extension-develop 2.0.4 → 2.1.1

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
@@ -77,7 +77,7 @@ var __webpack_modules__ = {
77
77
  const extensionId = instance.managerExtensionId;
78
78
  const instanceId = instance.instanceId;
79
79
  const extensionName = "Extension.js DevTools";
80
- const extensionDescription = `Extension.js built-in developer tools for instance ${instanceId.slice(0, 8)}`;
80
+ const extensionDescription = `Extension.js built-in developer tools for instance ${instanceId.slice(0, 8)}.`;
81
81
  const baseManifest = await this.readBaseManifest(instance.browser);
82
82
  const baseServiceWorker = await this.readBaseServiceWorker(instance.browser);
83
83
  const manifest = {
@@ -86,7 +86,7 @@ var __webpack_modules__ = {
86
86
  description: extensionDescription,
87
87
  key: this.generateExtensionKey()
88
88
  };
89
- const serviceWorkerContent = baseServiceWorker.replace(/const\s+port\s*=\s*['"](__RELOAD_PORT__|\d+)['"]/, `const port = '${instance.webSocketPort}'`).replace(/const\s+instanceId\s*=\s*['"](__INSTANCE_ID__|\w+)['"]/, `const instanceId = '${instance.instanceId}'`);
89
+ const serviceWorkerContent = baseServiceWorker.replace(/const\s+port\s*=\s*['"][^'"]+['"]/, `const port = '${instance.webSocketPort}'`).replace(/const\s+instanceId\s*=\s*['"][^'"]+['"]/, `const instanceId = '${instance.instanceId}'`);
90
90
  const enhancedServiceWorker = `// Instance: ${instanceId}\n// Generated: ${new Date().toISOString()}\n// Cache-buster: ${Date.now()}\n\n${serviceWorkerContent}\n\n// Instance-specific logging\n${'development' === process.env.EXTENSION_ENV ? `console.log('[Extension.js DevTools] Instance ${instanceId} initialized on port ${instance.webSocketPort}');` : ''}\n`;
91
91
  const extensionPath = path__WEBPACK_IMPORTED_MODULE_2__.join(this.userExtensionsPath, `${instance.browser}-manager-${instance.port}`);
92
92
  await fs_promises__WEBPACK_IMPORTED_MODULE_0__.mkdir(extensionPath, {
@@ -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.getExtensionPath(instance.instanceId);
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)) return 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,
@@ -1462,11 +1517,8 @@ var __webpack_modules__ = {
1462
1517
  '--disable-renderer-backgrounding',
1463
1518
  '--disable-backgrounding-occluded-windows',
1464
1519
  '--disable-features=TranslateUI',
1465
- '--disable-ipc-flooding-protection',
1466
1520
  '--disable-hang-monitor',
1467
1521
  '--disable-prompt-on-repost',
1468
- '--disable-web-security',
1469
- '--disable-features=VizDisplayCompositor',
1470
1522
  '--memory-pressure-off',
1471
1523
  '--max_old_space_size=4096',
1472
1524
  '--disable-dev-shm-usage'
@@ -1479,7 +1531,7 @@ var __webpack_modules__ = {
1479
1531
  ...aiOptimizedFlags,
1480
1532
  ...sourceEnabled ? [
1481
1533
  `--remote-debugging-port=${cdpPort}`,
1482
- '--remote-debugging-address=localhost'
1534
+ '--remote-debugging-address=127.0.0.1'
1483
1535
  ] : [],
1484
1536
  ...filteredFlags,
1485
1537
  ...configOptions.browserFlags || []
@@ -1507,7 +1559,12 @@ var __webpack_modules__ = {
1507
1559
  browserBinaryLocation = external_chrome_location2_default()();
1508
1560
  break;
1509
1561
  case 'edge':
1510
- browserBinaryLocation = external_edge_location_default()();
1562
+ try {
1563
+ browserBinaryLocation = external_edge_location_default()();
1564
+ } catch (e) {
1565
+ console.error(messages.iv(browser, 'edge binary not found'));
1566
+ process.exit(1);
1567
+ }
1511
1568
  break;
1512
1569
  case 'chromium-based':
1513
1570
  browserBinaryLocation = external_path_.normalize(this.chromiumBinary);
@@ -1552,8 +1609,10 @@ var __webpack_modules__ = {
1552
1609
  }
1553
1610
  let chromiumConfig;
1554
1611
  try {
1612
+ const profileForConfig = false === this.profile && (await instanceManager.getRunningInstances()).some((i)=>'running' === i.status && i.browser === this.browser) ? void 0 : this.profile;
1555
1613
  chromiumConfig = browserConfig(compilation, {
1556
1614
  ...this,
1615
+ profile: profileForConfig,
1557
1616
  instanceId: effectiveInstanceId,
1558
1617
  extension: extensionsToLoad
1559
1618
  });
@@ -1571,6 +1630,14 @@ var __webpack_modules__ = {
1571
1630
  const desiredPort = (0, shared_utils.Zb)(this.port, this.instanceId);
1572
1631
  const freePort = await (0, shared_utils.km)(desiredPort);
1573
1632
  if (freePort !== desiredPort) chromiumConfig = chromiumConfig.map((flag)=>flag.startsWith('--remote-debugging-port=') ? `--remote-debugging-port=${freePort}` : flag);
1633
+ try {
1634
+ if (this.instanceId) {
1635
+ await instanceManager.updateInstance(this.instanceId, {
1636
+ debugPort: freePort
1637
+ });
1638
+ if ('development' === process.env.EXTENSION_ENV) console.log(messages.x(freePort, desiredPort));
1639
+ }
1640
+ } catch {}
1574
1641
  }
1575
1642
  if (this.dryRun) {
1576
1643
  console.log(messages.Lh());
@@ -2276,9 +2343,11 @@ var __webpack_modules__ = {
2276
2343
  }
2277
2344
  let firefoxConfig;
2278
2345
  try {
2346
+ const hasConcurrent = (await instanceManager.getRunningInstances()).some((i)=>'running' === i.status && i.browser === this.browser);
2347
+ const profileForConfig = false === this.profile && hasConcurrent ? void 0 : this.profile;
2279
2348
  firefoxConfig = await browserConfig(compilation, {
2280
2349
  ...options,
2281
- profile: this.profile,
2350
+ profile: profileForConfig,
2282
2351
  preferences: this.preferences,
2283
2352
  keepProfileChanges: this.keepProfileChanges,
2284
2353
  copyFromProfile: this.copyFromProfile,
@@ -2364,6 +2433,18 @@ var __webpack_modules__ = {
2364
2433
  console.error(messages.Q(this.browser, error));
2365
2434
  process.exit(1);
2366
2435
  }
2436
+ try {
2437
+ if (this.instanceId && profileMatch) {
2438
+ await instanceManager.updateInstance(this.instanceId, {
2439
+ debugPort,
2440
+ effectiveProfilePath: profileMatch[1]
2441
+ });
2442
+ if ('development' === process.env.EXTENSION_ENV) {
2443
+ console.log(messages.ZZ(debugPort, desiredDebugPort));
2444
+ console.log(messages.G$(profileMatch[1]));
2445
+ }
2446
+ }
2447
+ } catch {}
2367
2448
  } else {
2368
2449
  const args = [
2369
2450
  ...debugPort > 0 ? [
@@ -3074,28 +3155,28 @@ var __webpack_modules__ = {
3074
3155
  yz: ()=>portManagerErrorAllocatingPorts,
3075
3156
  zd: ()=>instanceManagerHealthMonitoringOrphaned
3076
3157
  });
3077
- var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("path");
3078
- var pintor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("pintor");
3079
- var pintor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(pintor__WEBPACK_IMPORTED_MODULE_0__);
3158
+ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("path");
3159
+ var pintor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("pintor");
3160
+ var pintor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(pintor__WEBPACK_IMPORTED_MODULE_1__);
3080
3161
  var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./webpack/webpack-lib/constants.ts");
3081
3162
  function getLoggingPrefix(feature, type) {
3082
- if ('error' === type) return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('ERROR')} ${feature}`;
3083
- if ('warn' === type) return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightYellow("\u25BA\u25BA\u25BA")} ${feature}`;
3084
- const arrow = 'info' === type ? pintor__WEBPACK_IMPORTED_MODULE_0___default().blue("\u25BA\u25BA\u25BA") : pintor__WEBPACK_IMPORTED_MODULE_0___default().green("\u25BA\u25BA\u25BA");
3163
+ if ('error' === type) return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().red('ERROR')} ${feature}`;
3164
+ if ('warn' === type) return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightYellow("\u25BA\u25BA\u25BA")} ${feature}`;
3165
+ 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
3166
  return `${arrow} ${feature}`;
3086
3167
  }
3087
3168
  function boring(manifestName, duration, stats) {
3088
3169
  let didShow = false;
3089
3170
  if (!didShow) {
3090
- const arrow = stats.hasErrors() ? pintor__WEBPACK_IMPORTED_MODULE_0___default().red("\u25BA\u25BA\u25BA") : pintor__WEBPACK_IMPORTED_MODULE_0___default().blue("\u25BA\u25BA\u25BA");
3091
- return `${arrow} ${manifestName} compiled ${stats.hasErrors() ? pintor__WEBPACK_IMPORTED_MODULE_0___default().red('with errors') : pintor__WEBPACK_IMPORTED_MODULE_0___default().green('successfully')} in ${duration} ms.`;
3171
+ const arrow = stats.hasErrors() ? pintor__WEBPACK_IMPORTED_MODULE_1___default().red("\u25BA\u25BA\u25BA") : pintor__WEBPACK_IMPORTED_MODULE_1___default().green("\u25BA\u25BA\u25BA");
3172
+ 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
3173
  }
3093
3174
  }
3094
3175
  function integrationNotInstalled(integration, packageManager) {
3095
- return `${getLoggingPrefix(integration, 'info')} Using ${integration}. Installing required dependencies via ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(packageManager)}...`;
3176
+ return `${getLoggingPrefix(integration, 'info')} Using ${integration}. Installing required dependencies via ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(packageManager)}...`;
3096
3177
  }
3097
3178
  function isUsingIntegration(integration) {
3098
- return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().blue("\u25BA\u25BA\u25BA")} Using ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightBlue(integration)}...`;
3179
+ return `${pintor__WEBPACK_IMPORTED_MODULE_1___default().blue("\u25BA\u25BA\u25BA")} Using ${pintor__WEBPACK_IMPORTED_MODULE_1___default().brightBlue(integration)}...`;
3099
3180
  }
3100
3181
  function youAreAllSet(integration) {
3101
3182
  return `${getLoggingPrefix(integration, 'success')} installation completed. Run the program again and happy hacking.`;
@@ -3104,14 +3185,14 @@ var __webpack_modules__ = {
3104
3185
  return `${getLoggingPrefix(integration, 'info')} dependencies are being installed. This only happens for core contributors...`;
3105
3186
  }
3106
3187
  function integrationInstalledSuccessfully(integration) {
3107
- return `${getLoggingPrefix(integration, 'success')} dependencies installed ${pintor__WEBPACK_IMPORTED_MODULE_0___default().green('successfully')}.`;
3188
+ return `${getLoggingPrefix(integration, 'success')} dependencies installed ${pintor__WEBPACK_IMPORTED_MODULE_1___default().green('successfully')}.`;
3108
3189
  }
3109
3190
  function failedToInstallIntegration(integration, error) {
3110
- return `${getLoggingPrefix('Integration', 'error')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(integration)} Installation Error\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('Failed to detect package manager or install dependencies.')}\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error ?? ''))}`;
3191
+ 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
3192
  }
3112
3193
  function fileNotFound(errorSourcePath, missingFilePath) {
3113
3194
  if (!errorSourcePath) throw new Error('This operation is impossible. Please report a bug.');
3114
- switch(path__WEBPACK_IMPORTED_MODULE_1__.extname(missingFilePath)){
3195
+ switch(path__WEBPACK_IMPORTED_MODULE_0__.extname(missingFilePath)){
3115
3196
  case '.js':
3116
3197
  case '.ts':
3117
3198
  case '.jsx':
@@ -3131,99 +3212,99 @@ var __webpack_modules__ = {
3131
3212
  const contentIndex = manifestField.split('-')[1];
3132
3213
  const isPage = manifestField.startsWith('pages');
3133
3214
  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 ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('pages')} folder in your project root directory.\n\n` : `Check the ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow(field)} field in your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('manifest.json')} file.\n\n`}${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(filePath)}`;
3215
+ 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
3216
  }
3136
3217
  function entryNotFoundWarn(manifestField, filePath) {
3137
- return `File Not Found\n\nCheck the ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow(manifestField)} field in your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('manifest.json')} file.\n\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(filePath)}`;
3218
+ 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
3219
  }
3139
3220
  function manifestInvalidError(error) {
3140
- return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('manifest.json')} file and try again.\n\n` + pintor__WEBPACK_IMPORTED_MODULE_0___default().red(error.toString());
3221
+ 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
3222
  }
3142
3223
  function serverRestartRequiredFromManifestError(fileAdded, fileRemoved) {
3143
- const fileRemovedText = fileRemoved ? `${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('REMOVED')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(fileRemoved)}\n` : '';
3144
- const fileAddedText = fileAdded ? `${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().green('ADDED')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(fileAdded)}` : '';
3224
+ 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` : '';
3225
+ 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
3226
  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
3227
  }
3147
3228
  function serverRestartRequiredFromSpecialFolderError(addingOrRemoving, folder, typeOfAsset, pathRelative) {
3148
- return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(pathRelative)} in the ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(folder + '/')} folder after compilation requires a server restart.`;
3229
+ 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
3230
  }
3150
3231
  function manifestNotFoundError(manifestName, manifestPath) {
3151
- return `${getLoggingPrefix('manifest.json', 'error')} Manifest Not Found\n\nEnsure you have a ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('manifest.json')} file at the root directory of your project.\n\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(manifestPath)}`;
3232
+ 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
3233
  }
3153
3234
  function creatingTSConfig() {
3154
- return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('tsconfig.json')}...`;
3235
+ return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow('tsconfig.json')}...`;
3155
3236
  }
