extension-develop 2.0.0-rc.25 → 2.0.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-hmr-accept-code.js +113 -2
- package/dist/deprecated-shadow-root.js +116 -14
- package/dist/ensure-hmr-for-scripts.js +222 -2
- package/dist/inject-chromium-client-loader.js +110 -2
- package/dist/inject-firefox-client-loader.js +124 -9
- package/dist/minimum-chromium-file.js +5 -0
- package/dist/minimum-content-file.js +5 -0
- package/dist/minimum-firefox-file.js +5 -0
- package/dist/minimum-script-file.js +5 -0
- package/dist/module.d.ts +7 -96
- package/dist/module.js +6196 -128
- package/package.json +23 -14
- package/dist/958.js +0 -157742
- package/dist/958.js.LICENSE.txt +0 -14
- package/dist/depreacated-shadow-root.js +0 -34
- package/dist/dirname.d.ts +0 -1
- package/dist/inject-content-css-during-dev.js +0 -10
- package/dist/minimum-chromium-file.mjs +0 -1
- package/dist/minimum-content-file.mjs +0 -1
- package/dist/minimum-firefox-file.mjs +0 -1
- package/dist/minimum-script-file.mjs +0 -0
- package/dist/package-lock.json +0 -2542
- package/dist/package.json +0 -10
- package/dist/resolver-loader.js +0 -1
- package/dist/resolver-module.mjs +0 -1
- package/dist/tailwind.config.js +0 -25
|
@@ -1,11 +1,103 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>inject_firefox_client_loader
|
|
37
|
+
});
|
|
38
|
+
const external_path_namespaceObject = require("path");
|
|
39
|
+
const external_fs_namespaceObject = require("fs");
|
|
40
|
+
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
41
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
|
+
require("child_process");
|
|
43
|
+
require("package-manager-detector");
|
|
44
|
+
const external_chalk_namespaceObject = require("chalk");
|
|
45
|
+
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
46
|
+
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
47
|
+
const CHROMIUM_BASED_BROWSERS = [
|
|
48
|
+
'chrome',
|
|
49
|
+
'edge'
|
|
50
|
+
];
|
|
51
|
+
const GECKO_BASED_BROWSERS = [
|
|
52
|
+
'firefox'
|
|
53
|
+
];
|
|
54
|
+
[
|
|
55
|
+
...CHROMIUM_BASED_BROWSERS,
|
|
56
|
+
...GECKO_BASED_BROWSERS
|
|
57
|
+
];
|
|
58
|
+
require("console");
|
|
59
|
+
function getLoggingPrefix(feature, type) {
|
|
60
|
+
if ('error' === type) return `${external_chalk_default().bold(external_chalk_default().red('ERROR'))} in ${feature} ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
61
|
+
if ('warn' === type) return `${feature} ${external_chalk_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
62
|
+
const arrow = 'info' === type ? external_chalk_default().cyan("\u25BA\u25BA\u25BA") : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
63
|
+
return `${arrow} ${external_chalk_default().cyan(feature)}`;
|
|
64
|
+
}
|
|
65
|
+
function firefoxServiceWorkerError() {
|
|
66
|
+
return `${getLoggingPrefix('Firefox runner', 'error')} No Service Worker Support\n\nFirefox does not support the ${external_chalk_default().yellow('background.service_worker')} field yet.\nUpdate your manifest.json file to use ${external_chalk_default().yellow("background.scripts")} instead.\nIf you really need to keep the ${external_chalk_default().yellow('service_worker')} field, prefix it with\n${external_chalk_default().yellow('chromium:')} so it can target only Chromium-based browsers.\n\nMozilla bug: ${external_chalk_default().underline('https://bugzilla.mozilla.org/show_bug.cgi?id=1573659')}.`;
|
|
67
|
+
}
|
|
68
|
+
function filterKeysForThisBrowser(manifest, browser) {
|
|
69
|
+
const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
|
|
70
|
+
const indexOfColon = key.indexOf(':');
|
|
71
|
+
if (-1 === indexOfColon) return value;
|
|
72
|
+
const prefix = key.substring(0, indexOfColon);
|
|
73
|
+
if (prefix === browser || 'chromium' === prefix && CHROMIUM_BASED_BROWSERS.includes(browser) || 'chromium' === prefix && browser.includes('chromium') || 'gecko' === prefix && browser.includes('gecko')) this[key.substring(indexOfColon + 1)] = value;
|
|
74
|
+
});
|
|
75
|
+
return patchedManifest;
|
|
76
|
+
}
|
|
77
|
+
const schema = {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
test: {
|
|
81
|
+
type: 'string'
|
|
82
|
+
},
|
|
83
|
+
manifestPath: {
|
|
84
|
+
type: 'string'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function inject_firefox_client_loader(source) {
|
|
89
|
+
const options = this.getOptions();
|
|
90
|
+
const manifestPath = options.manifestPath;
|
|
91
|
+
const browser = options.browser;
|
|
92
|
+
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
93
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8'));
|
|
94
|
+
const patchedManifest = filterKeysForThisBrowser(manifest, browser);
|
|
95
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
96
|
+
name: 'reload:inject-background-client',
|
|
97
|
+
baseDataPath: 'options'
|
|
98
|
+
});
|
|
99
|
+
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
100
|
+
const generalReloadCode = `
|
|
9
101
|
;browser.runtime.onMessageExternal.addListener(async (request, _sender) => {
|
|
10
102
|
const managementInfo = await browser.management.getSelf()
|
|
11
103
|
|
|
@@ -33,4 +125,27 @@ Mozilla bug: ${(0,t.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=157
|
|
|
33
125
|
}
|
|
34
126
|
|
|
35
127
|
return {reloaded: true}
|
|
36
|
-
})
|
|
128
|
+
});`;
|
|
129
|
+
const manifestBg = patchedManifest.background;
|
|
130
|
+
if (patchedManifest.service_worker) {
|
|
131
|
+
console.log(firefoxServiceWorkerError());
|
|
132
|
+
return source;
|
|
133
|
+
}
|
|
134
|
+
if (manifestBg) {
|
|
135
|
+
const backgroundScripts = null == manifestBg ? void 0 : manifestBg.scripts;
|
|
136
|
+
if (backgroundScripts) for (const bgScript of [
|
|
137
|
+
backgroundScripts[0]
|
|
138
|
+
]){
|
|
139
|
+
const absoluteUrl = external_path_namespaceObject.resolve(projectPath, bgScript);
|
|
140
|
+
if (url.includes(absoluteUrl)) return `${generalReloadCode}${source}`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return source;
|
|
144
|
+
}
|
|
145
|
+
exports["default"] = __webpack_exports__["default"];
|
|
146
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
147
|
+
"default"
|
|
148
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
149
|
+
Object.defineProperty(exports, '__esModule', {
|
|
150
|
+
value: true
|
|
151
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var __webpack_exports__ = {};
|
|
1
2
|
chrome.runtime.onMessageExternal.addListener(async (request, _sender, sendResponse)=>{
|
|
2
3
|
const managementInfo = await new Promise((resolve)=>{
|
|
3
4
|
chrome.management.getSelf(resolve);
|
|
@@ -18,3 +19,7 @@ chrome.runtime.onMessageExternal.addListener(async (request, _sender, sendRespon
|
|
|
18
19
|
}
|
|
19
20
|
return true;
|
|
20
21
|
});
|
|
22
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
23
|
+
Object.defineProperty(exports, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var __webpack_exports__ = {};
|
|
1
2
|
browser.runtime.onMessageExternal.addListener(async (request, _sender)=>{
|
|
2
3
|
const managementInfo = await browser.management.getSelf();
|
|
3
4
|
if (request.initialLoadData) return {
|
|
@@ -10,3 +11,7 @@ browser.runtime.onMessageExternal.addListener(async (request, _sender)=>{
|
|
|
10
11
|
reloaded: true
|
|
11
12
|
};
|
|
12
13
|
});
|
|
14
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
15
|
+
Object.defineProperty(exports, '__esModule', {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
package/dist/module.d.ts
CHANGED
|
@@ -1,96 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
browser: BrowserType;
|
|
9
|
-
}
|
|
10
|
-
interface ChromiumOptions extends BrowserOptionsBase {
|
|
11
|
-
browser: 'chromium-based';
|
|
12
|
-
chromiumBinary?: string;
|
|
13
|
-
}
|
|
14
|
-
interface GeckoOptions extends BrowserOptionsBase {
|
|
15
|
-
browser: 'gecko-based';
|
|
16
|
-
geckoBinary?: string;
|
|
17
|
-
}
|
|
18
|
-
interface DevOptions extends BrowserOptionsBase {
|
|
19
|
-
mode: 'development' | 'production' | 'none';
|
|
20
|
-
polyfill?: boolean;
|
|
21
|
-
port?: number;
|
|
22
|
-
chromiumBinary?: ChromiumOptions['chromiumBinary'];
|
|
23
|
-
geckoBinary?: GeckoOptions['geckoBinary'];
|
|
24
|
-
}
|
|
25
|
-
interface BuildOptions {
|
|
26
|
-
browser: BrowserOptionsBase['browser'];
|
|
27
|
-
zipFilename?: string;
|
|
28
|
-
zip?: boolean;
|
|
29
|
-
zipSource?: boolean;
|
|
30
|
-
polyfill?: boolean;
|
|
31
|
-
silent?: boolean;
|
|
32
|
-
}
|
|
33
|
-
interface PreviewOptions extends BrowserOptionsBase {
|
|
34
|
-
mode: 'production';
|
|
35
|
-
chromiumBinary?: ChromiumOptions['chromiumBinary'];
|
|
36
|
-
geckoBinary?: GeckoOptions['geckoBinary'];
|
|
37
|
-
}
|
|
38
|
-
interface StartOptions extends BrowserOptionsBase {
|
|
39
|
-
mode: 'production';
|
|
40
|
-
polyfill?: boolean;
|
|
41
|
-
chromiumBinary?: ChromiumOptions['chromiumBinary'];
|
|
42
|
-
geckoBinary?: GeckoOptions['geckoBinary'];
|
|
43
|
-
}
|
|
44
|
-
interface BrowserConfig extends BrowserOptionsBase {
|
|
45
|
-
browserFlags?: string[];
|
|
46
|
-
preferences?: Record<string, unknown>;
|
|
47
|
-
chromiumBinary?: ChromiumOptions['chromiumBinary'];
|
|
48
|
-
geckoBinary?: GeckoOptions['geckoBinary'];
|
|
49
|
-
}
|
|
50
|
-
interface FileConfig {
|
|
51
|
-
browser?: {
|
|
52
|
-
chrome?: BrowserConfig;
|
|
53
|
-
firefox?: BrowserConfig;
|
|
54
|
-
edge?: BrowserConfig;
|
|
55
|
-
'chromium-based'?: BrowserConfig;
|
|
56
|
-
'gecko-based'?: BrowserConfig;
|
|
57
|
-
};
|
|
58
|
-
commands?: {
|
|
59
|
-
dev?: Pick<DevOptions, 'browser' | 'profile' | 'chromiumBinary' | 'geckoBinary' | 'open' | 'polyfill'> & {
|
|
60
|
-
browserFlags?: string[];
|
|
61
|
-
preferences?: Record<string, unknown>;
|
|
62
|
-
};
|
|
63
|
-
start?: Pick<StartOptions, 'browser' | 'profile' | 'chromiumBinary' | 'geckoBinary' | 'polyfill'> & {
|
|
64
|
-
browserFlags?: string[];
|
|
65
|
-
preferences?: Record<string, unknown>;
|
|
66
|
-
};
|
|
67
|
-
preview?: Pick<PreviewOptions, 'browser' | 'profile' | 'chromiumBinary' | 'geckoBinary'> & {
|
|
68
|
-
browserFlags?: string[];
|
|
69
|
-
preferences?: Record<string, unknown>;
|
|
70
|
-
};
|
|
71
|
-
build?: Pick<BuildOptions, 'browser' | 'zipFilename' | 'zip' | 'zipSource' | 'polyfill'>;
|
|
72
|
-
};
|
|
73
|
-
config?: (config: Configuration) => Configuration;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
declare function extensionBuild(pathOrRemoteUrl: string | undefined, buildOptions?: BuildOptions): Promise<void>;
|
|
77
|
-
|
|
78
|
-
declare function extensionDev(pathOrRemoteUrl: string | undefined, devOptions: DevOptions): Promise<void>;
|
|
79
|
-
|
|
80
|
-
declare function extensionPreview(pathOrRemoteUrl: string | undefined, previewOptions: PreviewOptions): Promise<void>;
|
|
81
|
-
|
|
82
|
-
declare function extensionStart(pathOrRemoteUrl: string | undefined, startOptions: StartOptions): Promise<void>;
|
|
83
|
-
|
|
84
|
-
type ChromeManifest = Partial<chrome.runtime.ManifestV2> & Partial<chrome.runtime.ManifestV3> & {
|
|
85
|
-
browser_action?: {
|
|
86
|
-
theme_icons?: ThemeIcon[];
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
type Manifest = ChromeManifest;
|
|
90
|
-
interface ThemeIcon {
|
|
91
|
-
light: string;
|
|
92
|
-
dark: string;
|
|
93
|
-
size?: number;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { type BuildOptions, type DevOptions, type FileConfig, type Manifest, type PreviewOptions, type StartOptions, extensionBuild, extensionDev, extensionPreview, extensionStart };
|
|
1
|
+
import { extensionBuild } from './commands/build';
|
|
2
|
+
import { extensionDev } from './commands/dev';
|
|
3
|
+
import { extensionPreview } from './commands/preview';
|
|
4
|
+
import { extensionStart } from './commands/start';
|
|
5
|
+
import { type FileConfig, type BuildOptions, type DevOptions, type PreviewOptions, type StartOptions } from './commands/commands-lib/config-types';
|
|
6
|
+
import { type Manifest } from './types';
|
|
7
|
+
export { extensionBuild, BuildOptions, extensionDev, DevOptions, extensionStart, StartOptions, extensionPreview, PreviewOptions, FileConfig, Manifest };
|