extension-develop 3.10.3 → 3.11.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} +3118 -504
- package/dist/ensure-hmr-for-scripts.cjs +50 -0
- package/dist/ensure-hmr-for-scripts.js +145 -0
- package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/{chromium/content_scripts/styles.24e59c3d.css → chrome/content_scripts/styles.5456c644.css} +1 -1
- package/dist/extension-js-devtools/chrome/manifest.json +1 -1
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/chrome/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/chrome/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
- package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/{edge/content_scripts/styles.24e59c3d.css → chromium/content_scripts/styles.5456c644.css} +1 -1
- package/dist/extension-js-devtools/chromium/manifest.json +1 -1
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/chromium/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/chromium/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
- package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/{firefox/content_scripts/styles.24e59c3d.css → edge/content_scripts/styles.5456c644.css} +1 -1
- package/dist/extension-js-devtools/edge/manifest.json +1 -1
- package/dist/extension-js-devtools/edge/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/edge/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/edge/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
- package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/{chrome/content_scripts/styles.24e59c3d.css → firefox/content_scripts/styles.5456c644.css} +1 -1
- package/dist/extension-js-devtools/firefox/manifest.json +2 -1
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/firefox/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/firefox/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
- package/dist/extension-js-theme/chrome/manifest.json +1 -1
- package/dist/extension-js-theme/chromium/manifest.json +1 -1
- package/dist/extension-js-theme/edge/manifest.json +1 -1
- package/dist/extension-js-theme/firefox/manifest.json +1 -1
- 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 +2098 -1784
- 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/warn-no-default-export.cjs +0 -356
- package/webpack/webpack-lib/optional-dependencies.json +0 -20
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
+
})();
|
|
3
12
|
(()=>{
|
|
4
13
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
14
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -26,7 +35,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
36
|
default: ()=>ensureHMRForScripts
|
|
28
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);
|
|
29
42
|
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
43
|
+
const EXTENSIONJS_CONTENT_SCRIPT_LAYER = "extensionjs-content-script";
|
|
30
44
|
const schema = {
|
|
31
45
|
type: 'object',
|
|
32
46
|
properties: {
|
|
@@ -43,9 +57,12 @@ const schema = {
|
|
|
43
57
|
additionalProperties: false
|
|
44
58
|
};
|
|
45
59
|
function ensureHMRForScripts(source) {
|
|
60
|
+
const debugHtmlHmr = '1' === process.env.EXTENSION_DEBUG_HTML_HMR_SKIP;
|
|
46
61
|
const resourceQuery = String(this.resourceQuery || '');
|
|
47
62
|
if (resourceQuery.includes('vue&type=')) return source;
|
|
48
63
|
const options = this.getOptions();
|
|
64
|
+
const resourcePath = String(this.resourcePath || '');
|
|
65
|
+
const moduleLayer = String(this?._module?.layer || '');
|
|
49
66
|
try {
|
|
50
67
|
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
51
68
|
name: "html:ensure-hmr-for-scripts",
|
|
@@ -54,6 +71,39 @@ function ensureHMRForScripts(source) {
|
|
|
54
71
|
} catch (error) {
|
|
55
72
|
throw error;
|
|
56
73
|
}
|
|
74
|
+
if (moduleLayer === EXTENSIONJS_CONTENT_SCRIPT_LAYER) {
|
|
75
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] skip layer resource=${resourcePath} layer=${moduleLayer}`);
|
|
76
|
+
return source;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const manifestPath = String(options?.manifestPath || '');
|
|
80
|
+
const manifestDir = manifestPath ? external_path_default().dirname(manifestPath) : '';
|
|
81
|
+
if (manifestPath && resourcePath) {
|
|
82
|
+
const manifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
|
|
83
|
+
const contentScripts = Array.isArray(manifest?.content_scripts) ? manifest.content_scripts : [];
|
|
84
|
+
const contentEntryPaths = new Set();
|
|
85
|
+
for (const contentScript of contentScripts){
|
|
86
|
+
const jsList = Array.isArray(contentScript?.js) ? contentScript.js : [];
|
|
87
|
+
for (const jsFile of jsList)contentEntryPaths.add(external_path_default().normalize(external_path_default().resolve(manifestDir, jsFile)));
|
|
88
|
+
}
|
|
89
|
+
if (contentEntryPaths.has(external_path_default().normalize(resourcePath))) {
|
|
90
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] skip direct resource=${resourcePath} manifest=${manifestPath}`);
|
|
91
|
+
return source;
|
|
92
|
+
}
|
|
93
|
+
let issuer = this?._module?.issuer;
|
|
94
|
+
while(issuer){
|
|
95
|
+
const issuerResource = String(issuer?.resource || issuer?.userRequest || '');
|
|
96
|
+
if (issuerResource && contentEntryPaths.has(external_path_default().normalize(issuerResource))) {
|
|
97
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] skip issuer resource=${resourcePath} issuer=${issuerResource}`);
|
|
98
|
+
return source;
|
|
99
|
+
}
|
|
100
|
+
issuer = issuer?.issuer;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] error resource=${resourcePath} manifest=${String(options?.manifestPath || '')} error=${error instanceof Error ? error.message : String(error)}`);
|
|
105
|
+
}
|
|
106
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] inject resource=${resourcePath} manifest=${String(options?.manifestPath || '')} layer=${moduleLayer || '<none>'}`);
|
|
57
107
|
const reloadCode = `
|
|
58
108
|
if (import.meta.webpackHot) {
|
|
59
109
|
try {
|
|
@@ -0,0 +1,145 @@
|
|
|
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: ()=>ensureHMRForScripts
|
|
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 EXTENSIONJS_CONTENT_SCRIPT_LAYER = "extensionjs-content-script";
|
|
44
|
+
const schema = {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
test: {
|
|
48
|
+
type: 'string'
|
|
49
|
+
},
|
|
50
|
+
manifestPath: {
|
|
51
|
+
type: 'string'
|
|
52
|
+
},
|
|
53
|
+
includeList: {
|
|
54
|
+
type: 'object'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
};
|
|
59
|
+
function ensureHMRForScripts(source) {
|
|
60
|
+
const debugHtmlHmr = '1' === process.env.EXTENSION_DEBUG_HTML_HMR_SKIP;
|
|
61
|
+
const resourceQuery = String(this.resourceQuery || '');
|
|
62
|
+
if (resourceQuery.includes('vue&type=')) return source;
|
|
63
|
+
const options = this.getOptions();
|
|
64
|
+
const resourcePath = String(this.resourcePath || '');
|
|
65
|
+
const moduleLayer = String(this?._module?.layer || '');
|
|
66
|
+
try {
|
|
67
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
68
|
+
name: "html:ensure-hmr-for-scripts",
|
|
69
|
+
baseDataPath: 'options'
|
|
70
|
+
});
|
|
71
|
+
} catch (error) {
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
if (moduleLayer === EXTENSIONJS_CONTENT_SCRIPT_LAYER) {
|
|
75
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] skip layer resource=${resourcePath} layer=${moduleLayer}`);
|
|
76
|
+
return source;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const manifestPath = String(options?.manifestPath || '');
|
|
80
|
+
const manifestDir = manifestPath ? external_path_default().dirname(manifestPath) : '';
|
|
81
|
+
if (manifestPath && resourcePath) {
|
|
82
|
+
const manifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
|
|
83
|
+
const contentScripts = Array.isArray(manifest?.content_scripts) ? manifest.content_scripts : [];
|
|
84
|
+
const contentEntryPaths = new Set();
|
|
85
|
+
for (const contentScript of contentScripts){
|
|
86
|
+
const jsList = Array.isArray(contentScript?.js) ? contentScript.js : [];
|
|
87
|
+
for (const jsFile of jsList)contentEntryPaths.add(external_path_default().normalize(external_path_default().resolve(manifestDir, jsFile)));
|
|
88
|
+
}
|
|
89
|
+
if (contentEntryPaths.has(external_path_default().normalize(resourcePath))) {
|
|
90
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] skip direct resource=${resourcePath} manifest=${manifestPath}`);
|
|
91
|
+
return source;
|
|
92
|
+
}
|
|
93
|
+
let issuer = this?._module?.issuer;
|
|
94
|
+
while(issuer){
|
|
95
|
+
const issuerResource = String(issuer?.resource || issuer?.userRequest || '');
|
|
96
|
+
if (issuerResource && contentEntryPaths.has(external_path_default().normalize(issuerResource))) {
|
|
97
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] skip issuer resource=${resourcePath} issuer=${issuerResource}`);
|
|
98
|
+
return source;
|
|
99
|
+
}
|
|
100
|
+
issuer = issuer?.issuer;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] error resource=${resourcePath} manifest=${String(options?.manifestPath || '')} error=${error instanceof Error ? error.message : String(error)}`);
|
|
105
|
+
}
|
|
106
|
+
if (debugHtmlHmr) console.log(`[extjs:html-hmr] inject resource=${resourcePath} manifest=${String(options?.manifestPath || '')} layer=${moduleLayer || '<none>'}`);
|
|
107
|
+
const reloadCode = `
|
|
108
|
+
if (import.meta.webpackHot) {
|
|
109
|
+
try {
|
|
110
|
+
// Accept updates for HTML-attached scripts and clear common containers
|
|
111
|
+
import.meta.webpackHot.accept();
|
|
112
|
+
import.meta.webpackHot.dispose(function() {
|
|
113
|
+
try {
|
|
114
|
+
var clear = function(el) {
|
|
115
|
+
if (!el) return;
|
|
116
|
+
while (el.firstChild) el.removeChild(el.firstChild);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Clear default template container
|
|
120
|
+
clear(document.getElementById('app'));
|
|
121
|
+
|
|
122
|
+
// Also clear any extension-root wrappers if present
|
|
123
|
+
var roots = document.querySelectorAll('[data-extension-root]');
|
|
124
|
+
roots.forEach(function(node) {
|
|
125
|
+
clear(node);
|
|
126
|
+
});
|
|
127
|
+
} catch (err) {
|
|
128
|
+
// 'err' is local in this catch, keep for error clarity
|
|
129
|
+
console.error('Error clearing HTML containers', err);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.error('Error accepting HMR', error);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
return `${reloadCode}${source}`;
|
|
138
|
+
}
|
|
139
|
+
exports["default"] = __webpack_exports__["default"];
|
|
140
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
141
|
+
"default"
|
|
142
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
143
|
+
Object.defineProperty(exports, '__esModule', {
|
|
144
|
+
value: true
|
|
145
|
+
});
|