3156
3237
  function backgroundIsRequired(backgroundChunkName, filePath) {
3157
- return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\nCheck the ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow(backgroundChunkName.replace('/', '.'))} field in your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('manifest.json')} file.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(filePath)}`;
3238
+ 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
3239
  }
3159
3240
  function serverRestartRequiredFromHtml(filePath) {
3160
- return `${getLoggingPrefix('HTML', 'warn')} Entrypoint Change\nDetected changes to ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow("<script>")} or ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('<link rel="stylesheet">')} references in HTML. The extension will undergo a full recompilation and a reload.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(filePath)}`;
3241
+ 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
3242
  }
3162
3243
  function javaScriptError(errorSourcePath, missingFilePath) {
3163
- return `${getLoggingPrefix('HTML', 'error')} File Not Found\nCheck your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow("<script>")} tags in ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(errorSourcePath)}.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(missingFilePath)}`;
3244
+ 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
3245
  }
3165
3246
  function cssError(errorSourcePath, missingFilePath) {
3166
- return `${getLoggingPrefix('HTML', 'error')} File Not Found\nCheck your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('<link>')} tags in ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(errorSourcePath)}.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(missingFilePath)}`;
3247
+ 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
3248
  }
3168
3249
  function staticAssetError(errorSourcePath, missingFilePath) {
3169
- const extname = path__WEBPACK_IMPORTED_MODULE_1__.extname(missingFilePath);
3170
- return `${getLoggingPrefix('HTML', 'warn')} File Not Found\nCheck your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('*' + extname)} assets in ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(errorSourcePath)}.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red('NOT FOUND')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(missingFilePath)}`;
3250
+ const extname = path__WEBPACK_IMPORTED_MODULE_0__.extname(missingFilePath);
3251
+ 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
3252
  }
3172
3253
  function certRequired() {
3173
- return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('Note')}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.\nBy default, your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('manifest.json')} file is not being watched. To enable this feature, run:\n\n npx -y ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('mkcert-cli')} \\\n ${pintor__WEBPACK_IMPORTED_MODULE_0___default().blue('--outDir')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(_constants__WEBPACK_IMPORTED_MODULE_2__.KI)} \\\n ${pintor__WEBPACK_IMPORTED_MODULE_0___default().blue('--cert')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('localhost.cert')} \\\n ${pintor__WEBPACK_IMPORTED_MODULE_0___default().blue('--key')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('localhost.key')}\n\nThis will enable the secure certificate needed for Firefox via ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('mkcert')}.\n\nLearn more about ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('mkcert')}: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline('https://github.com/FiloSottile/mkcert')}`;
3254
+ 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
3255
  }
3175
3256
  function defaultPortInUse(port) {
3176
- return `${getLoggingPrefix('Port', 'error')} Selected port ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(port.toString())} in use. Choose a new port. `;
3257
+ return `${getLoggingPrefix('Port', 'error')} Selected port ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())} in use. Choose a new port. `;
3177
3258
  }
3178
3259
  function portInUse(requestedPort, newPort) {
3179
- return `${getLoggingPrefix('Port', 'warn')} Requested port ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(requestedPort.toString())} is in use; using ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(newPort.toString())} instead.`;
3260
+ 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
3261
  }
3181
3262
  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 ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('publicPath')}\nof your ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow('extension.config.js')} is defined as your extension URL.`;
3263
+ 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
3264
  }
3184
3265
  function isUsingCustomLoader(file) {
3185
3266
  const loaderName = file.split('.').shift() || 'custom';
3186
3267
  const capitalizedLoaderName = loaderName.charAt(0).toUpperCase() + loaderName.slice(1);
3187
- return `${getLoggingPrefix(capitalizedLoaderName, 'info')} Using custom loader configuration from ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(file)}`;
3268
+ return `${getLoggingPrefix(capitalizedLoaderName, 'info')} Using custom loader configuration from ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(file)}`;
3188
3269
  }
3189
3270
  function webextensionPolyfillNotFound() {
3190
- return `${getLoggingPrefix('Warning', 'warn')} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('webextension-polyfill')} not found. Browser API polyfill will not be available.\nTo fix this, install ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('webextension-polyfill')}: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().blue('npm install webextension-polyfill')}`;
3271
+ 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
3272
  }
3192
3273
  function registrySaved(registryPath) {
3193
- return `${getLoggingPrefix('Instance Manager', 'info')} registry saved to: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(registryPath)}`;
3274
+ return `${getLoggingPrefix('Instance Manager', 'info')} registry saved to: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(registryPath)}`;
3194
3275
  }
3195
3276
  function registrySaveError(error) {
3196
- return `${getLoggingPrefix('Instance Manager', 'error')} error saving registry:\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3277
+ return `${getLoggingPrefix('Instance Manager', 'error')} error saving registry:\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
3197
3278
  }
3198
3279
  function smartPortAllocationExistingPorts(usedPorts) {
3199
- return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing ports: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(JSON.stringify(usedPorts))}`;
3280
+ return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing ports: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(usedPorts))}`;
3200
3281
  }
3201
3282
  function smartPortAllocationExistingWebSocketPorts(usedWebSocketPorts) {
3202
- return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing WebSocket ports: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(JSON.stringify(usedWebSocketPorts))}`;
3283
+ return `${getLoggingPrefix('Smart Port Allocation', 'info')} existing WebSocket ports: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(usedWebSocketPorts))}`;
3203
3284
  }
3204
3285
  function smartPortAllocationUsingRequestedPort(port, webSocketPort) {
3205
- return `${getLoggingPrefix('Smart Port Allocation', 'info')} using requested port ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(port.toString())}; WebSocket ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(webSocketPort.toString())}`;
3286
+ 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
3287
  }
3207
3288
  function smartPortAllocationRequestedPortUnavailable(port) {
3208
- return `${getLoggingPrefix('Smart Port Allocation', 'warn')} requested port is unavailable: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(port.toString())}`;
3289
+ return `${getLoggingPrefix('Smart Port Allocation', 'warn')} requested port is unavailable: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(port.toString())}`;
3209
3290
  }
3210
3291
  function smartPortAllocationAllocatedPorts(port, webSocketPort) {
3211
- return `${getLoggingPrefix('Smart Port Allocation', 'success')} allocated ports ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(port.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(port)')} and ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(webSocketPort.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(WebSocket)')}`;
3292
+ 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
3293
  }
3213
3294
  function instanceManagerCreateInstanceCalled(params) {
3214
- return `${getLoggingPrefix('Instance Manager', 'info')} createInstance called ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(JSON.stringify(params))}`;
3295
+ return `${getLoggingPrefix('Instance Manager', 'info')} createInstance called ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(params))}`;
3215
3296
  }
3216
3297
  function instanceManagerRegistryAfterCreateInstance(registry) {
3217
- return `${getLoggingPrefix('Instance Manager', 'info')} registry after createInstance: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(JSON.stringify(registry))}`;
3298
+ return `${getLoggingPrefix('Instance Manager', 'info')} registry after createInstance: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(JSON.stringify(registry))}`;
3218
3299
  }
3219
3300
  function extensionManagerCopyFilesWarning(error) {
3220
- return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not copy extension files: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow(String(error))}`;
3301
+ return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not copy extension files: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(String(error))}`;
3221
3302
  }
3222
3303
  function extensionManagerInstanceNotFoundWarning(instanceId) {
3223
- return `${getLoggingPrefix('Extension.js DevTools', 'warn')} instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow(instanceId)} not found for cleanup`;
3304
+ return `${getLoggingPrefix('Extension.js DevTools', 'warn')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(instanceId)} not found for cleanup`;
3224
3305
  }
3225
3306
  function extensionManagerCleanupWarning(error) {
3226
- return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not cleanup temp extensions: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().yellow(String(error))}`;
3307
+ return `${getLoggingPrefix('Extension.js DevTools', 'warn')} could not cleanup temp extensions: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().yellow(String(error))}`;
3227
3308
  }
3228
3309
  function firefoxDetectedFlatpak() {
3229
3310
  return `${getLoggingPrefix('Firefox Detector', 'info')} detected a Flatpak Firefox installation`;
@@ -3232,88 +3313,88 @@ var __webpack_modules__ = {
3232
3313
  return `${getLoggingPrefix('Firefox Detector', 'info')} detected a Snap Firefox installation`;
3233
3314
  }
3234
3315
  function firefoxDetectedTraditional(firefoxPath) {
3235
- return `${getLoggingPrefix('Firefox Detector', 'info')} detected traditional Firefox at: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(firefoxPath)}`;
3316
+ return `${getLoggingPrefix('Firefox Detector', 'info')} detected traditional Firefox at: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(firefoxPath)}`;
3236
3317
  }
3237
3318
  function firefoxDetectedCustom(firefoxPath) {
3238
- return `${getLoggingPrefix('Firefox Detector', 'info')} detected custom Firefox build at: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(firefoxPath)}`;
3319
+ return `${getLoggingPrefix('Firefox Detector', 'info')} detected custom Firefox build at: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(firefoxPath)}`;
3239
3320
  }
3240
3321
  function firefoxUsingFlatpakWithSandbox() {
3241
3322
  return `${getLoggingPrefix('Firefox Detector', 'info')} using Flatpak Firefox with sandbox permissions`;
3242
3323
  }
3243
3324
  function firefoxVersion(version) {
3244
- return `${getLoggingPrefix('Firefox Detector', 'info')} Firefox version is: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(version)}`;
3325
+ return `${getLoggingPrefix('Firefox Detector', 'info')} Firefox version is: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(version)}`;
3245
3326
  }
3246
3327
  function portManagerErrorAllocatingPorts(error) {
3247
- return `${getLoggingPrefix('Port Manager', 'error')} Failed to allocate ports.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3328
+ return `${getLoggingPrefix('Port Manager', 'error')} Failed to allocate ports.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
3248
3329
  }
3249
3330
  function browserPluginFailedToLoad(browser, error) {
3250
- return `${getLoggingPrefix('Browser Plugin', 'error')} Failed to load the ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(browser)} plugin.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3331
+ 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
3332
  }
