extension 3.13.5 → 3.14.0-next.0
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/{728.cjs → 631.cjs} +130 -23
- package/dist/browsers.cjs +209 -45
- package/dist/cli.cjs +324 -108
- package/dist/extension/browsers/browsers-types.d.ts +1 -1
- package/dist/extension/browsers/index.d.ts +4 -1
- package/dist/extension/browsers/run-chromium/chromium-launch/setup-cdp-after-launch.d.ts +5 -1
- package/dist/extension/browsers/run-chromium/chromium-launch/wsl-support.d.ts +2 -2
- package/dist/extension/browsers/run-chromium/chromium-source-inspection/cdp-client.d.ts +7 -0
- package/dist/extension/browsers/run-chromium/chromium-source-inspection/cdp-extension-controller/connect.d.ts +3 -1
- package/dist/extension/browsers/run-chromium/chromium-source-inspection/cdp-extension-controller/index.d.ts +5 -0
- package/dist/extension/browsers/run-chromium/chromium-source-inspection/discovery.d.ts +1 -1
- package/dist/extension/browsers/run-firefox/firefox-launch/binary-detector.d.ts +3 -0
- package/dist/extension/browsers/run-firefox/firefox-source-inspection/remote-firefox/transport.d.ts +1 -1
- package/dist/extension/helpers/messages.d.ts +8 -1
- package/package.json +4 -4
package/dist/browsers.cjs
CHANGED
|
@@ -209,6 +209,7 @@ var __webpack_modules__ = {
|
|
|
209
209
|
},
|
|
210
210
|
"./browsers/browsers-lib/content-script-contracts.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
211
211
|
__webpack_require__.d(__webpack_exports__, {
|
|
212
|
+
F: ()=>CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX,
|
|
212
213
|
Y: ()=>getCanonicalContentScriptEntryName
|
|
213
214
|
});
|
|
214
215
|
const CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX = "content_scripts/content-";
|
|
@@ -218,12 +219,23 @@ var __webpack_modules__ = {
|
|
|
218
219
|
},
|
|
219
220
|
"./browsers/browsers-lib/content-script-targets.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
220
221
|
__webpack_require__.d(__webpack_exports__, {
|
|
222
|
+
Il: ()=>selectContentScriptRules,
|
|
223
|
+
iw: ()=>readContentScriptRules,
|
|
221
224
|
lM: ()=>urlMatchesAnyContentScriptRule,
|
|
222
225
|
nG: ()=>resolveEmittedContentScriptFile
|
|
223
226
|
});
|
|
224
227
|
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
225
228
|
var path__rspack_import_1 = __webpack_require__("path");
|
|
226
229
|
var _content_script_contracts__rspack_import_2 = __webpack_require__("./browsers/browsers-lib/content-script-contracts.ts");
|
|
230
|
+
function isCanonicalContentScriptEntryName(entryName) {
|
|
231
|
+
return 'string' == typeof entryName && entryName.startsWith(_content_script_contracts__rspack_import_2.F);
|
|
232
|
+
}
|
|
233
|
+
function parseCanonicalContentScriptEntryIndex(entryName) {
|
|
234
|
+
if (!isCanonicalContentScriptEntryName(entryName)) return;
|
|
235
|
+
const suffix = entryName.slice(_content_script_contracts__rspack_import_2.F.length);
|
|
236
|
+
const index = Number(suffix);
|
|
237
|
+
return Number.isInteger(index) && index >= 0 ? index : void 0;
|
|
238
|
+
}
|
|
227
239
|
function getCanonicalContentScriptJsAssetName(index) {
|
|
228
240
|
return `${(0, _content_script_contracts__rspack_import_2.Y)(index)}.js`;
|
|
229
241
|
}
|
|
@@ -242,6 +254,29 @@ var __webpack_modules__ = {
|
|
|
242
254
|
} catch {}
|
|
243
255
|
return null;
|
|
244
256
|
}
|
|
257
|
+
function readContentScriptRules(compilation, extensionRoot) {
|
|
258
|
+
const manifest = readManifestFromCompilation(compilation) || readManifestFromDisk(extensionRoot) || {};
|
|
259
|
+
return getContentScriptRulesFromManifest(manifest);
|
|
260
|
+
}
|
|
261
|
+
function getContentScriptRulesFromManifest(manifest) {
|
|
262
|
+
const contentScripts = Array.isArray(manifest?.content_scripts) ? manifest.content_scripts : [];
|
|
263
|
+
return contentScripts.map((contentScript, index)=>({
|
|
264
|
+
index,
|
|
265
|
+
world: contentScript?.world === 'MAIN' ? 'main' : 'extension',
|
|
266
|
+
matches: normalizeStringArray(contentScript?.matches),
|
|
267
|
+
excludeMatches: normalizeStringArray(contentScript?.exclude_matches),
|
|
268
|
+
includeGlobs: normalizeStringArray(contentScript?.include_globs),
|
|
269
|
+
excludeGlobs: normalizeStringArray(contentScript?.exclude_globs)
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
function selectContentScriptRules(rules, entryNames) {
|
|
273
|
+
const selectedIndices = new Set();
|
|
274
|
+
for (const entryName of entryNames){
|
|
275
|
+
const index = parseCanonicalContentScriptEntryIndex(entryName);
|
|
276
|
+
if (void 0 !== index) selectedIndices.add(index);
|
|
277
|
+
}
|
|
278
|
+
return rules.filter((rule)=>selectedIndices.has(rule.index));
|
|
279
|
+
}
|
|
245
280
|
function urlMatchesContentScriptRule(rawUrl, rule) {
|
|
246
281
|
const url = safeParseUrl(rawUrl);
|
|
247
282
|
if (!url) return false;
|
|
@@ -254,6 +289,28 @@ var __webpack_modules__ = {
|
|
|
254
289
|
function urlMatchesAnyContentScriptRule(rawUrl, rules) {
|
|
255
290
|
return rules.some((rule)=>urlMatchesContentScriptRule(rawUrl, rule));
|
|
256
291
|
}
|
|
292
|
+
function readManifestFromCompilation(compilation) {
|
|
293
|
+
try {
|
|
294
|
+
const asset = compilation.getAsset?.('manifest.json');
|
|
295
|
+
if (!asset?.source) return;
|
|
296
|
+
return JSON.parse(String(asset.source.source()));
|
|
297
|
+
} catch {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function readManifestFromDisk(extensionRoot) {
|
|
302
|
+
if (!extensionRoot) return;
|
|
303
|
+
try {
|
|
304
|
+
const manifestPath = path__rspack_import_1.join(extensionRoot, 'manifest.json');
|
|
305
|
+
if (!fs__rspack_import_0.existsSync(manifestPath)) return;
|
|
306
|
+
return JSON.parse(fs__rspack_import_0.readFileSync(manifestPath, 'utf8'));
|
|
307
|
+
} catch {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function normalizeStringArray(input) {
|
|
312
|
+
return Array.isArray(input) ? input.filter((value)=>'string' == typeof value).map((value)=>value.trim()).filter(Boolean) : [];
|
|
313
|
+
}
|
|
257
314
|
function safeParseUrl(rawUrl) {
|
|
258
315
|
try {
|
|
259
316
|
return new URL(rawUrl);
|
|
@@ -1442,7 +1499,8 @@ var __webpack_modules__ = {
|
|
|
1442
1499
|
'--disable-sync',
|
|
1443
1500
|
'--no-pings',
|
|
1444
1501
|
'--enable-features=SidePanelUpdates',
|
|
1445
|
-
'--disable-features=DisableLoadExtensionCommandLineSwitch'
|
|
1502
|
+
'--disable-features=DisableLoadExtensionCommandLineSwitch',
|
|
1503
|
+
'--enable-unsafe-extension-debugging'
|
|
1446
1504
|
];
|
|
1447
1505
|
function isPlainObject(value) {
|
|
1448
1506
|
return !!value && 'object' == typeof value && !Array.isArray(value);
|
|
@@ -1541,7 +1599,8 @@ var __webpack_modules__ = {
|
|
|
1541
1599
|
const excludeFlags = configOptions.excludeBrowserFlags || [];
|
|
1542
1600
|
const filteredFlags = (0, shared_utils.ov)(DEFAULT_BROWSER_FLAGS, excludeFlags);
|
|
1543
1601
|
const cdpPort = (0, shared_utils.jl)(configOptions.port, configOptions.instanceId);
|
|
1544
|
-
const
|
|
1602
|
+
const isLinuxContainer = 'linux' === process.platform && ('true' === process.env.CI || external_fs_.existsSync('/.dockerenv') || external_fs_.existsSync('/run/.containerenv') || 'true' === process.env.REMOTE_CONTAINERS || 'true' === process.env.CODESPACES || null != process.env.container);
|
|
1603
|
+
const linuxContainerSandboxFlags = isLinuxContainer ? [
|
|
1545
1604
|
'--no-sandbox',
|
|
1546
1605
|
'--disable-setuid-sandbox'
|
|
1547
1606
|
] : [];
|
|
@@ -1561,11 +1620,12 @@ var __webpack_modules__ = {
|
|
|
1561
1620
|
...userProfilePath ? [
|
|
1562
1621
|
`--user-data-dir=${userProfilePath}`
|
|
1563
1622
|
] : [],
|
|
1564
|
-
...
|
|
1623
|
+
...linuxContainerSandboxFlags,
|
|
1565
1624
|
...aiOptimizedFlags,
|
|
1566
1625
|
...sourceEnabled || devWantsCDP ? [
|
|
1567
1626
|
`--remote-debugging-port=${cdpPort}`,
|
|
1568
|
-
'--remote-debugging-address=127.0.0.1'
|
|
1627
|
+
'--remote-debugging-address=127.0.0.1',
|
|
1628
|
+
'--remote-debugging-pipe'
|
|
1569
1629
|
] : [],
|
|
1570
1630
|
...filteredFlags,
|
|
1571
1631
|
...configOptions.browserFlags || []
|
|
@@ -2011,8 +2071,13 @@ var __webpack_modules__ = {
|
|
|
2011
2071
|
enableCdp
|
|
2012
2072
|
});
|
|
2013
2073
|
if (this.options.dryRun) return void logChromiumDryRun(browserBinaryLocation, chromiumConfig);
|
|
2014
|
-
|
|
2015
|
-
|
|
2074
|
+
const usePipe = chromiumConfig.includes('--remote-debugging-pipe');
|
|
2075
|
+
const child = await this.launchWithDirectSpawn(browserBinaryLocation, chromiumConfig, usePipe);
|
|
2076
|
+
const pipeStreams = usePipe && child?.stdio?.[3] && child?.stdio?.[4] ? {
|
|
2077
|
+
input: child.stdio[4],
|
|
2078
|
+
output: child.stdio[3]
|
|
2079
|
+
} : void 0;
|
|
2080
|
+
if (enableCdp && !pipeStreams) {
|
|
2016
2081
|
let portReady = false;
|
|
2017
2082
|
for(let attempt = 0; attempt < 10; attempt++){
|
|
2018
2083
|
portReady = await (0, discovery.z)(selectedPort);
|
|
@@ -2056,15 +2121,15 @@ var __webpack_modules__ = {
|
|
|
2056
2121
|
browserVersionLine
|
|
2057
2122
|
};
|
|
2058
2123
|
if (enableCdp) {
|
|
2059
|
-
const mod = await __webpack_require__.e("
|
|
2060
|
-
await mod.setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig);
|
|
2124
|
+
const mod = await __webpack_require__.e("631").then(__webpack_require__.bind(__webpack_require__, "./browsers/run-chromium/chromium-launch/setup-cdp-after-launch.ts"));
|
|
2125
|
+
await mod.setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig, pipeStreams);
|
|
2061
2126
|
if (cdpConfig.cdpController) this.ctx.setController(cdpConfig.cdpController, selectedPort);
|
|
2062
2127
|
}
|
|
2063
2128
|
} catch (error) {
|
|
2064
2129
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn('[browser] CDP post-launch setup failed:', String(error));
|
|
2065
2130
|
}
|
|
2066
2131
|
}
|
|
2067
|
-
async launchWithDirectSpawn(binary, chromeFlags) {
|
|
2132
|
+
async launchWithDirectSpawn(binary, chromeFlags, usePipe = false) {
|
|
2068
2133
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.info(messages.xyq());
|
|
2069
2134
|
const launchArgs = this.options?.startingUrl ? [
|
|
2070
2135
|
...chromeFlags,
|
|
@@ -2072,7 +2137,13 @@ var __webpack_modules__ = {
|
|
|
2072
2137
|
] : [
|
|
2073
2138
|
...chromeFlags
|
|
2074
2139
|
];
|
|
2075
|
-
const stdio =
|
|
2140
|
+
const stdio = usePipe ? [
|
|
2141
|
+
'ignore',
|
|
2142
|
+
'ignore',
|
|
2143
|
+
'ignore',
|
|
2144
|
+
'pipe',
|
|
2145
|
+
'pipe'
|
|
2146
|
+
] : 'ignore';
|
|
2076
2147
|
const normalizedBinary = normalizeBinaryPathForWsl(binary);
|
|
2077
2148
|
try {
|
|
2078
2149
|
const child = await spawnChromiumProcess({
|
|
@@ -2090,6 +2161,7 @@ var __webpack_modules__ = {
|
|
|
2090
2161
|
this.logger.error(messages.Cny(error));
|
|
2091
2162
|
});
|
|
2092
2163
|
setupProcessSignalHandlers(this.options?.browser, child, ()=>{});
|
|
2164
|
+
return child;
|
|
2093
2165
|
} catch (error) {
|
|
2094
2166
|
this.logger.error(messages.wk1(error));
|
|
2095
2167
|
throw error;
|
|
@@ -2181,7 +2253,7 @@ var __webpack_modules__ = {
|
|
|
2181
2253
|
}
|
|
2182
2254
|
throw new Error('No CDP WebSocket URL available');
|
|
2183
2255
|
}
|
|
2184
|
-
async function checkChromeRemoteDebugging(port = 9222) {
|
|
2256
|
+
async function checkChromeRemoteDebugging(port = 9222, host = '127.0.0.1') {
|
|
2185
2257
|
return new Promise((resolve)=>{
|
|
2186
2258
|
const socket = new external_net_.Socket();
|
|
2187
2259
|
socket.on('connect', ()=>{
|
|
@@ -2196,7 +2268,7 @@ var __webpack_modules__ = {
|
|
|
2196
2268
|
resolve(false);
|
|
2197
2269
|
});
|
|
2198
2270
|
socket.setTimeout(2000);
|
|
2199
|
-
socket.connect(port,
|
|
2271
|
+
socket.connect(port, host);
|
|
2200
2272
|
});
|
|
2201
2273
|
}
|
|
2202
2274
|
},
|
|
@@ -2513,14 +2585,14 @@ var __webpack_modules__ = {
|
|
|
2513
2585
|
return obj;
|
|
2514
2586
|
}
|
|
2515
2587
|
class RdpTransport extends external_events_default() {
|
|
2516
|
-
async connect(port) {
|
|
2588
|
+
async connect(port, host = '127.0.0.1') {
|
|
2517
2589
|
await new Promise((resolve, reject)=>{
|
|
2518
2590
|
try {
|
|
2519
2591
|
const c = external_net_default().createConnection({
|
|
2520
|
-
host
|
|
2592
|
+
host,
|
|
2521
2593
|
port
|
|
2522
2594
|
}, ()=>{
|
|
2523
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages.EIQ(
|
|
2595
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages.EIQ(host, port));
|
|
2524
2596
|
resolve();
|
|
2525
2597
|
});
|
|
2526
2598
|
this.conn = c;
|
|
@@ -4167,8 +4239,40 @@ var __webpack_modules__ = {
|
|
|
4167
4239
|
}
|
|
4168
4240
|
const external_util_namespaceObject = require("util");
|
|
4169
4241
|
const execFile = (0, external_util_namespaceObject.promisify)(external_child_process_.execFile);
|
|
4242
|
+
function parseFlatpakBinary(binary) {
|
|
4243
|
+
if (!binary || !binary.startsWith('flatpak:')) return null;
|
|
4244
|
+
const appId = binary.substring(8).trim();
|
|
4245
|
+
return appId ? {
|
|
4246
|
+
appId
|
|
4247
|
+
} : null;
|
|
4248
|
+
}
|
|
4170
4249
|
class FirefoxBinaryDetector {
|
|
4171
4250
|
static generateFirefoxArgs(binaryPath, profilePath, debugPort, additionalArgs = []) {
|
|
4251
|
+
const flatpak = parseFlatpakBinary(binaryPath);
|
|
4252
|
+
if (flatpak) {
|
|
4253
|
+
const args = [
|
|
4254
|
+
'run',
|
|
4255
|
+
`--filesystem=${profilePath}`,
|
|
4256
|
+
flatpak.appId,
|
|
4257
|
+
'--no-remote',
|
|
4258
|
+
'--new-instance',
|
|
4259
|
+
'-profile',
|
|
4260
|
+
profilePath,
|
|
4261
|
+
...debugPort > 0 ? [
|
|
4262
|
+
'-start-debugger-server',
|
|
4263
|
+
String(debugPort)
|
|
4264
|
+
] : [],
|
|
4265
|
+
'--foreground',
|
|
4266
|
+
'--disable-background-timer-throttling',
|
|
4267
|
+
'--disable-backgrounding-occluded-windows',
|
|
4268
|
+
'--disable-renderer-backgrounding',
|
|
4269
|
+
...additionalArgs
|
|
4270
|
+
];
|
|
4271
|
+
return {
|
|
4272
|
+
binary: 'flatpak',
|
|
4273
|
+
args
|
|
4274
|
+
};
|
|
4275
|
+
}
|
|
4172
4276
|
const args = [
|
|
4173
4277
|
'--no-remote',
|
|
4174
4278
|
'--new-instance',
|
|
@@ -4372,11 +4476,15 @@ var __webpack_modules__ = {
|
|
|
4372
4476
|
}
|
|
4373
4477
|
}
|
|
4374
4478
|
try {
|
|
4375
|
-
if (this.host.geckoBinary && 'string' == typeof this.host.geckoBinary) {
|
|
4479
|
+
if (this.host.geckoBinary && 'string' == typeof this.host.geckoBinary) if (parseFlatpakBinary(this.host.geckoBinary)) {
|
|
4480
|
+
browserBinaryLocation = this.host.geckoBinary;
|
|
4481
|
+
skipDetection = true;
|
|
4482
|
+
} else {
|
|
4376
4483
|
const normalized = normalizePath(this.host.geckoBinary);
|
|
4377
4484
|
if (normalized) browserBinaryLocation = normalized;
|
|
4378
4485
|
else failGeckoBinaryRequirement();
|
|
4379
|
-
}
|
|
4486
|
+
}
|
|
4487
|
+
else if (!skipDetection) if (engineBased) failGeckoBinaryRequirement();
|
|
4380
4488
|
else {
|
|
4381
4489
|
const cacheRoot = (0, output_binaries_resolver.LB)(compilation);
|
|
4382
4490
|
const env = {
|
|
@@ -4392,7 +4500,8 @@ var __webpack_modules__ = {
|
|
|
4392
4500
|
} catch (_error) {
|
|
4393
4501
|
failGeckoBinaryRequirement();
|
|
4394
4502
|
}
|
|
4395
|
-
|
|
4503
|
+
const isFlatpak = !!parseFlatpakBinary(browserBinaryLocation || '');
|
|
4504
|
+
if (!isFlatpak && (!browserBinaryLocation || !browserBinaryLocation.trim() || !external_fs_.existsSync(browserBinaryLocation))) {
|
|
4396
4505
|
const normalizedFallback = resolveManagedBinary();
|
|
4397
4506
|
if (normalizedFallback) browserBinaryLocation = normalizedFallback;
|
|
4398
4507
|
else if (engineBased || this.host.geckoBinary) failGeckoBinaryRequirement();
|
|
@@ -4407,14 +4516,16 @@ var __webpack_modules__ = {
|
|
|
4407
4516
|
}
|
|
4408
4517
|
const binaryPath = browserBinaryLocation;
|
|
4409
4518
|
const wslFallbackBinary = isWslEnv() && !engineBased ? resolveWslFallback() : null;
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4519
|
+
if (!isFlatpak) {
|
|
4520
|
+
try {
|
|
4521
|
+
this.host.browserVersionLine = (0, external_firefox_location2_.getFirefoxVersion)(binaryPath, {
|
|
4522
|
+
allowExec: true
|
|
4523
|
+
}) || '';
|
|
4524
|
+
} catch {}
|
|
4525
|
+
try {
|
|
4526
|
+
await FirefoxBinaryDetector.validateFirefoxBinary(binaryPath);
|
|
4527
|
+
} catch {}
|
|
4528
|
+
}
|
|
4418
4529
|
const extensionsToLoad = (0, runtime_options.fT)(this.host.extension);
|
|
4419
4530
|
(0, runtime_options.sl)(extensionsToLoad, 'function' == typeof this.ctx.setExtensionRoot ? this.ctx.setExtensionRoot : void 0);
|
|
4420
4531
|
const desiredDebugPort = (0, shared_utils.jl)(this.host.port, this.host.instanceId);
|
|
@@ -4805,15 +4916,16 @@ var __webpack_exports__ = {};
|
|
|
4805
4916
|
__webpack_require__.r(__webpack_exports__);
|
|
4806
4917
|
__webpack_require__.d(__webpack_exports__, {
|
|
4807
4918
|
launchBrowser: ()=>launchBrowser,
|
|
4808
|
-
runOnlyPreviewBrowser: ()=>
|
|
4919
|
+
runOnlyPreviewBrowser: ()=>_run_only__rspack_import_4.E
|
|
4809
4920
|
});
|
|
4810
4921
|
var _browsers_lib_output_binaries_resolver__rspack_import_0 = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
4811
|
-
var
|
|
4812
|
-
var
|
|
4813
|
-
var
|
|
4814
|
-
var
|
|
4815
|
-
var
|
|
4816
|
-
var
|
|
4922
|
+
var _browsers_lib_runtime_options__rspack_import_7 = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
|
|
4923
|
+
var _browsers_lib_content_script_targets__rspack_import_1 = __webpack_require__("./browsers/browsers-lib/content-script-targets.ts");
|
|
4924
|
+
var _run_chromium_chromium_context__rspack_import_5 = __webpack_require__("./browsers/run-chromium/chromium-context/index.ts");
|
|
4925
|
+
var _run_chromium_chromium_launch__rspack_import_2 = __webpack_require__("./browsers/run-chromium/chromium-launch/index.ts");
|
|
4926
|
+
var _run_firefox_firefox_context__rspack_import_6 = __webpack_require__("./browsers/run-firefox/firefox-context/index.ts");
|
|
4927
|
+
var _run_firefox_firefox_launch__rspack_import_3 = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
|
|
4928
|
+
var _run_only__rspack_import_4 = __webpack_require__("./browsers/run-only.ts");
|
|
4817
4929
|
function createCompilationLike(opts) {
|
|
4818
4930
|
return {
|
|
4819
4931
|
options: {
|
|
@@ -4828,6 +4940,12 @@ var __webpack_exports__ = {};
|
|
|
4828
4940
|
}
|
|
4829
4941
|
};
|
|
4830
4942
|
}
|
|
4943
|
+
function resolveContentScriptRulesForReload(compilationLike, extensionsToLoad, entries) {
|
|
4944
|
+
if (!entries || 0 === entries.length) return [];
|
|
4945
|
+
const extensionRoot = extensionsToLoad?.[0];
|
|
4946
|
+
const rules = (0, _browsers_lib_content_script_targets__rspack_import_1.iw)(compilationLike, extensionRoot);
|
|
4947
|
+
return (0, _browsers_lib_content_script_targets__rspack_import_1.Il)(rules, entries);
|
|
4948
|
+
}
|
|
4831
4949
|
function isChromiumBrowser(browser) {
|
|
4832
4950
|
return 'chrome' === browser || 'edge' === browser || 'chromium' === browser || 'chromium-based' === browser;
|
|
4833
4951
|
}
|
|
@@ -4877,8 +4995,8 @@ var __webpack_exports__ = {};
|
|
|
4877
4995
|
logUrl: opts.logUrl,
|
|
4878
4996
|
logTab: opts.logTab
|
|
4879
4997
|
};
|
|
4880
|
-
const ctx = (0,
|
|
4881
|
-
const launcher = new
|
|
4998
|
+
const ctx = (0, _run_chromium_chromium_context__rspack_import_5.g)();
|
|
4999
|
+
const launcher = new _run_chromium_chromium_launch__rspack_import_2.f(chromiumOpts, ctx);
|
|
4882
5000
|
const enableCdp = 'development' === mode;
|
|
4883
5001
|
await launcher.runOnce(compilationLike, {
|
|
4884
5002
|
enableCdpPostLaunch: enableCdp
|
|
@@ -4890,7 +5008,11 @@ var __webpack_exports__ = {};
|
|
|
4890
5008
|
if (!cdpController) return;
|
|
4891
5009
|
if (instruction?.type === "content-scripts") {
|
|
4892
5010
|
const ctrl = cdpController;
|
|
4893
|
-
if ('function' == typeof ctrl.reloadMatchingTabsForContentScripts)
|
|
5011
|
+
if ('function' == typeof ctrl.reloadMatchingTabsForContentScripts) {
|
|
5012
|
+
const rules = resolveContentScriptRulesForReload(compilationLike, opts.extensionsToLoad, instruction.changedContentScriptEntries);
|
|
5013
|
+
await ctrl.reloadMatchingTabsForContentScripts(rules);
|
|
5014
|
+
return;
|
|
5015
|
+
}
|
|
4894
5016
|
}
|
|
4895
5017
|
const ctrl = cdpController;
|
|
4896
5018
|
if ('function' == typeof ctrl.hardReload) await ctrl.hardReload(instruction?.changedAssets);
|
|
@@ -4905,8 +5027,7 @@ var __webpack_exports__ = {};
|
|
|
4905
5027
|
urlFilter: logOpts.urlFilter,
|
|
4906
5028
|
tabFilter: logOpts.tabFilter
|
|
4907
5029
|
});
|
|
4908
|
-
}
|
|
4909
|
-
async close () {}
|
|
5030
|
+
}
|
|
4910
5031
|
};
|
|
4911
5032
|
}
|
|
4912
5033
|
async function launchFirefox(opts, compilationLike, mode) {
|
|
@@ -4920,7 +5041,27 @@ var __webpack_exports__ = {};
|
|
|
4920
5041
|
geckoBinary: opts.geckoBinary,
|
|
4921
5042
|
instanceId: opts.instanceId,
|
|
4922
5043
|
port: opts.port,
|
|
4923
|
-
dryRun: opts.dryRun
|
|
5044
|
+
dryRun: opts.dryRun,
|
|
5045
|
+
source: opts.source,
|
|
5046
|
+
watchSource: opts.watchSource,
|
|
5047
|
+
sourceFormat: opts.sourceFormat,
|
|
5048
|
+
sourceSummary: opts.sourceSummary,
|
|
5049
|
+
sourceMeta: opts.sourceMeta,
|
|
5050
|
+
sourceProbe: opts.sourceProbe,
|
|
5051
|
+
sourceTree: opts.sourceTree,
|
|
5052
|
+
sourceConsole: opts.sourceConsole,
|
|
5053
|
+
sourceDom: opts.sourceDom,
|
|
5054
|
+
sourceMaxBytes: opts.sourceMaxBytes,
|
|
5055
|
+
sourceRedact: opts.sourceRedact,
|
|
5056
|
+
sourceIncludeShadow: opts.sourceIncludeShadow,
|
|
5057
|
+
sourceDiff: opts.sourceDiff,
|
|
5058
|
+
logLevel: opts.logLevel,
|
|
5059
|
+
logContexts: opts.logContexts,
|
|
5060
|
+
logFormat: opts.logFormat,
|
|
5061
|
+
logTimestamps: opts.logTimestamps,
|
|
5062
|
+
logColor: opts.logColor,
|
|
5063
|
+
logUrl: opts.logUrl,
|
|
5064
|
+
logTab: opts.logTab
|
|
4924
5065
|
};
|
|
4925
5066
|
const pluginOptions = {
|
|
4926
5067
|
extension: opts.extensionsToLoad,
|
|
@@ -4937,17 +5078,40 @@ var __webpack_exports__ = {};
|
|
|
4937
5078
|
port: opts.port,
|
|
4938
5079
|
dryRun: opts.dryRun
|
|
4939
5080
|
};
|
|
4940
|
-
const ctx = (0,
|
|
4941
|
-
const launcher = new
|
|
4942
|
-
const launchRequest = (0,
|
|
5081
|
+
const ctx = (0, _run_firefox_firefox_context__rspack_import_6.D)();
|
|
5082
|
+
const launcher = new _run_firefox_firefox_launch__rspack_import_3.c(firefoxOpts, ctx);
|
|
5083
|
+
const launchRequest = (0, _browsers_lib_runtime_options__rspack_import_7.zU)(pluginOptions, mode, {
|
|
4943
5084
|
persistProfile: opts.persistProfile,
|
|
4944
5085
|
geckoBinary: opts.geckoBinary
|
|
4945
5086
|
});
|
|
4946
5087
|
await launcher.runOnce(compilationLike, launchRequest);
|
|
5088
|
+
const rdpController = ctx.getController?.();
|
|
4947
5089
|
return {
|
|
4948
|
-
async reload () {
|
|
4949
|
-
|
|
4950
|
-
|
|
5090
|
+
async reload (instruction) {
|
|
5091
|
+
if (!rdpController) return;
|
|
5092
|
+
if (instruction?.type === "content-scripts") {
|
|
5093
|
+
const rules = resolveContentScriptRulesForReload(compilationLike, opts.extensionsToLoad, instruction.changedContentScriptEntries);
|
|
5094
|
+
try {
|
|
5095
|
+
await rdpController.reloadMatchingTabsForContentScripts(rules);
|
|
5096
|
+
return;
|
|
5097
|
+
} catch {}
|
|
5098
|
+
}
|
|
5099
|
+
try {
|
|
5100
|
+
await rdpController.hardReload(compilationLike, instruction?.changedAssets || []);
|
|
5101
|
+
} catch {}
|
|
5102
|
+
},
|
|
5103
|
+
async enableUnifiedLogging (logOpts) {
|
|
5104
|
+
if (!rdpController?.enableUnifiedLogging) return;
|
|
5105
|
+
await rdpController.enableUnifiedLogging({
|
|
5106
|
+
level: logOpts.level,
|
|
5107
|
+
contexts: logOpts.contexts,
|
|
5108
|
+
format: logOpts.format,
|
|
5109
|
+
timestamps: logOpts.timestamps,
|
|
5110
|
+
color: logOpts.color,
|
|
5111
|
+
urlFilter: logOpts.urlFilter,
|
|
5112
|
+
tabFilter: logOpts.tabFilter
|
|
5113
|
+
});
|
|
5114
|
+
}
|
|
4951
5115
|
};
|
|
4952
5116
|
}
|
|
4953
5117
|
})();
|