extension 4.0.16 → 4.0.17
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/49.cjs +13 -26
- package/dist/browsers.cjs +306 -171
- package/dist/cli.cjs +2340 -1368
- package/dist/extension/browsers/browsers-lib/banner.d.ts +0 -2
- package/dist/extension/browsers/browsers-lib/messages.d.ts +0 -4
- package/dist/extension/browsers/browsers-lib/ready-stamp.d.ts +7 -0
- package/dist/extension/browsers/browsers-lib/shared-utils.d.ts +9 -0
- package/dist/extension/commands/act.d.ts +18 -0
- package/dist/extension/commands/build.d.ts +1 -1
- package/dist/extension/commands/create.d.ts +5 -0
- package/dist/extension/commands/dev-wait.d.ts +13 -0
- package/dist/extension/commands/dev.d.ts +1 -1
- package/dist/extension/commands/preview.d.ts +2 -1
- package/dist/extension/commands/start.d.ts +1 -1
- package/dist/extension/helpers/messages.d.ts +191 -28
- package/dist/extension/helpers/messaging.d.ts +180 -0
- package/dist/extension/helpers/output-flag.d.ts +7 -0
- package/dist/extension/helpers/vendors.d.ts +1 -1
- package/package.json +4 -4
- package/types/index.d.ts +1 -0
package/dist/browsers.cjs
CHANGED
|
@@ -7,14 +7,9 @@ var __webpack_modules__ = {
|
|
|
7
7
|
var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
8
8
|
var node_fs__rspack_import_1 = __webpack_require__("node:fs");
|
|
9
9
|
var node_path__rspack_import_2 = __webpack_require__("node:path");
|
|
10
|
-
var
|
|
11
|
-
var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
|
|
10
|
+
var _helpers_messaging__rspack_import_3 = __webpack_require__("./helpers/messaging.ts");
|
|
12
11
|
var _browser_family__rspack_import_4 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
|
|
13
12
|
var _messages__rspack_import_5 = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
14
|
-
const BANNER_PRINTED_EVENT = 'extensionjs:banner-printed';
|
|
15
|
-
function markBannerPrinted() {
|
|
16
|
-
process.emit(BANNER_PRINTED_EVENT);
|
|
17
|
-
}
|
|
18
13
|
const printedKeys = new Set();
|
|
19
14
|
function readUpdateSuffixOnce() {
|
|
20
15
|
const suffix = process.env.EXTENSION_CLI_UPDATE_SUFFIX;
|
|
@@ -27,6 +22,14 @@ var __webpack_modules__ = {
|
|
|
27
22
|
const port = hp?.port == null ? '' : String(hp.port);
|
|
28
23
|
return `${browser}::${node_path__rspack_import_2.resolve(outPath)}::${host}:${port}`;
|
|
29
24
|
}
|
|
25
|
+
function baseKeyFor(browser, outPath) {
|
|
26
|
+
return `${browser}::${node_path__rspack_import_2.resolve(outPath)}`;
|
|
27
|
+
}
|
|
28
|
+
function markCardPrinted(k, browser, outPath) {
|
|
29
|
+
process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
|
|
30
|
+
printedKeys.add(k);
|
|
31
|
+
(0, _helpers_messaging__rspack_import_3.od)(baseKeyFor(browser, outPath));
|
|
32
|
+
}
|
|
30
33
|
function toNormalizedId(value) {
|
|
31
34
|
if ('string' != typeof value) return '';
|
|
32
35
|
return value.trim();
|
|
@@ -107,7 +110,7 @@ var __webpack_modules__ = {
|
|
|
107
110
|
}
|
|
108
111
|
async function printDevBannerOnce(opts) {
|
|
109
112
|
const k = keyFor(opts.browser, opts.outPath, opts.hostPort);
|
|
110
|
-
|
|
113
|
+
const alreadyPrinted = printedKeys.has(k) || (0, _helpers_messaging__rspack_import_3.VR)(baseKeyFor(opts.browser, opts.outPath));
|
|
111
114
|
const manifestPath = node_path__rspack_import_2.join(opts.outPath, 'manifest.json');
|
|
112
115
|
if (!node_fs__rspack_import_1.existsSync(manifestPath)) return false;
|
|
113
116
|
const manifest = JSON.parse(node_fs__rspack_import_1.readFileSync(manifestPath, 'utf-8'));
|
|
@@ -118,6 +121,7 @@ var __webpack_modules__ = {
|
|
|
118
121
|
manifest,
|
|
119
122
|
extensionPath: opts.outPath
|
|
120
123
|
});
|
|
124
|
+
if (alreadyPrinted && manifestDerivedExtensionId) return true;
|
|
121
125
|
const info = manifestDerivedExtensionId ? await Promise.race([
|
|
122
126
|
opts.getInfo().catch(()=>null),
|
|
123
127
|
new Promise((resolve)=>setTimeout(()=>resolve(null), 250))
|
|
@@ -130,6 +134,7 @@ var __webpack_modules__ = {
|
|
|
130
134
|
extensionPath: opts.outPath
|
|
131
135
|
});
|
|
132
136
|
if (!extensionId) return false;
|
|
137
|
+
if (alreadyPrinted) return true;
|
|
133
138
|
const name = info?.name || opts.fallback?.name || manifest.name;
|
|
134
139
|
const version = info?.version || opts.fallback?.version || manifest.version;
|
|
135
140
|
const message = {
|
|
@@ -145,14 +150,12 @@ var __webpack_modules__ = {
|
|
|
145
150
|
console.log(_messages__rspack_import_5.io());
|
|
146
151
|
console.log(_messages__rspack_import_5.e_(manifest, opts.browser, message, opts.browserVersionLine, updateSuffix || void 0));
|
|
147
152
|
console.log(_messages__rspack_import_5.io());
|
|
148
|
-
|
|
149
|
-
process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
|
|
150
|
-
printedKeys.add(k);
|
|
153
|
+
markCardPrinted(k, opts.browser, opts.outPath);
|
|
151
154
|
return true;
|
|
152
155
|
}
|
|
153
156
|
async function printProdBannerOnce(opts) {
|
|
154
157
|
const k = keyFor(opts.browser, opts.outPath);
|
|
155
|
-
if (printedKeys.has(k)) return
|
|
158
|
+
if (printedKeys.has(k) || (0, _helpers_messaging__rspack_import_3.VR)(baseKeyFor(opts.browser, opts.outPath))) return true;
|
|
156
159
|
const browserLabel = opts.browserVersionLine && opts.browserVersionLine.trim().length > 0 ? opts.browserVersionLine.trim() : String(opts.browser || 'unknown');
|
|
157
160
|
try {
|
|
158
161
|
const manifestPath = node_path__rspack_import_2.join(opts.outPath, 'manifest.json');
|
|
@@ -207,12 +210,21 @@ var __webpack_modules__ = {
|
|
|
207
210
|
}
|
|
208
211
|
} catch {
|
|
209
212
|
console.log(_messages__rspack_import_5.io());
|
|
210
|
-
console.log(
|
|
213
|
+
console.log((0, _helpers_messaging__rspack_import_3.Nr)({
|
|
214
|
+
rows: [
|
|
215
|
+
{
|
|
216
|
+
label: 'Browser',
|
|
217
|
+
value: browserLabel
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: 'Output',
|
|
221
|
+
value: opts.outPath
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}));
|
|
211
225
|
console.log(_messages__rspack_import_5.io());
|
|
212
226
|
}
|
|
213
|
-
|
|
214
|
-
process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
|
|
215
|
-
printedKeys.add(k);
|
|
227
|
+
markCardPrinted(k, opts.browser, opts.outPath);
|
|
216
228
|
return true;
|
|
217
229
|
}
|
|
218
230
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -335,20 +347,13 @@ var __webpack_modules__ = {
|
|
|
335
347
|
var firefox_location2__rspack_import_7_default = /*#__PURE__*/ __webpack_require__.n(firefox_location2__rspack_import_7);
|
|
336
348
|
var pintor__rspack_import_8 = __webpack_require__("pintor");
|
|
337
349
|
var pintor__rspack_import_8_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_8);
|
|
350
|
+
var _helpers_messaging__rspack_import_9 = __webpack_require__("./helpers/messaging.ts");
|
|
338
351
|
const require1 = (0, node_module__rspack_import_1.createRequire)(__rslib_import_meta_url__);
|
|
339
352
|
function getLoggingPrefix(type) {
|
|
340
|
-
|
|
341
|
-
if (isAuthor) {
|
|
342
|
-
const base = 'error' === type ? 'ERROR Author says' : '⏵⏵⏵ Author says';
|
|
343
|
-
return pintor__rspack_import_8_default().brightMagenta(base);
|
|
344
|
-
}
|
|
345
|
-
if ('error' === type) return pintor__rspack_import_8_default().red('ERROR');
|
|
346
|
-
if ('warn' === type) return pintor__rspack_import_8_default().brightYellow('⏵⏵⏵');
|
|
347
|
-
if ('info' === type) return pintor__rspack_import_8_default().gray('⏵⏵⏵');
|
|
348
|
-
return pintor__rspack_import_8_default().green('⏵⏵⏵');
|
|
353
|
+
return (0, _helpers_messaging__rspack_import_9.Pl)(type);
|
|
349
354
|
}
|
|
350
355
|
function errorDetail(error) {
|
|
351
|
-
if (
|
|
356
|
+
if ((0, _helpers_messaging__rspack_import_9._o)()) return String(error);
|
|
352
357
|
const maybe = error?.message;
|
|
353
358
|
return String(maybe || error);
|
|
354
359
|
}
|
|
@@ -421,34 +426,22 @@ var __webpack_modules__ = {
|
|
|
421
426
|
return `${browser.charAt(0).toUpperCase() + browser.slice(1)}`;
|
|
422
427
|
}
|
|
423
428
|
function creatingUserProfile(profilePath) {
|
|
424
|
-
return `${getLoggingPrefix('
|
|
429
|
+
return `${getLoggingPrefix('debug')} browser profile=fresh path=${profilePath}`;
|
|
425
430
|
}
|
|
426
431
|
function browserInstanceExited(browser) {
|
|
427
432
|
return `${getLoggingPrefix('info')} ${capitalizedBrowserName(browser)} instance exited.`;
|
|
428
433
|
}
|
|
429
434
|
function cdpClientAttachedToTarget(sessionId, targetType) {
|
|
430
|
-
return `${getLoggingPrefix('
|
|
431
|
-
}
|
|
432
|
-
function cdpPendingRejectFailed(message) {
|
|
433
|
-
return `[CDP] Pending request reject failed: ${message}`;
|
|
434
|
-
}
|
|
435
|
-
function cdpFailedToHandleMessage(message) {
|
|
436
|
-
return `[CDP] Failed to handle message: ${message}`;
|
|
437
|
-
}
|
|
438
|
-
function cdpAutoAttachSetupFailed(message) {
|
|
439
|
-
return `[CDP] Failed to set discover/autoAttach: ${message}`;
|
|
440
|
-
}
|
|
441
|
-
function cdpProtocolEventHandlerError(message) {
|
|
442
|
-
return `[CDP] Protocol event handler error: ${message}`;
|
|
435
|
+
return `${getLoggingPrefix('debug')} cdp attached type=${targetType} session=${sessionId}`;
|
|
443
436
|
}
|
|
444
437
|
function bestEffortBannerPrintFailed(message) {
|
|
445
|
-
return
|
|
438
|
+
return `${getLoggingPrefix('debug')} browser banner=failed reason="${message}"`;
|
|
446
439
|
}
|
|
447
440
|
function skippingBrowserLaunchDueToCompileErrors() {
|
|
448
|
-
return `${getLoggingPrefix('warn')}
|
|
441
|
+
return `${getLoggingPrefix('warn')} Skip the browser launch due to compile errors.`;
|
|
449
442
|
}
|
|
450
443
|
function browserNotInstalledError(browser, browserBinaryLocation) {
|
|
451
|
-
const isUnreachable = 'null' === browserBinaryLocation ? `Browser ${capitalizedBrowserName(browser)} is not installed
|
|
444
|
+
const isUnreachable = 'null' === browserBinaryLocation ? `Browser ${capitalizedBrowserName(browser)} is not installed.\n` : `Can't find the path for browser ${capitalizedBrowserName(browser)}.\n`;
|
|
452
445
|
const wslHint = (()=>{
|
|
453
446
|
if (!isWsl()) return '';
|
|
454
447
|
const example = '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe';
|
|
@@ -457,14 +450,14 @@ var __webpack_modules__ = {
|
|
|
457
450
|
return `${getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${pintor__rspack_import_8_default().blue('--browser')} ${pintor__rspack_import_8_default().gray('<chrome|edge|firefox>')}.\n\n${pintor__rspack_import_8_default().red('NOT FOUND')} ${pintor__rspack_import_8_default().underline(browserBinaryLocation || `${capitalizedBrowserName(browser)}BROWSER`)}` + wslHint;
|
|
458
451
|
}
|
|
459
452
|
function usingManagedChromiumFamilyFallback(requestedBrowser, fallbackBrowser, binaryPath) {
|
|
460
|
-
return `${getLoggingPrefix('info')} ${managedBrowserDisplayName(requestedBrowser)} is not installed
|
|
453
|
+
return `${getLoggingPrefix('info')} ${managedBrowserDisplayName(requestedBrowser)} is not installed, so the managed ${managedBrowserDisplayName(fallbackBrowser)} runs instead.\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(binaryPath)}\nRun ${pintor__rspack_import_8_default().blue(`npx extension install ${requestedBrowser}`)} to use ${managedBrowserDisplayName(requestedBrowser)} itself.`;
|
|
461
454
|
}
|
|
462
455
|
function resolvedBrowserBinary(browser, binaryPath, versionLine) {
|
|
463
456
|
const version = versionLine && versionLine.trim().length > 0 ? versionLine.trim() : capitalizedBrowserName(browser);
|
|
464
|
-
return `${getLoggingPrefix('info')} Browser: ${version} ${pintor__rspack_import_8_default().gray('at')} ${pintor__rspack_import_8_default().underline(binaryPath)}
|
|
457
|
+
return `${getLoggingPrefix('info')} Browser: ${version} ${pintor__rspack_import_8_default().gray('at')} ${pintor__rspack_import_8_default().underline(binaryPath)}.`;
|
|
465
458
|
}
|
|
466
459
|
function preferringSystemBrowserOverSnapshot(systemBinary, snapshotBinary) {
|
|
467
|
-
return `${getLoggingPrefix('info')}
|
|
460
|
+
return `${getLoggingPrefix('info')} Use the installed browser instead of the cached Chromium snapshot (a dev-channel build).\n${pintor__rspack_import_8_default().gray('USING')} ${pintor__rspack_import_8_default().underline(systemBinary)}\n${pintor__rspack_import_8_default().gray('CACHED')} ${pintor__rspack_import_8_default().underline(snapshotBinary)}\nSet ${pintor__rspack_import_8_default().blue('EXTENSION_PREFER_CHROMIUM_SNAPSHOT=true')} to use the cached snapshot.`;
|
|
468
461
|
}
|
|
469
462
|
function mv2NotSupportedByChromium(extensionPath) {
|
|
470
463
|
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('This extension declares Manifest V2, which modern Chromium refuses to load.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\nThe browser will reject it at launch (a native dialog, not a console error), so the dev session cannot attach.\nRun it on an MV2-capable browser (${pintor__rspack_import_8_default().blue('--browser firefox')}) or migrate the manifest to MV3.`;
|
|
@@ -479,28 +472,28 @@ var __webpack_modules__ = {
|
|
|
479
472
|
function chromiumInvalidMatchPatterns(extensionPath, patterns) {
|
|
480
473
|
const shown = patterns.slice(0, 6);
|
|
481
474
|
const more = patterns.length - shown.length;
|
|
482
|
-
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('This extension declares match patterns Chrome refuses, the whole extension will not load.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\n` + shown.map((pattern)=>`${pintor__rspack_import_8_default().gray('PATTERN')} ${pintor__rspack_import_8_default().red(pattern)}\n`).join('') + (more > 0 ? `${pintor__rspack_import_8_default().gray(`…and ${more} more`)}\n` : '') + `A match pattern's host wildcard must be ${pintor__rspack_import_8_default().blue('*')} or ${pintor__rspack_import_8_default().blue('*.domain.tld')}, ` +
|
|
475
|
+
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('This extension declares match patterns Chrome refuses, the whole extension will not load.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\n` + shown.map((pattern)=>`${pintor__rspack_import_8_default().gray('PATTERN')} ${pintor__rspack_import_8_default().red(pattern)}\n`).join('') + (more > 0 ? `${pintor__rspack_import_8_default().gray(`…and ${more} more`)}\n` : '') + `A match pattern's host wildcard must be ${pintor__rspack_import_8_default().blue('*')} or ${pintor__rspack_import_8_default().blue('*.domain.tld')}, ` + `a wildcard anywhere else in the host is invalid.\n` + `Replace the host with ${pintor__rspack_import_8_default().blue('*')} or ${pintor__rspack_import_8_default().blue('*.domain.tld')} in the source manifest.`;
|
|
483
476
|
}
|
|
484
477
|
function chromiumManifestLoadBlockers(extensionPath, blockers) {
|
|
485
|
-
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('This manifest declares shapes Chrome refuses, the whole extension will not load.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\n` + blockers.map((blocker)=>`${pintor__rspack_import_8_default().gray('REASON')} ${pintor__rspack_import_8_default().red(blocker)}\n`).join('') +
|
|
478
|
+
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('This manifest declares shapes Chrome refuses, the whole extension will not load.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\n` + blockers.map((blocker)=>`${pintor__rspack_import_8_default().gray('REASON')} ${pintor__rspack_import_8_default().red(blocker)}\n`).join('') + `Chrome rejects the extension at load, so no service worker or content script ever runs.\n` + "Fix these in the source manifest.";
|
|
486
479
|
}
|
|
487
480
|
function chromiumExtensionLoadRefused(extensionPath, reason) {
|
|
488
|
-
return `${getLoggingPrefix('error')} ${pintor__rspack_import_8_default().red('The browser refused to load this extension, so it is NOT running.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\n` + (reason ? `${pintor__rspack_import_8_default().gray('REASON')} ${pintor__rspack_import_8_default().red(reason)}\n` : '') +
|
|
481
|
+
return `${getLoggingPrefix('error')} ${pintor__rspack_import_8_default().red('The browser refused to load this extension, so it is NOT running.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(extensionPath)}\n` + (reason ? `${pintor__rspack_import_8_default().gray('REASON')} ${pintor__rspack_import_8_default().red(reason)}\n` : '') + `No service worker, content script, or page from this extension will run, and no Extension ID was assigned.\n` + `Fix the reason above and save.\n` + "If the browser does not pick it up, restart the dev session.";
|
|
489
482
|
}
|
|
490
483
|
function geckoAddonLoadRefused(addonPath, reason) {
|
|
491
|
-
return `${getLoggingPrefix('error')} ${pintor__rspack_import_8_default().red('The browser refused to load this add-on, so it is NOT running.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(addonPath)}\n` + (reason ? `${pintor__rspack_import_8_default().gray('REASON')} ${pintor__rspack_import_8_default().red(reason)}\n` : '') +
|
|
484
|
+
return `${getLoggingPrefix('error')} ${pintor__rspack_import_8_default().red('The browser refused to load this add-on, so it is NOT running.')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(addonPath)}\n` + (reason ? `${pintor__rspack_import_8_default().gray('REASON')} ${pintor__rspack_import_8_default().red(reason)}\n` : '') + `No background script, content script, or page from this add-on will run, and no Extension ID was assigned.\n` + `Fix the reason above and save.\n` + "If the browser does not pick it up, restart the dev session.";
|
|
492
485
|
}
|
|
493
486
|
function devChannelSnapshotInUse(binaryPath) {
|
|
494
|
-
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('
|
|
487
|
+
return `${getLoggingPrefix('warn')} ${pintor__rspack_import_8_default().brightYellow('This is a Chromium tip-of-tree snapshot (dev channel, not a stable release).')}\n${pintor__rspack_import_8_default().gray('PATH')} ${pintor__rspack_import_8_default().underline(binaryPath)}\nBehavior may differ from stable Chrome.\nInstall a stable browser or remove the snapshot to stop using it.`;
|
|
495
488
|
}
|
|
496
489
|
function browserLaunchError(browser, error) {
|
|
497
490
|
return `${getLoggingPrefix('error')} Error launching ${capitalizedBrowserName(browser)}:\n${pintor__rspack_import_8_default().red(errorDetail(error))}`;
|
|
498
491
|
}
|
|
499
492
|
function enhancedProcessManagementCleanup(browser) {
|
|
500
|
-
return `${getLoggingPrefix('
|
|
493
|
+
return `${getLoggingPrefix('debug')} proc cleanup browser=${browser}`;
|
|
501
494
|
}
|
|
502
495
|
function enhancedProcessManagementTerminating(browser) {
|
|
503
|
-
return `${getLoggingPrefix('
|
|
496
|
+
return `${getLoggingPrefix('debug')} proc terminate browser=${browser} mode=graceful`;
|
|
504
497
|
}
|
|
505
498
|
function enhancedProcessManagementForceKill(browser) {
|
|
506
499
|
return `${getLoggingPrefix('warn')} ${capitalizedBrowserName(browser)} did not exit gracefully, forcing the process to close.\nThis is a normal cleanup step and does not affect your build output.`;
|
|
@@ -522,7 +515,7 @@ var __webpack_modules__ = {
|
|
|
522
515
|
return `${getLoggingPrefix('error')} Unable to connect to ${capitalizedBrowserName(browser)}${where} after several retries.\nAnother browser instance is usually still holding that debugging port, often one left over from an earlier dev session.\nClose ${capitalizedBrowserName(browser)} windows opened by Extension.js and run the command again, or pass ${pintor__rspack_import_8_default().blue('--profile')} ${pintor__rspack_import_8_default().gray('<path>')} to launch against a separate profile.`;
|
|
523
516
|
}
|
|
524
517
|
function waitingForBrowserDebugger(browser, port, attempt, maxRetries) {
|
|
525
|
-
return `${getLoggingPrefix('info')}
|
|
518
|
+
return `${getLoggingPrefix('info')} Wait for the ${capitalizedBrowserName(browser)} debugger server on port ${port} (attempt ${attempt}/${maxRetries}).`;
|
|
526
519
|
}
|
|
527
520
|
function addonInstallError(browser, message) {
|
|
528
521
|
return `${getLoggingPrefix('error')} Can't install add-on into ${capitalizedBrowserName(browser)}:\n${pintor__rspack_import_8_default().red(message)}`;
|
|
@@ -531,10 +524,10 @@ var __webpack_modules__ = {
|
|
|
531
524
|
return `${getLoggingPrefix('error')} The ${capitalizedBrowserName(browser)} messaging channel closed unexpectedly.\nThe browser exited, or its debugging connection was dropped while the dev session was still running.\nCheck whether the browser window was closed by hand, then run the command again.`;
|
|
532
525
|
}
|
|
533
526
|
function connectionClosedError(browser) {
|
|
534
|
-
return `${getLoggingPrefix('error')} The debugging connection to ${capitalizedBrowserName(browser)} closed unexpectedly.\nReload and HMR need that connection, so the dev session cannot keep the extension up to date.\nRestart the dev session
|
|
527
|
+
return `${getLoggingPrefix('error')} The debugging connection to ${capitalizedBrowserName(browser)} closed unexpectedly.\nReload and HMR need that connection, so the dev session cannot keep the extension up to date.\nRestart the dev session.\nIf it keeps happening, launch with ${pintor__rspack_import_8_default().blue('--profile')} ${pintor__rspack_import_8_default().gray('<path>')} to rule out a corrupted browser profile.`;
|
|
535
528
|
}
|
|
536
529
|
function targetActorHasActiveRequestError(browser, targetActor) {
|
|
537
|
-
return `${getLoggingPrefix('error')} Target actor ${pintor__rspack_import_8_default().gray(targetActor)} has active request for ${capitalizedBrowserName(browser)}
|
|
530
|
+
return `${getLoggingPrefix('error')} Target actor ${pintor__rspack_import_8_default().gray(targetActor)} has an active request for ${capitalizedBrowserName(browser)}.`;
|
|
538
531
|
}
|
|
539
532
|
function parsingPacketError(browser, error) {
|
|
540
533
|
return `${getLoggingPrefix('error')} Failed to parse packet from ${capitalizedBrowserName(browser)}:\n${pintor__rspack_import_8_default().red(errorDetail(error))}`;
|
|
@@ -543,7 +536,7 @@ var __webpack_modules__ = {
|
|
|
543
536
|
return `${getLoggingPrefix('error')} Message without sender from ${capitalizedBrowserName(browser)}:\n${pintor__rspack_import_8_default().red(JSON.stringify(message))}`;
|
|
544
537
|
}
|
|
545
538
|
function chromeProcessExited(code) {
|
|
546
|
-
return `${getLoggingPrefix('
|
|
539
|
+
return `${getLoggingPrefix('debug')} proc exit browser=chrome code=${code}`;
|
|
547
540
|
}
|
|
548
541
|
function chromeProcessError(error) {
|
|
549
542
|
return `${getLoggingPrefix('error')} Chrome process error:\n${pintor__rspack_import_8_default().red(errorDetail(error))}`;
|
|
@@ -552,22 +545,22 @@ var __webpack_modules__ = {
|
|
|
552
545
|
return `${getLoggingPrefix('error')} Failed to spawn Chrome:\n${pintor__rspack_import_8_default().red(errorDetail(error))}`;
|
|
553
546
|
}
|
|
554
547
|
function chromeInitializingEnhancedReload() {
|
|
555
|
-
return `${getLoggingPrefix('
|
|
548
|
+
return `${getLoggingPrefix('debug')} proc enhancedReload=init spawn=direct browser=chrome`;
|
|
556
549
|
}
|
|
557
550
|
function locatingBrowser(browser) {
|
|
558
|
-
return `${getLoggingPrefix('
|
|
551
|
+
return `${getLoggingPrefix('debug')} browser locate browser=${browser}`;
|
|
559
552
|
}
|
|
560
553
|
function devChromeProfilePath(path) {
|
|
561
554
|
return `${getLoggingPrefix('info')} Chrome profile: ${pintor__rspack_import_8_default().underline(path)}`;
|
|
562
555
|
}
|
|
563
556
|
function chromiumDryRunNotLaunching() {
|
|
564
|
-
return `${getLoggingPrefix('info')}
|
|
557
|
+
return `${getLoggingPrefix('info')} Dry run: skip the browser launch.`;
|
|
565
558
|
}
|
|
566
559
|
function chromiumDryRunBinary(path) {
|
|
567
|
-
return `${getLoggingPrefix('info')}
|
|
560
|
+
return `${getLoggingPrefix('info')} Binary: ${pintor__rspack_import_8_default().underline(path)}.`;
|
|
568
561
|
}
|
|
569
562
|
function chromiumDryRunFlags(flags) {
|
|
570
|
-
return `${getLoggingPrefix('info')}
|
|
563
|
+
return `${getLoggingPrefix('info')} Flags: ${pintor__rspack_import_8_default().gray(flags)}.`;
|
|
571
564
|
}
|
|
572
565
|
function prettyPuppeteerInstallGuidance(browser, rawGuidance, cacheDir) {
|
|
573
566
|
const dim = pintor__rspack_import_8_default().gray;
|
|
@@ -600,49 +593,49 @@ var __webpack_modules__ = {
|
|
|
600
593
|
return `${body.join('\n')}\n`;
|
|
601
594
|
}
|
|
602
595
|
function firefoxLaunchCalled() {
|
|
603
|
-
return `${getLoggingPrefix('
|
|
596
|
+
return `${getLoggingPrefix('debug')} browser launch browser=firefox`;
|
|
604
597
|
}
|
|
605
598
|
function firefoxBinaryArgsExtracted(args) {
|
|
606
|
-
return `${getLoggingPrefix('
|
|
599
|
+
return `${getLoggingPrefix('debug')} browser args="${args}"`;
|
|
607
600
|
}
|
|
608
601
|
function firefoxNoBinaryArgsFound() {
|
|
609
|
-
return `${getLoggingPrefix('
|
|
602
|
+
return `${getLoggingPrefix('debug')} browser args=none`;
|
|
610
603
|
}
|
|
611
604
|
function firefoxFailedToStart(error) {
|
|
612
605
|
return `${getLoggingPrefix('error')} Firefox failed to start:\n${pintor__rspack_import_8_default().red(errorDetail(error))}`;
|
|
613
606
|
}
|
|
614
607
|
function firefoxDryRunNotLaunching() {
|
|
615
|
-
return `${getLoggingPrefix('info')}
|
|
608
|
+
return `${getLoggingPrefix('info')} Dry run: skip the browser launch.`;
|
|
616
609
|
}
|
|
617
610
|
function firefoxDryRunBinary(path) {
|
|
618
|
-
return `${getLoggingPrefix('info')}
|
|
611
|
+
return `${getLoggingPrefix('info')} Binary (detected): ${pintor__rspack_import_8_default().underline(path)}.`;
|
|
619
612
|
}
|
|
620
613
|
function firefoxDryRunConfig(cfg) {
|
|
621
|
-
return `${getLoggingPrefix('info')}
|
|
614
|
+
return `${getLoggingPrefix('info')} Config: ${pintor__rspack_import_8_default().gray(cfg)}.`;
|
|
622
615
|
}
|
|
623
616
|
function cdpClientFoundTargets(count) {
|
|
624
|
-
return `${getLoggingPrefix('
|
|
617
|
+
return `${getLoggingPrefix('debug')} cdp targets=${count}`;
|
|
625
618
|
}
|
|
626
619
|
function cdpClientTargetWebSocketUrlStored() {
|
|
627
|
-
return `${getLoggingPrefix('
|
|
620
|
+
return `${getLoggingPrefix('debug')} cdp targetWsUrl=stored`;
|
|
628
621
|
}
|
|
629
622
|
function cdpClientConnected(host, port) {
|
|
630
|
-
return `${getLoggingPrefix('
|
|
623
|
+
return `${getLoggingPrefix('debug')} cdp connected host=${host} port=${port}`;
|
|
631
624
|
}
|
|
632
625
|
function cdpClientConnectionError(error) {
|
|
633
626
|
return `${getLoggingPrefix('error')} Chrome CDP Client connection error: ${pintor__rspack_import_8_default().red(error)}`;
|
|
634
627
|
}
|
|
635
628
|
function cdpClientBrowserConnectionEstablished() {
|
|
636
|
-
return `${getLoggingPrefix('
|
|
629
|
+
return `${getLoggingPrefix('debug')} cdp browserConnection=established`;
|
|
637
630
|
}
|
|
638
631
|
function cdpClientConnectionClosed() {
|
|
639
|
-
return `${getLoggingPrefix('
|
|
632
|
+
return `${getLoggingPrefix('debug')} cdp connection=closed`;
|
|
640
633
|
}
|
|
641
634
|
function cdpClientExtensionInfoFailed(extensionId, error) {
|
|
642
635
|
return `${getLoggingPrefix('error')} Chrome CDP Client: Failed to get extension info for ${pintor__rspack_import_8_default().gray(extensionId)}: ${pintor__rspack_import_8_default().red(error)}`;
|
|
643
636
|
}
|
|
644
637
|
function firefoxRdpClientConnected(host, port) {
|
|
645
|
-
return `${getLoggingPrefix('
|
|
638
|
+
return `${getLoggingPrefix('debug')} rdp connected host=${host} port=${port}`;
|
|
646
639
|
}
|
|
647
640
|
function runningInDevelopment(manifest, browser, message, browserVersionLine, updateSuffix, opts) {
|
|
648
641
|
const capitalize = (str)=>str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -662,10 +655,10 @@ var __webpack_modules__ = {
|
|
|
662
655
|
default:
|
|
663
656
|
browserDevToolsUrl = '';
|
|
664
657
|
}
|
|
665
|
-
if (!message.data) return `${getLoggingPrefix('error')} No Client Data Received for ${manifestName}\n\n${pintor__rspack_import_8_default().red("This error happens when the program can't get the data from your extension.")}\n${pintor__rspack_import_8_default().red('There are many reasons this might happen.
|
|
658
|
+
if (!message.data) return `${getLoggingPrefix('error')} No Client Data Received for ${manifestName}\n\n${pintor__rspack_import_8_default().red("This error happens when the program can't get the data from your extension.")}\n${pintor__rspack_import_8_default().red('There are many reasons this might happen.')}\n${pintor__rspack_import_8_default().red('To fix, ensure that:')}\n\n- Your extension is set as enabled in ${pintor__rspack_import_8_default().underline(browserDevToolsUrl)}\n- No previous ${capitalize(browser)} browser instance is open\n\nIf that is not the case, restart both the ${pintor__rspack_import_8_default().yellow(manifest.name || '')} and the\n${pintor__rspack_import_8_default().yellow('Manager Extension')} in ${pintor__rspack_import_8_default().underline(browserDevToolsUrl)} and try again.\nIf the issue still persists, please report a bug:\n` + pintor__rspack_import_8_default().underline("https://github.com/extension-js/extension.js/issues");
|
|
666
659
|
const { id = '', management } = message.data;
|
|
667
660
|
if (!management) {
|
|
668
|
-
if (
|
|
661
|
+
if ((0, _helpers_messaging__rspack_import_9._o)()) return `${getLoggingPrefix('error')} No management API info received from the client for ${manifestName}.\nThe extension may not have finished loading, or the in-browser companion did not attach.`;
|
|
669
662
|
}
|
|
670
663
|
const { version = '' } = management;
|
|
671
664
|
const extensionVersion = process.env.EXTENSION_DEVELOP_VERSION || process.env.EXTENSION_CLI_VERSION || (()=>{
|
|
@@ -696,15 +689,32 @@ var __webpack_modules__ = {
|
|
|
696
689
|
let browserLabel = effectiveBrowserLine && effectiveBrowserLine.trim().length > 0 ? effectiveBrowserLine.trim() : capitalize(String(browser || 'unknown'));
|
|
697
690
|
if (browserLabel && !/[a-zA-Z]/.test(browserLabel)) browserLabel = `${capitalize(String(browser || 'unknown'))} ${browserLabel}`;
|
|
698
691
|
const cleanId = String(id || '').trim();
|
|
699
|
-
const lines = [];
|
|
700
692
|
const includeExtensionId = opts?.includeExtensionId !== false;
|
|
701
693
|
const updateNotice = updateSuffix ? ` ${updateSuffix}` : '';
|
|
702
694
|
const displayName = String(manifestName);
|
|
703
695
|
const displayVersion = String(version || manifest.version || '');
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
696
|
+
return (0, _helpers_messaging__rspack_import_9.Nr)({
|
|
697
|
+
version: extensionVersion,
|
|
698
|
+
suffix: updateNotice.trim(),
|
|
699
|
+
rows: [
|
|
700
|
+
{
|
|
701
|
+
label: 'Browser',
|
|
702
|
+
value: browserLabel
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
label: 'Extension',
|
|
706
|
+
value: displayVersion ? `${displayName} ${displayVersion}` : displayName
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
label: 'Extension ID',
|
|
710
|
+
value: includeExtensionId ? cleanId : ''
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
label: 'Run ID',
|
|
714
|
+
value: opts?.runLabel || ''
|
|
715
|
+
}
|
|
716
|
+
]
|
|
717
|
+
});
|
|
708
718
|
}
|
|
709
719
|
function emptyLine() {
|
|
710
720
|
return ' ';
|
|
@@ -729,7 +739,7 @@ var __webpack_modules__ = {
|
|
|
729
739
|
return `[extension-log ${ts}] ${data}`;
|
|
730
740
|
}
|
|
731
741
|
function browserRunnerError(body) {
|
|
732
|
-
return `${
|
|
742
|
+
return `${getLoggingPrefix('error')} ${pintor__rspack_import_8_default().brightBlue('Browser runner error')}\n${body}`;
|
|
733
743
|
}
|
|
734
744
|
function requireChromiumBinaryForChromiumBased() {
|
|
735
745
|
const body = `Configuration required\nProvide ${pintor__rspack_import_8_default().blue('--chromium-binary')} ${pintor__rspack_import_8_default().gray('<abs-path>')} when using ${pintor__rspack_import_8_default().yellow('chromium-based')}.\n`;
|
|
@@ -748,7 +758,7 @@ var __webpack_modules__ = {
|
|
|
748
758
|
return browserRunnerError(body);
|
|
749
759
|
}
|
|
750
760
|
function rdpInvalidRequestPayload() {
|
|
751
|
-
return `${getLoggingPrefix('error')} Received an unreadable Firefox remote debugging message.\nThe debugging connection is out of sync with the browser, usually after a crash or an abrupt reload.\nRestart the dev session
|
|
761
|
+
return `${getLoggingPrefix('error')} Received an unreadable Firefox remote debugging message.\nThe debugging connection is out of sync with the browser, usually after a crash or an abrupt reload.\nRestart the dev session.\nIf it repeats, report it with your Firefox version.`;
|
|
752
762
|
}
|
|
753
763
|
__webpack_require__.d(__webpack_exports__, {
|
|
754
764
|
$w: ()=>bestEffortBannerPrintFailed,
|
|
@@ -770,7 +780,6 @@ var __webpack_modules__ = {
|
|
|
770
780
|
HH: ()=>messageWithoutSenderError,
|
|
771
781
|
Ih: ()=>browserNotInstalledError,
|
|
772
782
|
JB: ()=>devChannelSnapshotInUse,
|
|
773
|
-
KK: ()=>cdpProtocolEventHandlerError,
|
|
774
783
|
L: ()=>chromiumManifestLoadBlockers,
|
|
775
784
|
LD: ()=>firefoxDryRunBinary,
|
|
776
785
|
M3: ()=>cdpClientConnected,
|
|
@@ -816,12 +825,9 @@ var __webpack_modules__ = {
|
|
|
816
825
|
qN: ()=>messagingClientClosedError,
|
|
817
826
|
qR: ()=>chromiumInvalidMatchPatterns,
|
|
818
827
|
qn: ()=>firefoxDryRunNotLaunching,
|
|
819
|
-
r0: ()=>cdpPendingRejectFailed,
|
|
820
828
|
sP: ()=>mv2NotSupportedByChromium,
|
|
821
829
|
sY: ()=>creatingUserProfile,
|
|
822
|
-
wX: ()=>cdpAutoAttachSetupFailed,
|
|
823
830
|
wk: ()=>chromeFailedToSpawn,
|
|
824
|
-
xx: ()=>cdpFailedToHandleMessage,
|
|
825
831
|
xy: ()=>chromeInitializingEnhancedReload,
|
|
826
832
|
y7: ()=>skippingBrowserLaunchDueToCompileErrors
|
|
827
833
|
});
|
|
@@ -1028,14 +1034,15 @@ var __webpack_modules__ = {
|
|
|
1028
1034
|
},
|
|
1029
1035
|
"./browsers/browsers-lib/process-teardown.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1030
1036
|
var node_child_process__rspack_import_0 = __webpack_require__("node:child_process");
|
|
1031
|
-
var
|
|
1037
|
+
var _helpers_messaging__rspack_import_1 = __webpack_require__("./helpers/messaging.ts");
|
|
1038
|
+
var _messages__rspack_import_2 = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
1032
1039
|
const FORCE_KILL_GRACE_MS = 5000;
|
|
1033
1040
|
const terminatedByUs = new WeakSet();
|
|
1034
1041
|
function wasTerminatedByUs(child) {
|
|
1035
1042
|
return !!child && terminatedByUs.has(child);
|
|
1036
1043
|
}
|
|
1037
1044
|
function authorLog(line) {
|
|
1038
|
-
if (line &&
|
|
1045
|
+
if (line && (0, _helpers_messaging__rspack_import_1._o)()) console.log(line);
|
|
1039
1046
|
}
|
|
1040
1047
|
function killWindowsTree(child, sync) {
|
|
1041
1048
|
if ('win32' !== process.platform) return;
|
|
@@ -1060,11 +1067,11 @@ var __webpack_modules__ = {
|
|
|
1060
1067
|
if (!child || child.killed) return;
|
|
1061
1068
|
terminatedByUs.add(child);
|
|
1062
1069
|
killWindowsTree(child, false);
|
|
1063
|
-
authorLog(
|
|
1070
|
+
authorLog(_messages__rspack_import_2.XH(browser));
|
|
1064
1071
|
child.kill('SIGTERM');
|
|
1065
1072
|
const killTimer = setTimeout(()=>{
|
|
1066
1073
|
if (!child.killed) {
|
|
1067
|
-
authorLog(
|
|
1074
|
+
authorLog(_messages__rspack_import_2.AG(browser));
|
|
1068
1075
|
child.kill('SIGKILL');
|
|
1069
1076
|
}
|
|
1070
1077
|
}, FORCE_KILL_GRACE_MS);
|
|
@@ -1075,7 +1082,7 @@ var __webpack_modules__ = {
|
|
|
1075
1082
|
terminatedByUs.add(child);
|
|
1076
1083
|
killWindowsTree(child, true);
|
|
1077
1084
|
try {
|
|
1078
|
-
authorLog(
|
|
1085
|
+
authorLog(_messages__rspack_import_2.AG(browser));
|
|
1079
1086
|
child.kill('SIGKILL');
|
|
1080
1087
|
} catch {}
|
|
1081
1088
|
}
|
|
@@ -1100,12 +1107,13 @@ var __webpack_modules__ = {
|
|
|
1100
1107
|
"./browsers/browsers-lib/ready-message.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1101
1108
|
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
1102
1109
|
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
|
1110
|
+
var _helpers_messaging__rspack_import_1 = __webpack_require__("./helpers/messaging.ts");
|
|
1103
1111
|
function ready(mode, browser) {
|
|
1104
1112
|
const key = String(browser || '').toLowerCase();
|
|
1105
|
-
const extensionOutput =
|
|
1113
|
+
const extensionOutput = (0, _helpers_messaging__rspack_import_1.T_)(key);
|
|
1106
1114
|
const cap = 'firefox' === key || 'gecko-based' === key || 'firefox-based' === key ? 'Firefox' : String(browser || '').charAt(0).toUpperCase() + String(browser || '').slice(1);
|
|
1107
1115
|
const pretty = pintor__rspack_import_0_default().green(`ready for ${mode}`);
|
|
1108
|
-
return `${
|
|
1116
|
+
return `${(0, _helpers_messaging__rspack_import_1.Pl)('info')} ${cap} ${extensionOutput} ${pretty}.`;
|
|
1109
1117
|
}
|
|
1110
1118
|
__webpack_require__.d(__webpack_exports__, {
|
|
1111
1119
|
G: ()=>ready
|
|
@@ -1143,6 +1151,20 @@ var __webpack_modules__ = {
|
|
|
1143
1151
|
node_fs__rspack_import_0.writeFileSync(readyPath, JSON.stringify(ready, null, 2));
|
|
1144
1152
|
} catch {}
|
|
1145
1153
|
}
|
|
1154
|
+
function stampReadyProfileLocked(extensionOutputPath, details) {
|
|
1155
|
+
try {
|
|
1156
|
+
if (!extensionOutputPath) return;
|
|
1157
|
+
const readyPath = readyPathFor(extensionOutputPath);
|
|
1158
|
+
if (!node_fs__rspack_import_0.existsSync(readyPath)) return;
|
|
1159
|
+
const ready = JSON.parse(node_fs__rspack_import_0.readFileSync(readyPath, 'utf-8'));
|
|
1160
|
+
ready.status = 'error';
|
|
1161
|
+
ready.code = 'profile_locked';
|
|
1162
|
+
ready.message = String(details?.message || '').trim() || 'the browser profile is already in use by another session';
|
|
1163
|
+
ready.profileLockedAt = new Date().toISOString();
|
|
1164
|
+
if (details?.owner) ready.profileLockOwner = details.owner;
|
|
1165
|
+
node_fs__rspack_import_0.writeFileSync(readyPath, JSON.stringify(ready, null, 2));
|
|
1166
|
+
} catch {}
|
|
1167
|
+
}
|
|
1146
1168
|
function stampReadyBrowserExited(extensionOutputPath, code) {
|
|
1147
1169
|
try {
|
|
1148
1170
|
if (!extensionOutputPath) return;
|
|
@@ -1162,6 +1184,7 @@ var __webpack_modules__ = {
|
|
|
1162
1184
|
__webpack_require__.d(__webpack_exports__, {
|
|
1163
1185
|
Wi: ()=>stampReadyBrowserExited,
|
|
1164
1186
|
__: ()=>stampReadyRdpPort,
|
|
1187
|
+
iD: ()=>stampReadyProfileLocked,
|
|
1165
1188
|
sf: ()=>stampReadyExtensionLoadRefused
|
|
1166
1189
|
});
|
|
1167
1190
|
},
|
|
@@ -1464,6 +1487,10 @@ var __webpack_modules__ = {
|
|
|
1464
1487
|
}
|
|
1465
1488
|
return removed;
|
|
1466
1489
|
}
|
|
1490
|
+
const PROFILE_LOCKED_ERROR_CODE = 'profile_locked';
|
|
1491
|
+
function isProfileLockedError(error) {
|
|
1492
|
+
return !!error && error.code === PROFILE_LOCKED_ERROR_CODE && 'string' == typeof error.message;
|
|
1493
|
+
}
|
|
1467
1494
|
function prepareChromiumProfileForLaunch(profilePath) {
|
|
1468
1495
|
const owner = readChromiumSingletonOwner(profilePath);
|
|
1469
1496
|
if (!owner) return {
|
|
@@ -1476,7 +1503,13 @@ var __webpack_modules__ = {
|
|
|
1476
1503
|
if (!sameHost || !alive) return {
|
|
1477
1504
|
removedArtifacts: removeChromiumSingletonArtifacts(profilePath)
|
|
1478
1505
|
};
|
|
1479
|
-
|
|
1506
|
+
const error = new Error(`Chromium profile "${profilePath}" is already in use by process ${owner.pid} on host ${owner.host}. Close that browser session or use a different profile before starting Extension.js.`);
|
|
1507
|
+
error.code = PROFILE_LOCKED_ERROR_CODE;
|
|
1508
|
+
error.profileLockOwner = {
|
|
1509
|
+
host: owner.host,
|
|
1510
|
+
pid: owner.pid
|
|
1511
|
+
};
|
|
1512
|
+
throw error;
|
|
1480
1513
|
}
|
|
1481
1514
|
function markManagedEphemeralProfile(profilePath) {
|
|
1482
1515
|
try {
|
|
@@ -1533,6 +1566,7 @@ var __webpack_modules__ = {
|
|
|
1533
1566
|
W0: ()=>parseEnvBrowserFlags,
|
|
1534
1567
|
ZO: ()=>isHeadlessGuardRequested,
|
|
1535
1568
|
aY: ()=>findAvailablePortNear,
|
|
1569
|
+
ci: ()=>isProfileLockedError,
|
|
1536
1570
|
jl: ()=>deriveDebugPortWithInstance,
|
|
1537
1571
|
ov: ()=>filterBrowserFlags,
|
|
1538
1572
|
sW: ()=>removeManagedEphemeralProfile
|
|
@@ -1839,6 +1873,7 @@ var __webpack_modules__ = {
|
|
|
1839
1873
|
var external_vivaldi_location2_default = /*#__PURE__*/ __webpack_require__.n(external_vivaldi_location2_namespaceObject);
|
|
1840
1874
|
const external_yandex_location_namespaceObject = require("yandex-location");
|
|
1841
1875
|
var external_yandex_location_default = /*#__PURE__*/ __webpack_require__.n(external_yandex_location_namespaceObject);
|
|
1876
|
+
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
1842
1877
|
var banner = __webpack_require__("./browsers/browsers-lib/banner.ts");
|
|
1843
1878
|
var instance_registry = __webpack_require__("./browsers/browsers-lib/instance-registry.ts");
|
|
1844
1879
|
function diagnoseChromiumManifestRefusal(manifest) {
|
|
@@ -2224,7 +2259,7 @@ var __webpack_modules__ = {
|
|
|
2224
2259
|
});
|
|
2225
2260
|
const userProfilePath = resolved.profilePath;
|
|
2226
2261
|
if ('managed' === resolved.kind) {
|
|
2227
|
-
console.log(messages.sY(shownPath(userProfilePath)));
|
|
2262
|
+
if ((0, messaging._o)()) console.log(messages.sY(shownPath(userProfilePath)));
|
|
2228
2263
|
if (!resolved.persisted) try {
|
|
2229
2264
|
const maxAgeHours = parseInt(String(process.env.EXTENSION_TMP_PROFILE_MAX_AGE_HOURS || ''), 10);
|
|
2230
2265
|
(0, shared_utils.CW)(managedBaseDir, external_node_path_.basename(userProfilePath), Number.isFinite(maxAgeHours) ? maxAgeHours : 12);
|
|
@@ -2280,7 +2315,7 @@ var __webpack_modules__ = {
|
|
|
2280
2315
|
return (0, shared_utils.Py)(baseFlags);
|
|
2281
2316
|
}
|
|
2282
2317
|
function logChromiumDryRun(browserBinaryLocation, chromiumConfig) {
|
|
2283
|
-
console.log(messages.xy());
|
|
2318
|
+
if ((0, messaging._o)()) console.log(messages.xy());
|
|
2284
2319
|
console.log(messages.Nk());
|
|
2285
2320
|
console.log(messages.Q0(browserBinaryLocation));
|
|
2286
2321
|
console.log(messages.E8(chromiumConfig.join(' ')));
|
|
@@ -2293,7 +2328,7 @@ var __webpack_modules__ = {
|
|
|
2293
2328
|
instance.isCleaningUp = true;
|
|
2294
2329
|
const { browser, child, cleanupInstance } = instance;
|
|
2295
2330
|
try {
|
|
2296
|
-
if (
|
|
2331
|
+
if ((0, messaging._o)()) console.log(messages.Vk(browser));
|
|
2297
2332
|
(0, process_teardown.Df)(child, browser);
|
|
2298
2333
|
cleanupInstance();
|
|
2299
2334
|
} catch (error) {
|
|
@@ -2467,12 +2502,17 @@ var __webpack_modules__ = {
|
|
|
2467
2502
|
else obj[key] = value;
|
|
2468
2503
|
return obj;
|
|
2469
2504
|
}
|
|
2470
|
-
async function
|
|
2505
|
+
async function maybePrintLaunchBanner(args) {
|
|
2471
2506
|
const mode = args.compilation?.options?.mode || 'development';
|
|
2472
|
-
if ('development' !== mode) return;
|
|
2473
2507
|
const loadExtensionFlag = args.chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
|
|
2474
2508
|
const extensionOutputPath = (0, extension_output_path.W)(args.compilation, loadExtensionFlag);
|
|
2475
2509
|
if (!extensionOutputPath) return;
|
|
2510
|
+
if ('production' === mode) return void await (0, banner.MK)({
|
|
2511
|
+
browser: args.browser,
|
|
2512
|
+
outPath: extensionOutputPath,
|
|
2513
|
+
browserVersionLine: args.browserVersionLine
|
|
2514
|
+
});
|
|
2515
|
+
if ('development' !== mode) return;
|
|
2476
2516
|
const ready = await (0, manifest_readiness.fR)(extensionOutputPath, {
|
|
2477
2517
|
timeoutMs: 10000
|
|
2478
2518
|
});
|
|
@@ -2648,7 +2688,7 @@ var __webpack_modules__ = {
|
|
|
2648
2688
|
...process.env,
|
|
2649
2689
|
...output_binaries_resolver.$4(String(managedCacheRoot), b)
|
|
2650
2690
|
});
|
|
2651
|
-
const isAuthorMode =
|
|
2691
|
+
const isAuthorMode = (0, messaging._o)();
|
|
2652
2692
|
const resolveChromeLikeBinary = ()=>{
|
|
2653
2693
|
try {
|
|
2654
2694
|
try {
|
|
@@ -2841,32 +2881,44 @@ var __webpack_modules__ = {
|
|
|
2841
2881
|
];
|
|
2842
2882
|
if (loadBlockers.length) console.warn(messages.L(String(extPath), loadBlockers));
|
|
2843
2883
|
} catch {}
|
|
2844
|
-
let chromiumConfig
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2884
|
+
let chromiumConfig;
|
|
2885
|
+
try {
|
|
2886
|
+
chromiumConfig = browserConfig(compilation, {
|
|
2887
|
+
...this.options,
|
|
2888
|
+
profile: this.options.profile,
|
|
2889
|
+
instanceId: this.options.instanceId,
|
|
2890
|
+
extension: extensionsToLoad,
|
|
2891
|
+
logLevel: this.options.logLevel
|
|
2892
|
+
});
|
|
2893
|
+
} catch (error) {
|
|
2894
|
+
if (shared_utils.ci(error)) (0, ready_stamp.iD)((0, extension_output_path.W)(compilation, void 0), {
|
|
2895
|
+
message: error.message,
|
|
2896
|
+
owner: error.profileLockOwner
|
|
2897
|
+
});
|
|
2898
|
+
throw error;
|
|
2899
|
+
}
|
|
2851
2900
|
const desiredPort = shared_utils.jl(this.options.port, this.options.instanceId);
|
|
2852
2901
|
const freePort = await shared_utils.aY(desiredPort);
|
|
2853
2902
|
const selectedPort = freePort;
|
|
2854
2903
|
if (freePort !== desiredPort) chromiumConfig = chromiumConfig.map((flag)=>flag.startsWith('--remote-debugging-port=') ? `--remote-debugging-port=${selectedPort}` : flag);
|
|
2855
|
-
if (
|
|
2904
|
+
if ((0, messaging._o)()) this.logger.info(messages.CY(selectedPort, desiredPort));
|
|
2856
2905
|
instance_registry.UF(this.options.instanceId, {
|
|
2857
2906
|
cdpPort: selectedPort
|
|
2858
2907
|
});
|
|
2859
2908
|
const enableCdp = opts?.enableCdpPostLaunch !== false;
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2909
|
+
try {
|
|
2910
|
+
await maybePrintLaunchBanner({
|
|
2911
|
+
compilation,
|
|
2912
|
+
chromiumConfig,
|
|
2913
|
+
browser: this.options.browser,
|
|
2914
|
+
hostPort: {
|
|
2915
|
+
host: '127.0.0.1',
|
|
2916
|
+
port: selectedPort
|
|
2917
|
+
},
|
|
2918
|
+
browserVersionLine,
|
|
2919
|
+
enableCdp
|
|
2920
|
+
});
|
|
2921
|
+
} catch {}
|
|
2870
2922
|
if (this.options.dryRun) return void logChromiumDryRun(browserBinaryLocation, chromiumConfig);
|
|
2871
2923
|
const usePipe = chromiumConfig.includes('--remote-debugging-pipe');
|
|
2872
2924
|
this.closeHandlerContext = {
|
|
@@ -2885,7 +2937,7 @@ var __webpack_modules__ = {
|
|
|
2885
2937
|
if (portReady) break;
|
|
2886
2938
|
await new Promise((r)=>setTimeout(r, 500));
|
|
2887
2939
|
}
|
|
2888
|
-
if (!portReady &&
|
|
2940
|
+
if (!portReady && (0, messaging._o)()) this.logger.warn?.(`[browser] Debug port ${selectedPort} not bound after spawn. CDP may fail`);
|
|
2889
2941
|
}
|
|
2890
2942
|
const reportReady = ()=>{
|
|
2891
2943
|
if ('development' !== compilation.options.mode) return;
|
|
@@ -2895,18 +2947,6 @@ var __webpack_modules__ = {
|
|
|
2895
2947
|
};
|
|
2896
2948
|
if (!enableCdp) reportReady();
|
|
2897
2949
|
try {
|
|
2898
|
-
const mode = compilation?.options?.mode || 'development';
|
|
2899
|
-
try {
|
|
2900
|
-
if ('production' === mode) {
|
|
2901
|
-
const loadExtensionFlag = chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
|
|
2902
|
-
const extensionOutputPath = (0, extension_output_path.W)(compilation, loadExtensionFlag);
|
|
2903
|
-
if (extensionOutputPath) await (0, banner.MK)({
|
|
2904
|
-
browser: this.options.browser,
|
|
2905
|
-
outPath: extensionOutputPath,
|
|
2906
|
-
browserVersionLine
|
|
2907
|
-
});
|
|
2908
|
-
}
|
|
2909
|
-
} catch {}
|
|
2910
2950
|
const cdpConfig = {
|
|
2911
2951
|
...(0, runtime_options.pA)({
|
|
2912
2952
|
...this.options,
|
|
@@ -2940,7 +2980,7 @@ var __webpack_modules__ = {
|
|
|
2940
2980
|
}
|
|
2941
2981
|
}
|
|
2942
2982
|
async launchWithDirectSpawn(binary, chromeFlags, usePipe = false) {
|
|
2943
|
-
if (
|
|
2983
|
+
if ((0, messaging._o)()) this.logger.info(messages.xy());
|
|
2944
2984
|
const launchArgs = this.options?.startingUrl ? [
|
|
2945
2985
|
...chromeFlags,
|
|
2946
2986
|
this.options.startingUrl
|
|
@@ -2967,7 +3007,7 @@ var __webpack_modules__ = {
|
|
|
2967
3007
|
browser: this.options.browser,
|
|
2968
3008
|
logger: this.logger
|
|
2969
3009
|
});
|
|
2970
|
-
if (
|
|
3010
|
+
if ((0, messaging._o)()) this.logger.debug?.('[browser] Final Chrome flags:', launchArgs.join(' '));
|
|
2971
3011
|
const stderrStream = child.stdio?.[2];
|
|
2972
3012
|
if (stderrStream && 'function' == typeof stderrStream.on) {
|
|
2973
3013
|
let pending = '';
|
|
@@ -2984,7 +3024,7 @@ var __webpack_modules__ = {
|
|
|
2984
3024
|
}
|
|
2985
3025
|
let disposeSignalHandlers;
|
|
2986
3026
|
child.on('close', (code)=>{
|
|
2987
|
-
if (
|
|
3027
|
+
if ((0, messaging._o)()) this.logger.info(messages.nn(code || 0));
|
|
2988
3028
|
if (!(0, process_teardown.Op)(child)) {
|
|
2989
3029
|
this.logger.error(this.closeHandlerContext?.isDevMode ? `[browser] ${this.options.browser} exited mid-session (code ${code ?? 'unknown'}). The dev server is still running but reloads cannot be delivered, restart "extension dev" to relaunch the browser.` : `[browser] ${this.options.browser} exited (code ${code ?? 'unknown'}); the preview session is over.`);
|
|
2990
3030
|
(0, ready_stamp.Wi)(this.closeHandlerContext?.extensionOutputPath, code);
|
|
@@ -3198,6 +3238,7 @@ var __webpack_modules__ = {
|
|
|
3198
3238
|
var external_librewolf_location_default = /*#__PURE__*/ __webpack_require__.n(external_librewolf_location_namespaceObject);
|
|
3199
3239
|
const external_waterfox_location_namespaceObject = require("waterfox-location");
|
|
3200
3240
|
var external_waterfox_location_default = /*#__PURE__*/ __webpack_require__.n(external_waterfox_location_namespaceObject);
|
|
3241
|
+
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
3201
3242
|
var instance_registry = __webpack_require__("./browsers/browsers-lib/instance-registry.ts");
|
|
3202
3243
|
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
3203
3244
|
var output_binaries_resolver = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
@@ -3378,7 +3419,7 @@ var __webpack_modules__ = {
|
|
|
3378
3419
|
});
|
|
3379
3420
|
const profilePath = resolved.profilePath;
|
|
3380
3421
|
if ('managed' === resolved.kind) {
|
|
3381
|
-
console.log(messages.sY(shownPath(profilePath)));
|
|
3422
|
+
if ((0, messaging._o)()) console.log(messages.sY(shownPath(profilePath)));
|
|
3382
3423
|
if (!resolved.persisted) try {
|
|
3383
3424
|
const maxAgeHours = parseInt(String(process.env.EXTENSION_TMP_PROFILE_MAX_AGE_HOURS || ''), 10);
|
|
3384
3425
|
(0, shared_utils.CW)(managedBaseDir, external_node_path_.basename(profilePath), Number.isFinite(maxAgeHours) ? maxAgeHours : 12);
|
|
@@ -3420,7 +3461,7 @@ var __webpack_modules__ = {
|
|
|
3420
3461
|
return parts.join(' ');
|
|
3421
3462
|
}
|
|
3422
3463
|
function logFirefoxDryRun(browserBinaryLocation, firefoxConfig) {
|
|
3423
|
-
console.log(messages.A9());
|
|
3464
|
+
if ((0, messaging._o)()) console.log(messages.A9());
|
|
3424
3465
|
console.log(messages.qn());
|
|
3425
3466
|
console.log(messages.LD(browserBinaryLocation));
|
|
3426
3467
|
console.log(messages.k6(firefoxConfig));
|
|
@@ -3432,7 +3473,7 @@ var __webpack_modules__ = {
|
|
|
3432
3473
|
instance.isCleaningUp = true;
|
|
3433
3474
|
const { browser, childRef, cleanupInstance } = instance;
|
|
3434
3475
|
try {
|
|
3435
|
-
if (
|
|
3476
|
+
if ((0, messaging._o)()) console.log(messages.Vk(browser));
|
|
3436
3477
|
(0, process_teardown.Df)(childRef(), browser);
|
|
3437
3478
|
await cleanupInstance();
|
|
3438
3479
|
} catch (error) {
|
|
@@ -3935,7 +3976,7 @@ var __webpack_modules__ = {
|
|
|
3935
3976
|
host,
|
|
3936
3977
|
port
|
|
3937
3978
|
}, ()=>{
|
|
3938
|
-
if (
|
|
3979
|
+
if ((0, messaging._o)()) console.log(messages.EI(host, port));
|
|
3939
3980
|
resolve();
|
|
3940
3981
|
});
|
|
3941
3982
|
this.conn = c;
|
|
@@ -4252,9 +4293,9 @@ var __webpack_modules__ = {
|
|
|
4252
4293
|
pollIntervalMs: 150,
|
|
4253
4294
|
stableReadsRequired: 2
|
|
4254
4295
|
});
|
|
4255
|
-
if (!ready &&
|
|
4296
|
+
if (!ready && (0, messaging._o)()) console.warn(`[browser] Firefox add-on output did not fully settle before install: ${addonPath}`);
|
|
4256
4297
|
} catch {}
|
|
4257
|
-
if (
|
|
4298
|
+
if ((0, messaging._o)()) try {
|
|
4258
4299
|
console.log('[browser] Firefox add-on paths:', candidateAddonPaths);
|
|
4259
4300
|
} catch {}
|
|
4260
4301
|
let primaryUserAddonId;
|
|
@@ -4278,7 +4319,7 @@ var __webpack_modules__ = {
|
|
|
4278
4319
|
try {
|
|
4279
4320
|
if (!this.derivedExtensionId) {
|
|
4280
4321
|
this.derivedExtensionId = await deriveMozExtensionId(client);
|
|
4281
|
-
if (
|
|
4322
|
+
if ((0, messaging._o)() && !this.derivedExtensionId) console.warn('[browser] Firefox: could not resolve a unique add-on id for the banner (install response had none; multiple or zero moz-extension targets).');
|
|
4282
4323
|
}
|
|
4283
4324
|
} catch {}
|
|
4284
4325
|
this.lastInstalledAddonPath = primaryAddonPath;
|
|
@@ -4371,7 +4412,7 @@ var __webpack_modules__ = {
|
|
|
4371
4412
|
} catch (error) {
|
|
4372
4413
|
lastError = error;
|
|
4373
4414
|
if (controller.getAddonInstallRefusalReason()) break;
|
|
4374
|
-
if (
|
|
4415
|
+
if ((0, messaging._o)()) try {
|
|
4375
4416
|
const msg = error?.message || String(error);
|
|
4376
4417
|
console.warn(`[browser] Firefox RDP setup retry ${i + 1}/${attempts}: ${msg}`);
|
|
4377
4418
|
} catch {}
|
|
@@ -4510,7 +4551,7 @@ var __webpack_modules__ = {
|
|
|
4510
4551
|
async launch(compilation, options) {
|
|
4511
4552
|
const compilationErrors = compilation?.errors || [];
|
|
4512
4553
|
if (compilationErrors.length > 0) return void this.ctx.logger?.info?.(messages.y7());
|
|
4513
|
-
if (
|
|
4554
|
+
if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.A9());
|
|
4514
4555
|
const normalizePath = (value)=>{
|
|
4515
4556
|
const normalized = value ? (0, wsl_support.f7)(value) : null;
|
|
4516
4557
|
return normalized && external_node_fs_.existsSync(normalized) ? normalized : null;
|
|
@@ -4647,8 +4688,8 @@ var __webpack_modules__ = {
|
|
|
4647
4688
|
if (binaryArgsMatch) {
|
|
4648
4689
|
const rawArgs = String(binaryArgsMatch[1] || '').trim();
|
|
4649
4690
|
if (rawArgs) firefoxArgs.push(...rawArgs.split(' ').filter((arg)=>arg.trim().length > 0));
|
|
4650
|
-
if (
|
|
4651
|
-
} else if (
|
|
4691
|
+
if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.iv(binaryArgsMatch[1]));
|
|
4692
|
+
} else if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.dN());
|
|
4652
4693
|
const profileMatch = firefoxCfg.match(/--profile="([^"]*)"/);
|
|
4653
4694
|
if (profileMatch) {
|
|
4654
4695
|
const profilePath = profileMatch[1];
|
|
@@ -4678,13 +4719,13 @@ var __webpack_modules__ = {
|
|
|
4678
4719
|
(0, ready_stamp.__)(this.extensionOutputPath, debugPort);
|
|
4679
4720
|
this.scheduleWatchTimeout();
|
|
4680
4721
|
try {
|
|
4681
|
-
if (
|
|
4722
|
+
if ((0, messaging._o)()) {
|
|
4682
4723
|
this.ctx.logger?.info?.(messages.pd(debugPort, desiredDebugPort));
|
|
4683
4724
|
this.ctx.logger?.info?.(messages.dw(profilePath));
|
|
4684
4725
|
}
|
|
4685
4726
|
} catch {}
|
|
4686
4727
|
} else {
|
|
4687
|
-
if (
|
|
4728
|
+
if ((0, messaging._o)()) this.ctx.logger?.warn?.('[browser] Firefox profile not set; skipping RDP add-on install.');
|
|
4688
4729
|
const args = [
|
|
4689
4730
|
...isFirefoxHeadlessRequested() ? [
|
|
4690
4731
|
'-headless'
|
|
@@ -4713,7 +4754,7 @@ var __webpack_modules__ = {
|
|
|
4713
4754
|
'pipe',
|
|
4714
4755
|
'pipe'
|
|
4715
4756
|
];
|
|
4716
|
-
return
|
|
4757
|
+
return (0, messaging._o)() ? [
|
|
4717
4758
|
'pipe',
|
|
4718
4759
|
'pipe',
|
|
4719
4760
|
'pipe'
|
|
@@ -4735,7 +4776,7 @@ var __webpack_modules__ = {
|
|
|
4735
4776
|
});
|
|
4736
4777
|
}
|
|
4737
4778
|
pipeChildOutput(child) {
|
|
4738
|
-
if (
|
|
4779
|
+
if (!(0, messaging._o)()) return;
|
|
4739
4780
|
child.stdout?.pipe(process.stdout);
|
|
4740
4781
|
child.stderr?.pipe(process.stderr);
|
|
4741
4782
|
}
|
|
@@ -4753,13 +4794,13 @@ var __webpack_modules__ = {
|
|
|
4753
4794
|
clearTimeout(this.watchTimeout);
|
|
4754
4795
|
this.watchTimeout = void 0;
|
|
4755
4796
|
}
|
|
4756
|
-
if (
|
|
4797
|
+
if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.Th(this.host.browser));
|
|
4757
4798
|
if (!(0, process_teardown.Op)(child)) {
|
|
4758
4799
|
this.ctx.logger?.error?.(`[browser] ${this.host.browser} exited (code ${code ?? 'unknown'}) without being asked to. The add-on may have been rejected or the browser crashed; the session cannot be driven.`);
|
|
4759
4800
|
(0, ready_stamp.Wi)(this.extensionOutputPath, code);
|
|
4760
4801
|
}
|
|
4761
4802
|
this.cleanupInstance().catch((err)=>{
|
|
4762
|
-
if (
|
|
4803
|
+
if ((0, messaging._o)()) this.ctx.logger?.error?.(`[browser] Cleanup error on child close: ${err?.message || err}`);
|
|
4763
4804
|
});
|
|
4764
4805
|
disposeProcessHandlers?.();
|
|
4765
4806
|
});
|
|
@@ -4810,7 +4851,7 @@ var __webpack_modules__ = {
|
|
|
4810
4851
|
this.ctx.logger?.info?.(`[browser] Watch timeout reached (${ms}ms). Shutting down.`);
|
|
4811
4852
|
} catch {}
|
|
4812
4853
|
this.cleanupInstance().catch((err)=>{
|
|
4813
|
-
if (
|
|
4854
|
+
if ((0, messaging._o)()) this.ctx.logger?.error?.(`[browser] Cleanup error on watch timeout: ${err?.message || err}`);
|
|
4814
4855
|
}).finally(()=>{
|
|
4815
4856
|
process.exit(0);
|
|
4816
4857
|
});
|
|
@@ -4838,14 +4879,19 @@ var __webpack_modules__ = {
|
|
|
4838
4879
|
}
|
|
4839
4880
|
},
|
|
4840
4881
|
"./browsers/run-only.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4841
|
-
var
|
|
4842
|
-
var
|
|
4843
|
-
var
|
|
4844
|
-
var
|
|
4845
|
-
var
|
|
4846
|
-
var
|
|
4847
|
-
var
|
|
4848
|
-
var
|
|
4882
|
+
var node_fs__rspack_import_0 = __webpack_require__("node:fs");
|
|
4883
|
+
var chrome_location2__rspack_import_1 = __webpack_require__("chrome-location2");
|
|
4884
|
+
var chromium_location__rspack_import_2 = __webpack_require__("chromium-location");
|
|
4885
|
+
var edge_location__rspack_import_3 = __webpack_require__("edge-location");
|
|
4886
|
+
var firefox_location2__rspack_import_4 = __webpack_require__("firefox-location2");
|
|
4887
|
+
var _browsers_lib_banner__rspack_import_5 = __webpack_require__("./browsers/browsers-lib/banner.ts");
|
|
4888
|
+
var _browsers_lib_browser_family__rspack_import_6 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
|
|
4889
|
+
var _browsers_lib_output_binaries_resolver__rspack_import_7 = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
4890
|
+
var _browsers_lib_runtime_options__rspack_import_12 = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
|
|
4891
|
+
var _run_chromium_chromium_context__rspack_import_10 = __webpack_require__("./browsers/run-chromium/chromium-context/index.ts");
|
|
4892
|
+
var _run_chromium_chromium_launch__rspack_import_8 = __webpack_require__("./browsers/run-chromium/chromium-launch/index.ts");
|
|
4893
|
+
var _run_firefox_firefox_context__rspack_import_11 = __webpack_require__("./browsers/run-firefox/firefox-context/index.ts");
|
|
4894
|
+
var _run_firefox_firefox_launch__rspack_import_9 = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
|
|
4849
4895
|
function createPreviewCompilationLike(opts) {
|
|
4850
4896
|
return {
|
|
4851
4897
|
options: {
|
|
@@ -4908,13 +4954,28 @@ var __webpack_modules__ = {
|
|
|
4908
4954
|
dryRun: pluginOptions.dryRun
|
|
4909
4955
|
};
|
|
4910
4956
|
}
|
|
4957
|
+
function resolvePinnedBinaryVersionLine(opts) {
|
|
4958
|
+
try {
|
|
4959
|
+
if ((0, _browsers_lib_browser_family__rspack_import_6.M_)(opts.browser)) {
|
|
4960
|
+
if (!opts.geckoBinary || !node_fs__rspack_import_0.existsSync(opts.geckoBinary)) return;
|
|
4961
|
+
return (0, firefox_location2__rspack_import_4.getFirefoxVersion)(opts.geckoBinary) || void 0;
|
|
4962
|
+
}
|
|
4963
|
+
if (!opts.chromiumBinary || !node_fs__rspack_import_0.existsSync(opts.chromiumBinary)) return;
|
|
4964
|
+
if ('edge' === opts.browser) return (0, edge_location__rspack_import_3.getEdgeVersion)(opts.chromiumBinary) || void 0;
|
|
4965
|
+
if ('chromium' === opts.browser || 'chromium-based' === opts.browser) return (0, chromium_location__rspack_import_2.getChromiumVersion)(opts.chromiumBinary) || void 0;
|
|
4966
|
+
return (0, chrome_location2__rspack_import_1.getChromeVersion)(opts.chromiumBinary) || void 0;
|
|
4967
|
+
} catch {
|
|
4968
|
+
return;
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4911
4971
|
function buildPreviewBannerOptions(opts) {
|
|
4912
4972
|
return {
|
|
4913
4973
|
browser: opts.browser,
|
|
4914
4974
|
outPath: opts.outPath,
|
|
4915
4975
|
includeExtensionId: true,
|
|
4916
4976
|
includeRunId: false,
|
|
4917
|
-
readyPath: opts.readyPath
|
|
4977
|
+
readyPath: opts.readyPath,
|
|
4978
|
+
browserVersionLine: resolvePinnedBinaryVersionLine(opts)
|
|
4918
4979
|
};
|
|
4919
4980
|
}
|
|
4920
4981
|
async function runOnlyPreviewBrowser(opts) {
|
|
@@ -4930,24 +4991,24 @@ var __webpack_modules__ = {
|
|
|
4930
4991
|
const compilationLike = createPreviewCompilationLike(opts);
|
|
4931
4992
|
const previewPluginOptions = buildPreviewPluginOptions(opts);
|
|
4932
4993
|
const bannerOptions = buildPreviewBannerOptions(opts);
|
|
4933
|
-
(0,
|
|
4934
|
-
if ((0,
|
|
4935
|
-
const ctx = (0,
|
|
4936
|
-
const launcher = new
|
|
4994
|
+
(0, _browsers_lib_output_binaries_resolver__rspack_import_7.LB)(compilationLike);
|
|
4995
|
+
if ((0, _browsers_lib_browser_family__rspack_import_6.rG)(opts.browser)) {
|
|
4996
|
+
const ctx = (0, _run_chromium_chromium_context__rspack_import_10.g)();
|
|
4997
|
+
const launcher = new _run_chromium_chromium_launch__rspack_import_8.f(buildPreviewChromiumOptions(opts), ctx);
|
|
4998
|
+
await (0, _browsers_lib_banner__rspack_import_5.MK)(bannerOptions);
|
|
4937
4999
|
await launcher.runOnce(compilationLike, {
|
|
4938
5000
|
enableCdpPostLaunch: false
|
|
4939
5001
|
});
|
|
4940
|
-
await (0, _browsers_lib_banner__rspack_import_0.MK)(bannerOptions);
|
|
4941
5002
|
return;
|
|
4942
5003
|
}
|
|
4943
|
-
if ((0,
|
|
4944
|
-
const ctx = (0,
|
|
4945
|
-
const launcher = new
|
|
4946
|
-
await
|
|
5004
|
+
if ((0, _browsers_lib_browser_family__rspack_import_6.M_)(opts.browser)) {
|
|
5005
|
+
const ctx = (0, _run_firefox_firefox_context__rspack_import_11.D)();
|
|
5006
|
+
const launcher = new _run_firefox_firefox_launch__rspack_import_9.c(buildPreviewFirefoxOptions(opts), ctx);
|
|
5007
|
+
await (0, _browsers_lib_banner__rspack_import_5.MK)(bannerOptions);
|
|
5008
|
+
await launcher.runOnce(compilationLike, (0, _browsers_lib_runtime_options__rspack_import_12.zU)(previewPluginOptions, 'production', {
|
|
4947
5009
|
persistProfile: previewPluginOptions.persistProfile,
|
|
4948
5010
|
geckoBinary: previewPluginOptions.geckoBinary
|
|
4949
5011
|
}));
|
|
4950
|
-
await (0, _browsers_lib_banner__rspack_import_0.MK)(bannerOptions);
|
|
4951
5012
|
return;
|
|
4952
5013
|
}
|
|
4953
5014
|
throw new Error(`Unsupported browser: ${String(opts.browser)}`);
|
|
@@ -4956,6 +5017,80 @@ var __webpack_modules__ = {
|
|
|
4956
5017
|
E: ()=>runOnlyPreviewBrowser
|
|
4957
5018
|
});
|
|
4958
5019
|
},
|
|
5020
|
+
"./helpers/messaging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5021
|
+
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
5022
|
+
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
|
5023
|
+
const GLYPH = '⏵⏵⏵';
|
|
5024
|
+
const DEBUG_GLYPH = '···';
|
|
5025
|
+
const DEBUG_VALUES = new Set([
|
|
5026
|
+
'1',
|
|
5027
|
+
'true',
|
|
5028
|
+
'yes',
|
|
5029
|
+
'on',
|
|
5030
|
+
'debug',
|
|
5031
|
+
'dev',
|
|
5032
|
+
'development'
|
|
5033
|
+
]);
|
|
5034
|
+
function isDebug() {
|
|
5035
|
+
const raw = process.env.EXTENSION_DEBUG ?? process.env.EXTENSION_AUTHOR_MODE;
|
|
5036
|
+
return DEBUG_VALUES.has(String(raw ?? '').trim().toLowerCase());
|
|
5037
|
+
}
|
|
5038
|
+
function prefix(type) {
|
|
5039
|
+
if ('error' === type) return pintor__rspack_import_0_default().red(GLYPH);
|
|
5040
|
+
if ('warn' === type) return pintor__rspack_import_0_default().brightYellow(GLYPH);
|
|
5041
|
+
if ('success' === type) return pintor__rspack_import_0_default().green(GLYPH);
|
|
5042
|
+
if ('debug' === type) return pintor__rspack_import_0_default().dim(pintor__rspack_import_0_default().gray(DEBUG_GLYPH));
|
|
5043
|
+
return pintor__rspack_import_0_default().gray(GLYPH);
|
|
5044
|
+
}
|
|
5045
|
+
const CARD_LABEL_WIDTH = 15;
|
|
5046
|
+
function card(input = {}) {
|
|
5047
|
+
const version = String(input.version || '').trim();
|
|
5048
|
+
const suffix = String(input.suffix || '').trim();
|
|
5049
|
+
const head = ` 🧩 ${pintor__rspack_import_0_default().brightBlue('Extension.js')}` + (version ? ` ${pintor__rspack_import_0_default().gray(version)}` : '') + (suffix ? ` ${suffix}` : '');
|
|
5050
|
+
const body = (input.rows || []).filter((row)=>String(row.value || '').trim().length > 0).map((row)=>{
|
|
5051
|
+
const label = row.label.padEnd(CARD_LABEL_WIDTH);
|
|
5052
|
+
return ` ${label}${pintor__rspack_import_0_default().gray(String(row.value).trim())}`;
|
|
5053
|
+
});
|
|
5054
|
+
return [
|
|
5055
|
+
head,
|
|
5056
|
+
...body
|
|
5057
|
+
].join('\n');
|
|
5058
|
+
}
|
|
5059
|
+
const CARD_KEYS_ENV = 'EXTENSION_CLI_CARD_KEYS';
|
|
5060
|
+
const CARD_KEYS_SEPARATOR = '\u001f';
|
|
5061
|
+
function isCardKeyClaimed(key) {
|
|
5062
|
+
const claimed = String(process.env[CARD_KEYS_ENV] || '');
|
|
5063
|
+
if (!claimed) return false;
|
|
5064
|
+
return claimed.split(CARD_KEYS_SEPARATOR).includes(key);
|
|
5065
|
+
}
|
|
5066
|
+
function claimCardKey(key) {
|
|
5067
|
+
if (isCardKeyClaimed(key)) return false;
|
|
5068
|
+
const claimed = String(process.env[CARD_KEYS_ENV] || '');
|
|
5069
|
+
process.env[CARD_KEYS_ENV] = claimed ? `${claimed}${CARD_KEYS_SEPARATOR}${key}` : key;
|
|
5070
|
+
return true;
|
|
5071
|
+
}
|
|
5072
|
+
const GECKO_BROWSERS = new Set([
|
|
5073
|
+
'firefox',
|
|
5074
|
+
'firefox-based',
|
|
5075
|
+
'gecko-based',
|
|
5076
|
+
'librewolf',
|
|
5077
|
+
'waterfox'
|
|
5078
|
+
]);
|
|
5079
|
+
function artifactNoun(browser) {
|
|
5080
|
+
const name = String(browser || '').trim().toLowerCase();
|
|
5081
|
+
if (GECKO_BROWSERS.has(name)) return 'Add-on';
|
|
5082
|
+
if (name.includes('gecko') || name.includes('firefox')) return 'Add-on';
|
|
5083
|
+
return 'Extension';
|
|
5084
|
+
}
|
|
5085
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5086
|
+
Nr: ()=>card,
|
|
5087
|
+
Pl: ()=>prefix,
|
|
5088
|
+
T_: ()=>artifactNoun,
|
|
5089
|
+
VR: ()=>isCardKeyClaimed,
|
|
5090
|
+
_o: ()=>isDebug,
|
|
5091
|
+
od: ()=>claimCardKey
|
|
5092
|
+
});
|
|
5093
|
+
},
|
|
4959
5094
|
"chrome-location2" (module) {
|
|
4960
5095
|
module.exports = require("chrome-location2");
|
|
4961
5096
|
},
|