extension-develop 3.10.3 → 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.
Files changed (99) hide show
  1. package/dist/215.cjs +350 -69
  2. package/dist/323.cjs +456 -26
  3. package/dist/324.cjs +15 -9
  4. package/dist/{270.cjs → 677.cjs} +3118 -504
  5. package/dist/ensure-hmr-for-scripts.cjs +50 -0
  6. package/dist/ensure-hmr-for-scripts.js +145 -0
  7. package/dist/feature-scripts-content-script-wrapper.cjs +237 -0
  8. package/dist/feature-scripts-content-script-wrapper.js +237 -0
  9. package/dist/main-world-bridge.js +127 -0
  10. package/dist/minimum-chromium-file.js +10 -0
  11. package/dist/minimum-firefox-file.js +10 -0
  12. package/dist/minimum-script-file.js +31 -0
  13. package/dist/module.cjs +1999 -1690
  14. package/dist/package.json +3 -0
  15. package/dist/resolve-paths-loader.js +1350 -0
  16. package/package.json +5 -5
  17. package/dist/add-hmr-accept-code.cjs +0 -91
  18. package/dist/content-script-wrapper.cjs +0 -319
  19. package/dist/extension-js-devtools/chrome/assets/developer-mode-off.f9a94937.jpeg +0 -0
  20. package/dist/extension-js-devtools/chrome/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  21. package/dist/extension-js-devtools/chrome/assets/local-network-permission.4fae40a7.png +0 -0
  22. package/dist/extension-js-devtools/chrome/assets/logo.7dc70d61.png +0 -0
  23. package/dist/extension-js-devtools/chrome/background/service_worker.js +0 -26
  24. package/dist/extension-js-devtools/chrome/chrome_url_overrides/newtab.html +0 -23
  25. package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +0 -5
  26. package/dist/extension-js-devtools/chrome/content_scripts/styles.24e59c3d.css +0 -2
  27. package/dist/extension-js-devtools/chrome/devtools/index.html +0 -12
  28. package/dist/extension-js-devtools/chrome/devtools/index.js +0 -1
  29. package/dist/extension-js-devtools/chrome/icons/logo.png +0 -0
  30. package/dist/extension-js-devtools/chrome/manifest.json +0 -57
  31. package/dist/extension-js-devtools/chrome/pages/centralized-logger.css +0 -2
  32. package/dist/extension-js-devtools/chrome/pages/centralized-logger.html +0 -12
  33. package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +0 -15
  34. package/dist/extension-js-devtools/chrome/pages/welcome.css +0 -2
  35. package/dist/extension-js-devtools/chrome/pages/welcome.html +0 -11
  36. package/dist/extension-js-devtools/chrome/pages/welcome.js +0 -25
  37. package/dist/extension-js-devtools/chrome/scripts/logger-client.js +0 -1
  38. package/dist/extension-js-devtools/chromium/assets/developer-mode-off.f9a94937.jpeg +0 -0
  39. package/dist/extension-js-devtools/chromium/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  40. package/dist/extension-js-devtools/chromium/assets/local-network-permission.4fae40a7.png +0 -0
  41. package/dist/extension-js-devtools/chromium/assets/logo.7dc70d61.png +0 -0
  42. package/dist/extension-js-devtools/chromium/background/service_worker.js +0 -26
  43. package/dist/extension-js-devtools/chromium/chrome_url_overrides/newtab.html +0 -23
  44. package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +0 -5
  45. package/dist/extension-js-devtools/chromium/content_scripts/styles.24e59c3d.css +0 -2
  46. package/dist/extension-js-devtools/chromium/devtools/index.html +0 -12
  47. package/dist/extension-js-devtools/chromium/devtools/index.js +0 -1
  48. package/dist/extension-js-devtools/chromium/icons/logo.png +0 -0
  49. package/dist/extension-js-devtools/chromium/manifest.json +0 -57
  50. package/dist/extension-js-devtools/chromium/pages/centralized-logger.css +0 -2
  51. package/dist/extension-js-devtools/chromium/pages/centralized-logger.html +0 -12
  52. package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +0 -15
  53. package/dist/extension-js-devtools/chromium/pages/welcome.css +0 -2
  54. package/dist/extension-js-devtools/chromium/pages/welcome.html +0 -11
  55. package/dist/extension-js-devtools/chromium/pages/welcome.js +0 -25
  56. package/dist/extension-js-devtools/chromium/scripts/logger-client.js +0 -1
  57. package/dist/extension-js-devtools/edge/assets/developer-mode-off.f9a94937.jpeg +0 -0
  58. package/dist/extension-js-devtools/edge/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  59. package/dist/extension-js-devtools/edge/assets/local-network-permission.4fae40a7.png +0 -0
  60. package/dist/extension-js-devtools/edge/assets/logo.7dc70d61.png +0 -0
  61. package/dist/extension-js-devtools/edge/background/service_worker.js +0 -26
  62. package/dist/extension-js-devtools/edge/chrome_url_overrides/newtab.html +0 -23
  63. package/dist/extension-js-devtools/edge/content_scripts/content-0.js +0 -5
  64. package/dist/extension-js-devtools/edge/content_scripts/styles.24e59c3d.css +0 -2
  65. package/dist/extension-js-devtools/edge/devtools/index.html +0 -12
  66. package/dist/extension-js-devtools/edge/devtools/index.js +0 -1
  67. package/dist/extension-js-devtools/edge/icons/logo.png +0 -0
  68. package/dist/extension-js-devtools/edge/manifest.json +0 -57
  69. package/dist/extension-js-devtools/edge/pages/centralized-logger.css +0 -2
  70. package/dist/extension-js-devtools/edge/pages/centralized-logger.html +0 -12
  71. package/dist/extension-js-devtools/edge/pages/centralized-logger.js +0 -15
  72. package/dist/extension-js-devtools/edge/pages/welcome.css +0 -2
  73. package/dist/extension-js-devtools/edge/pages/welcome.html +0 -11
  74. package/dist/extension-js-devtools/edge/pages/welcome.js +0 -25
  75. package/dist/extension-js-devtools/edge/scripts/logger-client.js +0 -1
  76. package/dist/extension-js-devtools/firefox/assets/developer-mode-off.f9a94937.jpeg +0 -0
  77. package/dist/extension-js-devtools/firefox/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  78. package/dist/extension-js-devtools/firefox/assets/local-network-permission.4fae40a7.png +0 -0
  79. package/dist/extension-js-devtools/firefox/assets/logo.7dc70d61.png +0 -0
  80. package/dist/extension-js-devtools/firefox/background/scripts.js +0 -26
  81. package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +0 -5
  82. package/dist/extension-js-devtools/firefox/content_scripts/styles.24e59c3d.css +0 -2
  83. package/dist/extension-js-devtools/firefox/devtools/index.html +0 -12
  84. package/dist/extension-js-devtools/firefox/devtools/index.js +0 -1
  85. package/dist/extension-js-devtools/firefox/icons/logo.png +0 -0
  86. package/dist/extension-js-devtools/firefox/manifest.json +0 -42
  87. package/dist/extension-js-devtools/firefox/pages/centralized-logger.css +0 -2
  88. package/dist/extension-js-devtools/firefox/pages/centralized-logger.html +0 -12
  89. package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +0 -15
  90. package/dist/extension-js-devtools/firefox/pages/welcome.css +0 -2
  91. package/dist/extension-js-devtools/firefox/pages/welcome.html +0 -11
  92. package/dist/extension-js-devtools/firefox/pages/welcome.js +0 -25
  93. package/dist/extension-js-devtools/firefox/scripts/logger-client.js +0 -1
  94. package/dist/extension-js-theme/chrome/manifest.json +0 -66
  95. package/dist/extension-js-theme/chromium/manifest.json +0 -66
  96. package/dist/extension-js-theme/edge/manifest.json +0 -66
  97. package/dist/extension-js-theme/firefox/manifest.json +0 -66
  98. package/dist/warn-no-default-export.cjs +0 -356
  99. package/webpack/webpack-lib/optional-dependencies.json +0 -20
