extension-develop 2.0.4 → 2.1.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/module.js
CHANGED
|
@@ -177,6 +177,18 @@ var __webpack_modules__ = {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
getExtensionPath(instanceId) {
|
|
180
|
+
try {
|
|
181
|
+
const InstanceManager = __webpack_require__("./webpack/plugin-browsers/browsers-lib/instance-manager.ts").InstanceManager;
|
|
182
|
+
new InstanceManager(this.projectPath);
|
|
183
|
+
const registryPath = path__WEBPACK_IMPORTED_MODULE_2__.join(__webpack_require__("os").homedir(), 'Library', 'Application Support', 'extension-js', 'instances.json');
|
|
184
|
+
if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(registryPath)) try {
|
|
185
|
+
var _data_instances;
|
|
186
|
+
const raw = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(registryPath, 'utf-8');
|
|
187
|
+
const data = JSON.parse(raw);
|
|
188
|
+
const info = null == (_data_instances = data.instances) ? void 0 : _data_instances[instanceId];
|
|
189
|
+
if (info && info.browser && 'number' == typeof info.port) return path__WEBPACK_IMPORTED_MODULE_2__.join(this.userExtensionsPath, `${info.browser}-manager-${info.port}`);
|
|
190
|
+
} catch {}
|
|
191
|
+
} catch {}
|
|
180
192
|
return path__WEBPACK_IMPORTED_MODULE_2__.join(this.userExtensionsPath, `manager-port-${instanceId}`);
|
|
181
193
|
}
|
|
182
194
|
async extensionExists(instanceId) {
|
|
@@ -195,7 +207,7 @@ var __webpack_modules__ = {
|
|
|
195
207
|
async regenerateExtensionIfNeeded(instance) {
|
|
196
208
|
const exists = await this.extensionExists(instance.instanceId);
|
|
197
209
|
if (!exists) return await this.generateExtension(instance);
|
|
198
|
-
const extensionPath = this.
|
|
210
|
+
const extensionPath = path__WEBPACK_IMPORTED_MODULE_2__.join(this.userExtensionsPath, `${instance.browser}-manager-${instance.port}`);
|
|
199
211
|
const serviceWorkerPath = path__WEBPACK_IMPORTED_MODULE_2__.join(extensionPath, 'reload-service.js');
|
|
200
212
|
try {
|
|
201
213
|
const content = await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(serviceWorkerPath, 'utf-8');
|
|
@@ -483,6 +495,18 @@ var __webpack_modules__ = {
|
|
|
483
495
|
if ('development' === process.env.EXTENSION_ENV) console.log(_webpack_webpack_lib_messages__WEBPACK_IMPORTED_MODULE_5__.JJ());
|
|
484
496
|
}
|
|
485
497
|
async createInstance(browser, projectPath, requestedPort) {
|
|
498
|
+
const lockPath = path__WEBPACK_IMPORTED_MODULE_1__.join(this.getDataDirectory(), 'instances.lock');
|
|
499
|
+
let lockHandle = null;
|
|
500
|
+
for(let attempt = 0; attempt < 10; attempt++)try {
|
|
501
|
+
lockHandle = await (await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "fs/promises", 23))).open(lockPath, 'wx');
|
|
502
|
+
break;
|
|
503
|
+
} catch (err) {
|
|
504
|
+
if (err && 'EEXIST' === err.code) {
|
|
505
|
+
await new Promise((r)=>setTimeout(r, 25 * (attempt + 1)));
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
throw err;
|
|
509
|
+
}
|
|
486
510
|
if ('development' === process.env.EXTENSION_ENV) console.log(_webpack_webpack_lib_messages__WEBPACK_IMPORTED_MODULE_5__.jE({
|
|
487
511
|
browser,
|
|
488
512
|
projectPath,
|
|
@@ -509,6 +533,10 @@ var __webpack_modules__ = {
|
|
|
509
533
|
await this.saveRegistry(registry);
|
|
510
534
|
await this.monitorProcessHealth(instanceId);
|
|
511
535
|
if ('development' === process.env.EXTENSION_ENV) console.log(_webpack_webpack_lib_messages__WEBPACK_IMPORTED_MODULE_5__.pU(registry));
|
|
536
|
+
try {
|
|
537
|
+
if (lockHandle && 'function' == typeof lockHandle.close) await lockHandle.close();
|
|
538
|
+
await (await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "fs/promises", 23))).unlink(lockPath);
|
|
539
|
+
} catch {}
|
|
512
540
|
return instance;
|
|
513
541
|
}
|
|
514
542
|
async updateInstance(instanceId, updates) {
|
|
@@ -613,6 +641,7 @@ var __webpack_modules__ = {
|
|
|
613
641
|
ET: ()=>sourceInspectorFileChanged,
|
|
614
642
|
El: ()=>firefoxFailedToStart,
|
|
615
643
|
F0: ()=>sourceInspectorUsingExistingTarget,
|
|
644
|
+
G$: ()=>devFirefoxProfilePath,
|
|
616
645
|
G9: ()=>sourceInspectorStartingWatchMode,
|
|
617
646
|
GB: ()=>cdpClientExtensionReloadFailed,
|
|
618
647
|
GR: ()=>sourceInspectorAttachedToTarget,
|
|
@@ -662,6 +691,7 @@ var __webpack_modules__ = {
|
|
|
662
691
|
Ym: ()=>sourceInspectorUrlRequired,
|
|
663
692
|
Yw: ()=>sourceInspectorChromeNotReadyYet,
|
|
664
693
|
ZM: ()=>firefoxBinaryArgsExtracted,
|
|
694
|
+
ZZ: ()=>devFirefoxDebugPort,
|
|
665
695
|
Zk: ()=>sourceInspectorOpeningUrl,
|
|
666
696
|
_A: ()=>enhancedProcessManagementTerminating,
|
|
667
697
|
_C: ()=>cdpClientCheckingShadowDOM,
|
|
@@ -710,6 +740,7 @@ var __webpack_modules__ = {
|
|
|
710
740
|
uc: ()=>enhancedProcessManagementInstanceCleanupComplete,
|
|
711
741
|
v5: ()=>sourceInspectorCreatingTarget,
|
|
712
742
|
w4: ()=>sourceInspectorReconnectionFailed,
|
|
743
|
+
x: ()=>devChromiumDebugPort,
|
|
713
744
|
xQ: ()=>runningInDevelopment,
|
|
714
745
|
xR: ()=>sourceInspectorEnablingPageDomain,
|
|
715
746
|
y4: ()=>sourceInspectorSetupFailed,
|
|
@@ -1103,13 +1134,21 @@ var __webpack_modules__ = {
|
|
|
1103
1134
|
function emptyLine() {
|
|
1104
1135
|
return '';
|
|
1105
1136
|
}
|
|
1137
|
+
function devChromiumDebugPort(finalPort, requestedPort) {
|
|
1138
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta('Dev')} Chromium debug port: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(finalPort.toString())} (requested ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(requestedPort.toString())})`;
|
|
1139
|
+
}
|
|
1140
|
+
function devFirefoxDebugPort(finalPort, requestedPort) {
|
|
1141
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta('Dev')} Firefox debug port: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(finalPort.toString())} (requested ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(requestedPort.toString())})`;
|
|
1142
|
+
}
|
|
1143
|
+
function devFirefoxProfilePath(profilePath) {
|
|
1144
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta('Dev')} Firefox profile: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(profilePath)}`;
|
|
1145
|
+
}
|
|
1106
1146
|
},
|
|
1107
1147
|
"./webpack/plugin-browsers/browsers-lib/shared-utils.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1108
1148
|
__webpack_require__.d(__webpack_exports__, {
|
|
1109
|
-
c5: ()=>calculateDebugPort,
|
|
1110
1149
|
gB: ()=>filterBrowserFlags,
|
|
1111
|
-
tu: ()=>chooseEffectiveInstanceId,
|
|
1112
1150
|
rX: ()=>isChromiumProfileLocked,
|
|
1151
|
+
tu: ()=>chooseEffectiveInstanceId,
|
|
1113
1152
|
_v: ()=>mergePreferences,
|
|
1114
1153
|
x$: ()=>validateProfilePath,
|
|
1115
1154
|
km: ()=>findAvailablePortNear,
|
|
@@ -1211,7 +1250,7 @@ var __webpack_modules__ = {
|
|
|
1211
1250
|
}
|
|
1212
1251
|
function chooseEffectiveInstanceId(reuseRequested, _concurrent, lockPresent, instanceId) {
|
|
1213
1252
|
const reuse = void 0 === reuseRequested ? true : !!reuseRequested;
|
|
1214
|
-
const canShare = reuse && !lockPresent;
|
|
1253
|
+
const canShare = reuse && !_concurrent && !lockPresent;
|
|
1215
1254
|
return canShare ? void 0 : instanceId;
|
|
1216
1255
|
}
|
|
1217
1256
|
function calculateDebugPort(portFromConfig, devServerPort, defaultPort = DEFAULT_DEBUG_PORT) {
|
|
@@ -1387,11 +1426,27 @@ var __webpack_modules__ = {
|
|
|
1387
1426
|
const shortId = instanceId ? String(instanceId).slice(0, 8) : void 0;
|
|
1388
1427
|
const instanceAwareProfilePath = shortId ? external_path_.join(defaultProfilePath, shortId) : defaultProfilePath;
|
|
1389
1428
|
(0, shared_utils.x$)(browser, instanceAwareProfilePath);
|
|
1429
|
+
const preferencesPath = external_path_.join(instanceAwareProfilePath, 'Default', 'Preferences');
|
|
1390
1430
|
try {
|
|
1391
|
-
if (external_fs_.existsSync(instanceAwareProfilePath))
|
|
1431
|
+
if (external_fs_.existsSync(instanceAwareProfilePath)) {
|
|
1432
|
+
if (!external_fs_.existsSync(preferencesPath)) {
|
|
1433
|
+
if (!(0, shared_utils.rX)(instanceAwareProfilePath)) {
|
|
1434
|
+
const basePrefs = 'chrome' === browser ? chromeMasterPreferences : edgeMasterPreferences;
|
|
1435
|
+
const mergedPrefs = {
|
|
1436
|
+
...basePrefs,
|
|
1437
|
+
...configPreferences
|
|
1438
|
+
};
|
|
1439
|
+
try {
|
|
1440
|
+
external_fs_.mkdirSync(external_path_.dirname(preferencesPath), {
|
|
1441
|
+
recursive: true
|
|
1442
|
+
});
|
|
1443
|
+
} catch {}
|
|
1444
|
+
external_fs_.writeFileSync(preferencesPath, JSON.stringify(mergedPrefs), 'utf8');
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
return instanceAwareProfilePath;
|
|
1448
|
+
}
|
|
1392
1449
|
} catch {}
|
|
1393
|
-
const preferencesPath = external_path_.join(instanceAwareProfilePath, 'Default', 'Preferences');
|
|
1394
|
-
if (external_fs_.existsSync(preferencesPath)) return instanceAwareProfilePath;
|
|
1395
1450
|
const preferences = 'chrome' === browser ? chromeMasterPreferences : edgeMasterPreferences;
|
|
1396
1451
|
const userProfile = {
|
|
1397
1452
|
...preferences,
|
|
@@ -1479,7 +1534,7 @@ var __webpack_modules__ = {
|
|
|
1479
1534
|
...aiOptimizedFlags,
|
|
1480
1535
|
...sourceEnabled ? [
|
|
1481
1536
|
`--remote-debugging-port=${cdpPort}`,
|
|
1482
|
-
'--remote-debugging-address=
|
|
1537
|
+
'--remote-debugging-address=127.0.0.1'
|
|
1483
1538
|
] : [],
|
|
1484
1539
|
...filteredFlags,
|
|
1485
1540
|
...configOptions.browserFlags || []
|
|
@@ -1507,7 +1562,12 @@ var __webpack_modules__ = {
|
|
|
1507
1562
|
browserBinaryLocation = external_chrome_location2_default()();
|
|
1508
1563
|
break;
|
|
1509
1564
|
case 'edge':
|
|
1510
|
-
|
|
1565
|
+
try {
|
|
1566
|
+
browserBinaryLocation = external_edge_location_default()();
|
|
1567
|
+
} catch (e) {
|
|
1568
|
+
console.error(messages.iv(browser, 'edge binary not found'));
|
|
1569
|
+
process.exit(1);
|
|
1570
|
+
}
|
|
1511
1571
|
break;
|
|
1512
1572
|
case 'chromium-based':
|
|
1513
1573
|
browserBinaryLocation = external_path_.normalize(this.chromiumBinary);
|
|
@@ -1552,8 +1612,10 @@ var __webpack_modules__ = {
|
|
|
1552
1612
|
}
|
|
1553
1613
|
let chromiumConfig;
|
|
1554
1614
|
try {
|
|
1615
|
+
const profileForConfig = false === this.profile && (await instanceManager.getRunningInstances()).some((i)=>'running' === i.status && i.browser === this.browser) ? void 0 : this.profile;
|
|
1555
1616
|
chromiumConfig = browserConfig(compilation, {
|
|
1556
1617
|
...this,
|
|
1618
|
+
profile: profileForConfig,
|
|
1557
1619
|
instanceId: effectiveInstanceId,
|
|
1558
1620
|
extension: extensionsToLoad
|
|
1559
1621
|
});
|
|
@@ -1571,6 +1633,14 @@ var __webpack_modules__ = {
|
|
|
1571
1633
|
const desiredPort = (0, shared_utils.Zb)(this.port, this.instanceId);
|
|
1572
1634
|
const freePort = await (0, shared_utils.km)(desiredPort);
|
|
1573
1635
|
if (freePort !== desiredPort) chromiumConfig = chromiumConfig.map((flag)=>flag.startsWith('--remote-debugging-port=') ? `--remote-debugging-port=${freePort}` : flag);
|
|
1636
|
+
try {
|
|
1637
|
+
if (this.instanceId) {
|
|
1638
|
+
await instanceManager.updateInstance(this.instanceId, {
|
|
1639
|
+
debugPort: freePort
|
|
1640
|
+
});
|
|
1641
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(messages.x(freePort, desiredPort));
|
|
1642
|
+
}
|
|
1643
|
+
} catch {}
|
|
1574
1644
|
}
|
|
1575
1645
|
if (this.dryRun) {
|
|
1576
1646
|
console.log(messages.Lh());
|
|
@@ -2276,9 +2346,11 @@ var __webpack_modules__ = {
|
|
|
2276
2346
|
}
|
|
2277
2347
|
let firefoxConfig;
|
|
2278
2348
|
try {
|
|
2349
|
+
const hasConcurrent = (await instanceManager.getRunningInstances()).some((i)=>'running' === i.status && i.browser === this.browser);
|
|
2350
|
+
const profileForConfig = false === this.profile && hasConcurrent ? void 0 : this.profile;
|
|
2279
2351
|
firefoxConfig = await browserConfig(compilation, {
|
|
2280
2352
|
...options,
|
|
2281
|
-
profile:
|
|
2353
|
+
profile: profileForConfig,
|
|
2282
2354
|
preferences: this.preferences,
|
|
2283
2355
|
keepProfileChanges: this.keepProfileChanges,
|
|
2284
2356
|
copyFromProfile: this.copyFromProfile,
|
|
@@ -2364,6 +2436,18 @@ var __webpack_modules__ = {
|
|
|
2364
2436
|
console.error(messages.Q(this.browser, error));
|
|
2365
2437
|
process.exit(1);
|
|
2366
2438
|
}
|
|
2439
|
+
try {
|
|
2440
|
+
if (this.instanceId && profileMatch) {
|
|
2441
|
+
await instanceManager.updateInstance(this.instanceId, {
|
|
2442
|
+
debugPort,
|
|
2443
|
+
effectiveProfilePath: profileMatch[1]
|
|
2444
|
+
});
|
|
2445
|
+
if ('development' === process.env.EXTENSION_ENV) {
|
|
2446
|
+
console.log(messages.ZZ(debugPort, desiredDebugPort));
|
|
2447
|
+
console.log(messages.G$(profileMatch[1]));
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
} catch {}
|
|
2367
2451
|
} else {
|
|
2368
2452
|
const args = [
|
|
2369
2453
|
...debugPort > 0 ? [
|
|
@@ -3074,28 +3158,28 @@ var __webpack_modules__ = {
|
|
|
3074
3158
|
yz: ()=>portManagerErrorAllocatingPorts,
|
|
3075
3159
|
zd: ()=>instanceManagerHealthMonitoringOrphaned
|
|
3076
3160
|
});
|
|
3077
|
-
var
|
|
3078
|
-
var
|
|
3079
|
-
var
|
|
3161
|
+
var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("path");
|
|
3162
|
+
var pintor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("pintor");
|
|
3163
|
+
var pintor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(pintor__WEBPACK_IMPORTED_MODULE_1__);
|
|
3080
3164
|
var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./webpack/webpack-lib/constants.ts");
|
|
3081
3165
|
function getLoggingPrefix(feature, type) {
|
|
3082
|
-
if ('error' === type) return `${
|
|
3083
|
-
if ('warn' === type) return `${
|
|
3084
|
-
const arrow = 'info' === type ?
|
|
3166
|
+
if ('error' === type) return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('ERROR')} ${feature}`;
|
|
3167
|
+
if ('warn' === type) return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightYellow("\u25BA\u25BA\u25BA")} ${feature}`;
|
|
3168
|
+
const arrow = 'info' === type ? pintor__WEBPACK_IMPORTED_MODULE_1___default().blue("\u25BA\u25BA\u25BA") : pintor__WEBPACK_IMPORTED_MODULE_1___default().green("\u25BA\u25BA\u25BA");
|
|
3085
3169
|
return `${arrow} ${feature}`;
|
|
3086
3170
|
}
|
|
3087
3171
|
function boring(manifestName, duration, stats) {
|
|
3088
3172
|
let didShow = false;
|
|
3089
3173
|
if (!didShow) {
|
|
3090
|
-
const arrow = stats.hasErrors() ?
|
|
3091
|
-
return `${arrow} ${manifestName} compiled ${stats.hasErrors() ?
|
|
3174
|
+
const arrow = stats.hasErrors() ? pintor__WEBPACK_IMPORTED_MODULE_1___default().red("\u25BA\u25BA\u25BA") : pintor__WEBPACK_IMPORTED_MODULE_1___default().blue("\u25BA\u25BA\u25BA");
|
|
3175
|
+
return `${arrow} ${manifestName} compiled ${stats.hasErrors() ? pintor__WEBPACK_IMPORTED_MODULE_1___default().red('with errors') : pintor__WEBPACK_IMPORTED_MODULE_1___default().green('successfully')} in ${duration} ms.`;
|
|
3092
3176
|
}
|
|
3093
3177
|
}
|
|
3094
3178
|
function integrationNotInstalled(integration, packageManager) {
|
|
3095
|
-
return `${getLoggingPrefix(integration, 'info')} Using ${integration}. Installing required dependencies via ${
|
|
3179
|
+
return `${getLoggingPrefix(integration, 'info')} Using ${integration}. Installing required dependencies via ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(packageManager)}...`;
|
|
3096
3180
|
}
|
|
3097
3181
|
function isUsingIntegration(integration) {
|
|
3098
|
-
return `${
|
|
3182
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().blue("\u25BA\u25BA\u25BA")} Using ${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightBlue(integration)}...`;
|
|
3099
3183
|
}
|
|
3100
3184
|
function youAreAllSet(integration) {
|
|
3101
3185
|
return `${getLoggingPrefix(integration, 'success')} installation completed. Run the program again and happy hacking.`;
|
|
@@ -3104,14 +3188,14 @@ var __webpack_modules__ = {
|
|
|
3104
3188
|
return `${getLoggingPrefix(integration, 'info')} dependencies are being installed. This only happens for core contributors...`;
|
|
3105
3189
|
}
|
|
3106
3190
|
function integrationInstalledSuccessfully(integration) {
|
|
3107
|
-
return `${getLoggingPrefix(integration, 'success')} dependencies installed ${
|
|
3191
|
+
return `${getLoggingPrefix(integration, 'success')} dependencies installed ${pintor__WEBPACK_IMPORTED_MODULE_1___default().green('successfully')}.`;
|
|
3108
3192
|
}
|
|
3109
3193
|
function failedToInstallIntegration(integration, error) {
|
|
3110
|
-
return `${getLoggingPrefix('Integration', 'error')} ${
|
|
3194
|
+
return `${getLoggingPrefix('Integration', 'error')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(integration)} Installation Error\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('Failed to detect package manager or install dependencies.')}\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error ?? ''))}`;
|
|
3111
3195
|
}
|
|
3112
3196
|
function fileNotFound(errorSourcePath, missingFilePath) {
|
|
3113
3197
|
if (!errorSourcePath) throw new Error('This operation is impossible. Please report a bug.');
|
|
3114
|
-
switch(
|
|
3198
|
+
switch(path__WEBPACK_IMPORTED_MODULE_0__.extname(missingFilePath)){
|
|
3115
3199
|
case '.js':
|
|
3116
3200
|
case '.ts':
|
|
3117
3201
|
case '.jsx':
|
|
@@ -3131,99 +3215,99 @@ var __webpack_modules__ = {
|
|
|
3131
3215
|
const contentIndex = manifestField.split('-')[1];
|
|
3132
3216
|
const isPage = manifestField.startsWith('pages');
|
|
3133
3217
|
const field = manifestName.includes("content_scripts") ? `(index ${contentIndex})\n\n` : manifestFieldName;
|
|
3134
|
-
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\n${isPage ? `Check the ${
|
|
3218
|
+
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\n${isPage ? `Check the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('pages')} folder in your project root directory.\n\n` : `Check the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(field)} field in your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('manifest.json')} file.\n\n`}${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(filePath)}`;
|
|
3135
3219
|
}
|
|
3136
3220
|
function entryNotFoundWarn(manifestField, filePath) {
|
|
3137
|
-
return `File Not Found\n\nCheck the ${
|
|
3221
|
+
return `File Not Found\n\nCheck the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(manifestField)} field in your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('manifest.json')} file.\n\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(filePath)}`;
|
|
3138
3222
|
}
|
|
3139
3223
|
function manifestInvalidError(error) {
|
|
3140
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your ${
|
|
3224
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('manifest.json')} file and try again.\n\n` + pintor__WEBPACK_IMPORTED_MODULE_1___default().red(error.toString());
|
|
3141
3225
|
}
|
|
3142
3226
|
function serverRestartRequiredFromManifestError(fileAdded, fileRemoved) {
|
|
3143
|
-
const fileRemovedText = fileRemoved ? `${
|
|
3144
|
-
const fileAddedText = fileAdded ? `${
|
|
3227
|
+
const fileRemovedText = fileRemoved ? `${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('REMOVED')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(fileRemoved)}\n` : '';
|
|
3228
|
+
const fileAddedText = fileAdded ? `${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().green('ADDED')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(fileAdded)}` : '';
|
|
3145
3229
|
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\nChanging the path of HTML or script files in manifest.json after compilation requires a server restart.\n` + fileRemovedText + fileAddedText;
|
|
3146
3230
|
}
|
|
3147
3231
|
function serverRestartRequiredFromSpecialFolderError(addingOrRemoving, folder, typeOfAsset, pathRelative) {
|
|
3148
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n${
|
|
3232
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(pathRelative)} in the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(folder + '/')} folder after compilation requires a server restart.`;
|
|
3149
3233
|
}
|
|
3150
3234
|
function manifestNotFoundError(manifestName, manifestPath) {
|
|
3151
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Not Found\n\nEnsure you have a ${
|
|
3235
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Not Found\n\nEnsure you have a ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('manifest.json')} file at the root directory of your project.\n\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(manifestPath)}`;
|
|
3152
3236
|
}
|
|
3153
3237
|
function creatingTSConfig() {
|
|
3154
|
-
return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${
|
|
3238
|
+
return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('tsconfig.json')}...`;
|
|
3155
3239
|
}
|
|
3156
3240
|
function backgroundIsRequired(backgroundChunkName, filePath) {
|
|
3157
|
-
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\nCheck the ${
|
|
3241
|
+
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\nCheck the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(backgroundChunkName.replace('/', '.'))} field in your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('manifest.json')} file.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(filePath)}`;
|
|
3158
3242
|
}
|
|
3159
3243
|
function serverRestartRequiredFromHtml(filePath) {
|
|
3160
|
-
return `${getLoggingPrefix('HTML', 'warn')} Entrypoint Change\nDetected changes to ${
|
|
3244
|
+
return `${getLoggingPrefix('HTML', 'warn')} Entrypoint Change\nDetected changes to ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow("<script>")} or ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('<link rel="stylesheet">')} references in HTML. The extension will undergo a full recompilation and a reload.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(filePath)}`;
|
|
3161
3245
|
}
|
|
3162
3246
|
function javaScriptError(errorSourcePath, missingFilePath) {
|
|
3163
|
-
return `${getLoggingPrefix('HTML', 'error')} File Not Found\nCheck your ${
|
|
3247
|
+
return `${getLoggingPrefix('HTML', 'error')} File Not Found\nCheck your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow("<script>")} tags in ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(errorSourcePath)}.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(missingFilePath)}`;
|
|
3164
3248
|
}
|
|
3165
3249
|
function cssError(errorSourcePath, missingFilePath) {
|
|
3166
|
-
return `${getLoggingPrefix('HTML', 'error')} File Not Found\nCheck your ${
|
|
3250
|
+
return `${getLoggingPrefix('HTML', 'error')} File Not Found\nCheck your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('<link>')} tags in ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(errorSourcePath)}.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(missingFilePath)}`;
|
|
3167
3251
|
}
|
|
3168
3252
|
function staticAssetError(errorSourcePath, missingFilePath) {
|
|
3169
|
-
const extname =
|
|
3170
|
-
return `${getLoggingPrefix('HTML', 'warn')} File Not Found\nCheck your ${
|
|
3253
|
+
const extname = path__WEBPACK_IMPORTED_MODULE_0__.extname(missingFilePath);
|
|
3254
|
+
return `${getLoggingPrefix('HTML', 'warn')} File Not Found\nCheck your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('*' + extname)} assets in ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(errorSourcePath)}.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(missingFilePath)}`;
|
|
3171
3255
|
}
|
|
3172
3256
|
function certRequired() {
|
|
3173
|
-
return `${
|
|
3257
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('Note')}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.\nBy default, your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('manifest.json')} file is not being watched. To enable this feature, run:\n\n npx -y ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('mkcert-cli')} \\\n ${pintor__WEBPACK_IMPORTED_MODULE_1___default().blue('--outDir')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(_constants__WEBPACK_IMPORTED_MODULE_2__.KI)} \\\n ${pintor__WEBPACK_IMPORTED_MODULE_1___default().blue('--cert')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('localhost.cert')} \\\n ${pintor__WEBPACK_IMPORTED_MODULE_1___default().blue('--key')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('localhost.key')}\n\nThis will enable the secure certificate needed for Firefox via ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('mkcert')}.\n\nLearn more about ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('mkcert')}: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline('https://github.com/FiloSottile/mkcert')}`;
|
|
3174
3258
|
}
|
|
3175
3259
|
function defaultPortInUse(port) {
|
|
3176
|
-
return `${getLoggingPrefix('Port', 'error')} Selected port ${
|
|
3260
|
+
return `${getLoggingPrefix('Port', 'error')} Selected port ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())} in use. Choose a new port. `;
|
|
3177
3261
|
}
|
|
3178
3262
|
function portInUse(requestedPort, newPort) {
|
|
3179
|
-
return `${getLoggingPrefix('Port', 'warn')} Requested port ${
|
|
3263
|
+
return `${getLoggingPrefix('Port', 'warn')} Requested port ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(requestedPort.toString())} is in use; using ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(newPort.toString())} instead.`;
|
|
3180
3264
|
}
|
|
3181
3265
|
function noExtensionIdError() {
|
|
3182
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${
|
|
3266
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('publicPath')}\nof your ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('extension.config.js')} is defined as your extension URL.`;
|
|
3183
3267
|
}
|
|
3184
3268
|
function isUsingCustomLoader(file) {
|
|
3185
3269
|
const loaderName = file.split('.').shift() || 'custom';
|
|
3186
3270
|
const capitalizedLoaderName = loaderName.charAt(0).toUpperCase() + loaderName.slice(1);
|
|
3187
|
-
return `${getLoggingPrefix(capitalizedLoaderName, 'info')} Using custom loader configuration from ${
|
|
3271
|
+
return `${getLoggingPrefix(capitalizedLoaderName, 'info')} Using custom loader configuration from ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(file)}`;
|
|
3188
3272
|
}
|
|
3189
3273
|
function webextensionPolyfillNotFound() {
|
|
3190
|
-
return `${getLoggingPrefix('Warning', 'warn')} ${
|
|
3274
|
+
return `${getLoggingPrefix('Warning', 'warn')} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('webextension-polyfill')} not found. Browser API polyfill will not be available.\nTo fix this, install ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('webextension-polyfill')}: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().blue('npm install webextension-polyfill')}`;
|
|
3191
3275
|
}
|
|
3192
3276
|
function registrySaved(registryPath) {
|
|
3193
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} registry saved to: ${
|
|
3277
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} registry saved to: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(registryPath)}`;
|
|
3194
3278
|
}
|
|
3195
3279
|
function registrySaveError(error) {
|
|
3196
|
-
return `${getLoggingPrefix('Instance Manager', 'error')} error saving registry:\n${
|
|
3280
|
+
return `${getLoggingPrefix('Instance Manager', 'error')} error saving registry:\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3197
3281
|
}
|
|
3198
3282
|
function smartPortAllocationExistingPorts(usedPorts) {
|
|
3199
|
-
return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing ports: ${
|
|
3283
|
+
return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing ports: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(usedPorts))}`;
|
|
3200
3284
|
}
|
|
3201
3285
|
function smartPortAllocationExistingWebSocketPorts(usedWebSocketPorts) {
|
|
3202
|
-
return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing WebSocket ports: ${
|
|
3286
|
+
return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing WebSocket ports: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(usedWebSocketPorts))}`;
|
|
3203
3287
|
}
|
|
3204
3288
|
function smartPortAllocationUsingRequestedPort(port, webSocketPort) {
|
|
3205
|
-
return `${getLoggingPrefix('Smart Port Allocation', 'info')} using requested port ${
|
|
3289
|
+
return `${getLoggingPrefix('Smart Port Allocation', 'info')} using requested port ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())}; WebSocket ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(webSocketPort.toString())}`;
|
|
3206
3290
|
}
|
|
3207
3291
|
function smartPortAllocationRequestedPortUnavailable(port) {
|
|
3208
|
-
return `${getLoggingPrefix('Smart Port Allocation', 'warn')} requested port is unavailable: ${
|
|
3292
|
+
return `${getLoggingPrefix('Smart Port Allocation', 'warn')} requested port is unavailable: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())}`;
|
|
3209
3293
|
}
|
|
3210
3294
|
function smartPortAllocationAllocatedPorts(port, webSocketPort) {
|
|
3211
|
-
return `${getLoggingPrefix('Smart Port Allocation', 'success')} allocated ports ${
|
|
3295
|
+
return `${getLoggingPrefix('Smart Port Allocation', 'success')} allocated ports ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(port)')} and ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(webSocketPort.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(WebSocket)')}`;
|
|
3212
3296
|
}
|
|
3213
3297
|
function instanceManagerCreateInstanceCalled(params) {
|
|
3214
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} createInstance called ${
|
|
3298
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} createInstance called ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(params))}`;
|
|
3215
3299
|
}
|
|
3216
3300
|
function instanceManagerRegistryAfterCreateInstance(registry) {
|
|
3217
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} registry after createInstance: ${
|
|
3301
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} registry after createInstance: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(registry))}`;
|
|
3218
3302
|
}
|
|
3219
3303
|
function extensionManagerCopyFilesWarning(error) {
|
|
3220
|
-
return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not copy extension files: ${
|
|
3304
|
+
return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not copy extension files: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(String(error))}`;
|
|
3221
3305
|
}
|
|
3222
3306
|
function extensionManagerInstanceNotFoundWarning(instanceId) {
|
|
3223
|
-
return `${getLoggingPrefix('Extension.js DevTools', 'warn')} instance ${
|
|
3307
|
+
return `${getLoggingPrefix('Extension.js DevTools', 'warn')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(instanceId)} not found for cleanup`;
|
|
3224
3308
|
}
|
|
3225
3309
|
function extensionManagerCleanupWarning(error) {
|
|
3226
|
-
return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not cleanup temp extensions: ${
|
|
3310
|
+
return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not cleanup temp extensions: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(String(error))}`;
|
|
3227
3311
|
}
|
|
3228
3312
|
function firefoxDetectedFlatpak() {
|
|
3229
3313
|
return `${getLoggingPrefix('Firefox Detector', 'info')} detected a Flatpak Firefox installation`;
|
|
@@ -3232,88 +3316,88 @@ var __webpack_modules__ = {
|
|
|
3232
3316
|
return `${getLoggingPrefix('Firefox Detector', 'info')} detected a Snap Firefox installation`;
|
|
3233
3317
|
}
|
|
3234
3318
|
function firefoxDetectedTraditional(firefoxPath) {
|
|
3235
|
-
return `${getLoggingPrefix('Firefox Detector', 'info')} detected traditional Firefox at: ${
|
|
3319
|
+
return `${getLoggingPrefix('Firefox Detector', 'info')} detected traditional Firefox at: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(firefoxPath)}`;
|
|
3236
3320
|
}
|
|
3237
3321
|
function firefoxDetectedCustom(firefoxPath) {
|
|
3238
|
-
return `${getLoggingPrefix('Firefox Detector', 'info')} detected custom Firefox build at: ${
|
|
3322
|
+
return `${getLoggingPrefix('Firefox Detector', 'info')} detected custom Firefox build at: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(firefoxPath)}`;
|
|
3239
3323
|
}
|
|
3240
3324
|
function firefoxUsingFlatpakWithSandbox() {
|
|
3241
3325
|
return `${getLoggingPrefix('Firefox Detector', 'info')} using Flatpak Firefox with sandbox permissions`;
|
|
3242
3326
|
}
|
|
3243
3327
|
function firefoxVersion(version) {
|
|
3244
|
-
return `${getLoggingPrefix('Firefox Detector', 'info')} Firefox version is: ${
|
|
3328
|
+
return `${getLoggingPrefix('Firefox Detector', 'info')} Firefox version is: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(version)}`;
|
|
3245
3329
|
}
|
|
3246
3330
|
function portManagerErrorAllocatingPorts(error) {
|
|
3247
|
-
return `${getLoggingPrefix('Port Manager', 'error')} Failed to allocate ports.\n${
|
|
3331
|
+
return `${getLoggingPrefix('Port Manager', 'error')} Failed to allocate ports.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3248
3332
|
}
|
|
3249
3333
|
function browserPluginFailedToLoad(browser, error) {
|
|
3250
|
-
return `${getLoggingPrefix('Browser Plugin', 'error')} Failed to load the ${
|
|
3334
|
+
return `${getLoggingPrefix('Browser Plugin', 'error')} Failed to load the ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(browser)} plugin.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3251
3335
|
}
|
|
3252
3336
|
function extensionJsRunnerError(error) {
|
|
3253
|
-
return `${getLoggingPrefix('Extension.js Runner', 'error')} Error in the Extension.js runner.\n${
|
|
3337
|
+
return `${getLoggingPrefix('Extension.js Runner', 'error')} Error in the Extension.js runner.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3254
3338
|
}
|
|
3255
3339
|
function extensionJsRunnerCleanupError(error) {
|
|
3256
|
-
return `${getLoggingPrefix('Extension.js Runner', 'error')} Error during cleanup.\n${
|
|
3340
|
+
return `${getLoggingPrefix('Extension.js Runner', 'error')} Error during cleanup.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3257
3341
|
}
|
|
3258
3342
|
function extensionJsRunnerUncaughtException(error) {
|
|
3259
|
-
return `${getLoggingPrefix('Extension.js Runner', 'error')} Uncaught exception.\n${
|
|
3343
|
+
return `${getLoggingPrefix('Extension.js Runner', 'error')} Uncaught exception.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3260
3344
|
}
|
|
3261
3345
|
function extensionJsRunnerUnhandledRejection(promise, reason) {
|
|
3262
|
-
return `${getLoggingPrefix('Extension.js Runner', 'error')} unhandled rejection at: ${
|
|
3346
|
+
return `${getLoggingPrefix('Extension.js Runner', 'error')} unhandled rejection at: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(promise.toString())} reason: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(reason))}`;
|
|
3263
3347
|
}
|
|
3264
3348
|
function autoExitModeEnabled(ms) {
|
|
3265
|
-
return `${getLoggingPrefix('Auto Mode', 'info')} is enabled. The program will exit automatically after ${
|
|
3349
|
+
return `${getLoggingPrefix('Auto Mode', 'info')} is enabled. The program will exit automatically after ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(' + ms.toString() + 'ms)')}.`;
|
|
3266
3350
|
}
|
|
3267
3351
|
function autoExitTriggered(ms) {
|
|
3268
|
-
return `${getLoggingPrefix('Auto Mode', 'warn')} timer has elapsed ${
|
|
3352
|
+
return `${getLoggingPrefix('Auto Mode', 'warn')} timer has elapsed ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(' + ms.toString() + 'ms)')}. Cleaning up\u{2026}`;
|
|
3269
3353
|
}
|
|
3270
3354
|
function autoExitForceKill(ms) {
|
|
3271
|
-
return `${getLoggingPrefix('Auto Mode', 'error')} is force-killing the process after the fallback ${
|
|
3355
|
+
return `${getLoggingPrefix('Auto Mode', 'error')} is force-killing the process after the fallback ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(' + ms.toString() + 'ms)')}.`;
|
|
3272
3356
|
}
|
|
3273
3357
|
function instanceManagerHealthMonitoringStart(instanceId) {
|
|
3274
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} starting health monitoring for instance ${
|
|
3358
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} starting health monitoring for instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))}`;
|
|
3275
3359
|
}
|
|
3276
3360
|
function instanceManagerHealthMonitoringPassed(instanceId) {
|
|
3277
|
-
return `${getLoggingPrefix('Instance Manager', 'success')} instance ${
|
|
3361
|
+
return `${getLoggingPrefix('Instance Manager', 'success')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} health check passed`;
|
|
3278
3362
|
}
|
|
3279
3363
|
function instanceManagerHealthMonitoringOrphaned(instanceId) {
|
|
3280
|
-
return `${getLoggingPrefix('Instance Manager', 'warn')} instance ${
|
|
3364
|
+
return `${getLoggingPrefix('Instance Manager', 'warn')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} appears orphaned, cleaning up`;
|
|
3281
3365
|
}
|
|
3282
3366
|
function instanceManagerHealthMonitoringFailed(instanceId, error) {
|
|
3283
|
-
return `${getLoggingPrefix('Instance Manager', 'error')} health check failed for instance ${
|
|
3367
|
+
return `${getLoggingPrefix('Instance Manager', 'error')} health check failed for instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))}:\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3284
3368
|
}
|
|
3285
3369
|
function instanceManagerForceCleanupProject(projectPath) {
|
|
3286
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} force cleaning up all processes for project: ${
|
|
3370
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} force cleaning up all processes for project: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(projectPath)}`;
|
|
3287
3371
|
}
|
|
3288
3372
|
function instanceManagerForceCleanupFound(instanceCount) {
|
|
3289
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} found ${
|
|
3373
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} found ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceCount.toString())} instances to clean up`;
|
|
3290
3374
|
}
|
|
3291
3375
|
function instanceManagerForceCleanupInstance(instanceId) {
|
|
3292
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} cleaning up instance ${
|
|
3376
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} cleaning up instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))}`;
|
|
3293
3377
|
}
|
|
3294
3378
|
function instanceManagerForceCleanupTerminating(processId) {
|
|
3295
|
-
return `${getLoggingPrefix('Instance Manager', 'info')} terminating process ${
|
|
3379
|
+
return `${getLoggingPrefix('Instance Manager', 'info')} terminating process ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(processId.toString())}`;
|
|
3296
3380
|
}
|
|
3297
3381
|
function instanceManagerForceCleanupForceKilled(processId) {
|
|
3298
|
-
return `${getLoggingPrefix('Instance Manager', 'error')} force killed process ${
|
|
3382
|
+
return `${getLoggingPrefix('Instance Manager', 'error')} force killed process ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(processId.toString())}`;
|
|
3299
3383
|
}
|
|
3300
3384
|
function instanceManagerForceCleanupInstanceTerminated(instanceId) {
|
|
3301
|
-
return `${getLoggingPrefix('Instance Manager', 'success')} instance ${
|
|
3385
|
+
return `${getLoggingPrefix('Instance Manager', 'success')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} marked as terminated`;
|
|
3302
3386
|
}
|
|
3303
3387
|
function instanceManagerForceCleanupError(instanceId, error) {
|
|
3304
|
-
return `${getLoggingPrefix('Instance Manager', 'error')} error terminating instance ${
|
|
3388
|
+
return `${getLoggingPrefix('Instance Manager', 'error')} error terminating instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId)}:\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
|
|
3305
3389
|
}
|
|
3306
3390
|
function instanceManagerForceCleanupComplete() {
|
|
3307
3391
|
return `${getLoggingPrefix('Instance Manager', 'success')} project cleanup completed`;
|
|
3308
3392
|
}
|
|
3309
3393
|
function instanceManagerProcessNoLongerRunning(instanceId, processId) {
|
|
3310
|
-
return `${
|
|
3394
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightMagenta('Instance Manager')} process ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(processId.toString())} for instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} is no longer running`;
|
|
3311
3395
|
}
|
|
3312
3396
|
function instanceManagerPortsNotInUse(instanceId, port, webSocketPort) {
|
|
3313
|
-
return `${
|
|
3397
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightMagenta('Instance Manager')} ports ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(')}${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('port')}${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(')')}/${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(webSocketPort.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(')}${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('WebSocket')}${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(')')} for instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} are not in use`;
|
|
3314
3398
|
}
|
|
3315
3399
|
function instanceManagerCleanedUpOrphanedInstance(instanceId) {
|
|
3316
|
-
return `${
|
|
3400
|
+
return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightMagenta('Instance Manager')} cleaned up orphaned instance: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))}`;
|
|
3317
3401
|
}
|
|
3318
3402
|
},
|
|
3319
3403
|
child_process: function(module) {
|
|
@@ -3344,7 +3428,7 @@ var __webpack_modules__ = {
|
|
|
3344
3428
|
module.exports = require("util");
|
|
3345
3429
|
},
|
|
3346
3430
|
"./package.json": function(module) {
|
|
3347
|
-
module.exports = JSON.parse('{"i8":"2.0
|
|
3431
|
+
module.exports = JSON.parse('{"i8":"2.1.0","HO":{"@rspack/core":"^1.4.8","@rspack/dev-server":"^1.1.3","@swc/helpers":"^0.5.15","@types/webextension-polyfill":"0.12.3","@vue/compiler-sfc":"^3.5.13","adm-zip":"^0.5.16","axios":"^1.9.0","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^4.0.1","chrome-location2":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^16.4.7","dotenv-webpack":"^8.1.0","edge-location":"^1.1.1","firefox-location2":"1.0.0","firefox-profile":"^4.7.0","go-git-it":"^5.0.0","ignore":"^6.0.2","loader-utils":"^3.3.1","locate-path":"^7.2.0","micromatch":"^4.0.8","package-manager-detector":"^0.2.7","parse5":"^7.2.1","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"^8.4.49","preact":"^10.22.0","progress":"^2.0.3","schema-utils":"^4.2.0","slugify":"^1.6.6","tiny-glob":"^0.2.9","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.18.0"},"Lq":{"@prefresh/core":"^1.5.2","@prefresh/utils":"^1.2.0","@prefresh/webpack":"^4.0.1","@rspack/plugin-preact-refresh":"^1.1.2","@rspack/plugin-react-refresh":"^1.0.1","babel-loader":"^9.2.1","less-loader":"^12.2.0","postcss-loader":"^8.1.1","postcss-preset-env":"^10.1.1","react-refresh":"^0.14.2","sass-loader":"^16.0.4","svelte-loader":"^3.2.4","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3"}}');
|
|
3348
3432
|
}
|
|
3349
3433
|
};
|
|
3350
3434
|
var __webpack_module_cache__ = {};
|
|
@@ -3366,6 +3450,33 @@ function __webpack_require__(moduleId) {
|
|
|
3366
3450
|
return getter;
|
|
3367
3451
|
};
|
|
3368
3452
|
})();
|
|
3453
|
+
(()=>{
|
|
3454
|
+
var getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__;
|
|
3455
|
+
var leafPrototypes;
|
|
3456
|
+
__webpack_require__.t = function(value, mode) {
|
|
3457
|
+
if (1 & mode) value = this(value);
|
|
3458
|
+
if (8 & mode) return value;
|
|
3459
|
+
if ('object' == typeof value && value) {
|
|
3460
|
+
if (4 & mode && value.__esModule) return value;
|
|
3461
|
+
if (16 & mode && 'function' == typeof value.then) return value;
|
|
3462
|
+
}
|
|
3463
|
+
var ns = Object.create(null);
|
|
3464
|
+
__webpack_require__.r(ns);
|
|
3465
|
+
var def = {};
|
|
3466
|
+
leafPrototypes = leafPrototypes || [
|
|
3467
|
+
null,
|
|
3468
|
+
getProto({}),
|
|
3469
|
+
getProto([]),
|
|
3470
|
+
getProto(getProto)
|
|
3471
|
+
];
|
|
3472
|
+
for(var current = 2 & mode && value; 'object' == typeof current && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
|
|
3473
|
+
def[key] = ()=>value[key];
|
|
3474
|
+
});
|
|
3475
|
+
def['default'] = ()=>value;
|
|
3476
|
+
__webpack_require__.d(ns, def);
|
|
3477
|
+
return ns;
|
|
3478
|
+
};
|
|
3479
|
+
})();
|
|
3369
3480
|
(()=>{
|
|
3370
3481
|
__webpack_require__.d = (exports1, definition)=>{
|
|
3371
3482
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -7953,6 +8064,7 @@ var __webpack_exports__ = {};
|
|
|
7953
8064
|
browser: this.browser,
|
|
7954
8065
|
mode: compiler.options.mode || 'development'
|
|
7955
8066
|
});
|
|
8067
|
+
compiler.options.webSocketServer = this.webSocketServer;
|
|
7956
8068
|
this.isServerInitialized = true;
|
|
7957
8069
|
if ('development' === process.env.EXTENSION_ENV) console.log(webSocketServerInitialized());
|
|
7958
8070
|
} catch (error) {
|
|
@@ -8415,10 +8527,7 @@ var __webpack_exports__ = {};
|
|
|
8415
8527
|
}
|
|
8416
8528
|
}
|
|
8417
8529
|
const setup_reload_strategy = SetupReloadStrategy;
|
|
8418
|
-
|
|
8419
|
-
var messaging_client = __webpack_require__("./webpack/plugin-browsers/run-firefox/remote-firefox/messaging-client.ts");
|
|
8420
|
-
var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
|
|
8421
|
-
function setup_firefox_inspection_define_property(obj, key, value) {
|
|
8530
|
+
function plugin_reload_define_property(obj, key, value) {
|
|
8422
8531
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
8423
8532
|
value: value,
|
|
8424
8533
|
enumerable: true,
|
|
@@ -8428,269 +8537,113 @@ var __webpack_exports__ = {};
|
|
|
8428
8537
|
else obj[key] = value;
|
|
8429
8538
|
return obj;
|
|
8430
8539
|
}
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8540
|
+
class ReloadPlugin {
|
|
8541
|
+
apply(compiler) {
|
|
8542
|
+
if (this.instanceId) compiler.options.currentInstance = {
|
|
8543
|
+
instanceId: this.instanceId
|
|
8544
|
+
};
|
|
8545
|
+
if ('development' !== compiler.options.mode) return;
|
|
8546
|
+
new CreateWebSocketServer({
|
|
8547
|
+
manifestPath: this.manifestPath,
|
|
8548
|
+
browser: this.browser,
|
|
8549
|
+
port: this.port,
|
|
8550
|
+
stats: this.stats,
|
|
8551
|
+
instanceId: this.instanceId
|
|
8552
|
+
}).apply(compiler);
|
|
8553
|
+
new setup_reload_strategy({
|
|
8554
|
+
manifestPath: this.manifestPath,
|
|
8555
|
+
browser: this.browser,
|
|
8556
|
+
autoReload: this.autoReload,
|
|
8557
|
+
stats: this.stats,
|
|
8558
|
+
port: this.port,
|
|
8559
|
+
instanceId: this.instanceId
|
|
8560
|
+
}).apply(compiler);
|
|
8442
8561
|
}
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8562
|
+
constructor(options){
|
|
8563
|
+
plugin_reload_define_property(this, "manifestPath", void 0);
|
|
8564
|
+
plugin_reload_define_property(this, "browser", void 0);
|
|
8565
|
+
plugin_reload_define_property(this, "port", void 0);
|
|
8566
|
+
plugin_reload_define_property(this, "stats", void 0);
|
|
8567
|
+
plugin_reload_define_property(this, "autoReload", void 0);
|
|
8568
|
+
plugin_reload_define_property(this, "instanceId", void 0);
|
|
8569
|
+
this.manifestPath = options.manifestPath;
|
|
8570
|
+
this.browser = options.browser || 'chrome';
|
|
8571
|
+
this.port = parseInt(options.port, 10);
|
|
8572
|
+
this.stats = options.stats;
|
|
8573
|
+
this.autoReload = options.autoReload;
|
|
8574
|
+
this.instanceId = options.instanceId;
|
|
8575
|
+
}
|
|
8576
|
+
}
|
|
8577
|
+
plugin_reload_define_property(ReloadPlugin, "name", 'plugin-reload');
|
|
8578
|
+
function feature_polyfill_define_property(obj, key, value) {
|
|
8579
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
8580
|
+
value: value,
|
|
8581
|
+
enumerable: true,
|
|
8582
|
+
configurable: true,
|
|
8583
|
+
writable: true
|
|
8584
|
+
});
|
|
8585
|
+
else obj[key] = value;
|
|
8586
|
+
return obj;
|
|
8587
|
+
}
|
|
8588
|
+
class PolyfillPlugin {
|
|
8589
|
+
apply(compiler) {
|
|
8447
8590
|
try {
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
return;
|
|
8460
|
-
} catch (err) {
|
|
8461
|
-
retries++;
|
|
8462
|
-
if (retries % 10 === 0) try {
|
|
8463
|
-
console.log(browsers_lib_messages.X_(retries, MAX_CONNECT_RETRIES));
|
|
8464
|
-
} catch {}
|
|
8465
|
-
await wait(CONNECT_RETRY_INTERVAL_MS);
|
|
8591
|
+
const context = compiler.options.context;
|
|
8592
|
+
const polyfillPath = require.resolve('webextension-polyfill/dist/browser-polyfill.js', {
|
|
8593
|
+
paths: [
|
|
8594
|
+
context
|
|
8595
|
+
]
|
|
8596
|
+
});
|
|
8597
|
+
new (core_default()).ProvidePlugin({
|
|
8598
|
+
browser: polyfillPath
|
|
8599
|
+
}).apply(compiler);
|
|
8600
|
+
} catch (error) {
|
|
8601
|
+
console.warn(webpack_lib_messages.or());
|
|
8466
8602
|
}
|
|
8467
|
-
throw new Error(browsers_lib_messages.V9(port));
|
|
8468
8603
|
}
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8604
|
+
constructor(options){
|
|
8605
|
+
feature_polyfill_define_property(this, "manifestPath", void 0);
|
|
8606
|
+
feature_polyfill_define_property(this, "browser", void 0);
|
|
8607
|
+
this.manifestPath = options.manifestPath;
|
|
8608
|
+
this.browser = options.browser;
|
|
8473
8609
|
}
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
continue;
|
|
8490
|
-
} catch {}
|
|
8491
|
-
}
|
|
8492
|
-
for (const target of allTargets)if (target && (target.actor || target.outerWindowID)) return {
|
|
8493
|
-
tabActor: target.actor,
|
|
8494
|
-
consoleActor: target.consoleActor || target.actor
|
|
8495
|
-
};
|
|
8496
|
-
await wait(TARGET_SCAN_INTERVAL_MS);
|
|
8497
|
-
}
|
|
8498
|
-
throw new Error(browsers_lib_messages.qP());
|
|
8610
|
+
}
|
|
8611
|
+
function feature_browser_specific_fields_define_property(obj, key, value) {
|
|
8612
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
8613
|
+
value: value,
|
|
8614
|
+
enumerable: true,
|
|
8615
|
+
configurable: true,
|
|
8616
|
+
writable: true
|
|
8617
|
+
});
|
|
8618
|
+
else obj[key] = value;
|
|
8619
|
+
return obj;
|
|
8620
|
+
}
|
|
8621
|
+
class BrowserSpecificFieldsPlugin {
|
|
8622
|
+
patchManifest(manifest) {
|
|
8623
|
+
const patchedManifest = filterKeysForThisBrowser(manifest, this.browser);
|
|
8624
|
+
return JSON.stringify(patchedManifest, null, 2);
|
|
8499
8625
|
}
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
} catch {}
|
|
8513
|
-
try {
|
|
8514
|
-
await this.client.navigateViaScript(consoleActor, urlToInspect);
|
|
8515
|
-
await this.client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
|
|
8516
|
-
return;
|
|
8517
|
-
} catch {}
|
|
8518
|
-
try {
|
|
8519
|
-
const detail = await this.client.getTargetFromDescriptor(tabActor);
|
|
8520
|
-
const targetActor = detail.targetActor || tabActor;
|
|
8521
|
-
try {
|
|
8522
|
-
await this.client.attach(targetActor);
|
|
8523
|
-
} catch {}
|
|
8524
|
-
await this.client.navigate(targetActor, urlToInspect);
|
|
8525
|
-
await this.client.waitForLoadEvent(targetActor);
|
|
8526
|
-
} catch {}
|
|
8626
|
+
apply(compiler) {
|
|
8627
|
+
compiler.hooks.compilation.tap('compatibility:browser-specific-fields', (compilation)=>{
|
|
8628
|
+
compilation.hooks.processAssets.tap({
|
|
8629
|
+
name: 'compatibility:browser-specific-fields',
|
|
8630
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
8631
|
+
}, ()=>{
|
|
8632
|
+
const manifest = getManifestContent(compilation, this.manifestPath);
|
|
8633
|
+
const patchedSource = this.patchManifest(manifest);
|
|
8634
|
+
const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
|
|
8635
|
+
compilation.updateAsset('manifest.json', rawSource);
|
|
8636
|
+
});
|
|
8637
|
+
});
|
|
8527
8638
|
}
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
} catch {}
|
|
8534
|
-
await this.client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
|
|
8535
|
-
}
|
|
8536
|
-
async resolveConsoleActor(tabActor, urlToInspect) {
|
|
8537
|
-
if (!this.client) throw new Error(browsers_lib_messages.pl());
|
|
8538
|
-
const start = Date.now();
|
|
8539
|
-
while(Date.now() - start < PAGE_READY_TIMEOUT_MS){
|
|
8540
|
-
try {
|
|
8541
|
-
const targets = await this.client.getTargets();
|
|
8542
|
-
const byActor = targets.find((t)=>t && t.actor === tabActor);
|
|
8543
|
-
const byUrl = targets.find((t)=>t && t.url === urlToInspect);
|
|
8544
|
-
const match = byActor || byUrl;
|
|
8545
|
-
const ca = (null == match ? void 0 : match.consoleActor) || (null == match ? void 0 : match.webConsoleActor);
|
|
8546
|
-
if ('string' == typeof ca && ca.length > 0) return ca;
|
|
8547
|
-
try {
|
|
8548
|
-
const detail = await this.client.getTargetFromDescriptor(tabActor);
|
|
8549
|
-
const guessed = detail.consoleActor;
|
|
8550
|
-
if ('string' == typeof guessed && guessed.length > 0) return guessed;
|
|
8551
|
-
} catch {}
|
|
8552
|
-
} catch {}
|
|
8553
|
-
await wait(200);
|
|
8554
|
-
}
|
|
8555
|
-
return tabActor;
|
|
8556
|
-
}
|
|
8557
|
-
async printHTML(consoleActor) {
|
|
8558
|
-
if (!this.client) throw new Error('RDP client not initialized');
|
|
8559
|
-
let lastError = null;
|
|
8560
|
-
for(let attempt = 0; attempt < 3; attempt++){
|
|
8561
|
-
let actorToUse = consoleActor;
|
|
8562
|
-
try {
|
|
8563
|
-
if (this.currentTabActor && this.lastUrlToInspect) {
|
|
8564
|
-
const fresh = await this.resolveConsoleActor(this.currentTabActor, this.lastUrlToInspect);
|
|
8565
|
-
if (fresh) actorToUse = fresh;
|
|
8566
|
-
}
|
|
8567
|
-
} catch {}
|
|
8568
|
-
try {
|
|
8569
|
-
const descriptor = this.currentTabActor || actorToUse;
|
|
8570
|
-
if (this.lastUrlToInspect) await this.ensureUrlAndReady(actorToUse, this.lastUrlToInspect);
|
|
8571
|
-
try {
|
|
8572
|
-
const currentUrl = await this.client.evaluate(actorToUse, 'String(location.href)');
|
|
8573
|
-
const currentTitle = await this.client.evaluate(actorToUse, 'String(document.title)');
|
|
8574
|
-
console.log(browsers_lib_messages.dI());
|
|
8575
|
-
console.log(browsers_lib_messages.Hd(`URL: ${currentUrl} | TITLE: ${currentTitle}`));
|
|
8576
|
-
} catch {}
|
|
8577
|
-
const html = await this.client.getPageHTML(descriptor, actorToUse) || '';
|
|
8578
|
-
console.log(html);
|
|
8579
|
-
console.log(browsers_lib_messages.qX());
|
|
8580
|
-
return;
|
|
8581
|
-
} catch (err) {
|
|
8582
|
-
lastError = err;
|
|
8583
|
-
}
|
|
8584
|
-
await wait(200);
|
|
8585
|
-
}
|
|
8586
|
-
throw lastError || new Error(browsers_lib_messages.Cn());
|
|
8587
|
-
}
|
|
8588
|
-
async waitForContentScriptInjection(consoleActor) {
|
|
8589
|
-
if (!this.client) return;
|
|
8590
|
-
const deadline = Date.now() + PAGE_READY_TIMEOUT_MS;
|
|
8591
|
-
while(Date.now() < deadline){
|
|
8592
|
-
try {
|
|
8593
|
-
const injected = await this.client.evaluate(consoleActor, `(() => {
|
|
8594
|
-
const root = document.getElementById('extension-root');
|
|
8595
|
-
if (!root || !root.shadowRoot) return false;
|
|
8596
|
-
const html = root.shadowRoot.innerHTML || '';
|
|
8597
|
-
return html.length > 0;
|
|
8598
|
-
})()`);
|
|
8599
|
-
if (injected) return;
|
|
8600
|
-
} catch {}
|
|
8601
|
-
await wait(200);
|
|
8602
|
-
}
|
|
8603
|
-
}
|
|
8604
|
-
setupWebSocketHandler(websocketServer) {
|
|
8605
|
-
if (!websocketServer || !websocketServer.clients) return;
|
|
8606
|
-
websocketServer.clients.forEach((ws)=>{
|
|
8607
|
-
this.attachConnection(ws);
|
|
8608
|
-
});
|
|
8609
|
-
websocketServer.on('connection', (ws)=>{
|
|
8610
|
-
this.attachConnection(ws);
|
|
8611
|
-
});
|
|
8612
|
-
}
|
|
8613
|
-
attachConnection(ws) {
|
|
8614
|
-
ws.on('message', async (data)=>{
|
|
8615
|
-
try {
|
|
8616
|
-
const message = JSON.parse(data);
|
|
8617
|
-
if ('changedFile' === message.type && this.isWatching) await this.handleFileChange();
|
|
8618
|
-
} catch {}
|
|
8619
|
-
});
|
|
8620
|
-
}
|
|
8621
|
-
async handleFileChange() {
|
|
8622
|
-
if (!this.client || !this.currentConsoleActor) return;
|
|
8623
|
-
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
8624
|
-
this.debounceTimer = setTimeout(async ()=>{
|
|
8625
|
-
try {
|
|
8626
|
-
if (this.currentTabActor && this.lastUrlToInspect) {
|
|
8627
|
-
const freshConsole = await this.resolveConsoleActor(this.currentTabActor, this.lastUrlToInspect);
|
|
8628
|
-
if (freshConsole) this.currentConsoleActor = freshConsole;
|
|
8629
|
-
}
|
|
8630
|
-
if (this.lastUrlToInspect) await this.ensureUrlAndReady(this.currentConsoleActor, this.lastUrlToInspect);
|
|
8631
|
-
await this.waitForContentScriptInjection(this.currentConsoleActor);
|
|
8632
|
-
let lastError = null;
|
|
8633
|
-
for(let attempt = 0; attempt < 3; attempt++){
|
|
8634
|
-
try {
|
|
8635
|
-
const descriptor = this.currentTabActor || this.currentConsoleActor;
|
|
8636
|
-
const html = await this.client.getPageHTML(descriptor, this.currentConsoleActor);
|
|
8637
|
-
console.log(browsers_lib_messages.dI());
|
|
8638
|
-
console.log(browsers_lib_messages.Hd("UPDATED - after content script injection"));
|
|
8639
|
-
console.log(html);
|
|
8640
|
-
console.log(browsers_lib_messages.qX());
|
|
8641
|
-
return;
|
|
8642
|
-
} catch (err) {
|
|
8643
|
-
lastError = err;
|
|
8644
|
-
}
|
|
8645
|
-
await wait(200);
|
|
8646
|
-
}
|
|
8647
|
-
throw lastError || new Error('Failed to update HTML after retries');
|
|
8648
|
-
} catch (err) {
|
|
8649
|
-
console.error(browsers_lib_messages.QB(err.message));
|
|
8650
|
-
}
|
|
8651
|
-
}, CHANGE_DEBOUNCE_MS);
|
|
8652
|
-
}
|
|
8653
|
-
apply(compiler) {
|
|
8654
|
-
if (!this.devOptions.source && !this.devOptions.watchSource) return;
|
|
8655
|
-
compiler.hooks.done.tapAsync('plugin-reload:setup-firefox-inspection', async (_stats, done)=>{
|
|
8656
|
-
try {
|
|
8657
|
-
if (!this.initialized) await this.initialize();
|
|
8658
|
-
const urlToInspect = this.resolveUrlToInspect();
|
|
8659
|
-
this.lastUrlToInspect = urlToInspect;
|
|
8660
|
-
console.log(browsers_lib_messages.hm(urlToInspect));
|
|
8661
|
-
const { tabActor, consoleActor } = await this.selectActors(urlToInspect);
|
|
8662
|
-
this.currentTabActor = tabActor;
|
|
8663
|
-
await this.ensureNavigatedAndLoaded(urlToInspect, tabActor);
|
|
8664
|
-
const resolvedConsoleActor = await this.resolveConsoleActor(tabActor, urlToInspect);
|
|
8665
|
-
this.currentConsoleActor = resolvedConsoleActor || consoleActor;
|
|
8666
|
-
if (this.currentConsoleActor) {
|
|
8667
|
-
await this.waitForContentScriptInjection(this.currentConsoleActor);
|
|
8668
|
-
await this.printHTML(this.currentConsoleActor);
|
|
8669
|
-
}
|
|
8670
|
-
const webSocketServer = compiler.options.webSocketServer;
|
|
8671
|
-
if (this.devOptions.watchSource && webSocketServer && !this.isWatching) {
|
|
8672
|
-
this.isWatching = true;
|
|
8673
|
-
this.setupWebSocketHandler(webSocketServer);
|
|
8674
|
-
}
|
|
8675
|
-
} catch (error) {
|
|
8676
|
-
console.error(browsers_lib_messages.y4(error.message));
|
|
8677
|
-
}
|
|
8678
|
-
done();
|
|
8679
|
-
});
|
|
8680
|
-
}
|
|
8681
|
-
constructor(devOptions){
|
|
8682
|
-
setup_firefox_inspection_define_property(this, "devOptions", void 0);
|
|
8683
|
-
setup_firefox_inspection_define_property(this, "client", null);
|
|
8684
|
-
setup_firefox_inspection_define_property(this, "currentConsoleActor", null);
|
|
8685
|
-
setup_firefox_inspection_define_property(this, "currentTabActor", null);
|
|
8686
|
-
setup_firefox_inspection_define_property(this, "isWatching", false);
|
|
8687
|
-
setup_firefox_inspection_define_property(this, "debounceTimer", null);
|
|
8688
|
-
setup_firefox_inspection_define_property(this, "initialized", false);
|
|
8689
|
-
setup_firefox_inspection_define_property(this, "lastUrlToInspect", null);
|
|
8690
|
-
this.devOptions = devOptions;
|
|
8639
|
+
constructor(options){
|
|
8640
|
+
feature_browser_specific_fields_define_property(this, "browser", void 0);
|
|
8641
|
+
feature_browser_specific_fields_define_property(this, "manifestPath", void 0);
|
|
8642
|
+
this.manifestPath = options.manifestPath;
|
|
8643
|
+
this.browser = options.browser || 'chrome';
|
|
8691
8644
|
}
|
|
8692
8645
|
}
|
|
8693
|
-
function
|
|
8646
|
+
function plugin_compatibility_define_property(obj, key, value) {
|
|
8694
8647
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
8695
8648
|
value: value,
|
|
8696
8649
|
enumerable: true,
|
|
@@ -8700,169 +8653,48 @@ var __webpack_exports__ = {};
|
|
|
8700
8653
|
else obj[key] = value;
|
|
8701
8654
|
return obj;
|
|
8702
8655
|
}
|
|
8703
|
-
class
|
|
8704
|
-
apply(compiler) {
|
|
8705
|
-
if (this.
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
port: this.port,
|
|
8713
|
-
stats: this.stats,
|
|
8714
|
-
instanceId: this.instanceId
|
|
8715
|
-
}).apply(compiler);
|
|
8716
|
-
new setup_reload_strategy({
|
|
8656
|
+
class CompatibilityPlugin {
|
|
8657
|
+
async apply(compiler) {
|
|
8658
|
+
if (this.polyfill) {
|
|
8659
|
+
if ('firefox' !== this.browser) new PolyfillPlugin({
|
|
8660
|
+
manifestPath: this.manifestPath,
|
|
8661
|
+
browser: this.browser || 'chrome'
|
|
8662
|
+
}).apply(compiler);
|
|
8663
|
+
}
|
|
8664
|
+
new BrowserSpecificFieldsPlugin({
|
|
8717
8665
|
manifestPath: this.manifestPath,
|
|
8718
|
-
browser: this.browser
|
|
8719
|
-
autoReload: this.autoReload,
|
|
8720
|
-
stats: this.stats,
|
|
8721
|
-
port: this.port,
|
|
8722
|
-
instanceId: this.instanceId
|
|
8723
|
-
}).apply(compiler);
|
|
8724
|
-
if ('firefox' === this.browser || 'gecko-based' === this.browser) new SetupFirefoxInspectionStep({
|
|
8725
|
-
browser: this.browser,
|
|
8726
|
-
mode: compiler.options.mode || 'development',
|
|
8727
|
-
port: this.port,
|
|
8728
|
-
instanceId: this.instanceId
|
|
8666
|
+
browser: this.browser || 'chrome'
|
|
8729
8667
|
}).apply(compiler);
|
|
8730
8668
|
}
|
|
8731
8669
|
constructor(options){
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
plugin_reload_define_property(this, "stats", void 0);
|
|
8736
|
-
plugin_reload_define_property(this, "autoReload", void 0);
|
|
8737
|
-
plugin_reload_define_property(this, "instanceId", void 0);
|
|
8670
|
+
plugin_compatibility_define_property(this, "manifestPath", void 0);
|
|
8671
|
+
plugin_compatibility_define_property(this, "browser", void 0);
|
|
8672
|
+
plugin_compatibility_define_property(this, "polyfill", void 0);
|
|
8738
8673
|
this.manifestPath = options.manifestPath;
|
|
8739
8674
|
this.browser = options.browser || 'chrome';
|
|
8740
|
-
this.
|
|
8741
|
-
this.stats = options.stats;
|
|
8742
|
-
this.autoReload = options.autoReload;
|
|
8743
|
-
this.instanceId = options.instanceId;
|
|
8675
|
+
this.polyfill = options.polyfill || false;
|
|
8744
8676
|
}
|
|
8745
8677
|
}
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
apply(compiler) {
|
|
8759
|
-
try {
|
|
8760
|
-
const context = compiler.options.context;
|
|
8761
|
-
const polyfillPath = require.resolve('webextension-polyfill/dist/browser-polyfill.js', {
|
|
8762
|
-
paths: [
|
|
8763
|
-
context
|
|
8764
|
-
]
|
|
8765
|
-
});
|
|
8766
|
-
new (core_default()).ProvidePlugin({
|
|
8767
|
-
browser: polyfillPath
|
|
8768
|
-
}).apply(compiler);
|
|
8769
|
-
} catch (error) {
|
|
8770
|
-
console.warn(webpack_lib_messages.or());
|
|
8678
|
+
plugin_compatibility_define_property(CompatibilityPlugin, "name", 'plugin-compatibility');
|
|
8679
|
+
var external_net_ = __webpack_require__("net");
|
|
8680
|
+
var browsers_lib_messages = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
|
|
8681
|
+
function mergeShadowIntoDocument(mainHTML, shadowContent) {
|
|
8682
|
+
try {
|
|
8683
|
+
if (!mainHTML) return '';
|
|
8684
|
+
const hasRoot = /<div id=(["'])extension-root\1/i.test(mainHTML);
|
|
8685
|
+
if (hasRoot) {
|
|
8686
|
+
const emptyRoot = /<div id=(["'])extension-root\1[^>]*><\/div>/i;
|
|
8687
|
+
const replacedEmpty = mainHTML.replace(emptyRoot, `<div id="extension-root">${shadowContent}</div>`);
|
|
8688
|
+
if (replacedEmpty !== mainHTML) return replacedEmpty;
|
|
8689
|
+
return mainHTML.replace(/<div id=(["'])extension-root\1[^>]*>[\s\S]*?<\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
|
|
8771
8690
|
}
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
this.manifestPath = options.manifestPath;
|
|
8777
|
-
this.browser = options.browser;
|
|
8691
|
+
if (/<\/body>/i.test(mainHTML)) return mainHTML.replace(/<\/body>/i, `<div id="extension-root">${shadowContent}</div></body>`);
|
|
8692
|
+
return `${mainHTML}\n<div id="extension-root">${shadowContent}</div>`;
|
|
8693
|
+
} catch {
|
|
8694
|
+
return mainHTML;
|
|
8778
8695
|
}
|
|
8779
8696
|
}
|
|
8780
|
-
function
|
|
8781
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
8782
|
-
value: value,
|
|
8783
|
-
enumerable: true,
|
|
8784
|
-
configurable: true,
|
|
8785
|
-
writable: true
|
|
8786
|
-
});
|
|
8787
|
-
else obj[key] = value;
|
|
8788
|
-
return obj;
|
|
8789
|
-
}
|
|
8790
|
-
class BrowserSpecificFieldsPlugin {
|
|
8791
|
-
patchManifest(manifest) {
|
|
8792
|
-
const patchedManifest = filterKeysForThisBrowser(manifest, this.browser);
|
|
8793
|
-
return JSON.stringify(patchedManifest, null, 2);
|
|
8794
|
-
}
|
|
8795
|
-
apply(compiler) {
|
|
8796
|
-
compiler.hooks.compilation.tap('compatibility:browser-specific-fields', (compilation)=>{
|
|
8797
|
-
compilation.hooks.processAssets.tap({
|
|
8798
|
-
name: 'compatibility:browser-specific-fields',
|
|
8799
|
-
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
8800
|
-
}, ()=>{
|
|
8801
|
-
const manifest = getManifestContent(compilation, this.manifestPath);
|
|
8802
|
-
const patchedSource = this.patchManifest(manifest);
|
|
8803
|
-
const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
|
|
8804
|
-
compilation.updateAsset('manifest.json', rawSource);
|
|
8805
|
-
});
|
|
8806
|
-
});
|
|
8807
|
-
}
|
|
8808
|
-
constructor(options){
|
|
8809
|
-
feature_browser_specific_fields_define_property(this, "browser", void 0);
|
|
8810
|
-
feature_browser_specific_fields_define_property(this, "manifestPath", void 0);
|
|
8811
|
-
this.manifestPath = options.manifestPath;
|
|
8812
|
-
this.browser = options.browser || 'chrome';
|
|
8813
|
-
}
|
|
8814
|
-
}
|
|
8815
|
-
function plugin_compatibility_define_property(obj, key, value) {
|
|
8816
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
8817
|
-
value: value,
|
|
8818
|
-
enumerable: true,
|
|
8819
|
-
configurable: true,
|
|
8820
|
-
writable: true
|
|
8821
|
-
});
|
|
8822
|
-
else obj[key] = value;
|
|
8823
|
-
return obj;
|
|
8824
|
-
}
|
|
8825
|
-
class CompatibilityPlugin {
|
|
8826
|
-
async apply(compiler) {
|
|
8827
|
-
if (this.polyfill) {
|
|
8828
|
-
if ('firefox' !== this.browser) new PolyfillPlugin({
|
|
8829
|
-
manifestPath: this.manifestPath,
|
|
8830
|
-
browser: this.browser || 'chrome'
|
|
8831
|
-
}).apply(compiler);
|
|
8832
|
-
}
|
|
8833
|
-
new BrowserSpecificFieldsPlugin({
|
|
8834
|
-
manifestPath: this.manifestPath,
|
|
8835
|
-
browser: this.browser || 'chrome'
|
|
8836
|
-
}).apply(compiler);
|
|
8837
|
-
}
|
|
8838
|
-
constructor(options){
|
|
8839
|
-
plugin_compatibility_define_property(this, "manifestPath", void 0);
|
|
8840
|
-
plugin_compatibility_define_property(this, "browser", void 0);
|
|
8841
|
-
plugin_compatibility_define_property(this, "polyfill", void 0);
|
|
8842
|
-
this.manifestPath = options.manifestPath;
|
|
8843
|
-
this.browser = options.browser || 'chrome';
|
|
8844
|
-
this.polyfill = options.polyfill || false;
|
|
8845
|
-
}
|
|
8846
|
-
}
|
|
8847
|
-
plugin_compatibility_define_property(CompatibilityPlugin, "name", 'plugin-compatibility');
|
|
8848
|
-
var external_net_ = __webpack_require__("net");
|
|
8849
|
-
function mergeShadowIntoDocument(mainHTML, shadowContent) {
|
|
8850
|
-
try {
|
|
8851
|
-
if (!mainHTML) return '';
|
|
8852
|
-
const hasRoot = /<div id=(["'])extension-root\1/i.test(mainHTML);
|
|
8853
|
-
if (hasRoot) {
|
|
8854
|
-
const emptyRoot = /<div id=(["'])extension-root\1[^>]*><\/div>/i;
|
|
8855
|
-
const replacedEmpty = mainHTML.replace(emptyRoot, `<div id="extension-root">${shadowContent}</div>`);
|
|
8856
|
-
if (replacedEmpty !== mainHTML) return replacedEmpty;
|
|
8857
|
-
return mainHTML.replace(/<div id=(["'])extension-root\1[^>]*>[\s\S]*?<\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
|
|
8858
|
-
}
|
|
8859
|
-
if (/<\/body>/i.test(mainHTML)) return mainHTML.replace(/<\/body>/i, `<div id="extension-root">${shadowContent}</div></body>`);
|
|
8860
|
-
return `${mainHTML}\n<div id="extension-root">${shadowContent}</div>`;
|
|
8861
|
-
} catch {
|
|
8862
|
-
return mainHTML;
|
|
8863
|
-
}
|
|
8864
|
-
}
|
|
8865
|
-
function cdp_client_define_property(obj, key, value) {
|
|
8697
|
+
function cdp_client_define_property(obj, key, value) {
|
|
8866
8698
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
8867
8699
|
value: value,
|
|
8868
8700
|
enumerable: true,
|
|
@@ -9173,6 +9005,7 @@ var __webpack_exports__ = {};
|
|
|
9173
9005
|
socket.connect(port, 'localhost');
|
|
9174
9006
|
});
|
|
9175
9007
|
}
|
|
9008
|
+
var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
|
|
9176
9009
|
function setup_chrome_inspection_define_property(obj, key, value) {
|
|
9177
9010
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
9178
9011
|
value: value,
|
|
@@ -9184,11 +9017,18 @@ var __webpack_exports__ = {};
|
|
|
9184
9017
|
return obj;
|
|
9185
9018
|
}
|
|
9186
9019
|
class SetupChromeInspectionStep {
|
|
9187
|
-
getCdpPort() {
|
|
9188
|
-
|
|
9020
|
+
async getCdpPort() {
|
|
9021
|
+
const instanceId = this.devOptions.instanceId;
|
|
9022
|
+
if (instanceId) try {
|
|
9023
|
+
const instanceManager = new instance_manager.InstanceManager(process.cwd());
|
|
9024
|
+
const instance = await instanceManager.getInstance(instanceId);
|
|
9025
|
+
if ((null == instance ? void 0 : instance.debugPort) && Number.isFinite(instance.debugPort)) return instance.debugPort;
|
|
9026
|
+
} catch {}
|
|
9027
|
+
return (0, shared_utils.Zb)(this.devOptions.port, instanceId);
|
|
9189
9028
|
}
|
|
9190
|
-
async initialize(port
|
|
9029
|
+
async initialize(port) {
|
|
9191
9030
|
try {
|
|
9031
|
+
if (!port) port = await this.getCdpPort();
|
|
9192
9032
|
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.Ro());
|
|
9193
9033
|
let retries = 0;
|
|
9194
9034
|
const maxRetries = 60;
|
|
@@ -9213,160 +9053,439 @@ var __webpack_exports__ = {};
|
|
|
9213
9053
|
throw error;
|
|
9214
9054
|
}
|
|
9215
9055
|
}
|
|
9216
|
-
async inspectSource(url) {
|
|
9217
|
-
if (!this.cdpClient) throw new Error(browsers_lib_messages.mO());
|
|
9056
|
+
async inspectSource(url) {
|
|
9057
|
+
if (!this.cdpClient) throw new Error(browsers_lib_messages.mO());
|
|
9058
|
+
try {
|
|
9059
|
+
if ('development' === process.env.EXTENSION_ENV) {
|
|
9060
|
+
console.log(browsers_lib_messages.Zk(url));
|
|
9061
|
+
console.log(browsers_lib_messages.Tz());
|
|
9062
|
+
}
|
|
9063
|
+
const targets = await this.cdpClient.getTargets();
|
|
9064
|
+
const existingTarget = targets.find((target)=>target.url === url && 'page' === target.type);
|
|
9065
|
+
if (existingTarget) {
|
|
9066
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.F0(existingTarget.targetId));
|
|
9067
|
+
this.currentTargetId = existingTarget.targetId;
|
|
9068
|
+
} else {
|
|
9069
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.v5());
|
|
9070
|
+
this.currentTargetId = await this.cdpClient.createTarget(url);
|
|
9071
|
+
if ('development' === process.env.EXTENSION_ENV) {
|
|
9072
|
+
console.log(browsers_lib_messages.N_(this.currentTargetId));
|
|
9073
|
+
console.log(browsers_lib_messages.Ac());
|
|
9074
|
+
}
|
|
9075
|
+
await this.cdpClient.navigateToUrl(this.currentTargetId, url);
|
|
9076
|
+
}
|
|
9077
|
+
if (!this.currentTargetId) throw new Error('Failed to get or create target');
|
|
9078
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.tX());
|
|
9079
|
+
this.currentSessionId = await this.cdpClient.attachToTarget(this.currentTargetId);
|
|
9080
|
+
if ('development' === process.env.EXTENSION_ENV) {
|
|
9081
|
+
console.log(browsers_lib_messages.GR(this.currentSessionId));
|
|
9082
|
+
console.log(browsers_lib_messages.xR());
|
|
9083
|
+
}
|
|
9084
|
+
await this.cdpClient.sendCommand('Page.enable', {}, this.currentSessionId);
|
|
9085
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages._y());
|
|
9086
|
+
await this.cdpClient.waitForLoadEvent(this.currentSessionId);
|
|
9087
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.Ak());
|
|
9088
|
+
await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
|
|
9089
|
+
const html = await this.cdpClient.getPageHTML(this.currentSessionId);
|
|
9090
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.tg());
|
|
9091
|
+
return html;
|
|
9092
|
+
} catch (error) {
|
|
9093
|
+
if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.L7(error.message));
|
|
9094
|
+
throw error;
|
|
9095
|
+
}
|
|
9096
|
+
}
|
|
9097
|
+
async startWatching(websocketServer) {
|
|
9098
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9099
|
+
if (this.isWatching) return void console.log(browsers_lib_messages.Li());
|
|
9100
|
+
this.isWatching = true;
|
|
9101
|
+
console.log(browsers_lib_messages.G9());
|
|
9102
|
+
this.setupWebSocketHandler(websocketServer);
|
|
9103
|
+
console.log(browsers_lib_messages.A4());
|
|
9104
|
+
}
|
|
9105
|
+
setupWebSocketHandler(websocketServer) {
|
|
9106
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9107
|
+
if (!websocketServer || !websocketServer.clients) return void console.warn(browsers_lib_messages.c9());
|
|
9108
|
+
websocketServer.clients.forEach((ws)=>{
|
|
9109
|
+
this.setupConnectionHandler(ws);
|
|
9110
|
+
});
|
|
9111
|
+
websocketServer.on('connection', (ws)=>{
|
|
9112
|
+
this.setupConnectionHandler(ws);
|
|
9113
|
+
});
|
|
9114
|
+
}
|
|
9115
|
+
setupConnectionHandler(ws) {
|
|
9116
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9117
|
+
ws.on('message', async (data)=>{
|
|
9118
|
+
try {
|
|
9119
|
+
const message = JSON.parse(data);
|
|
9120
|
+
if ('changedFile' === message.type && this.isWatching) await this.handleFileChange();
|
|
9121
|
+
} catch (error) {}
|
|
9122
|
+
});
|
|
9123
|
+
}
|
|
9124
|
+
stopWatching() {
|
|
9125
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9126
|
+
this.isWatching = false;
|
|
9127
|
+
console.log(browsers_lib_messages.aW());
|
|
9128
|
+
}
|
|
9129
|
+
async handleFileChange() {
|
|
9130
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9131
|
+
if (!this.cdpClient || !this.currentSessionId) return void console.warn(browsers_lib_messages.ln());
|
|
9132
|
+
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
9133
|
+
this.debounceTimer = setTimeout(async ()=>{
|
|
9134
|
+
try {
|
|
9135
|
+
console.log(browsers_lib_messages.ET());
|
|
9136
|
+
console.log(browsers_lib_messages.Tq());
|
|
9137
|
+
await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
|
|
9138
|
+
console.log(browsers_lib_messages.ov());
|
|
9139
|
+
const html = await this.cdpClient.getPageHTML(this.currentSessionId);
|
|
9140
|
+
this.printUpdatedHTML(html);
|
|
9141
|
+
} catch (error) {
|
|
9142
|
+
console.error(browsers_lib_messages.QB(error.message));
|
|
9143
|
+
if (error.message.includes('session') || error.message.includes('target')) {
|
|
9144
|
+
console.log(browsers_lib_messages.Lf());
|
|
9145
|
+
await this.reconnectToTarget();
|
|
9146
|
+
}
|
|
9147
|
+
}
|
|
9148
|
+
}, 300);
|
|
9149
|
+
}
|
|
9150
|
+
async reconnectToTarget() {
|
|
9151
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9152
|
+
try {
|
|
9153
|
+
if (!this.cdpClient || !this.currentTargetId) return void console.warn(browsers_lib_messages.DQ());
|
|
9154
|
+
console.log(browsers_lib_messages.S6());
|
|
9155
|
+
this.currentSessionId = await this.cdpClient.attachToTarget(this.currentTargetId);
|
|
9156
|
+
console.log(browsers_lib_messages.BK(this.currentSessionId));
|
|
9157
|
+
} catch (error) {
|
|
9158
|
+
console.error(browsers_lib_messages.w4(error.message));
|
|
9159
|
+
}
|
|
9160
|
+
}
|
|
9161
|
+
printHTML(html) {
|
|
9162
|
+
console.log(browsers_lib_messages.dI());
|
|
9163
|
+
console.log(html);
|
|
9164
|
+
console.log(browsers_lib_messages.qX());
|
|
9165
|
+
}
|
|
9166
|
+
printUpdatedHTML(html) {
|
|
9167
|
+
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9168
|
+
console.log(browsers_lib_messages.dI());
|
|
9169
|
+
console.log(browsers_lib_messages.Hd("UPDATED - after content script injection"));
|
|
9170
|
+
console.log(browsers_lib_messages.dI());
|
|
9171
|
+
console.log(html);
|
|
9172
|
+
console.log(browsers_lib_messages.qX());
|
|
9173
|
+
}
|
|
9174
|
+
async cleanup() {
|
|
9175
|
+
try {
|
|
9176
|
+
if ('development' === process.env.EXTENSION_ENV) this.stopWatching();
|
|
9177
|
+
if (this.cdpClient && this.currentTargetId) await this.cdpClient.closeTarget(this.currentTargetId);
|
|
9178
|
+
if (this.cdpClient) this.cdpClient.disconnect();
|
|
9179
|
+
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.S5());
|
|
9180
|
+
} catch (error) {
|
|
9181
|
+
if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.oP(error.message));
|
|
9182
|
+
}
|
|
9183
|
+
}
|
|
9184
|
+
apply(compiler) {
|
|
9185
|
+
if (!this.devOptions.source && !this.devOptions.watchSource) return;
|
|
9186
|
+
compiler.hooks.done.tapAsync('plugin-reload:setup-chrome-inspection', async (stats, done)=>{
|
|
9187
|
+
try {
|
|
9188
|
+
if (!this.isInitialized) await this.initialize();
|
|
9189
|
+
let urlToInspect;
|
|
9190
|
+
if (this.devOptions.source && 'string' == typeof this.devOptions.source && 'true' !== this.devOptions.source) urlToInspect = this.devOptions.source;
|
|
9191
|
+
else if (this.devOptions.startingUrl) urlToInspect = this.devOptions.startingUrl;
|
|
9192
|
+
else throw new Error(browsers_lib_messages.Ym());
|
|
9193
|
+
const html = await this.inspectSource(urlToInspect);
|
|
9194
|
+
this.printHTML(html);
|
|
9195
|
+
const webSocketServer = compiler.options.webSocketServer;
|
|
9196
|
+
if (this.devOptions.watchSource && webSocketServer && 'development' === process.env.EXTENSION_ENV) this.startWatching(webSocketServer);
|
|
9197
|
+
done();
|
|
9198
|
+
} catch (error) {
|
|
9199
|
+
if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.y4(error.message));
|
|
9200
|
+
done();
|
|
9201
|
+
}
|
|
9202
|
+
});
|
|
9203
|
+
}
|
|
9204
|
+
constructor(devOptions){
|
|
9205
|
+
setup_chrome_inspection_define_property(this, "devOptions", void 0);
|
|
9206
|
+
setup_chrome_inspection_define_property(this, "cdpClient", null);
|
|
9207
|
+
setup_chrome_inspection_define_property(this, "currentTargetId", null);
|
|
9208
|
+
setup_chrome_inspection_define_property(this, "currentSessionId", null);
|
|
9209
|
+
setup_chrome_inspection_define_property(this, "isInitialized", false);
|
|
9210
|
+
this.devOptions = devOptions;
|
|
9211
|
+
}
|
|
9212
|
+
}
|
|
9213
|
+
var messaging_client = __webpack_require__("./webpack/plugin-browsers/run-firefox/remote-firefox/messaging-client.ts");
|
|
9214
|
+
function setup_firefox_inspection_define_property(obj, key, value) {
|
|
9215
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
9216
|
+
value: value,
|
|
9217
|
+
enumerable: true,
|
|
9218
|
+
configurable: true,
|
|
9219
|
+
writable: true
|
|
9220
|
+
});
|
|
9221
|
+
else obj[key] = value;
|
|
9222
|
+
return obj;
|
|
9223
|
+
}
|
|
9224
|
+
const MAX_CONNECT_RETRIES = 60;
|
|
9225
|
+
const CONNECT_RETRY_INTERVAL_MS = 500;
|
|
9226
|
+
const PAGE_READY_TIMEOUT_MS = 8000;
|
|
9227
|
+
const TARGET_SCAN_INTERVAL_MS = 250;
|
|
9228
|
+
const CHANGE_DEBOUNCE_MS = 300;
|
|
9229
|
+
function wait(ms) {
|
|
9230
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
9231
|
+
}
|
|
9232
|
+
class SetupFirefoxInspectionStep {
|
|
9233
|
+
async getRdpPort() {
|
|
9234
|
+
const instanceId = this.devOptions.instanceId;
|
|
9235
|
+
if (instanceId) try {
|
|
9236
|
+
const instanceManager = new instance_manager.InstanceManager(process.cwd());
|
|
9237
|
+
const instance = await instanceManager.getInstance(instanceId);
|
|
9238
|
+
if ((null == instance ? void 0 : instance.debugPort) && Number.isFinite(instance.debugPort)) return instance.debugPort;
|
|
9239
|
+
} catch {}
|
|
9240
|
+
return (0, shared_utils.Zb)(this.devOptions.port, instanceId);
|
|
9241
|
+
}
|
|
9242
|
+
async initialize() {
|
|
9243
|
+
if (this.initialized) return;
|
|
9244
|
+
const client = new messaging_client.v();
|
|
9245
|
+
const port = await this.getRdpPort();
|
|
9246
|
+
try {
|
|
9247
|
+
console.log(browsers_lib_messages.l());
|
|
9248
|
+
} catch {}
|
|
9249
|
+
let retries = 0;
|
|
9250
|
+
while(retries < MAX_CONNECT_RETRIES)try {
|
|
9251
|
+
await client.connect(port);
|
|
9252
|
+
this.client = client;
|
|
9253
|
+
this.initialized = true;
|
|
9254
|
+
try {
|
|
9255
|
+
console.log(browsers_lib_messages.Xy());
|
|
9256
|
+
console.log(browsers_lib_messages.Qe());
|
|
9257
|
+
} catch {}
|
|
9258
|
+
return;
|
|
9259
|
+
} catch (err) {
|
|
9260
|
+
retries++;
|
|
9261
|
+
if (retries % 10 === 0) try {
|
|
9262
|
+
console.log(browsers_lib_messages.X_(retries, MAX_CONNECT_RETRIES));
|
|
9263
|
+
} catch {}
|
|
9264
|
+
await wait(CONNECT_RETRY_INTERVAL_MS);
|
|
9265
|
+
}
|
|
9266
|
+
throw new Error(browsers_lib_messages.V9(port));
|
|
9267
|
+
}
|
|
9268
|
+
resolveUrlToInspect() {
|
|
9269
|
+
if (this.devOptions.source && 'string' == typeof this.devOptions.source && 'true' !== this.devOptions.source) return this.devOptions.source;
|
|
9270
|
+
if (this.devOptions.startingUrl) return this.devOptions.startingUrl;
|
|
9271
|
+
throw new Error(browsers_lib_messages.Ym());
|
|
9272
|
+
}
|
|
9273
|
+
async selectActors(urlToInspect) {
|
|
9274
|
+
if (!this.client) throw new Error(browsers_lib_messages.pl());
|
|
9275
|
+
const deadline = Date.now() + 10000;
|
|
9276
|
+
let triedAddTab = false;
|
|
9277
|
+
while(Date.now() < deadline){
|
|
9278
|
+
const allTargets = await this.client.getTargets() || [];
|
|
9279
|
+
for (const target of allTargets)if (target && 'string' == typeof target.url && target.url === urlToInspect && target.actor) return {
|
|
9280
|
+
tabActor: target.actor,
|
|
9281
|
+
consoleActor: target.consoleActor || target.actor
|
|
9282
|
+
};
|
|
9283
|
+
if (!triedAddTab && urlToInspect) {
|
|
9284
|
+
triedAddTab = true;
|
|
9285
|
+
try {
|
|
9286
|
+
await this.client.addTab(urlToInspect);
|
|
9287
|
+
await wait(300);
|
|
9288
|
+
continue;
|
|
9289
|
+
} catch {}
|
|
9290
|
+
}
|
|
9291
|
+
for (const target of allTargets)if (target && (target.actor || target.outerWindowID)) return {
|
|
9292
|
+
tabActor: target.actor,
|
|
9293
|
+
consoleActor: target.consoleActor || target.actor
|
|
9294
|
+
};
|
|
9295
|
+
await wait(TARGET_SCAN_INTERVAL_MS);
|
|
9296
|
+
}
|
|
9297
|
+
throw new Error(browsers_lib_messages.qP());
|
|
9298
|
+
}
|
|
9299
|
+
async ensureNavigatedAndLoaded(urlToInspect, tabActor) {
|
|
9300
|
+
if (!this.client) throw new Error(browsers_lib_messages.pl());
|
|
9301
|
+
if (!tabActor) throw new Error(browsers_lib_messages.Do());
|
|
9302
|
+
let consoleActor = tabActor;
|
|
9303
|
+
let frameActor = tabActor;
|
|
9304
|
+
try {
|
|
9305
|
+
const detail = await this.client.getTargetFromDescriptor(tabActor);
|
|
9306
|
+
if (detail.consoleActor) consoleActor = detail.consoleActor;
|
|
9307
|
+
if (detail.targetActor) frameActor = detail.targetActor;
|
|
9308
|
+
} catch {}
|
|
9309
|
+
try {
|
|
9310
|
+
await this.client.attach(frameActor);
|
|
9311
|
+
} catch {}
|
|
9312
|
+
try {
|
|
9313
|
+
await this.client.navigateViaScript(consoleActor, urlToInspect);
|
|
9314
|
+
await this.client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
|
|
9315
|
+
return;
|
|
9316
|
+
} catch {}
|
|
9317
|
+
try {
|
|
9318
|
+
const detail = await this.client.getTargetFromDescriptor(tabActor);
|
|
9319
|
+
const targetActor = detail.targetActor || tabActor;
|
|
9320
|
+
try {
|
|
9321
|
+
await this.client.attach(targetActor);
|
|
9322
|
+
} catch {}
|
|
9323
|
+
await this.client.navigate(targetActor, urlToInspect);
|
|
9324
|
+
await this.client.waitForLoadEvent(targetActor);
|
|
9325
|
+
} catch {}
|
|
9326
|
+
}
|
|
9327
|
+
async ensureUrlAndReady(consoleActor, urlToInspect) {
|
|
9328
|
+
if (!this.client) return;
|
|
9218
9329
|
try {
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9330
|
+
const href = await this.client.evaluate(consoleActor, 'String(location.href)');
|
|
9331
|
+
if ('string' != typeof href || !href.startsWith(urlToInspect)) await this.client.navigateViaScript(consoleActor, urlToInspect);
|
|
9332
|
+
} catch {}
|
|
9333
|
+
await this.client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
|
|
9334
|
+
}
|
|
9335
|
+
async resolveConsoleActor(tabActor, urlToInspect) {
|
|
9336
|
+
if (!this.client) throw new Error(browsers_lib_messages.pl());
|
|
9337
|
+
const start = Date.now();
|
|
9338
|
+
while(Date.now() - start < PAGE_READY_TIMEOUT_MS){
|
|
9339
|
+
try {
|
|
9340
|
+
const targets = await this.client.getTargets();
|
|
9341
|
+
const byActor = targets.find((t)=>t && t.actor === tabActor);
|
|
9342
|
+
const byUrl = targets.find((t)=>t && t.url === urlToInspect);
|
|
9343
|
+
const match = byActor || byUrl;
|
|
9344
|
+
const ca = (null == match ? void 0 : match.consoleActor) || (null == match ? void 0 : match.webConsoleActor);
|
|
9345
|
+
if ('string' == typeof ca && ca.length > 0) return ca;
|
|
9346
|
+
try {
|
|
9347
|
+
const detail = await this.client.getTargetFromDescriptor(tabActor);
|
|
9348
|
+
const guessed = detail.consoleActor;
|
|
9349
|
+
if ('string' == typeof guessed && guessed.length > 0) return guessed;
|
|
9350
|
+
} catch {}
|
|
9351
|
+
} catch {}
|
|
9352
|
+
await wait(200);
|
|
9353
|
+
}
|
|
9354
|
+
return tabActor;
|
|
9355
|
+
}
|
|
9356
|
+
async printHTML(consoleActor) {
|
|
9357
|
+
if (!this.client) throw new Error('RDP client not initialized');
|
|
9358
|
+
let lastError = null;
|
|
9359
|
+
for(let attempt = 0; attempt < 3; attempt++){
|
|
9360
|
+
let actorToUse = consoleActor;
|
|
9361
|
+
try {
|
|
9362
|
+
if (this.currentTabActor && this.lastUrlToInspect) {
|
|
9363
|
+
const fresh = await this.resolveConsoleActor(this.currentTabActor, this.lastUrlToInspect);
|
|
9364
|
+
if (fresh) actorToUse = fresh;
|
|
9234
9365
|
}
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9366
|
+
} catch {}
|
|
9367
|
+
try {
|
|
9368
|
+
const descriptor = this.currentTabActor || actorToUse;
|
|
9369
|
+
if (this.lastUrlToInspect) await this.ensureUrlAndReady(actorToUse, this.lastUrlToInspect);
|
|
9370
|
+
try {
|
|
9371
|
+
const currentUrl = await this.client.evaluate(actorToUse, 'String(location.href)');
|
|
9372
|
+
const currentTitle = await this.client.evaluate(actorToUse, 'String(document.title)');
|
|
9373
|
+
console.log(browsers_lib_messages.dI());
|
|
9374
|
+
console.log(browsers_lib_messages.Hd(`URL: ${currentUrl} | TITLE: ${currentTitle}`));
|
|
9375
|
+
} catch {}
|
|
9376
|
+
const html = await this.client.getPageHTML(descriptor, actorToUse) || '';
|
|
9377
|
+
console.log(html);
|
|
9378
|
+
console.log(browsers_lib_messages.qX());
|
|
9379
|
+
return;
|
|
9380
|
+
} catch (err) {
|
|
9381
|
+
lastError = err;
|
|
9243
9382
|
}
|
|
9244
|
-
await
|
|
9245
|
-
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages._y());
|
|
9246
|
-
await this.cdpClient.waitForLoadEvent(this.currentSessionId);
|
|
9247
|
-
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.Ak());
|
|
9248
|
-
await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
|
|
9249
|
-
const html = await this.cdpClient.getPageHTML(this.currentSessionId);
|
|
9250
|
-
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.tg());
|
|
9251
|
-
return html;
|
|
9252
|
-
} catch (error) {
|
|
9253
|
-
if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.L7(error.message));
|
|
9254
|
-
throw error;
|
|
9383
|
+
await wait(200);
|
|
9255
9384
|
}
|
|
9385
|
+
throw lastError || new Error(browsers_lib_messages.Cn());
|
|
9256
9386
|
}
|
|
9257
|
-
async
|
|
9258
|
-
if (
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9387
|
+
async waitForContentScriptInjection(consoleActor) {
|
|
9388
|
+
if (!this.client) return;
|
|
9389
|
+
const deadline = Date.now() + PAGE_READY_TIMEOUT_MS;
|
|
9390
|
+
while(Date.now() < deadline){
|
|
9391
|
+
try {
|
|
9392
|
+
const injected = await this.client.evaluate(consoleActor, `(() => {
|
|
9393
|
+
const root = document.getElementById('extension-root');
|
|
9394
|
+
if (!root || !root.shadowRoot) return false;
|
|
9395
|
+
const html = root.shadowRoot.innerHTML || '';
|
|
9396
|
+
return html.length > 0;
|
|
9397
|
+
})()`);
|
|
9398
|
+
if (injected) return;
|
|
9399
|
+
} catch {}
|
|
9400
|
+
await wait(200);
|
|
9401
|
+
}
|
|
9264
9402
|
}
|
|
9265
9403
|
setupWebSocketHandler(websocketServer) {
|
|
9266
|
-
if (
|
|
9267
|
-
if (!websocketServer || !websocketServer.clients) return void console.warn(browsers_lib_messages.c9());
|
|
9404
|
+
if (!websocketServer || !websocketServer.clients) return;
|
|
9268
9405
|
websocketServer.clients.forEach((ws)=>{
|
|
9269
|
-
this.
|
|
9406
|
+
this.attachConnection(ws);
|
|
9270
9407
|
});
|
|
9271
9408
|
websocketServer.on('connection', (ws)=>{
|
|
9272
|
-
this.
|
|
9409
|
+
this.attachConnection(ws);
|
|
9273
9410
|
});
|
|
9274
9411
|
}
|
|
9275
|
-
|
|
9276
|
-
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9412
|
+
attachConnection(ws) {
|
|
9277
9413
|
ws.on('message', async (data)=>{
|
|
9278
9414
|
try {
|
|
9279
9415
|
const message = JSON.parse(data);
|
|
9280
9416
|
if ('changedFile' === message.type && this.isWatching) await this.handleFileChange();
|
|
9281
|
-
} catch
|
|
9417
|
+
} catch {}
|
|
9282
9418
|
});
|
|
9283
9419
|
}
|
|
9284
|
-
stopWatching() {
|
|
9285
|
-
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9286
|
-
this.isWatching = false;
|
|
9287
|
-
console.log(browsers_lib_messages.aW());
|
|
9288
|
-
}
|
|
9289
9420
|
async handleFileChange() {
|
|
9290
|
-
if (
|
|
9291
|
-
if (!this.cdpClient || !this.currentSessionId) return void console.warn(browsers_lib_messages.ln());
|
|
9421
|
+
if (!this.client || !this.currentConsoleActor) return;
|
|
9292
9422
|
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
9293
9423
|
this.debounceTimer = setTimeout(async ()=>{
|
|
9294
9424
|
try {
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
this.
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9425
|
+
if (this.currentTabActor && this.lastUrlToInspect) {
|
|
9426
|
+
const freshConsole = await this.resolveConsoleActor(this.currentTabActor, this.lastUrlToInspect);
|
|
9427
|
+
if (freshConsole) this.currentConsoleActor = freshConsole;
|
|
9428
|
+
}
|
|
9429
|
+
if (this.lastUrlToInspect) await this.ensureUrlAndReady(this.currentConsoleActor, this.lastUrlToInspect);
|
|
9430
|
+
await this.waitForContentScriptInjection(this.currentConsoleActor);
|
|
9431
|
+
let lastError = null;
|
|
9432
|
+
for(let attempt = 0; attempt < 3; attempt++){
|
|
9433
|
+
try {
|
|
9434
|
+
const descriptor = this.currentTabActor || this.currentConsoleActor;
|
|
9435
|
+
const html = await this.client.getPageHTML(descriptor, this.currentConsoleActor);
|
|
9436
|
+
console.log(browsers_lib_messages.dI());
|
|
9437
|
+
console.log(browsers_lib_messages.Hd("UPDATED - after content script injection"));
|
|
9438
|
+
console.log(html);
|
|
9439
|
+
console.log(browsers_lib_messages.qX());
|
|
9440
|
+
return;
|
|
9441
|
+
} catch (err) {
|
|
9442
|
+
lastError = err;
|
|
9443
|
+
}
|
|
9444
|
+
await wait(200);
|
|
9306
9445
|
}
|
|
9446
|
+
throw lastError || new Error('Failed to update HTML after retries');
|
|
9447
|
+
} catch (err) {
|
|
9448
|
+
console.error(browsers_lib_messages.QB(err.message));
|
|
9307
9449
|
}
|
|
9308
|
-
},
|
|
9309
|
-
}
|
|
9310
|
-
async reconnectToTarget() {
|
|
9311
|
-
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9312
|
-
try {
|
|
9313
|
-
if (!this.cdpClient || !this.currentTargetId) return void console.warn(browsers_lib_messages.DQ());
|
|
9314
|
-
console.log(browsers_lib_messages.S6());
|
|
9315
|
-
this.currentSessionId = await this.cdpClient.attachToTarget(this.currentTargetId);
|
|
9316
|
-
console.log(browsers_lib_messages.BK(this.currentSessionId));
|
|
9317
|
-
} catch (error) {
|
|
9318
|
-
console.error(browsers_lib_messages.w4(error.message));
|
|
9319
|
-
}
|
|
9320
|
-
}
|
|
9321
|
-
printHTML(html) {
|
|
9322
|
-
console.log(browsers_lib_messages.dI());
|
|
9323
|
-
console.log(html);
|
|
9324
|
-
console.log(browsers_lib_messages.qX());
|
|
9325
|
-
}
|
|
9326
|
-
printUpdatedHTML(html) {
|
|
9327
|
-
if ('development' !== process.env.EXTENSION_ENV) return;
|
|
9328
|
-
console.log(browsers_lib_messages.dI());
|
|
9329
|
-
console.log(browsers_lib_messages.Hd("UPDATED - after content script injection"));
|
|
9330
|
-
console.log(browsers_lib_messages.dI());
|
|
9331
|
-
console.log(html);
|
|
9332
|
-
console.log(browsers_lib_messages.qX());
|
|
9333
|
-
}
|
|
9334
|
-
async cleanup() {
|
|
9335
|
-
try {
|
|
9336
|
-
if ('development' === process.env.EXTENSION_ENV) this.stopWatching();
|
|
9337
|
-
if (this.cdpClient && this.currentTargetId) await this.cdpClient.closeTarget(this.currentTargetId);
|
|
9338
|
-
if (this.cdpClient) this.cdpClient.disconnect();
|
|
9339
|
-
if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.S5());
|
|
9340
|
-
} catch (error) {
|
|
9341
|
-
if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.oP(error.message));
|
|
9342
|
-
}
|
|
9450
|
+
}, CHANGE_DEBOUNCE_MS);
|
|
9343
9451
|
}
|
|
9344
9452
|
apply(compiler) {
|
|
9345
9453
|
if (!this.devOptions.source && !this.devOptions.watchSource) return;
|
|
9346
|
-
compiler.hooks.done.tapAsync('plugin-reload:setup-
|
|
9454
|
+
compiler.hooks.done.tapAsync('plugin-reload:setup-firefox-inspection', async (_stats, done)=>{
|
|
9347
9455
|
try {
|
|
9348
|
-
if (!this.
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
this.
|
|
9456
|
+
if (!this.initialized) await this.initialize();
|
|
9457
|
+
const urlToInspect = this.resolveUrlToInspect();
|
|
9458
|
+
this.lastUrlToInspect = urlToInspect;
|
|
9459
|
+
console.log(browsers_lib_messages.hm(urlToInspect));
|
|
9460
|
+
const { tabActor, consoleActor } = await this.selectActors(urlToInspect);
|
|
9461
|
+
this.currentTabActor = tabActor;
|
|
9462
|
+
await this.ensureNavigatedAndLoaded(urlToInspect, tabActor);
|
|
9463
|
+
const resolvedConsoleActor = await this.resolveConsoleActor(tabActor, urlToInspect);
|
|
9464
|
+
this.currentConsoleActor = resolvedConsoleActor || consoleActor;
|
|
9465
|
+
if (this.currentConsoleActor) {
|
|
9466
|
+
await this.waitForContentScriptInjection(this.currentConsoleActor);
|
|
9467
|
+
await this.printHTML(this.currentConsoleActor);
|
|
9468
|
+
}
|
|
9355
9469
|
const webSocketServer = compiler.options.webSocketServer;
|
|
9356
|
-
if (this.devOptions.watchSource && webSocketServer &&
|
|
9357
|
-
|
|
9470
|
+
if (this.devOptions.watchSource && webSocketServer && !this.isWatching) {
|
|
9471
|
+
this.isWatching = true;
|
|
9472
|
+
this.setupWebSocketHandler(webSocketServer);
|
|
9473
|
+
}
|
|
9358
9474
|
} catch (error) {
|
|
9359
|
-
|
|
9360
|
-
done();
|
|
9475
|
+
console.error(browsers_lib_messages.y4(error.message));
|
|
9361
9476
|
}
|
|
9477
|
+
done();
|
|
9362
9478
|
});
|
|
9363
9479
|
}
|
|
9364
9480
|
constructor(devOptions){
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9481
|
+
setup_firefox_inspection_define_property(this, "devOptions", void 0);
|
|
9482
|
+
setup_firefox_inspection_define_property(this, "client", null);
|
|
9483
|
+
setup_firefox_inspection_define_property(this, "currentConsoleActor", null);
|
|
9484
|
+
setup_firefox_inspection_define_property(this, "currentTabActor", null);
|
|
9485
|
+
setup_firefox_inspection_define_property(this, "isWatching", false);
|
|
9486
|
+
setup_firefox_inspection_define_property(this, "debounceTimer", null);
|
|
9487
|
+
setup_firefox_inspection_define_property(this, "initialized", false);
|
|
9488
|
+
setup_firefox_inspection_define_property(this, "lastUrlToInspect", null);
|
|
9370
9489
|
this.devOptions = devOptions;
|
|
9371
9490
|
}
|
|
9372
9491
|
}
|