extension-develop 3.10.2 → 3.10.4-canary.1
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/215.cjs +350 -69
- package/dist/323.cjs +456 -26
- package/dist/324.cjs +15 -9
- package/dist/{270.cjs → 677.cjs} +3121 -494
- package/dist/ensure-hmr-for-scripts.cjs +50 -0
- package/dist/ensure-hmr-for-scripts.js +145 -0
- package/dist/feature-scripts-content-script-wrapper.cjs +237 -0
- package/dist/feature-scripts-content-script-wrapper.js +237 -0
- package/dist/main-world-bridge.js +127 -0
- package/dist/minimum-chromium-file.js +10 -0
- package/dist/minimum-firefox-file.js +10 -0
- package/dist/minimum-script-file.js +31 -0
- package/dist/module.cjs +2072 -1755
- package/dist/package.json +3 -0
- package/dist/resolve-paths-loader.js +1350 -0
- package/package.json +5 -5
- package/dist/add-hmr-accept-code.cjs +0 -91
- package/dist/content-script-wrapper.cjs +0 -319
- package/dist/extension-js-devtools/chrome/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/chrome/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/chrome/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/chrome/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/chrome/background/service_worker.js +0 -26
- package/dist/extension-js-devtools/chrome/chrome_url_overrides/newtab.html +0 -23
- package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/chrome/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/chrome/devtools/index.html +0 -12
- package/dist/extension-js-devtools/chrome/devtools/index.js +0 -1
- package/dist/extension-js-devtools/chrome/icons/logo.png +0 -0
- package/dist/extension-js-devtools/chrome/manifest.json +0 -57
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/chrome/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/chrome/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/chrome/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/chrome/scripts/logger-client.js +0 -1
- package/dist/extension-js-devtools/chromium/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/chromium/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/chromium/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/chromium/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/chromium/background/service_worker.js +0 -26
- package/dist/extension-js-devtools/chromium/chrome_url_overrides/newtab.html +0 -23
- package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/chromium/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/chromium/devtools/index.html +0 -12
- package/dist/extension-js-devtools/chromium/devtools/index.js +0 -1
- package/dist/extension-js-devtools/chromium/icons/logo.png +0 -0
- package/dist/extension-js-devtools/chromium/manifest.json +0 -57
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/chromium/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/chromium/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/chromium/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/chromium/scripts/logger-client.js +0 -1
- package/dist/extension-js-devtools/edge/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/edge/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/edge/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/edge/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/edge/background/service_worker.js +0 -26
- package/dist/extension-js-devtools/edge/chrome_url_overrides/newtab.html +0 -23
- package/dist/extension-js-devtools/edge/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/edge/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/edge/devtools/index.html +0 -12
- package/dist/extension-js-devtools/edge/devtools/index.js +0 -1
- package/dist/extension-js-devtools/edge/icons/logo.png +0 -0
- package/dist/extension-js-devtools/edge/manifest.json +0 -57
- package/dist/extension-js-devtools/edge/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/edge/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/edge/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/edge/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/edge/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/edge/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/edge/scripts/logger-client.js +0 -1
- package/dist/extension-js-devtools/firefox/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/firefox/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/firefox/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/firefox/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/firefox/background/scripts.js +0 -26
- package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/firefox/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/firefox/devtools/index.html +0 -12
- package/dist/extension-js-devtools/firefox/devtools/index.js +0 -1
- package/dist/extension-js-devtools/firefox/icons/logo.png +0 -0
- package/dist/extension-js-devtools/firefox/manifest.json +0 -42
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/firefox/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/firefox/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/firefox/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/firefox/scripts/logger-client.js +0 -1
- package/dist/extension-js-theme/chrome/manifest.json +0 -66
- package/dist/extension-js-theme/chromium/manifest.json +0 -66
- package/dist/extension-js-theme/edge/manifest.json +0 -66
- package/dist/extension-js-theme/firefox/manifest.json +0 -66
- package/dist/warn-no-default-export.cjs +0 -356
- package/webpack/webpack-lib/optional-dependencies.json +0 -20
|
@@ -0,0 +1,237 @@
|
|
|
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 ("u" > 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: ()=>contentScriptWrapper
|
|
37
|
+
});
|
|
38
|
+
const external_fs_namespaceObject = require("fs");
|
|
39
|
+
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
40
|
+
const external_path_namespaceObject = require("path");
|
|
41
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
42
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
43
|
+
const core_namespaceObject = require("@swc/core");
|
|
44
|
+
const CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX = "content_scripts/content-";
|
|
45
|
+
function getCanonicalContentScriptEntryName(index) {
|
|
46
|
+
return `${CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX}${index}`;
|
|
47
|
+
}
|
|
48
|
+
function findUpLocalSync(filename, options) {
|
|
49
|
+
const root = external_path_namespaceObject.parse(options.cwd).root;
|
|
50
|
+
let currentDir = options.cwd;
|
|
51
|
+
while(true){
|
|
52
|
+
const candidate = external_path_namespaceObject.join(currentDir, filename);
|
|
53
|
+
try {
|
|
54
|
+
const stat = external_fs_namespaceObject.statSync(candidate);
|
|
55
|
+
if (stat.isFile()) return candidate;
|
|
56
|
+
} catch {}
|
|
57
|
+
if (currentDir === root) return;
|
|
58
|
+
currentDir = external_path_namespaceObject.dirname(currentDir);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function findNearestPackageJsonSync(manifestPath) {
|
|
62
|
+
try {
|
|
63
|
+
const manifestDir = external_path_namespaceObject.dirname(manifestPath);
|
|
64
|
+
return findUpLocalSync('package.json', {
|
|
65
|
+
cwd: manifestDir
|
|
66
|
+
}) || null;
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const schema = {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
manifestPath: {
|
|
75
|
+
type: 'string'
|
|
76
|
+
},
|
|
77
|
+
mode: {
|
|
78
|
+
type: 'string'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function getSourceSignature(source) {
|
|
83
|
+
const head = String(source || '').slice(0, 64);
|
|
84
|
+
const tail = String(source || '').slice(-64);
|
|
85
|
+
return `${String(source || '').length}:${head}:${tail}`;
|
|
86
|
+
}
|
|
87
|
+
function createBuildToken(source) {
|
|
88
|
+
let hash = 0;
|
|
89
|
+
for(let index = 0; index < source.length; index++)hash = 31 * hash + source.charCodeAt(index) >>> 0;
|
|
90
|
+
return hash.toString(16);
|
|
91
|
+
}
|
|
92
|
+
function collectStyleAssetSpecifiers(source) {
|
|
93
|
+
const styleSpecifiers = new Set();
|
|
94
|
+
const patterns = [
|
|
95
|
+
/import\s+(?:[^'"`]*from\s*)?["']([^"'`]+\.(?:css|scss|sass|less|styl)(?:\?[^"'`]+)?)["']/g,
|
|
96
|
+
/require\(\s*["']([^"'`]+\.(?:css|scss|sass|less|styl)(?:\?[^"'`]+)?)["']\s*\)/g
|
|
97
|
+
];
|
|
98
|
+
for (const pattern of patterns){
|
|
99
|
+
let match = pattern.exec(source);
|
|
100
|
+
while(match){
|
|
101
|
+
const specifier = String(match[1] || '').trim();
|
|
102
|
+
if (specifier && !/(?:^|[?&])url(?:[=&]|$)/.test(specifier) && !/(?:^|[?&])raw(?:[=&]|$)/.test(specifier)) styleSpecifiers.add(specifier);
|
|
103
|
+
match = pattern.exec(source);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return Array.from(styleSpecifiers);
|
|
107
|
+
}
|
|
108
|
+
function hasDefaultExport(source, resourcePath, compilation) {
|
|
109
|
+
try {
|
|
110
|
+
const ext = external_path_default().extname(resourcePath).toLowerCase();
|
|
111
|
+
const isTS = '.ts' === ext || '.tsx' === ext || '.mts' === ext || '.mtsx' === ext;
|
|
112
|
+
const isJSX = '.jsx' === ext || '.tsx' === ext || '.mjsx' === ext || '.mtsx' === ext;
|
|
113
|
+
const abs = external_path_default().normalize(resourcePath);
|
|
114
|
+
const sig = getSourceSignature(source);
|
|
115
|
+
if (compilation) {
|
|
116
|
+
compilation.__extjsHasDefaultExportCache ??= new Map();
|
|
117
|
+
const cacheKey = `${abs}|${sig}`;
|
|
118
|
+
const cached = compilation.__extjsHasDefaultExportCache.get(cacheKey);
|
|
119
|
+
if ('boolean' == typeof cached) return cached;
|
|
120
|
+
}
|
|
121
|
+
const ast = (0, core_namespaceObject.parseSync)(source, {
|
|
122
|
+
syntax: isTS ? "typescript" : "ecmascript",
|
|
123
|
+
tsx: isTS && isJSX,
|
|
124
|
+
jsx: !isTS && isJSX,
|
|
125
|
+
decorators: true,
|
|
126
|
+
dynamicImport: true,
|
|
127
|
+
importAssertions: true,
|
|
128
|
+
topLevelAwait: true
|
|
129
|
+
});
|
|
130
|
+
const body = Array.isArray(ast?.body) ? ast.body : [];
|
|
131
|
+
for (const item of body)if (item && 'object' == typeof item) {
|
|
132
|
+
if ('ExportDefaultDeclaration' === item.type || 'ExportDefaultExpression' === item.type) {
|
|
133
|
+
compilation?.__extjsHasDefaultExportCache?.set(`${abs}|${sig}`, true);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if ('ExportNamedDeclaration' === item.type && Array.isArray(item.specifiers)) {
|
|
137
|
+
for (const specifier of item.specifiers)if (specifier && 'object' == typeof specifier) {
|
|
138
|
+
if ('ExportDefaultSpecifier' === specifier.type) {
|
|
139
|
+
compilation?.__extjsHasDefaultExportCache?.set(`${abs}|${sig}`, true);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
if ('ExportSpecifier' === specifier.type) {
|
|
143
|
+
const exported = specifier.exported;
|
|
144
|
+
if (exported && 'object' == typeof exported && ('Identifier' === exported.type && 'default' === exported.value || 'Ident' === exported.type && 'default' === exported.value || 'Str' === exported.type && 'default' === exported.value)) {
|
|
145
|
+
compilation?.__extjsHasDefaultExportCache?.set(`${abs}|${sig}`, true);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
compilation?.__extjsHasDefaultExportCache?.set(`${abs}|${sig}`, false);
|
|
153
|
+
return false;
|
|
154
|
+
} catch {
|
|
155
|
+
const fallback = source.includes('export default');
|
|
156
|
+
try {
|
|
157
|
+
compilation?.__extjsHasDefaultExportCache?.set(`${external_path_default().normalize(resourcePath)}|${getSourceSignature(source)}`, fallback);
|
|
158
|
+
} catch {}
|
|
159
|
+
return fallback;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function contentScriptWrapper(source) {
|
|
163
|
+
const options = this.getOptions();
|
|
164
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
165
|
+
name: "scripts:content-script-wrapper",
|
|
166
|
+
baseDataPath: 'options'
|
|
167
|
+
});
|
|
168
|
+
const compilation = this._compilation;
|
|
169
|
+
const manifestPath = options.manifestPath;
|
|
170
|
+
const manifestDir = external_path_default().dirname(manifestPath);
|
|
171
|
+
const packageJsonPath = findNearestPackageJsonSync(manifestPath);
|
|
172
|
+
const packageJsonDir = packageJsonPath ? external_path_default().dirname(packageJsonPath) : manifestDir;
|
|
173
|
+
const manifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
|
|
174
|
+
const isProd = 'production' === String(options && options.mode || '').toLowerCase();
|
|
175
|
+
const rewrittenSource = String(source);
|
|
176
|
+
const declaredContentJsAbsEntries = [];
|
|
177
|
+
const contentScripts = Array.isArray(manifest.content_scripts) ? manifest.content_scripts : [];
|
|
178
|
+
for(let index = 0; index < contentScripts.length; index++){
|
|
179
|
+
const contentScript = contentScripts[index];
|
|
180
|
+
const jsList = Array.isArray(contentScript?.js) ? contentScript.js : [];
|
|
181
|
+
const runAtRaw = 'string' == typeof contentScript?.run_at ? contentScript.run_at : 'document_idle';
|
|
182
|
+
const runAt = 'document_start' === runAtRaw || 'document_end' === runAtRaw || 'document_idle' === runAtRaw ? runAtRaw : 'document_idle';
|
|
183
|
+
for(let scriptIndex = 0; scriptIndex < jsList.length; scriptIndex++){
|
|
184
|
+
const jsFile = jsList[scriptIndex];
|
|
185
|
+
declaredContentJsAbsEntries.push({
|
|
186
|
+
abs: external_path_default().resolve(manifestDir, jsFile),
|
|
187
|
+
runAt,
|
|
188
|
+
index,
|
|
189
|
+
scriptIndex
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const resourceAbsPath = external_path_default().normalize(this.resourcePath);
|
|
194
|
+
const declaredEntry = declaredContentJsAbsEntries.find((entry)=>resourceAbsPath === external_path_default().normalize(entry.abs));
|
|
195
|
+
const scriptsDir = external_path_default().resolve(packageJsonDir, "scripts");
|
|
196
|
+
const relToScripts = external_path_default().relative(scriptsDir, resourceAbsPath);
|
|
197
|
+
const isScriptsFolderScript = relToScripts && !relToScripts.startsWith('..') && !external_path_default().isAbsolute(relToScripts);
|
|
198
|
+
const isContentScriptLike = Boolean(declaredEntry || isScriptsFolderScript);
|
|
199
|
+
if (!isContentScriptLike) return rewrittenSource;
|
|
200
|
+
const runAt = declaredEntry?.runAt || 'document_idle';
|
|
201
|
+
const bundleKey = declaredEntry ? getCanonicalContentScriptEntryName(declaredEntry.index) : `scripts/${String(relToScripts || '').replace(/\\/g, '/')}`;
|
|
202
|
+
const reinjectKey = declaredEntry ? `${bundleKey}::script-${declaredEntry.scriptIndex}` : bundleKey;
|
|
203
|
+
const buildToken = createBuildToken(rewrittenSource);
|
|
204
|
+
const cssAssetSpecifiers = collectStyleAssetSpecifiers(rewrittenSource);
|
|
205
|
+
const cssAssetUrlsInline = `var __EXTENSIONJS_BUNDLE_CSS_URLS=[${cssAssetSpecifiers.map((specifier)=>`(function(){ try { return String(new URL(${JSON.stringify(specifier)}, import.meta.url)); } catch (error) { return ""; } })()`).join(',')}];\n`;
|
|
206
|
+
const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat([__EXTENSIONJS_runtimeGetURL(__EXTENSIONJS_BUNDLE_KEY + ".css")]).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = sr.querySelector("style[data-extjs-bundle-css=\\"true\\"]");\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
|
|
207
|
+
const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (current && typeof current.getAttribute === "function" && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", String(__EXTENSIONJS_REINJECT_KEY || ""));\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = String(__EXTENSIONJS_REINJECT_KEY || "");\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === String(__EXTENSIONJS_REINJECT_KEY || "")) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + String(__EXTENSIONJS_REINJECT_KEY || "").replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\ntry { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\ntry { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\ntry { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
|
|
208
|
+
const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("[extension.js] content script default export failed to run", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
|
|
209
|
+
if (!hasDefaultExport(rewrittenSource, this.resourcePath, compilation)) return `var __EXTJS_WRAPPER_KIND="FS3_INLINE";\n${bootstrap}${runtimeInline}${rewrittenSource}\ntry { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\ntry { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\ntry { __EXTENSIONJS_scheduleBundleCssHydration() } catch (error) {}\ntry { __EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY] = { cleanup: __EXTENSIONJS_composeCleanup(null), generation: Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, build: __EXTENSIONJS_REINJECT_BUILD_TOKEN }; } catch (error) {}\n`;
|
|
210
|
+
const replaced = rewrittenSource.replace(/\bexport\s+default\b/, 'const __EXTENSIONJS_default__ =');
|
|
211
|
+
let defaultName;
|
|
212
|
+
{
|
|
213
|
+
const matchFunction = rewrittenSource.match(/\bexport\s+default\s+function\s+([A-Za-z_$][\w$]*)\s*\(/);
|
|
214
|
+
if (matchFunction) defaultName = matchFunction[1];
|
|
215
|
+
else {
|
|
216
|
+
const matchIdentifier = rewrittenSource.match(/\bexport\s+default\s+([A-Za-z_$][\w$]*)\b/);
|
|
217
|
+
if (matchIdentifier) defaultName = matchIdentifier[1];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
let cleaned = replaced;
|
|
221
|
+
if (defaultName) {
|
|
222
|
+
const callPattern = new RegExp(`(^|\\n|;)\\s*${defaultName}\\s*\\(\\s*\\)\\s*;?\\s*(?=\\n|$)`, 'g');
|
|
223
|
+
const next = cleaned.replace(callPattern, (_match, prefix)=>prefix || '\n');
|
|
224
|
+
if (next !== cleaned) {
|
|
225
|
+
cleaned = next;
|
|
226
|
+
this.emitWarning?.(new Error(`Removed direct call to ${defaultName}() to prevent double mount; wrapper handles mounting.`));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return `var __EXTJS_WRAPPER_KIND="FS3_INLINE";\n${bootstrap}${runtimeInline}${cleaned}\n;/* __EXTENSIONJS_MOUNT_WRAPPED__ */\nvar __EXTENSIONJS_cleanup = function(){};\ntry { __EXTENSIONJS_cleanup = __EXTENSIONJS_mount(__EXTENSIONJS_default__, ${JSON.stringify(runAt)}) } catch (error) {}\ntry { __EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY] = __EXTENSIONJS_cleanup } catch (error) {}\nexport default __EXTENSIONJS_default__\n`;
|
|
230
|
+
}
|
|
231
|
+
exports["default"] = __webpack_exports__["default"];
|
|
232
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
233
|
+
"default"
|
|
234
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
235
|
+
Object.defineProperty(exports, '__esModule', {
|
|
236
|
+
value: true
|
|
237
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
const EXTJS_MARK = '__extjs__';
|
|
16
|
+
const REQ_TYPE = 'EXTJS_WTW_LOAD';
|
|
17
|
+
const RES_TYPE = 'EXTJS_WTW_LOADED';
|
|
18
|
+
const EXTJS_BASE_KEY = '__EXTJS_EXTENSION_BASE__';
|
|
19
|
+
const EXTJS_BASE_ATTR = 'data-extjs-extension-base';
|
|
20
|
+
function safeString(x) {
|
|
21
|
+
return 'string' == typeof x && x.length > 0;
|
|
22
|
+
}
|
|
23
|
+
function hasForbiddenProtocol(url) {
|
|
24
|
+
return /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(url) && !/^((chrome|moz)-extension):\/\//.test(url);
|
|
25
|
+
}
|
|
26
|
+
function getRuntime() {
|
|
27
|
+
try {
|
|
28
|
+
if ('object' == typeof globalThis.browser) return globalThis.browser;
|
|
29
|
+
} catch {}
|
|
30
|
+
try {
|
|
31
|
+
if ('object' == typeof globalThis.chrome) return globalThis.chrome;
|
|
32
|
+
} catch {}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function setExtensionBaseUrl() {
|
|
36
|
+
try {
|
|
37
|
+
const rt = getRuntime();
|
|
38
|
+
const getURL = rt?.runtime?.getURL;
|
|
39
|
+
if ('function' != typeof getURL) return;
|
|
40
|
+
const base = String(getURL('/'));
|
|
41
|
+
if (base) {
|
|
42
|
+
window[EXTJS_BASE_KEY] = base;
|
|
43
|
+
try {
|
|
44
|
+
const docEl = document && document.documentElement;
|
|
45
|
+
if (docEl && 'function' == typeof docEl.setAttribute) docEl.setAttribute(EXTJS_BASE_ATTR, base);
|
|
46
|
+
} catch {}
|
|
47
|
+
}
|
|
48
|
+
} catch {}
|
|
49
|
+
}
|
|
50
|
+
setExtensionBaseUrl();
|
|
51
|
+
function resolveExtensionUrl(inputUrl) {
|
|
52
|
+
if (!safeString(inputUrl)) return null;
|
|
53
|
+
if (hasForbiddenProtocol(inputUrl)) return null;
|
|
54
|
+
if (/^((chrome|moz)-extension):\/\//.test(inputUrl)) return inputUrl;
|
|
55
|
+
const rt = getRuntime();
|
|
56
|
+
const getURL = rt?.runtime?.getURL;
|
|
57
|
+
if ('function' != typeof getURL) return null;
|
|
58
|
+
let p = inputUrl;
|
|
59
|
+
try {
|
|
60
|
+
if (p.startsWith('/')) p = new URL('https://example.invalid' + p).pathname;
|
|
61
|
+
else if (p.includes('?') || p.includes('#')) p = p.split('?')[0].split('#')[0];
|
|
62
|
+
} catch {}
|
|
63
|
+
if (!p) return null;
|
|
64
|
+
if (!p.startsWith('/')) p = '/' + p;
|
|
65
|
+
return String(getURL(p));
|
|
66
|
+
}
|
|
67
|
+
function injectScript(src) {
|
|
68
|
+
return new Promise((resolve, reject)=>{
|
|
69
|
+
const el = document.createElement("script");
|
|
70
|
+
el.src = src;
|
|
71
|
+
el.async = false;
|
|
72
|
+
el.onload = ()=>{
|
|
73
|
+
try {
|
|
74
|
+
el.remove();
|
|
75
|
+
} catch {}
|
|
76
|
+
resolve();
|
|
77
|
+
};
|
|
78
|
+
el.onerror = ()=>{
|
|
79
|
+
try {
|
|
80
|
+
el.remove();
|
|
81
|
+
} catch {}
|
|
82
|
+
reject(new Error("Failed to load script: " + src));
|
|
83
|
+
};
|
|
84
|
+
(document.head || document.documentElement).appendChild(el);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function postResponse(res) {
|
|
88
|
+
try {
|
|
89
|
+
window.postMessage(res, '*');
|
|
90
|
+
} catch {}
|
|
91
|
+
}
|
|
92
|
+
window.addEventListener('message', (event)=>{
|
|
93
|
+
if (event.source !== window) return;
|
|
94
|
+
const data = event.data;
|
|
95
|
+
if (!data || true !== data[EXTJS_MARK]) return;
|
|
96
|
+
if (data.type !== REQ_TYPE) return;
|
|
97
|
+
if (!safeString(data.requestId) || !safeString(data.url)) return;
|
|
98
|
+
const requestId = data.requestId;
|
|
99
|
+
const resolved = resolveExtensionUrl(data.url);
|
|
100
|
+
if (!resolved) return void postResponse({
|
|
101
|
+
[EXTJS_MARK]: true,
|
|
102
|
+
type: RES_TYPE,
|
|
103
|
+
requestId,
|
|
104
|
+
ok: false,
|
|
105
|
+
error: 'No extension runtime available to resolve URL'
|
|
106
|
+
});
|
|
107
|
+
injectScript(resolved).then(()=>{
|
|
108
|
+
postResponse({
|
|
109
|
+
[EXTJS_MARK]: true,
|
|
110
|
+
type: RES_TYPE,
|
|
111
|
+
requestId,
|
|
112
|
+
ok: true
|
|
113
|
+
});
|
|
114
|
+
}).catch((e)=>{
|
|
115
|
+
postResponse({
|
|
116
|
+
[EXTJS_MARK]: true,
|
|
117
|
+
type: RES_TYPE,
|
|
118
|
+
requestId,
|
|
119
|
+
ok: false,
|
|
120
|
+
error: e instanceof Error ? e.message : String(e)
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
125
|
+
Object.defineProperty(exports, '__esModule', {
|
|
126
|
+
value: true
|
|
127
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __webpack_exports__ = {};
|
|
2
|
+
try {
|
|
3
|
+
const loc = globalThis?.location;
|
|
4
|
+
if (loc && 'function' != typeof loc.reload) loc.reload = ()=>{};
|
|
5
|
+
} catch {}
|
|
6
|
+
console.log('Minimum Chromium file loaded for reload purposes');
|
|
7
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
8
|
+
Object.defineProperty(exports, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __webpack_exports__ = {};
|
|
2
|
+
try {
|
|
3
|
+
const loc = globalThis?.location;
|
|
4
|
+
if (loc && 'function' != typeof loc.reload) loc.reload = ()=>{};
|
|
5
|
+
} catch {}
|
|
6
|
+
console.log('Minimum Firefox file loaded for reload purposes');
|
|
7
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
8
|
+
Object.defineProperty(exports, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
const safeLocation = "u" > typeof globalThis ? globalThis.location : void 0;
|
|
16
|
+
const safeHistory = "u" > typeof globalThis ? globalThis.history : void 0;
|
|
17
|
+
try {
|
|
18
|
+
if ('object' == typeof safeLocation && safeLocation && String(safeLocation.protocol || '').includes('-extension:')) {
|
|
19
|
+
const q = String(safeLocation.search || '');
|
|
20
|
+
if (q.toLowerCase().includes('webpack-dev-server-hot=false')) ;
|
|
21
|
+
else if ('function' == typeof URL && 'object' == typeof safeHistory && safeHistory && 'function' == typeof safeHistory.replaceState) {
|
|
22
|
+
const u = new URL(String(safeLocation.href));
|
|
23
|
+
u.searchParams.set('webpack-dev-server-hot', 'false');
|
|
24
|
+
safeHistory.replaceState(null, '', u.toString());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} catch {}
|
|
28
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
29
|
+
Object.defineProperty(exports, '__esModule', {
|
|
30
|
+
value: true
|
|
31
|
+
});
|