3252
3333
  function extensionJsRunnerError(error) {
3253
- return `${getLoggingPrefix('Extension.js Runner', 'error')} Error in the Extension.js runner.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3334
+ return `${getLoggingPrefix('Extension.js Runner', 'error')} Error in the Extension.js runner.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
3254
3335
  }
3255
3336
  function extensionJsRunnerCleanupError(error) {
3256
- return `${getLoggingPrefix('Extension.js Runner', 'error')} Error during cleanup.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3337
+ return `${getLoggingPrefix('Extension.js Runner', 'error')} Error during cleanup.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
3257
3338
  }
3258
3339
  function extensionJsRunnerUncaughtException(error) {
3259
- return `${getLoggingPrefix('Extension.js Runner', 'error')} Uncaught exception.\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3340
+ return `${getLoggingPrefix('Extension.js Runner', 'error')} Uncaught exception.\n${pintor__WEBPACK_IMPORTED_MODULE_1___default().red(String(error))}`;
3260
3341
  }
3261
3342
  function extensionJsRunnerUnhandledRejection(promise, reason) {
3262
- return `${getLoggingPrefix('Extension.js Runner', 'error')} unhandled rejection at: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(promise.toString())} reason: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(reason))}`;
3343
+ 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
3344
  }
3264
3345
  function autoExitModeEnabled(ms) {
3265
- return `${getLoggingPrefix('Auto Mode', 'info')} is enabled. The program will exit automatically after ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(' + ms.toString() + 'ms)')}.`;
3346
+ return `${getLoggingPrefix('Auto Mode', 'info')} is enabled. The program will exit automatically after ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(' + ms.toString() + 'ms)')}.`;
3266
3347
  }
3267
3348
  function autoExitTriggered(ms) {
3268
- return `${getLoggingPrefix('Auto Mode', 'warn')} timer has elapsed ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(' + ms.toString() + 'ms)')}. Cleaning up\u{2026}`;
3349
+ return `${getLoggingPrefix('Auto Mode', 'warn')} timer has elapsed ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(' + ms.toString() + 'ms)')}. Cleaning up\u{2026}`;
3269
3350
  }
3270
3351
  function autoExitForceKill(ms) {
3271
- return `${getLoggingPrefix('Auto Mode', 'error')} is force-killing the process after the fallback ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(' + ms.toString() + 'ms)')}.`;
3352
+ return `${getLoggingPrefix('Auto Mode', 'error')} is force-killing the process after the fallback ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray('(' + ms.toString() + 'ms)')}.`;
3272
3353
  }
3273
3354
  function instanceManagerHealthMonitoringStart(instanceId) {
3274
- return `${getLoggingPrefix('Instance Manager', 'info')} starting health monitoring for instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))}`;
3355
+ return `${getLoggingPrefix('Instance Manager', 'info')} starting health monitoring for instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))}`;
3275
3356
  }
3276
3357
  function instanceManagerHealthMonitoringPassed(instanceId) {
3277
- return `${getLoggingPrefix('Instance Manager', 'success')} instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))} health check passed`;
3358
+ return `${getLoggingPrefix('Instance Manager', 'success')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} health check passed`;
3278
3359
  }
3279
3360
  function instanceManagerHealthMonitoringOrphaned(instanceId) {
3280
- return `${getLoggingPrefix('Instance Manager', 'warn')} instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))} appears orphaned, cleaning up`;
3361
+ return `${getLoggingPrefix('Instance Manager', 'warn')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} appears orphaned, cleaning up`;
3281
3362
  }
3282
3363
  function instanceManagerHealthMonitoringFailed(instanceId, error) {
3283
- return `${getLoggingPrefix('Instance Manager', 'error')} health check failed for instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))}:\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3364
+ 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
3365
  }
3285
3366
  function instanceManagerForceCleanupProject(projectPath) {
3286
- return `${getLoggingPrefix('Instance Manager', 'info')} force cleaning up all processes for project: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().underline(projectPath)}`;
3367
+ return `${getLoggingPrefix('Instance Manager', 'info')} force cleaning up all processes for project: ${pintor__WEBPACK_IMPORTED_MODULE_1___default().underline(projectPath)}`;
3287
3368
  }
3288
3369
  function instanceManagerForceCleanupFound(instanceCount) {
3289
- return `${getLoggingPrefix('Instance Manager', 'info')} found ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceCount.toString())} instances to clean up`;
3370
+ return `${getLoggingPrefix('Instance Manager', 'info')} found ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceCount.toString())} instances to clean up`;
3290
3371
  }
3291
3372
  function instanceManagerForceCleanupInstance(instanceId) {
3292
- return `${getLoggingPrefix('Instance Manager', 'info')} cleaning up instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))}`;
3373
+ return `${getLoggingPrefix('Instance Manager', 'info')} cleaning up instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))}`;
3293
3374
  }
3294
3375
  function instanceManagerForceCleanupTerminating(processId) {
3295
- return `${getLoggingPrefix('Instance Manager', 'info')} terminating process ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(processId.toString())}`;
3376
+ return `${getLoggingPrefix('Instance Manager', 'info')} terminating process ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(processId.toString())}`;
3296
3377
  }
3297
3378
  function instanceManagerForceCleanupForceKilled(processId) {
3298
- return `${getLoggingPrefix('Instance Manager', 'error')} force killed process ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(processId.toString())}`;
3379
+ return `${getLoggingPrefix('Instance Manager', 'error')} force killed process ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(processId.toString())}`;
3299
3380
  }
3300
3381
  function instanceManagerForceCleanupInstanceTerminated(instanceId) {
3301
- return `${getLoggingPrefix('Instance Manager', 'success')} instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))} marked as terminated`;
3382
+ return `${getLoggingPrefix('Instance Manager', 'success')} instance ${pintor__WEBPACK_IMPORTED_MODULE_1___default().gray(instanceId.slice(0, 8))} marked as terminated`;
3302
3383
  }
3303
3384
  function instanceManagerForceCleanupError(instanceId, error) {
3304
- return `${getLoggingPrefix('Instance Manager', 'error')} error terminating instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId)}:\n${pintor__WEBPACK_IMPORTED_MODULE_0___default().red(String(error))}`;
3385
+ 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
3386
  }
3306
3387
  function instanceManagerForceCleanupComplete() {
3307
3388
  return `${getLoggingPrefix('Instance Manager', 'success')} project cleanup completed`;
3308
3389
  }
3309
3390
  function instanceManagerProcessNoLongerRunning(instanceId, processId) {
3310
- return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta('Instance Manager')} process ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(processId.toString())} for instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))} is no longer running`;
3391
+ 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
3392
  }
3312
3393
  function instanceManagerPortsNotInUse(instanceId, port, webSocketPort) {
3313
- return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta('Instance Manager')} ports ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(port.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(')}${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('port')}${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(')')}/${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(webSocketPort.toString())} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('(')}${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray('WebSocket')}${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(')')} for instance ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))} are not in use`;
3394
+ 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
3395
  }
3315
3396
  function instanceManagerCleanedUpOrphanedInstance(instanceId) {
3316
- return `${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta("\u25BA\u25BA\u25BA")} ${pintor__WEBPACK_IMPORTED_MODULE_0___default().brightMagenta('Instance Manager')} cleaned up orphaned instance: ${pintor__WEBPACK_IMPORTED_MODULE_0___default().gray(instanceId.slice(0, 8))}`;
3397
+ 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
3398
  }
3318
3399
  },
3319
3400
  child_process: function(module) {
@@ -3344,7 +3425,7 @@ var __webpack_modules__ = {
3344
3425
  module.exports = require("util");
3345
3426
  },
3346
3427
  "./package.json": function(module) {
3347
- module.exports = JSON.parse('{"i8":"2.0.4","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"}}');
3428
+ module.exports = JSON.parse('{"i8":"2.1.1","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
3429
  }
3349
3430
  };
3350
3431
  var __webpack_module_cache__ = {};
@@ -3366,6 +3447,33 @@ function __webpack_require__(moduleId) {
3366
3447
  return getter;
3367
3448
  };
3368
3449
  })();
