extension-develop 4.1.39 → 4.1.40-canary.458.001a6a0
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 +7 -4
- package/dist/{771~0.mjs → 5h~0.mjs} +13 -3
- package/dist/{273~0.mjs → 6l~0.mjs} +1 -1
- package/dist/{524~0.mjs → 9~0.mjs} +18 -2
- package/dist/{640~0.mjs → bh~0.mjs} +6 -1
- package/dist/bridge.mjs +14 -8
- package/dist/b~0.mjs +8568 -0
- package/dist/command-dev.d.ts +2 -0
- package/dist/command-preview.d.ts +2 -0
- package/dist/contracts.mjs +2 -1
- package/dist/{469~0.mjs → cp~0.mjs} +30 -18
- package/dist/css-parse-guard-loader.mjs +2 -2
- package/dist/c~0.mjs +56 -0
- package/dist/dead-css-url-loader.mjs +20 -119
- package/dist/dev-server/control-bridge/actions-file.d.ts +7 -0
- package/dist/dev-server/control-bridge/broker.d.ts +42 -2
- package/dist/dev-server/control-bridge/consumer-client.d.ts +7 -0
- package/dist/dev-server/control-bridge/contracts.d.ts +29 -1
- package/dist/dev-server/control-bridge/logs-file.d.ts +6 -0
- package/dist/dev-server/control-bridge/loopback.d.ts +1 -0
- package/dist/dev-server/control-bridge/producer-runtime.d.ts +5 -2
- package/dist/dev-server/control-bridge/production-control.d.ts +1 -0
- package/dist/dev-server/control-bridge/session-token.d.ts +5 -2
- package/dist/dev-server/cors.d.ts +4 -2
- package/dist/dev-server/messages.d.ts +6 -0
- package/dist/dev-server/session-restart.d.ts +3 -1
- package/dist/dev-server~0.mjs +71 -129
- package/dist/df~0.mjs +197 -0
- package/dist/{846~0.mjs → d~0.mjs} +4 -3
- package/dist/ensure-hmr-for-scripts.js +3 -3
- package/dist/ensure-hmr-for-scripts.mjs +3 -3
- package/dist/extension-js-devtools/build-stamp.json +2 -2
- package/dist/extension-js-devtools/chrome/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/chrome/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/chromium/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/edge/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
- package/dist/extension-js-devtools/firefox/pages/welcome.js +2 -2
- package/dist/extension-js-theme/build-stamp.json +2 -2
- package/dist/{143~0.mjs → ey~0.mjs} +2 -2
- package/dist/e~0.mjs +33 -0
- package/dist/feature-scripts-classic-traced-globals-loader.mjs +7 -2
- package/dist/feature-scripts-content-script-wrapper.js +55 -17
- package/dist/feature-scripts-content-script-wrapper.mjs +55 -17
- package/dist/feature-scripts-native-geturl-import-loader.mjs +1 -1
- package/dist/{105~0.mjs → g0~0.mjs} +1 -1
- package/dist/{88~0.mjs → j6~0.mjs} +9 -1
- package/dist/{731~0.mjs → j~0.mjs} +2 -2
- package/dist/{712~0.mjs → ka~0.mjs} +18 -2
- package/dist/{852~0.mjs → k~0.mjs} +4 -2
- package/dist/late-css-import-loader.mjs +1 -1
- package/dist/lib/addon-lint.d.ts +6 -0
- package/dist/lib/build-summary.d.ts +6 -0
- package/dist/lib/dev-additions.d.ts +12 -0
- package/dist/lib/extension-base-from-stack.d.ts +16 -0
- package/dist/lib/localized-manifest-name.d.ts +9 -0
- package/dist/lib/messages.d.ts +5 -2
- package/dist/lib/process-started-at.d.ts +1 -0
- package/dist/lib/real-path.d.ts +8 -0
- package/dist/lib/resource-path.d.ts +1 -0
- package/dist/lib/session-paths.d.ts +2 -0
- package/dist/lib/split-chunks.d.ts +2 -1
- package/dist/lib/stats-handler.d.ts +1 -0
- package/dist/lib/tsconfig-includes-file.d.ts +1 -0
- package/dist/l~0.mjs +2290 -0
- package/dist/main-world-bridge.js +92 -23
- package/dist/main-world-bridge.mjs +92 -23
- package/dist/manifest-entry.d.ts +2 -0
- package/dist/manifest.mjs +3 -1
- package/dist/module.mjs +3 -3
- package/dist/{832~0.mjs → m~0.mjs} +2242 -286
- package/dist/o~0.mjs +47 -0
- package/dist/plugin-browsers/index.d.ts +7 -0
- package/dist/plugin-browsers/safari-dev-plugin.d.ts +2 -0
- package/dist/plugin-compatibility/compatibility-lib/messages.d.ts +1 -1
- package/dist/plugin-compatibility/compatibility-lib/native-browser-namespace.d.ts +5 -0
- package/dist/plugin-compatibility/feature-browser-global.d.ts +4 -0
- package/dist/plugin-compilation/compilation-lib/messages.d.ts +4 -1
- package/dist/plugin-compilation/env.d.ts +1 -0
- package/dist/plugin-compilation/index.d.ts +2 -0
- package/dist/plugin-compilation/node-builtins.d.ts +5 -0
- package/dist/plugin-compilation/one-diagnostic-per-location.d.ts +13 -0
- package/dist/plugin-compilation/resolve-file-requests.d.ts +16 -0
- package/dist/plugin-compilation/warm-ancestor-watchers.d.ts +19 -0
- package/dist/plugin-compilation/watch-real-project-path.d.ts +27 -0
- package/dist/plugin-compilation/zip.d.ts +2 -0
- package/dist/plugin-css/css-in-content-script-loader.d.ts +1 -1
- package/dist/plugin-css/css-lib/build-css-rules.d.ts +3 -0
- package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +3 -1
- package/dist/plugin-css/css-lib/messages.d.ts +4 -0
- package/dist/plugin-css/css-lib/sfc-style-block.d.ts +26 -0
- package/dist/plugin-css/css-lib/unplaced-style-imports.d.ts +7 -0
- package/dist/plugin-css/css-lib/verbatim-css.d.ts +1 -0
- package/dist/plugin-css/dead-css-url-loader.d.ts +9 -1
- package/dist/plugin-css/index.d.ts +1 -0
- package/dist/plugin-css/sfc-style-block-loader.d.ts +18 -0
- package/dist/plugin-css/unplaced-style-import-loader.d.ts +16 -0
- package/dist/plugin-playwright/index.d.ts +22 -0
- package/dist/plugin-reload/classify-reload.d.ts +20 -0
- package/dist/plugin-reload/index.d.ts +4 -2
- package/dist/plugin-reload/messages.d.ts +1 -0
- package/dist/plugin-reload/reload-dispatch.d.ts +21 -2
- package/dist/plugin-reload/reload-lib/dev-content-scripts.d.ts +6 -0
- package/dist/plugin-reload/reload-lib/scripts-replay-shim.d.ts +1 -1
- package/dist/plugin-reload/steps/inject-bridge-producer.d.ts +6 -0
- package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/ChunkLoader.d.ts +3 -0
- package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/AutoPublicPath.d.ts +1 -1
- package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/BaseUri.d.ts +1 -1
- package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/LoadScript.d.ts +1 -1
- package/dist/plugin-reload/steps/setup-reload-strategy/webpack-target-webextension-fork/lib/webpack5/RuntimeModules/PublicPath.d.ts +1 -1
- package/dist/plugin-special-folders/get-data.d.ts +2 -0
- package/dist/plugin-special-folders/hint-import-only-scripts.d.ts +4 -0
- package/dist/plugin-special-folders/include-files.d.ts +2 -0
- package/dist/plugin-special-folders/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-html/html-lib/inject.d.ts +1 -1
- package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +1 -0
- package/dist/plugin-web-extension/feature-html/steps/update-html-file.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-gecko.d.ts +21 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/webkit-unsupported-keys.d.ts +15 -0
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +7 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-additions.d.ts +8 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-description-length.d.ts +25 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +2 -2
- package/dist/plugin-web-extension/feature-scripts/contracts.d.ts +3 -0
- package/dist/plugin-web-extension/feature-scripts/index.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/messages.d.ts +9 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/completion-value.d.ts +13 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/injected-sheet-urls.d.ts +5 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/main-world-bridge-pairing.d.ts +5 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/main-world-copy-routing.d.ts +2 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/registration-worlds.d.ts +10 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/runtime-main-world-scripts.d.ts +25 -2
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/runtime-script-sheet.d.ts +14 -0
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/taken-extension-base.d.ts +10 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-base-uri-runtime-module.d.ts +7 -1
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/content-script-wrapper.d.ts +2 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/index.d.ts +2 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-public-path-runtime-module.d.ts +6 -0
- package/dist/plugin-web-extension/feature-scripts/steps/classic-traced-globals-loader.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/compile-main-world-scripts.d.ts +4 -0
- package/dist/plugin-web-extension/feature-scripts/steps/keep-completion-value.d.ts +6 -0
- package/dist/plugin-web-extension/feature-scripts/steps/pair-runtime-main-world-bridges.d.ts +12 -0
- package/dist/plugin-web-extension/feature-scripts/steps/place-runtime-script-sheets.d.ts +12 -0
- package/dist/plugin-web-extension/feature-scripts/steps/prune-main-world-bridges.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/root-injected-sheet-urls.d.ts +9 -0
- package/dist/plugin-web-extension/feature-scripts/steps/route-main-world-copies.d.ts +10 -0
- package/dist/plugin-web-extension/feature-scripts/steps/source-literals.d.ts +24 -0
- package/dist/plugin-web-extension/feature-scripts/steps/take-extension-base.d.ts +11 -0
- package/dist/plugin-web-extension/feature-scripts/steps/trace-runtime-loaded-files.d.ts +18 -3
- package/dist/plugin-web-extension/feature-scripts/steps/warn-main-world-registration-changed.d.ts +12 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-moved-page-relative-urls.d.ts +30 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-page-relative-script-path.d.ts +10 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-unknown-registration-world.d.ts +10 -0
- package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/page-requests.d.ts +5 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/resolve-war.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/unreachable-resources.d.ts +1 -0
- package/dist/plugin-web-extension/shared/script-graph.d.ts +12 -0
- package/dist/preprocessor-passthrough-loader.mjs +1 -1
- package/dist/preview.mjs +1 -1
- package/dist/public-css-url-loader.mjs +1 -1
- package/dist/{331~0.mjs → q~0.mjs} +2 -2
- package/dist/rj~0.mjs +125 -0
- package/dist/{519~0.mjs → rl~0.mjs} +53 -3
- package/dist/rspack-config~0.mjs +2768 -3256
- package/dist/{177~0.mjs → r~0.mjs} +2 -2
- package/dist/sfc-style-block-loader.mjs +49 -0
- package/dist/stats-handler~0.mjs +15 -7
- package/dist/tm~0.mjs +71 -0
- package/dist/types.d.ts +43 -3
- package/dist/{285~0.mjs → t~0.mjs} +41 -26
- package/dist/unplaced-style-import-loader.mjs +131 -0
- package/dist/x~0.mjs +3 -0
- package/dist/y~0.mjs +234 -0
- package/dist/zip~0.mjs +5 -4
- package/dist/{363~0.mjs → z~0.mjs} +360 -267
- package/package.json +5 -5
- package/dist/527~0.mjs +0 -3
- package/dist/840~0.mjs +0 -5635
- /package/dist/{895~0.mjs → 3~0.mjs} +0 -0
- /package/dist/{374~0.mjs → 5~0.mjs} +0 -0
- /package/dist/{206~0.mjs → 6~0.mjs} +0 -0
- /package/dist/{471~0.mjs → g~0.mjs} +0 -0
- /package/dist/{117~0.mjs → w~0.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
-
import { resolvePublicFolder, publicContainmentRoot } from "./
|
|
3
|
-
import { replaceCssUrlRefs, publicOwnedOutputName } from "./
|
|
2
|
+
import { resolvePublicFolder, publicContainmentRoot } from "./g0~0.mjs";
|
|
3
|
+
import { replaceCssUrlRefs, publicOwnedOutputName } from "./6l~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
6
|
const BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import { isSfcStyleBlock, moduleStyleBlockRequest, readStyleBlockProxyRequest, toRuntimeStylesheetModule, isSfcInlineStyleBlockQuery, sfcStyleBlockId, dropSourceMapComment, isSfcModuleStyleBlockQuery } from "./y~0.mjs";
|
|
3
|
+
import { inlineStylesheetUrls } from "./dead-css-url-loader.mjs";
|
|
4
|
+
import { canonicalizeDir, canonicalizeResourcePath } from "./ka~0.mjs";
|
|
5
|
+
import { toPosixPath } from "./6l~0.mjs";
|
|
6
|
+
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
7
|
+
function runsLast(loader) {
|
|
8
|
+
const { loaders, loaderIndex } = loader;
|
|
9
|
+
if (!Array.isArray(loaders) || 'number' != typeof loaderIndex) return true;
|
|
10
|
+
const own = loaders[loaderIndex]?.path;
|
|
11
|
+
return loaders.findIndex((entry)=>entry?.path === own) === loaderIndex;
|
|
12
|
+
}
|
|
13
|
+
function sfcStyleBlockLoader(source) {
|
|
14
|
+
if (!isSfcStyleBlock(this) || !runsLast(this)) return source;
|
|
15
|
+
const inline = isSfcInlineStyleBlockQuery(this.resourceQuery);
|
|
16
|
+
const proxied = readStyleBlockProxyRequest(source);
|
|
17
|
+
if (proxied && inline) {
|
|
18
|
+
const done = this.async();
|
|
19
|
+
this.importModule(proxied, {}, (error, exports)=>{
|
|
20
|
+
if (error) return done(error);
|
|
21
|
+
const text = 'string' == typeof exports ? exports : exports?.default;
|
|
22
|
+
done(null, 'string' == typeof text ? text : '');
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (proxied) return `import ${JSON.stringify(proxied)};\n`;
|
|
27
|
+
if (inline) return source;
|
|
28
|
+
const { css, bundledRequests } = inlineStylesheetUrls(this, 'production' === this.mode ? dropSourceMapComment(source) : source);
|
|
29
|
+
const { projectPath, gecko, baseAttribute, baseScheme } = this.getOptions() || {};
|
|
30
|
+
const resourcePath = canonicalizeResourcePath(this.resourcePath);
|
|
31
|
+
const relativePath = projectPath ? toPosixPath(__rspack_external_node_path_806ed179.relative(canonicalizeDir(projectPath), resourcePath)) : __rspack_external_node_path_806ed179.basename(resourcePath);
|
|
32
|
+
return toRuntimeStylesheetModule(css, bundledRequests, sfcStyleBlockId(relativePath, String(this.resourceQuery || ''), 'development' === this.mode && projectPath ? projectPath : ''), true === gecko, baseAttribute, baseScheme);
|
|
33
|
+
}
|
|
34
|
+
function pitch() {
|
|
35
|
+
const query = String(this.resourceQuery || '');
|
|
36
|
+
if (!isSfcModuleStyleBlockQuery(query)) return;
|
|
37
|
+
const loaders = this.loaders || [];
|
|
38
|
+
const absolute = moduleStyleBlockRequest({
|
|
39
|
+
resourcePath: this.resourcePath,
|
|
40
|
+
resourceQuery: query,
|
|
41
|
+
loaders,
|
|
42
|
+
ownPath: loaders[this.loaderIndex ?? 0]?.path
|
|
43
|
+
});
|
|
44
|
+
if (!absolute) return;
|
|
45
|
+
const request = JSON.stringify(this.context && this.utils?.contextify ? this.utils.contextify(this.context, absolute) : absolute);
|
|
46
|
+
return `export {default} from ${request};\nexport * from ${request};\n`;
|
|
47
|
+
}
|
|
48
|
+
export default sfcStyleBlockLoader;
|
|
49
|
+
export { pitch };
|
package/dist/stats-handler~0.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
2
|
+
import { supportsColor } from "pintor";
|
|
3
|
+
import { humanLine, prefix, isDebug } from "./k~0.mjs";
|
|
4
|
+
const BUNDLER_NAME = /rspack|webpack/i;
|
|
3
5
|
function scrubBrand(txt, brand = 'Extension.js') {
|
|
4
6
|
if (!txt) return txt;
|
|
5
7
|
const safeBrand = brand.replace(/\$/g, '$$$$');
|
|
@@ -9,9 +11,9 @@ function scrubBrand(txt, brand = 'Extension.js') {
|
|
|
9
11
|
preserved.push(value);
|
|
10
12
|
return token;
|
|
11
13
|
};
|
|
12
|
-
let output = txt.replace(/\bRspack\b(?=\s+performance recommendations:)/gi, preserve).replace(/https?:\/\/rspack\.(?:rs|dev)\/[^\s)]+/gi, preserve).replace(/(?<!@)\bRspack\b/gi, safeBrand).replace(/(?<!@)\bWebpack\b/gi, safeBrand).replace(/(?<!@)\bwebpack-dev-server\b/gi, `${safeBrand} dev server`).replace(/(?<!@)\bRspackDevServer\b/gi, `${safeBrand} dev server`).replace(/ModuleBuildError:\s*/g, '').replace(/ModuleParseError:\s*/g, '').replace(/Error:\s*Module\s+build\s+failed.*?\n/gi, '').replace(/\n{3,}/g, '\n\n').replace(/\n{2}(?=WARNING in )/g, '\n');
|
|
14
|
+
let output = txt.replace(/\bRspack\b(?=\s+performance recommendations:)/gi, preserve).replace(/https?:\/\/rspack\.(?:rs|dev)\/[^\s)]+/gi, preserve).replace(/`[^`\n]*`/g, (span)=>BUNDLER_NAME.test(span) ? preserve(span) : span).replace(/(['"])rspack\1/g, preserve).replace(/\{\s*rspack\s*\}/g, preserve).replace(/\brspack(?=\.(?!config\b)[A-Za-z_$])/g, preserve).replace(/(?<!@)\bRspack\b/gi, safeBrand).replace(/(?<!@)\bWebpack\b/gi, safeBrand).replace(/(?<!@)\bwebpack-dev-server\b/gi, `${safeBrand} dev server`).replace(/(?<!@)\bRspackDevServer\b/gi, `${safeBrand} dev server`).replace(/ModuleBuildError:\s*/g, '').replace(/ModuleParseError:\s*/g, '').replace(/Error:\s*Module\s+build\s+failed.*?\n/gi, '').replace(/\n{3,}/g, '\n\n').replace(/\n{2}(?=WARNING in )/g, '\n');
|
|
13
15
|
preserved.forEach((value, index)=>{
|
|
14
|
-
output = output.replace(`__EXT_BRAND_PRESERVE_${index}__`, value);
|
|
16
|
+
output = output.replace(`__EXT_BRAND_PRESERVE_${index}__`, ()=>value);
|
|
15
17
|
});
|
|
16
18
|
return output;
|
|
17
19
|
}
|
|
@@ -25,9 +27,13 @@ function makeSanitizedConsole(brand = 'Extension.js') {
|
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
const ANSI_PATTERN = /\u001b\[[0-9;]*m/g;
|
|
30
|
+
function diagnosticsHaveColor() {
|
|
31
|
+
return supportsColor(process.stderr);
|
|
32
|
+
}
|
|
28
33
|
const EMIT_TIME_WARNING_CODES = new Set([
|
|
29
34
|
'ManifestFatalShapeWarning',
|
|
30
|
-
'ManifestLegacyWarning'
|
|
35
|
+
'ManifestLegacyWarning',
|
|
36
|
+
"ManifestDescriptionWarning"
|
|
31
37
|
]);
|
|
32
38
|
function isEmitTimeWarning(warning) {
|
|
33
39
|
if (!warning || 'string' == typeof warning) return false;
|
|
@@ -138,8 +144,9 @@ function wrapStatsBlocks(raw) {
|
|
|
138
144
|
return wrapped.join('\n');
|
|
139
145
|
}
|
|
140
146
|
function renderStatsBlocks(stats, opts) {
|
|
147
|
+
const colored = diagnosticsHaveColor();
|
|
141
148
|
const raw = stats.toString({
|
|
142
|
-
colors:
|
|
149
|
+
colors: colored,
|
|
143
150
|
all: false,
|
|
144
151
|
errors: opts.errors,
|
|
145
152
|
warnings: opts.warnings
|
|
@@ -147,7 +154,8 @@ function renderStatsBlocks(stats, opts) {
|
|
|
147
154
|
if (!raw) return '';
|
|
148
155
|
const filtered = opts.warnings ? dropEmitTimeWarningBlocks(raw, collectEmitTimeWarningTexts(stats)) : raw;
|
|
149
156
|
if (!filtered.trim()) return '';
|
|
150
|
-
|
|
157
|
+
const blocks = wrapStatsBlocks(scrubBrand(humanizeCaseMismatchBlocks(filtered)));
|
|
158
|
+
return colored ? blocks : blocks.replace(ANSI_PATTERN, '');
|
|
151
159
|
}
|
|
152
160
|
function handleStatsErrors(stats) {
|
|
153
161
|
try {
|
|
@@ -167,4 +175,4 @@ function handleStatsErrors(stats) {
|
|
|
167
175
|
} catch {}
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
|
-
export { handleStatsErrors, isEmitTimeWarning, makeSanitizedConsole, renderStatsBlocks };
|
|
178
|
+
export { diagnosticsHaveColor, handleStatsErrors, isEmitTimeWarning, makeSanitizedConsole, renderStatsBlocks };
|
package/dist/tm~0.mjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
3
|
+
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
4
|
+
function codedError(code, message) {
|
|
5
|
+
const error = new Error(message);
|
|
6
|
+
error.code = code;
|
|
7
|
+
return error;
|
|
8
|
+
}
|
|
9
|
+
const MAX_REMEMBERED = 4096;
|
|
10
|
+
function nativeRealPath(target) {
|
|
11
|
+
return (__rspack_external_node_fs_1b05aee1.realpathSync.native || __rspack_external_node_fs_1b05aee1.realpathSync)(target);
|
|
12
|
+
}
|
|
13
|
+
function placeOf(parent, child) {
|
|
14
|
+
const relative = __rspack_external_node_path_806ed179.relative(parent, child);
|
|
15
|
+
if ('' === relative) return 'same';
|
|
16
|
+
return '..' === relative || relative.startsWith(`..${__rspack_external_node_path_806ed179.sep}`) || __rspack_external_node_path_806ed179.isAbsolute(relative) ? 'outside' : 'inside';
|
|
17
|
+
}
|
|
18
|
+
function createPathComparisons(resolveLinks = nativeRealPath) {
|
|
19
|
+
const remembered = new Map();
|
|
20
|
+
function realPath(target) {
|
|
21
|
+
const absolute = __rspack_external_node_path_806ed179.resolve(target);
|
|
22
|
+
const known = remembered.get(absolute);
|
|
23
|
+
if (void 0 !== known) return known;
|
|
24
|
+
let head = absolute;
|
|
25
|
+
const tail = [];
|
|
26
|
+
while(true)try {
|
|
27
|
+
const real = __rspack_external_node_path_806ed179.join(resolveLinks(head), ...tail);
|
|
28
|
+
if (0 === tail.length) {
|
|
29
|
+
if (remembered.size >= MAX_REMEMBERED) remembered.clear();
|
|
30
|
+
remembered.set(absolute, real);
|
|
31
|
+
}
|
|
32
|
+
return real;
|
|
33
|
+
} catch {
|
|
34
|
+
const parent = __rspack_external_node_path_806ed179.dirname(head);
|
|
35
|
+
if (parent === head) return absolute;
|
|
36
|
+
tail.unshift(__rspack_external_node_path_806ed179.basename(head));
|
|
37
|
+
head = parent;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function place(parent, child) {
|
|
41
|
+
const given = placeOf(__rspack_external_node_path_806ed179.resolve(parent), __rspack_external_node_path_806ed179.resolve(child));
|
|
42
|
+
if ('outside' !== given) return given;
|
|
43
|
+
const real = placeOf(realPath(parent), realPath(child));
|
|
44
|
+
return 'outside' === real ? given : real;
|
|
45
|
+
}
|
|
46
|
+
function isSamePath(a, b) {
|
|
47
|
+
if (!a || !b) return false;
|
|
48
|
+
return __rspack_external_node_path_806ed179.resolve(a) === __rspack_external_node_path_806ed179.resolve(b) || realPath(a) === realPath(b);
|
|
49
|
+
}
|
|
50
|
+
function isInsidePath(parent, child) {
|
|
51
|
+
if (!parent || !child) return false;
|
|
52
|
+
return 'inside' === place(parent, child);
|
|
53
|
+
}
|
|
54
|
+
function isSameOrInsidePath(parent, child) {
|
|
55
|
+
if (!parent || !child) return false;
|
|
56
|
+
return 'outside' !== place(parent, child);
|
|
57
|
+
}
|
|
58
|
+
function isOsPathUnder(folder, reference) {
|
|
59
|
+
if (!folder || !reference) return false;
|
|
60
|
+
return reference.startsWith(folder) || isSameOrInsidePath(folder, reference);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
realPath,
|
|
64
|
+
isSamePath,
|
|
65
|
+
isInsidePath,
|
|
66
|
+
isSameOrInsidePath,
|
|
67
|
+
isOsPathUnder
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const { realPath: real_path_realPath, isSamePath: real_path_isSamePath, isInsidePath: real_path_isInsidePath, isSameOrInsidePath: real_path_isSameOrInsidePath, isOsPathUnder: real_path_isOsPathUnder } = createPathComparisons();
|
|
71
|
+
export { codedError, real_path_isInsidePath, real_path_isOsPathUnder, real_path_isSameOrInsidePath, real_path_isSamePath };
|
package/dist/types.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export type PluginInterface = {
|
|
|
38
38
|
manifestPath: string;
|
|
39
39
|
browser?: DevOptions['browser'];
|
|
40
40
|
includeList?: FilepathList;
|
|
41
|
+
/** The HTML page entries of this build, for a step that reads page scripts. */
|
|
42
|
+
pageList?: FilepathList;
|
|
41
43
|
transpilePackages?: string[];
|
|
42
44
|
/**
|
|
43
45
|
* Compile-time constants, each value JSON-serialized into the bundle the
|
|
@@ -195,6 +197,8 @@ export interface DevOptions extends BrowserOptionsBase {
|
|
|
195
197
|
zip?: boolean;
|
|
196
198
|
zipSource?: boolean;
|
|
197
199
|
zipFilename?: string;
|
|
200
|
+
zipDir?: string;
|
|
201
|
+
sourceMaps?: boolean;
|
|
198
202
|
logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'all';
|
|
199
203
|
logContexts?: LogContext[];
|
|
200
204
|
logFormat?: 'pretty' | 'json' | 'ndjson';
|
|
@@ -240,8 +244,19 @@ export interface BuildOptions {
|
|
|
240
244
|
*/
|
|
241
245
|
extensions?: CompanionExtensionsConfig;
|
|
242
246
|
zipFilename?: string;
|
|
247
|
+
/**
|
|
248
|
+
* Folder the archives are written to, relative to the project root or
|
|
249
|
+
* absolute. Defaults to the folder that holds the browser output, `dist`.
|
|
250
|
+
* The file name and its browser suffix stay as `zipFilename` sets them.
|
|
251
|
+
*/
|
|
252
|
+
zipDir?: string;
|
|
243
253
|
zip?: boolean;
|
|
244
254
|
zipSource?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Write a `.map` file beside each script and stylesheet of a production
|
|
257
|
+
* build. The maps stay out of the zip. Defaults to `false`.
|
|
258
|
+
*/
|
|
259
|
+
sourceMaps?: boolean;
|
|
245
260
|
polyfill?: boolean;
|
|
246
261
|
silent?: boolean;
|
|
247
262
|
/**
|
|
@@ -476,6 +491,11 @@ export interface CommonWebpackOptions {
|
|
|
476
491
|
controlPortUnavailableReason?: string | null;
|
|
477
492
|
controlPath?: string;
|
|
478
493
|
logsPath?: string;
|
|
494
|
+
/**
|
|
495
|
+
* Set by dev-server when act verbs are allowed and a browser launch
|
|
496
|
+
* follows, so ready.json waits for the background to connect.
|
|
497
|
+
*/
|
|
498
|
+
readyAwaitsExecutor?: boolean;
|
|
479
499
|
}
|
|
480
500
|
/**
|
|
481
501
|
* Canonical options type for webpack-config consumers.
|
|
@@ -536,7 +556,7 @@ export interface FileConfig {
|
|
|
536
556
|
define?: Record<string, unknown>;
|
|
537
557
|
folders?: SpecialFoldersConfig;
|
|
538
558
|
};
|
|
539
|
-
build?: Pick<BuildOptions, 'outDir' | 'zipFilename' | 'zip' | 'zipSource' | 'polyfill' | 'silent' | 'addonLint' | 'minify' | 'safariBinary' | 'appName' | 'bundleId' | 'developmentTeam' | 'macOsOnly' | 'appIcon' | 'forceRegenerate'> & {
|
|
559
|
+
build?: Pick<BuildOptions, 'outDir' | 'zipFilename' | 'zipDir' | 'zip' | 'zipSource' | 'sourceMaps' | 'polyfill' | 'silent' | 'addonLint' | 'minify' | 'safariBinary' | 'appName' | 'bundleId' | 'developmentTeam' | 'macOsOnly' | 'appIcon' | 'forceRegenerate'> & {
|
|
540
560
|
browser?: BrowserType;
|
|
541
561
|
extensions?: CompanionExtensionsConfig;
|
|
542
562
|
transpilePackages?: string[];
|
|
@@ -612,18 +632,38 @@ export interface ConfigHookContext {
|
|
|
612
632
|
browser: BrowserType;
|
|
613
633
|
mode: 'development' | 'production' | 'none';
|
|
614
634
|
command: 'dev' | 'build' | 'start' | 'preview';
|
|
635
|
+
/**
|
|
636
|
+
* The bundler this run compiles with, so a hook reaches `ProvidePlugin`
|
|
637
|
+
* or `NormalModuleReplacementPlugin` with no bundler of the project's own.
|
|
638
|
+
*/
|
|
639
|
+
rspack: typeof import('@rspack/core').rspack;
|
|
615
640
|
}
|
|
616
641
|
export interface SpecialFoldersConfig {
|
|
617
642
|
scripts?: string | false;
|
|
618
643
|
pages?: string | false;
|
|
619
644
|
public?: string | false;
|
|
620
645
|
}
|
|
646
|
+
/**
|
|
647
|
+
* One `include` source in its long form. `minify: false` ships a script as
|
|
648
|
+
* authored where a production build would minify it.
|
|
649
|
+
*/
|
|
650
|
+
export interface IncludeFileEntry {
|
|
651
|
+
/** The source path, relative to the project root. */
|
|
652
|
+
from: string;
|
|
653
|
+
/**
|
|
654
|
+
* Minify a `.js`, `.mjs` or `.cjs` source in a production build. Names
|
|
655
|
+
* are shortened and comments dropped, and no statement is rewritten.
|
|
656
|
+
* Defaults to `true`.
|
|
657
|
+
*/
|
|
658
|
+
minify?: boolean;
|
|
659
|
+
}
|
|
621
660
|
/**
|
|
622
661
|
* Extra files for the build output. Each key is the output path, relative
|
|
623
662
|
* to the extension root, and each value the source path, relative to the
|
|
624
|
-
* project root
|
|
663
|
+
* project root, or `{from, minify}`. A folder source copies its tree under
|
|
664
|
+
* the output path. A production build minifies the scripts among them.
|
|
625
665
|
*/
|
|
626
|
-
export type IncludeFilesConfig = Record<string, string>;
|
|
666
|
+
export type IncludeFilesConfig = Record<string, string | IncludeFileEntry>;
|
|
627
667
|
/**
|
|
628
668
|
* Files the build leaves out, each relative to the project root. A page or
|
|
629
669
|
* script in a special folder named here gets no entry, a public file named
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
-
import { CONTROL_TOKEN_FILE_PREFIX, controlTokenPath, legacyControlTokenPath, sessionStateDir } from "./
|
|
2
|
+
import { CONTROL_TOKEN_FILE_PREFIX, controlTokenPath, ensureSessionStateIgnoreFile, legacyControlTokenPath, sessionStateDir } from "./5h~0.mjs";
|
|
3
3
|
import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
|
|
4
4
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
5
5
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
@@ -23,12 +23,11 @@ const REFUSAL_URL_REFUSED = 'url_refused';
|
|
|
23
23
|
const REFUSAL_TAB_NOT_FOUND = 'tab_not_found';
|
|
24
24
|
const REFUSAL_SURFACE_NOT_DECLARED = 'surface_not_declared';
|
|
25
25
|
const CONTROL_WS_PATH = '/extjs-control';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
26
|
+
const RENAME_BLOCKED_CODES = new Set([
|
|
27
|
+
'EPERM',
|
|
28
|
+
'EBUSY'
|
|
29
|
+
]);
|
|
30
|
+
function writeTokenDirect(file, token) {
|
|
32
31
|
__rspack_external_node_fs_1b05aee1.writeFileSync(file, token, {
|
|
33
32
|
encoding: 'utf-8',
|
|
34
33
|
mode: 384
|
|
@@ -36,13 +35,36 @@ function writeControlToken(projectPath, browser) {
|
|
|
36
35
|
try {
|
|
37
36
|
__rspack_external_node_fs_1b05aee1.chmodSync(file, 384);
|
|
38
37
|
} catch {}
|
|
38
|
+
}
|
|
39
|
+
function tempTokenPath(file) {
|
|
40
|
+
const unique = `${process.pid}-${__rspack_external_node_crypto_2e7c4b46.randomBytes(6).toString('hex')}`;
|
|
41
|
+
return __rspack_external_node_path_806ed179.join(__rspack_external_node_path_806ed179.dirname(file), `.${__rspack_external_node_path_806ed179.basename(file)}.${unique}.tmp`);
|
|
42
|
+
}
|
|
43
|
+
function writeTokenWhole(file, token, io) {
|
|
44
|
+
const rename = io.rename ?? __rspack_external_node_fs_1b05aee1.renameSync;
|
|
45
|
+
const temp = tempTokenPath(file);
|
|
39
46
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
writeTokenDirect(temp, token);
|
|
48
|
+
rename(temp, file);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
__rspack_external_node_fs_1b05aee1.rmSync(temp, {
|
|
51
|
+
force: true
|
|
44
52
|
});
|
|
45
|
-
|
|
53
|
+
const code = error?.code;
|
|
54
|
+
if (!code || !RENAME_BLOCKED_CODES.has(code)) throw error;
|
|
55
|
+
writeTokenDirect(file, token);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function writeControlToken(projectPath, browser, io = {}) {
|
|
59
|
+
const token = __rspack_external_node_crypto_2e7c4b46.randomBytes(32).toString('hex');
|
|
60
|
+
const file = controlTokenPath(projectPath, browser);
|
|
61
|
+
__rspack_external_node_fs_1b05aee1.mkdirSync(__rspack_external_node_path_806ed179.dirname(file), {
|
|
62
|
+
recursive: true
|
|
63
|
+
});
|
|
64
|
+
ensureSessionStateIgnoreFile(projectPath);
|
|
65
|
+
writeTokenWhole(file, token, io);
|
|
66
|
+
try {
|
|
67
|
+
writeTokenWhole(legacyControlTokenPath(projectPath), token, io);
|
|
46
68
|
} catch {}
|
|
47
69
|
return token;
|
|
48
70
|
}
|
|
@@ -66,20 +88,13 @@ function readControlToken(projectPath, browser) {
|
|
|
66
88
|
if (hasAnyPerBrowserToken(projectPath)) return null;
|
|
67
89
|
return readTokenFile(legacyControlTokenPath(projectPath));
|
|
68
90
|
}
|
|
69
|
-
function clearControlToken(projectPath, browser) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
__rspack_external_node_fs_1b05aee1.rmSync(file, {
|
|
77
|
-
force: true
|
|
78
|
-
});
|
|
79
|
-
} catch {}
|
|
80
|
-
try {
|
|
81
|
-
const legacy = legacyControlTokenPath(projectPath);
|
|
82
|
-
if (token && __rspack_external_node_fs_1b05aee1.readFileSync(legacy, 'utf-8').trim() === token) __rspack_external_node_fs_1b05aee1.rmSync(legacy, {
|
|
91
|
+
function clearControlToken(projectPath, browser, ownToken) {
|
|
92
|
+
const slots = [
|
|
93
|
+
controlTokenPath(projectPath, browser),
|
|
94
|
+
legacyControlTokenPath(projectPath)
|
|
95
|
+
];
|
|
96
|
+
for (const slot of slots)try {
|
|
97
|
+
if (readTokenFile(slot) === ownToken) __rspack_external_node_fs_1b05aee1.rmSync(slot, {
|
|
83
98
|
force: true
|
|
84
99
|
});
|
|
85
100
|
} catch {}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import { WebpackError } from "@rspack/core";
|
|
3
|
+
import { readScriptText, createLocalImportResolver, collectModuleSpecifiers, walkLocalImportGraph } from "./l~0.mjs";
|
|
4
|
+
import { toResourceKey, canonicalizeDir } from "./ka~0.mjs";
|
|
5
|
+
import { unplacedStyleImport } from "./9~0.mjs";
|
|
6
|
+
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
7
|
+
const STYLE_REQUEST = /\.(?:css|scss|sass|less)$/i;
|
|
8
|
+
const STYLE_MODULE_REQUEST = /\.module\.(?:css|scss|sass|less)$/i;
|
|
9
|
+
const BARE_IMPORT = /(^|[;{}\n])[ \t]*import[ \t]*(['"])([^'"\n]+)\2/g;
|
|
10
|
+
const SHADOW_HOST_MARKER = /\bdata-extension-root\b|\bextension-root\b/;
|
|
11
|
+
function blankComments(source) {
|
|
12
|
+
let out = '';
|
|
13
|
+
let at = 0;
|
|
14
|
+
while(at < source.length){
|
|
15
|
+
const char = source[at];
|
|
16
|
+
const next = source[at + 1];
|
|
17
|
+
if ('/' === char && '/' === next) {
|
|
18
|
+
let end = source.indexOf('\n', at);
|
|
19
|
+
if (-1 === end) end = source.length;
|
|
20
|
+
out += ' '.repeat(end - at);
|
|
21
|
+
at = end;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if ('/' === char && '*' === next) {
|
|
25
|
+
let end = source.indexOf('*/', at + 2);
|
|
26
|
+
end = -1 === end ? source.length : end + 2;
|
|
27
|
+
out += source.slice(at, end).replace(/[^\n]/g, ' ');
|
|
28
|
+
at = end;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if ('"' === char || "'" === char || '`' === char) {
|
|
32
|
+
let end = at + 1;
|
|
33
|
+
while(end < source.length && source[end] !== char){
|
|
34
|
+
if ('\n' === source[end] && '`' !== char) break;
|
|
35
|
+
end += '\\' === source[end] ? 2 : 1;
|
|
36
|
+
}
|
|
37
|
+
end = Math.min(end + 1, source.length);
|
|
38
|
+
out += source.slice(at, end);
|
|
39
|
+
at = end;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
out += char;
|
|
43
|
+
at++;
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
function countOccurrences(haystack, needle) {
|
|
48
|
+
return haystack.split(needle).length - 1;
|
|
49
|
+
}
|
|
50
|
+
function findUnplacedStyleImports(source) {
|
|
51
|
+
if (!/\bimport\b/.test(source)) return [];
|
|
52
|
+
const code = blankComments(source);
|
|
53
|
+
const bare = new Map();
|
|
54
|
+
for (const match of code.matchAll(BARE_IMPORT)){
|
|
55
|
+
const request = match[3];
|
|
56
|
+
if (!STYLE_REQUEST.test(request) || STYLE_MODULE_REQUEST.test(request)) continue;
|
|
57
|
+
const seen = bare.get(request);
|
|
58
|
+
if (seen) {
|
|
59
|
+
seen.count++;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const at = (match.index || 0) + match[0].indexOf('import');
|
|
63
|
+
const line = code.slice(0, at).split('\n').length;
|
|
64
|
+
bare.set(request, {
|
|
65
|
+
line,
|
|
66
|
+
count: 1
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const unplaced = [];
|
|
70
|
+
for (const [request, { line, count }] of bare){
|
|
71
|
+
const named = [
|
|
72
|
+
'"',
|
|
73
|
+
"'",
|
|
74
|
+
'`'
|
|
75
|
+
].reduce((total, quote)=>total + countOccurrences(code, `${quote}${request}${quote}`), 0);
|
|
76
|
+
if (named === count) unplaced.push({
|
|
77
|
+
request,
|
|
78
|
+
line
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return unplaced;
|
|
82
|
+
}
|
|
83
|
+
function namesShadowHost(source) {
|
|
84
|
+
return SHADOW_HOST_MARKER.test(source);
|
|
85
|
+
}
|
|
86
|
+
function reachesShadowHost(entry, projectPath) {
|
|
87
|
+
const resolve = createLocalImportResolver(projectPath);
|
|
88
|
+
let found = false;
|
|
89
|
+
walkLocalImportGraph([
|
|
90
|
+
entry
|
|
91
|
+
], (file)=>{
|
|
92
|
+
if (found) return [];
|
|
93
|
+
const text = readScriptText(file);
|
|
94
|
+
if (void 0 === text) return [];
|
|
95
|
+
if (namesShadowHost(text)) {
|
|
96
|
+
found = true;
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
return collectModuleSpecifiers(text).map((specifier)=>resolve(file, specifier)).filter((resolved)=>'string' == typeof resolved);
|
|
100
|
+
});
|
|
101
|
+
return found;
|
|
102
|
+
}
|
|
103
|
+
function comparablePathKey(file, platform = process.platform) {
|
|
104
|
+
if ('win32' !== platform || 'string' != typeof file) return file;
|
|
105
|
+
const key = __rspack_external_node_path_806ed179.win32.normalize(file);
|
|
106
|
+
return /^[a-z]:/.test(key) ? key[0].toUpperCase() + key.slice(1) : key;
|
|
107
|
+
}
|
|
108
|
+
function isDeclaredEntry(resource, declaredEntries, platform = process.platform) {
|
|
109
|
+
const key = comparablePathKey(resource, platform);
|
|
110
|
+
return declaredEntries.some((entry)=>comparablePathKey(entry, platform) === key);
|
|
111
|
+
}
|
|
112
|
+
function unplacedStyleImportLoader(source) {
|
|
113
|
+
const unplaced = findUnplacedStyleImports(source);
|
|
114
|
+
if (0 === unplaced.length) return source;
|
|
115
|
+
const options = this.getOptions?.() || {};
|
|
116
|
+
const projectPath = options.projectPath || this.rootContext || '';
|
|
117
|
+
const resource = toResourceKey(this.resourcePath);
|
|
118
|
+
const declared = isDeclaredEntry(resource, (options.declaredEntries || []).map(toResourceKey));
|
|
119
|
+
if (declared && (namesShadowHost(source) || reachesShadowHost(this.resourcePath, projectPath))) return source;
|
|
120
|
+
const relative = projectPath ? __rspack_external_node_path_806ed179.relative(canonicalizeDir(projectPath), resource) || resource : resource;
|
|
121
|
+
const issuer = relative.split(__rspack_external_node_path_806ed179.sep).join('/');
|
|
122
|
+
const report = new WebpackError(unplacedStyleImport(issuer, unplaced, declared));
|
|
123
|
+
report.file = issuer;
|
|
124
|
+
report.name = 'CssUnplacedImport';
|
|
125
|
+
const sink = this._compilation?.warnings;
|
|
126
|
+
if (sink) sink.push(report);
|
|
127
|
+
else this.emitWarning(report);
|
|
128
|
+
return source;
|
|
129
|
+
}
|
|
130
|
+
export default unplacedStyleImportLoader;
|
|
131
|
+
export { comparablePathKey, isDeclaredEntry };
|
package/dist/x~0.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.1.40-canary.458.001a6a0","El":{"@babel/core":"7.29.7","@babel/preset-typescript":"7.29.7","@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"2.2.3","@rspack/dev-server":"2.1.0","@rspack/plugin-preact-refresh":"2.0.1","@rspack/plugin-react-refresh":"2.0.2","@vue/compiler-sfc":"3.5.43","acorn":"^8.16.0","babel-loader":"10.1.1","babel-preset-solid":"1.9.15","browser-extension-manifest-fields":"^3.0.2","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^18.0.0","es-module-lexer":"^3.0.2","extension-from-store":"^0.2.5","fflate":"^0.8.3","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.9.1","less-loader":"13.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.23","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"11.0.0","prefers-yarn":"2.0.1","react-refresh":"0.18.0","sass-loader":"17.0.0","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","vue":"3.5.43","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.20.1"}}');
|
|
3
|
+
export { package_namespaceObject };
|