extension-develop 4.0.30 → 4.0.33
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 +5 -5
- package/dist/0~rspack-config.mjs +412 -117
- package/dist/0~stats-handler.mjs +26 -2
- package/dist/0~zip.mjs +22 -3
- package/dist/101.mjs +189 -126
- package/dist/349.mjs +5 -1
- package/dist/839.mjs +28 -21
- package/dist/contract/codes.json +1 -1
- package/dist/lib/stats-handler.d.ts +1 -0
- package/dist/plugin-compilation/env.d.ts +6 -0
- package/dist/plugin-perf-budgets/categorize.d.ts +1 -1
- package/dist/plugin-perf-budgets/index.d.ts +1 -0
- package/dist/plugin-wasm/index.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/legacy-paths.d.ts +26 -0
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -1
- package/dist/plugin-web-extension/feature-manifest/steps/legacy-warnings.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/steps/update-manifest.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +2 -0
- package/dist/plugin-web-extension/shared/discover-devtools-panels.d.ts +8 -0
- package/package.json +3 -4
package/dist/0~stats-handler.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
2
|
import { __webpack_require__ } from "./0~rslib-runtime.mjs";
|
|
3
|
-
import { prefix } from "./349.mjs";
|
|
3
|
+
import { prefix, isDebug } from "./349.mjs";
|
|
4
4
|
var stats_handler_namespaceObject = {};
|
|
5
5
|
__webpack_require__.r(stats_handler_namespaceObject);
|
|
6
6
|
__webpack_require__.d(stats_handler_namespaceObject, {
|
|
7
7
|
handleStatsErrors: ()=>handleStatsErrors,
|
|
8
|
+
humanizeCaseMismatchBlocks: ()=>humanizeCaseMismatchBlocks,
|
|
8
9
|
isEmitTimeWarning: ()=>isEmitTimeWarning,
|
|
9
10
|
renderStatsBlocks: ()=>renderStatsBlocks,
|
|
10
11
|
wrapStatsBlocks: ()=>wrapStatsBlocks
|
|
@@ -90,6 +91,29 @@ function dropEmitTimeWarningBlocks(raw, excluded) {
|
|
|
90
91
|
flush();
|
|
91
92
|
return kept.join('\n');
|
|
92
93
|
}
|
|
94
|
+
const CASE_MISMATCH_PATTERN = /\[CaseSensitivePathsPlugin\]\s*`([^`]+)`\s*does not match the corresponding path on disk\s*`?([^`\s]+?)`?\.?\s*$/;
|
|
95
|
+
function humanizeCaseMismatchBlocks(raw, showStack = isDebug()) {
|
|
96
|
+
const lines = String(raw || '').split('\n');
|
|
97
|
+
const out = [];
|
|
98
|
+
let droppingStack = false;
|
|
99
|
+
for (const line of lines){
|
|
100
|
+
const plain = line.replace(ANSI_PATTERN, '');
|
|
101
|
+
const match = CASE_MISMATCH_PATTERN.exec(plain);
|
|
102
|
+
if (match) {
|
|
103
|
+
const reference = match[1];
|
|
104
|
+
const onDisk = match[2];
|
|
105
|
+
out.push(` × \`${reference}\` does not match its casing on disk: \`${onDisk}\`.`, " Case-sensitive filesystems fail this reference. Rename the file or the import so both agree.");
|
|
106
|
+
droppingStack = !showStack;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (droppingStack) {
|
|
110
|
+
if (plain.trim().startsWith('│')) continue;
|
|
111
|
+
droppingStack = false;
|
|
112
|
+
}
|
|
113
|
+
out.push(line);
|
|
114
|
+
}
|
|
115
|
+
return out.join('\n');
|
|
116
|
+
}
|
|
93
117
|
function wrapStatsBlocks(raw) {
|
|
94
118
|
const lines = String(raw || '').split('\n');
|
|
95
119
|
const wrapped = [];
|
|
@@ -125,7 +149,7 @@ function renderStatsBlocks(stats, opts) {
|
|
|
125
149
|
if (!raw) return '';
|
|
126
150
|
const filtered = opts.warnings ? dropEmitTimeWarningBlocks(raw, collectEmitTimeWarningTexts(stats)) : raw;
|
|
127
151
|
if (!filtered.trim()) return '';
|
|
128
|
-
return wrapStatsBlocks(scrubBrand(filtered));
|
|
152
|
+
return wrapStatsBlocks(scrubBrand(humanizeCaseMismatchBlocks(filtered)));
|
|
129
153
|
}
|
|
130
154
|
function handleStatsErrors(stats) {
|
|
131
155
|
try {
|
package/dist/0~zip.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
-
import
|
|
2
|
+
import { unzipSync } from "fflate";
|
|
3
3
|
import { unpackagingExtension, failedToDownloadOrExtractZIPFileError, invalidRemoteZip, notAZipArchive, unpackagedSuccessfully, localZipNotFound, downloadingText } from "./101.mjs";
|
|
4
4
|
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
5
5
|
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
@@ -12,8 +12,27 @@ function isZipBuffer(buffer) {
|
|
|
12
12
|
}
|
|
13
13
|
function extractBuffer(zipBuffer, destinationPath) {
|
|
14
14
|
console.log(unpackagingExtension(destinationPath));
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const root = __rspack_external_node_path_c5b9b54f.resolve(destinationPath);
|
|
16
|
+
const entries = unzipSync(new Uint8Array(zipBuffer));
|
|
17
|
+
__rspack_external_node_fs_5ea92f0c.mkdirSync(root, {
|
|
18
|
+
recursive: true
|
|
19
|
+
});
|
|
20
|
+
for (const [name, data] of Object.entries(entries)){
|
|
21
|
+
const normalized = name.replace(/\\/g, '/');
|
|
22
|
+
const target = __rspack_external_node_path_c5b9b54f.resolve(root, normalized);
|
|
23
|
+
const relative = __rspack_external_node_path_c5b9b54f.relative(root, target);
|
|
24
|
+
if (!relative || relative.startsWith('..') || __rspack_external_node_path_c5b9b54f.isAbsolute(relative)) throw new Error(`Refusing to extract zip entry outside the destination: ${name}`);
|
|
25
|
+
if (normalized.endsWith('/')) {
|
|
26
|
+
__rspack_external_node_fs_5ea92f0c.mkdirSync(target, {
|
|
27
|
+
recursive: true
|
|
28
|
+
});
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
__rspack_external_node_fs_5ea92f0c.mkdirSync(__rspack_external_node_path_c5b9b54f.dirname(target), {
|
|
32
|
+
recursive: true
|
|
33
|
+
});
|
|
34
|
+
__rspack_external_node_fs_5ea92f0c.writeFileSync(target, data);
|
|
35
|
+
}
|
|
17
36
|
console.log(unpackagedSuccessfully());
|
|
18
37
|
}
|
|
19
38
|
function asZipError(error) {
|
package/dist/101.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { fetchExtensionFromStore } from "extension-from-store";
|
|
|
8
8
|
import node_fs from "node:fs";
|
|
9
9
|
import node_path from "node:path";
|
|
10
10
|
import { getSpecialFoldersData } from "browser-extension-manifest-fields";
|
|
11
|
-
import {
|
|
11
|
+
import { humanWarn, browserRowValue, artifactNoun, prefix as messaging_prefix, card, humanLine, fmt, isDebug } from "./349.mjs";
|
|
12
12
|
import { findNearestDenoConfigSync, validateDenoConfig, PROJECT_MANIFEST_FILENAMES, readProjectDependencies } from "./80.mjs";
|
|
13
13
|
import { stripBom, parseJsonSafe } from "./23.mjs";
|
|
14
14
|
import { readyContractPath, browserArtifactsDir, eventsPath as session_paths_eventsPath } from "./494.mjs";
|
|
@@ -19,6 +19,46 @@ import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
|
19
19
|
import * as __rspack_external_node_os_74b4b876 from "node:os";
|
|
20
20
|
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
21
21
|
import * as __rspack_external_node_vm_bd3d9cea from "node:vm";
|
|
22
|
+
__rspack_external_node_path_c5b9b54f.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
23
|
+
const CHROMIUM_BASED_BROWSERS = [
|
|
24
|
+
'chrome',
|
|
25
|
+
'edge',
|
|
26
|
+
'brave',
|
|
27
|
+
'opera',
|
|
28
|
+
'vivaldi',
|
|
29
|
+
'yandex'
|
|
30
|
+
];
|
|
31
|
+
const GECKO_BASED_BROWSERS = [
|
|
32
|
+
'firefox',
|
|
33
|
+
'waterfox',
|
|
34
|
+
'librewolf'
|
|
35
|
+
];
|
|
36
|
+
const WEBKIT_BASED_BROWSERS = [
|
|
37
|
+
'safari'
|
|
38
|
+
];
|
|
39
|
+
const CHROMIUM_FAMILY_ALIASES = [
|
|
40
|
+
'chromium',
|
|
41
|
+
'chrome',
|
|
42
|
+
'edge',
|
|
43
|
+
'chromium-based'
|
|
44
|
+
];
|
|
45
|
+
const GECKO_FAMILY_ALIASES = [
|
|
46
|
+
'firefox',
|
|
47
|
+
'gecko-based'
|
|
48
|
+
];
|
|
49
|
+
[
|
|
50
|
+
...CHROMIUM_BASED_BROWSERS,
|
|
51
|
+
...GECKO_BASED_BROWSERS
|
|
52
|
+
];
|
|
53
|
+
function isChromiumBasedBrowser(browser) {
|
|
54
|
+
return CHROMIUM_BASED_BROWSERS.includes(browser) || String(browser).includes('chromium');
|
|
55
|
+
}
|
|
56
|
+
function isGeckoBasedBrowser(browser) {
|
|
57
|
+
return GECKO_BASED_BROWSERS.includes(browser) || String(browser).includes('gecko') || String(browser).includes('firefox');
|
|
58
|
+
}
|
|
59
|
+
function isWebkitBasedBrowser(browser) {
|
|
60
|
+
return WEBKIT_BASED_BROWSERS.includes(browser) || String(browser).includes('webkit');
|
|
61
|
+
}
|
|
22
62
|
function getLoggingPrefix(type) {
|
|
23
63
|
return messaging_prefix(type);
|
|
24
64
|
}
|
|
@@ -601,14 +641,22 @@ async function loadBrowserConfig(projectPath, browser = 'chrome') {
|
|
|
601
641
|
const userConfig = await loadConfigFile(configPath);
|
|
602
642
|
if (userConfig?.browser) {
|
|
603
643
|
const browsers = userConfig.browser;
|
|
644
|
+
const browserName = String(browser);
|
|
604
645
|
if ('chromium-based' === browser) {
|
|
605
646
|
if (browsers['chromium-based']) return browsers['chromium-based'];
|
|
606
647
|
if (browsers.chromium) return browsers.chromium;
|
|
607
648
|
} else if ('gecko-based' === browser) {
|
|
608
649
|
if (browsers['gecko-based']) return browsers['gecko-based'];
|
|
609
650
|
if (browsers.firefox) return browsers.firefox;
|
|
651
|
+
} else if (isWebkitBasedBrowser(browserName)) {
|
|
652
|
+
const direct = browsers[browserName];
|
|
653
|
+
if (direct) return direct;
|
|
654
|
+
if ('safari' !== browserName) {
|
|
655
|
+
if (browsers['webkit-based']) return browsers['webkit-based'];
|
|
656
|
+
if (browsers.safari) return browsers.safari;
|
|
657
|
+
}
|
|
610
658
|
} else {
|
|
611
|
-
const direct = browsers[
|
|
659
|
+
const direct = browsers[browserName];
|
|
612
660
|
if (direct) return direct;
|
|
613
661
|
}
|
|
614
662
|
}
|
|
@@ -634,7 +682,7 @@ async function config_loader_isUsingExperimentalConfig(projectPath) {
|
|
|
634
682
|
}
|
|
635
683
|
return false;
|
|
636
684
|
}
|
|
637
|
-
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.
|
|
685
|
+
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.33","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.1.1","@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.26","acorn":"^8.16.0","browser-extension-manifest-fields":"^2.2.9","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","dotenv":"^17.2.3","es-module-lexer":"^2.1.0","extension-from-store":"^0.2.5","fflate":"^0.8.3","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.6.7","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":"10.27.3","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.26","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"}}');
|
|
638
686
|
function asAbsolute(p) {
|
|
639
687
|
return __rspack_external_node_path_c5b9b54f.isAbsolute(p) ? p : __rspack_external_node_path_c5b9b54f.resolve(p);
|
|
640
688
|
}
|
|
@@ -1182,46 +1230,6 @@ function assertNoManagedDependencyConflicts(userManifestPath, projectPath) {
|
|
|
1182
1230
|
}
|
|
1183
1231
|
if (duplicates.length > 0) throw new Error(managedDependencyConflict(duplicates, userManifestPath));
|
|
1184
1232
|
}
|
|
1185
|
-
__rspack_external_node_path_c5b9b54f.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
1186
|
-
const CHROMIUM_BASED_BROWSERS = [
|
|
1187
|
-
'chrome',
|
|
1188
|
-
'edge',
|
|
1189
|
-
'brave',
|
|
1190
|
-
'opera',
|
|
1191
|
-
'vivaldi',
|
|
1192
|
-
'yandex'
|
|
1193
|
-
];
|
|
1194
|
-
const GECKO_BASED_BROWSERS = [
|
|
1195
|
-
'firefox',
|
|
1196
|
-
'waterfox',
|
|
1197
|
-
'librewolf'
|
|
1198
|
-
];
|
|
1199
|
-
const WEBKIT_BASED_BROWSERS = [
|
|
1200
|
-
'safari'
|
|
1201
|
-
];
|
|
1202
|
-
const CHROMIUM_FAMILY_ALIASES = [
|
|
1203
|
-
'chromium',
|
|
1204
|
-
'chrome',
|
|
1205
|
-
'edge',
|
|
1206
|
-
'chromium-based'
|
|
1207
|
-
];
|
|
1208
|
-
const GECKO_FAMILY_ALIASES = [
|
|
1209
|
-
'firefox',
|
|
1210
|
-
'gecko-based'
|
|
1211
|
-
];
|
|
1212
|
-
[
|
|
1213
|
-
...CHROMIUM_BASED_BROWSERS,
|
|
1214
|
-
...GECKO_BASED_BROWSERS
|
|
1215
|
-
];
|
|
1216
|
-
function isChromiumBasedBrowser(browser) {
|
|
1217
|
-
return CHROMIUM_BASED_BROWSERS.includes(browser) || String(browser).includes('chromium');
|
|
1218
|
-
}
|
|
1219
|
-
function isGeckoBasedBrowser(browser) {
|
|
1220
|
-
return GECKO_BASED_BROWSERS.includes(browser) || String(browser).includes('gecko') || String(browser).includes('firefox');
|
|
1221
|
-
}
|
|
1222
|
-
function isWebkitBasedBrowser(browser) {
|
|
1223
|
-
return WEBKIT_BASED_BROWSERS.includes(browser) || String(browser).includes('webkit');
|
|
1224
|
-
}
|
|
1225
1233
|
function idFromHash(hash) {
|
|
1226
1234
|
const hex = hash.subarray(0, 16).toString('hex');
|
|
1227
1235
|
let id = '';
|
|
@@ -1410,6 +1418,7 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
1410
1418
|
instanceExplicit: options.instanceExplicit
|
|
1411
1419
|
})) humanWarn(anotherDevSessionActive(options.browser, liveOwner.pid, liveOwner.runId));
|
|
1412
1420
|
const toManagedRecords = (dirs)=>Array.isArray(dirs) && dirs.length > 0 ? managedExtensionRecords(options.browser, dirs) : void 0;
|
|
1421
|
+
let managedExtensionsExplicit = void 0 !== options.managedExtensionDirs;
|
|
1413
1422
|
let managedExtensions = toManagedRecords(options.managedExtensionDirs);
|
|
1414
1423
|
const base = {
|
|
1415
1424
|
schemaVersion: 2,
|
|
@@ -1435,48 +1444,55 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
1435
1444
|
function writeReady(status, extra) {
|
|
1436
1445
|
if (foreignLiveDevSession) return;
|
|
1437
1446
|
plugin_playwright_ensureDirSync(metadataDir);
|
|
1447
|
+
let prev;
|
|
1448
|
+
try {
|
|
1449
|
+
if (__rspack_external_node_fs_5ea92f0c.existsSync(readyPath)) prev = JSON.parse(__rspack_external_node_fs_5ea92f0c.readFileSync(readyPath, 'utf-8'));
|
|
1450
|
+
} catch {
|
|
1451
|
+
prev = void 0;
|
|
1452
|
+
}
|
|
1453
|
+
const compiledAtExplicit = Boolean(extra && 'compiledAt' in extra);
|
|
1454
|
+
const compiledAt = compiledAtExplicit ? extra?.compiledAt ?? null : 'string' == typeof prev?.compiledAt ? prev.compiledAt : 'ready' === status ? nowISO() : null;
|
|
1438
1455
|
const payload = {
|
|
1439
1456
|
...base,
|
|
1440
1457
|
status,
|
|
1441
1458
|
pid: process.pid,
|
|
1442
1459
|
ts: nowISO(),
|
|
1443
|
-
compiledAt
|
|
1460
|
+
compiledAt,
|
|
1444
1461
|
errors: Array.isArray(extra?.errors) ? extra.errors : []
|
|
1445
1462
|
};
|
|
1463
|
+
if ('starting' !== status && prev && prev.runId === base.runId && 'string' == typeof prev.startedAt) payload.startedAt = prev.startedAt;
|
|
1446
1464
|
if (extra?.code) payload.code = extra.code;
|
|
1447
1465
|
if (extra?.message) payload.message = extra.message;
|
|
1448
|
-
if (
|
|
1466
|
+
if (managedExtensionsExplicit) {
|
|
1467
|
+
if (managedExtensions) payload.managedExtensions = managedExtensions;
|
|
1468
|
+
} else if (Array.isArray(prev?.managedExtensions) && prev.managedExtensions.length > 0) payload.managedExtensions = prev.managedExtensions;
|
|
1449
1469
|
const derivedExtensionId = deriveDistExtensionId(options.browser, options.distPath);
|
|
1450
1470
|
if (derivedExtensionId) payload.extensionId = derivedExtensionId;
|
|
1451
|
-
|
|
1452
|
-
if (
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
if ('
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
payload.status = 'error';
|
|
1474
|
-
payload.code = 'extension_load_refused';
|
|
1475
|
-
payload.message = String(prev.message || 'the browser refused to load the extension');
|
|
1476
|
-
}
|
|
1471
|
+
if (prev) {
|
|
1472
|
+
if ('number' == typeof prev.cdpPort) payload.cdpPort = prev.cdpPort;
|
|
1473
|
+
if ('number' == typeof prev.rdpPort) payload.rdpPort = prev.rdpPort;
|
|
1474
|
+
if ('string' == typeof prev.profilePath) payload.profilePath = prev.profilePath;
|
|
1475
|
+
if ('number' == typeof prev.browserPid) payload.browserPid = prev.browserPid;
|
|
1476
|
+
if ('string' == typeof prev.extensionId && prev.extensionId) payload.extensionId = prev.extensionId;
|
|
1477
|
+
if ('string' == typeof prev.browserExitedAt) {
|
|
1478
|
+
payload.browserExitedAt = prev.browserExitedAt;
|
|
1479
|
+
payload.browserExitCode = prev.browserExitCode ?? null;
|
|
1480
|
+
}
|
|
1481
|
+
if ('string' == typeof prev.executorAttachedAt) {
|
|
1482
|
+
payload.executorAttachedAt = prev.executorAttachedAt;
|
|
1483
|
+
payload.runtime = 'attached';
|
|
1484
|
+
}
|
|
1485
|
+
if ('starting' !== status && 'string' == typeof prev.extensionLoadRefusedAt) {
|
|
1486
|
+
const target = payload;
|
|
1487
|
+
target.extensionLoadRefusedAt = prev.extensionLoadRefusedAt;
|
|
1488
|
+
if ('string' == typeof prev.extensionLoadRefusedReason) target.extensionLoadRefusedReason = prev.extensionLoadRefusedReason;
|
|
1489
|
+
if ('ready' === status) {
|
|
1490
|
+
payload.status = 'error';
|
|
1491
|
+
payload.code = 'extension_load_refused';
|
|
1492
|
+
payload.message = String(prev.message || 'the browser refused to load the extension');
|
|
1477
1493
|
}
|
|
1478
1494
|
}
|
|
1479
|
-
}
|
|
1495
|
+
}
|
|
1480
1496
|
writeJsonAtomic(readyPath, payload);
|
|
1481
1497
|
}
|
|
1482
1498
|
function appendEvent(event) {
|
|
@@ -1494,6 +1510,7 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
1494
1510
|
readyPath,
|
|
1495
1511
|
eventsPath,
|
|
1496
1512
|
setManagedExtensionDirs (dirs) {
|
|
1513
|
+
managedExtensionsExplicit = true;
|
|
1497
1514
|
managedExtensions = toManagedRecords(dirs);
|
|
1498
1515
|
},
|
|
1499
1516
|
writeStarting () {
|
|
@@ -1502,10 +1519,12 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
1502
1519
|
try {
|
|
1503
1520
|
__rspack_external_node_fs_5ea92f0c.writeFileSync(eventsPath, '', 'utf-8');
|
|
1504
1521
|
} catch {}
|
|
1505
|
-
writeReady('starting'
|
|
1522
|
+
writeReady('starting', {
|
|
1523
|
+
compiledAt: null
|
|
1524
|
+
});
|
|
1506
1525
|
},
|
|
1507
1526
|
writeReady (compiledAt) {
|
|
1508
|
-
writeReady('ready', {
|
|
1527
|
+
void 0 === compiledAt ? writeReady('ready') : writeReady('ready', {
|
|
1509
1528
|
compiledAt: compiledAt || nowISO()
|
|
1510
1529
|
});
|
|
1511
1530
|
},
|
|
@@ -2073,6 +2092,80 @@ function finalizeSpecialFoldersData(data, projectRoot, publicDir) {
|
|
|
2073
2092
|
}
|
|
2074
2093
|
};
|
|
2075
2094
|
}
|
|
2095
|
+
function getDarkModeDefaults(browser) {
|
|
2096
|
+
if (isChromiumBasedBrowser(String(browser))) return {
|
|
2097
|
+
browserFlags: [
|
|
2098
|
+
'--force-dark-mode',
|
|
2099
|
+
'--enable-features=WebUIDarkMode'
|
|
2100
|
+
],
|
|
2101
|
+
preferences: {}
|
|
2102
|
+
};
|
|
2103
|
+
if (isGeckoBasedBrowser(String(browser))) return {
|
|
2104
|
+
browserFlags: [],
|
|
2105
|
+
preferences: {
|
|
2106
|
+
'ui.systemUsesDarkTheme': 1,
|
|
2107
|
+
'layout.css.prefers-color-scheme.content-override': 2,
|
|
2108
|
+
'devtools.theme': 'dark'
|
|
2109
|
+
}
|
|
2110
|
+
};
|
|
2111
|
+
return {
|
|
2112
|
+
browserFlags: [],
|
|
2113
|
+
preferences: {}
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
function normalizeFlag(flag) {
|
|
2117
|
+
return String(flag ?? '').trim();
|
|
2118
|
+
}
|
|
2119
|
+
function isFlagExcluded(flag, excludeFlags) {
|
|
2120
|
+
return excludeFlags.some((exclude)=>{
|
|
2121
|
+
if (!exclude) return false;
|
|
2122
|
+
if (flag === exclude) return true;
|
|
2123
|
+
return flag.startsWith(`${exclude}=`) || flag.startsWith(`${exclude},`);
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
function featureList(flag, switchName) {
|
|
2127
|
+
const prefix = `${switchName}=`;
|
|
2128
|
+
if (!flag.startsWith(prefix)) return [];
|
|
2129
|
+
return flag.slice(prefix.length).split(',').map((part)=>part.trim()).filter(Boolean);
|
|
2130
|
+
}
|
|
2131
|
+
function hasFeature(flags, switchName, feature) {
|
|
2132
|
+
return flags.some((flag)=>featureList(flag, switchName).includes(feature));
|
|
2133
|
+
}
|
|
2134
|
+
function withDarkMode(config) {
|
|
2135
|
+
const defaults = getDarkModeDefaults(config.browser);
|
|
2136
|
+
const excludeFlags = (config.excludeBrowserFlags || []).map(normalizeFlag);
|
|
2137
|
+
const appearanceOptedOut = isFlagExcluded('--force-dark-mode', excludeFlags);
|
|
2138
|
+
const existingFlags = Array.isArray(config.browserFlags) ? config.browserFlags.map(normalizeFlag) : [];
|
|
2139
|
+
const nextFlags = [
|
|
2140
|
+
...existingFlags
|
|
2141
|
+
];
|
|
2142
|
+
if (!appearanceOptedOut) {
|
|
2143
|
+
for (const flag of defaults.browserFlags || [])if (!isFlagExcluded(flag, excludeFlags)) {
|
|
2144
|
+
if (!nextFlags.some((existing)=>existing === flag)) {
|
|
2145
|
+
if (flag.startsWith('--enable-features=')) {
|
|
2146
|
+
const feature = flag.slice(18);
|
|
2147
|
+
if (hasFeature(nextFlags, '--disable-features', feature)) continue;
|
|
2148
|
+
const enableIndex = nextFlags.findIndex((existing)=>existing.startsWith('--enable-features='));
|
|
2149
|
+
if (enableIndex >= 0) {
|
|
2150
|
+
if (!hasFeature(nextFlags, '--enable-features', feature)) nextFlags[enableIndex] = `${nextFlags[enableIndex]},${feature}`;
|
|
2151
|
+
continue;
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
nextFlags.push(flag);
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
const userPreferences = config.preferences || {};
|
|
2159
|
+
const nextPreferences = {
|
|
2160
|
+
...userPreferences,
|
|
2161
|
+
...Object.fromEntries(Object.entries(defaults.preferences || {}).filter(([key])=>!(key in userPreferences) && !appearanceOptedOut))
|
|
2162
|
+
};
|
|
2163
|
+
return {
|
|
2164
|
+
...config,
|
|
2165
|
+
browserFlags: nextFlags,
|
|
2166
|
+
preferences: nextPreferences
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2076
2169
|
const cjsRequire = createRequire(import.meta.url);
|
|
2077
2170
|
function messages_getLoggingPrefix(type) {
|
|
2078
2171
|
return messaging_prefix(type);
|
|
@@ -2194,46 +2287,6 @@ function noEntrypointsDetected(port) {
|
|
|
2194
2287
|
function spacerLine() {
|
|
2195
2288
|
return ' ';
|
|
2196
2289
|
}
|
|
2197
|
-
function getDarkModeDefaults(browser) {
|
|
2198
|
-
if (isChromiumBasedBrowser(String(browser))) return {
|
|
2199
|
-
browserFlags: [
|
|
2200
|
-
'--force-dark-mode',
|
|
2201
|
-
'--enable-features=WebUIDarkMode'
|
|
2202
|
-
],
|
|
2203
|
-
preferences: {}
|
|
2204
|
-
};
|
|
2205
|
-
if (isGeckoBasedBrowser(String(browser))) return {
|
|
2206
|
-
browserFlags: [],
|
|
2207
|
-
preferences: {
|
|
2208
|
-
'ui.systemUsesDarkTheme': 1,
|
|
2209
|
-
'layout.css.prefers-color-scheme.content-override': 2,
|
|
2210
|
-
'devtools.theme': 'dark'
|
|
2211
|
-
}
|
|
2212
|
-
};
|
|
2213
|
-
return {
|
|
2214
|
-
browserFlags: [],
|
|
2215
|
-
preferences: {}
|
|
2216
|
-
};
|
|
2217
|
-
}
|
|
2218
|
-
function withDarkMode(config) {
|
|
2219
|
-
const defaults = getDarkModeDefaults(config.browser);
|
|
2220
|
-
const existingFlags = Array.isArray(config.browserFlags) ? [
|
|
2221
|
-
...config.browserFlags
|
|
2222
|
-
] : [];
|
|
2223
|
-
const nextFlags = [
|
|
2224
|
-
...existingFlags
|
|
2225
|
-
];
|
|
2226
|
-
for (const flag of defaults.browserFlags || [])if (!nextFlags.some((f)=>String(f).trim() === flag)) nextFlags.push(flag);
|
|
2227
|
-
const nextPreferences = {
|
|
2228
|
-
...config.preferences || {},
|
|
2229
|
-
...Object.fromEntries(Object.entries(defaults.preferences || {}).filter(([k])=>!(k in (config.preferences || {}))))
|
|
2230
|
-
};
|
|
2231
|
-
return {
|
|
2232
|
-
...config,
|
|
2233
|
-
browserFlags: nextFlags,
|
|
2234
|
-
preferences: nextPreferences
|
|
2235
|
-
};
|
|
2236
|
-
}
|
|
2237
2290
|
function hasNewTabOverride(extensionDir) {
|
|
2238
2291
|
const manifestPath = __rspack_external_node_path_c5b9b54f.join(extensionDir, 'manifest.json');
|
|
2239
2292
|
if (!__rspack_external_node_fs_5ea92f0c.existsSync(manifestPath)) return false;
|
|
@@ -2346,7 +2399,7 @@ function resolveCompanionExtensionDirs(opts) {
|
|
|
2346
2399
|
}
|
|
2347
2400
|
};
|
|
2348
2401
|
scanOneLevel(absScan);
|
|
2349
|
-
|
|
2402
|
+
for (const ent of entries){
|
|
2350
2403
|
if (!ent.isDirectory()) continue;
|
|
2351
2404
|
if (ent.name.startsWith('.')) continue;
|
|
2352
2405
|
const browserDir = __rspack_external_node_path_c5b9b54f.join(absScan, ent.name);
|
|
@@ -2362,6 +2415,14 @@ function resolveCompanionExtensionDirs(opts) {
|
|
|
2362
2415
|
}
|
|
2363
2416
|
return unique;
|
|
2364
2417
|
}
|
|
2418
|
+
function readRunIdFromReadyFile(readyPath) {
|
|
2419
|
+
try {
|
|
2420
|
+
const parsed = JSON.parse(__rspack_external_node_fs_5ea92f0c.readFileSync(readyPath, 'utf-8'));
|
|
2421
|
+
return 'string' == typeof parsed?.runId ? parsed.runId : void 0;
|
|
2422
|
+
} catch {
|
|
2423
|
+
return;
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2365
2426
|
async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher) {
|
|
2366
2427
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
2367
2428
|
const debug = isDebug();
|
|
@@ -2381,11 +2442,12 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
|
|
|
2381
2442
|
manifestPath: projectStructure.manifestPath,
|
|
2382
2443
|
port: 'number' == typeof previewOptions.port ? previewOptions.port : 'string' == typeof previewOptions.port ? parseInt(previewOptions.port, 10) : null
|
|
2383
2444
|
});
|
|
2384
|
-
metadata.
|
|
2445
|
+
const continuingStartRun = 'start' === metadataCommand && readRunIdFromReadyFile(metadata.readyPath) === getSessionRunId(packageJsonDir, String(browser));
|
|
2446
|
+
if (!continuingStartRun) metadata.writeStarting();
|
|
2385
2447
|
if (debug) {
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2448
|
+
humanLine(debugDirs(manifestDir, packageJsonDir));
|
|
2449
|
+
humanLine(debugBrowser(browser, previewOptions.chromiumBinary, previewOptions.geckoBinary || previewOptions.firefoxBinary));
|
|
2450
|
+
humanLine(debugPreviewOutput(outputPath, distPath));
|
|
2389
2451
|
}
|
|
2390
2452
|
const manifestAtOutput = __rspack_external_node_path_c5b9b54f.join(outputPath, 'manifest.json');
|
|
2391
2453
|
if (!__rspack_external_node_fs_5ea92f0c.existsSync(manifestAtOutput)) {
|
|
@@ -2396,19 +2458,19 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
|
|
|
2396
2458
|
const browserConfig = await loadBrowserConfig(packageJsonDir, browser);
|
|
2397
2459
|
if (previewOptions.noBrowser) {
|
|
2398
2460
|
const browserLabel = String(browser || 'unknown');
|
|
2399
|
-
|
|
2400
|
-
|
|
2461
|
+
humanLine(spacerLine());
|
|
2462
|
+
humanLine(browserRunnerDisabled({
|
|
2401
2463
|
browser: browserLabel,
|
|
2402
2464
|
manifestPath: projectStructure.manifestPath,
|
|
2403
2465
|
readyPath: metadata.readyPath,
|
|
2404
2466
|
distPath: outputPath
|
|
2405
2467
|
}));
|
|
2406
|
-
|
|
2407
|
-
|
|
2468
|
+
humanLine(spacerLine());
|
|
2469
|
+
humanLine(runningMessage(browser, true));
|
|
2408
2470
|
metadata.writeReady();
|
|
2409
2471
|
return;
|
|
2410
2472
|
}
|
|
2411
|
-
|
|
2473
|
+
humanLine(runningMessage(browser));
|
|
2412
2474
|
const safeBrowserConfig = sanitize(browserConfig);
|
|
2413
2475
|
const safeCommandConfig = sanitize(commandConfig);
|
|
2414
2476
|
const safePreviewOptions = sanitize(previewOptions);
|
|
@@ -2430,7 +2492,8 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
|
|
|
2430
2492
|
const darkDefaults = withDarkMode({
|
|
2431
2493
|
browser,
|
|
2432
2494
|
browserFlags: merged.browserFlags,
|
|
2433
|
-
preferences: merged.preferences
|
|
2495
|
+
preferences: merged.preferences,
|
|
2496
|
+
excludeBrowserFlags: merged.excludeBrowserFlags
|
|
2434
2497
|
});
|
|
2435
2498
|
const companionUnpackedExtensionDirs = resolveCompanionExtensionDirs({
|
|
2436
2499
|
projectRoot: packageJsonDir,
|
|
@@ -2468,4 +2531,4 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
|
|
|
2468
2531
|
await browserLauncher(resolvedOpts);
|
|
2469
2532
|
metadata.writeReady();
|
|
2470
2533
|
}
|
|
2471
|
-
export { BUILD_COMMAND_DEFAULTS, CHROMIUM_FAMILY_ALIASES, DEV_COMMAND_DEFAULTS, GECKO_FAMILY_ALIASES, PlaywrightPlugin, START_BUILD_DEFAULTS, asAbsolute, assertNoManagedDependencyConflicts, authorInstallNotice, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserLaunchFailed, browserRunnerDisabled, buildAssetsTree, buildCommandFailed, buildComplete, buildFailed, buildShareHint, buildWarningsDetails, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, createPlaywrightMetadataWriter, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, devCommandFailed, devServerStartTimeout, downloadingText, extensionJsRunnerError, extensionLoadRecovered, extensionLoadStillRefused, extensionPreview, failedToDownloadOrExtractZIPFileError, getDirs, getDistPath, getProjectStructure, getSessionRunId, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, invalidRemoteZip, isChromiumBasedBrowser, isGeckoBasedBrowser, isWebkitBasedBrowser, loadBrowserConfig, loadCommandConfig, loadCustomConfig, localZipNotFound, manifestInvalidJson, mergeOptionLayers, messages_ready, needsInstall, noCompanionExtensionsResolved, noEntrypointsDetected, normalizeBrowser, notAZipArchive, package_namespaceObject, packagingDistributionFiles, packagingSourceFiles, portInUse, projectInstallFallbackToNpm, projectInstallScriptsDisabled, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, sanitize, shouldWarnPortConflict, spacerLine, stampReadyDistExtensionId, stampReadyKnownExtensionId, toPosixPath, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactReady };
|
|
2534
|
+
export { BUILD_COMMAND_DEFAULTS, CHROMIUM_FAMILY_ALIASES, DEV_COMMAND_DEFAULTS, GECKO_FAMILY_ALIASES, PlaywrightPlugin, START_BUILD_DEFAULTS, asAbsolute, assertNoManagedDependencyConflicts, authorInstallNotice, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserLaunchFailed, browserRunnerDisabled, buildAssetsTree, buildCommandFailed, buildComplete, buildFailed, buildShareHint, buildWarningsDetails, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, createPlaywrightMetadataWriter, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, devCommandFailed, devServerStartTimeout, downloadingText, extensionJsRunnerError, extensionLoadRecovered, extensionLoadStillRefused, extensionPreview, failedToDownloadOrExtractZIPFileError, getDirs, getDistPath, getProjectStructure, getSessionRunId, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, invalidRemoteZip, isChromiumBasedBrowser, isGeckoBasedBrowser, isWebkitBasedBrowser, loadBrowserConfig, loadCommandConfig, loadCustomConfig, localZipNotFound, manifestInvalidJson, mergeOptionLayers, messages_ready, needsInstall, noCompanionExtensionsResolved, noEntrypointsDetected, normalizeBrowser, notAZipArchive, package_namespaceObject, packagingDistributionFiles, packagingSourceFiles, portInUse, projectInstallFallbackToNpm, projectInstallScriptsDisabled, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, sanitize, shouldWarnPortConflict, spacerLine, stampReadyDistExtensionId, stampReadyKnownExtensionId, toPosixPath, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, withDarkMode, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactReady };
|
package/dist/349.mjs
CHANGED
|
@@ -29,6 +29,10 @@ const MACHINE_OUTPUT_VALUES = new Set([
|
|
|
29
29
|
function isMachineOutput() {
|
|
30
30
|
return MACHINE_OUTPUT_VALUES.has(String(process.env.EXTENSION_OUTPUT || '').trim().toLowerCase());
|
|
31
31
|
}
|
|
32
|
+
function humanLine(...parts) {
|
|
33
|
+
if (isMachineOutput()) return;
|
|
34
|
+
console.log(...parts);
|
|
35
|
+
}
|
|
32
36
|
function humanWarn(...parts) {
|
|
33
37
|
if (isMachineOutput()) return;
|
|
34
38
|
console.warn(...parts);
|
|
@@ -267,4 +271,4 @@ const ENVELOPE = {
|
|
|
267
271
|
}, extras);
|
|
268
272
|
}
|
|
269
273
|
};
|
|
270
|
-
export { CODES, ENVELOPE, artifactNoun, browserRowValue, card, claimCardKey, fmt, humanWarn, isDebug, isMachineOutput, prefix };
|
|
274
|
+
export { CODES, ENVELOPE, artifactNoun, browserRowValue, card, claimCardKey, fmt, humanLine, humanWarn, isDebug, isMachineOutput, prefix };
|