extension-develop 4.1.39 → 4.1.40-canary.459.2c1ba7b
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 +13 -10
- 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 +8644 -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} +66 -17
- 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 +56 -18
- package/dist/feature-scripts-content-script-wrapper.mjs +56 -18
- 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/manifest-types.d.ts +276 -0
- package/dist/lib/messages.d.ts +6 -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} +2244 -288
- 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 +5 -1
- package/dist/plugin-compatibility/compatibility-lib/native-browser-namespace.d.ts +5 -0
- package/dist/plugin-compatibility/feature-browser-global.d.ts +11 -1
- package/dist/plugin-compatibility/index.d.ts +2 -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-icons/extract-action-theme-icons.d.ts +1 -0
- package/dist/plugin-web-extension/feature-icons/extract-icon-variants.d.ts +2 -0
- package/dist/plugin-web-extension/feature-json/json-validation.d.ts +2 -1
- package/dist/plugin-web-extension/feature-json/messages.d.ts +2 -0
- package/dist/plugin-web-extension/feature-json/process-assets.d.ts +1 -1
- 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/icon-variants-fallback.d.ts +15 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/sanitize-fatal-shapes.d.ts +2 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/webkit-unsupported-keys.d.ts +15 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/icons.d.ts +3 -2
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/omnibox.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/page_action.d.ts +2 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/permissions.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/sandbox.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/browser_action.d.ts +4 -3
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/action.d.ts +3 -2
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +15 -1
- package/dist/plugin-web-extension/feature-manifest/normalize-manifest-path.d.ts +2 -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/apply-dev-defaults-lib/patch-background.d.ts +2 -2
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-externally-connectable.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/steps/patch-gecko-background.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-content-script-host-access.d.ts +17 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-description-length.d.ts +26 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +37 -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 +10 -1
- 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 +2 -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} +56 -5
- package/dist/rspack-config~0.mjs +3140 -3302
- 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 +46 -5
- 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} +563 -281
- package/package.json +6 -6
- 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
package/dist/y~0.mjs
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { replaceCssUrlRefs, publicOwnedOutputName, toPosixPath } from "./6l~0.mjs";
|
|
4
|
+
import { extensionBaseFromFile, GECKO_EXTENSION_SCHEME, unlessExtensionAddress, closedOnSlash, CHROMIUM_EXTENSION_SCHEME, EXTENSION_BASE_ATTRIBUTE, EXTENSION_BASE_FROM_STACK } from "./c~0.mjs";
|
|
5
|
+
import { toJsStringLiteral } from "./z~0.mjs";
|
|
6
|
+
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
7
|
+
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
8
|
+
const EXTENSION_ROOT_PLACEHOLDER = '__EXTENSIONJS_EXTENSION_ROOT__/';
|
|
9
|
+
const BUNDLED_FILE_TOKEN = /__EXTENSIONJS_CSS_FILE_(\d+)__([^"\\]*)/g;
|
|
10
|
+
function bundledFileToken(index) {
|
|
11
|
+
return `__EXTENSIONJS_CSS_FILE_${index}__`;
|
|
12
|
+
}
|
|
13
|
+
function isFile(candidate) {
|
|
14
|
+
try {
|
|
15
|
+
return __rspack_external_node_fs_1b05aee1.statSync(candidate).isFile();
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function resolveTarget(req, { resourcePath, manifestDir, publicRoot, publicDir }) {
|
|
21
|
+
if (req.startsWith('/')) {
|
|
22
|
+
const rel = req.slice(1);
|
|
23
|
+
const fromPublic = __rspack_external_node_path_806ed179.join(publicRoot, rel);
|
|
24
|
+
if (isFile(fromPublic)) return {
|
|
25
|
+
absolutePath: fromPublic,
|
|
26
|
+
outputName: toPosixPath(__rspack_external_node_path_806ed179.normalize(rel)),
|
|
27
|
+
publicOwned: true
|
|
28
|
+
};
|
|
29
|
+
const fromManifest = __rspack_external_node_path_806ed179.join(manifestDir, rel);
|
|
30
|
+
if (!isFile(fromManifest)) return;
|
|
31
|
+
return {
|
|
32
|
+
absolutePath: fromManifest,
|
|
33
|
+
publicOwned: false
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const absolutePath = __rspack_external_node_path_806ed179.resolve(__rspack_external_node_path_806ed179.dirname(resourcePath), req);
|
|
37
|
+
if (!isFile(absolutePath)) return;
|
|
38
|
+
const publicPath = publicOwnedOutputName(absolutePath, publicDir);
|
|
39
|
+
if (publicPath) return {
|
|
40
|
+
absolutePath,
|
|
41
|
+
outputName: publicPath,
|
|
42
|
+
publicOwned: true
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
absolutePath,
|
|
46
|
+
publicOwned: false
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function rewriteInlinedCssUrls(source, context) {
|
|
50
|
+
const targets = [];
|
|
51
|
+
const seen = new Map();
|
|
52
|
+
const css = replaceCssUrlRefs(source, (request)=>{
|
|
53
|
+
const suffixAt = request.search(/[?#]/);
|
|
54
|
+
const req = -1 === suffixAt ? request : request.slice(0, suffixAt);
|
|
55
|
+
const suffix = -1 === suffixAt ? '' : request.slice(suffixAt);
|
|
56
|
+
if (!req || req.startsWith('//') || /^[a-z][a-z0-9+.-]*:/i.test(req)) return;
|
|
57
|
+
if (req.startsWith('~') || req.startsWith('@')) return;
|
|
58
|
+
if (req.startsWith(EXTENSION_ROOT_PLACEHOLDER)) return;
|
|
59
|
+
let named = seen.get(req);
|
|
60
|
+
if (!named) {
|
|
61
|
+
const target = resolveTarget(req, context);
|
|
62
|
+
if (!target) return;
|
|
63
|
+
named = target.publicOwned ? `${EXTENSION_ROOT_PLACEHOLDER}${target.outputName}` : bundledFileToken(targets.filter((other)=>!other.publicOwned).length);
|
|
64
|
+
seen.set(req, named);
|
|
65
|
+
targets.push({
|
|
66
|
+
request: req,
|
|
67
|
+
...target
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return `${named}${suffix}`;
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
css,
|
|
74
|
+
targets
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const SFC_STYLE_ATTRIBUTE = 'data-extjs-sfc-style';
|
|
78
|
+
const SFC_SHEET_PROPERTY = '__extjsSfcSheet';
|
|
79
|
+
function styleElementLines(text, styleId) {
|
|
80
|
+
const id = JSON.stringify(styleId);
|
|
81
|
+
const selector = JSON.stringify(`style[${SFC_STYLE_ATTRIBUTE}="${styleId}"]`);
|
|
82
|
+
return [
|
|
83
|
+
`var __extjsSfcCss = ${text};`,
|
|
84
|
+
'(function () {',
|
|
85
|
+
' try {',
|
|
86
|
+
' if (typeof document !== "object" || !document || typeof document.createElement !== "function") return;',
|
|
87
|
+
` var el = document.querySelector(${selector});`,
|
|
88
|
+
' if (!el) {',
|
|
89
|
+
' el = document.createElement("style");',
|
|
90
|
+
` el.setAttribute(${JSON.stringify(SFC_STYLE_ATTRIBUTE)}, ${id});`,
|
|
91
|
+
' (document.head || document.documentElement).appendChild(el);',
|
|
92
|
+
' }',
|
|
93
|
+
' if (el.textContent !== __extjsSfcCss) el.textContent = __extjsSfcCss;',
|
|
94
|
+
' if (!__extjsSfcCss || el.sheet || typeof CSSStyleSheet !== "function" || !document.adoptedStyleSheets) return;',
|
|
95
|
+
` var sheet = el[${JSON.stringify(SFC_SHEET_PROPERTY)}];`,
|
|
96
|
+
' if (!sheet) {',
|
|
97
|
+
' sheet = new CSSStyleSheet();',
|
|
98
|
+
` el[${JSON.stringify(SFC_SHEET_PROPERTY)}] = sheet;`,
|
|
99
|
+
' document.adoptedStyleSheets = document.adoptedStyleSheets.concat([sheet]);',
|
|
100
|
+
' }',
|
|
101
|
+
' sheet.replaceSync(__extjsSfcCss);',
|
|
102
|
+
' } catch (error) {}',
|
|
103
|
+
'})();',
|
|
104
|
+
'module.exports = __extjsSfcCss;',
|
|
105
|
+
''
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
function concatenatedSheet(css) {
|
|
109
|
+
const pieces = [];
|
|
110
|
+
const literal = (text)=>{
|
|
111
|
+
text.split(EXTENSION_ROOT_PLACEHOLDER).forEach((part, index)=>{
|
|
112
|
+
if (index > 0) pieces.push('__extjsExtensionRoot()');
|
|
113
|
+
if (part) pieces.push(JSON.stringify(part));
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
let from = 0;
|
|
117
|
+
for (const token of css.matchAll(BUNDLED_FILE_TOKEN)){
|
|
118
|
+
literal(css.slice(from, token.index));
|
|
119
|
+
pieces.push(`__extjsCssFile("", ${JSON.stringify(token[1])}, ${JSON.stringify(token[2])})`);
|
|
120
|
+
from = token.index + token[0].length;
|
|
121
|
+
}
|
|
122
|
+
literal(css.slice(from));
|
|
123
|
+
return pieces.length > 0 ? pieces.join(' + ') : '""';
|
|
124
|
+
}
|
|
125
|
+
function toRuntimeStylesheetModule(css, bundledRequests = [], styleId, gecko = false, baseAttribute = EXTENSION_BASE_ATTRIBUTE, baseScheme = gecko ? GECKO_EXTENSION_SCHEME : CHROMIUM_EXTENSION_SCHEME) {
|
|
126
|
+
const root = JSON.stringify(EXTENSION_ROOT_PLACEHOLDER);
|
|
127
|
+
const rooted = `__extjsCssText.split(${root}).join(__extjsExtensionRoot())`;
|
|
128
|
+
const text = gecko ? concatenatedSheet(css) : 0 === bundledRequests.length ? rooted : `${rooted}.replace(${String(BUNDLED_FILE_TOKEN)}, __extjsCssFile)`;
|
|
129
|
+
return [
|
|
130
|
+
`var __extjsCssText = ${JSON.stringify(css)};`,
|
|
131
|
+
'function __extjsExtensionRoot() {',
|
|
132
|
+
' try {',
|
|
133
|
+
' var b = globalThis.browser;',
|
|
134
|
+
' if (typeof b === "object" && b && b.runtime && typeof b.runtime.getURL === "function") return String(b.runtime.getURL("/"));',
|
|
135
|
+
' } catch (error) {}',
|
|
136
|
+
' try {',
|
|
137
|
+
' var c = globalThis.chrome;',
|
|
138
|
+
' if (typeof c === "object" && c && c.runtime && typeof c.runtime.getURL === "function") return String(c.runtime.getURL("/"));',
|
|
139
|
+
' } catch (error) {}',
|
|
140
|
+
' try {',
|
|
141
|
+
...gecko ? [
|
|
142
|
+
` var base = ${extensionBaseFromFile(true)};`,
|
|
143
|
+
' if (!base && typeof __webpack_require__ === "function" && typeof __webpack_require__.extjsBase === "string") base = __webpack_require__.extjsBase;',
|
|
144
|
+
` if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute(${JSON.stringify(baseAttribute)}) || "");`,
|
|
145
|
+
` ${unlessExtensionAddress('base')}`,
|
|
146
|
+
` if (base) return ${closedOnSlash('base')};`
|
|
147
|
+
] : [
|
|
148
|
+
` var base = ${EXTENSION_BASE_FROM_STACK};`,
|
|
149
|
+
` if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute(${JSON.stringify(baseAttribute)}) || "");`,
|
|
150
|
+
' if (!base && typeof __webpack_require__ === "function" && __webpack_require__.extjsBase) base = String(__webpack_require__.extjsBase);',
|
|
151
|
+
` ${unlessExtensionAddress('base', baseScheme)}`,
|
|
152
|
+
' if (base) return base.replace(/\\/+$/, "") + "/";'
|
|
153
|
+
],
|
|
154
|
+
' } catch (error) {}',
|
|
155
|
+
' return "/";',
|
|
156
|
+
'}',
|
|
157
|
+
...0 === bundledRequests.length ? [] : [
|
|
158
|
+
`var __extjsCssFiles = [${bundledRequests.map((request)=>`function(){ return new URL(${toJsStringLiteral(request)}, import.meta.url); }`).join(', ')}];`,
|
|
159
|
+
'function __extjsCssFile(match, index, suffix) {',
|
|
160
|
+
' try {',
|
|
161
|
+
' var file = __extjsCssFiles[Number(index)]();',
|
|
162
|
+
' if (file.protocol === "data:") return file.href;',
|
|
163
|
+
' return __extjsExtensionRoot() + String(file.pathname).replace(/^\\/+/, "") + suffix;',
|
|
164
|
+
' } catch (error) {}',
|
|
165
|
+
' return "about:invalid";',
|
|
166
|
+
'}'
|
|
167
|
+
],
|
|
168
|
+
...styleId ? styleElementLines(text, styleId) : [
|
|
169
|
+
`module.exports = "data:text/css;charset=utf-8," + encodeURIComponent(${text});`,
|
|
170
|
+
''
|
|
171
|
+
]
|
|
172
|
+
].join('\n');
|
|
173
|
+
}
|
|
174
|
+
const SFC_STYLE_BLOCK_QUERY = /(?:^\?|&)vue&type=style(?:&|$)/;
|
|
175
|
+
function isSfcStyleBlockQuery(query) {
|
|
176
|
+
return SFC_STYLE_BLOCK_QUERY.test(String(query || ''));
|
|
177
|
+
}
|
|
178
|
+
const SFC_INLINE_STYLE_BLOCK_QUERY = /(?:^\?|&)vue&type=style&(?:[^#]*&)?inline(?:&|$)/;
|
|
179
|
+
function isSfcInlineStyleBlockQuery(query) {
|
|
180
|
+
return SFC_INLINE_STYLE_BLOCK_QUERY.test(String(query || ''));
|
|
181
|
+
}
|
|
182
|
+
const SFC_MODULE_STYLE_BLOCK_QUERY = /(?:^\?|&)vue&type=style&(?:[^#]*&)?module=/;
|
|
183
|
+
function isSfcModuleStyleBlockQuery(query) {
|
|
184
|
+
return SFC_MODULE_STYLE_BLOCK_QUERY.test(String(query || ''));
|
|
185
|
+
}
|
|
186
|
+
function moduleStyleBlockRequest(input) {
|
|
187
|
+
const { resourcePath, resourceQuery, loaders, ownPath } = input;
|
|
188
|
+
const pitcher = loaders.find((loader)=>/[\\/]vue-loader[\\/]dist[\\/]pitcher\.js$/.test(String(loader.path)));
|
|
189
|
+
if (!pitcher?.path) return;
|
|
190
|
+
const params = new URLSearchParams(resourceQuery.slice(1));
|
|
191
|
+
const lang = params.get('lang') || 'css';
|
|
192
|
+
const index = params.get('index') || '0';
|
|
193
|
+
const seen = new Set();
|
|
194
|
+
const chain = loaders.filter(({ path })=>path !== ownPath && path !== pitcher.path).map(({ request })=>String(request || '')).filter((request)=>{
|
|
195
|
+
if (!request || seen.has(request)) return false;
|
|
196
|
+
seen.add(request);
|
|
197
|
+
return true;
|
|
198
|
+
});
|
|
199
|
+
const scoping = pitcher.path.slice(0, -10);
|
|
200
|
+
return [
|
|
201
|
+
`${resourcePath}.${index}.module.${lang}!=!-`,
|
|
202
|
+
`${scoping}stylePostLoader.js`,
|
|
203
|
+
...chain,
|
|
204
|
+
`${resourcePath}${resourceQuery}`
|
|
205
|
+
].join('!');
|
|
206
|
+
}
|
|
207
|
+
const SVELTE_STYLE_BLOCK_TEST = /\.svelte\.\d+\.css$/;
|
|
208
|
+
function isSvelteStyleBlockPath(resourcePath) {
|
|
209
|
+
return String(resourcePath || '').endsWith('.svelte');
|
|
210
|
+
}
|
|
211
|
+
function isSfcStyleBlock(module) {
|
|
212
|
+
return isSfcStyleBlockQuery(module.resourceQuery) || isSvelteStyleBlockPath(module.resourcePath);
|
|
213
|
+
}
|
|
214
|
+
function readStyleBlockProxyRequest(source) {
|
|
215
|
+
const match = /^\s*@import\s+("(?:[^"\\]|\\.)*");?\s*$/.exec(source);
|
|
216
|
+
if (!match) return;
|
|
217
|
+
try {
|
|
218
|
+
const request = JSON.parse(match[1]);
|
|
219
|
+
return 'string' == typeof request && request.includes('!=!') ? request : void 0;
|
|
220
|
+
} catch {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function sfcStyleBlockId(relativePath, query, devSalt) {
|
|
225
|
+
return createHash('sha256').update(`${devSalt}\n${relativePath}\n${query}`).digest('hex').slice(0, 12);
|
|
226
|
+
}
|
|
227
|
+
function dropSourceMapComment(css) {
|
|
228
|
+
const at = css.lastIndexOf('/*# sourceMappingURL=');
|
|
229
|
+
if (-1 === at) return css;
|
|
230
|
+
const end = css.indexOf('*/', at);
|
|
231
|
+
if (-1 === end || '' !== css.slice(end + 2).trim()) return css;
|
|
232
|
+
return `${css.slice(0, at).trimEnd()}\n`;
|
|
233
|
+
}
|
|
234
|
+
export { EXTENSION_ROOT_PLACEHOLDER, SFC_INLINE_STYLE_BLOCK_QUERY, SFC_MODULE_STYLE_BLOCK_QUERY, SFC_STYLE_BLOCK_QUERY, SVELTE_STYLE_BLOCK_TEST, dropSourceMapComment, isSfcInlineStyleBlockQuery, isSfcModuleStyleBlockQuery, isSfcStyleBlock, moduleStyleBlockRequest, readStyleBlockProxyRequest, rewriteInlinedCssUrls, sfcStyleBlockId, toRuntimeStylesheetModule };
|
package/dist/zip~0.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
2
|
import { unzipSync } from "fflate";
|
|
3
|
-
import { sessionArtifactsRootDir } from "./
|
|
4
|
-
import { renameSyncWithRetry } from "./
|
|
5
|
-
import { humanLine, CODES } from "./
|
|
6
|
-
import { unpackagingExtension, failedToDownloadOrWriteZIPFileError, remoteZipDamaged, localZipNotFound, unpackagedSuccessfully,
|
|
3
|
+
import { sessionArtifactsRootDir } from "./5h~0.mjs";
|
|
4
|
+
import { renameSyncWithRetry } from "./6~0.mjs";
|
|
5
|
+
import { humanLine, CODES } from "./k~0.mjs";
|
|
6
|
+
import { unpackagingExtension, failedToDownloadOrWriteZIPFileError, remoteZipDamaged, localZipNotFound, unpackagedSuccessfully, downloadingText, failedToWriteZIPFileError, reusingDownloadedProject, remoteSourceDestinationTaken, notAZipArchive, remoteZipAccessRefused, localZipUnreadable, zipEntryOutsideFolder, tokenExpiry, invalidRemoteZip } from "./cp~0.mjs";
|
|
7
|
+
import { codedError } from "./tm~0.mjs";
|
|
7
8
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
8
9
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
9
10
|
function isZipBuffer(buffer) {
|