@@ -1 +0,0 @@
1
- (()=>{"use strict";var r={},t={};function e(s){var o=t[s];if(void 0!==o)return o.exports;var u=t[s]={exports:{}};return r[s](u,u.exports,e),u.exports}e.rv=()=>"1.7.5",e.ruid="bundler=rspack@1.7.5"})();
@@ -1,66 +0,0 @@
1
- {
2
- "manifest_version": 3,
3
- "name": "Custom theme",
4
- "version": "1.0",
5
- "description": "A clean, minimal browser theme generated in the editor.",
6
- "author": "Anonymous",
7
- "theme": {
8
- "colors": {
9
- "frame": [
10
- 18,
11
- 18,
12
- 20
13
- ],
14
- "frame_inactive": [
15
- 15,
16
- 15,
17
- 17
18
- ],
19
- "toolbar": [
20
- 30,
21
- 30,
22
- 32
23
- ],
24
- "tab_background_text": [
25
- 185,
26
- 185,
27
- 191
28
- ],
29
- "tab_text": [
30
- 255,
31
- 255,
32
- 255
33
- ],
34
- "tab_background_text_inactive": [
35
- 168,
36
- 168,
37
- 174
38
- ],
39
- "tab_text_inactive": [
40
- 255,
41
- 255,
42
- 255
43
- ],
44
- "bookmark_text": [
45
- 153,
46
- 153,
47
- 159
48
- ],
49
- "ntp_background": [
50
- 28,
51
- 28,
52
- 30
53
- ],
54
- "ntp_text": [
55
- 255,
56
- 255,
57
- 255
58
- ],
59
- "button_background": [
60
- 28,
61
- 28,
62
- 30
63
- ]
64
- }
65
- }
66
- }
@@ -1,66 +0,0 @@
1
- {
2
- "manifest_version": 3,
3
- "name": "Custom theme",
4
- "version": "1.0",
5
- "description": "A clean, minimal browser theme generated in the editor.",
6
- "author": "Anonymous",
7
- "theme": {
8
- "colors": {
9
- "frame": [
10
- 18,
11
- 18,
12
- 20
13
- ],
14
- "frame_inactive": [
15
- 15,
16
- 15,
17
- 17
18
- ],
19
- "toolbar": [
20
- 30,
21
- 30,
22
- 32
23
- ],
24
- "tab_background_text": [
25
- 185,
26
- 185,
27
- 191
28
- ],
29
- "tab_text": [
30
- 255,
31
- 255,
32
- 255
33
- ],
34
- "tab_background_text_inactive": [
35
- 168,
36
- 168,
37
- 174
38
- ],
39
- "tab_text_inactive": [
40
- 255,
41
- 255,
42
- 255
43
- ],
44
- "bookmark_text": [
45
- 153,
46
- 153,
47
- 159
48
- ],
49
- "ntp_background": [
50
- 28,
51
- 28,
52
- 30
53
- ],
54
- "ntp_text": [
55
- 255,
56
- 255,
57
- 255
58
- ],
59
- "button_background": [
60
- 28,
61
- 28,
62
- 30
63
- ]
64
- }
65
- }
66
- }
@@ -1,66 +0,0 @@
1
- {
2
- "manifest_version": 3,
3
- "name": "Custom theme",
4
- "version": "1.0",
5
- "description": "A clean, minimal browser theme generated in the editor.",
6
- "author": "Anonymous",
7
- "theme": {
8
- "colors": {
9
- "frame": [
10
- 18,
11
- 18,
12
- 20
13
- ],
14
- "frame_inactive": [
15
- 15,
16
- 15,
17
- 17
18
- ],
19
- "toolbar": [
20
- 30,
21
- 30,
22
- 32
23
- ],
24
- "tab_background_text": [
25
- 185,
26
- 185,
27
- 191
28
- ],
29
- "tab_text": [
30
- 255,
31
- 255,
32
- 255
33
- ],
34
- "tab_background_text_inactive": [
35
- 168,
36
- 168,
37
- 174
38
- ],
39
- "tab_text_inactive": [
40
- 255,
41
- 255,
42
- 255
43
- ],
44
- "bookmark_text": [
45
- 153,
46
- 153,
47
- 159
48
- ],
49
- "ntp_background": [
50
- 28,
51
- 28,
52
- 30
53
- ],
54
- "ntp_text": [
55
- 255,
56
- 255,
57
- 255
58
- ],
59
- "button_background": [
60
- 28,
61
- 28,
62
- 30
63
- ]
64
- }
65
- }
66
- }
@@ -1,66 +0,0 @@
1
- {
2
- "manifest_version": 3,
3
- "name": "Custom theme",
4
- "version": "1.0",
5
- "description": "A clean, minimal browser theme generated in the editor.",
6
- "author": "Anonymous",
7
- "theme": {
8
- "colors": {
9
- "frame": [
10
- 18,
11
- 18,
12
- 20
13
- ],
14
- "frame_inactive": [
15
- 15,
16
- 15,
17
- 17
18
- ],
19
- "toolbar": [
20
- 30,
21
- 30,
22
- 32
23
- ],
24
- "tab_background_text": [
25
- 185,
26
- 185,
27
- 191
28
- ],
29
- "tab_text": [
30
- 255,
31
- 255,
32
- 255
33
- ],
34
- "tab_background_text_inactive": [
35
- 168,
36
- 168,
37
- 174
38
- ],
39
- "tab_text_inactive": [
40
- 255,
41
- 255,
42
- 255
43
- ],
44
- "bookmark_text": [
45
- 153,
46
- 153,
47
- 159
48
- ],
49
- "ntp_background": [
50
- 28,
51
- 28,
52
- 30
53
- ],
54
- "ntp_text": [
55
- 255,
56
- 255,
57
- 255
58
- ],
59
- "button_background": [
60
- 28,
61
- 28,
62
- 30
63
- ]
64
- }
65
- }
66
- }
@@ -1,356 +0,0 @@
1
- "use strict";
2
- const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
- }();
5
- var __webpack_require__ = {};
6
- (()=>{
7
- __webpack_require__.n = (module)=>{
8
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
9
- __webpack_require__.d(getter, {
10
- a: getter
11
- });
12
- return getter;
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.d = (exports1, definition)=>{
17
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
18
- enumerable: true,
19
- get: definition[key]
20
- });
21
- };
22
- })();
23
- (()=>{
24
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
25
- })();
26
- (()=>{
27
- __webpack_require__.r = (exports1)=>{
28
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
29
- value: 'Module'
30
- });
31
- Object.defineProperty(exports1, '__esModule', {
32
- value: true
33
- });
34
- };
35
- })();
36
- var __webpack_exports__ = {};
37
- __webpack_require__.r(__webpack_exports__);
38
- __webpack_require__.d(__webpack_exports__, {
39
- default: ()=>warn_no_default_export
40
- });
41
- const external_fs_namespaceObject = require("fs");
42
- var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
43
- const external_path_namespaceObject = require("path");
44
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
45
- function findUpLocalSync(filename, options) {
46
- const root = external_path_namespaceObject.parse(options.cwd).root;
47
- let currentDir = options.cwd;
48
- while(true){
49
- const candidate = external_path_namespaceObject.join(currentDir, filename);
50
- try {
51
- const stat = external_fs_namespaceObject.statSync(candidate);
52
- if (stat.isFile()) return candidate;
53
- } catch {}
54
- if (currentDir === root) return;
55
- currentDir = external_path_namespaceObject.dirname(currentDir);
56
- }
57
- }
58
- function findNearestPackageJsonSync(manifestPath) {
59
- try {
60
- const manifestDir = external_path_namespaceObject.dirname(manifestPath);
61
- const packageJsonPath = findUpLocalSync('package.json', {
62
- cwd: manifestDir
63
- });
64
- return packageJsonPath || null;
65
- } catch (error) {
66
- console.warn('Failed to find package.json:', error);
67
- return null;
68
- }
69
- }
70
- require("pintor");
71
- require("crypto");
72
- require("child_process");
73
- const external_module_namespaceObject = require("module");
74
- (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
75
- require("os");
76
- (0, external_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
77
- function runtime_context_parseJsonSafe(text) {
78
- const raw = 'string' == typeof text ? text : String(text || '');
79
- const s = raw && 0xfeff === raw.charCodeAt(0) ? raw.slice(1) : raw;
80
- return JSON.parse(s || '{}');
81
- }
82
- function hasDependency(projectPath, dependency) {
83
- const findNearestPackageJsonDirectory = (startPath)=>{
84
- let currentDirectory = startPath;
85
- const maxDepth = 4;
86
- for(let i = 0; i < maxDepth; i++){
87
- const candidate = external_path_namespaceObject.join(currentDirectory, 'package.json');
88
- if (external_fs_namespaceObject.existsSync(candidate)) return currentDirectory;
89
- const parentDirectory = external_path_namespaceObject.dirname(currentDirectory);
90
- if (parentDirectory === currentDirectory) break;
91
- currentDirectory = parentDirectory;
92
- }
93
- };
94
- const packageJsonDirectory = findNearestPackageJsonDirectory(projectPath);
95
- if (!packageJsonDirectory) return false;
96
- const packageJsonPath = external_path_namespaceObject.join(packageJsonDirectory, 'package.json');
97
- if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
98
- const parsed = runtime_context_parseJsonSafe(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf8'));
99
- const dependencies = parsed.dependencies || {};
100
- const devDependencies = parsed.devDependencies || {};
101
- return !!dependencies[dependency] || !!devDependencies[dependency];
102
- }
103
- const core_namespaceObject = require("@swc/core");
104
- const external_schema_utils_namespaceObject = require("schema-utils");
105
- const schema = {
106
- type: 'object',
107
- properties: {
108
- test: {
109
- type: 'string'
110
- },
111
- manifestPath: {
112
- type: 'string'
113
- },
114
- mode: {
115
- type: 'string'
116
- }
117
- }
118
- };
119
- const EXAMPLES_BASE = 'https://github.com/extension-js/examples/blob/main';
120
- function getContentScriptSampleInfo(packageJsonDir, resourcePath) {
121
- if (hasDependency(packageJsonDir, 'react')) return {
122
- phrase: 'See React sample',
123
- url: `${EXAMPLES_BASE}/react/src/content/scripts.tsx`
124
- };
125
- if (hasDependency(packageJsonDir, 'preact')) return {
126
- phrase: 'See Preact sample',
127
- url: `${EXAMPLES_BASE}/preact/src/content/scripts.tsx`
128
- };
129
- if (hasDependency(packageJsonDir, 'vue')) return {
130
- phrase: 'See Vue sample',
131
- url: `${EXAMPLES_BASE}/vue/src/content/scripts.ts`
132
- };
133
- if (hasDependency(packageJsonDir, 'svelte')) return {
134
- phrase: 'See Svelte sample',
135
- url: `${EXAMPLES_BASE}/svelte/src/content/scripts.ts`
136
- };
137
- const ext = external_path_default().extname(resourcePath).toLowerCase();
138
- if ('.ts' === ext || '.tsx' === ext || '.mts' === ext || '.mtsx' === ext) return {
139
- phrase: 'See TypeScript sample',
140
- url: `${EXAMPLES_BASE}/typescript/src/content/scripts.ts`
141
- };
142
- return {
143
- phrase: 'See vanilla JS sample',
144
- url: `${EXAMPLES_BASE}/content/src/content/scripts.js`
145
- };
146
- }
147
- function getSourceSignature(source) {
148
- const head = source.slice(0, 64);
149
- const tail = source.slice(-64);
150
- return `${source.length}:${head}:${tail}`;
151
- }
152
- function analyzeDefaultExport(source, resourcePath, compilation) {
153
- const abs = external_path_default().normalize(resourcePath);
154
- const sig = getSourceSignature(source);
155
- const cacheKey = `${abs}|${sig}`;
156
- try {
157
- const compilationAny = compilation;
158
- if (compilationAny) {
159
- compilationAny.__extjsDefaultExportAnalysisCache ??= new Map();
160
- const cached = compilationAny.__extjsDefaultExportAnalysisCache.get(cacheKey);
161
- if (cached) return cached;
162
- }
163
- const ext = external_path_default().extname(resourcePath).toLowerCase();
164
- const isTS = '.ts' === ext || '.tsx' === ext || '.mts' === ext || '.mtsx' === ext;
165
- const isJSX = '.jsx' === ext || '.tsx' === ext || '.mjsx' === ext || '.mtsx' === ext;
166
- const ast = (0, core_namespaceObject.parseSync)(source, {
167
- syntax: isTS ? "typescript" : "ecmascript",
168
- tsx: isTS && isJSX,
169
- jsx: !isTS && isJSX,
170
- decorators: true,
171
- dynamicImport: true,
172
- importAssertions: true,
173
- topLevelAwait: true
174
- });
175
- const body = Array.isArray(ast?.body) ? ast.body : [];
176
- const bindings = new Map();
177
- const recordBinding = (name, kind)=>{
178
- if ('string' == typeof name && name) bindings.set(name, kind);
179
- };
180
- const inspectDecl = (node)=>{
181
- if ('FunctionDeclaration' === node.type) {
182
- const id = node.identifier;
183
- recordBinding(id?.value, 'function');
184
- } else if ('ClassDeclaration' === node.type) {
185
- const id = node.identifier;
186
- recordBinding(id?.value, 'class');
187
- } else if ('VariableDeclaration' === node.type) {
188
- const decls = node.declarations;
189
- if (!Array.isArray(decls)) return;
190
- for (const d of decls){
191
- if (!d || 'object' != typeof d) continue;
192
- const dd = d;
193
- const id = dd.id;
194
- const init = dd.init;
195
- if (id?.type !== 'Identifier') continue;
196
- const name = id.value;
197
- const initType = init?.type;
198
- if ('FunctionExpression' === initType || 'ArrowFunctionExpression' === initType) recordBinding(name, 'function');
199
- else if ('ClassExpression' === initType) recordBinding(name, 'class');
200
- else if (initType) recordBinding(name, 'other');
201
- }
202
- }
203
- };
204
- for (const item of body){
205
- if (!item || 'object' != typeof item) continue;
206
- const it = item;
207
- if ('FunctionDeclaration' === it.type || 'ClassDeclaration' === it.type || 'VariableDeclaration' === it.type) inspectDecl(it);
208
- if ('ExportNamedDeclaration' === it.type) {
209
- const decl = it.declaration;
210
- if (decl && 'object' == typeof decl) inspectDecl(decl);
211
- }
212
- }
213
- const resolveIdentifierKind = (name)=>bindings.get(name) ?? 'unknown';
214
- const analysis = {
215
- hasDefaultExport: false,
216
- kind: 'none'
217
- };
218
- for (const item of body){
219
- if (!item || 'object' != typeof item) continue;
220
- const it = item;
221
- if ('ExportDefaultDeclaration' === it.type) {
222
- analysis.hasDefaultExport = true;
223
- const decl = it.decl;
224
- const declType = decl?.type;
225
- if ('FunctionDeclaration' === declType || 'FunctionExpression' === declType) analysis.kind = 'function';
226
- else if ('ClassDeclaration' === declType || 'ClassExpression' === declType) analysis.kind = 'class';
227
- else analysis.kind = 'other';
228
- break;
229
- }
230
- if ('ExportDefaultExpression' === it.type) {
231
- analysis.hasDefaultExport = true;
232
- const expr = it.expression;
233
- const exprType = expr?.type;
234
- if ('FunctionExpression' === exprType || 'ArrowFunctionExpression' === exprType) analysis.kind = 'function';
235
- else if ('ClassExpression' === exprType) analysis.kind = 'class';
236
- else if ('Identifier' === exprType && 'string' == typeof expr?.value) analysis.kind = resolveIdentifierKind(expr.value);
237
- else analysis.kind = 'other';
238
- break;
239
- }
240
- if ('ExportNamedDeclaration' === it.type && Array.isArray(it.specifiers)) {
241
- for (const specifier of it.specifiers){
242
- if (!specifier || 'object' != typeof specifier) continue;
243
- const spec = specifier;
244
- if ('ExportSpecifier' !== spec.type) continue;
245
- const exported = spec.exported;
246
- const orig = spec.orig;
247
- const exportedType = exported?.type;
248
- const exportedValue = exported?.value;
249
- const isDefault = 'Identifier' === exportedType ? 'default' === exportedValue : 'Ident' === exportedType ? 'default' === exportedValue : 'Str' === exportedType ? 'default' === exportedValue : false;
250
- if (isDefault) {
251
- analysis.hasDefaultExport = true;
252
- if (orig?.type === 'Identifier' && 'string' == typeof orig?.value) analysis.kind = resolveIdentifierKind(orig.value);
253
- else analysis.kind = 'unknown';
254
- break;
255
- }
256
- }
257
- if (analysis.hasDefaultExport) break;
258
- }
259
- }
260
- if (compilationAny) compilationAny.__extjsDefaultExportAnalysisCache.set(cacheKey, analysis);
261
- return analysis;
262
- } catch {
263
- const fallback = source.includes('export default') ? {
264
- hasDefaultExport: true,
265
- kind: 'unknown'
266
- } : {
267
- hasDefaultExport: false,
268
- kind: 'none'
269
- };
270
- try {
271
- const compilationAny = compilation;
272
- if (compilationAny?.__extjsDefaultExportAnalysisCache) compilationAny.__extjsDefaultExportAnalysisCache.set(cacheKey, fallback);
273
- } catch {}
274
- return fallback;
275
- }
276
- }
277
- function warn_no_default_export(source) {
278
- const options = this.getOptions();
279
- const manifestPath = options.manifestPath;
280
- const manifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
281
- const resourceQuery = this.resourceQuery;
282
- if ('string' == typeof resourceQuery && resourceQuery.includes('__extjs_inner=1')) return source;
283
- (0, external_schema_utils_namespaceObject.validate)(schema, options, {
284
- name: "scripts:warn-no-default-export",
285
- baseDataPath: 'options'
286
- });
287
- try {
288
- const resourceAbsPath = external_path_default().normalize(this.resourcePath);
289
- const manifestDir = external_path_default().dirname(manifestPath);
290
- const packageJsonPath = findNearestPackageJsonSync(manifestPath);
291
- const packageJsonDir = packageJsonPath ? external_path_default().dirname(packageJsonPath) : manifestDir;
292
- const compilation = this._compilation;
293
- const dedupeKey = `no-default:${resourceAbsPath}`;
294
- if (compilation) {
295
- compilation.__extjsWarnedDefaultExport ??= new Set();
296
- if (compilation.__extjsWarnedDefaultExport.has(dedupeKey)) return source;
297
- }
298
- const declaredContentJsAbsPaths = [];
299
- const contentScripts = Array.isArray(manifest.content_scripts) ? manifest.content_scripts : [];
300
- for (const contentScript of contentScripts){
301
- const contentScriptJsList = Array.isArray(contentScript?.js) ? contentScript.js : [];
302
- for (const contentScriptJs of contentScriptJsList)declaredContentJsAbsPaths.push(external_path_default().resolve(manifestDir, contentScriptJs));
303
- }
304
- const isDeclaredContentScript = declaredContentJsAbsPaths.some((abs)=>resourceAbsPath === external_path_default().normalize(abs));
305
- const scriptsDir = external_path_default().resolve(packageJsonDir, "scripts");
306
- const relToScripts = external_path_default().relative(scriptsDir, resourceAbsPath);
307
- const isScriptsFolderScript = relToScripts && !relToScripts.startsWith('..') && !external_path_default().isAbsolute(relToScripts);
308
- const isContentScriptLike = isDeclaredContentScript || isScriptsFolderScript;
309
- if (isContentScriptLike) {
310
- const analysis = analyzeDefaultExport(source, this.resourcePath, compilation);
311
- if (analysis.hasDefaultExport) {
312
- if ('class' === analysis.kind || 'other' === analysis.kind) {
313
- const dedupeKindKey = `default-not-callable:${resourceAbsPath}`;
314
- if (compilation) {
315
- compilation.__extjsWarnedDefaultExportKinds ??= new Set();
316
- if (compilation.__extjsWarnedDefaultExportKinds.has(dedupeKindKey)) return source;
317
- }
318
- const relativeFile = external_path_default().relative(packageJsonDir, resourceAbsPath);
319
- const found = 'class' === analysis.kind ? 'class' : 'non-callable value';
320
- const sample = getContentScriptSampleInfo(packageJsonDir, this.resourcePath);
321
- const message = [
322
- "Content script default export must be a function.",
323
- ` │ File: ${relativeFile}`,
324
- " │",
325
- ` │ Found: ${found}. Export a default function that sets up your script and returns optional cleanup.`,
326
- " │ Without it: duplicate UI mounts, memory leaks, and inconsistent state during HMR.",
327
- ` │ ${sample.phrase} ${sample.url}`
328
- ].join('\n');
329
- compilation?.warnings.push(message);
330
- compilation?.__extjsWarnedDefaultExportKinds?.add(dedupeKindKey);
331
- }
332
- } else {
333
- const relativeFile = external_path_default().relative(packageJsonDir, resourceAbsPath);
334
- const sample = getContentScriptSampleInfo(packageJsonDir, this.resourcePath);
335
- const message = [
336
- "Content script requires a default export.",
337
- ` File: ${relativeFile}`,
338
- "",
339
- " Export a default function so Extension.js can mount and cleanup safely.",
340
- " Without it: duplicate UI mounts and inconsistent state during HMR.",
341
- ` ${sample.phrase}: ${sample.url}`
342
- ].join('\n');
343
- compilation?.warnings.push(message);
344
- compilation?.__extjsWarnedDefaultExport?.add(dedupeKey);
345
- }
346
- }
347
- } catch {}
348
- return source;
349
- }
350
- exports["default"] = __webpack_exports__["default"];
351
- for(var __rspack_i in __webpack_exports__)if (-1 === [
352
- "default"
353
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
354
- Object.defineProperty(exports, '__esModule', {
355
- value: true
356
- });
@@ -1,20 +0,0 @@
1
- {
2
- "typescript": "5.9.3",
3
- "react-refresh": "0.18.0",
4
- "@rspack/plugin-react-refresh": "1.6.0",
5
- "preact": "10.27.2",
6
- "@prefresh/core": "1.5.9",
7
- "@prefresh/utils": "1.2.1",
8
- "@rspack/plugin-preact-refresh": "1.1.4",
9
- "vue": "3.5.26",
10
- "vue-loader": "17.4.2",
11
- "@vue/compiler-sfc": "3.5.26",
12
- "svelte-loader": "3.2.4",
13
- "less": "4.5.1",
14
- "less-loader": "12.3.0",
15
- "postcss": "8.5.6",
16
- "postcss-loader": "8.2.0",
17
- "postcss-preset-env": "11.1.1",
18
- "postcss-scss": "4.0.9",
19
- "sass-loader": "16.0.6"
20
- }