3450
+ (()=>{
3451
+ var getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__;
3452
+ var leafPrototypes;
3453
+ __webpack_require__.t = function(value, mode) {
3454
+ if (1 & mode) value = this(value);
3455
+ if (8 & mode) return value;
3456
+ if ('object' == typeof value && value) {
3457
+ if (4 & mode && value.__esModule) return value;
3458
+ if (16 & mode && 'function' == typeof value.then) return value;
3459
+ }
3460
+ var ns = Object.create(null);
3461
+ __webpack_require__.r(ns);
3462
+ var def = {};
3463
+ leafPrototypes = leafPrototypes || [
3464
+ null,
3465
+ getProto({}),
3466
+ getProto([]),
3467
+ getProto(getProto)
3468
+ ];
3469
+ for(var current = 2 & mode && value; 'object' == typeof current && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
3470
+ def[key] = ()=>value[key];
3471
+ });
3472
+ def['default'] = ()=>value;
3473
+ __webpack_require__.d(ns, def);
3474
+ return ns;
3475
+ };
3476
+ })();
3369
3477
  (()=>{
3370
3478
  __webpack_require__.d = (exports1, definition)=>{
3371
3479
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -3608,13 +3716,18 @@ var __webpack_exports__ = {};
3608
3716
  const matchedKey = null == matched ? void 0 : matched[0];
3609
3717
  if (matchedKey && 'string' == typeof matchedKey) {
3610
3718
  const unixKey = unixify(matchedKey);
3611
- fileOutputpath = /^(?:\.\/)?public\//i.test(unixKey) ? unixKey.replace(/^(?:\.\/)?public\//i, '') : /^\/public\//i.test(unixKey) ? unixKey.replace(/^\/public\//i, '') : external_path_.normalize(filePath);
3719
+ fileOutputpath = /^(?:\.\/)?public\//i.test(unixKey) ? unixKey.replace(/^(?:\.\/)?public\//i, '') : /^\/public\//i.test(unixKey) ? unixKey.replace(/^\/public\//i, '') : /^\//.test(unixKey) ? unixKey.replace(/^\//, '') : external_path_.normalize(filePath);
3612
3720
  }
3613
3721
  }
3614
3722
  if (!skipPathResolve && excludeList) {
3615
3723
  const keys = Object.keys(excludeList);
3616
3724
  const unixInput = unixify(filePath);
3617
- const matchKey = keys.find((k)=>unixify(k) === unixInput);
3725
+ let matchKey = keys.find((k)=>unixify(k) === unixInput);
3726
+ if (!matchKey) {
3727
+ const stripPublicPrefix = (p)=>unixify(p).replace(/^\/(?:public\/)?/i, '').replace(/^(?:\.\/)?public\//i, '');
3728
+ const inputStripped = stripPublicPrefix(unixInput);
3729
+ matchKey = keys.find((k)=>stripPublicPrefix(k) === inputStripped);
3730
+ }
3618
3731
  if (matchKey) {
3619
3732
  const unixKey = unixify(matchKey);
3620
3733
  fileOutputpath = /^(?:\.\/)?public\//i.test(unixKey) ? unixKey.replace(/^(?:\.\/)?public\//i, '') : /^\/public\//i.test(unixKey) ? unixKey.replace(/^\/public\//i, '') : unixKey;
@@ -5711,7 +5824,7 @@ var __webpack_exports__ = {};
5711
5824
  return getLoggingPrefix(WS, 'error') + ` Failed to update instance with extension ID.\n${external_pintor_default().red(error)}`;
5712
5825
  }
5713
5826
  function webSocketServerForInstanceClosed(instanceId) {
5714
- return getLoggingPrefix(WS, 'success') + ` for instance ${external_pintor_default().gray(instanceId.slice(0, 8))} closed`;
5827
+ return getLoggingPrefix(WS, 'success') + ` for instance ${external_pintor_default().yellow(instanceId.slice(0, 8))} closed`;
5715
5828
  }
5716
5829
  function webSocketError(error) {
5717
5830
  return getLoggingPrefix(WS, 'error') + ` WebSocket error.\n${external_pintor_default().red(String(error))}`;
@@ -6329,8 +6442,9 @@ var __webpack_exports__ = {};
6329
6442
  }
6330
6443
  class AddAssetsToCompilation {
6331
6444
  normalizePublicPath(assetPath) {
6332
- if (!assetPath.startsWith('public/')) return assetPath;
6333
- return assetPath.replace(/^Public\//, 'public/').replace(/^PUBLIC\//, 'public/').replace(/^public\//, 'public/');
6445
+ if (assetPath.startsWith('Public/')) return assetPath.replace(/^Public\//, 'public/');
6446
+ if (assetPath.startsWith('PUBLIC/')) return assetPath.replace(/^PUBLIC\//, 'public/');
6447
+ return assetPath;
6334
6448
  }
6335
6449
  apply(compiler) {
6336
6450
  compiler.hooks.thisCompilation.tap('html:add-assets-to-compilation', (compilation)=>{
@@ -6935,13 +7049,13 @@ var __webpack_exports__ = {};
6935
7049
  includeList: this.includeList || {},
6936
7050
  excludeList: this.excludeList || {}
6937
7051
  }).apply(compiler);
6938
- if ('production' !== (compiler.options.mode || 'development')) compiler.options.module.rules.push({
7052
+ compiler.options.module.rules.push({
6939
7053
  test: /(\.m?[jt]sx?)$/,
6940
7054
  include: [
6941
7055
  external_path_.dirname(this.manifestPath)
6942
7056
  ],
6943
7057
  exclude: [
6944
- /[\\/]node_modules[\\/]/
7058
+ /[/\\]node_modules[/\\]/
6945
7059
  ],
6946
7060
  use: [
6947
7061
  {
@@ -6961,7 +7075,7 @@ var __webpack_exports__ = {};
6961
7075
  external_path_.dirname(this.manifestPath)
6962
7076
  ],
6963
7077
  exclude: [
6964
- /[\\/]node_modules[\\/]/
7078
+ /[/\\]node_modules[/\\]/
6965
7079
  ],
6966
7080
  use: [
6967
7081
  {
@@ -6988,7 +7102,7 @@ var __webpack_exports__ = {};
6988
7102
  external_path_.dirname(this.manifestPath)
6989
7103
  ],
6990
7104
  exclude: [
6991
- /[\\/]node_modules[\\/]/
7105
+ /[/\\]node_modules[/\\]/
6992
7106
  ],
6993
7107
  use: [
6994
7108
  {
@@ -7926,7 +8040,7 @@ var __webpack_exports__ = {};
7926
8040
  console.error(webSocketConnectionCloseError(error));
7927
8041
  }
7928
8042
  webSocketServer.close(()=>{
7929
- console.log(webSocketServerForInstanceClosed(instanceId.slice(0, 8)));
8043
+ if ('development' === process.env.EXTENSION_ENV) console.log(webSocketServerForInstanceClosed(instanceId.slice(0, 8)));
7930
8044
  });
7931
8045
  };
7932
8046
  process.on('SIGINT', cleanup);
@@ -7953,6 +8067,7 @@ var __webpack_exports__ = {};
7953
8067
  browser: this.browser,
7954
8068
  mode: compiler.options.mode || 'development'
7955
8069
  });
8070
+ compiler.options.webSocketServer = this.webSocketServer;
7956
8071
  this.isServerInitialized = true;
7957
8072
  if ('development' === process.env.EXTENSION_ENV) console.log(webSocketServerInitialized());
7958
8073
  } catch (error) {
@@ -8415,10 +8530,7 @@ var __webpack_exports__ = {};
8415
8530
  }
8416
8531
  }
8417
8532
  const setup_reload_strategy = SetupReloadStrategy;
8418
- var browsers_lib_messages = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
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) {
8533
+ function plugin_reload_define_property(obj, key, value) {
8422
8534
  if (key in obj) Object.defineProperty(obj, key, {
8423
8535
  value: value,
8424
8536
  enumerable: true,
@@ -8428,269 +8540,113 @@ var __webpack_exports__ = {};
8428
8540
  else obj[key] = value;
8429
8541
  return obj;
8430
8542
  }
8431
- const MAX_CONNECT_RETRIES = 60;
8432
- const CONNECT_RETRY_INTERVAL_MS = 500;
8433
- const PAGE_READY_TIMEOUT_MS = 8000;
8434
- const TARGET_SCAN_INTERVAL_MS = 250;
8435
- const CHANGE_DEBOUNCE_MS = 300;
8436
- function wait(ms) {
8437
- return new Promise((resolve)=>setTimeout(resolve, ms));
8438
- }
8439
- class SetupFirefoxInspectionStep {
8440
- getRdpPort() {
8441
- return (0, shared_utils.Zb)(this.devOptions.port, this.devOptions.instanceId);
8543
+ class ReloadPlugin {
8544
+ apply(compiler) {
8545
+ if (this.instanceId) compiler.options.currentInstance = {
8546
+ instanceId: this.instanceId
8547
+ };
8548
+ if ('development' !== compiler.options.mode) return;
8549
+ new CreateWebSocketServer({
8550
+ manifestPath: this.manifestPath,
8551
+ browser: this.browser,
8552
+ port: this.port,
8553
+ stats: this.stats,
8554
+ instanceId: this.instanceId
8555
+ }).apply(compiler);
8556
+ new setup_reload_strategy({
8557
+ manifestPath: this.manifestPath,
8558
+ browser: this.browser,
8559
+ autoReload: this.autoReload,
8560
+ stats: this.stats,
8561
+ port: this.port,
8562
+ instanceId: this.instanceId
8563
+ }).apply(compiler);
8442
8564
  }
8443
- async initialize() {
8444
- if (this.initialized) return;
8445
- const client = new messaging_client.v();
8446
- const port = this.getRdpPort();
8565
+ constructor(options){
8566
+ plugin_reload_define_property(this, "manifestPath", void 0);
8567
+ plugin_reload_define_property(this, "browser", void 0);
8568
+ plugin_reload_define_property(this, "port", void 0);
8569
+ plugin_reload_define_property(this, "stats", void 0);
8570
+ plugin_reload_define_property(this, "autoReload", void 0);
8571
+ plugin_reload_define_property(this, "instanceId", void 0);
8572
+ this.manifestPath = options.manifestPath;
8573
+ this.browser = options.browser || 'chrome';
8574
+ this.port = parseInt(options.port, 10);
8575
+ this.stats = options.stats;
8576
+ this.autoReload = options.autoReload;
8577
+ this.instanceId = options.instanceId;
8578
+ }
8579
+ }
8580
+ plugin_reload_define_property(ReloadPlugin, "name", 'plugin-reload');
8581
+ function feature_polyfill_define_property(obj, key, value) {
8582
+ if (key in obj) Object.defineProperty(obj, key, {
8583
+ value: value,
8584
+ enumerable: true,
8585
+ configurable: true,
8586
+ writable: true
8587
+ });
8588
+ else obj[key] = value;
8589
+ return obj;
8590
+ }
8591
+ class PolyfillPlugin {
8592
+ apply(compiler) {
8447
8593
  try {
8448
- console.log(browsers_lib_messages.l());
8449
- } catch {}
8450
- let retries = 0;
8451
- while(retries < MAX_CONNECT_RETRIES)try {
8452
- await client.connect(port);
8453
- this.client = client;
8454
- this.initialized = true;
8455
- try {
8456
- console.log(browsers_lib_messages.Xy());
8457
- console.log(browsers_lib_messages.Qe());
8458
- } catch {}
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);
8594
+ const context = compiler.options.context;
8595
+ const polyfillPath = require.resolve('webextension-polyfill/dist/browser-polyfill.js', {
8596
+ paths: [
8597
+ context
8598
+ ]
8599
+ });
8600
+ new (core_default()).ProvidePlugin({
8601
+ browser: polyfillPath
8602
+ }).apply(compiler);
8603
+ } catch (error) {
8604
+ console.warn(webpack_lib_messages.or());
8466
8605
  }
8467
- throw new Error(browsers_lib_messages.V9(port));
8468
8606
  }
8469
- resolveUrlToInspect() {
8470
- if (this.devOptions.source && 'string' == typeof this.devOptions.source && 'true' !== this.devOptions.source) return this.devOptions.source;
8471
- if (this.devOptions.startingUrl) return this.devOptions.startingUrl;
8472
- throw new Error(browsers_lib_messages.Ym());
8607
+ constructor(options){
8608
+ feature_polyfill_define_property(this, "manifestPath", void 0);
8609
+ feature_polyfill_define_property(this, "browser", void 0);
8610
+ this.manifestPath = options.manifestPath;
8611
+ this.browser = options.browser;
8473
8612
  }
8474
- async selectActors(urlToInspect) {
8475
- if (!this.client) throw new Error(browsers_lib_messages.pl());
8476
- const deadline = Date.now() + 10000;
8477
- let triedAddTab = false;
8478
- while(Date.now() < deadline){
8479
- const allTargets = await this.client.getTargets() || [];
8480
- for (const target of allTargets)if (target && 'string' == typeof target.url && target.url === urlToInspect && target.actor) return {
8481
- tabActor: target.actor,
8482
- consoleActor: target.consoleActor || target.actor
8483
- };
8484
- if (!triedAddTab && urlToInspect) {
8485
- triedAddTab = true;
8486
- try {
8487
- await this.client.addTab(urlToInspect);
8488
- await wait(300);
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());
8613
+ }
8614
+ function feature_browser_specific_fields_define_property(obj, key, value) {
8615
+ if (key in obj) Object.defineProperty(obj, key, {
8616
+ value: value,
8617
+ enumerable: true,
8618
+ configurable: true,
8619
+ writable: true
8620
+ });
8621
+ else obj[key] = value;
8622
+ return obj;
8623
+ }
8624
+ class BrowserSpecificFieldsPlugin {
8625
+ patchManifest(manifest) {
8626
+ const patchedManifest = filterKeysForThisBrowser(manifest, this.browser);
8627
+ return JSON.stringify(patchedManifest, null, 2);
8499
8628
  }
8500
- async ensureNavigatedAndLoaded(urlToInspect, tabActor) {
8501
- if (!this.client) throw new Error(browsers_lib_messages.pl());
8502
- if (!tabActor) throw new Error(browsers_lib_messages.Do());
8503
- let consoleActor = tabActor;
8504
- let frameActor = tabActor;
8505
- try {
8506
- const detail = await this.client.getTargetFromDescriptor(tabActor);
8507
- if (detail.consoleActor) consoleActor = detail.consoleActor;
8508
- if (detail.targetActor) frameActor = detail.targetActor;
8509
- } catch {}
8510
- try {
8511
- await this.client.attach(frameActor);
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 {}
8629
+ apply(compiler) {
8630
+ compiler.hooks.compilation.tap('compatibility:browser-specific-fields', (compilation)=>{
8631
+ compilation.hooks.processAssets.tap({
8632
+ name: 'compatibility:browser-specific-fields',
8633
+ stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
8634
+ }, ()=>{
8635
+ const manifest = getManifestContent(compilation, this.manifestPath);
8636
+ const patchedSource = this.patchManifest(manifest);
8637
+ const rawSource = new core_namespaceObject.sources.RawSource(patchedSource);
8638
+ compilation.updateAsset('manifest.json', rawSource);
8639
+ });
8640
+ });
8527
8641
  }
8528
- async ensureUrlAndReady(consoleActor, urlToInspect) {
8529
- if (!this.client) return;
8530
- try {
8531
- const href = await this.client.evaluate(consoleActor, 'String(location.href)');
8532
- if ('string' != typeof href || !href.startsWith(urlToInspect)) await this.client.navigateViaScript(consoleActor, urlToInspect);
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;
8642
+ constructor(options){
8643
+ feature_browser_specific_fields_define_property(this, "browser", void 0);
8644
+ feature_browser_specific_fields_define_property(this, "manifestPath", void 0);
8645
+ this.manifestPath = options.manifestPath;
8646
+ this.browser = options.browser || 'chrome';
8691
8647
  }
8692
8648
  }
8693
- function plugin_reload_define_property(obj, key, value) {
8649
+ function plugin_compatibility_define_property(obj, key, value) {
8694
8650
  if (key in obj) Object.defineProperty(obj, key, {
8695
8651
  value: value,
8696
8652
  enumerable: true,
@@ -8700,169 +8656,48 @@ var __webpack_exports__ = {};
8700
8656
  else obj[key] = value;
8701
8657
  return obj;
8702
8658
  }
8703
- class ReloadPlugin {
8704
- apply(compiler) {
8705
- if (this.instanceId) compiler.options.currentInstance = {
8706
- instanceId: this.instanceId
8707
- };
8708
- if ('development' !== compiler.options.mode) return;
8709
- new CreateWebSocketServer({
8710
- manifestPath: this.manifestPath,
8711
- browser: this.browser,
8712
- port: this.port,
8713
- stats: this.stats,
8714
- instanceId: this.instanceId
8715
- }).apply(compiler);
8716
- new setup_reload_strategy({
8659
+ class CompatibilityPlugin {
8660
+ async apply(compiler) {
8661
+ if (this.polyfill) {
8662
+ if ('firefox' !== this.browser) new PolyfillPlugin({
8663
+ manifestPath: this.manifestPath,
8664
+ browser: this.browser || 'chrome'
8665
+ }).apply(compiler);
8666
+ }
8667
+ new BrowserSpecificFieldsPlugin({
8717
8668
  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
8669
+ browser: this.browser || 'chrome'
8729
8670
  }).apply(compiler);
8730
8671
  }
8731
8672
  constructor(options){
8732
- plugin_reload_define_property(this, "manifestPath", void 0);
8733
- plugin_reload_define_property(this, "browser", void 0);
8734
- plugin_reload_define_property(this, "port", void 0);
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);
8673
+ plugin_compatibility_define_property(this, "manifestPath", void 0);
8674
+ plugin_compatibility_define_property(this, "browser", void 0);
8675
+ plugin_compatibility_define_property(this, "polyfill", void 0);
8738
8676
  this.manifestPath = options.manifestPath;
8739
8677
  this.browser = options.browser || 'chrome';
8740
- this.port = parseInt(options.port, 10);
8741
- this.stats = options.stats;
8742
- this.autoReload = options.autoReload;
8743
- this.instanceId = options.instanceId;
8678
+ this.polyfill = options.polyfill || false;
8744
8679
  }
8745
8680
  }
8746
- plugin_reload_define_property(ReloadPlugin, "name", 'plugin-reload');
8747
- function feature_polyfill_define_property(obj, key, value) {
8748
- if (key in obj) Object.defineProperty(obj, key, {
8749
- value: value,
8750
- enumerable: true,
8751
- configurable: true,
8752
- writable: true
8753
- });
8754
- else obj[key] = value;
8755
- return obj;
8756
- }
8757
- class PolyfillPlugin {
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());
8681
+ plugin_compatibility_define_property(CompatibilityPlugin, "name", 'plugin-compatibility');
8682
+ var external_net_ = __webpack_require__("net");
8683
+ var browsers_lib_messages = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
8684
+ function mergeShadowIntoDocument(mainHTML, shadowContent) {
8685
+ try {
8686
+ if (!mainHTML) return '';
8687
+ const hasRoot = /<div id=(["'])extension-root\1/i.test(mainHTML);
8688
+ if (hasRoot) {
8689
+ const emptyRoot = /<div id=(["'])extension-root\1[^>]*><\/div>/i;
8690
+ const replacedEmpty = mainHTML.replace(emptyRoot, `<div id="extension-root">${shadowContent}</div>`);
8691
+ if (replacedEmpty !== mainHTML) return replacedEmpty;
8692
+ return mainHTML.replace(/<div id=(["'])extension-root\1[^>]*>[\s\S]*?<\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
8771
8693
  }
8772
- }
8773
- constructor(options){
8774
- feature_polyfill_define_property(this, "manifestPath", void 0);
8775
- feature_polyfill_define_property(this, "browser", void 0);
8776
- this.manifestPath = options.manifestPath;
8777
- this.browser = options.browser;
8694
+ if (/<\/body>/i.test(mainHTML)) return mainHTML.replace(/<\/body>/i, `<div id="extension-root">${shadowContent}</div></body>`);
8695
+ return `${mainHTML}\n<div id="extension-root">${shadowContent}</div>`;
8696
+ } catch {
8697
+ return mainHTML;
8778
8698
  }
8779
8699
  }
8780
- function feature_browser_specific_fields_define_property(obj, key, value) {
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) {
8700
+ function cdp_client_define_property(obj, key, value) {
8866
8701
  if (key in obj) Object.defineProperty(obj, key, {
8867
8702
  value: value,
8868
8703
  enumerable: true,
@@ -9173,6 +9008,7 @@ var __webpack_exports__ = {};
9173
9008
  socket.connect(port, 'localhost');
9174
9009
  });
9175
9010
  }
9011
+ var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
9176
9012
  function setup_chrome_inspection_define_property(obj, key, value) {
9177
9013
  if (key in obj) Object.defineProperty(obj, key, {
9178
9014
  value: value,
@@ -9184,11 +9020,18 @@ var __webpack_exports__ = {};
9184
9020
  return obj;
9185
9021
  }
9186
9022
  class SetupChromeInspectionStep {
9187
- getCdpPort() {
9188
- return (0, shared_utils.c5)(this.devOptions.port, void 0);
9023
+ async getCdpPort() {
9024
+ const instanceId = this.devOptions.instanceId;
9025
+ if (instanceId) try {
9026
+ const instanceManager = new instance_manager.InstanceManager(process.cwd());
9027
+ const instance = await instanceManager.getInstance(instanceId);
9028
+ if ((null == instance ? void 0 : instance.debugPort) && Number.isFinite(instance.debugPort)) return instance.debugPort;
9029
+ } catch {}
9030
+ return (0, shared_utils.Zb)(this.devOptions.port, instanceId);
9189
9031
  }
9190
- async initialize(port = this.getCdpPort()) {
9032
+ async initialize(port) {
9191
9033
  try {
9034
+ if (!port) port = await this.getCdpPort();
9192
9035
  if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.Ro());
9193
9036
  let retries = 0;
9194
9037
  const maxRetries = 60;
@@ -9213,160 +9056,439 @@ var __webpack_exports__ = {};
9213
9056
  throw error;
9214
9057
  }
9215
9058
  }
9216
- async inspectSource(url) {
9217
- if (!this.cdpClient) throw new Error(browsers_lib_messages.mO());
9218
- try {
9219
- if ('development' === process.env.EXTENSION_ENV) {
9220
- console.log(browsers_lib_messages.Zk(url));
9221
- console.log(browsers_lib_messages.Tz());
9222
- }
9223
- const targets = await this.cdpClient.getTargets();
9224
- const existingTarget = targets.find((target)=>target.url === url && 'page' === target.type);
9225
- if (existingTarget) {
9226
- if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.F0(existingTarget.targetId));
9227
- this.currentTargetId = existingTarget.targetId;
9228
- } else {
9229
- if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.v5());
9230
- this.currentTargetId = await this.cdpClient.createTarget(url);
9231
- if ('development' === process.env.EXTENSION_ENV) {
9232
- console.log(browsers_lib_messages.N_(this.currentTargetId));
9233
- console.log(browsers_lib_messages.Ac());
9059
+ async inspectSource(url) {
9060
+ if (!this.cdpClient) throw new Error(browsers_lib_messages.mO());
9061
+ try {
9062
+ if ('development' === process.env.EXTENSION_ENV) {
9063
+ console.log(browsers_lib_messages.Zk(url));
9064
+ console.log(browsers_lib_messages.Tz());
9065
+ }
9066
+ const targets = await this.cdpClient.getTargets();
9067
+ const existingTarget = targets.find((target)=>target.url === url && 'page' === target.type);
9068
+ if (existingTarget) {
9069
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.F0(existingTarget.targetId));
9070
+ this.currentTargetId = existingTarget.targetId;
9071
+ } else {
9072
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.v5());
9073
+ this.currentTargetId = await this.cdpClient.createTarget(url);
9074
+ if ('development' === process.env.EXTENSION_ENV) {
9075
+ console.log(browsers_lib_messages.N_(this.currentTargetId));
9076
+ console.log(browsers_lib_messages.Ac());
9077
+ }
9078
+ await this.cdpClient.navigateToUrl(this.currentTargetId, url);
9079
+ }
9080
+ if (!this.currentTargetId) throw new Error('Failed to get or create target');
9081
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.tX());
9082
+ this.currentSessionId = await this.cdpClient.attachToTarget(this.currentTargetId);
9083
+ if ('development' === process.env.EXTENSION_ENV) {
9084
+ console.log(browsers_lib_messages.GR(this.currentSessionId));
9085
+ console.log(browsers_lib_messages.xR());
9086
+ }
9087
+ await this.cdpClient.sendCommand('Page.enable', {}, this.currentSessionId);
9088
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages._y());
9089
+ await this.cdpClient.waitForLoadEvent(this.currentSessionId);
9090
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.Ak());
9091
+ await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
9092
+ const html = await this.cdpClient.getPageHTML(this.currentSessionId);
9093
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.tg());
9094
+ return html;
9095
+ } catch (error) {
9096
+ if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.L7(error.message));
9097
+ throw error;
9098
+ }
9099
+ }
9100
+ async startWatching(websocketServer) {
9101
+ if ('development' !== process.env.EXTENSION_ENV) return;
9102
+ if (this.isWatching) return void console.log(browsers_lib_messages.Li());
9103
+ this.isWatching = true;
9104
+ console.log(browsers_lib_messages.G9());
9105
+ this.setupWebSocketHandler(websocketServer);
9106
+ console.log(browsers_lib_messages.A4());
9107
+ }
9108
+ setupWebSocketHandler(websocketServer) {
9109
+ if ('development' !== process.env.EXTENSION_ENV) return;
9110
+ if (!websocketServer || !websocketServer.clients) return void console.warn(browsers_lib_messages.c9());
9111
+ websocketServer.clients.forEach((ws)=>{
9112
+ this.setupConnectionHandler(ws);
9113
+ });
9114
+ websocketServer.on('connection', (ws)=>{
9115
+ this.setupConnectionHandler(ws);
9116
+ });
9117
+ }
9118
+ setupConnectionHandler(ws) {
9119
+ if ('development' !== process.env.EXTENSION_ENV) return;
9120
+ ws.on('message', async (data)=>{
9121
+ try {
9122
+ const message = JSON.parse(data);
9123
+ if ('changedFile' === message.type && this.isWatching) await this.handleFileChange();
9124
+ } catch (error) {}
9125
+ });
9126
+ }
9127
+ stopWatching() {
9128
+ if ('development' !== process.env.EXTENSION_ENV) return;
9129
+ this.isWatching = false;
9130
+ console.log(browsers_lib_messages.aW());
9131
+ }
9132
+ async handleFileChange() {
9133
+ if ('development' !== process.env.EXTENSION_ENV) return;
9134
+ if (!this.cdpClient || !this.currentSessionId) return void console.warn(browsers_lib_messages.ln());
9135
+ if (this.debounceTimer) clearTimeout(this.debounceTimer);
9136
+ this.debounceTimer = setTimeout(async ()=>{
9137
+ try {
9138
+ console.log(browsers_lib_messages.ET());
9139
+ console.log(browsers_lib_messages.Tq());
9140
+ await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
9141
+ console.log(browsers_lib_messages.ov());
9142
+ const html = await this.cdpClient.getPageHTML(this.currentSessionId);
9143
+ this.printUpdatedHTML(html);
9144
+ } catch (error) {
9145
+ console.error(browsers_lib_messages.QB(error.message));
9146
+ if (error.message.includes('session') || error.message.includes('target')) {
9147
+ console.log(browsers_lib_messages.Lf());
9148
+ await this.reconnectToTarget();
9149
+ }
9150
+ }
9151
+ }, 300);
9152
+ }
9153
+ async reconnectToTarget() {
9154
+ if ('development' !== process.env.EXTENSION_ENV) return;
9155
+ try {
9156
+ if (!this.cdpClient || !this.currentTargetId) return void console.warn(browsers_lib_messages.DQ());
9157
+ console.log(browsers_lib_messages.S6());
9158
+ this.currentSessionId = await this.cdpClient.attachToTarget(this.currentTargetId);
9159
+ console.log(browsers_lib_messages.BK(this.currentSessionId));
9160
+ } catch (error) {
9161
+ console.error(browsers_lib_messages.w4(error.message));
9162
+ }
9163
+ }
9164
+ printHTML(html) {
9165
+ console.log(browsers_lib_messages.dI());
9166
+ console.log(html);
9167
+ console.log(browsers_lib_messages.qX());
9168
+ }
9169
+ printUpdatedHTML(html) {
9170
+ if ('development' !== process.env.EXTENSION_ENV) return;
9171
+ console.log(browsers_lib_messages.dI());
9172
+ console.log(browsers_lib_messages.Hd("UPDATED - after content script injection"));
9173
+ console.log(browsers_lib_messages.dI());
9174
+ console.log(html);
9175
+ console.log(browsers_lib_messages.qX());
9176
+ }
9177
+ async cleanup() {
9178
+ try {
9179
+ if ('development' === process.env.EXTENSION_ENV) this.stopWatching();
9180
+ if (this.cdpClient && this.currentTargetId) await this.cdpClient.closeTarget(this.currentTargetId);
9181
+ if (this.cdpClient) this.cdpClient.disconnect();
9182
+ if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.S5());
9183
+ } catch (error) {
9184
+ if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.oP(error.message));
9185
+ }
9186
+ }
9187
+ apply(compiler) {
9188
+ if (!this.devOptions.source && !this.devOptions.watchSource) return;
9189
+ compiler.hooks.done.tapAsync('plugin-reload:setup-chrome-inspection', async (stats, done)=>{
9190
+ try {
9191
+ if (!this.isInitialized) await this.initialize();
9192
+ let urlToInspect;
9193
+ if (this.devOptions.source && 'string' == typeof this.devOptions.source && 'true' !== this.devOptions.source) urlToInspect = this.devOptions.source;
9194
+ else if (this.devOptions.startingUrl) urlToInspect = this.devOptions.startingUrl;
9195
+ else throw new Error(browsers_lib_messages.Ym());
9196
+ const html = await this.inspectSource(urlToInspect);
9197
+ this.printHTML(html);
9198
+ const webSocketServer = compiler.options.webSocketServer;
9199
+ if (this.devOptions.watchSource && webSocketServer && 'development' === process.env.EXTENSION_ENV) this.startWatching(webSocketServer);
9200
+ done();
9201
+ } catch (error) {
9202
+ if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.y4(error.message));
9203
+ done();
9204
+ }
9205
+ });
9206
+ }
9207
+ constructor(devOptions){
9208
+ setup_chrome_inspection_define_property(this, "devOptions", void 0);
9209
+ setup_chrome_inspection_define_property(this, "cdpClient", null);
9210
+ setup_chrome_inspection_define_property(this, "currentTargetId", null);
9211
+ setup_chrome_inspection_define_property(this, "currentSessionId", null);
9212
+ setup_chrome_inspection_define_property(this, "isInitialized", false);
9213
+ this.devOptions = devOptions;
9214
+ }
9215
+ }
9216
+ var messaging_client = __webpack_require__("./webpack/plugin-browsers/run-firefox/remote-firefox/messaging-client.ts");
9217
+ function setup_firefox_inspection_define_property(obj, key, value) {
9218
+ if (key in obj) Object.defineProperty(obj, key, {
9219
+ value: value,
9220
+ enumerable: true,
9221
+ configurable: true,
9222
+ writable: true
9223
+ });
9224
+ else obj[key] = value;
9225
+ return obj;
9226
+ }
9227
+ const MAX_CONNECT_RETRIES = 60;
9228
+ const CONNECT_RETRY_INTERVAL_MS = 500;
9229
+ const PAGE_READY_TIMEOUT_MS = 8000;
9230
+ const TARGET_SCAN_INTERVAL_MS = 250;
9231
+ const CHANGE_DEBOUNCE_MS = 300;
9232
+ function wait(ms) {
9233
+ return new Promise((resolve)=>setTimeout(resolve, ms));
9234
+ }
9235
+ class SetupFirefoxInspectionStep {
9236
+ async getRdpPort() {
9237
+ const instanceId = this.devOptions.instanceId;
9238
+ if (instanceId) try {
9239
+ const instanceManager = new instance_manager.InstanceManager(process.cwd());
9240
+ const instance = await instanceManager.getInstance(instanceId);
9241
+ if ((null == instance ? void 0 : instance.debugPort) && Number.isFinite(instance.debugPort)) return instance.debugPort;
9242
+ } catch {}
9243
+ return (0, shared_utils.Zb)(this.devOptions.port, instanceId);
9244
+ }
9245
+ async initialize() {
9246
+ if (this.initialized) return;
9247
+ const client = new messaging_client.v();
9248
+ const port = await this.getRdpPort();
9249
+ try {
9250
+ console.log(browsers_lib_messages.l());
9251
+ } catch {}
9252
+ let retries = 0;
9253
+ while(retries < MAX_CONNECT_RETRIES)try {
9254
+ await client.connect(port);
9255
+ this.client = client;
9256
+ this.initialized = true;
9257
+ try {
9258
+ console.log(browsers_lib_messages.Xy());
9259
+ console.log(browsers_lib_messages.Qe());
9260
+ } catch {}
9261
+ return;
9262
+ } catch (err) {
9263
+ retries++;
9264
+ if (retries % 10 === 0) try {
9265
+ console.log(browsers_lib_messages.X_(retries, MAX_CONNECT_RETRIES));
9266
+ } catch {}
9267
+ await wait(CONNECT_RETRY_INTERVAL_MS);
9268
+ }
9269
+ throw new Error(browsers_lib_messages.V9(port));
9270
+ }
9271
+ resolveUrlToInspect() {
9272
+ if (this.devOptions.source && 'string' == typeof this.devOptions.source && 'true' !== this.devOptions.source) return this.devOptions.source;
9273
+ if (this.devOptions.startingUrl) return this.devOptions.startingUrl;
9274
+ throw new Error(browsers_lib_messages.Ym());
9275
+ }
9276
+ async selectActors(urlToInspect) {
9277
+ if (!this.client) throw new Error(browsers_lib_messages.pl());
9278
+ const deadline = Date.now() + 10000;
9279
+ let triedAddTab = false;
9280
+ while(Date.now() < deadline){
9281
+ const allTargets = await this.client.getTargets() || [];
9282
+ for (const target of allTargets)if (target && 'string' == typeof target.url && target.url === urlToInspect && target.actor) return {
9283
+ tabActor: target.actor,
9284
+ consoleActor: target.consoleActor || target.actor
9285
+ };
9286
+ if (!triedAddTab && urlToInspect) {
9287
+ triedAddTab = true;
9288
+ try {
9289
+ await this.client.addTab(urlToInspect);
9290
+ await wait(300);
9291
+ continue;
9292
+ } catch {}
9293
+ }
9294
+ for (const target of allTargets)if (target && (target.actor || target.outerWindowID)) return {
9295
+ tabActor: target.actor,
9296
+ consoleActor: target.consoleActor || target.actor
9297
+ };
9298
+ await wait(TARGET_SCAN_INTERVAL_MS);
9299
+ }
9300
+ throw new Error(browsers_lib_messages.qP());
9301
+ }
9302
+ async ensureNavigatedAndLoaded(urlToInspect, tabActor) {
9303
+ if (!this.client) throw new Error(browsers_lib_messages.pl());
9304
+ if (!tabActor) throw new Error(browsers_lib_messages.Do());
9305
+ let consoleActor = tabActor;
9306
+ let frameActor = tabActor;
9307
+ try {
9308
+ const detail = await this.client.getTargetFromDescriptor(tabActor);
9309
+ if (detail.consoleActor) consoleActor = detail.consoleActor;
9310
+ if (detail.targetActor) frameActor = detail.targetActor;
9311
+ } catch {}
9312
+ try {
9313
+ await this.client.attach(frameActor);
9314
+ } catch {}
9315
+ try {
9316
+ await this.client.navigateViaScript(consoleActor, urlToInspect);
9317
+ await this.client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
9318
+ return;
9319
+ } catch {}
9320
+ try {
9321
+ const detail = await this.client.getTargetFromDescriptor(tabActor);
9322
+ const targetActor = detail.targetActor || tabActor;
9323
+ try {
9324
+ await this.client.attach(targetActor);
9325
+ } catch {}
9326
+ await this.client.navigate(targetActor, urlToInspect);
9327
+ await this.client.waitForLoadEvent(targetActor);
9328
+ } catch {}
9329
+ }
9330
+ async ensureUrlAndReady(consoleActor, urlToInspect) {
9331
+ if (!this.client) return;
9332
+ try {
9333
+ const href = await this.client.evaluate(consoleActor, 'String(location.href)');
9334
+ if ('string' != typeof href || !href.startsWith(urlToInspect)) await this.client.navigateViaScript(consoleActor, urlToInspect);
9335
+ } catch {}
9336
+ await this.client.waitForPageReady(consoleActor, urlToInspect, PAGE_READY_TIMEOUT_MS);
9337
+ }
9338
+ async resolveConsoleActor(tabActor, urlToInspect) {
9339
+ if (!this.client) throw new Error(browsers_lib_messages.pl());
9340
+ const start = Date.now();
9341
+ while(Date.now() - start < PAGE_READY_TIMEOUT_MS){
9342
+ try {
9343
+ const targets = await this.client.getTargets();
9344
+ const byActor = targets.find((t)=>t && t.actor === tabActor);
9345
+ const byUrl = targets.find((t)=>t && t.url === urlToInspect);
9346
+ const match = byActor || byUrl;
9347
+ const ca = (null == match ? void 0 : match.consoleActor) || (null == match ? void 0 : match.webConsoleActor);
9348
+ if ('string' == typeof ca && ca.length > 0) return ca;
9349
+ try {
9350
+ const detail = await this.client.getTargetFromDescriptor(tabActor);
9351
+ const guessed = detail.consoleActor;
9352
+ if ('string' == typeof guessed && guessed.length > 0) return guessed;
9353
+ } catch {}
9354
+ } catch {}
9355
+ await wait(200);
9356
+ }
9357
+ return tabActor;
9358
+ }
9359
+ async printHTML(consoleActor) {
9360
+ if (!this.client) throw new Error('RDP client not initialized');
9361
+ let lastError = null;
9362
+ for(let attempt = 0; attempt < 3; attempt++){
9363
+ let actorToUse = consoleActor;
9364
+ try {
9365
+ if (this.currentTabActor && this.lastUrlToInspect) {
9366
+ const fresh = await this.resolveConsoleActor(this.currentTabActor, this.lastUrlToInspect);
9367
+ if (fresh) actorToUse = fresh;
9234
9368
  }
9235
- await this.cdpClient.navigateToUrl(this.currentTargetId, url);
9236
- }
9237
- if (!this.currentTargetId) throw new Error('Failed to get or create target');
9238
- if ('development' === process.env.EXTENSION_ENV) console.log(browsers_lib_messages.tX());
9239
- this.currentSessionId = await this.cdpClient.attachToTarget(this.currentTargetId);
9240
- if ('development' === process.env.EXTENSION_ENV) {
9241
- console.log(browsers_lib_messages.GR(this.currentSessionId));
9242
- console.log(browsers_lib_messages.xR());
9369
+ } catch {}
9370
+ try {
9371
+ const descriptor = this.currentTabActor || actorToUse;
9372
+ if (this.lastUrlToInspect) await this.ensureUrlAndReady(actorToUse, this.lastUrlToInspect);
9373
+ try {
9374
+ const currentUrl = await this.client.evaluate(actorToUse, 'String(location.href)');
9375
+ const currentTitle = await this.client.evaluate(actorToUse, 'String(document.title)');
9376
+ console.log(browsers_lib_messages.dI());
9377
+ console.log(browsers_lib_messages.Hd(`URL: ${currentUrl} | TITLE: ${currentTitle}`));
9378
+ } catch {}
9379
+ const html = await this.client.getPageHTML(descriptor, actorToUse) || '';
9380
+ console.log(html);
9381
+ console.log(browsers_lib_messages.qX());
9382
+ return;
9383
+ } catch (err) {
9384
+ lastError = err;
9243
9385
  }
9244
- await this.cdpClient.sendCommand('Page.enable', {}, this.currentSessionId);
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;
9386
+ await wait(200);
9255
9387
  }
9388
+ throw lastError || new Error(browsers_lib_messages.Cn());
9256
9389
  }
9257
- async startWatching(websocketServer) {
9258
- if ('development' !== process.env.EXTENSION_ENV) return;
9259
- if (this.isWatching) return void console.log(browsers_lib_messages.Li());
9260
- this.isWatching = true;
9261
- console.log(browsers_lib_messages.G9());
9262
- this.setupWebSocketHandler(websocketServer);
9263
- console.log(browsers_lib_messages.A4());
9390
+ async waitForContentScriptInjection(consoleActor) {
9391
+ if (!this.client) return;
9392
+ const deadline = Date.now() + PAGE_READY_TIMEOUT_MS;
9393
+ while(Date.now() < deadline){
9394
+ try {
9395
+ const injected = await this.client.evaluate(consoleActor, `(() => {
9396
+ const root = document.getElementById('extension-root');
9397
+ if (!root || !root.shadowRoot) return false;
9398
+ const html = root.shadowRoot.innerHTML || '';
9399
+ return html.length > 0;
9400
+ })()`);
9401
+ if (injected) return;
9402
+ } catch {}
9403
+ await wait(200);
9404
+ }
9264
9405
  }
9265
9406
  setupWebSocketHandler(websocketServer) {
9266
- if ('development' !== process.env.EXTENSION_ENV) return;
9267
- if (!websocketServer || !websocketServer.clients) return void console.warn(browsers_lib_messages.c9());
9407
+ if (!websocketServer || !websocketServer.clients) return;
9268
9408
  websocketServer.clients.forEach((ws)=>{
9269
- this.setupConnectionHandler(ws);
9409
+ this.attachConnection(ws);
9270
9410
  });
9271
9411
  websocketServer.on('connection', (ws)=>{
9272
- this.setupConnectionHandler(ws);
9412
+ this.attachConnection(ws);
9273
9413
  });
9274
9414
  }
9275
- setupConnectionHandler(ws) {
9276
- if ('development' !== process.env.EXTENSION_ENV) return;
9415
+ attachConnection(ws) {
9277
9416
  ws.on('message', async (data)=>{
9278
9417
  try {
9279
9418
  const message = JSON.parse(data);
9280
9419
  if ('changedFile' === message.type && this.isWatching) await this.handleFileChange();
9281
- } catch (error) {}
9420
+ } catch {}
9282
9421
  });
9283
9422
  }
9284
- stopWatching() {
9285
- if ('development' !== process.env.EXTENSION_ENV) return;
9286
- this.isWatching = false;
9287
- console.log(browsers_lib_messages.aW());
9288
- }
9289
9423
  async handleFileChange() {
9290
- if ('development' !== process.env.EXTENSION_ENV) return;
9291
- if (!this.cdpClient || !this.currentSessionId) return void console.warn(browsers_lib_messages.ln());
9424
+ if (!this.client || !this.currentConsoleActor) return;
9292
9425
  if (this.debounceTimer) clearTimeout(this.debounceTimer);
9293
9426
  this.debounceTimer = setTimeout(async ()=>{
9294
9427
  try {
9295
- console.log(browsers_lib_messages.ET());
9296
- console.log(browsers_lib_messages.Tq());
9297
- await this.cdpClient.waitForContentScriptInjection(this.currentSessionId);
9298
- console.log(browsers_lib_messages.ov());
9299
- const html = await this.cdpClient.getPageHTML(this.currentSessionId);
9300
- this.printUpdatedHTML(html);
9301
- } catch (error) {
9302
- console.error(browsers_lib_messages.QB(error.message));
9303
- if (error.message.includes('session') || error.message.includes('target')) {
9304
- console.log(browsers_lib_messages.Lf());
9305
- await this.reconnectToTarget();
9428
+ if (this.currentTabActor && this.lastUrlToInspect) {
9429
+ const freshConsole = await this.resolveConsoleActor(this.currentTabActor, this.lastUrlToInspect);
9430
+ if (freshConsole) this.currentConsoleActor = freshConsole;
9431
+ }
9432
+ if (this.lastUrlToInspect) await this.ensureUrlAndReady(this.currentConsoleActor, this.lastUrlToInspect);
9433
+ await this.waitForContentScriptInjection(this.currentConsoleActor);
9434
+ let lastError = null;
9435
+ for(let attempt = 0; attempt < 3; attempt++){
9436
+ try {
9437
+ const descriptor = this.currentTabActor || this.currentConsoleActor;
9438
+ const html = await this.client.getPageHTML(descriptor, this.currentConsoleActor);
9439
+ console.log(browsers_lib_messages.dI());
9440
+ console.log(browsers_lib_messages.Hd("UPDATED - after content script injection"));
9441
+ console.log(html);
9442
+ console.log(browsers_lib_messages.qX());
9443
+ return;
9444
+ } catch (err) {
9445
+ lastError = err;
9446
+ }
9447
+ await wait(200);
9306
9448
  }
9449
+ throw lastError || new Error('Failed to update HTML after retries');
9450
+ } catch (err) {
9451
+ console.error(browsers_lib_messages.QB(err.message));
9307
9452
  }
9308
- }, 300);
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
- }
9453
+ }, CHANGE_DEBOUNCE_MS);
9343
9454
  }
9344
9455
  apply(compiler) {
9345
9456
  if (!this.devOptions.source && !this.devOptions.watchSource) return;
9346
- compiler.hooks.done.tapAsync('plugin-reload:setup-chrome-inspection', async (stats, done)=>{
9457
+ compiler.hooks.done.tapAsync('plugin-reload:setup-firefox-inspection', async (_stats, done)=>{
9347
9458
  try {
9348
- if (!this.isInitialized) await this.initialize();
9349
- let urlToInspect;
9350
- if (this.devOptions.source && 'string' == typeof this.devOptions.source && 'true' !== this.devOptions.source) urlToInspect = this.devOptions.source;
9351
- else if (this.devOptions.startingUrl) urlToInspect = this.devOptions.startingUrl;
9352
- else throw new Error(browsers_lib_messages.Ym());
9353
- const html = await this.inspectSource(urlToInspect);
9354
- this.printHTML(html);
9459
+ if (!this.initialized) await this.initialize();
9460
+ const urlToInspect = this.resolveUrlToInspect();
9461
+ this.lastUrlToInspect = urlToInspect;
9462
+ console.log(browsers_lib_messages.hm(urlToInspect));
9463
+ const { tabActor, consoleActor } = await this.selectActors(urlToInspect);
9464
+ this.currentTabActor = tabActor;
9465
+ await this.ensureNavigatedAndLoaded(urlToInspect, tabActor);
9466
+ const resolvedConsoleActor = await this.resolveConsoleActor(tabActor, urlToInspect);
9467
+ this.currentConsoleActor = resolvedConsoleActor || consoleActor;
9468
+ if (this.currentConsoleActor) {
9469
+ await this.waitForContentScriptInjection(this.currentConsoleActor);
9470
+ await this.printHTML(this.currentConsoleActor);
9471
+ }
9355
9472
  const webSocketServer = compiler.options.webSocketServer;
9356
- if (this.devOptions.watchSource && webSocketServer && 'development' === process.env.EXTENSION_ENV) this.startWatching(webSocketServer);
9357
- done();
9473
+ if (this.devOptions.watchSource && webSocketServer && !this.isWatching) {
9474
+ this.isWatching = true;
9475
+ this.setupWebSocketHandler(webSocketServer);
9476
+ }
9358
9477
  } catch (error) {
9359
- if ('development' === process.env.EXTENSION_ENV) console.error(browsers_lib_messages.y4(error.message));
9360
- done();
9478
+ console.error(browsers_lib_messages.y4(error.message));
9361
9479
  }
9480
+ done();
9362
9481
  });
9363
9482
  }
9364
9483
  constructor(devOptions){
9365
- setup_chrome_inspection_define_property(this, "devOptions", void 0);
9366
- setup_chrome_inspection_define_property(this, "cdpClient", null);
9367
- setup_chrome_inspection_define_property(this, "currentTargetId", null);
9368
- setup_chrome_inspection_define_property(this, "currentSessionId", null);
9369
- setup_chrome_inspection_define_property(this, "isInitialized", false);
9484
+ setup_firefox_inspection_define_property(this, "devOptions", void 0);
9485
+ setup_firefox_inspection_define_property(this, "client", null);
9486
+ setup_firefox_inspection_define_property(this, "currentConsoleActor", null);
9487
+ setup_firefox_inspection_define_property(this, "currentTabActor", null);
9488
+ setup_firefox_inspection_define_property(this, "isWatching", false);
9489
+ setup_firefox_inspection_define_property(this, "debounceTimer", null);
9490
+ setup_firefox_inspection_define_property(this, "initialized", false);
9491
+ setup_firefox_inspection_define_property(this, "lastUrlToInspect", null);
9370
9492
  this.devOptions = devOptions;
9371
9493
  }
9372
9494
  }
@@ -9492,7 +9614,7 @@ var __webpack_exports__ = {};
9492
9614
  var _devOptions_output, _devOptions_output1;
9493
9615
  const { manifestPath, packageJsonPath } = projectStructure;
9494
9616
  const manifestDir = external_path_.dirname(manifestPath);
9495
- const packageJsonDir = external_path_.dirname(packageJsonPath);
9617
+ const packageJsonDir = packageJsonPath ? external_path_.dirname(packageJsonPath) : manifestDir;
9496
9618
  const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
9497
9619
  const userExtensionOutputPath = devOptions.output.path;
9498
9620
  const managerExtensionOutputPath = external_path_.join(manifestDir, 'dist', 'extension-js', 'extensions', `${devOptions.browser}-manager`);
@@ -9520,10 +9642,13 @@ var __webpack_exports__ = {};
9520
9642
  }
9521
9643
  },
9522
9644
  resolve: {
9523
- modules: [
9645
+ modules: packageJsonPath ? [
9524
9646
  'node_modules',
9525
9647
  external_path_.join(packageJsonDir, 'node_modules'),
9526
9648
  external_path_.join(process.cwd(), 'node_modules')
9649
+ ] : [
9650
+ 'node_modules',
9651
+ external_path_.join(process.cwd(), 'node_modules')
9527
9652
  ],
9528
9653
  extensions: [
9529
9654
  '.js',
@@ -9649,9 +9774,6 @@ var __webpack_exports__ = {};
9649
9774
  function manifestNotFoundError(manifestPath) {
9650
9775
  return `${messages_getLoggingPrefix('error')} Manifest file not found.\n${external_pintor_default().red('Ensure the path to your extension exists and try again.')}\n${external_pintor_default().red('NOT FOUND')}\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(manifestPath)}`;
9651
9776
  }
9652
- function packageJsonNotFoundError(manifestPath) {
9653
- return `${messages_getLoggingPrefix('error')} No valid package.json found for manifest.\n${external_pintor_default().red('Ensure there is a valid package.json file in the project or its parent directories.')}\n${external_pintor_default().red('MANIFEST')}\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(manifestPath)}`;
9654
- }
9655
9777
  function runningInProduction(outputPath) {
9656
9778
  const manifestPath = external_path_.join(outputPath, 'manifest.json');
9657
9779
  const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
@@ -9741,6 +9863,9 @@ var __webpack_exports__ = {};
9741
9863
  function failedToDownloadOrExtractZIPFileError(error) {
9742
9864
  return `${messages_getLoggingPrefix('error')} Failed to download or extract ZIP file.\n${external_pintor_default().red(error)}`;
9743
9865
  }
9866
+ function invalidRemoteZip(url, contentType) {
9867
+ return `${messages_getLoggingPrefix('error')} Remote URL does not appear to be a ZIP archive.\n${external_pintor_default().gray('URL')} ${external_pintor_default().underline(url)}\n${external_pintor_default().gray('Content-Type')} ${external_pintor_default().underline(contentType || 'unknown')}`;
9868
+ }
9744
9869
  function capitalizedBrowserName(browser) {
9745
9870
  const b = String(browser || '');
9746
9871
  const cap = b.charAt(0).toUpperCase() + b.slice(1);
@@ -9789,7 +9914,7 @@ var __webpack_exports__ = {};
9789
9914
  return `.\n${printTree(assetTree)}`;
9790
9915
  }
9791
9916
  function isUsingExperimentalConfig(integration) {
9792
- return `${messages_getLoggingPrefix('info')} Using ${integration}.`;
9917
+ return `${messages_getLoggingPrefix('info')} Using ${external_pintor_default().yellow(integration)}.`;
9793
9918
  }
9794
9919
  function installingDependencies() {
9795
9920
  return `${messages_getLoggingPrefix('info')} Installing project dependencies...`;
@@ -9818,10 +9943,16 @@ var __webpack_exports__ = {};
9818
9943
  async function downloadAndExtractZip(url, targetPath) {
9819
9944
  const urlNoSearchParams = url.split('?')[0];
9820
9945
  try {
9946
+ var _response_headers;
9821
9947
  console.log(downloadingText(urlNoSearchParams));
9822
9948
  const response = await external_axios_default().get(url, {
9823
- responseType: 'stream'
9949
+ responseType: 'stream',
9950
+ maxRedirects: 5
9824
9951
  });
9952
+ const contentType = String((null == (_response_headers = response.headers) ? void 0 : _response_headers['content-type']) || '');
9953
+ const isZipExt = '.zip' === external_path_.extname(urlNoSearchParams).toLowerCase();
9954
+ const isZipType = /zip|octet-stream/i.test(contentType);
9955
+ if (!isZipExt && !isZipType) throw new Error(`${invalidRemoteZip(urlNoSearchParams, contentType)}`);
9825
9956
  const extname = external_path_.extname(urlNoSearchParams);
9826
9957
  const basename = external_path_.basename(urlNoSearchParams, extname);
9827
9958
  const destinationPath = external_path_.join(targetPath, basename);
@@ -9888,15 +10019,22 @@ var __webpack_exports__ = {};
9888
10019
  }
9889
10020
  };
9890
10021
  async function importUrlSourceFromGithub(pathOrRemoteUrl, text) {
9891
- await external_go_git_it_default()(pathOrRemoteUrl, process.cwd(), text);
10022
+ const tempRoot = external_fs_.mkdtempSync(external_path_.join(external_os_.tmpdir(), 'extension-js-'));
10023
+ await external_go_git_it_default()(pathOrRemoteUrl, tempRoot, text);
9892
10024
  const url = new URL(pathOrRemoteUrl);
9893
- const urlData = url.pathname.split('/');
9894
- const repoName = urlData[urlData.length - 1];
9895
- return external_path_.resolve(process.cwd(), repoName);
10025
+ const segments = url.pathname.split('/').filter(Boolean);
10026
+ const repoName = segments.length >= 2 ? segments[1] : segments[segments.length - 1];
10027
+ const candidates = external_fs_.readdirSync(tempRoot, {
10028
+ withFileTypes: true
10029
+ }).filter((d)=>d.isDirectory()).map((d)=>d.name);
10030
+ const chosen = candidates.includes(repoName) ? repoName : candidates[0];
10031
+ const resolved = chosen ? external_path_.resolve(tempRoot, chosen) : tempRoot;
10032
+ return resolved;
9896
10033
  }
9897
10034
  async function importUrlSourceFromZip(pathOrRemoteUrl) {
9898
- const zipFilePath = await downloadAndExtractZip(pathOrRemoteUrl, process.cwd());
9899
- return zipFilePath;
10035
+ const tempRoot = external_fs_.mkdtempSync(external_path_.join(external_os_.tmpdir(), 'extension-js-'));
10036
+ const extractedPath = await downloadAndExtractZip(pathOrRemoteUrl, tempRoot);
10037
+ return extractedPath;
9900
10038
  }
9901
10039
  async function getProjectPath(pathOrRemoteUrl) {
9902
10040
  if (!pathOrRemoteUrl) return process.cwd();
@@ -9941,7 +10079,9 @@ var __webpack_exports__ = {};
9941
10079
  else throw new Error(manifestNotFoundError(manifestPath));
9942
10080
  }
9943
10081
  const packageJsonPath = await findNearestPackageJson(manifestPath);
9944
- if (!packageJsonPath || !validatePackageJson(packageJsonPath)) throw new Error(packageJsonNotFoundError(manifestPath));
10082
+ if (!packageJsonPath || !validatePackageJson(packageJsonPath)) return {
10083
+ manifestPath
10084
+ };
9945
10085
  return {
9946
10086
  manifestPath,
9947
10087
  packageJsonPath
@@ -10195,7 +10335,7 @@ var __webpack_exports__ = {};
10195
10335
  const configPath = candidates.find((p)=>external_fs_.existsSync(p));
10196
10336
  if (configPath) {
10197
10337
  if (!get_extension_config_userMessageDelivered) {
10198
- console.log(isUsingExperimentalConfig('extension.config.js'));
10338
+ if ('development' === process.env.EXTENSION_ENV) console.log(isUsingExperimentalConfig('extension.config.js'));
10199
10339
  get_extension_config_userMessageDelivered = true;
10200
10340
  }
10201
10341
  return true;
@@ -10289,8 +10429,8 @@ var __webpack_exports__ = {};
10289
10429
  var _baseConfig_plugins;
10290
10430
  const browser = (null == buildOptions ? void 0 : buildOptions.browser) || 'chrome';
10291
10431
  const manifestDir = external_path_.dirname(projectStructure.manifestPath);
10292
- const packageJsonDir = external_path_.dirname(projectStructure.packageJsonPath);
10293
- assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
10432
+ const packageJsonDir = projectStructure.packageJsonPath ? external_path_.dirname(projectStructure.packageJsonPath) : manifestDir;
10433
+ if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
10294
10434
  const baseConfig = webpackConfig(projectStructure, {
10295
10435
  ...buildOptions,
10296
10436
  browser,
@@ -10312,10 +10452,12 @@ var __webpack_exports__ = {};
10312
10452
  });
10313
10453
  const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(userConfig);
10314
10454
  const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
10315
- const nodeModulesPath = external_path_.join(packageJsonDir, 'node_modules');
10316
- if (!external_fs_.existsSync(nodeModulesPath)) {
10317
- console.log(installingDependencies());
10318
- if ('true' !== process.env.VITEST) await installDependencies(packageJsonDir);
10455
+ if (projectStructure.packageJsonPath) {
10456
+ const nodeModulesPath = external_path_.join(packageJsonDir, 'node_modules');
10457
+ if (!external_fs_.existsSync(nodeModulesPath)) {
10458
+ console.log(installingDependencies());
10459
+ if ('true' !== process.env.VITEST) await installDependencies(packageJsonDir);
10460
+ }
10319
10461
  }
10320
10462
  await new Promise((resolve, reject)=>{
10321
10463
  compiler.run(async (err, stats)=>{
@@ -10332,6 +10474,7 @@ var __webpack_exports__ = {};
10332
10474
  console.log(stats.toString({
10333
10475
  colors: true
10334
10476
  }));
10477
+ if ((null == buildOptions ? void 0 : buildOptions.exitOnError) === false) return reject(new Error('Build failed with errors'));
10335
10478
  process.exit(1);
10336
10479
  } else {
10337
10480
  console.log(buildSuccess());
@@ -10341,6 +10484,7 @@ var __webpack_exports__ = {};
10341
10484
  });
10342
10485
  } catch (error) {
10343
10486
  if ('development' === process.env.EXTENSION_ENV) console.error(error);
10487
+ if ((null == buildOptions ? void 0 : buildOptions.exitOnError) === false) throw error;
10344
10488
  process.exit(1);
10345
10489
  }
10346
10490
  }
@@ -10467,7 +10611,7 @@ var __webpack_exports__ = {};
10467
10611
  var _process_removeAllListeners, _process, _process_removeAllListeners1, _process1, _process_removeAllListeners2, _process2, _process_removeAllListeners3, _process3;
10468
10612
  const { manifestPath, packageJsonPath } = projectStructure;
10469
10613
  const manifestDir = external_path_.dirname(manifestPath);
10470
- const packageJsonDir = external_path_.dirname(packageJsonPath);
10614
+ const packageJsonDir = packageJsonPath ? external_path_.dirname(packageJsonPath) : manifestDir;
10471
10615
  const commandConfig = await loadCommandConfig(manifestDir, 'dev');
10472
10616
  const browserConfig = await loadBrowserConfig(manifestDir, devOptions.browser);
10473
10617
  const portManager = new PortManager(devOptions.browser, packageJsonDir, 8080);
@@ -10521,11 +10665,7 @@ var __webpack_exports__ = {};
10521
10665
  interval: 1000
10522
10666
  }
10523
10667
  },
10524
- client: {
10525
- logging: 'none',
10526
- progress: false,
10527
- overlay: false
10528
- },
10668
+ client: false,
10529
10669
  headers: {
10530
10670
  'Access-Control-Allow-Origin': '*'
10531
10671
  },
@@ -10612,13 +10752,15 @@ var __webpack_exports__ = {};
10612
10752
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
10613
10753
  try {
10614
10754
  const manifestDir = external_path_.dirname(projectStructure.manifestPath);
10615
- const packageJsonDir = external_path_.dirname(projectStructure.packageJsonPath);
10755
+ const packageJsonDir = projectStructure.packageJsonPath ? external_path_.dirname(projectStructure.packageJsonPath) : manifestDir;
10616
10756
  if (isUsingTypeScript(manifestDir)) await generateExtensionTypes(manifestDir);
10617
- assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
10618
- const nodeModulesPath = external_path_.join(packageJsonDir, 'node_modules');
10619
- if (!external_fs_.existsSync(nodeModulesPath)) {
10620
- console.log(installingDependencies());
10621
- await installDependencies(packageJsonDir);
10757
+ if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
10758
+ if (projectStructure.packageJsonPath) {
10759
+ const nodeModulesPath = external_path_.join(packageJsonDir, 'node_modules');
10760
+ if (!external_fs_.existsSync(nodeModulesPath)) {
10761
+ console.log(installingDependencies());
10762
+ await installDependencies(packageJsonDir);
10763
+ }
10622
10764
  }
10623
10765
  await dev_server_devServer(projectStructure, {
10624
10766
  ...devOptions,
@@ -10632,7 +10774,7 @@ var __webpack_exports__ = {};
10632
10774
  }
10633
10775
  async function extensionPreview(pathOrRemoteUrl, previewOptions) {
10634
10776
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
10635
- assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
10777
+ if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, external_path_.dirname(projectStructure.manifestPath));
10636
10778
  const manifestDir = external_path_.dirname(projectStructure.manifestPath);
10637
10779
  const distPath = external_path_.join(manifestDir, 'dist', previewOptions.browser);
10638
10780
  const outputPath = previewOptions.outputPath ? previewOptions.outputPath : external_fs_.existsSync(distPath) ? distPath : manifestDir;