extension-develop 4.1.34 → 4.1.35
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/dist/206~0.mjs +33 -0
- package/dist/363~0.mjs +1 -1
- package/dist/469~0.mjs +98 -16
- package/dist/519~0.mjs +12 -1
- package/dist/771~0.mjs +49 -8
- package/dist/832~0.mjs +127 -25
- package/dist/840~0.mjs +215 -54
- package/dist/846~0.mjs +16 -14
- package/dist/852~0.mjs +2 -0
- package/dist/88~0.mjs +10 -1
- package/dist/command-preview.d.ts +2 -0
- package/dist/contract/codes.json +9 -0
- package/dist/contracts-entry.d.ts +1 -1
- package/dist/contracts.mjs +109 -1
- package/dist/css-parse-guard-loader.mjs +7 -2
- package/dist/dev-server/control-bridge/log-rule.d.ts +38 -0
- package/dist/dev-server/control-bridge/logs-query.d.ts +2 -55
- package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -1
- package/dist/dev-server/html-refresh.d.ts +10 -0
- package/dist/dev-server/port-manager.d.ts +14 -0
- package/dist/dev-server/reserved-listen.d.ts +9 -0
- package/dist/dev-server/session-restart.d.ts +1 -1
- package/dist/dev-server~0.mjs +155 -30
- 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.css +1 -1
- package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/chromium/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/edge/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
- package/dist/extension-js-devtools/firefox/pages/welcome.css +1 -1
- package/dist/extension-js-theme/build-stamp.json +2 -2
- package/dist/feature-scripts-classic-concat-loader.js +45 -2
- package/dist/feature-scripts-classic-concat-loader.mjs +45 -2
- package/dist/feature-scripts-classic-traced-globals-loader.mjs +111 -0
- package/dist/feature-scripts-content-script-wrapper.js +10 -6
- package/dist/feature-scripts-content-script-wrapper.mjs +10 -6
- package/dist/lib/config-loader.d.ts +1 -0
- package/dist/lib/css-minimizer-options.d.ts +8 -0
- package/dist/lib/develop-context.d.ts +1 -1
- package/dist/lib/live-dev-session.d.ts +5 -0
- package/dist/lib/messages.d.ts +9 -1
- package/dist/lib/messaging.d.ts +2 -0
- package/dist/lib/package-manager.d.ts +7 -1
- package/dist/lib/paths.d.ts +1 -0
- package/dist/lib/project.d.ts +10 -2
- package/dist/lib/remote-archive.d.ts +11 -0
- package/dist/lib/rename-with-retry.d.ts +6 -0
- package/dist/lib/session-paths.d.ts +1 -0
- package/dist/lib/zip.d.ts +5 -1
- package/dist/plugin-browsers/index.d.ts +2 -0
- package/dist/plugin-css/css-in-content-script-loader.d.ts +1 -1
- package/dist/plugin-css/css-in-html-loader.d.ts +1 -1
- package/dist/plugin-css/css-lib/build-css-rules.d.ts +2 -1
- package/dist/plugin-css/css-lib/verbatim-css.d.ts +1 -0
- package/dist/plugin-js-frameworks/js-tools/typescript.d.ts +1 -0
- package/dist/plugin-playwright/index.d.ts +3 -0
- package/dist/plugin-special-folders/messages.d.ts +1 -0
- package/dist/plugin-special-folders/warn-upon-folder-changes.d.ts +1 -1
- package/dist/plugin-web-extension/feature-html/html-lib/options-dialog-floor.d.ts +7 -0
- package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +3 -1
- package/dist/plugin-web-extension/feature-html/steps/update-html-file.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-injected-hosts.d.ts +4 -1
- package/dist/plugin-web-extension/feature-scripts/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/classic-concat-loader.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/content-script-wrapper.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/index.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/classic-traced-globals-loader.d.ts +7 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-unshipped-runtime-assets.d.ts +32 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
- package/dist/plugin-web-extension/shared/discover-runtime-surfaces.d.ts +2 -0
- package/dist/plugin-web-extension/shared/script-graph.d.ts +4 -0
- package/dist/rspack-config~0.mjs +799 -196
- package/dist/types.d.ts +7 -1
- package/dist/zip~0.mjs +14 -7
- package/package.json +3 -3
- package/dist/plugin-css/css-lib/is-content-script.d.ts +0 -2
package/dist/832~0.mjs
CHANGED
|
@@ -10,10 +10,11 @@ import content_security_policy_parser from "content-security-policy-parser";
|
|
|
10
10
|
import { Compilation, sources } from "@rspack/core";
|
|
11
11
|
import { WebSocket, WebSocketServer } from "ws";
|
|
12
12
|
import { browserRowValue, humanWarn, CODES, artifactNoun, prefix as messaging_prefix, card, humanLine, debugLine, stripChannelPrefix, isDebug } from "./852~0.mjs";
|
|
13
|
-
import { productionControlOpen, devtoolsEngineFor, getDirs, computePreviewOutputPath, previewHasNothingToRun, asAbsolute, anotherDevSessionActive, previewingSourceFallback, displayPath, previewing, starting, debugPreviewOutput, normalizeBrowser, debugDirs, debugBrowser, collapseHomeDir, previewingCustomOutput, getDistPath, managedDependencyCopyWarning, getProjectStructure, configBrowserOrThrow } from "./469~0.mjs";
|
|
13
|
+
import { productionControlOpen, devtoolsEngineFor, remoteArchiveCacheRoot, getDirs, computePreviewOutputPath, previewHasNothingToRun, asAbsolute, anotherDevSessionActive, previewingSourceFallback, displayPath, previewing, starting, debugPreviewOutput, normalizeBrowser, debugDirs, debugBrowser, collapseHomeDir, previewingCustomOutput, getDistPath, managedDependencyCopyWarning, getProjectStructure, configBrowserOrThrow } from "./469~0.mjs";
|
|
14
14
|
import { readProjectDependencies } from "./731~0.mjs";
|
|
15
15
|
import { loadCommandConfig, loadBrowserConfig, loadProjectConfigDefaults, findConfigFile } from "./846~0.mjs";
|
|
16
16
|
import { stripBom, isEmulatorBrowser, isChromiumBasedBrowser, isWebkitBasedBrowser, parseJsonSafe, isGeckoBasedBrowser } from "./937~0.mjs";
|
|
17
|
+
import { renameSyncWithRetry } from "./206~0.mjs";
|
|
17
18
|
import { eventsPath as session_paths_eventsPath, actionsPath, logsPath, readyContractPath, ensureSessionArtifactsIgnoreFile, browserArtifactsDir } from "./771~0.mjs";
|
|
18
19
|
import { isScriptsFolderEntry, rememberedFolders, publicFolderSetting } from "./471~0.mjs";
|
|
19
20
|
import { CONTROL_WS_PATH, clearControlToken, writeControlToken } from "./285~0.mjs";
|
|
@@ -142,7 +143,7 @@ function bundlerFatalError(error) {
|
|
|
142
143
|
return `${getLoggingPrefix('error')} The build failed to start.\n${pintor.red(text)}`;
|
|
143
144
|
}
|
|
144
145
|
function devServerRestarting(request) {
|
|
145
|
-
const what = 'icons' === request.reason ? 'a manifest icon' : 'html' === request.reason ? 'an HTML entrypoint' : 'json' === request.reason ? 'a manifest JSON entry' : 'env' === request.reason ? 'an environment file' : "a manifest script entry";
|
|
146
|
+
const what = 'icons' === request.reason ? 'a manifest icon' : 'html' === request.reason ? 'an HTML entrypoint' : 'json' === request.reason ? 'a manifest JSON entry' : 'env' === request.reason ? 'an environment file' : 'public' === request.reason ? 'a public folder' : "a manifest script entry";
|
|
146
147
|
const lines = [
|
|
147
148
|
`${getLoggingPrefix('info')} Restarting the dev server to pick up ${what} change…`
|
|
148
149
|
];
|
|
@@ -177,7 +178,7 @@ function runnerUncaughtException(error) {
|
|
|
177
178
|
function runnerUnhandledRejection(reason) {
|
|
178
179
|
return `${messaging_prefix('error')} Unhandled rejection in the dev server: ${String(reason?.message || reason)}`;
|
|
179
180
|
}
|
|
180
|
-
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.1.
|
|
181
|
+
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.1.35","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"}}');
|
|
181
182
|
function sanitize(obj) {
|
|
182
183
|
return Object.fromEntries(Object.entries(obj || {}).filter(([, value])=>void 0 !== value));
|
|
183
184
|
}
|
|
@@ -405,9 +406,9 @@ function rotateEventsFile(eventsPath) {
|
|
|
405
406
|
});
|
|
406
407
|
for(let n = EVENTS_GENERATIONS - 1; n >= 1; n--){
|
|
407
408
|
const from = rotatedEventsName(eventsPath, n);
|
|
408
|
-
if (__rspack_external_node_fs_1b05aee1.existsSync(from))
|
|
409
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(from)) renameSyncWithRetry(from, rotatedEventsName(eventsPath, n + 1));
|
|
409
410
|
}
|
|
410
|
-
if (__rspack_external_node_fs_1b05aee1.existsSync(eventsPath))
|
|
411
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(eventsPath)) renameSyncWithRetry(eventsPath, rotatedEventsName(eventsPath, 1));
|
|
411
412
|
} catch {}
|
|
412
413
|
}
|
|
413
414
|
function capEventSize(event) {
|
|
@@ -452,13 +453,16 @@ function deriveDistExtensionId(browser, distPath) {
|
|
|
452
453
|
return;
|
|
453
454
|
}
|
|
454
455
|
}
|
|
455
|
-
function
|
|
456
|
+
function stampReadyExtensionIdFrom(packageJsonDir, browser, extensionId, source) {
|
|
456
457
|
try {
|
|
457
458
|
const readyPath = readyContractPath(packageJsonDir, browser);
|
|
458
459
|
if (!__rspack_external_node_fs_1b05aee1.existsSync(readyPath)) return;
|
|
459
460
|
const prev = JSON.parse(__rspack_external_node_fs_1b05aee1.readFileSync(readyPath, 'utf-8'));
|
|
460
|
-
|
|
461
|
+
const prevIsAnswer = 'browser' === prev.extensionIdSource || 'packager' === prev.extensionIdSource;
|
|
462
|
+
if (prev.extensionId && prevIsAnswer) return;
|
|
463
|
+
if (prev.extensionId === extensionId && prev.extensionIdSource === source) return;
|
|
461
464
|
prev.extensionId = extensionId;
|
|
465
|
+
prev.extensionIdSource = source;
|
|
462
466
|
prev.ts = nowISO();
|
|
463
467
|
writeJsonAtomic(readyPath, prev);
|
|
464
468
|
} catch {}
|
|
@@ -466,11 +470,11 @@ function stampReadyExtensionIdIfAbsent(packageJsonDir, browser, extensionId) {
|
|
|
466
470
|
function stampReadyDistExtensionId(packageJsonDir, browser, distPath) {
|
|
467
471
|
const derived = deriveDistExtensionId(browser, distPath);
|
|
468
472
|
if (!derived) return;
|
|
469
|
-
|
|
473
|
+
stampReadyExtensionIdFrom(packageJsonDir, browser, derived, 'derived');
|
|
470
474
|
}
|
|
471
475
|
function stampReadyKnownExtensionId(packageJsonDir, browser, extensionId) {
|
|
472
476
|
if (!extensionId) return;
|
|
473
|
-
|
|
477
|
+
stampReadyExtensionIdFrom(packageJsonDir, browser, extensionId, 'packager');
|
|
474
478
|
}
|
|
475
479
|
function readManifestProvenance(...manifestPaths) {
|
|
476
480
|
for (const manifestPath of manifestPaths)if (manifestPath) try {
|
|
@@ -492,11 +496,19 @@ function ensureDirSync(dirPath) {
|
|
|
492
496
|
} catch {}
|
|
493
497
|
}
|
|
494
498
|
function writeJsonAtomic(filePath, value) {
|
|
499
|
+
const tmpPath = `${filePath}.tmp-${process.pid}`;
|
|
495
500
|
try {
|
|
496
|
-
const tmpPath = `${filePath}.tmp-${process.pid}`;
|
|
497
501
|
__rspack_external_node_fs_1b05aee1.writeFileSync(tmpPath, `${JSON.stringify(value, null, 2)}\n`, 'utf-8');
|
|
498
|
-
|
|
499
|
-
|
|
502
|
+
renameSyncWithRetry(tmpPath, filePath);
|
|
503
|
+
return true;
|
|
504
|
+
} catch {
|
|
505
|
+
try {
|
|
506
|
+
__rspack_external_node_fs_1b05aee1.rmSync(tmpPath, {
|
|
507
|
+
force: true
|
|
508
|
+
});
|
|
509
|
+
} catch {}
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
500
512
|
}
|
|
501
513
|
function detectLiveDevSessionOwner(readyPath, isAlive = (pid)=>{
|
|
502
514
|
try {
|
|
@@ -518,7 +530,10 @@ function detectLiveDevSessionOwner(readyPath, isAlive = (pid)=>{
|
|
|
518
530
|
port: 'number' == typeof prev.port ? prev.port : null,
|
|
519
531
|
runId: 'string' == typeof prev.runId ? prev.runId : '',
|
|
520
532
|
instanceId: 'string' == typeof prev.instanceId ? prev.instanceId : void 0,
|
|
521
|
-
instanceExplicit: true === prev.instanceExplicit
|
|
533
|
+
instanceExplicit: true === prev.instanceExplicit,
|
|
534
|
+
...'string' == typeof prev.distPath && prev.distPath ? {
|
|
535
|
+
distPath: prev.distPath
|
|
536
|
+
} : {}
|
|
522
537
|
};
|
|
523
538
|
} catch {
|
|
524
539
|
return null;
|
|
@@ -541,7 +556,8 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
541
556
|
};
|
|
542
557
|
const liveOwner = detectLiveDevSessionOwner(readyPath);
|
|
543
558
|
const foreignLiveDevSession = 'dev' !== options.command && liveOwner ? liveOwner : null;
|
|
544
|
-
|
|
559
|
+
const sharesSessionOutput = !foreignLiveDevSession?.distPath || __rspack_external_node_path_806ed179.resolve(foreignLiveDevSession.distPath) === __rspack_external_node_path_806ed179.resolve(options.distPath);
|
|
560
|
+
if (foreignLiveDevSession && sharesSessionOutput) console.warn(`[extension] a live dev session (pid ${foreignLiveDevSession.pid}) owns ${readyPath}; this ${options.command} run will not rewrite the session's ready.json/events.ndjson. The output dir is shared, so the dev browser may pick up freshly ${options.command}-built files. Stop the dev session first for a clean ${options.command} receipt.`);
|
|
545
561
|
if ('dev' === options.command && liveOwner && !devOverDevWarnedByMetadataDir.has(metadataDir)) {
|
|
546
562
|
devOverDevWarnedByMetadataDir.add(metadataDir);
|
|
547
563
|
humanWarn(anotherDevSessionActive(options.browser, liveOwner.pid, liveOwner.runId));
|
|
@@ -611,7 +627,10 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
611
627
|
if (managedExtensions) payload.managedExtensions = managedExtensions;
|
|
612
628
|
} else if (Array.isArray(prev?.managedExtensions) && prev.managedExtensions.length > 0) payload.managedExtensions = prev.managedExtensions;
|
|
613
629
|
const derivedExtensionId = deriveDistExtensionId(options.browser, options.distPath);
|
|
614
|
-
if (derivedExtensionId)
|
|
630
|
+
if (derivedExtensionId) {
|
|
631
|
+
payload.extensionId = derivedExtensionId;
|
|
632
|
+
payload.extensionIdSource = 'derived';
|
|
633
|
+
}
|
|
615
634
|
const sameRun = Boolean(prev && prev.runId === base.runId);
|
|
616
635
|
if (prev && sameRun) {
|
|
617
636
|
if ('number' == typeof prev.cdpPort) payload.cdpPort = prev.cdpPort;
|
|
@@ -633,7 +652,10 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
633
652
|
if ('number' == typeof prev.launcherPid) payload.launcherPid = prev.launcherPid;
|
|
634
653
|
if ('string' == typeof prev.binary && prev.binary) payload.binary = prev.binary;
|
|
635
654
|
if ('string' == typeof prev.binaryProvenance && prev.binaryProvenance) payload.binaryProvenance = prev.binaryProvenance;
|
|
636
|
-
if ('string' == typeof prev.extensionId && prev.extensionId
|
|
655
|
+
if ('string' == typeof prev.extensionId && prev.extensionId && ('browser' === prev.extensionIdSource || 'packager' === prev.extensionIdSource)) {
|
|
656
|
+
payload.extensionId = prev.extensionId;
|
|
657
|
+
payload.extensionIdSource = prev.extensionIdSource;
|
|
658
|
+
}
|
|
637
659
|
if ('string' == typeof prev.browserExitedAt) {
|
|
638
660
|
payload.browserExitedAt = prev.browserExitedAt;
|
|
639
661
|
payload.browserExitCode = prev.browserExitCode ?? null;
|
|
@@ -1149,6 +1171,9 @@ function publicMustBeAtProjectRoot(foundAt, expectedAt, projectRoot) {
|
|
|
1149
1171
|
function publicFolderShadowed(usedAt, ignoredAt, projectRoot) {
|
|
1150
1172
|
return `Two public folders were found and only one is copied into the build.\nUSING ${displayPath(usedAt, projectRoot)}\nIGNORED ${displayPath(ignoredAt, projectRoot)}\npublic/ is canonically placed at the project root, and that copy wins.\nFiles that exist only in the ignored folder do not ship.\nMove or merge the ignored folder to silence this warning.`;
|
|
1151
1173
|
}
|
|
1174
|
+
function publicFolderAppeared(publicDir, projectRoot) {
|
|
1175
|
+
return `${displayPath(publicDir, projectRoot)} appeared after the session started.\nIts files are copied only by a session that saw the folder at startup.\nRestart \`extension dev\` to ship them.`;
|
|
1176
|
+
}
|
|
1152
1177
|
function specialFoldersSetupSummary(hasPublic, copyEnabled, ignoredCount) {
|
|
1153
1178
|
return `${messaging_prefix('debug')} folders setup public=${String(hasPublic)} copy=${String(copyEnabled)} ignored=${String(ignoredCount)}`;
|
|
1154
1179
|
}
|
|
@@ -1712,6 +1737,30 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
1712
1737
|
}
|
|
1713
1738
|
}
|
|
1714
1739
|
|
|
1740
|
+
// A page cap counts characters, the transport counts the escaped JSON, and
|
|
1741
|
+
// markup grows under escaping. Shrink the html until the whole snapshot
|
|
1742
|
+
// fits, so a capped inspect still returns html instead of a placeholder.
|
|
1743
|
+
function fitSnapshot(snap) {
|
|
1744
|
+
try {
|
|
1745
|
+
if (!snap || typeof snap.html !== "string") return snap;
|
|
1746
|
+
if (JSON.stringify(snap).length <= MAX_RESULT_BYTES) return snap;
|
|
1747
|
+
var html = snap.html;
|
|
1748
|
+
var cut = html.length;
|
|
1749
|
+
for (var attempt = 0; attempt < 40 && cut > 0; attempt++) {
|
|
1750
|
+
snap.html = html.slice(0, cut);
|
|
1751
|
+
snap.htmlTruncated = true;
|
|
1752
|
+
var size = JSON.stringify(snap).length;
|
|
1753
|
+
if (size <= MAX_RESULT_BYTES) return snap;
|
|
1754
|
+
cut = Math.floor(cut * (MAX_RESULT_BYTES / size) * 0.98);
|
|
1755
|
+
}
|
|
1756
|
+
snap.html = "";
|
|
1757
|
+
snap.htmlTruncated = true;
|
|
1758
|
+
return snap;
|
|
1759
|
+
} catch (e) {
|
|
1760
|
+
return snap;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1715
1764
|
function replyOk(cmdId, value) {
|
|
1716
1765
|
var s = safeValue(value);
|
|
1717
1766
|
var frame = {type: "result", cmdId: cmdId, ok: true, value: s.value};
|
|
@@ -2291,7 +2340,7 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
2291
2340
|
if (err) { replyInjectionErr(cmdId, err); return; }
|
|
2292
2341
|
var snap = res && res[0] ? res[0].result : undefined;
|
|
2293
2342
|
if (snap == null) { replyErr(cmdId, "TargetNotFound", "no injectable frame returned a snapshot for tab " + target.tabId + " (restricted page, or outside host_permissions)"); return; }
|
|
2294
|
-
replyOk(cmdId, snap);
|
|
2343
|
+
replyOk(cmdId, fitSnapshot(snap));
|
|
2295
2344
|
});
|
|
2296
2345
|
} else if (ctx === "popup" || ctx === "options" || ctx === "sidebar" || ctx === "devtools" || ctx === "newtab" || ctx === "history" || ctx === "bookmarks") {
|
|
2297
2346
|
// The SW can't read a surface page's DOM; ask the surface's own
|
|
@@ -2303,7 +2352,7 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
2303
2352
|
if (relayErr) {
|
|
2304
2353
|
replyErr(cmdId, "Unsupported", relayErr.message, relayErr.code);
|
|
2305
2354
|
} else if (resp.ok) {
|
|
2306
|
-
replyOk(cmdId, resp.value);
|
|
2355
|
+
replyOk(cmdId, fitSnapshot(resp.value));
|
|
2307
2356
|
} else {
|
|
2308
2357
|
replyErr(cmdId, (resp.error && resp.error.name) || "InspectError", (resp.error && resp.error.message) || "inspect failed");
|
|
2309
2358
|
}
|
|
@@ -2333,6 +2382,42 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
2333
2382
|
return typeof url === "string" && /^(https?|file|ftp):/i.test(url);
|
|
2334
2383
|
}
|
|
2335
2384
|
|
|
2385
|
+
function stringList(value) {
|
|
2386
|
+
return Array.isArray(value) ? value.filter(function (v) { return typeof v === "string"; }) : [];
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
// The manifest glob dialect: * is any run of characters, ? exactly one,
|
|
2390
|
+
// and the pattern covers the whole url.
|
|
2391
|
+
function globMatches(glob, text) {
|
|
2392
|
+
var gi = 0, ti = 0, star = -1, mark = 0;
|
|
2393
|
+
while (ti < text.length) {
|
|
2394
|
+
if (gi < glob.length && (glob.charAt(gi) === "?" || glob.charAt(gi) === text.charAt(ti))) { gi++; ti++; }
|
|
2395
|
+
else if (gi < glob.length && glob.charAt(gi) === "*") { star = gi++; mark = ti; }
|
|
2396
|
+
else if (star !== -1) { gi = star + 1; ti = ++mark; }
|
|
2397
|
+
else return false;
|
|
2398
|
+
}
|
|
2399
|
+
while (gi < glob.length && glob.charAt(gi) === "*") gi++;
|
|
2400
|
+
return gi === glob.length;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
// include_globs narrows matches and exclude_globs removes from them, the
|
|
2404
|
+
// same way the browser decides where the built extension runs.
|
|
2405
|
+
function passesGlobs(url, includeGlobs, excludeGlobs) {
|
|
2406
|
+
var u = String(url || "");
|
|
2407
|
+
var i;
|
|
2408
|
+
if (includeGlobs.length) {
|
|
2409
|
+
var included = false;
|
|
2410
|
+
for (i = 0; i < includeGlobs.length; i++) {
|
|
2411
|
+
if (globMatches(includeGlobs[i], u)) { included = true; break; }
|
|
2412
|
+
}
|
|
2413
|
+
if (!included) return false;
|
|
2414
|
+
}
|
|
2415
|
+
for (i = 0; i < excludeGlobs.length; i++) {
|
|
2416
|
+
if (globMatches(excludeGlobs[i], u)) return false;
|
|
2417
|
+
}
|
|
2418
|
+
return true;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2336
2421
|
// Re-inject one declared entry's fresh files into every matching open tab.
|
|
2337
2422
|
// exclude_matches MUST be honored: query the excludes and subtract them.
|
|
2338
2423
|
// opts.completeOnly skips a tab still loading: Chrome injects the static
|
|
@@ -2343,6 +2428,8 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
2343
2428
|
var matches = (entry && entry.matches) || [];
|
|
2344
2429
|
if (!Array.isArray(matches) || !matches.length) return;
|
|
2345
2430
|
var excludeMatches = (entry && entry.exclude_matches) || [];
|
|
2431
|
+
var includeGlobs = stringList(entry && entry.include_globs);
|
|
2432
|
+
var excludeGlobs = stringList(entry && entry.exclude_globs);
|
|
2346
2433
|
var jsFiles = ((entry && entry.js) || []).filter(function (f) { return typeof f === "string"; });
|
|
2347
2434
|
var cssFiles = ((entry && entry.css) || []).filter(function (f) { return typeof f === "string"; });
|
|
2348
2435
|
if (!jsFiles.length && !cssFiles.length) return;
|
|
@@ -2360,6 +2447,7 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
2360
2447
|
(function (tab) {
|
|
2361
2448
|
if (!tab || tab.id == null || !isInjectableUrl(tab.url)) return;
|
|
2362
2449
|
if (excludedTabIds[tab.id]) return;
|
|
2450
|
+
if (!passesGlobs(tab.url, includeGlobs, excludeGlobs)) return;
|
|
2363
2451
|
if (completeOnly && tab.status === "loading") return;
|
|
2364
2452
|
var target = {tabId: tab.id, allFrames: allFrames};
|
|
2365
2453
|
if (cssFiles.length && chrome.scripting.insertCSS) {
|
|
@@ -2452,6 +2540,9 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
2452
2540
|
for (var i = 0; i < entries.length; i++) {
|
|
2453
2541
|
var e = entries[i] || {};
|
|
2454
2542
|
if (!Array.isArray(e.matches) || !e.matches.length) continue;
|
|
2543
|
+
// registerContentScripts has no glob keys, so a copy of a globbed
|
|
2544
|
+
// entry would run on pages the built extension never reaches.
|
|
2545
|
+
if (stringList(e.include_globs).length || stringList(e.exclude_globs).length) continue;
|
|
2455
2546
|
var js = (e.js || []).filter(function (f) { return typeof f === "string"; });
|
|
2456
2547
|
var css = (e.css || []).filter(function (f) { return typeof f === "string"; });
|
|
2457
2548
|
if (!js.length && !css.length) continue;
|
|
@@ -3587,9 +3678,9 @@ class ActionsFileWriter {
|
|
|
3587
3678
|
});
|
|
3588
3679
|
for(let n = generations - 1; n >= 1; n--){
|
|
3589
3680
|
const from = this.rotatedName(n);
|
|
3590
|
-
if (__rspack_external_node_fs_1b05aee1.existsSync(from))
|
|
3681
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(from)) renameSyncWithRetry(from, this.rotatedName(n + 1));
|
|
3591
3682
|
}
|
|
3592
|
-
if (__rspack_external_node_fs_1b05aee1.existsSync(this.opts.filePath))
|
|
3683
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(this.opts.filePath)) renameSyncWithRetry(this.opts.filePath, this.rotatedName(1));
|
|
3593
3684
|
} catch {}
|
|
3594
3685
|
}
|
|
3595
3686
|
}
|
|
@@ -4585,9 +4676,9 @@ class LogsFileWriter {
|
|
|
4585
4676
|
});
|
|
4586
4677
|
for(let n = generations - 1; n >= 1; n--){
|
|
4587
4678
|
const from = this.rotatedName(n);
|
|
4588
|
-
if (__rspack_external_node_fs_1b05aee1.existsSync(from))
|
|
4679
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(from)) renameSyncWithRetry(from, this.rotatedName(n + 1));
|
|
4589
4680
|
}
|
|
4590
|
-
if (__rspack_external_node_fs_1b05aee1.existsSync(this.opts.filePath))
|
|
4681
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(this.opts.filePath)) renameSyncWithRetry(this.opts.filePath, this.rotatedName(1));
|
|
4591
4682
|
} catch {}
|
|
4592
4683
|
}
|
|
4593
4684
|
}
|
|
@@ -5015,13 +5106,24 @@ function explicitUnpackedDir(pathOrRemoteUrl, packageJsonDir, manifestDir) {
|
|
|
5015
5106
|
if ('src' === __rspack_external_node_path_806ed179.basename(typed)) return;
|
|
5016
5107
|
return typed;
|
|
5017
5108
|
}
|
|
5109
|
+
function previewArchiveTarget(metadataCommand, outputPath) {
|
|
5110
|
+
if ('preview' !== metadataCommand) return;
|
|
5111
|
+
if (outputPath) return {
|
|
5112
|
+
destination: __rspack_external_node_path_806ed179.resolve(process.cwd(), outputPath)
|
|
5113
|
+
};
|
|
5114
|
+
return {
|
|
5115
|
+
cacheRoot: remoteArchiveCacheRoot()
|
|
5116
|
+
};
|
|
5117
|
+
}
|
|
5018
5118
|
async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher) {
|
|
5019
|
-
const
|
|
5119
|
+
const metadataCommand = 'start' === previewOptions.metadataCommand ? 'start' : 'preview';
|
|
5120
|
+
const projectStructure = await getProjectStructure(pathOrRemoteUrl, {
|
|
5121
|
+
remoteArchive: previewArchiveTarget(metadataCommand, previewOptions.outputPath)
|
|
5122
|
+
});
|
|
5020
5123
|
const debug = isDebug();
|
|
5021
5124
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
5022
5125
|
const userManifestPath = projectStructure.packageJsonPath || projectStructure.denoJsonPath;
|
|
5023
5126
|
if (userManifestPath) assertNoManagedDependencyConflicts(userManifestPath, packageJsonDir);
|
|
5024
|
-
const metadataCommand = 'start' === previewOptions.metadataCommand ? 'start' : 'preview';
|
|
5025
5127
|
const configBrowser = previewOptions.browser ? void 0 : configBrowserOrThrow((await loadCommandConfig(packageJsonDir, metadataCommand)).browser, metadataCommand);
|
|
5026
5128
|
const browser = normalizeBrowser(previewOptions.browser || configBrowser || 'chrome', previewOptions.chromiumBinary, previewOptions.geckoBinary || previewOptions.firefoxBinary);
|
|
5027
5129
|
const unpackedDir = explicitUnpackedDir(pathOrRemoteUrl, packageJsonDir, manifestDir);
|
|
@@ -5187,4 +5289,4 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
|
|
|
5187
5289
|
warnings
|
|
5188
5290
|
};
|
|
5189
5291
|
}
|
|
5190
|
-
export { ActionsFileWriter, BUILD_COMMAND_DEFAULTS, BridgeBroker, CONTROL_PORT_ASSET_NAME, DEV_COMMAND_DEFAULTS, InjectBridgeRelay, LogRingBuffer, LogsFileWriter, PlaywrightPlugin, START_BUILD_DEFAULTS, assertNoManagedDependencyConflicts, attachEmulatorFileIndex, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserRunnerDisabled, buildBridgeProducerSource, buildEmulatorViewerUrl, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, controlBridgeUnavailable, createEmulatorFileIndexHolder, createEmulatorFilesMiddlewareEntry, createPlaywrightMetadataWriter, detectLiveDevSessionOwner, devServerHostRefused, devServerRestarting, devServerStartTimeout, emulatorViewerUrl, extensionJsRunnerError, extensionPreview, falseProfileSource, getSessionRunId, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, isSameWebOrigin, manifestGoneDuringSession, mergeOptionLayers, messages_ready, noEntrypointsDetected, normalizeWebOrigin, package_namespaceObject, portInUse, prependToEmittedAsset, publicFileCollidesWithEntry, publicFolderOffRef, publicFolderShadowed, publicMustBeAtProjectRoot, recordCodedWarning, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, resolveEmulatorOrigin, runnerCleanupError, runnerUncaughtException, runnerUnhandledRejection, sanitize, serverRestartRequiredFromSpecialFolderMessageOnly, shouldWarnPortConflict, spacerLine, specialFolderChangeDetected, specialFoldersSetupSummary, stampReadyDistExtensionId, stampReadyKnownExtensionId, startControlServer, takeCodedWarnings, withDarkMode };
|
|
5292
|
+
export { ActionsFileWriter, BUILD_COMMAND_DEFAULTS, BridgeBroker, CONTROL_PORT_ASSET_NAME, DEV_COMMAND_DEFAULTS, InjectBridgeRelay, LogRingBuffer, LogsFileWriter, PlaywrightPlugin, START_BUILD_DEFAULTS, assertNoManagedDependencyConflicts, attachEmulatorFileIndex, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserRunnerDisabled, buildBridgeProducerSource, buildEmulatorViewerUrl, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, controlBridgeUnavailable, createEmulatorFileIndexHolder, createEmulatorFilesMiddlewareEntry, createPlaywrightMetadataWriter, detectLiveDevSessionOwner, devServerHostRefused, devServerRestarting, devServerStartTimeout, emulatorViewerUrl, extensionJsRunnerError, extensionPreview, falseProfileSource, getSessionRunId, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, isSameWebOrigin, manifestGoneDuringSession, mergeOptionLayers, messages_ready, noEntrypointsDetected, normalizeWebOrigin, package_namespaceObject, portInUse, prependToEmittedAsset, publicFileCollidesWithEntry, publicFolderAppeared, publicFolderOffRef, publicFolderShadowed, publicMustBeAtProjectRoot, recordCodedWarning, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, resolveEmulatorOrigin, runnerCleanupError, runnerUncaughtException, runnerUnhandledRejection, sanitize, serverRestartRequiredFromSpecialFolderMessageOnly, shouldWarnPortConflict, spacerLine, specialFolderChangeDetected, specialFoldersSetupSummary, stampReadyDistExtensionId, stampReadyKnownExtensionId, startControlServer, takeCodedWarnings, withDarkMode };
|