extension-develop 4.1.31 → 4.1.32
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/README.md +2 -0
- package/dist/105~0.mjs +1 -1
- package/dist/177~0.mjs +87 -19
- package/dist/273~0.mjs +13 -3
- package/dist/363~0.mjs +1874 -0
- package/dist/{896~0.mjs → 469~0.mjs} +116 -586
- package/dist/519~0.mjs +21 -8
- package/dist/616~0.mjs +1 -1
- package/dist/771~0.mjs +103 -0
- package/dist/832~0.mjs +229 -463
- package/dist/840~0.mjs +1189 -54
- package/dist/846~0.mjs +453 -0
- package/dist/852~0.mjs +8 -6
- package/dist/bridge.mjs +3 -2
- package/dist/command-preview.d.ts +1 -0
- package/dist/contract/codes.json +39 -29
- package/dist/contract/envelope.schema.json +16 -0
- package/dist/contract/golden.build.compile.json +20 -3
- package/dist/contract/golden.eval.csp-blocks-eval.page.json +15 -0
- package/dist/css-parse-guard-loader.mjs +3 -1
- package/dist/dead-css-url-loader.mjs +129 -13
- package/dist/dev-server/cleanup.d.ts +1 -1
- package/dist/dev-server/lifecycle-stream.d.ts +14 -3
- package/dist/dev-server/session-start-prune.d.ts +13 -0
- package/dist/dev-server~0.mjs +91 -14
- package/dist/ensure-hmr-for-scripts.js +4 -8
- package/dist/ensure-hmr-for-scripts.mjs +4 -8
- package/dist/extension-js-devtools/build-stamp.json +2 -2
- package/dist/extension-js-theme/build-stamp.json +2 -2
- package/dist/feature-scripts-content-script-wrapper.js +7 -4
- package/dist/feature-scripts-content-script-wrapper.mjs +7 -4
- package/dist/lib/build-summary.d.ts +4 -1
- package/dist/lib/coded-warnings.d.ts +3 -0
- package/dist/lib/compilation-diagnostics.d.ts +23 -0
- package/dist/lib/config-loader.d.ts +2 -2
- package/dist/lib/config-resolved-plugin.d.ts +3 -2
- package/dist/lib/corepack-registry.d.ts +3 -0
- package/dist/lib/diagnostic-code.d.ts +6 -0
- package/dist/lib/merge-options.d.ts +1 -0
- package/dist/lib/messages.d.ts +4 -1
- package/dist/lib/messaging.d.ts +12 -4
- package/dist/lib/output-files.d.ts +11 -0
- package/dist/lib/package-manager.d.ts +2 -2
- package/dist/module.mjs +2 -1
- package/dist/plugin-browsers/index.d.ts +1 -0
- package/dist/plugin-compatibility/compatibility-lib/free-browser-references.d.ts +9 -0
- package/dist/plugin-css/css-lib/dead-url-refs.d.ts +5 -1
- package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +4 -2
- package/dist/plugin-css/css-lib/line-rewrite-source-map.d.ts +8 -0
- package/dist/plugin-css/dead-css-url-loader.d.ts +0 -2
- package/dist/plugin-css/public-css-url-loader.d.ts +8 -3
- package/dist/plugin-playwright/index.d.ts +9 -4
- package/dist/plugin-reload/classify-reload.d.ts +2 -0
- package/dist/plugin-reload/messages.d.ts +1 -0
- package/dist/plugin-reload/reload-lib/dev-content-scripts.d.ts +4 -0
- package/dist/plugin-reload/steps/prune-unreachable-chunks.d.ts +5 -0
- package/dist/plugin-special-folders/messages.d.ts +1 -1
- package/dist/plugin-special-folders/prune-removed-public-files.d.ts +7 -0
- package/dist/plugin-static-assets/check-namespace-imports.d.ts +4 -0
- package/dist/plugin-static-assets/static-assets-lib/asset-output-name.d.ts +8 -0
- package/dist/plugin-static-assets/static-assets-lib/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +2 -1
- package/dist/plugin-web-extension/feature-icons/messages.d.ts +1 -4
- package/dist/plugin-web-extension/feature-locales/get-locales.d.ts +2 -0
- package/dist/plugin-web-extension/feature-locales/messages.d.ts +3 -1
- package/dist/plugin-web-extension/feature-locales/validation.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/index.d.ts +2 -0
- package/dist/plugin-web-extension/feature-scripts/messages.d.ts +4 -3
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/load-time-constants.d.ts +11 -0
- package/dist/plugin-web-extension/feature-scripts/steps/trace-runtime-loaded-files.d.ts +4 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-missing-build-constants.d.ts +24 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/declared-pages.d.ts +2 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/resolve-war.d.ts +5 -0
- package/dist/plugin-web-extension/index.d.ts +1 -0
- package/dist/plugin-web-extension/shared/classic-concat.d.ts +1 -0
- package/dist/plugin-web-extension/shared/compilation-issues.d.ts +1 -1
- package/dist/preprocessor-passthrough-loader.mjs +3 -1
- package/dist/public-css-url-loader.mjs +1 -1
- package/dist/rspack-config~0.mjs +4925 -5885
- package/dist/stats-handler~0.mjs +12 -4
- package/dist/types.d.ts +19 -2
- package/dist/zip~0.mjs +20 -2
- package/package.json +4 -4
- package/dist/300~0.mjs +0 -394
- package/dist/747~0.mjs +0 -90
package/dist/contract/codes.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"note": "The durable error-code table for the schema-1 envelope. Codes may be added, never renamed
|
|
3
|
+
"note": "The durable error-code table for the schema-1 envelope. Codes may be added, never renamed. A code retired after it shipped keeps a 'folded' row pointing at the code the same path reports now, so a consumer that still lists the name resolves it. One code per operator-distinguishable failure family; the envelope's command field carries the which-command context. 'folded' records finer inventory names that map onto a shipped family code. 'legacy' maps the three pre-envelope conventions (snake_case ready.json codes, PascalCase error names, kebab-case doctor check ids) onto the table; a ready.json id that lists several codes resolves to the first unless the contract's browserLaunchFailedCode names another from the list. A row marked 'reserved' names a failure the CLI does not report under that code today, so no envelope carries it yet and a consumer need not handle it; its 'reason' says what keeps it reserved.",
|
|
4
4
|
"codes": {
|
|
5
5
|
"E_ARGS": {
|
|
6
6
|
"area": "usage",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"E_MANAGED_DEP_CONFLICT": {
|
|
62
62
|
"area": "project",
|
|
63
|
-
"summary": "The project declares a package the toolchain manages."
|
|
63
|
+
"summary": "The project declares a package the toolchain manages.",
|
|
64
|
+
"warn": true
|
|
64
65
|
},
|
|
65
66
|
"E_DEPENDENCY_INSTALL": {
|
|
66
67
|
"area": "project",
|
|
@@ -68,11 +69,8 @@
|
|
|
68
69
|
},
|
|
69
70
|
"E_TYPES_EMIT": {
|
|
70
71
|
"area": "project",
|
|
71
|
-
"summary": "Writing extension-env.d.ts failed."
|
|
72
|
-
|
|
73
|
-
"E_TSCONFIG_MISSING": {
|
|
74
|
-
"area": "project",
|
|
75
|
-
"summary": "TypeScript sources exist with no tsconfig.json beside package.json."
|
|
72
|
+
"summary": "Writing extension-env.d.ts failed.",
|
|
73
|
+
"warn": true
|
|
76
74
|
},
|
|
77
75
|
"E_OPTIONAL_DEP_UNRESOLVED": {
|
|
78
76
|
"area": "project",
|
|
@@ -143,7 +141,8 @@
|
|
|
143
141
|
},
|
|
144
142
|
"E_CSS_PARSE": {
|
|
145
143
|
"area": "compile",
|
|
146
|
-
"summary": "A stylesheet failed to parse."
|
|
144
|
+
"summary": "A stylesheet failed to parse.",
|
|
145
|
+
"warn": true
|
|
147
146
|
},
|
|
148
147
|
"E_CSS_PREPROCESSOR_MISSING": {
|
|
149
148
|
"area": "compile",
|
|
@@ -155,26 +154,20 @@
|
|
|
155
154
|
"summary": "A CSS url() points at nothing.",
|
|
156
155
|
"warn": true
|
|
157
156
|
},
|
|
158
|
-
"E_INTEGRATION_INSTALL": {
|
|
159
|
-
"area": "compile",
|
|
160
|
-
"summary": "A framework integration failed to install."
|
|
161
|
-
},
|
|
162
157
|
"E_POLYFILL_NOT_FOUND": {
|
|
163
158
|
"area": "compile",
|
|
164
|
-
"summary": "webextension-polyfill requested but absent."
|
|
159
|
+
"summary": "webextension-polyfill requested but absent.",
|
|
160
|
+
"warn": true
|
|
165
161
|
},
|
|
166
162
|
"E_LOCALES_LAYOUT": {
|
|
167
163
|
"area": "compile",
|
|
168
|
-
"summary": "_locales layout or messages.json is invalid."
|
|
164
|
+
"summary": "_locales layout or messages.json is invalid.",
|
|
165
|
+
"warn": true
|
|
169
166
|
},
|
|
170
167
|
"E_WAR_INVALID": {
|
|
171
168
|
"area": "compile",
|
|
172
169
|
"summary": "web_accessible_resources shape or match pattern rejected."
|
|
173
170
|
},
|
|
174
|
-
"E_MATCH_PATTERN_INVALID": {
|
|
175
|
-
"area": "compile",
|
|
176
|
-
"summary": "The browser rejected a content-script match pattern."
|
|
177
|
-
},
|
|
178
171
|
"E_BACKGROUND_REQUIRED": {
|
|
179
172
|
"area": "compile",
|
|
180
173
|
"summary": "The reload runtime needs a background chunk that is absent."
|
|
@@ -185,7 +178,8 @@
|
|
|
185
178
|
},
|
|
186
179
|
"E_NO_ENTRYPOINTS": {
|
|
187
180
|
"area": "compile",
|
|
188
|
-
"summary": "The compilation produced zero entrypoints."
|
|
181
|
+
"summary": "The compilation produced zero entrypoints.",
|
|
182
|
+
"warn": true
|
|
189
183
|
},
|
|
190
184
|
"E_REMOTE_RESOURCE_BLOCKED": {
|
|
191
185
|
"area": "compile",
|
|
@@ -253,7 +247,7 @@
|
|
|
253
247
|
},
|
|
254
248
|
"E_BROWSER_START_TIMEOUT": {
|
|
255
249
|
"area": "browser-binary",
|
|
256
|
-
"summary": "The browser never
|
|
250
|
+
"summary": "The browser accepted the debug socket but never sent its greeting."
|
|
257
251
|
},
|
|
258
252
|
"E_PROFILE_LOCKED": {
|
|
259
253
|
"area": "browser-binary",
|
|
@@ -261,16 +255,13 @@
|
|
|
261
255
|
},
|
|
262
256
|
"E_LAUNCH_SKIPPED_COMPILE_ERRORS": {
|
|
263
257
|
"area": "browser-binary",
|
|
264
|
-
"summary": "Launch was withheld because the compile failed."
|
|
258
|
+
"summary": "Launch was withheld because the compile failed.",
|
|
259
|
+
"warn": true
|
|
265
260
|
},
|
|
266
261
|
"E_INSTANCE_AMBIGUOUS": {
|
|
267
262
|
"area": "browser-binary",
|
|
268
263
|
"summary": "More than one live instance matches the requested id."
|
|
269
264
|
},
|
|
270
|
-
"E_WSL_INTEROP": {
|
|
271
|
-
"area": "browser-binary",
|
|
272
|
-
"summary": "WSL interop could not resolve a Windows browser."
|
|
273
|
-
},
|
|
274
265
|
"E_BROWSER_DOWNLOAD": {
|
|
275
266
|
"area": "browser-binary",
|
|
276
267
|
"summary": "Downloading or installing a browser failed."
|
|
@@ -345,6 +336,10 @@
|
|
|
345
336
|
"area": "ready",
|
|
346
337
|
"summary": "The session contract reports a stopped session."
|
|
347
338
|
},
|
|
339
|
+
"E_SESSION_EXISTS": {
|
|
340
|
+
"area": "dev-server",
|
|
341
|
+
"summary": "A live dev session already owns this project and browser, so the new session was refused."
|
|
342
|
+
},
|
|
348
343
|
"E_READY_TIMEOUT": {
|
|
349
344
|
"area": "ready",
|
|
350
345
|
"summary": "--wait expired before the session became ready."
|
|
@@ -371,7 +366,7 @@
|
|
|
371
366
|
},
|
|
372
367
|
"E_CSP_BLOCKS_EVAL": {
|
|
373
368
|
"area": "control",
|
|
374
|
-
"summary": "
|
|
369
|
+
"summary": "A content security policy forbids eval in the target, the extension's own for its documents and its content-script world or the page's own for a web page, so the in-page executor runs no expression there."
|
|
375
370
|
},
|
|
376
371
|
"E_TIMEOUT": {
|
|
377
372
|
"area": "control",
|
|
@@ -395,7 +390,7 @@
|
|
|
395
390
|
},
|
|
396
391
|
"E_EVAL": {
|
|
397
392
|
"area": "control",
|
|
398
|
-
"summary": "The evaluated expression threw inside the page."
|
|
393
|
+
"summary": "The evaluated expression threw inside the page, whatever the class of the error it threw."
|
|
399
394
|
},
|
|
400
395
|
"E_INSPECT": {
|
|
401
396
|
"area": "control",
|
|
@@ -467,7 +462,18 @@
|
|
|
467
462
|
"dev_server_start_failed": "E_DEV_SERVER_START",
|
|
468
463
|
"preview_manifest_missing": "E_PREVIEW_NO_DIST",
|
|
469
464
|
"browser_exited": "E_BROWSER_EXITED",
|
|
470
|
-
"browser_launch_failed":
|
|
465
|
+
"browser_launch_failed": [
|
|
466
|
+
"E_BROWSER_LAUNCH",
|
|
467
|
+
"E_BROWSER_BINARY_INVALID",
|
|
468
|
+
"E_FLAG_NOT_SUPPORTED_HERE",
|
|
469
|
+
"E_BROWSER_BINARY_REQUIRED",
|
|
470
|
+
"E_BROWSER_NOT_FOUND",
|
|
471
|
+
"E_BROWSER_START_TIMEOUT",
|
|
472
|
+
"E_BROWSER_CONNECT",
|
|
473
|
+
"E_BROWSER_CONNECTION_CLOSED",
|
|
474
|
+
"E_RDP_PROTOCOL",
|
|
475
|
+
"E_ADDON_INSTALL"
|
|
476
|
+
],
|
|
471
477
|
"extension_load_refused": "E_EXTENSION_LOAD_REFUSED",
|
|
472
478
|
"profile_locked": "E_PROFILE_LOCKED"
|
|
473
479
|
},
|
|
@@ -552,6 +558,10 @@
|
|
|
552
558
|
"E_SAFARI_BUNDLE_ID_INVALID": "E_INVALID_OPTION",
|
|
553
559
|
"E_PUBLISH_NO_TOKEN": "E_AUTH_REQUIRED",
|
|
554
560
|
"E_PUBLISH_UNREACHABLE": "E_NETWORK",
|
|
555
|
-
"E_UNKNOWN": "E_INTERNAL"
|
|
561
|
+
"E_UNKNOWN": "E_INTERNAL",
|
|
562
|
+
"E_TSCONFIG_MISSING": "E_COMPILE",
|
|
563
|
+
"E_INTEGRATION_INSTALL": "E_DEPENDENCY_INSTALL",
|
|
564
|
+
"E_WSL_INTEROP": "E_BROWSER_NOT_FOUND",
|
|
565
|
+
"E_MATCH_PATTERN_INVALID": "E_EXTENSION_LOAD_REFUSED"
|
|
556
566
|
}
|
|
557
567
|
}
|
|
@@ -38,6 +38,22 @@
|
|
|
38
38
|
"path": { "type": "string" },
|
|
39
39
|
"version": { "type": "string" }
|
|
40
40
|
}
|
|
41
|
+
},
|
|
42
|
+
"details": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"required": ["message", "severity"],
|
|
47
|
+
"properties": {
|
|
48
|
+
"code": { "type": "string", "pattern": "^E_[A-Z0-9_]+$" },
|
|
49
|
+
"message": { "type": "string" },
|
|
50
|
+
"file": { "type": "string" },
|
|
51
|
+
"line": { "type": "integer" },
|
|
52
|
+
"column": { "type": "integer" },
|
|
53
|
+
"severity": { "enum": ["error", "warning"] },
|
|
54
|
+
"name": { "type": "string" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
}
|
|
@@ -6,8 +6,25 @@
|
|
|
6
6
|
"value": null,
|
|
7
7
|
"error": {
|
|
8
8
|
"code": "E_COMPILE",
|
|
9
|
-
"message": "Build failed with
|
|
9
|
+
"message": "Build failed with errors",
|
|
10
|
+
"details": [
|
|
11
|
+
{
|
|
12
|
+
"code": "E_CONTENT_SCRIPT_SYNTAX",
|
|
13
|
+
"message": "Module build failed (from builtin:swc-loader):\n ╰─▶ × Syntax Error: Expression expected\n ╭─[82:15]\n 80 │ return unmount;\n 81 │ }\n 82 │ const broken = ;\n · ─\n 83 │\n 84 │ try { __EXTENSIONJS_scheduleBundleCssHydration() } catch (error) {\n ╰────",
|
|
14
|
+
"file": "content/scripts.js",
|
|
15
|
+
"severity": "error",
|
|
16
|
+
"name": "ModuleBuildError"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"code": "E_MODULE_NOT_FOUND",
|
|
20
|
+
"message": "Module not found: Can't resolve './missing' in '/home/dev/my-extension'\n ╭─[1:0]\n 1 │ import './missing';\n · ───────────────────\n 2 │ console.log('x');\n ╰────",
|
|
21
|
+
"file": "background.js",
|
|
22
|
+
"line": 1,
|
|
23
|
+
"column": 1,
|
|
24
|
+
"severity": "error"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
10
27
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
28
|
+
"warnings": [],
|
|
29
|
+
"hint": "Fix the error above and run build again."
|
|
13
30
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"ok": false,
|
|
4
|
+
"command": "eval",
|
|
5
|
+
"status": "denied",
|
|
6
|
+
"value": null,
|
|
7
|
+
"error": {
|
|
8
|
+
"code": "E_CSP_BLOCKS_EVAL",
|
|
9
|
+
"message": "call to eval() blocked by CSP",
|
|
10
|
+
"name": "EvalError",
|
|
11
|
+
"engine": "firefox",
|
|
12
|
+
"hint": "The page's own Content-Security-Policy forbids eval, so the in-page executor runs no expression in this tab. The extension's policy is not involved. Read the page with extension inspect --context page --tab <id>. Firefox evaluates such a page through its debugger instead when exactly one open tab is on that url, so close the duplicate tab and run it again."
|
|
13
|
+
},
|
|
14
|
+
"warnings": []
|
|
15
|
+
}
|
|
@@ -16,7 +16,9 @@ function pitch() {
|
|
|
16
16
|
});
|
|
17
17
|
callback(null);
|
|
18
18
|
} catch (error) {
|
|
19
|
-
this.emitWarning(new Error(cssParseErrorShippedVerbatim(this.resourcePath, error))
|
|
19
|
+
this.emitWarning(Object.assign(new Error(cssParseErrorShippedVerbatim(this.resourcePath, error)), {
|
|
20
|
+
name: 'CssParseWarning'
|
|
21
|
+
}));
|
|
20
22
|
const moduleType = String(this._module?.type || '');
|
|
21
23
|
if (moduleType.startsWith('css')) return void callback(null, verbatimCssPlaceholder(registerVerbatimCss(raw, this.resourcePath)));
|
|
22
24
|
callback(null, raw);
|
|
@@ -1,12 +1,119 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
2
|
import { WebpackError } from "@rspack/core";
|
|
3
|
-
import {
|
|
3
|
+
import { isDeadCssUrlRef, publicOwnedOutputName, extractCssUrlRefs, toPosixPath, replaceCssUrlRefs } from "./273~0.mjs";
|
|
4
|
+
import { toJsStringLiteral } from "./363~0.mjs";
|
|
5
|
+
import { resolvePublicFolder, publicContainmentRoot } from "./105~0.mjs";
|
|
4
6
|
import { canonicalizeDir, canonicalizeResourcePath } from "./712~0.mjs";
|
|
5
|
-
import { isDeadCssUrlRef, extractCssUrlRefs, toPosixPath } from "./273~0.mjs";
|
|
6
7
|
import { deadCssUrlRef } from "./524~0.mjs";
|
|
7
|
-
import { toRuntimeStylesheetModule, rewriteInlinedCssUrls } from "./747~0.mjs";
|
|
8
|
-
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
9
8
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
9
|
+
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
10
|
+
const EXTENSION_ROOT_PLACEHOLDER = '__EXTENSIONJS_EXTENSION_ROOT__/';
|
|
11
|
+
const BUNDLED_FILE_TOKEN = /__EXTENSIONJS_CSS_FILE_(\d+)__([^"\\]*)/g;
|
|
12
|
+
function bundledFileToken(index) {
|
|
13
|
+
return `__EXTENSIONJS_CSS_FILE_${index}__`;
|
|
14
|
+
}
|
|
15
|
+
function isFile(candidate) {
|
|
16
|
+
try {
|
|
17
|
+
return __rspack_external_node_fs_1b05aee1.statSync(candidate).isFile();
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function resolveTarget(req, { resourcePath, manifestDir, publicRoot, publicDir }) {
|
|
23
|
+
if (req.startsWith('/')) {
|
|
24
|
+
const rel = req.slice(1);
|
|
25
|
+
const fromPublic = __rspack_external_node_path_806ed179.join(publicRoot, rel);
|
|
26
|
+
if (isFile(fromPublic)) return {
|
|
27
|
+
absolutePath: fromPublic,
|
|
28
|
+
outputName: toPosixPath(__rspack_external_node_path_806ed179.normalize(rel)),
|
|
29
|
+
publicOwned: true
|
|
30
|
+
};
|
|
31
|
+
const fromManifest = __rspack_external_node_path_806ed179.join(manifestDir, rel);
|
|
32
|
+
if (!isFile(fromManifest)) return;
|
|
33
|
+
return {
|
|
34
|
+
absolutePath: fromManifest,
|
|
35
|
+
publicOwned: false
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const absolutePath = __rspack_external_node_path_806ed179.resolve(__rspack_external_node_path_806ed179.dirname(resourcePath), req);
|
|
39
|
+
if (!isFile(absolutePath)) return;
|
|
40
|
+
const publicPath = publicOwnedOutputName(absolutePath, publicDir);
|
|
41
|
+
if (publicPath) return {
|
|
42
|
+
absolutePath,
|
|
43
|
+
outputName: publicPath,
|
|
44
|
+
publicOwned: true
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
absolutePath,
|
|
48
|
+
publicOwned: false
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function rewriteInlinedCssUrls(source, context) {
|
|
52
|
+
const targets = [];
|
|
53
|
+
const seen = new Map();
|
|
54
|
+
const css = replaceCssUrlRefs(source, (request)=>{
|
|
55
|
+
const suffixAt = request.search(/[?#]/);
|
|
56
|
+
const req = -1 === suffixAt ? request : request.slice(0, suffixAt);
|
|
57
|
+
const suffix = -1 === suffixAt ? '' : request.slice(suffixAt);
|
|
58
|
+
if (!req || req.startsWith('//') || /^[a-z][a-z0-9+.-]*:/i.test(req)) return;
|
|
59
|
+
if (req.startsWith('~') || req.startsWith('@')) return;
|
|
60
|
+
if (req.startsWith(EXTENSION_ROOT_PLACEHOLDER)) return;
|
|
61
|
+
let named = seen.get(req);
|
|
62
|
+
if (!named) {
|
|
63
|
+
const target = resolveTarget(req, context);
|
|
64
|
+
if (!target) return;
|
|
65
|
+
named = target.publicOwned ? `${EXTENSION_ROOT_PLACEHOLDER}${target.outputName}` : bundledFileToken(targets.filter((other)=>!other.publicOwned).length);
|
|
66
|
+
seen.set(req, named);
|
|
67
|
+
targets.push({
|
|
68
|
+
request: req,
|
|
69
|
+
...target
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return `${named}${suffix}`;
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
css,
|
|
76
|
+
targets
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function toRuntimeStylesheetModule(css, bundledRequests = []) {
|
|
80
|
+
const root = JSON.stringify(EXTENSION_ROOT_PLACEHOLDER);
|
|
81
|
+
const rooted = `__extjsCssText.split(${root}).join(__extjsExtensionRoot())`;
|
|
82
|
+
const text = 0 === bundledRequests.length ? rooted : `${rooted}.replace(${String(BUNDLED_FILE_TOKEN)}, __extjsCssFile)`;
|
|
83
|
+
return [
|
|
84
|
+
`var __extjsCssText = ${JSON.stringify(css)};`,
|
|
85
|
+
'function __extjsExtensionRoot() {',
|
|
86
|
+
' try {',
|
|
87
|
+
' var b = globalThis.browser;',
|
|
88
|
+
' if (typeof b === "object" && b && b.runtime && typeof b.runtime.getURL === "function") return String(b.runtime.getURL("/"));',
|
|
89
|
+
' } catch (error) {}',
|
|
90
|
+
' try {',
|
|
91
|
+
' var c = globalThis.chrome;',
|
|
92
|
+
' if (typeof c === "object" && c && c.runtime && typeof c.runtime.getURL === "function") return String(c.runtime.getURL("/"));',
|
|
93
|
+
' } catch (error) {}',
|
|
94
|
+
' try {',
|
|
95
|
+
' var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";',
|
|
96
|
+
' if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");',
|
|
97
|
+
' if (!base && typeof __webpack_require__ === "function" && __webpack_require__.extjsBase) base = String(__webpack_require__.extjsBase);',
|
|
98
|
+
' if (base) return base.replace(/\\/+$/, "") + "/";',
|
|
99
|
+
' } catch (error) {}',
|
|
100
|
+
' return "/";',
|
|
101
|
+
'}',
|
|
102
|
+
...0 === bundledRequests.length ? [] : [
|
|
103
|
+
`var __extjsCssFiles = [${bundledRequests.map((request)=>`function(){ return new URL(${toJsStringLiteral(request)}, import.meta.url); }`).join(', ')}];`,
|
|
104
|
+
'function __extjsCssFile(match, index, suffix) {',
|
|
105
|
+
' try {',
|
|
106
|
+
' var file = __extjsCssFiles[Number(index)]();',
|
|
107
|
+
' if (file.protocol === "data:") return file.href;',
|
|
108
|
+
' return __extjsExtensionRoot() + String(file.pathname).replace(/^\\/+/, "") + suffix;',
|
|
109
|
+
' } catch (error) {}',
|
|
110
|
+
' return "about:invalid";',
|
|
111
|
+
'}'
|
|
112
|
+
],
|
|
113
|
+
`module.exports = "data:text/css;charset=utf-8," + encodeURIComponent(${text});`,
|
|
114
|
+
''
|
|
115
|
+
].join('\n');
|
|
116
|
+
}
|
|
10
117
|
function reportDeadRefs(loader, source, manifestDir, publicRoot) {
|
|
11
118
|
const roots = [
|
|
12
119
|
publicRoot,
|
|
@@ -24,27 +131,37 @@ function reportDeadRefs(loader, source, manifestDir, publicRoot) {
|
|
|
24
131
|
})) continue;
|
|
25
132
|
const report = new WebpackError(deadCssUrlRef(issuerPath, request));
|
|
26
133
|
report.file = issuerPath;
|
|
134
|
+
report.name = 'CssDeadRef';
|
|
27
135
|
const sink = strict ? compilation?.errors : compilation?.warnings;
|
|
28
136
|
if (sink) sink.push(report);
|
|
29
137
|
else if (strict) loader.emitError(report);
|
|
30
138
|
else loader.emitWarning(report);
|
|
31
139
|
}
|
|
32
140
|
}
|
|
33
|
-
function
|
|
141
|
+
function resolveTargets(loader, source, manifestDir, publicRoot, publicDir) {
|
|
142
|
+
const resourcePath = canonicalizeResourcePath(loader.resourcePath);
|
|
34
143
|
const { css, targets } = rewriteInlinedCssUrls(source, {
|
|
35
|
-
resourcePath
|
|
144
|
+
resourcePath,
|
|
36
145
|
manifestDir,
|
|
37
|
-
publicRoot
|
|
146
|
+
publicRoot,
|
|
147
|
+
publicDir
|
|
38
148
|
});
|
|
39
|
-
|
|
149
|
+
const bundledRequests = [];
|
|
40
150
|
for (const target of targets){
|
|
41
|
-
if (!target.publicOwned
|
|
151
|
+
if (!target.publicOwned) {
|
|
152
|
+
const request = toPosixPath(__rspack_external_node_path_806ed179.relative(__rspack_external_node_path_806ed179.dirname(resourcePath), target.absolutePath));
|
|
153
|
+
bundledRequests.push(request.startsWith('../') || __rspack_external_node_path_806ed179.isAbsolute(request) ? request : `./${request}`);
|
|
154
|
+
}
|
|
42
155
|
loader.addDependency?.(target.absolutePath);
|
|
43
156
|
}
|
|
44
|
-
return
|
|
157
|
+
return {
|
|
158
|
+
css,
|
|
159
|
+
bundledRequests
|
|
160
|
+
};
|
|
45
161
|
}
|
|
46
162
|
function deadCssUrlLoader(source) {
|
|
47
163
|
let css = source;
|
|
164
|
+
let bundledRequests = [];
|
|
48
165
|
const options = this.getOptions() || {};
|
|
49
166
|
try {
|
|
50
167
|
const { manifestPath, projectPath } = options;
|
|
@@ -52,10 +169,9 @@ function deadCssUrlLoader(source) {
|
|
|
52
169
|
const manifestDir = canonicalizeDir(__rspack_external_node_path_806ed179.dirname(manifestPath));
|
|
53
170
|
const publicRoot = canonicalizeDir(publicContainmentRoot(manifestPath, projectPath));
|
|
54
171
|
reportDeadRefs(this, source, manifestDir, publicRoot);
|
|
55
|
-
css =
|
|
172
|
+
({ css, bundledRequests } = resolveTargets(this, source, manifestDir, publicRoot, resolvePublicFolder(manifestPath, projectPath)));
|
|
56
173
|
}
|
|
57
174
|
} catch {}
|
|
58
|
-
|
|
59
|
-
return toRuntimeStylesheetModule(css);
|
|
175
|
+
return toRuntimeStylesheetModule(css, bundledRequests);
|
|
60
176
|
}
|
|
61
177
|
export default deadCssUrlLoader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RspackDevServer } from '@rspack/dev-server';
|
|
2
2
|
import type { PortManager } from './port-manager.js';
|
|
3
3
|
export type DevServerHandle = RspackDevServer | (() => RspackDevServer | null | undefined);
|
|
4
|
-
export declare function setupCleanupHandlers(devServer: DevServerHandle, portManager: PortManager): () => void;
|
|
4
|
+
export declare function setupCleanupHandlers(devServer: DevServerHandle, portManager: PortManager, onSignal?: (signal: NodeJS.Signals) => void): () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type Envelope, isMachineOutput } from '../lib/messaging.js';
|
|
1
|
+
import { type Diagnostic, type Envelope, isMachineOutput } from '../lib/messaging.js';
|
|
2
2
|
export type LifecycleCommand = 'dev' | 'start' | 'preview';
|
|
3
|
-
export type LifecycleStatus = 'starting' | 'compiled' | 'recompiled' | 'compile-failed' | 'ready' | 'browser-exited' | 'failed';
|
|
3
|
+
export type LifecycleStatus = 'starting' | 'compiled' | 'recompiled' | 'compile-failed' | 'ready' | 'browser-exited' | 'failed' | 'stopped';
|
|
4
4
|
export { isMachineOutput };
|
|
5
5
|
export declare function isLifecycleStreamEnabled(): boolean;
|
|
6
|
-
export
|
|
6
|
+
export { humanLine } from '../lib/messaging.js';
|
|
7
7
|
export declare function stripAnsi(input: string): string;
|
|
8
8
|
export interface LifecycleStreamOptions {
|
|
9
9
|
command: LifecycleCommand;
|
|
@@ -11,6 +11,7 @@ export interface LifecycleStreamOptions {
|
|
|
11
11
|
distPath: string;
|
|
12
12
|
readyPath?: string;
|
|
13
13
|
eventsPath?: string;
|
|
14
|
+
noBrowser?: boolean;
|
|
14
15
|
write?: (line: string) => void;
|
|
15
16
|
}
|
|
16
17
|
export declare class LifecycleStream {
|
|
@@ -21,6 +22,9 @@ export declare class LifecycleStream {
|
|
|
21
22
|
private readyEmitted;
|
|
22
23
|
private readyErrorEmitted;
|
|
23
24
|
private browserExitEmitted;
|
|
25
|
+
private interruptEmitted;
|
|
26
|
+
private terminalEmitted;
|
|
27
|
+
private startingEmitted;
|
|
24
28
|
private boundPort;
|
|
25
29
|
private exitWatcher;
|
|
26
30
|
private launchFailureWatcher;
|
|
@@ -35,19 +39,26 @@ export declare class LifecycleStream {
|
|
|
35
39
|
compiled(args: {
|
|
36
40
|
assets?: number;
|
|
37
41
|
durationMs?: number;
|
|
42
|
+
entrypoints?: number;
|
|
38
43
|
}): Envelope<unknown> | null;
|
|
39
44
|
compileFailed(args: {
|
|
40
45
|
output?: string;
|
|
41
46
|
durationMs?: number;
|
|
42
47
|
message?: string;
|
|
48
|
+
diagnostics?: Diagnostic[];
|
|
49
|
+
diagnosticsTruncated?: boolean;
|
|
43
50
|
}): Envelope<unknown> | null;
|
|
44
51
|
ready(args?: {
|
|
45
52
|
port?: number | null;
|
|
46
53
|
}): Envelope<unknown> | null;
|
|
54
|
+
private contractError;
|
|
55
|
+
exited(exitCode: number): Envelope<unknown> | null;
|
|
56
|
+
emitOnExit(): () => void;
|
|
47
57
|
browserExited(args?: {
|
|
48
58
|
exitCode?: number | null;
|
|
49
59
|
message?: string;
|
|
50
60
|
}): Envelope<unknown> | null;
|
|
61
|
+
interrupted(signal: string): Envelope<unknown> | null;
|
|
51
62
|
failed(message: string): Envelope<unknown> | null;
|
|
52
63
|
watchBrowserExit(intervalMs?: number, onExit?: (ready: Record<string, unknown>) => void): () => void;
|
|
53
64
|
watchBrowserLaunchFailure(intervalMs: number | undefined, onFailure: (ready: Record<string, unknown>) => void): () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Compiler, Configuration } from '@rspack/core';
|
|
2
|
+
export interface SessionStartPruneOptions {
|
|
3
|
+
isRestart: boolean;
|
|
4
|
+
distPath: string;
|
|
5
|
+
readyPath: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class PruneSessionStartLeftovers {
|
|
8
|
+
static readonly name: string;
|
|
9
|
+
private readonly distPath;
|
|
10
|
+
constructor(distPath: string);
|
|
11
|
+
apply(compiler: Compiler): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function withSessionStartPrune(config: Configuration, session: SessionStartPruneOptions): Configuration;
|