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/README.md
CHANGED
|
@@ -292,6 +292,8 @@ dist/
|
|
|
292
292
|
- Built on the Rspack stack; user config is loaded when an `extension.config.*` is present.
|
|
293
293
|
- Only `EXTENSION_PUBLIC_*` variables are injected into client code; avoid secrets in templated `.json`/`.html`.
|
|
294
294
|
|
|
295
|
+
- A `dev` session started within the watcher's accuracy margin of the last source write (up to 2 s, usually 10 to 100 ms, for example `create` followed at once by `dev`) compiles twice at startup. The second compile is the watcher reporting files written just before it attached, not a change in the project, and the session is unaffected.
|
|
296
|
+
|
|
295
297
|
## Plugins
|
|
296
298
|
|
|
297
299
|
| Name | Group | Summary |
|
package/dist/105~0.mjs
CHANGED
|
@@ -95,4 +95,4 @@ function publicRootsFor(compiler) {
|
|
|
95
95
|
if (!compiler) return [];
|
|
96
96
|
return publicRootsByCompiler.get(compiler) || [];
|
|
97
97
|
}
|
|
98
|
-
export { findPublicFile, inspectPublicFolders, publicContainmentRoot, publicFolderOrDefault, publicRelativePath, publicResolveRoots, publicRootsFor, rememberPublicRoots, turnedOffPublicFolders };
|
|
98
|
+
export { findPublicFile, inspectPublicFolders, publicContainmentRoot, publicFolderOrDefault, publicRelativePath, publicResolveRoots, publicRootsFor, rememberPublicRoots, resolvePublicFolder, turnedOffPublicFolders };
|
package/dist/177~0.mjs
CHANGED
|
@@ -1,8 +1,62 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
-
import { publicContainmentRoot } from "./105~0.mjs";
|
|
3
|
-
import { replaceCssUrlRefs } from "./273~0.mjs";
|
|
2
|
+
import { resolvePublicFolder, publicContainmentRoot } from "./105~0.mjs";
|
|
3
|
+
import { replaceCssUrlRefs, publicOwnedOutputName } from "./273~0.mjs";
|
|
4
4
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
5
5
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
6
|
+
const BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
7
|
+
function vlq(value) {
|
|
8
|
+
let rest = value < 0 ? -value << 1 | 1 : value << 1;
|
|
9
|
+
let out = '';
|
|
10
|
+
do {
|
|
11
|
+
let digit = 31 & rest;
|
|
12
|
+
rest >>>= 5;
|
|
13
|
+
if (rest > 0) digit |= 32;
|
|
14
|
+
out += BASE64[digit];
|
|
15
|
+
}while (rest > 0);
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
function commonSuffixLength(a, b, limit) {
|
|
19
|
+
let length = 0;
|
|
20
|
+
while(length < limit && a[a.length - 1 - length] === b[b.length - 1 - length])length++;
|
|
21
|
+
return length;
|
|
22
|
+
}
|
|
23
|
+
function lineRewriteSourceMap(original, rewritten, source) {
|
|
24
|
+
const originalLines = original.split('\n');
|
|
25
|
+
const rewrittenLines = rewritten.split('\n');
|
|
26
|
+
const lines = [];
|
|
27
|
+
let previousLine = 0;
|
|
28
|
+
let previousColumn = 0;
|
|
29
|
+
for(let index = 0; index < rewrittenLines.length; index++){
|
|
30
|
+
const from = originalLines[index] ?? '';
|
|
31
|
+
const to = rewrittenLines[index];
|
|
32
|
+
const segments = [
|
|
33
|
+
`${vlq(0)}${vlq(0)}${vlq(index - previousLine)}${vlq(0 - previousColumn)}`
|
|
34
|
+
];
|
|
35
|
+
previousLine = index;
|
|
36
|
+
previousColumn = 0;
|
|
37
|
+
if (from !== to) {
|
|
38
|
+
let prefix = 0;
|
|
39
|
+
while(prefix < from.length && prefix < to.length && from[prefix] === to[prefix])prefix++;
|
|
40
|
+
const suffix = commonSuffixLength(from, to, Math.min(from.length, to.length) - prefix);
|
|
41
|
+
const generatedColumn = to.length - suffix;
|
|
42
|
+
const originalColumn = from.length - suffix;
|
|
43
|
+
segments.push(`${vlq(generatedColumn)}${vlq(0)}${vlq(0)}${vlq(originalColumn)}`);
|
|
44
|
+
previousColumn = originalColumn;
|
|
45
|
+
}
|
|
46
|
+
lines.push(segments.join(','));
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
version: 3,
|
|
50
|
+
sources: [
|
|
51
|
+
source
|
|
52
|
+
],
|
|
53
|
+
sourcesContent: [
|
|
54
|
+
original
|
|
55
|
+
],
|
|
56
|
+
names: [],
|
|
57
|
+
mappings: lines.join(';')
|
|
58
|
+
};
|
|
59
|
+
}
|
|
6
60
|
const PUBLIC_ROOT_SCHEME = 'https://extensionjs-public.invalid';
|
|
7
61
|
function isFile(candidate) {
|
|
8
62
|
try {
|
|
@@ -11,27 +65,41 @@ function isFile(candidate) {
|
|
|
11
65
|
return false;
|
|
12
66
|
}
|
|
13
67
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
68
|
+
function publicPathOfRelativeRef(req, { issuerDir, publicDir }) {
|
|
69
|
+
if (!req || /^[a-z][a-z0-9+.-]*:/i.test(req)) return;
|
|
70
|
+
if (req.startsWith('~') || req.startsWith('@')) return;
|
|
71
|
+
const absolutePath = __rspack_external_node_path_806ed179.resolve(issuerDir, req);
|
|
72
|
+
if (!isFile(absolutePath)) return;
|
|
73
|
+
return publicOwnedOutputName(absolutePath, publicDir);
|
|
74
|
+
}
|
|
75
|
+
function keepPublicRootRefs(source, publicRoot, relative) {
|
|
76
|
+
return replaceCssUrlRefs(source, (request, { isImport })=>{
|
|
77
|
+
if (request.startsWith('//')) return;
|
|
17
78
|
const suffixAt = request.search(/[?#]/);
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
|
|
79
|
+
const req = -1 === suffixAt ? request : request.slice(0, suffixAt);
|
|
80
|
+
if (req.startsWith('/')) {
|
|
81
|
+
const rel = req.slice(1);
|
|
82
|
+
if (!rel || !isFile(__rspack_external_node_path_806ed179.join(publicRoot, rel))) return;
|
|
83
|
+
return `${PUBLIC_ROOT_SCHEME}${request}`;
|
|
84
|
+
}
|
|
85
|
+
if (!relative || isImport) return;
|
|
86
|
+
const publicPath = publicPathOfRelativeRef(req, relative);
|
|
87
|
+
if (!publicPath) return;
|
|
88
|
+
return `${PUBLIC_ROOT_SCHEME}/${publicPath}${request.slice(req.length)}`;
|
|
21
89
|
});
|
|
22
90
|
}
|
|
23
|
-
function
|
|
24
|
-
return source.split(PUBLIC_ROOT_SCHEME).join('');
|
|
25
|
-
}
|
|
26
|
-
function publicCssUrlLoader(source) {
|
|
91
|
+
function publicCssUrlLoader(source, map) {
|
|
27
92
|
const { manifestPath, projectPath } = this.getOptions() || {};
|
|
28
|
-
|
|
29
|
-
try {
|
|
93
|
+
let rewritten = source;
|
|
94
|
+
if (manifestPath && projectPath) try {
|
|
30
95
|
const publicRoot = publicContainmentRoot(manifestPath, projectPath);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
96
|
+
const publicDir = resolvePublicFolder(manifestPath, projectPath);
|
|
97
|
+
rewritten = keepPublicRootRefs(source, publicRoot, publicDir && this.resourcePath ? {
|
|
98
|
+
issuerDir: __rspack_external_node_path_806ed179.dirname(this.resourcePath),
|
|
99
|
+
publicDir
|
|
100
|
+
} : void 0);
|
|
101
|
+
} catch {}
|
|
102
|
+
this.callback(null, rewritten, map ?? (rewritten === source ? void 0 : lineRewriteSourceMap(source, rewritten, this.resourcePath || '')));
|
|
35
103
|
}
|
|
36
104
|
export default publicCssUrlLoader;
|
|
37
|
-
export { PUBLIC_ROOT_SCHEME, keepPublicRootRefs
|
|
105
|
+
export { PUBLIC_ROOT_SCHEME, keepPublicRootRefs };
|
package/dist/273~0.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import { canonicalizeDir, canonicalizeResourcePath } from "./712~0.mjs";
|
|
2
3
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
3
4
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
4
5
|
const ASSET_EXT = /\.(png|jpe?g|gif|webp|svg|avif|ico|bmp|cur|woff2?|ttf|otf|eot|mp3|mp4|webm|ogg|wav)$/i;
|
|
@@ -20,11 +21,20 @@ function isDeadCssUrlRef(rawRequest, { issuerDir, roots }) {
|
|
|
20
21
|
];
|
|
21
22
|
return !candidates.some((candidate)=>__rspack_external_node_fs_1b05aee1.existsSync(candidate));
|
|
22
23
|
}
|
|
24
|
+
function publicOwnedOutputName(absolutePath, publicDir) {
|
|
25
|
+
if (!publicDir) return;
|
|
26
|
+
const rel = __rspack_external_node_path_806ed179.relative(canonicalizeDir(publicDir), canonicalizeResourcePath(absolutePath));
|
|
27
|
+
if (!rel || __rspack_external_node_path_806ed179.isAbsolute(rel) || '..' === rel.split(__rspack_external_node_path_806ed179.sep)[0]) return;
|
|
28
|
+
return toPosixPath(rel);
|
|
29
|
+
}
|
|
23
30
|
function replaceCssUrlRefs(source, replacer) {
|
|
24
|
-
return source.replace(URL_REF, (whole, dq, sq, bare)=>{
|
|
31
|
+
return source.replace(URL_REF, (whole, dq, sq, bare, offset)=>{
|
|
25
32
|
const request = dq ?? sq ?? bare ?? '';
|
|
26
33
|
if (!request) return whole;
|
|
27
|
-
const
|
|
34
|
+
const before = source.slice(Math.max(0, offset - 32), offset);
|
|
35
|
+
const next = replacer(request, {
|
|
36
|
+
isImport: /@import\s*$/i.test(before)
|
|
37
|
+
});
|
|
28
38
|
if (void 0 === next) return whole;
|
|
29
39
|
return `url("${next.replace(/["\\]/g, '\\$&')}")`;
|
|
30
40
|
});
|
|
@@ -42,4 +52,4 @@ function extractCssUrlRefs(source) {
|
|
|
42
52
|
}
|
|
43
53
|
return found;
|
|
44
54
|
}
|
|
45
|
-
export { extractCssUrlRefs, isDeadCssUrlRef, replaceCssUrlRefs, toPosixPath };
|
|
55
|
+
export { extractCssUrlRefs, isDeadCssUrlRef, publicOwnedOutputName, replaceCssUrlRefs, toPosixPath };
|