feat: add cross-browser browser.*/chrome.* shim; exclude test/ from builds
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
'use strict';
|
||||
// Cross-browser API namespace. Firefox provides Promise-based `browser.*`;
|
||||
// Chrome MV3 exposes `browser.*` too, but some builds only populate the
|
||||
// `chrome.*` global. Alias to whichever is present.
|
||||
if (typeof browser === 'undefined' || browser == null) {
|
||||
var browser = (typeof chrome !== 'undefined' ? chrome : {});
|
||||
}
|
||||
|
||||
function errMsg(err) {
|
||||
return String((err && err.message) || err);
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Cross-browser API namespace (see background.js). No-op in Firefox.
|
||||
if (typeof browser === 'undefined' || browser == null) {
|
||||
var browser = (typeof chrome !== 'undefined' ? chrome : {});
|
||||
}
|
||||
|
||||
const MASTER_KEY = 'enabled';
|
||||
|
||||
async function isEnabled() {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
// Cross-browser API namespace (see background.js). No-op in Firefox.
|
||||
if (typeof browser === 'undefined' || browser == null) {
|
||||
var browser = (typeof chrome !== 'undefined' ? chrome : {});
|
||||
}
|
||||
|
||||
const $ = (sel) => document.querySelector(sel);
|
||||
|
||||
const MASTER_KEY = 'enabled';
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ function collectFiles(srcDir, out = [], prefix = '') {
|
||||
const abs = path.join(srcDir, entry);
|
||||
const rel = prefix ? prefix + '/' + entry : entry;
|
||||
if (entry === '.git' || entry === 'node_modules' || entry === 'dist' ||
|
||||
entry === 'docs' || entry === 'scripts' || entry === 'manifest.json' ||
|
||||
entry.startsWith('.')) {
|
||||
entry === 'docs' || entry === 'scripts' || entry === 'test' ||
|
||||
entry === 'manifest.json' || entry.startsWith('.')) {
|
||||
continue;
|
||||
}
|
||||
if (fs.statSync(abs).isDirectory()) collectFiles(abs, out, rel);
|
||||
|
||||
Reference in New Issue
Block a user