extension-develop 3.0.0-next.62 → 3.0.0-next.67

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
@@ -124489,7 +124489,9 @@ var __webpack_modules__ = {
124489
124489
  var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("path");
124490
124490
  var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("fs");
124491
124491
  var child_process__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("child_process");
124492
- var package_manager_detector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("package-manager-detector");
124492
+ var pintor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("pintor");
124493
+ var pintor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/ __webpack_require__.n(pintor__WEBPACK_IMPORTED_MODULE_3__);
124494
+ var package_manager_detector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("package-manager-detector");
124493
124495
  function parseJsonSafe(text) {
124494
124496
  const s = text && 0xfeff === text.charCodeAt(0) ? text.slice(1) : text;
124495
124497
  return JSON.parse(s || '{}');
@@ -124505,7 +124507,7 @@ var __webpack_modules__ = {
124505
124507
  }
124506
124508
  async function installOptionalDependencies(integration, dependencies) {
124507
124509
  try {
124508
- const pm = await (0, package_manager_detector__WEBPACK_IMPORTED_MODULE_3__.detect)();
124510
+ const pm = await (0, package_manager_detector__WEBPACK_IMPORTED_MODULE_4__.detect)();
124509
124511
  let installCommand = '';
124510
124512
  const quotedDir = JSON.stringify(__dirname);
124511
124513
  if ((null == pm ? void 0 : pm.name) === 'yarn') installCommand = `yarn --silent add ${dependencies.join(' ')} --cwd ${quotedDir} --optional`;
@@ -124521,7 +124523,7 @@ var __webpack_modules__ = {
124521
124523
  });
124522
124524
  await new Promise((r)=>setTimeout(r, 500));
124523
124525
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
124524
- console.log(`[${integration}] Installing root dependencies for dev...`);
124526
+ console.log(`${pintor__WEBPACK_IMPORTED_MODULE_3___default().brightMagenta("\u25BA\u25BA\u25BA Author says")} [${integration}] Installing root dependencies for dev...`);
124525
124527
  const devInstall = (null == pm ? void 0 : pm.name) === 'yarn' ? "yarn install --silent" : (null == pm ? void 0 : pm.name) === 'npm' || isFromNpx() ? "npm install --silent" : isFromPnpx() ? "pnpm install --silent" : `${'string' == typeof pm ? pm : (null == pm ? void 0 : pm.name) || 'npm'} install --silent`;
124526
124528
  (0, child_process__WEBPACK_IMPORTED_MODULE_2__.execSync)(devInstall, {
124527
124529
  stdio: 'ignore'
@@ -124573,6 +124575,7 @@ var __webpack_modules__ = {
124573
124575
  _n: ()=>writingTypeDefinitions,
124574
124576
  aP: ()=>unpackagedSuccessfully,
124575
124577
  cq: ()=>downloadingText,
124578
+ fH: ()=>noCompanionExtensionsResolved,
124576
124579
  hf: ()=>cantInstallDependencies,
124577
124580
  hv: ()=>treeWithDistFilesbrowser,
124578
124581
  iE: ()=>downloadingProjectPath,
@@ -124619,7 +124622,11 @@ var __webpack_modules__ = {
124619
124622
  }
124620
124623
  };
124621
124624
  function getLoggingPrefix(type) {
124622
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) return pintor__WEBPACK_IMPORTED_MODULE_2___default().brightMagenta('error' === type ? 'ERROR' : "\u25BA\u25BA\u25BA");
124625
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
124626
+ if (isAuthor) {
124627
+ const base = 'error' === type ? 'ERROR Author says' : "\u25BA\u25BA\u25BA Author says";
124628
+ return pintor__WEBPACK_IMPORTED_MODULE_2___default().brightMagenta(base);
124629
+ }
124623
124630
  if ('error' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().red('ERROR');
124624
124631
  if ('warn' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().brightYellow("\u25BA\u25BA\u25BA");
124625
124632
  if ('info' === type) return pintor__WEBPACK_IMPORTED_MODULE_2___default().gray("\u25BA\u25BA\u25BA");
@@ -124631,18 +124638,14 @@ var __webpack_modules__ = {
124631
124638
  function manifestNotFoundError(manifestPath) {
124632
124639
  return `${getLoggingPrefix('error')} Manifest file not found.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red('Ensure the path to your extension exists and try again.')}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red('NOT FOUND')}\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('PATH')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(manifestPath)}`;
124633
124640
  }
124634
- function runningInProduction(outputPath) {
124641
+ function runningInProduction(outputPath, browserLabel) {
124635
124642
  const manifestPath = path__WEBPACK_IMPORTED_MODULE_1__.join(outputPath, 'manifest.json');
124636
124643
  const manifest = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(manifestPath, 'utf-8'));
124637
124644
  const { name, version: version1, hostPermissions, permissions } = manifest;
124638
124645
  const hasHost = hostPermissions && hostPermissions.length;
124639
124646
  const hasPermissions = permissions && permissions.length;
124640
- return `${` \u{1F9E9} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().brightBlue('Extension.js')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(`${_package_json__WEBPACK_IMPORTED_MODULE_3__.i8}`)}`}
124641
- Extension Name ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(name)}
124642
- Extension Version ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(version1)}
124643
- Host Permissions ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(hasHost ? hostPermissions.join(', ') : 'Browser defaults')}
124644
- Permissions ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(hasPermissions ? permissions.join(', ') : 'Browser defaults')}
124645
- `;
124647
+ const browserDisplay = browserLabel && browserLabel.trim().length > 0 ? browserLabel.trim() : 'Unknown';
124648
+ return ` \u{1F9E9} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().brightBlue('Extension.js')} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(`${_package_json__WEBPACK_IMPORTED_MODULE_3__.i8}`)}\n Browser ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(browserDisplay)}\n Extension ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(version1 ? `${name} ${version1}` : name)}\n Permissions ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(hasPermissions ? permissions.join(', ') : 'Browser defaults')}\n Host Permissions ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(hasHost ? hostPermissions.join(', ') : 'Browser defaults')}`;
124646
124649
  }
124647
124650
  function previewing(browser) {
124648
124651
  return `${getLoggingPrefix('info')} Previewing the extension on ${capitalizedBrowserName(browser)}...`;
@@ -124797,6 +124800,9 @@ var __webpack_modules__ = {
124797
124800
  const list = extensions.map((e)=>`- ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline(e)}`).join('\n');
124798
124801
  return `${header}\n${list}`;
124799
124802
  }
124803
+ function noCompanionExtensionsResolved() {
124804
+ return `${getLoggingPrefix('warn')} No companion extensions resolved from ${pintor__WEBPACK_IMPORTED_MODULE_2___default().underline('extensions')} config.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray('Ensure each companion extension is an unpacked extension directory containing a manifest.json (e.g., ./extensions/<name>/manifest.json).')}`;
124805
+ }
124800
124806
  function installingDependenciesFailed(gitCommand, gitArgs, code) {
124801
124807
  return `${getLoggingPrefix('error')} Command ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(gitCommand)} ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(gitArgs.join(' '))} failed.\n${pintor__WEBPACK_IMPORTED_MODULE_2___default().red(`exit code ${pintor__WEBPACK_IMPORTED_MODULE_2___default().gray(String(code))}`)}`;
124802
124808
  }
@@ -124827,26 +124833,10 @@ var __webpack_modules__ = {
124827
124833
  "use strict";
124828
124834
  module.exports = require("child_process");
124829
124835
  },
124830
- "chrome-location2": function(module) {
124831
- "use strict";
124832
- module.exports = require("chrome-location2");
124833
- },
124834
- "chromium-location": function(module) {
124835
- "use strict";
124836
- module.exports = require("chromium-location");
124837
- },
124838
124836
  crypto: function(module) {
124839
124837
  "use strict";
124840
124838
  module.exports = require("crypto");
124841
124839
  },
124842
- "edge-location": function(module) {
124843
- "use strict";
124844
- module.exports = require("edge-location");
124845
- },
124846
- "firefox-location2": function(module) {
124847
- "use strict";
124848
- module.exports = require("firefox-location2");
124849
- },
124850
124840
  fs: function(module) {
124851
124841
  "use strict";
124852
124842
  module.exports = require("fs");
@@ -124887,7 +124877,7 @@ var __webpack_modules__ = {
124887
124877
  },
124888
124878
  "./package.json": function(module) {
124889
124879
  "use strict";
124890
- module.exports = JSON.parse('{"i8":"3.0.0-next.62","HO":{"@rspack/core":"^1.6.3","@rspack/dev-server":"^1.1.4","@swc/core":"^1.13.2","@swc/helpers":"^0.5.15","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^4.0.1","chrome-location2":"3.2.1","chromium-location":"1.2.3","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^16.4.7","edge-location":"^2.1.1","firefox-location2":"2.1.1","go-git-it":"^5.0.0","ignore":"^6.0.2","loader-utils":"^3.3.1","magic-string":"^0.30.10","package-manager-detector":"^0.2.7","parse5":"^7.2.1","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.2.0","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.18.0"}}');
124880
+ module.exports = JSON.parse('{"i8":"3.0.0-next.67","HO":{"@rspack/core":"^1.6.3","@rspack/dev-server":"^1.1.4","@swc/core":"^1.13.2","@swc/helpers":"^0.5.15","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^4.0.1","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^16.4.7","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.0.0","ignore":"^6.0.2","loader-utils":"^3.3.1","magic-string":"^0.30.10","package-manager-detector":"^0.2.7","parse5":"^7.2.1","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.2.0","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.18.0"}}');
124891
124881
  }
124892
124882
  };
124893
124883
  var __webpack_module_cache__ = {};
@@ -124971,6 +124961,7 @@ var __webpack_exports__ = {};
124971
124961
  var external_path_ = __webpack_require__("path");
124972
124962
  var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_);
124973
124963
  var external_fs_ = __webpack_require__("fs");
124964
+ var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_);
124974
124965
  var webpack_lib_messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
124975
124966
  async function findUpLocal(filename, options) {
124976
124967
  const root = external_path_.parse(options.cwd).root;
@@ -125158,10 +125149,27 @@ var __webpack_exports__ = {};
125158
125149
  };
125159
125150
  }
125160
125151
  const external_os_namespaceObject = require("os");
125152
+ const external_vm_namespaceObject = require("vm");
125161
125153
  const external_url_namespaceObject = require("url");
125162
125154
  var external_module_ = __webpack_require__("module");
125163
125155
  const external_dotenv_namespaceObject = require("dotenv");
125164
125156
  var external_dotenv_default = /*#__PURE__*/ __webpack_require__.n(external_dotenv_namespaceObject);
125157
+ function loadCommonJsConfigWithStableDirname(absolutePath) {
125158
+ var _module_exports;
125159
+ const code = external_fs_.readFileSync(absolutePath, 'utf-8');
125160
+ const dirname = external_path_.dirname(absolutePath);
125161
+ const requireFn = (0, external_module_.createRequire)(absolutePath);
125162
+ const module = {
125163
+ exports: {}
125164
+ };
125165
+ const exports1 = module.exports;
125166
+ const wrapped = `(function (exports, require, module, __filename, __dirname) {\n${code}\n})`;
125167
+ const fn = new external_vm_namespaceObject.Script(wrapped, {
125168
+ filename: absolutePath
125169
+ }).runInThisContext();
125170
+ fn(exports1, requireFn, module, absolutePath, dirname);
125171
+ return (null == (_module_exports = module.exports) ? void 0 : _module_exports.default) || module.exports;
125172
+ }
125165
125173
  function preloadEnvFiles(projectDir) {
125166
125174
  try {
125167
125175
  const defaultsPath = external_path_.join(projectDir, '.env.defaults');
@@ -125223,12 +125231,15 @@ var __webpack_exports__ = {};
125223
125231
  } catch (requireErr) {
125224
125232
  const message = String((null == error ? void 0 : error.message) || '') + ' ' + String((null == requireErr ? void 0 : requireErr.message) || '');
125225
125233
  const looksLikeCommonJsInEsm = message.includes('require is not defined in ES module scope') || message.includes('Cannot use import statement outside a module') || message.includes('ERR_REQUIRE_ESM');
125226
- if (looksLikeCommonJsInEsm) {
125234
+ if (looksLikeCommonJsInEsm) try {
125235
+ required = loadCommonJsConfigWithStableDirname(absolutePath);
125236
+ } catch {
125227
125237
  const tmpDir = external_fs_.mkdtempSync(external_path_.join(external_os_namespaceObject.tmpdir(), 'extension-config-'));
125228
125238
  const tmpCjsPath = external_path_.join(tmpDir, external_path_.basename(absolutePath, external_path_.extname(absolutePath)) + '.cjs');
125229
125239
  external_fs_.copyFileSync(absolutePath, tmpCjsPath);
125230
125240
  required = requireFn(tmpCjsPath);
125231
- } else throw requireErr;
125241
+ }
125242
+ else throw requireErr;
125232
125243
  }
125233
125244
  return (null == required ? void 0 : required.default) || required;
125234
125245
  }
@@ -125280,7 +125291,14 @@ var __webpack_exports__ = {};
125280
125291
  if (configPath) {
125281
125292
  if (await isUsingExperimentalConfig(projectPath)) try {
125282
125293
  const userConfig = await loadConfigFile(configPath);
125283
- if (userConfig && userConfig.commands && userConfig.commands[command]) return userConfig.commands[command];
125294
+ const baseExtensions = userConfig && userConfig.extensions ? {
125295
+ extensions: userConfig.extensions
125296
+ } : {};
125297
+ const perCommand = userConfig && userConfig.commands && userConfig.commands[command] ? userConfig.commands[command] : {};
125298
+ return {
125299
+ ...baseExtensions,
125300
+ ...perCommand
125301
+ };
125284
125302
  } catch (err) {
125285
125303
  const error = err;
125286
125304
  console.error(webpack_lib_messages.rF(configPath, error));
@@ -125302,7 +125320,19 @@ var __webpack_exports__ = {};
125302
125320
  if (configPath) {
125303
125321
  if (await isUsingExperimentalConfig(projectPath)) try {
125304
125322
  const userConfig = await loadConfigFile(configPath);
125305
- if (userConfig && userConfig.browser && userConfig.browser[browser]) return userConfig.browser[browser];
125323
+ if (userConfig && userConfig.browser) {
125324
+ const browsers = userConfig.browser;
125325
+ if ('chromium-based' === browser) {
125326
+ if (browsers['chromium-based']) return browsers['chromium-based'];
125327
+ if (browsers.chromium) return browsers.chromium;
125328
+ } else if ('gecko-based' === browser) {
125329
+ if (browsers['gecko-based']) return browsers['gecko-based'];
125330
+ if (browsers.firefox) return browsers.firefox;
125331
+ } else {
125332
+ const direct = browsers[browser];
125333
+ if (direct) return direct;
125334
+ }
125335
+ }
125306
125336
  } catch (err) {
125307
125337
  const error = err;
125308
125338
  console.error(webpack_lib_messages.rF(configPath, error));
@@ -125419,19 +125449,6 @@ var __webpack_exports__ = {};
125419
125449
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(error);
125420
125450
  }
125421
125451
  }
125422
- function scrubBrand(txt, brand = 'Extension.js') {
125423
- if (!txt) return txt;
125424
- return txt.replace(/\bRspack\b/gi, brand).replace(/\bWebpack\b/gi, brand).replace(/\bwebpack-dev-server\b/gi, `${brand} dev server`).replace(/\bRspackDevServer\b/gi, `${brand} dev server`).replace(/ModuleBuildError:\s*/g, '').replace(/ModuleParseError:\s*/g, '').replace(/Error:\s*Module\s+build\s+failed.*?\n/gi, '').replace(/\n{3,}/g, '\n\n');
125425
- }
125426
- function makeSanitizedConsole(brand = 'Extension.js') {
125427
- const sanitize = (a)=>'string' == typeof a ? scrubBrand(a, brand) : a;
125428
- return {
125429
- log: (...args)=>console.log(...args.map(sanitize)),
125430
- info: (...args)=>console.info(...args.map(sanitize)),
125431
- warn: (...args)=>console.warn(...args.map(sanitize)),
125432
- error: (...args)=>console.error(...args.map(sanitize))
125433
- };
125434
- }
125435
125452
  function asAbsolute(p) {
125436
125453
  return external_path_.isAbsolute(p) ? p : external_path_.resolve(p);
125437
125454
  }
@@ -125510,6 +125527,52 @@ var __webpack_exports__ = {};
125510
125527
  return 'chrome';
125511
125528
  }
125512
125529
  }
125530
+ function getBuildSummary(browser, info) {
125531
+ const assets = (null == info ? void 0 : info.assets) || [];
125532
+ return {
125533
+ browser,
125534
+ total_assets: assets.length,
125535
+ total_bytes: assets.reduce((n, a)=>n + (a.size || 0), 0),
125536
+ largest_asset_bytes: assets.reduce((m, a)=>Math.max(m, a.size || 0), 0),
125537
+ warnings_count: ((null == info ? void 0 : info.warnings) || []).length,
125538
+ errors_count: ((null == info ? void 0 : info.errors) || []).length
125539
+ };
125540
+ }
125541
+ function scrubBrand(txt, brand = 'Extension.js') {
125542
+ if (!txt) return txt;
125543
+ return txt.replace(/\bRspack\b/gi, brand).replace(/\bWebpack\b/gi, brand).replace(/\bwebpack-dev-server\b/gi, `${brand} dev server`).replace(/\bRspackDevServer\b/gi, `${brand} dev server`).replace(/ModuleBuildError:\s*/g, '').replace(/ModuleParseError:\s*/g, '').replace(/Error:\s*Module\s+build\s+failed.*?\n/gi, '').replace(/\n{3,}/g, '\n\n');
125544
+ }
125545
+ function makeSanitizedConsole(brand = 'Extension.js') {
125546
+ const sanitize = (a)=>'string' == typeof a ? scrubBrand(a, brand) : a;
125547
+ return {
125548
+ log: (...args)=>console.log(...args.map(sanitize)),
125549
+ info: (...args)=>console.info(...args.map(sanitize)),
125550
+ warn: (...args)=>console.warn(...args.map(sanitize)),
125551
+ error: (...args)=>console.error(...args.map(sanitize))
125552
+ };
125553
+ }
125554
+ function handleStatsErrors(stats) {
125555
+ try {
125556
+ const verbose = '1' === String(process.env.EXTENSION_VERBOSE || '').trim();
125557
+ const str = stats.toString({
125558
+ colors: true,
125559
+ all: false,
125560
+ errors: true,
125561
+ warnings: !!verbose
125562
+ });
125563
+ if (str) console.error(scrubBrand(str));
125564
+ } catch {
125565
+ try {
125566
+ const str = stats.toString({
125567
+ colors: true,
125568
+ all: false,
125569
+ errors: true,
125570
+ warnings: true
125571
+ });
125572
+ if (str) console.error(str);
125573
+ } catch {}
125574
+ }
125575
+ }
125513
125576
  function filterKeysForThisBrowser(manifest, browser) {
125514
125577
  const CHROMIUM_BASED_BROWSERS = [
125515
125578
  'chrome',
@@ -125577,20 +125640,84 @@ var __webpack_exports__ = {};
125577
125640
  preferences: nextPreferences
125578
125641
  };
125579
125642
  }
125580
- function computeExtensionsToLoad(baseDir, mode, browser, userExtensionOutputPath) {
125643
+ function computeExtensionsToLoad(baseDir, mode, browser, userExtensionOutputPath, extraExtensionDirs = []) {
125581
125644
  const list = [];
125582
125645
  try {
125583
125646
  const engine = devtoolsEngineFor(browser);
125584
- const devtoolsRoot = external_path_.resolve(baseDir, '../dist/extension-js-devtools');
125585
- const themeRoot = external_path_.resolve(baseDir, '../dist/extension-js-theme');
125647
+ const distRoot = external_path_.resolve(baseDir, 'dist');
125648
+ const devtoolsRoot = external_path_.join(distRoot, 'extension-js-devtools');
125649
+ const themeRoot = external_path_.join(distRoot, 'extension-js-theme');
125586
125650
  const devtoolsForBrowser = external_path_.join(devtoolsRoot, engine);
125587
125651
  const themeForBrowser = external_path_.join(themeRoot, engine);
125588
125652
  if ('production' !== mode && external_fs_.existsSync(devtoolsForBrowser)) list.push(devtoolsForBrowser);
125589
125653
  if (external_fs_.existsSync(themeForBrowser)) list.push(themeForBrowser);
125590
125654
  } catch {}
125655
+ for (const p of extraExtensionDirs)list.push(p);
125591
125656
  list.push(userExtensionOutputPath);
125592
125657
  return list;
125593
125658
  }
125659
+ function isDir(p) {
125660
+ try {
125661
+ return external_fs_.existsSync(p) && external_fs_.statSync(p).isDirectory();
125662
+ } catch {
125663
+ return false;
125664
+ }
125665
+ }
125666
+ function isFile(p) {
125667
+ try {
125668
+ return external_fs_.existsSync(p) && external_fs_.statSync(p).isFile();
125669
+ } catch {
125670
+ return false;
125671
+ }
125672
+ }
125673
+ function toAbs(projectRoot, p) {
125674
+ return external_path_.isAbsolute(p) ? p : external_path_.resolve(projectRoot, p);
125675
+ }
125676
+ function isValidExtensionRoot(dir) {
125677
+ if (!isDir(dir)) return false;
125678
+ return isFile(external_path_.join(dir, 'manifest.json'));
125679
+ }
125680
+ function resolveCompanionExtensionDirs(opts) {
125681
+ const { projectRoot, config } = opts;
125682
+ const explicitPaths = [];
125683
+ let scanDir;
125684
+ if (Array.isArray(config)) explicitPaths.push(...config.filter((p)=>'string' == typeof p));
125685
+ else if (config && 'object' == typeof config) {
125686
+ if (Array.isArray(config.paths)) explicitPaths.push(...config.paths.filter((p)=>'string' == typeof p));
125687
+ if ('string' == typeof config.dir && config.dir.trim().length > 0) scanDir = config.dir.trim();
125688
+ }
125689
+ const found = [];
125690
+ for (const p of explicitPaths){
125691
+ const abs = toAbs(projectRoot, p);
125692
+ if (isValidExtensionRoot(abs)) found.push(abs);
125693
+ }
125694
+ if (scanDir) {
125695
+ const absScan = toAbs(projectRoot, scanDir);
125696
+ if (isDir(absScan)) {
125697
+ let entries = [];
125698
+ try {
125699
+ entries = external_fs_.readdirSync(absScan, {
125700
+ withFileTypes: true
125701
+ });
125702
+ } catch {
125703
+ entries = [];
125704
+ }
125705
+ for (const ent of entries){
125706
+ if (!ent.isDirectory()) continue;
125707
+ if (ent.name.startsWith('.')) continue;
125708
+ const candidate = external_path_.join(absScan, ent.name);
125709
+ if (isValidExtensionRoot(candidate)) found.push(candidate);
125710
+ }
125711
+ }
125712
+ }
125713
+ const unique = [];
125714
+ const seen = new Set();
125715
+ for (const p of found)if (!seen.has(p)) {
125716
+ seen.add(p);
125717
+ unique.push(p);
125718
+ }
125719
+ return unique;
125720
+ }
125594
125721
  const external_case_sensitive_paths_webpack_plugin_namespaceObject = require("case-sensitive-paths-webpack-plugin");
125595
125722
  var external_case_sensitive_paths_webpack_plugin_default = /*#__PURE__*/ __webpack_require__.n(external_case_sensitive_paths_webpack_plugin_namespaceObject);
125596
125723
  var external_pintor_ = __webpack_require__("pintor");
@@ -126039,7 +126166,7 @@ var __webpack_exports__ = {};
126039
126166
  function isUsingSass(projectPath) {
126040
126167
  if ((0, css_lib_integrations.S)(projectPath, 'sass')) {
126041
126168
  if (!sass_userMessageDelivered) {
126042
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('SASS'));
126169
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('SASS')}`);
126043
126170
  sass_userMessageDelivered = true;
126044
126171
  }
126045
126172
  return true;
@@ -126139,7 +126266,7 @@ var __webpack_exports__ = {};
126139
126266
  function isUsingLess(projectPath) {
126140
126267
  if ((0, css_lib_integrations.S)(projectPath, 'less')) {
126141
126268
  if (!less_userMessageDelivered) {
126142
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('LESS'));
126269
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('LESS')}`);
126143
126270
  less_userMessageDelivered = true;
126144
126271
  }
126145
126272
  return true;
@@ -126225,7 +126352,7 @@ var __webpack_exports__ = {};
126225
126352
  const isUsingStylelint = !!configFile;
126226
126353
  if (isUsingStylelint) {
126227
126354
  if (!stylelint_userMessageDelivered) {
126228
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('Stylelint'));
126355
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('Stylelint')}`);
126229
126356
  stylelint_userMessageDelivered = true;
126230
126357
  }
126231
126358
  }
@@ -126240,7 +126367,7 @@ var __webpack_exports__ = {};
126240
126367
  const isUsingTailwind = (0, css_lib_integrations.S)(projectPath, 'tailwindcss') || (0, css_lib_integrations.S)(projectPath, '@tailwindcss/postcss');
126241
126368
  if (isUsingTailwind) {
126242
126369
  if (!tailwind_userMessageDelivered) {
126243
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('Tailwind'));
126370
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('Tailwind')}`);
126244
126371
  tailwind_userMessageDelivered = true;
126245
126372
  }
126246
126373
  }
@@ -126275,21 +126402,21 @@ var __webpack_exports__ = {};
126275
126402
  function isUsingPostCss(projectPath) {
126276
126403
  if ((0, css_lib_integrations.S)(projectPath, 'postcss')) {
126277
126404
  if (!postcss_userMessageDelivered) {
126278
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('PostCSS'));
126405
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('PostCSS')}`);
126279
126406
  postcss_userMessageDelivered = true;
126280
126407
  }
126281
126408
  return true;
126282
126409
  }
126283
126410
  if (findPostCssConfig(projectPath)) {
126284
126411
  if (!postcss_userMessageDelivered) {
126285
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('PostCSS'));
126412
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('PostCSS')}`);
126286
126413
  postcss_userMessageDelivered = true;
126287
126414
  }
126288
126415
  return true;
126289
126416
  }
126290
126417
  if (tailwind_isUsingTailwind(projectPath)) {
126291
126418
  if (!postcss_userMessageDelivered) {
126292
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(isUsingIntegration('PostCSS'));
126419
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${isUsingIntegration('PostCSS')}`);
126293
126420
  postcss_userMessageDelivered = true;
126294
126421
  }
126295
126422
  return true;
@@ -126366,9 +126493,9 @@ var __webpack_exports__ = {};
126366
126493
  };
126367
126494
  if (pluginsFromOptions) postcssOptions.plugins = pluginsFromOptions;
126368
126495
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
126369
- console.log('[extension.js:postcss] projectPath=%s userPostCssConfig=%s pkgHasPostCss=%s tailwindPresent=%s', projectPath, userPostCssConfig || 'none', pkgHasPostCss, tailwindPresent);
126496
+ console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} [extension.js:postcss] projectPath=%s userPostCssConfig=%s pkgHasPostCss=%s tailwindPresent=%s`, projectPath, userPostCssConfig || 'none', pkgHasPostCss, tailwindPresent);
126370
126497
  const resolvedPluginsCount = Array.isArray(postcssOptions.plugins) ? postcssOptions.plugins.length : 0;
126371
- console.log('[extension.js:postcss] resolvedPlugins=%d config=%s cwd=%s', resolvedPluginsCount, String(postcssOptions.config), String(postcssOptions.cwd));
126498
+ console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} [extension.js:postcss] resolvedPlugins=%d config=%s cwd=%s`, resolvedPluginsCount, String(postcssOptions.config), String(postcssOptions.cwd));
126372
126499
  } catch {}
126373
126500
  return {
126374
126501
  test: /\.css$/,
@@ -126794,7 +126921,7 @@ var __webpack_exports__ = {};
126794
126921
  function isUsingPreact(projectPath) {
126795
126922
  if ((0, css_lib_integrations.S)(projectPath, 'preact')) {
126796
126923
  if (!preact_userMessageDelivered) {
126797
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages_isUsingIntegration('Preact'));
126924
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${messages_isUsingIntegration('Preact')}`);
126798
126925
  preact_userMessageDelivered = true;
126799
126926
  }
126800
126927
  return true;
@@ -126846,7 +126973,7 @@ var __webpack_exports__ = {};
126846
126973
  function isUsingReact(projectPath) {
126847
126974
  if ((0, css_lib_integrations.S)(projectPath, 'react')) {
126848
126975
  if (!react_userMessageDelivered) {
126849
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages_isUsingIntegration('React'));
126976
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${messages_isUsingIntegration('React')}`);
126850
126977
  react_userMessageDelivered = true;
126851
126978
  }
126852
126979
  return true;
@@ -126950,7 +127077,7 @@ var __webpack_exports__ = {};
126950
127077
  function isUsingVue(projectPath) {
126951
127078
  const using = (0, css_lib_integrations.S)(projectPath, 'vue');
126952
127079
  if (using && !vue_userMessageDelivered) {
126953
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages_isUsingIntegration('Vue'));
127080
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${messages_isUsingIntegration('Vue')}`);
126954
127081
  vue_userMessageDelivered = true;
126955
127082
  }
126956
127083
  return using;
@@ -127041,9 +127168,11 @@ var __webpack_exports__ = {};
127041
127168
  const hasTsFiles = hasTypeScriptSourceFiles(projectPath);
127042
127169
  if (!hasShownUserMessage) {
127043
127170
  if (TypeScriptAsDevDep || TypeScriptAsDep || hasTsFiles) if (tsConfigFilePath) {
127044
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(messages_isUsingIntegration('TypeScript'));
127045
- } else if (hasTsFiles) console.warn('[Extension.js] TypeScript/TSX files detected but no tsconfig.json found near manifest. Consider adding src/tsconfig.json with { "extends": "../tsconfig.json" }.');
127046
- else {
127171
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA Author says")} ${messages_isUsingIntegration('TypeScript')}`);
127172
+ } else if (hasTsFiles) {
127173
+ const errorMessage = '[Extension.js] Missing tsconfig.json next to package.json. Create one to use TypeScript.';
127174
+ throw new Error(errorMessage);
127175
+ } else {
127047
127176
  console.log(creatingTSConfig());
127048
127177
  writeTsConfig(projectPath);
127049
127178
  }
@@ -127079,12 +127208,10 @@ var __webpack_exports__ = {};
127079
127208
  };
127080
127209
  }
127081
127210
  function getUserTypeScriptConfigFile(projectPath) {
127082
- const local = external_path_.join(projectPath, 'tsconfig.json');
127083
- if (external_fs_.existsSync(local)) return local;
127084
127211
  const pkgDir = typescript_findNearestPackageJsonDirectory(projectPath);
127085
127212
  if (pkgDir) {
127086
- const rootTs = external_path_.join(pkgDir, 'tsconfig.json');
127087
- if (external_fs_.existsSync(rootTs)) return rootTs;
127213
+ const tsconfigPath = external_path_.join(pkgDir, 'tsconfig.json');
127214
+ if (external_fs_.existsSync(tsconfigPath)) return tsconfigPath;
127088
127215
  }
127089
127216
  }
127090
127217
  function writeTsConfig(projectPath) {
@@ -127479,7 +127606,7 @@ var __webpack_exports__ = {};
127479
127606
  if (/^\//.test(unixPath)) return unixPath.replace(/^\//, '');
127480
127607
  return unixPath;
127481
127608
  }
127482
- function background(manifest) {
127609
+ function background_background(manifest) {
127483
127610
  return manifest.background && manifest.background.scripts && {
127484
127611
  background: {
127485
127612
  ...manifest.background,
@@ -127636,7 +127763,7 @@ var __webpack_exports__ = {};
127636
127763
  }
127637
127764
  function manifestV2(manifest) {
127638
127765
  return {
127639
- ...background(manifest),
127766
+ ...background_background(manifest),
127640
127767
  ...browserAction(manifest),
127641
127768
  ...pageAction(manifest),
127642
127769
  ...sidebarAction(manifest),
@@ -127696,7 +127823,7 @@ var __webpack_exports__ = {};
127696
127823
  }
127697
127824
  };
127698
127825
  }
127699
- function hostPermissions(manifest) {
127826
+ function host_permissions_hostPermissions(manifest) {
127700
127827
  return manifest.host_permissions && {
127701
127828
  host_permissions: manifest.host_permissions
127702
127829
  };
@@ -127721,7 +127848,7 @@ var __webpack_exports__ = {};
127721
127848
  ...action_action(manifest),
127722
127849
  ...backgroundServiceWorker(manifest),
127723
127850
  ...declarativeNetRequest(manifest),
127724
- ...hostPermissions(manifest),
127851
+ ...host_permissions_hostPermissions(manifest),
127725
127852
  ...sidePanel(manifest)
127726
127853
  };
127727
127854
  }
@@ -127770,25 +127897,41 @@ var __webpack_exports__ = {};
127770
127897
  }
127771
127898
  };
127772
127899
  }
127773
- function contentScripts(manifest) {
127774
- return manifest.content_scripts && {
127775
- content_scripts: manifest.content_scripts.map((contentObj, index)=>{
127776
- const contentJs = [
127777
- ...new Set(contentObj.js)
127778
- ];
127779
- const contentCss = [
127780
- ...new Set(contentObj.css)
127781
- ];
127782
- return {
127783
- ...contentObj,
127784
- js: [
127785
- ...contentJs.map((js)=>getFilename(`content_scripts/content-${index}.js`, js))
127786
- ],
127787
- css: [
127788
- ...contentCss.map((css)=>getFilename(`content_scripts/content-${index}.css`, css))
127789
- ]
127790
- };
127791
- })
127900
+ function content_scripts_contentScripts(manifest) {
127901
+ if (!manifest.content_scripts) return;
127902
+ const original = manifest.content_scripts;
127903
+ const originalCount = original.length;
127904
+ const result = [];
127905
+ for(let index = 0; index < original.length; index++){
127906
+ const contentObj = original[index] || {};
127907
+ const contentJs = [
127908
+ ...new Set(contentObj.js || [])
127909
+ ];
127910
+ const contentCss = [
127911
+ ...new Set(contentObj.css || [])
127912
+ ];
127913
+ result.push({
127914
+ ...original[index] || {},
127915
+ js: contentJs.map((js)=>getFilename(`content_scripts/content-${index}.js`, js)),
127916
+ css: contentCss.map((css)=>getFilename(`content_scripts/content-${index}.css`, css))
127917
+ });
127918
+ }
127919
+ let bridgeOrdinal = 0;
127920
+ for(let i = 0; i < original.length; i++){
127921
+ const cs = original[i];
127922
+ if (!cs || 'MAIN' !== cs.world) continue;
127923
+ const bridgeIndex = originalCount + bridgeOrdinal++;
127924
+ const { world: _ignoredWorld, js: _ignoredJs, css: _ignoredCss, ...rest } = cs;
127925
+ result.push({
127926
+ ...rest,
127927
+ js: [
127928
+ getFilename(`content_scripts/content-${bridgeIndex}.js`, 'main-world-bridge.js')
127929
+ ],
127930
+ css: []
127931
+ });
127932
+ }
127933
+ return {
127934
+ content_scripts: result
127792
127935
  };
127793
127936
  }
127794
127937
  function devtoolsPage(manifest) {
@@ -127819,7 +127962,7 @@ var __webpack_exports__ = {};
127819
127962
  commands: manifest.commands
127820
127963
  };
127821
127964
  }
127822
- function permissions(manifest) {
127965
+ function permissions_permissions(manifest) {
127823
127966
  return manifest.permissions && {
127824
127967
  permissions: manifest.permissions
127825
127968
  };
@@ -127931,11 +128074,11 @@ var __webpack_exports__ = {};
127931
128074
  return {
127932
128075
  ...backgroundPage(manifest),
127933
128076
  ...chromeUrlOverrides(manifest),
127934
- ...contentScripts(manifest),
128077
+ ...content_scripts_contentScripts(manifest),
127935
128078
  ...devtoolsPage(manifest),
127936
128079
  ...icons_icons(manifest),
127937
128080
  ...commands(manifest),
127938
- ...permissions(manifest),
128081
+ ...permissions_permissions(manifest),
127939
128082
  ...optionsPage(manifest),
127940
128083
  ...optionsUi(manifest),
127941
128084
  ...sandbox(manifest),
@@ -128038,23 +128181,6 @@ var __webpack_exports__ = {};
128038
128181
  const rawSource = new core_namespaceObject.sources.RawSource(source);
128039
128182
  compilation.updateAsset('manifest.json', rawSource);
128040
128183
  });
128041
- if ('production' === compiler.options.mode) compilation.hooks.processAssets.tap('manifest:update-manifest', ()=>{
128042
- if (compilation.errors.length > 0) return;
128043
- const manifest = getManifestContent(compilation, this.manifestPath);
128044
- const overrides = getManifestOverrides(this.manifestPath, manifest);
128045
- const patchedManifest = {
128046
- ...manifest,
128047
- ...JSON.parse(overrides)
128048
- };
128049
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
128050
- const overrideObj = JSON.parse(overrides || '{}');
128051
- const overrideKeys = Object.keys(overrideObj || {}).length;
128052
- console.log(manifestOverridesSummary(overrideKeys, 0));
128053
- } catch {}
128054
- const source = JSON.stringify(patchedManifest, null, 2);
128055
- const rawSource = new core_namespaceObject.sources.RawSource(source);
128056
- compilation.updateAsset('manifest.json', rawSource);
128057
- });
128058
128184
  });
128059
128185
  }
128060
128186
  constructor(options){
@@ -129594,8 +129720,106 @@ var __webpack_exports__ = {};
129594
129720
  });
129595
129721
  return fileAssets;
129596
129722
  }
129597
- function scriptsIncludeSummary(featureCount, devMode, browser) {
129598
- return `Scripts include summary \u{2014} features=${external_pintor_default().gray(String(featureCount))}, dev=${external_pintor_default().gray(String(devMode))}, browser=${external_pintor_default().yellow(browser)}`;
129723
+ function getMainWorldBridgeScripts(manifestPath) {
129724
+ const bridgeScripts = {};
129725
+ try {
129726
+ const raw = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
129727
+ const contentScripts = Array.isArray(null == raw ? void 0 : raw.content_scripts) ? raw.content_scripts : [];
129728
+ const originalCount = contentScripts.length;
129729
+ const bridgeSourceCandidates = [
129730
+ external_path_default().resolve(__dirname, 'main-world-bridge.js'),
129731
+ external_path_default().resolve(__dirname, '../../../../../../main-world-bridge.js')
129732
+ ];
129733
+ const bridgeSource = bridgeSourceCandidates.find((p)=>external_fs_default().existsSync(p)) || bridgeSourceCandidates[0];
129734
+ let bridgeOrdinal = 0;
129735
+ for(let i = 0; i < contentScripts.length; i++){
129736
+ const cs = contentScripts[i];
129737
+ if ((null == cs ? void 0 : cs.world) !== 'MAIN') continue;
129738
+ const bridgeIndex = originalCount + bridgeOrdinal++;
129739
+ bridgeScripts[`content_scripts/content-${bridgeIndex}`] = bridgeSource;
129740
+ }
129741
+ } catch {}
129742
+ return bridgeScripts;
129743
+ }
129744
+ function add_content_script_wrapper_define_property(obj, key, value) {
129745
+ if (key in obj) Object.defineProperty(obj, key, {
129746
+ value: value,
129747
+ enumerable: true,
129748
+ configurable: true,
129749
+ writable: true
129750
+ });
129751
+ else obj[key] = value;
129752
+ return obj;
129753
+ }
129754
+ class AddContentScriptWrapper {
129755
+ static getBridgeScripts(manifestPath) {
129756
+ return getMainWorldBridgeScripts(manifestPath);
129757
+ }
129758
+ apply(compiler) {
129759
+ compiler.options.module.rules.push({
129760
+ test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
129761
+ include: [
129762
+ external_path_.dirname(this.manifestPath)
129763
+ ],
129764
+ exclude: [
129765
+ /([\\/])node_modules\1/
129766
+ ],
129767
+ use: [
129768
+ {
129769
+ loader: external_path_.resolve(__dirname, "content-script-wrapper"),
129770
+ options: {
129771
+ manifestPath: this.manifestPath,
129772
+ mode: compiler.options.mode
129773
+ }
129774
+ }
129775
+ ]
129776
+ });
129777
+ if ('production' !== compiler.options.mode) {
129778
+ compiler.options.module.rules.push({
129779
+ test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
129780
+ include: [
129781
+ external_path_.dirname(this.manifestPath)
129782
+ ],
129783
+ exclude: [
129784
+ /([\\/])node_modules\1/
129785
+ ],
129786
+ use: [
129787
+ {
129788
+ loader: external_path_.resolve(__dirname, 'warn-no-default-export'),
129789
+ options: {
129790
+ manifestPath: this.manifestPath,
129791
+ mode: compiler.options.mode
129792
+ }
129793
+ }
129794
+ ],
129795
+ enforce: 'pre'
129796
+ });
129797
+ compiler.options.module.rules.push({
129798
+ test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
129799
+ include: [
129800
+ external_path_.dirname(this.manifestPath)
129801
+ ],
129802
+ exclude: [
129803
+ /([\\/])node_modules\1/
129804
+ ],
129805
+ use: [
129806
+ {
129807
+ loader: external_path_.resolve(__dirname, 'add-hmr-accept-code'),
129808
+ options: {
129809
+ manifestPath: this.manifestPath,
129810
+ mode: compiler.options.mode
129811
+ }
129812
+ }
129813
+ ]
129814
+ });
129815
+ }
129816
+ }
129817
+ constructor(options){
129818
+ add_content_script_wrapper_define_property(this, "manifestPath", void 0);
129819
+ add_content_script_wrapper_define_property(this, "browser", void 0);
129820
+ this.manifestPath = options.manifestPath;
129821
+ this.browser = options.browser || 'chrome';
129822
+ }
129599
129823
  }
129600
129824
  function scriptsEntriesSummary(entriesAdded, publicTracked) {
129601
129825
  return `Scripts entries \u{2014} added=${external_pintor_default().gray(String(entriesAdded))}, publicTracked=${external_pintor_default().gray(String(publicTracked))}`;
@@ -129621,7 +129845,12 @@ var __webpack_exports__ = {};
129621
129845
  class AddScripts {
129622
129846
  apply(compiler) {
129623
129847
  var _compiler_hooks_thisCompilation, _compiler_hooks, _compiler_hooks_thisCompilation1, _compiler_hooks1;
129624
- const scriptFields = this.includeList || {};
129848
+ const bridgeScripts = AddContentScriptWrapper.getBridgeScripts(this.manifestPath);
129849
+ const mergedIncludeList = {
129850
+ ...this.includeList,
129851
+ ...bridgeScripts
129852
+ };
129853
+ const scriptFields = mergedIncludeList;
129625
129854
  if (null == compiler ? void 0 : null == (_compiler_hooks = compiler.hooks) ? void 0 : null == (_compiler_hooks_thisCompilation = _compiler_hooks.thisCompilation) ? void 0 : _compiler_hooks_thisCompilation.tap) compiler.hooks.thisCompilation.tap("scripts:validate-include-list", (compilation)=>{
129626
129855
  try {
129627
129856
  var _compilation_options_output, _compilation_options, _compiler_rspack;
@@ -129756,42 +129985,886 @@ var __webpack_exports__ = {};
129756
129985
  }
129757
129986
  return new PublicPathRuntimeModule();
129758
129987
  }
129759
- const external_webpack_target_webextension_namespaceObject = require("webpack-target-webextension");
129760
- var external_webpack_target_webextension_default = /*#__PURE__*/ __webpack_require__.n(external_webpack_target_webextension_namespaceObject);
129761
- const external_node_module_namespaceObject = require("node:module");
129762
- function manifest_getManifestContent(compilation, manifestPath) {
129763
- var _compilation_getAsset, _compilation_assets;
129764
- if ((null == (_compilation_getAsset = compilation.getAsset) ? void 0 : _compilation_getAsset.call(compilation, 'manifest.json')) || (null == (_compilation_assets = compilation.assets) ? void 0 : _compilation_assets['manifest.json'])) {
129765
- var _compilation_assets_manifestjson_source, _compilation_assets_manifestjson;
129766
- const source = null == (_compilation_assets_manifestjson = compilation.assets['manifest.json']) ? void 0 : null == (_compilation_assets_manifestjson_source = _compilation_assets_manifestjson.source) ? void 0 : _compilation_assets_manifestjson_source.call(_compilation_assets_manifestjson);
129767
- const manifest = 'function' == typeof source ? source().toString() : String(source || '');
129768
- return JSON.parse(manifest || '{}');
129769
- }
129770
- try {
129771
- const text = external_fs_.readFileSync(manifestPath, 'utf8');
129772
- return JSON.parse(text);
129773
- } catch {
129774
- return require(manifestPath);
129988
+ function TemplateFn(compilation, Template) {
129989
+ return {
129990
+ f: (args, body)=>{
129991
+ if (!compilation) throw new TypeError('No compilation is found.');
129992
+ if (compilation.runtimeTemplate) return compilation.runtimeTemplate.basicFunction(args, body);
129993
+ return compilation.outputOptions.environment.arrowFunction ? `(${args}) => {\n${Template.indent(body)}\n}` : `function(${args}) {\n${Template.indent(body)}\n}`;
129994
+ },
129995
+ retF: (returnValue, args = '')=>{
129996
+ if (!compilation) throw new TypeError('No compilation is found.');
129997
+ if (compilation.runtimeTemplate) return compilation.runtimeTemplate.returningFunction(returnValue, args);
129998
+ return compilation.outputOptions.environment.arrowFunction ? `(${args}) => (${returnValue})` : `function(${args}) { return ${returnValue}; }`;
129999
+ }
130000
+ };
130001
+ }
130002
+ const RuntimeGlobal = '__webpack_require__.webExtRt';
130003
+ const RuntimeGlobalIsBrowser = '__webpack_require__.webExtRtModern';
130004
+ function BrowserRuntimeModule(webpack, acceptWeak) {
130005
+ const { RuntimeModule, Template } = webpack;
130006
+ class BrowserRuntime extends RuntimeModule {
130007
+ generate() {
130008
+ const { compilation } = this;
130009
+ if (!compilation) return Template.asString('/* [webpack-target-webextension] BrowserRuntimeModule skipped because no compilation is found. */');
130010
+ const optionalChaining = compilation.outputOptions.environment.optionalChaining;
130011
+ const _let = compilation.outputOptions.environment.const ? 'let' : 'var';
130012
+ return Template.asString([
130013
+ `${_let} isChrome, runtime;`,
130014
+ 'try {',
130015
+ Template.indent([
130016
+ `if (typeof browser !== "undefined" && ${optionalChaining ? 'typeof browser.runtime?.getURL === "function"' : 'typeof browser.runtime === "object" && typeof browser.runtime.getURL === "function"'}) {`,
130017
+ Template.indent([
130018
+ 'runtime = browser;'
130019
+ ]),
130020
+ '}'
130021
+ ]),
130022
+ '} catch (_) {}',
130023
+ 'if (!runtime) {',
130024
+ Template.indent([
130025
+ 'try {',
130026
+ Template.indent([
130027
+ `if (typeof chrome !== "undefined" && ${optionalChaining ? 'typeof chrome.runtime?.getURL === "function"' : 'typeof chrome.runtime === "object" && typeof chrome.runtime.getURL === "function"'}) {`,
130028
+ Template.indent([
130029
+ 'isChrome = true;',
130030
+ 'runtime = chrome;'
130031
+ ]),
130032
+ '}'
130033
+ ]),
130034
+ '} catch (_) {}'
130035
+ ]),
130036
+ '}',
130037
+ `${RuntimeGlobalIsBrowser} = !isChrome;`,
130038
+ `${RuntimeGlobal} = runtime || { runtime: null };`,
130039
+ acceptWeak ? 'if (!runtime && (typeof self !== "object" || !self.addEventListener)) {' : '',
130040
+ acceptWeak ? Template.indent([
130041
+ `${RuntimeGlobal} = { runtime: { getURL: String } };`
130042
+ ]) : '',
130043
+ acceptWeak ? '}' : ''
130044
+ ].filter(Boolean));
130045
+ }
130046
+ constructor(){
130047
+ super('WebExtensionBrowserRuntime', RuntimeModule.STAGE_NORMAL);
130048
+ }
129775
130049
  }
130050
+ return new BrowserRuntime();
129776
130051
  }
129777
- function scripts_lib_manifest_filterKeysForThisBrowser(manifest, browser) {
129778
- const CHROMIUM_BASED_BROWSERS = [
129779
- 'chrome',
129780
- 'edge'
129781
- ];
129782
- const GECKO_BASED_BROWSERS = [
129783
- 'firefox'
129784
- ];
129785
- const isChromiumTarget = CHROMIUM_BASED_BROWSERS.includes(browser) || String(browser).includes('chromium');
129786
- const isGeckoTarget = GECKO_BASED_BROWSERS.includes(browser) || String(browser).includes('gecko');
129787
- const chromiumPrefixes = new Set([
129788
- 'chromium',
129789
- 'chrome',
129790
- 'edge'
129791
- ]);
129792
- const geckoPrefixes = new Set([
129793
- 'gecko',
129794
- 'firefox'
130052
+ function LoadScript_define_property(obj, key, value) {
130053
+ if (key in obj) Object.defineProperty(obj, key, {
130054
+ value: value,
130055
+ enumerable: true,
130056
+ configurable: true,
130057
+ writable: true
130058
+ });
130059
+ else obj[key] = value;
130060
+ return obj;
130061
+ }
130062
+ const DYNAMIC_IMPORT_LOADER = 'dynamicImportLoader';
130063
+ const DOM_LOADER = "scriptLoader";
130064
+ const WORKER_LOADER = 'workerLoader';
130065
+ const CLASSIC_LOADER = 'classicLoader';
130066
+ const FALLBACK_LOADER = 'fallbackLoader';
130067
+ function LoadScriptRuntimeModule(webpack, supportDynamicImport, classicLoaderEnabled, contentScriptsMeta) {
130068
+ const { Template, RuntimeGlobals, RuntimeModule } = webpack;
130069
+ class LoadScriptRuntime extends RuntimeModule {
130070
+ generate() {
130071
+ const { compilation } = this;
130072
+ if (!compilation) return Template.asString('/* [webpack-target-webextension] ChunkLoaderFallbackRuntimeModule skipped because no compilation is found. */');
130073
+ const { f } = TemplateFn(compilation, Template);
130074
+ const _const = compilation.outputOptions.environment.const ? 'const' : 'var';
130075
+ const _let = compilation.outputOptions.environment.const ? 'let' : 'var';
130076
+ const chunkName = (this.chunk && this.chunk.name ? this.chunk.name : '') || (compilation && compilation.chunk && compilation.chunk.name ? compilation.chunk.name : '');
130077
+ const bundleId = chunkName ? `${chunkName}.js` : '';
130078
+ const world = bundleId && this.contentScriptsMeta[bundleId] ? this.contentScriptsMeta[bundleId].world : void 0;
130079
+ const isMainWorld = 'main' === world;
130080
+ const HasExtensionRuntime = `${_const} hasExtensionRuntime = (function(){ try {return ((typeof browser === "object" && browser && browser.runtime && typeof browser.runtime.sendMessage === "function") || (typeof chrome === "object" && chrome && chrome.runtime && typeof chrome.runtime.sendMessage === "function"));} catch (e) { return false; } })();`;
130081
+ const DynamicImportLoader = `${_const} ${DYNAMIC_IMPORT_LOADER} = ` + f('url, done, key, chunkId', `import(url).then(${f('', [
130082
+ 'if (isNotIframe) return done();',
130083
+ 'try {',
130084
+ Template.indent([
130085
+ "// It's a Chrome bug, if the import() is called in a sandboxed iframe, it _fails_ the script loading but _resolve_ the Promise.",
130086
+ `// we call ${RuntimeGlobals.ensureChunkHandlers}.j(chunkId) to check if it is loaded.`,
130087
+ '// if it is, this is a no-op. if it is not, it will throw a TypeError because this function requires 2 parameters.',
130088
+ '// This call will not trigger the chunk loading because it is already loading.',
130089
+ '// see https://github.com/awesome-webextension/webpack-target-webextension/issues/41',
130090
+ `chunkId !== undefined && ${RuntimeGlobals.ensureChunkHandlers}.j(chunkId);`,
130091
+ 'done();'
130092
+ ]),
130093
+ '}',
130094
+ 'catch (_) {',
130095
+ Template.indent([
130096
+ 'if (!bug816121warned) {',
130097
+ Template.indent([
130098
+ 'console.warn("Chrome bug https://crbug.com/816121 hit.");',
130099
+ 'bug816121warned = true;'
130100
+ ]),
130101
+ '}',
130102
+ `return ${FALLBACK_LOADER}(url, done, key, chunkId);`
130103
+ ]),
130104
+ '}'
130105
+ ])}, ${f('e', [
130106
+ 'console.warn("Dynamic import loader failed. Using fallback loader (see https://github.com/awesome-webextension/webpack-target-webextension#content-script).", e);',
130107
+ `${FALLBACK_LOADER}(url, done, key, chunkId);`
130108
+ ])});`);
130109
+ const DOMLoader = `${_const} ${DOM_LOADER} = ` + f('url, done', [
130110
+ `${_const} script = document.createElement('script');`,
130111
+ "script.src = url;",
130112
+ "script.onload = done;",
130113
+ "script.onerror = done;",
130114
+ "document.body.appendChild(script);"
130115
+ ]);
130116
+ const WorkerLoader = `${_const} ${WORKER_LOADER} = ` + f('url, done', [
130117
+ 'try {',
130118
+ Template.indent([
130119
+ 'importScripts(url);',
130120
+ 'done();'
130121
+ ]),
130122
+ '} catch (e) {',
130123
+ Template.indent([
130124
+ 'done(e);'
130125
+ ]),
130126
+ '}'
130127
+ ]);
130128
+ const ClassicLoader = `${_const} ${CLASSIC_LOADER} = ` + f('url, done', Template.asString([
130129
+ `${_const} msg = { type: "WTW_INJECT", file: url };`,
130130
+ `${_const} onError = ${f('e', 'done(Object.assign(e, { type: "missing" }))')};`,
130131
+ `if (${RuntimeGlobalIsBrowser}) {`,
130132
+ Template.indent([
130133
+ `${RuntimeGlobal}.runtime.sendMessage(msg).then(done, onError);`
130134
+ ]),
130135
+ '} else {',
130136
+ Template.indent([
130137
+ `${RuntimeGlobal}.runtime.sendMessage(msg, ${f('', [
130138
+ `${_const} error = ${RuntimeGlobal}.runtime.lastError;`,
130139
+ 'if (error) onError(error);',
130140
+ 'else done();'
130141
+ ])});`
130142
+ ]),
130143
+ '}'
130144
+ ])) + ';';
130145
+ const ClassicLoaderDisabled = `${_const} ${CLASSIC_LOADER} = ` + f('', [
130146
+ `throw new Error("[webpack-target-webextension] Failed to load async chunk in the content script. No script loader is found. You can either\\n - Set output.environment.dynamicImport to true if your environment supports native ES Module\\n - Specify the background entry to enable the fallback loader\\n - Set module.parser.javascript.dynamicImportMode to 'eager' to inline all async chunks.");`
130147
+ ]);
130148
+ return Template.asString([
130149
+ this.supportDynamicImport ? `${_let} bug816121warned, isNotIframe;` : '',
130150
+ this.supportDynamicImport ? Template.asString([
130151
+ 'try {',
130152
+ Template.indent([
130153
+ 'isNotIframe = typeof window === "object" ? window.top === window : true;'
130154
+ ]),
130155
+ '} catch(e) {',
130156
+ Template.indent([
130157
+ 'isNotIframe = false /* CORS error */;'
130158
+ ]),
130159
+ '}'
130160
+ ]) : '',
130161
+ HasExtensionRuntime,
130162
+ this.classicLoaderEnabled ? ClassicLoader : ClassicLoaderDisabled,
130163
+ this.supportDynamicImport ? DynamicImportLoader : '',
130164
+ DOMLoader,
130165
+ WorkerLoader,
130166
+ `${_const} isWorker = typeof importScripts === 'function'`,
130167
+ "if (typeof location === 'object' && location.protocol.includes('-extension:')) {",
130168
+ Template.indent([
130169
+ `${RuntimeGlobals.loadScript} = isWorker ? ${WORKER_LOADER} : ${DOM_LOADER};`
130170
+ ]),
130171
+ "}",
130172
+ isMainWorld ? Template.asString([
130173
+ `${_const} __extjsMark = "__extjs__";`,
130174
+ `${_const} __extjsReqType = "EXTJS_WTW_LOAD";`,
130175
+ `${_const} __extjsResType = "EXTJS_WTW_LOADED";`,
130176
+ `${_const} ${CLASSIC_LOADER} = ` + f('url, done', [
130177
+ `${_const} requestId = String(Date.now()) + "-" + Math.random().toString(16).slice(2);`,
130178
+ `${_const} onMessage = ${f('event', [
130179
+ 'try {',
130180
+ Template.indent([
130181
+ 'if (!event || event.source !== window) return;',
130182
+ `${_const} data = event.data || null;`,
130183
+ "if (!data || data[__extjsMark] !== true) return;",
130184
+ "if (data.type !== __extjsResType || data.requestId !== requestId) return;",
130185
+ 'window.removeEventListener("message", onMessage);',
130186
+ 'if (data.ok) done();',
130187
+ 'else done(Object.assign(new Error(data.error || "Bridge failed"), { type: "missing" }));'
130188
+ ]),
130189
+ '} catch (e) {',
130190
+ Template.indent([
130191
+ 'window.removeEventListener("message", onMessage);',
130192
+ 'done(Object.assign(e, { type: "missing" }));'
130193
+ ]),
130194
+ '}'
130195
+ ])};`,
130196
+ 'window.addEventListener("message", onMessage);',
130197
+ 'try {',
130198
+ Template.indent([
130199
+ 'window.postMessage({ [__extjsMark]: true, type: __extjsReqType, requestId: requestId, url: url }, "*");'
130200
+ ]),
130201
+ '} catch (e) {',
130202
+ Template.indent([
130203
+ 'window.removeEventListener("message", onMessage);',
130204
+ 'done(Object.assign(e, { type: "missing" }));'
130205
+ ]),
130206
+ '}',
130207
+ 'setTimeout(function(){ try { window.removeEventListener("message", onMessage); } catch(_){} done(Object.assign(new Error("Bridge timeout"), { type: "missing" })); }, 5000);'
130208
+ ]) + ';',
130209
+ `else if (!isWorker) ${RuntimeGlobals.loadScript} = ${CLASSIC_LOADER};`
130210
+ ]) : Template.asString([
130211
+ `else if (!isWorker && hasExtensionRuntime) ${RuntimeGlobals.loadScript} = ${CLASSIC_LOADER};`,
130212
+ `else if (!isWorker) ${RuntimeGlobals.loadScript} = ${DOM_LOADER};`
130213
+ ]),
130214
+ "else { throw new TypeError('Unable to determinate the chunk loader: content script + Worker'); }",
130215
+ this.supportDynamicImport ? `${_const} ${FALLBACK_LOADER} = ${RuntimeGlobals.loadScript};` : '',
130216
+ this.supportDynamicImport ? `${RuntimeGlobals.loadScript} = ${DYNAMIC_IMPORT_LOADER};` : ''
130217
+ ].filter(Boolean));
130218
+ }
130219
+ constructor(){
130220
+ super("load script", RuntimeModule.STAGE_BASIC), LoadScript_define_property(this, "supportDynamicImport", void 0), LoadScript_define_property(this, "classicLoaderEnabled", void 0), LoadScript_define_property(this, "contentScriptsMeta", void 0);
130221
+ this.supportDynamicImport = Boolean(supportDynamicImport);
130222
+ this.classicLoaderEnabled = Boolean(classicLoaderEnabled);
130223
+ this.contentScriptsMeta = contentScriptsMeta || {};
130224
+ }
130225
+ }
130226
+ return new LoadScriptRuntime();
130227
+ }
130228
+ function PublicPath_PublicPathRuntimeModule(webpack) {
130229
+ const { RuntimeGlobals, RuntimeModule, Template } = webpack;
130230
+ class PublicPathRuntime extends RuntimeModule {
130231
+ generate() {
130232
+ const { compilation } = this;
130233
+ if (!compilation) return Template.asString('/* [webpack-target-webextension] PublicPathRuntimeModule skipped because no compilation is found. */');
130234
+ const { publicPath } = compilation.outputOptions;
130235
+ const path = JSON.stringify(compilation.getPath(publicPath || '', {
130236
+ hash: compilation.hash || 'XXXX'
130237
+ }));
130238
+ return Template.asString([
130239
+ `if (${RuntimeGlobal} && ${RuntimeGlobal}.runtime && typeof ${RuntimeGlobal}.runtime.getURL === "function") {`,
130240
+ Template.indent([
130241
+ `${RuntimeGlobals.publicPath} = ${RuntimeGlobal}.runtime.getURL(${path});`
130242
+ ]),
130243
+ "} else {",
130244
+ Template.indent([
130245
+ `${RuntimeGlobals.publicPath} = "";`
130246
+ ]),
130247
+ "}"
130248
+ ]);
130249
+ }
130250
+ constructor(){
130251
+ super('publicPath', RuntimeModule.STAGE_BASIC);
130252
+ }
130253
+ }
130254
+ return new PublicPathRuntime();
130255
+ }
130256
+ function AutoPublicPathRuntimeModule(webpack) {
130257
+ const { RuntimeModule, RuntimeGlobals, Template, javascript: { JavascriptModulesPlugin }, HotUpdateChunk } = webpack;
130258
+ const getChunkFilenameTemplate = JavascriptModulesPlugin.getChunkFilenameTemplate || function(chunk, outputOptions) {
130259
+ if (chunk.filenameTemplate) return chunk.filenameTemplate;
130260
+ if ('function' == typeof HotUpdateChunk && chunk instanceof HotUpdateChunk) return outputOptions.hotUpdateChunkFilename;
130261
+ if (chunk.canBeInitial()) return outputOptions.filename;
130262
+ return outputOptions.chunkFilename;
130263
+ };
130264
+ class AutoPublicPathRuntime extends RuntimeModule {
130265
+ generate() {
130266
+ const { compilation } = this;
130267
+ if (!compilation || !this.chunk) return Template.asString('/* [webpack-target-webextension] AutoPublicPathRuntimeModule skipped because no compilation/chunk is found. */');
130268
+ const { scriptType, importMetaName } = compilation.outputOptions;
130269
+ const chunkName = compilation.getPath(getChunkFilenameTemplate(this.chunk, compilation.outputOptions), {
130270
+ chunk: this.chunk,
130271
+ contentHashType: "javascript"
130272
+ });
130273
+ const outputPath = compilation.outputOptions.path;
130274
+ if (!outputPath) return Template.asString('/* [webpack-target-webextension] AutoPublicPathRuntimeModule skipped because no output path is found. */');
130275
+ const undoPath = getUndoPath(chunkName, outputPath, false);
130276
+ const optionalChaining = compilation.outputOptions.environment.optionalChaining;
130277
+ const _const = compilation.outputOptions.environment.const ? 'const' : 'var';
130278
+ const _let = compilation.outputOptions.environment.const ? 'let' : 'var';
130279
+ return Template.asString([
130280
+ `${_let} scriptUrl;`,
130281
+ 'module' === scriptType ? `if (typeof ${importMetaName}.url === "string") scriptUrl = ${importMetaName}.url;` : Template.asString([
130282
+ `if (${RuntimeGlobals.global}.importScripts) scriptUrl = ${RuntimeGlobals.global}.location + "";`,
130283
+ `${_const} document = ${RuntimeGlobals.global}.document;`,
130284
+ `if (!scriptUrl && ${optionalChaining ? 'document?.currentScript' : 'document && document.currentScript'}) {`,
130285
+ Template.indent("scriptUrl = document.currentScript.src;"),
130286
+ '}'
130287
+ ]),
130288
+ '// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration',
130289
+ '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.',
130290
+ "if (!scriptUrl) {",
130291
+ Template.indent([
130292
+ `if (${RuntimeGlobal} && ${RuntimeGlobal}.runtime && typeof ${RuntimeGlobal}.runtime.getURL === "function") {`,
130293
+ Template.indent(`scriptUrl = ${RuntimeGlobal}.runtime.getURL("/");`),
130294
+ "} else {",
130295
+ Template.indent('scriptUrl = "";'),
130296
+ "}"
130297
+ ]),
130298
+ '}',
130299
+ 'scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\\?.*$/, "").replace(/\\/[^\\/]+$/, "/");',
130300
+ undoPath ? `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify(undoPath)};` : `${RuntimeGlobals.publicPath} = scriptUrl;`
130301
+ ]);
130302
+ }
130303
+ constructor(){
130304
+ super('publicPath', RuntimeModule.STAGE_BASIC);
130305
+ }
130306
+ }
130307
+ return new AutoPublicPathRuntime();
130308
+ }
130309
+ function getUndoPath(filename, outputPath, enforceRelative) {
130310
+ let depth = -1;
130311
+ let append = '';
130312
+ outputPath = outputPath.replace(/[\\/]$/, '');
130313
+ for (const part of filename.split(/[/\\]+/))if ('..' === part) if (depth > -1) depth--;
130314
+ else {
130315
+ const i = outputPath.lastIndexOf('/');
130316
+ const j = outputPath.lastIndexOf('\\');
130317
+ const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
130318
+ if (pos < 0) return outputPath + '/';
130319
+ append = outputPath.slice(pos + 1) + '/' + append;
130320
+ outputPath = outputPath.slice(0, pos);
130321
+ }
130322
+ else if ('.' !== part) depth++;
130323
+ return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
130324
+ }
130325
+ function ChunkLoaderFallbackRuntimeModule(webpack) {
130326
+ const { RuntimeModule, Template } = webpack;
130327
+ class ChunkLoaderFallbackRuntime extends RuntimeModule {
130328
+ generate() {
130329
+ const { compilation } = this;
130330
+ if (!compilation) return Template.asString('/* [webpack-target-webextension] ChunkLoaderFallbackRuntimeModule skipped because no compilation is found. */');
130331
+ const { f } = TemplateFn(compilation, Template);
130332
+ const optionalChain = compilation.outputOptions.environment.optionalChaining;
130333
+ const _const = compilation.outputOptions.environment.const ? 'const' : 'var';
130334
+ const _let = compilation.outputOptions.environment.const ? 'let' : 'var';
130335
+ return `${RuntimeGlobal}.runtime.onMessage.addListener(` + f('message, sender, sendResponse', [
130336
+ optionalChain ? 'if (message?.type != "WTW_INJECT" || typeof sender?.tab?.id != "number") return;' : 'if (!message || message.type != "WTW_INJECT" || !sender || !sender.tab || sender.tab.id == null) return;',
130337
+ `${_let} file = message.file;`,
130338
+ 'try {',
130339
+ Template.indent([
130340
+ 'file = new URL(file).pathname;'
130341
+ ]),
130342
+ '} catch (_) {}',
130343
+ 'if (!file) return;',
130344
+ `if (${RuntimeGlobal}.scripting) {`,
130345
+ Template.indent([
130346
+ `${RuntimeGlobal}.scripting.executeScript({`,
130347
+ Template.indent([
130348
+ 'target: { tabId: sender.tab.id, frameIds: [sender.frameId] },',
130349
+ 'files: [file],'
130350
+ ]),
130351
+ '}).then(sendResponse);'
130352
+ ]),
130353
+ "} else {",
130354
+ Template.indent([
130355
+ `${_const} details = { frameId: sender.frameId, file, matchAboutBlank: true };`,
130356
+ `if (${RuntimeGlobalIsBrowser}) {`,
130357
+ `${RuntimeGlobal}.tabs.executeScript(sender.tab.id, details).then(sendResponse);`,
130358
+ '} else {',
130359
+ `${RuntimeGlobal}.tabs.executeScript(sender.tab.id, details, sendResponse);`,
130360
+ '}'
130361
+ ]),
130362
+ '}',
130363
+ 'return true;'
130364
+ ]) + ');';
130365
+ }
130366
+ constructor(){
130367
+ super('chunk loader fallback', RuntimeModule.STAGE_TRIGGER);
130368
+ }
130369
+ }
130370
+ return new ChunkLoaderFallbackRuntime();
130371
+ }
130372
+ function ChunkLoader_define_property(obj, key, value) {
130373
+ if (key in obj) Object.defineProperty(obj, key, {
130374
+ value: value,
130375
+ enumerable: true,
130376
+ configurable: true,
130377
+ writable: true
130378
+ });
130379
+ else obj[key] = value;
130380
+ return obj;
130381
+ }
130382
+ class WebExtensionChuckLoaderRuntimePlugin {
130383
+ apply(compiler) {
130384
+ if ('rspack' in compiler) {
130385
+ const { output } = compiler.options;
130386
+ if (void 0 === output.publicPath || 'auto' === output.publicPath) {
130387
+ output.publicPath = '';
130388
+ this.rspackAutoPublicPath = true;
130389
+ }
130390
+ }
130391
+ compiler.hooks.compilation.tap(WebExtensionChuckLoaderRuntimePlugin.name, (compilation)=>{
130392
+ this.tap(compiler, compilation);
130393
+ });
130394
+ }
130395
+ tap(compiler, compilation) {
130396
+ const { RuntimeGlobals } = compiler.webpack;
130397
+ const { options } = this;
130398
+ compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.loadScript).tap(WebExtensionChuckLoaderRuntimePlugin.name, (_chunk, set)=>{
130399
+ set.add(RuntimeGlobal);
130400
+ compilation.addRuntimeModule(_chunk, LoadScriptRuntimeModule(compiler.webpack, false !== compilation.outputOptions.environment.dynamicImport, false !== options.classicLoader, this.contentScriptsMeta));
130401
+ return true;
130402
+ });
130403
+ compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.publicPath).tap(WebExtensionChuckLoaderRuntimePlugin.name, (chunk, set)=>{
130404
+ const { outputOptions } = compilation;
130405
+ const { publicPath, scriptType } = outputOptions;
130406
+ if ('auto' === publicPath || '' === publicPath && this.rspackAutoPublicPath) {
130407
+ const module = AutoPublicPathRuntimeModule(compiler.webpack);
130408
+ set.add(RuntimeGlobal);
130409
+ if ('module' !== scriptType) set.add(RuntimeGlobals.global);
130410
+ compilation.addRuntimeModule(chunk, module);
130411
+ } else {
130412
+ set.add(RuntimeGlobal);
130413
+ const module = PublicPath_PublicPathRuntimeModule(compiler.webpack);
130414
+ if ('string' != typeof publicPath || /\[(full)?hash\]/.test(publicPath)) module.fullHash = true;
130415
+ compilation.addRuntimeModule(chunk, module);
130416
+ }
130417
+ return true;
130418
+ });
130419
+ if (false !== options.classicLoader) compilation.hooks.afterOptimizeModules.tap(WebExtensionChuckLoaderRuntimePlugin.name, ()=>{
130420
+ const { pageEntry, serviceWorkerEntry } = options;
130421
+ const entryPoint1 = pageEntry && compilation.entrypoints.get(pageEntry);
130422
+ const entryPoint2 = serviceWorkerEntry && compilation.entrypoints.get(serviceWorkerEntry);
130423
+ if (entryPoint1) compilation.addRuntimeModule(entryPoint1.chunks[0], ChunkLoaderFallbackRuntimeModule(compiler.webpack));
130424
+ if (entryPoint2) compilation.addRuntimeModule(entryPoint2.chunks[0], ChunkLoaderFallbackRuntimeModule(compiler.webpack));
130425
+ });
130426
+ }
130427
+ constructor(options){
130428
+ ChunkLoader_define_property(this, "pluginOptions", void 0);
130429
+ ChunkLoader_define_property(this, "options", void 0);
130430
+ ChunkLoader_define_property(this, "contentScriptsMeta", void 0);
130431
+ ChunkLoader_define_property(this, "rspackAutoPublicPath", false);
130432
+ this.pluginOptions = options || {};
130433
+ this.options = this.pluginOptions.background || this.pluginOptions || {};
130434
+ this.contentScriptsMeta = this.pluginOptions.contentScriptsMeta || {};
130435
+ }
130436
+ }
130437
+ class NoDangerNamePlugin {
130438
+ apply(compiler) {
130439
+ const { Compilation, WebpackError } = compiler.webpack;
130440
+ compiler.hooks.thisCompilation.tap(NoDangerNamePlugin.name, (compilation)=>{
130441
+ compilation.hooks.processAssets.tap({
130442
+ name: NoDangerNamePlugin.name,
130443
+ stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
130444
+ }, (assets)=>{
130445
+ for (const name of Object.keys(assets || {})){
130446
+ if (!name.startsWith('_')) continue;
130447
+ const e = new WebpackError(`[webpack-extension-target] Output file name ${JSON.stringify(name)} starts with "_" which is prohibited.`);
130448
+ e.stack = '';
130449
+ compilation.errors.push(e);
130450
+ }
130451
+ });
130452
+ });
130453
+ }
130454
+ }
130455
+ function EagerlyLoadChunks_define_property(obj, key, value) {
130456
+ if (key in obj) Object.defineProperty(obj, key, {
130457
+ value: value,
130458
+ enumerable: true,
130459
+ configurable: true,
130460
+ writable: true
130461
+ });
130462
+ else obj[key] = value;
130463
+ return obj;
130464
+ }
130465
+ function createEagerlyLoadChunksRuntimeModule(webpack) {
130466
+ const { RuntimeGlobals, RuntimeModule, Template } = webpack;
130467
+ return class extends RuntimeModule {
130468
+ generate() {
130469
+ const { compilation } = this;
130470
+ if (!compilation) return Template.asString('/* [webpack-target-webextension] EagerlyLoadChunksRuntimeModule skipped because no compilation is found. */');
130471
+ const _const = compilation.outputOptions.environment.const ? 'const' : 'var';
130472
+ return Template.asString([
130473
+ `${_const} __extjsChunkIds = ${JSON.stringify(this.chunkIds)};`,
130474
+ `${_const} __extjsLoad = ${RuntimeGlobals.ensureChunkHandlers};`,
130475
+ `for (${_const} __extjsId of __extjsChunkIds) __extjsLoad(__extjsId);`
130476
+ ]);
130477
+ }
130478
+ constructor(chunkIds){
130479
+ super('eagerly load chunks', RuntimeModule.STAGE_NORMAL), EagerlyLoadChunks_define_property(this, "chunkIds", void 0);
130480
+ this.chunkIds = chunkIds;
130481
+ }
130482
+ };
130483
+ }
130484
+ function ServiceWorkerPlugin_define_property(obj, key, value) {
130485
+ if (key in obj) Object.defineProperty(obj, key, {
130486
+ value: value,
130487
+ enumerable: true,
130488
+ configurable: true,
130489
+ writable: true
130490
+ });
130491
+ else obj[key] = value;
130492
+ return obj;
130493
+ }
130494
+ class WebExtensionServiceWorkerEntryPlugin {
130495
+ apply(compiler) {
130496
+ const { javascript, sources } = compiler.webpack;
130497
+ const entry = this.options.serviceWorkerEntry;
130498
+ if (void 0 === entry) return;
130499
+ if (!(compiler.options.output.module || compiler.options.experiments.outputModule)) {
130500
+ const hook = compiler.hooks.entryOption;
130501
+ hook.tap(WebExtensionServiceWorkerEntryPlugin.name, (_context, entries)=>{
130502
+ if ('function' == typeof entries) {
130503
+ if (this.options.noDynamicEntryWarning) return;
130504
+ console.warn(`[webpack-extension-target] Dynamic entry points not supported yet.
130505
+ You must manually set the chuck loading of entry point ${entry} to "import-scripts".
130506
+
130507
+ See https://webpack.js.org/configuration/entry-context/#entry-descriptor
130508
+
130509
+ Set background.noDynamicEntryWarning to true to disable this warning.
130510
+ `);
130511
+ }
130512
+ const selectedEntry = null == entries ? void 0 : entries[entry];
130513
+ if (!selectedEntry) throw new Error(`[webpack-extension-target] There is no entry called ${entry}.`);
130514
+ selectedEntry.chunkLoading = "import-scripts";
130515
+ });
130516
+ }
130517
+ if (false !== this.options.eagerChunkLoading) compiler.hooks.compilation.tap(WebExtensionServiceWorkerEntryPlugin.name, (compilation)=>{
130518
+ var _compilation_hooks_afterOptimizeChunkIds;
130519
+ null == (_compilation_hooks_afterOptimizeChunkIds = compilation.hooks.afterOptimizeChunkIds) || _compilation_hooks_afterOptimizeChunkIds.tap(WebExtensionServiceWorkerEntryPlugin.name, ()=>{
130520
+ const entryPoint = compilation.entrypoints.get(entry);
130521
+ if (!entryPoint) return;
130522
+ const entryChunk = entryPoint.getEntrypointChunk();
130523
+ const reachableChunks = getReachableChunks(entryPoint, new Set(entryPoint.chunks));
130524
+ const reachableChunkIds = new Set([
130525
+ ...reachableChunks
130526
+ ].map((x)=>x.id));
130527
+ for (const id of getInitialChunkIds(entryChunk, compilation.chunkGraph, chunkHasJs))reachableChunkIds.delete(id);
130528
+ if (reachableChunkIds.size) {
130529
+ const EagerlyLoadChunksRuntimeModule = createEagerlyLoadChunksRuntimeModule(compiler.webpack);
130530
+ compilation.hooks.additionalTreeRuntimeRequirements.tap(EagerlyLoadChunksRuntimeModule.name, (chunk, set)=>{
130531
+ if (chunk.id !== entryChunk.id) return;
130532
+ set.add(compiler.webpack.RuntimeGlobals.ensureChunkHandlers);
130533
+ compilation.addRuntimeModule(entryChunk, new EagerlyLoadChunksRuntimeModule([
130534
+ ...reachableChunkIds
130535
+ ]));
130536
+ });
130537
+ }
130538
+ });
130539
+ });
130540
+ if (false !== this.options.tryCatchWrapper && 'module' !== compiler.options.output.chunkFormat && !this.backgroundOutputEmitted) compiler.hooks.compilation.tap(WebExtensionServiceWorkerEntryPlugin.name, (compilation)=>{
130541
+ const hooks = javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
130542
+ if (hooks.renderContent) hooks.renderContent.tap(WebExtensionServiceWorkerEntryPlugin.name, (source, context)=>{
130543
+ const entryPoint = compilation.entrypoints.get(entry);
130544
+ const entryChunk = null == entryPoint ? void 0 : entryPoint.getEntrypointChunk();
130545
+ if (entryChunk !== context.chunk) return source;
130546
+ return new sources.ConcatSource('/******/ try { // If the initial code of the serviceWorkerEntry throws, the console cannot be opened.\n', source, '\n/******/ } catch (e) {\n/******/ \tPromise.reject(e);\n/******/ }');
130547
+ });
130548
+ });
130549
+ }
130550
+ constructor(options, backgroundOutputEmitted){
130551
+ ServiceWorkerPlugin_define_property(this, "options", void 0);
130552
+ ServiceWorkerPlugin_define_property(this, "backgroundOutputEmitted", void 0);
130553
+ this.options = options;
130554
+ this.backgroundOutputEmitted = backgroundOutputEmitted;
130555
+ }
130556
+ }
130557
+ function getInitialChunkIds(chunk, chunkGraph, filterFn) {
130558
+ const initialChunkIds = new Set(chunk.ids);
130559
+ for (const c of chunk.getAllInitialChunks())if (!(c === chunk || filterFn(c, chunkGraph)) && c.ids) for (const id of c.ids)initialChunkIds.add(id);
130560
+ return initialChunkIds;
130561
+ }
130562
+ function chunkHasJs(chunk, chunkGraph) {
130563
+ if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return true;
130564
+ return !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "javascript");
130565
+ }
130566
+ function getReachableChunks(chunkGroup, reachableChunks = new Set(), visitedChunkGroups = new Set()) {
130567
+ for (const x of chunkGroup.getChildren())if (!visitedChunkGroups.has(x)) {
130568
+ visitedChunkGroups.add(x);
130569
+ x.chunks.forEach((c)=>reachableChunks.add(c));
130570
+ getReachableChunks(x, reachableChunks, visitedChunkGroups);
130571
+ }
130572
+ return reachableChunks;
130573
+ }
130574
+ function InitialChunkFile_define_property(obj, key, value) {
130575
+ if (key in obj) Object.defineProperty(obj, key, {
130576
+ value: value,
130577
+ enumerable: true,
130578
+ configurable: true,
130579
+ writable: true
130580
+ });
130581
+ else obj[key] = value;
130582
+ return obj;
130583
+ }
130584
+ class WebExtensionContentScriptEntryPlugin {
130585
+ apply(compiler) {
130586
+ const { WebpackError, sources, Template } = compiler.webpack;
130587
+ const { experimental_output } = this.options;
130588
+ if (!experimental_output) return;
130589
+ {
130590
+ var _this_options_background;
130591
+ const sw = null == (_this_options_background = this.options.background) ? void 0 : _this_options_background.serviceWorkerEntry;
130592
+ if (sw && sw in experimental_output && 'function' == typeof experimental_output[sw]) throw new Error(`[webpack-extension-target] options.experimental_output[${JSON.stringify(sw)}] cannot be a function because it is a service worker entry. Use { file, touch(manifest, file) { manifest.background.service_worker = file; } } instead.`);
130593
+ }
130594
+ compiler.hooks.thisCompilation.tap(WebExtensionContentScriptEntryPlugin.name, (compilation)=>{
130595
+ compilation.hooks.processAssets.tap({
130596
+ name: WebExtensionContentScriptEntryPlugin.name,
130597
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVED
130598
+ }, (assets)=>{
130599
+ var _this_options_background;
130600
+ let manifest;
130601
+ const serviceWorkerEntry = null == (_this_options_background = this.options.background) ? void 0 : _this_options_background.serviceWorkerEntry;
130602
+ var _getInitialFiles;
130603
+ if (serviceWorkerEntry && !(serviceWorkerEntry in experimental_output) && ((null == (_getInitialFiles = getInitialFiles(compilation, serviceWorkerEntry)) ? void 0 : _getInitialFiles.length) || 0) > 1) {
130604
+ const e = new WebpackError(`[webpack-extension-target] Entry ${JSON.stringify(serviceWorkerEntry)} is not specified in options.experimental_output.`);
130605
+ e.stack = '';
130606
+ compilation.warnings.push(e);
130607
+ }
130608
+ for(const entry in experimental_output){
130609
+ const isBackgroundEntry = entry === serviceWorkerEntry;
130610
+ const entryOption = experimental_output[entry];
130611
+ const initialFiles = getInitialFiles(compilation, entry);
130612
+ if (!initialFiles || 0 === initialFiles.length) {
130613
+ const name = JSON.stringify(entry);
130614
+ const e = new WebpackError(initialFiles ? `[webpack-extension-target] Entry ${name} does not emit any initial file (specified in options.experimental_output).` : `[webpack-extension-target] Entry ${name} does not exist (specified in options.experimental_output).`);
130615
+ e.stack = '';
130616
+ compilation.errors.push(e);
130617
+ continue;
130618
+ }
130619
+ if (false === entryOption) {
130620
+ if (initialFiles.length > 1) {
130621
+ const name = JSON.stringify(entry);
130622
+ const e = new WebpackError(`[webpack-extension-target] Entry ${name} emits more than one initial file which is prohibited (specified in options.experimental_output).`);
130623
+ e.stack = '';
130624
+ compilation.errors.push(e);
130625
+ }
130626
+ continue;
130627
+ }
130628
+ const emitFile = (entryOptionFile, files)=>{
130629
+ if (entryOptionFile in assets) {
130630
+ const e = new WebpackError(`[webpack-extension-target] Cannot override an existing file ${JSON.stringify(entryOptionFile)} (specified by options.experimental_output[${JSON.stringify(entry)}]).`);
130631
+ e.stack = '';
130632
+ compilation.errors.push(e);
130633
+ return;
130634
+ }
130635
+ let code;
130636
+ if (isBackgroundEntry) {
130637
+ const asyncAndSyncFiles = getInitialAndAsyncFiles(compilation, entry);
130638
+ code = 'module' === compilation.outputOptions.chunkFormat ? asyncAndSyncFiles.map((file)=>`import ${JSON.stringify('./' + file)};`) : [
130639
+ 'try {',
130640
+ Template.indent('importScripts(' + asyncAndSyncFiles.map((file)=>JSON.stringify(file)).join(', ') + ');'),
130641
+ '} catch (e) {',
130642
+ Template.indent('Promise.reject(e);'),
130643
+ '}'
130644
+ ];
130645
+ } else code = [
130646
+ ';(() => {',
130647
+ Template.indent([
130648
+ 'const getURL = typeof browser === "object" ? browser.runtime.getURL : chrome.runtime.getURL;',
130649
+ `${JSON.stringify(files)}.forEach(file => import(getURL(file)));`
130650
+ ]),
130651
+ '})();',
130652
+ 'null;'
130653
+ ];
130654
+ const source = new compiler.webpack.sources.RawSource(Template.asString(code));
130655
+ compilation.emitAsset(entryOptionFile, source);
130656
+ };
130657
+ if ('string' == typeof entryOption) {
130658
+ emitFile(entryOption, initialFiles);
130659
+ continue;
130660
+ }
130661
+ if (!manifest) {
130662
+ const manifestAsset = assets['manifest.json'];
130663
+ const name = JSON.stringify(entry);
130664
+ if (!manifestAsset) {
130665
+ const e = new WebpackError(`[webpack-extension-target] A manifest.json is required (required by options.experimental_output[${name}]). You can emit this file by using CopyPlugin or any other plugins.`);
130666
+ e.stack = '';
130667
+ compilation.errors.push(e);
130668
+ continue;
130669
+ }
130670
+ try {
130671
+ const source = manifestAsset.source();
130672
+ manifest = 'string' == typeof source ? JSON.parse(source) : JSON.parse(source.toString('utf-8'));
130673
+ } catch {
130674
+ const e = new WebpackError(`[webpack-extension-target] Failed to parse manifest.json (required by options.experimental_output[${name}]).`);
130675
+ e.stack = '';
130676
+ e.file = 'manifest.json';
130677
+ compilation.errors.push(e);
130678
+ continue;
130679
+ }
130680
+ }
130681
+ if ('function' == typeof entryOption) entryOption(manifest, initialFiles);
130682
+ else if ('object' == typeof entryOption) {
130683
+ emitFile(entryOption.file, initialFiles);
130684
+ entryOption.touch(manifest, entryOption.file);
130685
+ }
130686
+ }
130687
+ if (manifest) compilation.updateAsset('manifest.json', new sources.RawSource(JSON.stringify(manifest, void 0, 4)));
130688
+ });
130689
+ });
130690
+ }
130691
+ constructor(options){
130692
+ InitialChunkFile_define_property(this, "options", void 0);
130693
+ this.options = options;
130694
+ }
130695
+ }
130696
+ function getInitialFiles(compilation, entry) {
130697
+ const entryPoint = compilation.entrypoints.get(entry);
130698
+ if (!entryPoint) return;
130699
+ const files = new Set();
130700
+ const runtimeChunk = entryPoint.getRuntimeChunk();
130701
+ if (runtimeChunk) runtimeChunk.files.forEach((file)=>{
130702
+ if (!isJSFile(file)) return;
130703
+ const asset = compilation.getAsset(file);
130704
+ if (!asset) return;
130705
+ if (!asset.info.hotModuleReplacement) files.add(file);
130706
+ });
130707
+ entryPoint.getFiles().forEach((file)=>{
130708
+ if (!isJSFile(file)) return;
130709
+ const asset = compilation.getAsset(file);
130710
+ if (!asset) return;
130711
+ if (!asset.info.hotModuleReplacement) files.add(file);
130712
+ });
130713
+ return [
130714
+ ...files
130715
+ ];
130716
+ }
130717
+ function getInitialAndAsyncFiles(compilation, entry) {
130718
+ const entryPoint = compilation.entrypoints.get(entry);
130719
+ if (!entryPoint) return [];
130720
+ const files = new Set();
130721
+ const visitedChunk = new Set();
130722
+ function visit(chunk) {
130723
+ const chunkId = 'rspack' in compilation.compiler ? chunk.id && chunk.hash ? chunk.id + chunk.hash : Array.from(chunk.files).join('') : chunk;
130724
+ if (visitedChunk.has(chunkId)) return;
130725
+ visitedChunk.add(chunkId);
130726
+ chunk.files.forEach((file)=>{
130727
+ if (!isJSFile(file)) return;
130728
+ const asset = compilation.getAsset(file);
130729
+ if (!asset) return;
130730
+ if (!asset.info.hotModuleReplacement) files.add(file);
130731
+ });
130732
+ for (const child of chunk.getAllAsyncChunks())visit(child);
130733
+ }
130734
+ entryPoint.chunks.forEach(visit);
130735
+ const allFiles = [
130736
+ ...files
130737
+ ].filter((file)=>isJSFile(file) && compilation.getAsset(file));
130738
+ return allFiles;
130739
+ }
130740
+ function isJSFile(file) {
130741
+ return file.endsWith('.js') || file.endsWith('.mjs');
130742
+ }
130743
+ class DevServerConfigPlugin {
130744
+ apply(compiler) {
130745
+ if (!compiler.options.devServer) compiler.options.devServer = {};
130746
+ const devServer = compiler.options.devServer;
130747
+ setDefault(devServer, 'devMiddleware', {});
130748
+ setDefault(devServer.devMiddleware, 'writeToDisk', true);
130749
+ if (void 0 === devServer.hot) devServer.hot = 'only';
130750
+ if (!devServer.hot) return;
130751
+ setDefault(devServer, 'host', '127.0.0.1');
130752
+ setDefault(devServer, 'client', {
130753
+ overlay: false,
130754
+ progress: false,
130755
+ webSocketURL: {
130756
+ protocol: 'ws'
130757
+ }
130758
+ });
130759
+ setDefault(devServer.client, 'overlay', false);
130760
+ setDefault(devServer.client, 'progress', false);
130761
+ setDefault(devServer.client, 'webSocketURL', {
130762
+ protocol: 'ws'
130763
+ });
130764
+ setDefault(devServer.client.webSocketURL, 'protocol', 'ws');
130765
+ setDefault(devServer, 'allowedHosts', 'all');
130766
+ setDefault(devServer, 'headers', {
130767
+ 'Access-Control-Allow-Origin': '*'
130768
+ });
130769
+ setDefault(devServer, 'static', {
130770
+ watch: {
130771
+ ignored: /\bnode_modules\b/
130772
+ }
130773
+ });
130774
+ setDefault(devServer.static, 'watch', {
130775
+ ignored: /\bnode_modules\b/
130776
+ });
130777
+ isObject(devServer.static) && 'watch' in devServer.static && isObject(devServer.static.watch) && setDefault(devServer.static.watch, 'ignored', /\bnode_modules\b/);
130778
+ }
130779
+ }
130780
+ function setDefault(obj, key, val) {
130781
+ if (isObject(obj) && void 0 === obj[key]) obj[key] = val;
130782
+ }
130783
+ function isObject(x) {
130784
+ return 'object' == typeof x && null !== x;
130785
+ }
130786
+ function webpack5_define_property(obj, key, value) {
130787
+ if (key in obj) Object.defineProperty(obj, key, {
130788
+ value: value,
130789
+ enumerable: true,
130790
+ configurable: true,
130791
+ writable: true
130792
+ });
130793
+ else obj[key] = value;
130794
+ return obj;
130795
+ }
130796
+ class WebExtensionPlugin {
130797
+ apply(compiler) {
130798
+ const { background, experimental_output } = this.options;
130799
+ if (null == background ? void 0 : background.serviceWorkerEntry) {
130800
+ var _this_options_background, _this_options_experimental_output;
130801
+ const serviceWorkerEntry = null == (_this_options_background = this.options.background) ? void 0 : _this_options_background.serviceWorkerEntry;
130802
+ const output = serviceWorkerEntry ? null == (_this_options_experimental_output = this.options.experimental_output) ? void 0 : _this_options_experimental_output[serviceWorkerEntry] : false;
130803
+ new WebExtensionServiceWorkerEntryPlugin(background, !!output).apply(compiler);
130804
+ }
130805
+ if (experimental_output) new WebExtensionContentScriptEntryPlugin(this.options).apply(compiler);
130806
+ if (false !== this.options.hmrConfig) new DevServerConfigPlugin().apply(compiler);
130807
+ new WebExtensionChuckLoaderRuntimePlugin(this.options).apply(compiler);
130808
+ new NoDangerNamePlugin().apply(compiler);
130809
+ compiler.hooks.environment.tap(WebExtensionPlugin.name, ()=>{
130810
+ const { output } = compiler.options;
130811
+ if (false !== output.environment.dynamicImport) output.environment.dynamicImport = true;
130812
+ if (void 0 !== output.hotUpdateChunkFilename) output.hotUpdateChunkFilename = 'hot/[id].[fullhash].js';
130813
+ if (void 0 !== output.hotUpdateMainFilename) output.hotUpdateMainFilename = 'hot/[runtime].[fullhash].json';
130814
+ });
130815
+ compiler.hooks.compilation.tap(WebExtensionPlugin.name, (compilation)=>{
130816
+ compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobal).tap(WebExtensionPlugin.name, (chunk)=>{
130817
+ compilation.addRuntimeModule(chunk, BrowserRuntimeModule(compiler.webpack, !!this.options.weakRuntimeCheck));
130818
+ return true;
130819
+ });
130820
+ });
130821
+ }
130822
+ constructor(options = {}){
130823
+ webpack5_define_property(this, "options", void 0);
130824
+ const { background } = options;
130825
+ if (background) {
130826
+ const { serviceWorkerEntry, pageEntry } = background;
130827
+ if ('entry' in background || 'manifest' in background) throw new Error('[webpack-extension-target] background.entry and background.manifest has been removed. Use background.pageEntry and/or background.serviceWorkerEntry instead.');
130828
+ if (serviceWorkerEntry && serviceWorkerEntry === pageEntry) throw new Error(`[webpack-extension-target] background.serviceWorkerEntry must not be the same as background.pageEntry. Service Worker entry only supports importScript, but importScript does not exist in background page (mv2) or limited event page (mv3).
130829
+ A possible fix is to create two new files to be the service worker entry and the page entry, then those two files imports the background entry.`);
130830
+ }
130831
+ this.options = options;
130832
+ }
130833
+ }
130834
+ const webpack_target_webextension_fork = WebExtensionPlugin;
130835
+ function manifest_getManifestContent(compilation, manifestPath) {
130836
+ var _compilation_getAsset, _compilation_assets;
130837
+ if ((null == (_compilation_getAsset = compilation.getAsset) ? void 0 : _compilation_getAsset.call(compilation, 'manifest.json')) || (null == (_compilation_assets = compilation.assets) ? void 0 : _compilation_assets['manifest.json'])) {
130838
+ var _compilation_assets_manifestjson_source, _compilation_assets_manifestjson;
130839
+ const source = null == (_compilation_assets_manifestjson = compilation.assets['manifest.json']) ? void 0 : null == (_compilation_assets_manifestjson_source = _compilation_assets_manifestjson.source) ? void 0 : _compilation_assets_manifestjson_source.call(_compilation_assets_manifestjson);
130840
+ const manifest = 'function' == typeof source ? source().toString() : String(source || '');
130841
+ return JSON.parse(manifest || '{}');
130842
+ }
130843
+ try {
130844
+ const text = external_fs_.readFileSync(manifestPath, 'utf8');
130845
+ return JSON.parse(text);
130846
+ } catch {
130847
+ return require(manifestPath);
130848
+ }
130849
+ }
130850
+ function scripts_lib_manifest_filterKeysForThisBrowser(manifest, browser) {
130851
+ const CHROMIUM_BASED_BROWSERS = [
130852
+ 'chrome',
130853
+ 'edge'
130854
+ ];
130855
+ const GECKO_BASED_BROWSERS = [
130856
+ 'firefox'
130857
+ ];
130858
+ const isChromiumTarget = CHROMIUM_BASED_BROWSERS.includes(browser) || String(browser).includes('chromium');
130859
+ const isGeckoTarget = GECKO_BASED_BROWSERS.includes(browser) || String(browser).includes('gecko');
130860
+ const chromiumPrefixes = new Set([
130861
+ 'chromium',
130862
+ 'chrome',
130863
+ 'edge'
130864
+ ]);
130865
+ const geckoPrefixes = new Set([
130866
+ 'gecko',
130867
+ 'firefox'
129795
130868
  ]);
129796
130869
  const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
129797
130870
  const indexOfColon = key.indexOf(':');
@@ -130119,15 +131192,6 @@ var __webpack_exports__ = {};
130119
131192
  else obj[key] = value;
130120
131193
  return obj;
130121
131194
  }
130122
- const requireForEsm = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
130123
- function tryLoadWebExtensionFork() {
130124
- try {
130125
- const mod = requireForEsm('./webpack-target-webextension-fork');
130126
- return mod && (mod.default || mod);
130127
- } catch {
130128
- return null;
130129
- }
130130
- }
130131
131195
  class SetupReloadStrategy {
130132
131196
  getEntryName(manifest) {
130133
131197
  if (manifest.background) {
@@ -130139,126 +131203,72 @@ var __webpack_exports__ = {};
130139
131203
  if (3 === manifest.manifest_version) return {
130140
131204
  serviceWorkerEntry: 'background/service_worker',
130141
131205
  tryCatchWrapper: true,
130142
- eagerChunkLoading: false
130143
- };
130144
- if (2 === manifest.manifest_version) return {
130145
- pageEntry: "background/script",
130146
- tryCatchWrapper: true,
130147
- eagerChunkLoading: false
130148
- };
130149
- }
130150
- return {
130151
- pageEntry: 'background',
130152
- tryCatchWrapper: true,
130153
- eagerChunkLoading: false
130154
- };
130155
- }
130156
- apply(compiler) {
130157
- const manifest = JSON.parse(external_fs_.readFileSync(this.manifestPath, 'utf-8'));
130158
- const patchedManifest = scripts_lib_manifest_filterKeysForThisBrowser(manifest, this.browser);
130159
- new ApplyManifestDevDefaults({
130160
- manifestPath: this.manifestPath,
130161
- browser: this.browser
130162
- }).apply(compiler);
130163
- new SetupBackgroundEntry({
130164
- manifestPath: this.manifestPath,
130165
- browser: this.browser
130166
- }).apply(compiler);
130167
- const wantFork = 'true' === process.env.EXTENSION_EXPERIMENTAL_HMR;
130168
- if (wantFork) {
130169
- const Fork = tryLoadWebExtensionFork();
130170
- const PluginCtor = Fork || external_webpack_target_webextension_default();
130171
- new PluginCtor({
130172
- background: this.getEntryName(patchedManifest),
130173
- weakRuntimeCheck: true
130174
- }).apply(compiler);
130175
- return;
130176
- }
130177
- new (external_webpack_target_webextension_default())({
130178
- background: this.getEntryName(patchedManifest),
130179
- weakRuntimeCheck: true
130180
- }).apply(compiler);
130181
- }
130182
- constructor(options){
130183
- setup_reload_strategy_define_property(this, "manifestPath", void 0);
130184
- setup_reload_strategy_define_property(this, "browser", void 0);
130185
- this.manifestPath = options.manifestPath;
130186
- this.browser = options.browser || 'chrome';
130187
- }
130188
- }
130189
- function add_content_script_wrapper_define_property(obj, key, value) {
130190
- if (key in obj) Object.defineProperty(obj, key, {
130191
- value: value,
130192
- enumerable: true,
130193
- configurable: true,
130194
- writable: true
130195
- });
130196
- else obj[key] = value;
130197
- return obj;
130198
- }
130199
- class AddContentScriptWrapper {
130200
- apply(compiler) {
130201
- compiler.options.module.rules.push({
130202
- test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
130203
- include: [
130204
- external_path_.dirname(this.manifestPath)
130205
- ],
130206
- exclude: [
130207
- /([\\/])node_modules\1/
130208
- ],
130209
- use: [
130210
- {
130211
- loader: external_path_.resolve(__dirname, "content-script-wrapper"),
130212
- options: {
130213
- manifestPath: this.manifestPath,
130214
- mode: compiler.options.mode
130215
- }
130216
- }
130217
- ]
130218
- });
130219
- if ('production' !== compiler.options.mode) {
130220
- compiler.options.module.rules.push({
130221
- test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
130222
- include: [
130223
- external_path_.dirname(this.manifestPath)
130224
- ],
130225
- exclude: [
130226
- /([\\/])node_modules\1/
130227
- ],
130228
- use: [
130229
- {
130230
- loader: external_path_.resolve(__dirname, 'warn-no-default-export'),
130231
- options: {
130232
- manifestPath: this.manifestPath,
130233
- mode: compiler.options.mode
130234
- }
130235
- }
130236
- ],
130237
- enforce: 'pre'
130238
- });
130239
- compiler.options.module.rules.push({
130240
- test: /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,
130241
- include: [
130242
- external_path_.dirname(this.manifestPath)
130243
- ],
130244
- exclude: [
130245
- /([\\/])node_modules\1/
130246
- ],
130247
- use: [
130248
- {
130249
- loader: external_path_.resolve(__dirname, 'add-hmr-accept-code'),
130250
- options: {
130251
- manifestPath: this.manifestPath,
130252
- mode: compiler.options.mode
130253
- }
130254
- }
130255
- ]
130256
- });
131206
+ eagerChunkLoading: false
131207
+ };
131208
+ if (2 === manifest.manifest_version) return {
131209
+ pageEntry: "background/script",
131210
+ tryCatchWrapper: true,
131211
+ eagerChunkLoading: false
131212
+ };
130257
131213
  }
131214
+ return {
131215
+ pageEntry: 'background',
131216
+ tryCatchWrapper: true,
131217
+ eagerChunkLoading: false
131218
+ };
131219
+ }
131220
+ apply(compiler) {
131221
+ const manifest = JSON.parse(external_fs_.readFileSync(this.manifestPath, 'utf-8'));
131222
+ const patchedManifest = scripts_lib_manifest_filterKeysForThisBrowser(manifest, this.browser);
131223
+ const contentScriptsMeta = {};
131224
+ try {
131225
+ const csList = Array.isArray(patchedManifest.content_scripts) ? patchedManifest.content_scripts : [];
131226
+ const originalCount = csList.length;
131227
+ let bridgeOrdinal = 0;
131228
+ for(let i = 0; i < csList.length; i++){
131229
+ const cs = csList[i];
131230
+ const bundleId = `content_scripts/content-${i}.js`;
131231
+ const isMain = (null == cs ? void 0 : cs.world) === 'MAIN';
131232
+ if (isMain) {
131233
+ const bridgeIndex = originalCount + bridgeOrdinal++;
131234
+ contentScriptsMeta[bundleId] = {
131235
+ index: i,
131236
+ bundleId,
131237
+ world: 'main',
131238
+ bridgeBundleId: `content_scripts/content-${bridgeIndex}.js`
131239
+ };
131240
+ const bridgeBundleId = `content_scripts/content-${bridgeIndex}.js`;
131241
+ contentScriptsMeta[bridgeBundleId] = {
131242
+ index: bridgeIndex,
131243
+ bundleId: bridgeBundleId,
131244
+ world: 'extension',
131245
+ role: 'main_world_bridge',
131246
+ mainBundleId: bundleId
131247
+ };
131248
+ } else contentScriptsMeta[bundleId] = {
131249
+ index: i,
131250
+ bundleId,
131251
+ world: 'extension'
131252
+ };
131253
+ }
131254
+ } catch {}
131255
+ new ApplyManifestDevDefaults({
131256
+ manifestPath: this.manifestPath,
131257
+ browser: this.browser
131258
+ }).apply(compiler);
131259
+ new SetupBackgroundEntry({
131260
+ manifestPath: this.manifestPath,
131261
+ browser: this.browser
131262
+ }).apply(compiler);
131263
+ new webpack_target_webextension_fork({
131264
+ background: this.getEntryName(patchedManifest),
131265
+ weakRuntimeCheck: true,
131266
+ contentScriptsMeta
131267
+ }).apply(compiler);
130258
131268
  }
130259
131269
  constructor(options){
130260
- add_content_script_wrapper_define_property(this, "manifestPath", void 0);
130261
- add_content_script_wrapper_define_property(this, "browser", void 0);
131270
+ setup_reload_strategy_define_property(this, "manifestPath", void 0);
131271
+ setup_reload_strategy_define_property(this, "browser", void 0);
130262
131272
  this.manifestPath = options.manifestPath;
130263
131273
  this.browser = options.browser || 'chrome';
130264
131274
  }
@@ -130283,6 +131293,9 @@ var __webpack_exports__ = {};
130283
131293
  const paths = [];
130284
131294
  for (const [, val] of Object.entries(scriptsMap))if (Array.isArray(val)) paths.push(...val.filter(Boolean));
130285
131295
  else if (val) paths.push(val);
131296
+ const bridgeScripts = AddContentScriptWrapper.getBridgeScripts(this.manifestPath);
131297
+ for (const [, value] of Object.entries(bridgeScripts))if (Array.isArray(value)) paths.push(...value.filter(Boolean));
131298
+ else if (value) paths.push(value);
130286
131299
  return paths;
130287
131300
  }
130288
131301
  async handleWatchRun(compilerWithModifiedFiles, callbackDone) {
@@ -130373,10 +131386,6 @@ var __webpack_exports__ = {};
130373
131386
  apply(compiler) {
130374
131387
  const hasValidManifest = !!this.manifestPath && external_fs_.existsSync(this.manifestPath) && external_fs_.lstatSync(this.manifestPath).isFile();
130375
131388
  if (!hasValidManifest) return;
130376
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
130377
- const featuresCount = Object.keys(this.includeList || {}).length;
130378
- console.log(scriptsIncludeSummary(featuresCount, 'production' !== compiler.options.mode, String(this.browser || 'chrome')));
130379
- }
130380
131389
  new AddScripts({
130381
131390
  manifestPath: this.manifestPath,
130382
131391
  includeList: this.includeList || {}
@@ -130393,7 +131402,6 @@ var __webpack_exports__ = {};
130393
131402
  }).apply(compiler);
130394
131403
  new ThrowIfManifestScriptsChange({
130395
131404
  manifestPath: this.manifestPath,
130396
- includeList: this.includeList || {},
130397
131405
  browser: this.browser
130398
131406
  }).apply(compiler);
130399
131407
  }
@@ -130450,6 +131458,101 @@ var __webpack_exports__ = {};
130450
131458
  function localesValidationDetected(issue) {
130451
131459
  return `Locales validation detected: ${issue}`;
130452
131460
  }
131461
+ function pushCompilationError(compiler, compilation, name, message, file) {
131462
+ var _compiler_rspack;
131463
+ const ErrorConstructor = (null == compiler ? void 0 : null == (_compiler_rspack = compiler.rspack) ? void 0 : _compiler_rspack.WebpackError) || Error;
131464
+ const error = new ErrorConstructor(message);
131465
+ error.name = name;
131466
+ if (file) error.file = file;
131467
+ if (!compilation.errors) compilation.errors = [];
131468
+ compilation.errors.push(error);
131469
+ }
131470
+ function validateLocales(compiler, compilation, manifestPath) {
131471
+ try {
131472
+ const manifestDir = external_path_.dirname(manifestPath);
131473
+ const manifestRaw = external_fs_.readFileSync(manifestPath, 'utf8');
131474
+ const manifest = JSON.parse(manifestRaw);
131475
+ const defaultLocale = null == manifest ? void 0 : manifest.default_locale;
131476
+ const localesRoot = external_path_.join(manifestDir, '_locales');
131477
+ const hasLocalesRoot = external_fs_.existsSync(localesRoot);
131478
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesIncludeSummary(true, hasLocalesRoot, 'string' == typeof defaultLocale ? defaultLocale : void 0));
131479
+ if ('string' == typeof defaultLocale && defaultLocale.trim()) {
131480
+ if (!hasLocalesRoot) {
131481
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('default_locale set but _locales missing'));
131482
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleSpecifiedButLocalesMissing(), 'manifest.json');
131483
+ return false;
131484
+ }
131485
+ const defaultLocaleDir = external_path_.join(localesRoot, defaultLocale);
131486
+ if (!external_fs_.existsSync(defaultLocaleDir)) {
131487
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}`));
131488
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleFolderMissing(defaultLocale), 'manifest.json');
131489
+ return false;
131490
+ }
131491
+ const messagesJsonPath = external_path_.join(defaultLocaleDir, 'messages.json');
131492
+ if (!external_fs_.existsSync(messagesJsonPath)) {
131493
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}/messages.json`));
131494
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleMessagesMissing(defaultLocale), 'manifest.json');
131495
+ return false;
131496
+ }
131497
+ try {
131498
+ const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
131499
+ JSON.parse(content);
131500
+ } catch (e) {
131501
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in _locales/${defaultLocale}/messages.json`));
131502
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(messagesJsonPath), 'manifest.json');
131503
+ return false;
131504
+ }
131505
+ try {
131506
+ const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
131507
+ const dict = JSON.parse(content);
131508
+ const collectMsgKeys = (value, acc)=>{
131509
+ if ('string' == typeof value) {
131510
+ const regex = /__MSG_([a-zA-Z0-9_]+)__/g;
131511
+ let matches;
131512
+ while(null !== (matches = regex.exec(value))){
131513
+ const key = matches[1];
131514
+ if (key) acc.add(key);
131515
+ }
131516
+ } else if (Array.isArray(value)) for (const item of value)collectMsgKeys(item, acc);
131517
+ else if (value && 'object' == typeof value) for (const v of Object.values(value))collectMsgKeys(v, acc);
131518
+ };
131519
+ const referenced = new Set();
131520
+ collectMsgKeys(manifest, referenced);
131521
+ for (const key of referenced){
131522
+ const entry = null == dict ? void 0 : dict[key];
131523
+ if (!entry || 'string' != typeof entry.message) {
131524
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing key "${key}" in default locale`));
131525
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', missingManifestMessageKey(key, defaultLocale), 'manifest.json');
131526
+ return false;
131527
+ }
131528
+ }
131529
+ } catch {}
131530
+ } else if (hasLocalesRoot) {
131531
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('_locales present but no default_locale'));
131532
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', localesPresentButNoDefaultLocale(), 'manifest.json');
131533
+ return false;
131534
+ }
131535
+ } catch {}
131536
+ try {
131537
+ const manifestDir = external_path_.dirname(manifestPath);
131538
+ const localesRoot = external_path_.join(manifestDir, '_locales');
131539
+ if (external_fs_.existsSync(localesRoot)) {
131540
+ const localeDirs = external_fs_.readdirSync(localesRoot).map((d)=>external_path_.join(localesRoot, d)).filter((p)=>external_fs_.statSync(p).isDirectory());
131541
+ for (const localeDir of localeDirs){
131542
+ const msgPath = external_path_.join(localeDir, 'messages.json');
131543
+ if (external_fs_.existsSync(msgPath)) try {
131544
+ const s = external_fs_.readFileSync(msgPath, 'utf8');
131545
+ JSON.parse(s);
131546
+ } catch {
131547
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in ${msgPath}`));
131548
+ pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(msgPath), 'manifest.json');
131549
+ return false;
131550
+ }
131551
+ }
131552
+ }
131553
+ } catch {}
131554
+ return true;
131555
+ }
130453
131556
  function getLocales(manifestPath) {
130454
131557
  const localesFolder = external_path_.join(external_path_.dirname(manifestPath), '_locales');
130455
131558
  const localeFiles = [];
@@ -130459,6 +131562,62 @@ var __webpack_exports__ = {};
130459
131562
  }
130460
131563
  return localeFiles;
130461
131564
  }
131565
+ function processLocaleAssets(compiler, compilation, manifestPath) {
131566
+ if (compilation.errors.length > 0) return;
131567
+ const localesFields = getLocales(manifestPath);
131568
+ const discoveredList = getLocales(manifestPath) || [];
131569
+ let emittedCount = 0;
131570
+ let missingCount = 0;
131571
+ for (const field of Object.entries(localesFields || [])){
131572
+ const [feature, resource] = field;
131573
+ const thisResource = resource;
131574
+ if (thisResource) {
131575
+ if ('.json' !== external_path_.extname(thisResource)) continue;
131576
+ if (!external_fs_.existsSync(thisResource)) {
131577
+ var _compiler_rspack;
131578
+ const ErrorConstructor = (null == compiler ? void 0 : null == (_compiler_rspack = compiler.rspack) ? void 0 : _compiler_rspack.WebpackError) || Error;
131579
+ const warning = new ErrorConstructor(entryNotFoundMessageOnly(feature));
131580
+ warning.file = thisResource;
131581
+ warning.name = 'LocalesPluginMissingFile';
131582
+ if (!compilation.warnings) compilation.warnings = [];
131583
+ compilation.warnings.push(warning);
131584
+ missingCount++;
131585
+ continue;
131586
+ }
131587
+ const source = external_fs_.readFileSync(thisResource);
131588
+ const rawSource = new core_namespaceObject.sources.RawSource(source);
131589
+ const manifestDir = external_path_.dirname(manifestPath);
131590
+ const localesRoot = external_path_.join(manifestDir, '_locales');
131591
+ const relativeToLocales = external_path_.relative(localesRoot, thisResource);
131592
+ const normalizedRel = relativeToLocales.split(external_path_.sep).join('/');
131593
+ const filename = `_locales/${normalizedRel}`;
131594
+ compilation.emitAsset(filename, rawSource);
131595
+ emittedCount++;
131596
+ }
131597
+ }
131598
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesEmitSummary(emittedCount, missingCount, discoveredList.length));
131599
+ }
131600
+ function trackLocaleDependencies(compilation, manifestPath) {
131601
+ var _compilation_errors;
131602
+ if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
131603
+ const localesFields = getLocales(manifestPath);
131604
+ let added = 0;
131605
+ for (const field of Object.entries(localesFields || [])){
131606
+ const [, resource] = field;
131607
+ if (resource) {
131608
+ const fileDependencies = new Set(compilation.fileDependencies);
131609
+ const fileResources = localesFields || [];
131610
+ for (const thisResource of fileResources)if (external_fs_.existsSync(thisResource) && '.json' === external_path_.extname(thisResource)) {
131611
+ if (!fileDependencies.has(thisResource)) {
131612
+ fileDependencies.add(thisResource);
131613
+ compilation.fileDependencies.add(thisResource);
131614
+ added++;
131615
+ }
131616
+ }
131617
+ }
131618
+ }
131619
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesDepsTracked(added));
131620
+ }
130462
131621
  function feature_locales_define_property(obj, key, value) {
130463
131622
  if (key in obj) Object.defineProperty(obj, key, {
130464
131623
  value: value,
@@ -130469,15 +131628,6 @@ var __webpack_exports__ = {};
130469
131628
  else obj[key] = value;
130470
131629
  return obj;
130471
131630
  }
130472
- function pushCompilationError(compiler, compilation, name, message, file) {
130473
- var _compiler_rspack;
130474
- const ErrorConstructor = (null == compiler ? void 0 : null == (_compiler_rspack = compiler.rspack) ? void 0 : _compiler_rspack.WebpackError) || Error;
130475
- const error = new ErrorConstructor(message);
130476
- error.name = name;
130477
- if (file) error.file = file;
130478
- if (!compilation.errors) compilation.errors = [];
130479
- compilation.errors.push(error);
130480
- }
130481
131631
  class LocalesPlugin {
130482
131632
  apply(compiler) {
130483
131633
  compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
@@ -130495,122 +131645,9 @@ var __webpack_exports__ = {};
130495
131645
  compilation.errors.push(error);
130496
131646
  return;
130497
131647
  }
130498
- try {
130499
- const manifestDir = external_path_.dirname(this.manifestPath);
130500
- const manifestRaw = external_fs_.readFileSync(this.manifestPath, 'utf8');
130501
- const manifest = JSON.parse(manifestRaw);
130502
- const defaultLocale = null == manifest ? void 0 : manifest.default_locale;
130503
- const localesRoot = external_path_.join(manifestDir, '_locales');
130504
- const hasLocalesRoot = external_fs_.existsSync(localesRoot);
130505
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesIncludeSummary(true, hasLocalesRoot, 'string' == typeof defaultLocale ? defaultLocale : void 0));
130506
- if ('string' == typeof defaultLocale && defaultLocale.trim()) {
130507
- if (!hasLocalesRoot) {
130508
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('default_locale set but _locales missing'));
130509
- pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleSpecifiedButLocalesMissing(), 'manifest.json');
130510
- return;
130511
- }
130512
- const defaultLocaleDir = external_path_.join(localesRoot, defaultLocale);
130513
- if (!external_fs_.existsSync(defaultLocaleDir)) {
130514
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}`));
130515
- pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleFolderMissing(defaultLocale), 'manifest.json');
130516
- return;
130517
- }
130518
- const messagesJsonPath = external_path_.join(defaultLocaleDir, 'messages.json');
130519
- if (!external_fs_.existsSync(messagesJsonPath)) {
130520
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing _locales/${defaultLocale}/messages.json`));
130521
- pushCompilationError(compiler, compilation, 'LocalesValidationError', defaultLocaleMessagesMissing(defaultLocale), 'manifest.json');
130522
- return;
130523
- }
130524
- try {
130525
- const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
130526
- JSON.parse(content);
130527
- } catch (e) {
130528
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in _locales/${defaultLocale}/messages.json`));
130529
- pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(messagesJsonPath), 'manifest.json');
130530
- return;
130531
- }
130532
- try {
130533
- const content = external_fs_.readFileSync(messagesJsonPath, 'utf8');
130534
- const dict = JSON.parse(content);
130535
- const collectMsgKeys = (value, acc)=>{
130536
- if ('string' == typeof value) {
130537
- const regex = /__MSG_([a-zA-Z0-9_]+)__/g;
130538
- let matches;
130539
- while(null !== (matches = regex.exec(value))){
130540
- const key = matches[1];
130541
- if (key) acc.add(key);
130542
- }
130543
- } else if (Array.isArray(value)) for (const item of value)collectMsgKeys(item, acc);
130544
- else if (value && 'object' == typeof value) for (const v of Object.values(value))collectMsgKeys(v, acc);
130545
- };
130546
- const referenced = new Set();
130547
- collectMsgKeys(manifest, referenced);
130548
- for (const key of referenced){
130549
- const entry = null == dict ? void 0 : dict[key];
130550
- if (!entry || 'string' != typeof entry.message) {
130551
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`missing key "${key}" in default locale`));
130552
- pushCompilationError(compiler, compilation, 'LocalesValidationError', missingManifestMessageKey(key, defaultLocale), 'manifest.json');
130553
- return;
130554
- }
130555
- }
130556
- } catch {}
130557
- } else if (hasLocalesRoot) {
130558
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected('_locales present but no default_locale'));
130559
- pushCompilationError(compiler, compilation, 'LocalesValidationError', localesPresentButNoDefaultLocale(), 'manifest.json');
130560
- return;
130561
- }
130562
- } catch {}
131648
+ if (!validateLocales(compiler, compilation, this.manifestPath)) return;
130563
131649
  if (compilation.errors.length > 0) return;
130564
- try {
130565
- const manifestDir = external_path_.dirname(this.manifestPath);
130566
- const localesRoot = external_path_.join(manifestDir, '_locales');
130567
- if (external_fs_.existsSync(localesRoot)) {
130568
- const localeDirs = external_fs_.readdirSync(localesRoot).map((d)=>external_path_.join(localesRoot, d)).filter((p)=>external_fs_.statSync(p).isDirectory());
130569
- for (const localeDir of localeDirs){
130570
- const msgPath = external_path_.join(localeDir, 'messages.json');
130571
- if (external_fs_.existsSync(msgPath)) try {
130572
- const s = external_fs_.readFileSync(msgPath, 'utf8');
130573
- JSON.parse(s);
130574
- } catch {
130575
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesValidationDetected(`invalid JSON in ${msgPath}`));
130576
- pushCompilationError(compiler, compilation, 'LocalesValidationError', invalidMessagesJson(msgPath), 'manifest.json');
130577
- return;
130578
- }
130579
- }
130580
- }
130581
- } catch {}
130582
- const localesFields = getLocales(this.manifestPath);
130583
- const discoveredList = getLocales(this.manifestPath) || [];
130584
- let emittedCount = 0;
130585
- let missingCount = 0;
130586
- for (const field of Object.entries(localesFields || [])){
130587
- const [feature, resource] = field;
130588
- const thisResource = resource;
130589
- if (thisResource) {
130590
- if ('.json' !== external_path_.extname(thisResource)) continue;
130591
- if (!external_fs_.existsSync(thisResource)) {
130592
- var _compiler_rspack1;
130593
- const ErrorConstructor = (null == compiler ? void 0 : null == (_compiler_rspack1 = compiler.rspack) ? void 0 : _compiler_rspack1.WebpackError) || Error;
130594
- const warning = new ErrorConstructor(entryNotFoundMessageOnly(feature));
130595
- warning.file = thisResource;
130596
- warning.name = 'LocalesPluginMissingFile';
130597
- if (!compilation.warnings) compilation.warnings = [];
130598
- compilation.warnings.push(warning);
130599
- missingCount++;
130600
- continue;
130601
- }
130602
- const source = external_fs_.readFileSync(thisResource);
130603
- const rawSource = new core_namespaceObject.sources.RawSource(source);
130604
- const manifestDir = external_path_.dirname(this.manifestPath);
130605
- const localesRoot = external_path_.join(manifestDir, '_locales');
130606
- const relativeToLocales = external_path_.relative(localesRoot, thisResource);
130607
- const normalizedRel = relativeToLocales.split(external_path_.sep).join('/');
130608
- const filename = `_locales/${normalizedRel}`;
130609
- compilation.emitAsset(filename, rawSource);
130610
- emittedCount++;
130611
- }
130612
- }
130613
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesEmitSummary(emittedCount, missingCount, discoveredList.length));
131650
+ processLocaleAssets(compiler, compilation, this.manifestPath);
130614
131651
  });
130615
131652
  });
130616
131653
  compiler.hooks.thisCompilation.tap('locales:module', (compilation)=>{
@@ -130618,25 +131655,7 @@ var __webpack_exports__ = {};
130618
131655
  name: 'locales:module',
130619
131656
  stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
130620
131657
  }, ()=>{
130621
- var _compilation_errors;
130622
- if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
130623
- const localesFields = getLocales(this.manifestPath);
130624
- let added = 0;
130625
- for (const field of Object.entries(localesFields || [])){
130626
- const [, resource] = field;
130627
- if (resource) {
130628
- const fileDependencies = new Set(compilation.fileDependencies);
130629
- const fileResources = localesFields || [];
130630
- for (const thisResource of fileResources)if (external_fs_.existsSync(thisResource) && '.json' === external_path_.extname(thisResource)) {
130631
- if (!fileDependencies.has(thisResource)) {
130632
- fileDependencies.add(thisResource);
130633
- compilation.fileDependencies.add(thisResource);
130634
- added++;
130635
- }
130636
- }
130637
- }
130638
- }
130639
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(localesDepsTracked(added));
131658
+ trackLocaleDependencies(compilation, this.manifestPath);
130640
131659
  });
130641
131660
  });
130642
131661
  }
@@ -130647,6 +131666,7 @@ var __webpack_exports__ = {};
130647
131666
  this.includeList = options.includeList;
130648
131667
  }
130649
131668
  }
131669
+ const external_node_module_namespaceObject = require("node:module");
130650
131670
  function jsonMissingFile(manifestField, filePath, opts) {
130651
131671
  const lines = [];
130652
131672
  lines.push(`Check the ${external_pintor_default().yellow(manifestField)} field in your ${external_pintor_default().yellow('manifest.json')} file.`);
@@ -130812,6 +131832,147 @@ var __webpack_exports__ = {};
130812
131832
  this.browser = options.browser || 'chrome';
130813
131833
  }
130814
131834
  }
131835
+ function isCriticalJsonFeature(feature) {
131836
+ return feature.startsWith('declarative_net_request') || 'storage.managed_schema' === feature;
131837
+ }
131838
+ function validateJsonAsset(compilation, feature, filePath, buf) {
131839
+ let parsed;
131840
+ try {
131841
+ parsed = JSON.parse(buf.toString('utf-8'));
131842
+ } catch (e) {
131843
+ const err = new core_namespaceObject.WebpackError(invalidJsonSyntax(feature, filePath, String((null == e ? void 0 : e.message) || e)));
131844
+ err.file = filePath;
131845
+ err.name = 'JSONInvalidSyntax';
131846
+ compilation.errors.push(err);
131847
+ return false;
131848
+ }
131849
+ if (feature.startsWith('declarative_net_request')) {
131850
+ if (!Array.isArray(parsed)) {
131851
+ const err = new core_namespaceObject.WebpackError(invalidRulesetStructure(feature, filePath));
131852
+ err.file = filePath;
131853
+ err.name = 'DNRInvalidRuleset';
131854
+ compilation.errors.push(err);
131855
+ return false;
131856
+ }
131857
+ } else if ('storage.managed_schema' === feature) {
131858
+ if (null === parsed || Array.isArray(parsed) || 'object' != typeof parsed) {
131859
+ const err = new core_namespaceObject.WebpackError(invalidManagedSchemaStructure(feature, filePath));
131860
+ err.file = filePath;
131861
+ err.name = 'ManagedSchemaInvalid';
131862
+ compilation.errors.push(err);
131863
+ return false;
131864
+ }
131865
+ }
131866
+ return true;
131867
+ }
131868
+ function getProjectPathFromCompilation(compilation, manifestPath) {
131869
+ return compilation.compiler.options.context || compilation.options.context || external_path_.dirname(manifestPath);
131870
+ }
131871
+ function processJsonAssets(compilation, manifestPath, includeList) {
131872
+ if (compilation.errors.length > 0) return;
131873
+ const jsonFields = includeList || {};
131874
+ const manifestDir = external_path_.dirname(manifestPath);
131875
+ const projectPath = getProjectPathFromCompilation(compilation, manifestPath);
131876
+ const publicDir = external_path_.join(projectPath, 'public');
131877
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
131878
+ const featureKeys = Object.keys(jsonFields || {});
131879
+ const criticalCount = featureKeys.filter((key)=>isCriticalJsonFeature(key)).length;
131880
+ console.log(jsonIncludeSummary(featureKeys.length, criticalCount));
131881
+ }
131882
+ for (const field of Object.entries(jsonFields)){
131883
+ const [feature, resource] = field;
131884
+ let emittedCount = 0;
131885
+ let underPublicCount = 0;
131886
+ let missingCount = 0;
131887
+ let validatedOk = 0;
131888
+ let invalid = 0;
131889
+ const resourceArr = Array.isArray(resource) ? resource : [
131890
+ resource
131891
+ ];
131892
+ for (const thisResource of resourceArr)if (thisResource) {
131893
+ const abs = external_path_.isAbsolute(thisResource) ? thisResource : external_path_.join(manifestDir, thisResource);
131894
+ const relToPublic = external_path_.relative(publicDir, abs);
131895
+ const isUnderPublic = relToPublic && !relToPublic.startsWith('..') && !external_path_.isAbsolute(relToPublic);
131896
+ if (!external_fs_.existsSync(abs)) {
131897
+ var _compilation_options_output, _compilation_options;
131898
+ const rawRef = String(thisResource);
131899
+ const isPublicRoot = rawRef.startsWith('/') && !external_path_.isAbsolute(rawRef);
131900
+ const outputRoot = (null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : null == (_compilation_options_output = _compilation_options.output) ? void 0 : _compilation_options_output.path) || '';
131901
+ const displayPath = isPublicRoot ? external_path_.join(outputRoot, rawRef.slice(1)) : abs;
131902
+ const notFound = new core_namespaceObject.WebpackError(jsonMissingFile(feature, displayPath, {
131903
+ publicRootHint: isPublicRoot
131904
+ }));
131905
+ notFound.name = 'JSONMissingFile';
131906
+ notFound.file = 'manifest.json';
131907
+ if (isCriticalJsonFeature(feature)) compilation.errors.push(notFound);
131908
+ else compilation.warnings.push(notFound);
131909
+ missingCount++;
131910
+ continue;
131911
+ }
131912
+ if (isUnderPublic) {
131913
+ try {
131914
+ compilation.fileDependencies.add(abs);
131915
+ } catch {}
131916
+ if (isCriticalJsonFeature(feature)) {
131917
+ const ok = validateJsonAsset(compilation, feature, abs, external_fs_.readFileSync(abs));
131918
+ if (ok) validatedOk++;
131919
+ else invalid++;
131920
+ if (!ok) continue;
131921
+ }
131922
+ underPublicCount++;
131923
+ continue;
131924
+ }
131925
+ const source = external_fs_.readFileSync(abs);
131926
+ if (isCriticalJsonFeature(feature)) {
131927
+ const ok = validateJsonAsset(compilation, feature, abs, source);
131928
+ if (ok) validatedOk++;
131929
+ else invalid++;
131930
+ if (!ok) continue;
131931
+ }
131932
+ const rawSource = new core_namespaceObject.sources.RawSource(source);
131933
+ const assetName = feature + '.json';
131934
+ if ('function' == typeof compilation.getAsset && compilation.getAsset(assetName)) compilation.updateAsset(assetName, rawSource);
131935
+ else compilation.emitAsset(assetName, rawSource);
131936
+ emittedCount++;
131937
+ }
131938
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
131939
+ const entries = Array.isArray(resource) ? resource.length : resource ? 1 : 0;
131940
+ console.log(jsonEmitSummary(feature, {
131941
+ entries,
131942
+ underPublic: underPublicCount,
131943
+ emitted: emittedCount,
131944
+ missing: missingCount,
131945
+ validatedOk,
131946
+ invalid
131947
+ }));
131948
+ }
131949
+ }
131950
+ }
131951
+ function trackJsonDependencies(compilation, manifestPath, includeList) {
131952
+ var _compilation_errors;
131953
+ if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
131954
+ const jsonFields = includeList || {};
131955
+ const manifestDir = external_path_.dirname(manifestPath);
131956
+ let added = 0;
131957
+ for (const field of Object.entries(jsonFields)){
131958
+ const [, resource] = field;
131959
+ const resourceArr = Array.isArray(resource) ? resource : [
131960
+ resource
131961
+ ];
131962
+ for (const thisResource of resourceArr)if (thisResource) {
131963
+ const abs = external_path_.isAbsolute(thisResource) ? thisResource : external_path_.join(manifestDir, thisResource);
131964
+ const fileDependencies = new Set(compilation.fileDependencies);
131965
+ if (external_fs_.existsSync(abs)) {
131966
+ if (!fileDependencies.has(abs)) {
131967
+ fileDependencies.add(abs);
131968
+ compilation.fileDependencies.add(abs);
131969
+ added++;
131970
+ }
131971
+ }
131972
+ }
131973
+ }
131974
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonDepsTracked(added));
131975
+ }
130815
131976
  function feature_json_define_property(obj, key, value) {
130816
131977
  if (key in obj) Object.defineProperty(obj, key, {
130817
131978
  value: value,
@@ -130823,39 +131984,6 @@ var __webpack_exports__ = {};
130823
131984
  return obj;
130824
131985
  }
130825
131986
  class JsonPlugin {
130826
- isCriticalJsonFeature(feature) {
130827
- return feature.startsWith('declarative_net_request') || 'storage.managed_schema' === feature;
130828
- }
130829
- validateJsonAsset(compilation, feature, filePath, buf) {
130830
- let parsed;
130831
- try {
130832
- parsed = JSON.parse(buf.toString('utf-8'));
130833
- } catch (e) {
130834
- const err = new core_namespaceObject.WebpackError(invalidJsonSyntax(feature, filePath, String((null == e ? void 0 : e.message) || e)));
130835
- err.file = filePath;
130836
- err.name = 'JSONInvalidSyntax';
130837
- compilation.errors.push(err);
130838
- return false;
130839
- }
130840
- if (feature.startsWith('declarative_net_request')) {
130841
- if (!Array.isArray(parsed)) {
130842
- const err = new core_namespaceObject.WebpackError(invalidRulesetStructure(feature, filePath));
130843
- err.file = filePath;
130844
- err.name = 'DNRInvalidRuleset';
130845
- compilation.errors.push(err);
130846
- return false;
130847
- }
130848
- } else if ('storage.managed_schema' === feature) {
130849
- if (null === parsed || Array.isArray(parsed) || 'object' != typeof parsed) {
130850
- const err = new core_namespaceObject.WebpackError(invalidManagedSchemaStructure(feature, filePath));
130851
- err.file = filePath;
130852
- err.name = 'ManagedSchemaInvalid';
130853
- compilation.errors.push(err);
130854
- return false;
130855
- }
130856
- }
130857
- return true;
130858
- }
130859
131987
  apply(compiler) {
130860
131988
  new ThrowIfManifestJsonChange({
130861
131989
  manifestPath: this.manifestPath,
@@ -130867,85 +131995,7 @@ var __webpack_exports__ = {};
130867
131995
  name: 'json:module',
130868
131996
  stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
130869
131997
  }, ()=>{
130870
- var _compiler_options;
130871
- if (compilation.errors.length > 0) return;
130872
- const jsonFields = this.includeList || {};
130873
- const manifestDir = external_path_.dirname(this.manifestPath);
130874
- const projectPath = (null == (_compiler_options = compiler.options) ? void 0 : _compiler_options.context) || external_path_.dirname(this.manifestPath);
130875
- const publicDir = external_path_.join(projectPath, 'public');
130876
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
130877
- const featureKeys = Object.keys(jsonFields || {});
130878
- const criticalCount = featureKeys.filter((k)=>this.isCriticalJsonFeature(k)).length;
130879
- console.log(jsonIncludeSummary(featureKeys.length, criticalCount));
130880
- }
130881
- for (const field of Object.entries(jsonFields)){
130882
- const [feature, resource] = field;
130883
- let emittedCount = 0;
130884
- let underPublicCount = 0;
130885
- let missingCount = 0;
130886
- let validatedOk = 0;
130887
- let invalid = 0;
130888
- const resourceArr = Array.isArray(resource) ? resource : [
130889
- resource
130890
- ];
130891
- for (const thisResource of resourceArr)if (thisResource) {
130892
- const abs = external_path_.isAbsolute(thisResource) ? thisResource : external_path_.join(manifestDir, thisResource);
130893
- const relToPublic = external_path_.relative(publicDir, abs);
130894
- const isUnderPublic = relToPublic && !relToPublic.startsWith('..') && !external_path_.isAbsolute(relToPublic);
130895
- if (!external_fs_.existsSync(abs)) {
130896
- var _compilation_options_output, _compilation_options;
130897
- const rawRef = String(thisResource);
130898
- const isPublicRoot = rawRef.startsWith('/') && !external_path_.isAbsolute(rawRef);
130899
- const outputRoot = (null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : null == (_compilation_options_output = _compilation_options.output) ? void 0 : _compilation_options_output.path) || '';
130900
- const displayPath = isPublicRoot ? external_path_.join(outputRoot, rawRef.slice(1)) : abs;
130901
- const notFound = new core_namespaceObject.WebpackError(jsonMissingFile(feature, displayPath, {
130902
- publicRootHint: isPublicRoot
130903
- }));
130904
- notFound.name = 'JSONMissingFile';
130905
- notFound.file = 'manifest.json';
130906
- if (this.isCriticalJsonFeature(feature)) compilation.errors.push(notFound);
130907
- else compilation.warnings.push(notFound);
130908
- missingCount++;
130909
- continue;
130910
- }
130911
- if (isUnderPublic) {
130912
- try {
130913
- compilation.fileDependencies.add(abs);
130914
- } catch {}
130915
- if (this.isCriticalJsonFeature(feature)) {
130916
- const ok = this.validateJsonAsset(compilation, feature, abs, external_fs_.readFileSync(abs));
130917
- if (ok) validatedOk++;
130918
- else invalid++;
130919
- if (!ok) continue;
130920
- }
130921
- underPublicCount++;
130922
- continue;
130923
- }
130924
- const source = external_fs_.readFileSync(abs);
130925
- if (this.isCriticalJsonFeature(feature)) {
130926
- const ok = this.validateJsonAsset(compilation, feature, abs, source);
130927
- if (ok) validatedOk++;
130928
- else invalid++;
130929
- if (!ok) continue;
130930
- }
130931
- const rawSource = new core_namespaceObject.sources.RawSource(source);
130932
- const assetName = feature + '.json';
130933
- if ('function' == typeof compilation.getAsset && compilation.getAsset(assetName)) compilation.updateAsset(assetName, rawSource);
130934
- else compilation.emitAsset(assetName, rawSource);
130935
- emittedCount++;
130936
- }
130937
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
130938
- const entries = Array.isArray(resource) ? resource.length : resource ? 1 : 0;
130939
- console.log(jsonEmitSummary(feature, {
130940
- entries,
130941
- underPublic: underPublicCount,
130942
- emitted: emittedCount,
130943
- missing: missingCount,
130944
- validatedOk,
130945
- invalid
130946
- }));
130947
- }
130948
- }
131998
+ processJsonAssets(compilation, this.manifestPath, this.includeList || {});
130949
131999
  });
130950
132000
  });
130951
132001
  compiler.hooks.thisCompilation.tap('json:module', (compilation)=>{
@@ -130953,29 +132003,7 @@ var __webpack_exports__ = {};
130953
132003
  name: 'json:module',
130954
132004
  stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
130955
132005
  }, ()=>{
130956
- var _compilation_errors;
130957
- if (null == (_compilation_errors = compilation.errors) ? void 0 : _compilation_errors.length) return;
130958
- const jsonFields = this.includeList || {};
130959
- const manifestDir = external_path_.dirname(this.manifestPath);
130960
- let added = 0;
130961
- for (const field of Object.entries(jsonFields)){
130962
- const [, resource] = field;
130963
- const resourceArr = Array.isArray(resource) ? resource : [
130964
- resource
130965
- ];
130966
- for (const thisResource of resourceArr)if (thisResource) {
130967
- const abs = external_path_.isAbsolute(thisResource) ? thisResource : external_path_.join(manifestDir, thisResource);
130968
- const fileDependencies = new Set(compilation.fileDependencies);
130969
- if (external_fs_.existsSync(abs)) {
130970
- if (!fileDependencies.has(abs)) {
130971
- fileDependencies.add(abs);
130972
- compilation.fileDependencies.add(abs);
130973
- added++;
130974
- }
130975
- }
130976
- }
130977
- }
130978
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(jsonDepsTracked(added));
132006
+ trackJsonDependencies(compilation, this.manifestPath, this.includeList || {});
130979
132007
  });
130980
132008
  });
130981
132009
  }
@@ -131084,17 +132112,47 @@ var __webpack_exports__ = {};
131084
132112
  for (const entry of stringEntries)if (entry) {
131085
132113
  const manifestDir = external_path_.dirname(this.manifestPath);
131086
132114
  let resolved = entry;
131087
- if (!external_fs_.existsSync(resolved)) resolved = entry.startsWith('/') ? external_path_.join(projectPath, entry.slice(1)) : external_path_.isAbsolute(entry) ? entry : external_path_.join(manifestDir, entry);
132115
+ if (!external_fs_.existsSync(resolved)) if (external_path_.isAbsolute(entry) && entry.startsWith(projectPath)) {
132116
+ const basename = external_path_.basename(entry);
132117
+ const publicCandidate = external_path_.join(publicDir, basename);
132118
+ if ('1' === process.env.EXTENSION_DEV_DEBUG_ICONS) console.log('[icons:emit-file] absolute entry', JSON.stringify({
132119
+ entry,
132120
+ projectPath,
132121
+ publicDir,
132122
+ basename,
132123
+ publicCandidate,
132124
+ exists: external_fs_.existsSync(publicCandidate)
132125
+ }));
132126
+ resolved = external_fs_.existsSync(publicCandidate) ? publicCandidate : entry;
132127
+ } else if (entry.startsWith('/')) {
132128
+ const publicCandidate = external_path_.join(projectPath, 'public', entry.slice(1));
132129
+ if ('1' === process.env.EXTENSION_DEV_DEBUG_ICONS) console.log('[icons:emit-file] leading-slash entry', JSON.stringify({
132130
+ entry,
132131
+ projectPath,
132132
+ publicCandidate,
132133
+ exists: external_fs_.existsSync(publicCandidate)
132134
+ }));
132135
+ resolved = external_fs_.existsSync(publicCandidate) ? publicCandidate : external_path_.join(projectPath, entry.slice(1));
132136
+ } else {
132137
+ const publicCandidate = external_path_.join(publicDir, entry);
132138
+ if ('1' === process.env.EXTENSION_DEV_DEBUG_ICONS) console.log('[icons:emit-file] relative entry', JSON.stringify({
132139
+ entry,
132140
+ projectPath,
132141
+ publicDir,
132142
+ publicCandidate,
132143
+ exists: external_fs_.existsSync(publicCandidate),
132144
+ manifestDir
132145
+ }));
132146
+ resolved = external_fs_.existsSync(publicCandidate) ? publicCandidate : external_path_.isAbsolute(entry) ? entry : external_path_.join(manifestDir, entry);
132147
+ }
131088
132148
  const relToPublic = external_path_.relative(publicDir, resolved);
131089
132149
  const isUnderPublic = relToPublic && !relToPublic.startsWith('..') && !external_path_.isAbsolute(relToPublic) || entry.startsWith('/') && external_fs_.existsSync(external_path_.join(projectPath, 'public', entry.slice(1)));
131090
132150
  if (!external_fs_.existsSync(resolved)) {
131091
- var _compilation_options_output, _compilation_options;
131092
- const isPublicRoot = entry.startsWith('/');
131093
- const outputRoot = (null == (_compilation_options = compilation.options) ? void 0 : null == (_compilation_options_output = _compilation_options.output) ? void 0 : _compilation_options_output.path) || '';
132151
+ const isPublicRoot = entry.startsWith('/') && !entry.startsWith(projectPath);
131094
132152
  const parts = String(feature).split('/');
131095
132153
  const group = parts[0];
131096
132154
  const sub = parts[1] || '';
131097
- const displayPath = !external_path_.isAbsolute(entry) && isPublicRoot ? outputRoot ? external_path_.join(outputRoot, entry.slice(1)) : entry : external_path_.isAbsolute(entry) ? entry : external_path_.join(projectPath, entry);
132155
+ const displayPath = !external_path_.isAbsolute(entry) && isPublicRoot ? external_path_.join(projectPath, 'public', entry.slice(1)) : external_path_.isAbsolute(entry) ? entry : external_path_.join(projectPath, entry);
131098
132156
  const isDefaultIconFamily = ('action' === group || 'browser_action' === group || 'page_action' === group || 'sidebar_action' === group) && 'default_icon' === sub;
131099
132157
  const severity = 'icons' === group || isDefaultIconFamily ? 'error' : 'warning';
131100
132158
  emit_file_reportToCompilation(compilation, iconsMissingFile(feature, displayPath, {
@@ -131302,6 +132360,15 @@ var __webpack_exports__ = {};
131302
132360
  this.browser = options.browser || 'chrome';
131303
132361
  }
131304
132362
  }
132363
+ function normalizeIconIncludeKeys(icons) {
132364
+ const out = {};
132365
+ for (const [key, value] of Object.entries(icons || {}))if ('action' === key) out['action/default_icon'] = value;
132366
+ else if ('browser_action' === key) out['browser_action/default_icon'] = value;
132367
+ else if ('page_action' === key) out['page_action/default_icon'] = value;
132368
+ else if ('sidebar_action' === key) out['sidebar_action/default_icon'] = value;
132369
+ else out[key] = value;
132370
+ return out;
132371
+ }
131305
132372
  function feature_icons_define_property(obj, key, value) {
131306
132373
  if (key in obj) Object.defineProperty(obj, key, {
131307
132374
  value: value,
@@ -131314,15 +132381,6 @@ var __webpack_exports__ = {};
131314
132381
  }
131315
132382
  class IconsPlugin {
131316
132383
  apply(compiler) {
131317
- const normalizeIconIncludeKeys = (icons)=>{
131318
- const out = {};
131319
- for (const [key, value] of Object.entries(icons || {}))if ('action' === key) out['action/default_icon'] = value;
131320
- else if ('browser_action' === key) out['browser_action/default_icon'] = value;
131321
- else if ('page_action' === key) out['page_action/default_icon'] = value;
131322
- else if ('sidebar_action' === key) out['sidebar_action/default_icon'] = value;
131323
- else out[key] = value;
131324
- return out;
131325
- };
131326
132384
  const normalizedIncludeList = normalizeIconIncludeKeys(this.includeList);
131327
132385
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
131328
132386
  const beforeKeys = Object.keys(this.includeList || {});
@@ -131630,17 +132688,32 @@ var __webpack_exports__ = {};
131630
132688
  const handleOne = (matches, res)=>{
131631
132689
  compilation.errors = compilation.errors || [];
131632
132690
  compilation.warnings = compilation.warnings || [];
132691
+ const normalizedOutput = normalizeManifestOutputPath(res);
132692
+ const publicCandidate = external_path_.join(projectPath, 'public', normalizedOutput);
132693
+ if (external_fs_.existsSync(publicCandidate)) return void pushResource(matches, normalizedOutput);
131633
132694
  external_path_.isAbsolute(res) || external_path_.join(manifestDir, isPublicRootLike(res) ? toPublicOutput(res) : res);
131634
132695
  if (/[*?\[\]{}]/.test(res)) return void pushResource(matches, res);
131635
132696
  if (isPublicRootLike(res)) {
131636
- var _compilation_options_output, _compilation_options, _compilation_outputOptions;
131637
- const output = toPublicOutput(res);
132697
+ var _compilation_options_output, _compilation_options, _compilation_outputOptions, _compilation_options1;
132698
+ const output = normalizeManifestOutputPath(res);
131638
132699
  const publicAbs = external_path_.join(projectPath, 'public', output);
131639
132700
  const outputRoot = (null == (_compilation_options = compilation.options) ? void 0 : null == (_compilation_options_output = _compilation_options.output) ? void 0 : _compilation_options_output.path) || (null == (_compilation_outputOptions = compilation.outputOptions) ? void 0 : _compilation_outputOptions.path) || external_path_.join(external_path_.dirname(manifestPath), 'dist');
131640
132701
  const builtAbs = external_path_.join(outputRoot || '', output);
131641
132702
  const asset = 'function' == typeof compilation.getAsset ? compilation.getAsset(output) : void 0;
131642
132703
  const assetEmitted = Boolean(asset && asset.name === output) || external_fs_.existsSync(builtAbs);
131643
- if (!external_fs_.existsSync(publicAbs) && !assetEmitted) {
132704
+ const isDevMode = 'production' !== ((null == (_compilation_options1 = compilation.options) ? void 0 : _compilation_options1.mode) || 'development');
132705
+ if ('1' === process.env.EXTENSION_DEV_DEBUG_WAR) console.log('[web-resources:resolve-war] public-like resource', JSON.stringify({
132706
+ res,
132707
+ output,
132708
+ projectPath,
132709
+ publicAbs,
132710
+ outputRoot,
132711
+ builtAbs,
132712
+ publicExists: external_fs_.existsSync(publicAbs),
132713
+ builtExists: external_fs_.existsSync(builtAbs),
132714
+ assetEmitted
132715
+ }));
132716
+ if (!isDevMode && !external_fs_.existsSync(publicAbs) && !assetEmitted) {
131644
132717
  const overrideNotFoundPath = builtAbs;
131645
132718
  const msg = warFieldError(publicAbs, {
131646
132719
  overrideNotFoundPath,
@@ -131656,21 +132729,13 @@ var __webpack_exports__ = {};
131656
132729
  }
131657
132730
  const abs = external_path_.isAbsolute(res) ? res : external_path_.join(manifestDir, res);
131658
132731
  if (!external_fs_.existsSync(abs)) {
131659
- var _compilation_options_output1, _compilation_options1, _compilation_outputOptions1;
131660
- const outputRoot = (null == (_compilation_options1 = compilation.options) ? void 0 : null == (_compilation_options_output1 = _compilation_options1.output) ? void 0 : _compilation_options_output1.path) || (null == (_compilation_outputOptions1 = compilation.outputOptions) ? void 0 : _compilation_outputOptions1.path) || external_path_.join(external_path_.dirname(manifestPath), 'dist');
132732
+ var _compilation_options_output1, _compilation_options2, _compilation_outputOptions1;
132733
+ const outputRoot = (null == (_compilation_options2 = compilation.options) ? void 0 : null == (_compilation_options_output1 = _compilation_options2.output) ? void 0 : _compilation_options_output1.path) || (null == (_compilation_outputOptions1 = compilation.outputOptions) ? void 0 : _compilation_outputOptions1.path) || external_path_.join(external_path_.dirname(manifestPath), 'dist');
131661
132734
  const builtAbs = external_path_.join(outputRoot || '', res);
131662
132735
  const publicAbsMaybe = external_path_.join(projectPath, 'public', res);
131663
132736
  const asset2 = 'function' == typeof compilation.getAsset ? compilation.getAsset(res) : void 0;
131664
132737
  const assetEmitted = Boolean(asset2 && asset2.name === res) || external_fs_.existsSync(builtAbs);
131665
132738
  if (external_fs_.existsSync(publicAbsMaybe) || assetEmitted) {
131666
- const msg = warFieldError(publicAbsMaybe, {
131667
- publicRootHint: true,
131668
- relativeRef: res
131669
- });
131670
- const warn = new core_namespaceObject.WebpackError(msg);
131671
- warn.file = 'manifest.json';
131672
- warn.name = 'WARPublicRootPathMissingSlash';
131673
- compilation.warnings.push(warn);
131674
132739
  const output = toPublicOutput('/' + res);
131675
132740
  pushResource(matches, output);
131676
132741
  return;
@@ -132058,6 +133123,18 @@ var __webpack_exports__ = {};
132058
133123
  });
132059
133124
  }
132060
133125
  }
133126
+ function checkManifestInPublic(compilation, publicDir) {
133127
+ try {
133128
+ const manifestInPublic = external_path_.join(publicDir, 'manifest.json');
133129
+ if (external_fs_.existsSync(manifestInPublic)) {
133130
+ var _compilation_compiler_webpack;
133131
+ const ErrCtor = null == (_compilation_compiler_webpack = compilation.compiler.webpack) ? void 0 : _compilation_compiler_webpack.WebpackError;
133132
+ const err = new ErrCtor(`manifest.json must not be placed under public/: ${manifestInPublic}`);
133133
+ err.file = 'manifest.json';
133134
+ compilation.errors.push(err);
133135
+ }
133136
+ } catch {}
133137
+ }
132061
133138
  function feature_special_folders_define_property(obj, key, value) {
132062
133139
  if (key in obj) Object.defineProperty(obj, key, {
132063
133140
  value: value,
@@ -132079,16 +133156,7 @@ var __webpack_exports__ = {};
132079
133156
  name: `${SpecialFoldersPlugin.name}:guards`,
132080
133157
  stage: compilation.constructor.PROCESS_ASSETS_STAGE_PRE_PROCESS
132081
133158
  }, ()=>{
132082
- try {
132083
- const manifestInPublic = external_path_.join(publicDir, 'manifest.json');
132084
- if (external_fs_.existsSync(manifestInPublic)) {
132085
- var _compilation_compiler_webpack;
132086
- const ErrCtor = null == (_compilation_compiler_webpack = compilation.compiler.webpack) ? void 0 : _compilation_compiler_webpack.WebpackError;
132087
- const err = new ErrCtor(`manifest.json must not be placed under public/: ${manifestInPublic}`);
132088
- err.file = 'manifest.json';
132089
- compilation.errors.push(err);
132090
- }
132091
- } catch {}
133159
+ checkManifestInPublic(compilation, publicDir);
132092
133160
  });
132093
133161
  });
132094
133162
  new core_namespaceObject.rspack.CopyRspackPlugin({
@@ -132117,6 +133185,11 @@ var __webpack_exports__ = {};
132117
133185
  }
132118
133186
  }
132119
133187
  feature_special_folders_define_property(SpecialFoldersPlugin, "name", 'plugin-special-folders');
133188
+ function getSpecialFoldersDataForCompiler(compiler) {
133189
+ return (0, external_browser_extension_manifest_fields_namespaceObject.getSpecialFoldersData)({
133190
+ manifestPath: external_path_default().join(compiler.options.context || '', 'package.json')
133191
+ });
133192
+ }
132120
133193
  function plugin_extension_define_property(obj, key, value) {
132121
133194
  if (key in obj) Object.defineProperty(obj, key, {
132122
133195
  value: value,
@@ -132134,9 +133207,7 @@ var __webpack_exports__ = {};
132134
133207
  manifestPath,
132135
133208
  browser: this.browser
132136
133209
  });
132137
- const specialFoldersData = (0, external_browser_extension_manifest_fields_namespaceObject.getSpecialFoldersData)({
132138
- manifestPath: external_path_default().join(compiler.options.context || '', 'package.json')
132139
- });
133210
+ const specialFoldersData = getSpecialFoldersDataForCompiler(compiler);
132140
133211
  new ManifestPlugin({
132141
133212
  browser: this.browser,
132142
133213
  manifestPath,
@@ -132195,8 +133266,20 @@ var __webpack_exports__ = {};
132195
133266
  }
132196
133267
  }
132197
133268
  plugin_extension_define_property(ExtensionPlugin, "name", 'plugin-extension');
133269
+ function messages_getLoggingPrefix(type) {
133270
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133271
+ if (isAuthor) {
133272
+ const base = 'error' === type ? 'ERROR Author says' : "\u25BA\u25BA\u25BA Author says";
133273
+ return external_pintor_default().brightMagenta(base);
133274
+ }
133275
+ if ('error' === type) return external_pintor_default().red('ERROR');
133276
+ if ('warn' === type) return external_pintor_default().brightYellow("\u25BA\u25BA\u25BA");
133277
+ if ('info' === type) return external_pintor_default().gray("\u25BA\u25BA\u25BA");
133278
+ return external_pintor_default().green("\u25BA\u25BA\u25BA");
133279
+ }
133280
+ const messages_code = (text)=>external_pintor_default().blue(text);
132198
133281
  function webextensionPolyfillNotFound() {
132199
- return `Warning: webextension-polyfill not found. Browser API polyfill will not be available.\nTo fix this, install webextension-polyfill: npm install webextension-polyfill`;
133282
+ return `${messages_getLoggingPrefix('warn')} webextension-polyfill not found.\nInstall it to enable the browser API polyfill:\n${messages_code('npm install webextension-polyfill')}`;
132200
133283
  }
132201
133284
  function capitalizedBrowserName(browser) {
132202
133285
  const b = String(browser || '');
@@ -132422,8 +133505,21 @@ var __webpack_exports__ = {};
132422
133505
  instanceId: options.instanceId
132423
133506
  };
132424
133507
  }
132425
- function messages_getLoggingPrefix(type) {
132426
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) return external_pintor_default().brightMagenta('error' === type ? 'ERROR' : "\u25BA\u25BA\u25BA");
133508
+ const external_chrome_location2_namespaceObject = require("chrome-location2");
133509
+ var external_chrome_location2_default = /*#__PURE__*/ __webpack_require__.n(external_chrome_location2_namespaceObject);
133510
+ const external_chromium_location_namespaceObject = require("chromium-location");
133511
+ var external_chromium_location_default = /*#__PURE__*/ __webpack_require__.n(external_chromium_location_namespaceObject);
133512
+ const external_edge_location_namespaceObject = require("edge-location");
133513
+ var external_edge_location_default = /*#__PURE__*/ __webpack_require__.n(external_edge_location_namespaceObject);
133514
+ const external_firefox_location2_namespaceObject = require("firefox-location2");
133515
+ var external_firefox_location2_default = /*#__PURE__*/ __webpack_require__.n(external_firefox_location2_namespaceObject);
133516
+ const messages_require = (0, external_module_.createRequire)(__rslib_import_meta_url__);
133517
+ function browsers_lib_messages_getLoggingPrefix(type) {
133518
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133519
+ if (isAuthor) {
133520
+ const base = 'error' === type ? 'ERROR Author says' : "\u25BA\u25BA\u25BA Author says";
133521
+ return external_pintor_default().brightMagenta(base);
133522
+ }
132427
133523
  if ('error' === type) return external_pintor_default().red('ERROR');
132428
133524
  if ('warn' === type) return external_pintor_default().brightYellow("\u25BA\u25BA\u25BA");
132429
133525
  if ('info' === type) return external_pintor_default().gray("\u25BA\u25BA\u25BA");
@@ -132435,20 +133531,20 @@ var __webpack_exports__ = {};
132435
133531
  return String(maybe || error);
132436
133532
  }
132437
133533
  function messages_capitalizedBrowserName(browser) {
132438
- return external_pintor_default().yellow(`${browser.charAt(0).toUpperCase() + browser.slice(1)}`);
133534
+ return `${browser.charAt(0).toUpperCase() + browser.slice(1)}`;
132439
133535
  }
132440
133536
  function creatingUserProfile(profilePath) {
132441
- return `${messages_getLoggingPrefix('info')} Creating a fresh user profile at ${external_pintor_default().underline(profilePath)}...`;
133537
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Creating a fresh user profile at ${external_pintor_default().underline(profilePath)}...`;
132442
133538
  }
132443
133539
  function browserInstanceExited(browser) {
132444
- return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} instance exited.`;
133540
+ return `${browsers_lib_messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} instance exited.`;
132445
133541
  }
132446
133542
  function stdoutData(browser, mode) {
132447
133543
  const extensionOutput = 'firefox' === browser || 'gecko-based' === browser ? 'Add-on' : 'Extension';
132448
- return `${messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().green(mode || 'unknown')} mode.`;
133544
+ return `${browsers_lib_messages_getLoggingPrefix('info')} ${messages_capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().green(mode || 'unknown')} mode.`;
132449
133545
  }
132450
133546
  function cdpClientAttachedToTarget(sessionId, targetType) {
132451
- return `${messages_getLoggingPrefix('info')} Attached to target: ${targetType} (session ${sessionId})`;
133547
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Attached to target: ${targetType} (session ${sessionId})`;
132452
133548
  }
132453
133549
  function cdpPendingRejectFailed(message) {
132454
133550
  return `[CDP] Pending request reject failed: ${message}`;
@@ -132470,98 +133566,98 @@ var __webpack_exports__ = {};
132470
133566
  }
132471
133567
  function firefoxRdpReloadCapabilitySummary(mode) {
132472
133568
  const txt = 'native' === mode ? 'native reloadAddon' : 'reinstall fallback';
132473
- return `${messages_getLoggingPrefix('info')} Firefox RDP reload: ${txt}`;
133569
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Firefox RDP reload: ${txt}`;
132474
133570
  }
132475
133571
  function rdpAddTabFailed(message) {
132476
133572
  return `[RDP] addTab failed: ${message}`;
132477
133573
  }
132478
133574
  function skippingBrowserLaunchDueToCompileErrors() {
132479
- return `${messages_getLoggingPrefix('warn')} Skipping browser launch due to compile errors`;
133575
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Skipping browser launch due to compile errors`;
132480
133576
  }
132481
133577
  function browserNotInstalledError(browser, browserBinaryLocation) {
132482
133578
  const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${messages_capitalizedBrowserName(browser)} is not installed\n` : `Can't find the path for browser ${messages_capitalizedBrowserName(browser)}\n`;
132483
- return `${messages_getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${external_pintor_default().blue('--browser')} ${external_pintor_default().gray('<chrome|edge|firefox>')}.\n\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(browserBinaryLocation || messages_capitalizedBrowserName(browser) + 'BROWSER')}`;
133579
+ return `${browsers_lib_messages_getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${external_pintor_default().blue('--browser')} ${external_pintor_default().gray('<chrome|edge|firefox>')}.\n\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(browserBinaryLocation || messages_capitalizedBrowserName(browser) + 'BROWSER')}`;
132484
133580
  }
132485
133581
  function browserLaunchError(browser, error) {
132486
- return `${messages_getLoggingPrefix('error')} Error launching ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
133582
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Error launching ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
132487
133583
  }
132488
133584
  function enhancedProcessManagementCleanup(browser) {
132489
- return `${messages_getLoggingPrefix('info')} Process Management cleanup for ${messages_capitalizedBrowserName(browser)}`;
133585
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Process Management cleanup for ${messages_capitalizedBrowserName(browser)}`;
132490
133586
  }
132491
133587
  function enhancedProcessManagementTerminating(browser) {
132492
- return `${messages_getLoggingPrefix('info')} Terminating ${messages_capitalizedBrowserName(browser)} process gracefully`;
133588
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Terminating ${messages_capitalizedBrowserName(browser)} process gracefully`;
132493
133589
  }
132494
133590
  function enhancedProcessManagementForceKill(browser) {
132495
- return `${messages_getLoggingPrefix('error')} Force killing ${messages_capitalizedBrowserName(browser)} process after timeout`;
133591
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Force killing ${messages_capitalizedBrowserName(browser)} process after timeout`;
132496
133592
  }
132497
133593
  function enhancedProcessManagementCleanupError(browser, error) {
132498
- return `${messages_getLoggingPrefix('error')} Error during ${messages_capitalizedBrowserName(browser)} cleanup:\n${external_pintor_default().red(errorDetail(error))}`;
133594
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Error during ${messages_capitalizedBrowserName(browser)} cleanup:\n${external_pintor_default().red(errorDetail(error))}`;
132499
133595
  }
132500
133596
  function enhancedProcessManagementUncaughtException(browser, error) {
132501
- return `${messages_getLoggingPrefix('error')} Uncaught exception in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(error))}`;
133597
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Uncaught exception in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(error))}`;
132502
133598
  }
132503
133599
  function enhancedProcessManagementUnhandledRejection(browser, reason) {
132504
- return `${messages_getLoggingPrefix('error')} Unhandled rejection in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(reason))}`;
133600
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Unhandled rejection in ${messages_capitalizedBrowserName(browser)} process:\n${external_pintor_default().red(errorDetail(reason))}`;
132505
133601
  }
132506
133602
  function generalBrowserError(browser, error) {
132507
- return `${messages_getLoggingPrefix('error')} General error in ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
133603
+ return `${browsers_lib_messages_getLoggingPrefix('error')} General error in ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
132508
133604
  }
132509
133605
  function errorConnectingToBrowser(browser) {
132510
- return `${messages_getLoggingPrefix('error')} Unable to connect to ${messages_capitalizedBrowserName(browser)}. Too many retries.`;
133606
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Unable to connect to ${messages_capitalizedBrowserName(browser)}. Too many retries.`;
132511
133607
  }
132512
133608
  function addonInstallError(browser, message) {
132513
- return `${messages_getLoggingPrefix('error')} Can't install add-on into ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(message)}`;
133609
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Can't install add-on into ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(message)}`;
132514
133610
  }
132515
133611
  function messagingClientClosedError(browser) {
132516
- return `${messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
133612
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Messaging client closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
132517
133613
  }
132518
133614
  function connectionClosedError(browser) {
132519
- return `${messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
133615
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Connection closed unexpectedly for ${messages_capitalizedBrowserName(browser)}`;
132520
133616
  }
132521
133617
  function targetActorHasActiveRequestError(browser, targetActor) {
132522
- return `${messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${messages_capitalizedBrowserName(browser)}`;
133618
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Target actor ${external_pintor_default().gray(targetActor)} has active request for ${messages_capitalizedBrowserName(browser)}`;
132523
133619
  }
132524
133620
  function parsingPacketError(browser, error) {
132525
- return `${messages_getLoggingPrefix('error')} Failed to parse packet from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
133621
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to parse packet from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(errorDetail(error))}`;
132526
133622
  }
132527
133623
  function messageWithoutSenderError(browser, message) {
132528
- return `${messages_getLoggingPrefix('error')} Message without sender from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(JSON.stringify(message))}`;
133624
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Message without sender from ${messages_capitalizedBrowserName(browser)}:\n${external_pintor_default().red(JSON.stringify(message))}`;
132529
133625
  }
132530
133626
  function profileFallbackWarning(browser, reason) {
132531
- return `${external_pintor_default().brightYellow("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightYellow('Dev')} ${messages_capitalizedBrowserName(browser)} falling back to per-instance profile` + (reason ? `: ${external_pintor_default().gray(reason)}` : '');
133627
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} ${messages_capitalizedBrowserName(browser)} falling back to per-instance profile` + (reason ? `: ${external_pintor_default().gray(reason)}` : '');
132532
133628
  }
132533
133629
  function chromeProcessExited(code) {
132534
- return `${messages_getLoggingPrefix('info')} Chrome process exited with code: ${external_pintor_default().gray(code.toString())}`;
133630
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome process exited with code: ${external_pintor_default().gray(code.toString())}`;
132535
133631
  }
132536
133632
  function chromeProcessError(error) {
132537
- return `${messages_getLoggingPrefix('error')} Chrome process error:\n${external_pintor_default().red(errorDetail(error))}`;
133633
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome process error:\n${external_pintor_default().red(errorDetail(error))}`;
132538
133634
  }
132539
133635
  function chromeFailedToSpawn(error) {
132540
- return `${messages_getLoggingPrefix('error')} Failed to spawn Chrome:\n${external_pintor_default().red(errorDetail(error))}`;
133636
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to spawn Chrome:\n${external_pintor_default().red(errorDetail(error))}`;
132541
133637
  }
132542
133638
  function chromeInitializingEnhancedReload() {
132543
- return `${messages_getLoggingPrefix('info')} Initializing enhanced reload service with direct spawn for Chrome`;
133639
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Initializing enhanced reload service with direct spawn for Chrome`;
132544
133640
  }
132545
133641
  function locatingBrowser(browser) {
132546
- return `${messages_getLoggingPrefix('info')} Locating ${messages_capitalizedBrowserName(browser)} browser binary...`;
133642
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Locating ${messages_capitalizedBrowserName(browser)} browser binary...`;
132547
133643
  }
132548
133644
  function devChromeProfilePath(path) {
132549
- return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Chrome profile: ${external_pintor_default().underline(path)}`;
133645
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome profile: ${external_pintor_default().underline(path)}`;
132550
133646
  }
132551
133647
  function usingChromiumRunner(browser) {
132552
- return `${messages_getLoggingPrefix('info')} Using Chromium runner for ${messages_capitalizedBrowserName(browser)}`;
133648
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Using Chromium runner for ${messages_capitalizedBrowserName(browser)}`;
132553
133649
  }
132554
133650
  function usingFirefoxRunner(browser) {
132555
- return `${messages_getLoggingPrefix('info')} Using Firefox runner for ${messages_capitalizedBrowserName(browser)}`;
133651
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Using Firefox runner for ${messages_capitalizedBrowserName(browser)}`;
132556
133652
  }
132557
133653
  function chromiumDryRunNotLaunching() {
132558
- return `${messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
133654
+ return `${browsers_lib_messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
132559
133655
  }
132560
133656
  function chromiumDryRunBinary(path) {
132561
- return `${messages_getLoggingPrefix('info')} [plugin-browsers] Binary: ${external_pintor_default().underline(path)}`;
133657
+ return `${browsers_lib_messages_getLoggingPrefix('info')} [plugin-browsers] Binary: ${external_pintor_default().underline(path)}`;
132562
133658
  }
132563
133659
  function chromiumDryRunFlags(flags) {
132564
- return `${messages_getLoggingPrefix('info')} [plugin-browsers] Flags: ${external_pintor_default().gray(flags)}`;
133660
+ return `${browsers_lib_messages_getLoggingPrefix('info')} [plugin-browsers] Flags: ${external_pintor_default().gray(flags)}`;
132565
133661
  }
132566
133662
  function prettyPuppeteerInstallGuidance(browser, rawGuidance, cacheDir) {
132567
133663
  const dim = external_pintor_default().gray;
@@ -132572,23 +133668,19 @@ var __webpack_exports__ = {};
132572
133668
  if (looksMinimal) {
132573
133669
  const b = String(browser || '').toLowerCase();
132574
133670
  if ('chromium' === b || 'chromium-based' === b) try {
132575
- const loc = __webpack_require__("chromium-location");
132576
- const txt = 'function' == typeof (null == loc ? void 0 : loc.getInstallGuidance) ? loc.getInstallGuidance() : '';
133671
+ const txt = (0, external_chromium_location_namespaceObject.getInstallGuidance)();
132577
133672
  if (txt && 'string' == typeof txt) cleaned = String(txt).trim();
132578
133673
  } catch {}
132579
133674
  else if ('chrome' === b) try {
132580
- const loc = __webpack_require__("chrome-location2");
132581
- const txt = 'function' == typeof (null == loc ? void 0 : loc.getInstallGuidance) ? loc.getInstallGuidance() : '';
133675
+ const txt = (0, external_chrome_location2_namespaceObject.getInstallGuidance)();
132582
133676
  if (txt && 'string' == typeof txt) cleaned = String(txt).trim();
132583
133677
  } catch {}
132584
133678
  else if ('firefox' === b || 'gecko-based' === b) try {
132585
- const loc = __webpack_require__("firefox-location2");
132586
- const txt = 'function' == typeof (null == loc ? void 0 : loc.getInstallGuidance) ? loc.getInstallGuidance() : '';
133679
+ const txt = (0, external_firefox_location2_namespaceObject.getInstallGuidance)();
132587
133680
  if (txt && 'string' == typeof txt) cleaned = String(txt).trim();
132588
133681
  } catch {}
132589
133682
  else if ('edge' === b) try {
132590
- const loc = __webpack_require__("edge-location");
132591
- const txt = 'function' == typeof (null == loc ? void 0 : loc.getInstallGuidance) ? loc.getInstallGuidance() : '';
133683
+ const txt = (0, external_edge_location_namespaceObject.getInstallGuidance)();
132592
133684
  if (txt && 'string' == typeof txt) cleaned = String(txt).trim();
132593
133685
  } catch {}
132594
133686
  }
@@ -132624,163 +133716,163 @@ var __webpack_exports__ = {};
132624
133716
  return body.join('\n') + '\n';
132625
133717
  }
132626
133718
  function firefoxLaunchCalled() {
132627
- return `${messages_getLoggingPrefix('info')} launchFirefox called!`;
133719
+ return `${browsers_lib_messages_getLoggingPrefix('info')} launchFirefox called!`;
132628
133720
  }
132629
133721
  function firefoxBinaryArgsExtracted(args) {
132630
- return `${messages_getLoggingPrefix('info')} Firefox binary args extracted: ${external_pintor_default().gray(args)}`;
133722
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Firefox binary args extracted: ${external_pintor_default().gray(args)}`;
132631
133723
  }
132632
133724
  function firefoxNoBinaryArgsFound() {
132633
- return `${messages_getLoggingPrefix('info')} No Firefox binary args found`;
133725
+ return `${browsers_lib_messages_getLoggingPrefix('info')} No Firefox binary args found`;
132634
133726
  }
132635
133727
  function firefoxFailedToStart(error) {
132636
- return `${messages_getLoggingPrefix('error')} Firefox failed to start:\n${external_pintor_default().red(errorDetail(error))}`;
133728
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Firefox failed to start:\n${external_pintor_default().red(errorDetail(error))}`;
132637
133729
  }
132638
133730
  function firefoxDryRunNotLaunching() {
132639
- return `${messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
133731
+ return `${browsers_lib_messages_getLoggingPrefix('info')} [plugin-browsers] Dry run: not launching browser`;
132640
133732
  }
132641
133733
  function firefoxDryRunBinary(path) {
132642
- return `${messages_getLoggingPrefix('info')} [plugin-browsers] Binary (detected): ${external_pintor_default().underline(path)}`;
133734
+ return `${browsers_lib_messages_getLoggingPrefix('info')} [plugin-browsers] Binary (detected): ${external_pintor_default().underline(path)}`;
132643
133735
  }
132644
133736
  function firefoxDryRunConfig(cfg) {
132645
- return `${messages_getLoggingPrefix('info')} [plugin-browsers] Config: ${external_pintor_default().gray(cfg)}`;
133737
+ return `${browsers_lib_messages_getLoggingPrefix('info')} [plugin-browsers] Config: ${external_pintor_default().gray(cfg)}`;
132646
133738
  }
132647
133739
  function sourceInspectorInitialized() {
132648
- return `${messages_getLoggingPrefix('info')} Chrome source inspector initialized successfully`;
133740
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome source inspector initialized successfully`;
132649
133741
  }
132650
133742
  function sourceInspectorInitializationFailed(error) {
132651
- return `${messages_getLoggingPrefix('error')} Failed to initialize Chrome source inspector: ${external_pintor_default().red(error)}`;
133743
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to initialize Chrome source inspector: ${external_pintor_default().red(error)}`;
132652
133744
  }
132653
133745
  function sourceInspectorChromeDebuggingRequired(port) {
132654
133746
  try {
132655
133747
  const p = Number(port);
132656
133748
  const shown = Number.isFinite(p) && p > 0 ? p : 9222;
132657
- return `${messages_getLoggingPrefix('error')} Chrome is not running with remote debugging enabled on port ${external_pintor_default().gray(shown.toString())}. Ensure Chrome is launched with ${external_pintor_default().blue('--remote-debugging-port')}=${external_pintor_default().gray(shown.toString())}`;
133749
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome is not running with remote debugging enabled on port ${external_pintor_default().gray(shown.toString())}. Ensure Chrome is launched with ${external_pintor_default().blue('--remote-debugging-port')}=${external_pintor_default().gray(shown.toString())}`;
132658
133750
  } catch {
132659
- return `${messages_getLoggingPrefix('error')} Chrome is not running with remote debugging enabled on port ${external_pintor_default().gray('9222')}. Ensure Chrome is launched with ${external_pintor_default().blue('--remote-debugging-port')}=${external_pintor_default().gray('9222')}`;
133751
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome is not running with remote debugging enabled on port ${external_pintor_default().gray('9222')}. Ensure Chrome is launched with ${external_pintor_default().blue('--remote-debugging-port')}=${external_pintor_default().gray('9222')}`;
132660
133752
  }
132661
133753
  }
132662
133754
  function sourceInspectorFirefoxDebuggingRequired(port) {
132663
- return `${messages_getLoggingPrefix('error')} Firefox is not running with remote debugging enabled on port ${external_pintor_default().gray(port.toString())}. Ensure Firefox is launched with ${external_pintor_default().blue('-start-debugger-server')} ${external_pintor_default().gray(port.toString())}`;
133755
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Firefox is not running with remote debugging enabled on port ${external_pintor_default().gray(port.toString())}. Ensure Firefox is launched with ${external_pintor_default().blue('-start-debugger-server')} ${external_pintor_default().gray(port.toString())}`;
132664
133756
  }
132665
133757
  function sourceInspectorWaitingForFirefox() {
132666
- return `${messages_getLoggingPrefix('info')} Waiting for Firefox to be ready with remote debugging...`;
133758
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Waiting for Firefox to be ready with remote debugging...`;
132667
133759
  }
132668
133760
  function firefoxRemoteDebuggingReady() {
132669
- return `${messages_getLoggingPrefix('success')} Firefox is ready with remote debugging!`;
133761
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Firefox is ready with remote debugging!`;
132670
133762
  }
132671
133763
  function sourceInspectorFirefoxNotReadyYet(retries, maxRetries) {
132672
- return `${messages_getLoggingPrefix('warn')} Firefox not ready yet, retrying... (${external_pintor_default().gray(retries.toString())}/${external_pintor_default().gray(maxRetries.toString())})`;
133764
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Firefox not ready yet, retrying... (${external_pintor_default().gray(retries.toString())}/${external_pintor_default().gray(maxRetries.toString())})`;
132673
133765
  }
132674
133766
  function sourceInspectorWaitingForChrome() {
132675
- return `${messages_getLoggingPrefix('info')} Waiting for Chrome to be ready with remote debugging...`;
133767
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Waiting for Chrome to be ready with remote debugging...`;
132676
133768
  }
132677
133769
  function chromeRemoteDebuggingReady() {
132678
- return `${messages_getLoggingPrefix('success')} Chrome is ready with remote debugging!`;
133770
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome is ready with remote debugging!`;
132679
133771
  }
132680
133772
  function sourceInspectorChromeNotReadyYet(retries, maxRetries) {
132681
- return `${messages_getLoggingPrefix('warn')} Chrome not ready yet, retrying... (${external_pintor_default().gray(retries.toString())}/${external_pintor_default().gray(maxRetries.toString())})`;
133773
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome not ready yet, retrying... (${external_pintor_default().gray(retries.toString())}/${external_pintor_default().gray(maxRetries.toString())})`;
132682
133774
  }
132683
133775
  function sourceInspectorOpeningUrl(url) {
132684
- return `${messages_getLoggingPrefix('info')} Chrome is opening URL: ${external_pintor_default().underline(url)}`;
133776
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is opening URL: ${external_pintor_default().underline(url)}`;
132685
133777
  }
132686
133778
  function sourceInspectorWaitingForPageLoad() {
132687
- return `${messages_getLoggingPrefix('info')} Chrome is waiting for the page to load...`;
133779
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is waiting for the page to load...`;
132688
133780
  }
132689
133781
  function sourceInspectorCreatingTarget() {
132690
- return `${messages_getLoggingPrefix('info')} Chrome is creating a new target...`;
133782
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is creating a new target...`;
132691
133783
  }
132692
133784
  function sourceInspectorFindingExistingTarget() {
132693
- return `${messages_getLoggingPrefix('info')} Chrome is finding an existing target...`;
133785
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is finding an existing target...`;
132694
133786
  }
132695
133787
  function sourceInspectorUsingExistingTarget(targetId) {
132696
- return `${messages_getLoggingPrefix('info')} Chrome is using existing target with ID: ${external_pintor_default().gray(targetId)}`;
133788
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is using existing target with ID: ${external_pintor_default().gray(targetId)}`;
132697
133789
  }
132698
133790
  function sourceInspectorTargetCreated(targetId) {
132699
- return `${messages_getLoggingPrefix('success')} Chrome created a target with ID: ${external_pintor_default().gray(targetId)}`;
133791
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome created a target with ID: ${external_pintor_default().gray(targetId)}`;
132700
133792
  }
132701
133793
  function sourceInspectorAttachingToTarget() {
132702
- return `${messages_getLoggingPrefix('info')} Chrome is attaching to the target...`;
133794
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is attaching to the target...`;
132703
133795
  }
132704
133796
  function sourceInspectorAttachedToTarget(sessionId) {
132705
- return `${messages_getLoggingPrefix('success')} Chrome is attached to the target with session ID: ${external_pintor_default().gray(sessionId)}`;
133797
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome is attached to the target with session ID: ${external_pintor_default().gray(sessionId)}`;
132706
133798
  }
132707
133799
  function sourceInspectorHTMLExtractionComplete() {
132708
- return `${messages_getLoggingPrefix('success')} Chrome HTML extraction is complete`;
133800
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome HTML extraction is complete`;
132709
133801
  }
132710
133802
  function sourceInspectorInspectionFailed(error) {
132711
- return `${messages_getLoggingPrefix('error')} Failed to inspect Chrome source: ${external_pintor_default().red(error)}`;
133803
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to inspect Chrome source: ${external_pintor_default().red(error)}`;
132712
133804
  }
132713
133805
  function sourceInspectorStartingWatchMode() {
132714
- return `${messages_getLoggingPrefix('info')} Chrome is starting watch mode for sources...`;
133806
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is starting watch mode for sources...`;
132715
133807
  }
132716
133808
  function sourceInspectorWatchModeActive() {
132717
- return `${messages_getLoggingPrefix('info')} Chrome HTML will be updated automatically when files change`;
133809
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome HTML will be updated automatically when files change`;
132718
133810
  }
132719
133811
  function sourceInspectorWatchModeStopped() {
132720
- return `${messages_getLoggingPrefix('warn')} Chrome source inspector watch mode stopped`;
133812
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome source inspector watch mode stopped`;
132721
133813
  }
132722
133814
  function sourceInspectorCDPConnectionMaintained() {
132723
- return `${messages_getLoggingPrefix('info')} Chrome CDP connection maintained for continuous monitoring`;
133815
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome CDP connection maintained for continuous monitoring`;
132724
133816
  }
132725
133817
  function sourceInspectorNoActiveSession() {
132726
- return `${messages_getLoggingPrefix('warn')} No active Chrome CDP session for file change monitoring`;
133818
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} No active Chrome CDP session for file change monitoring`;
132727
133819
  }
132728
133820
  function sourceInspectorReExtractingHTML() {
132729
- return `${messages_getLoggingPrefix('info')} Chrome is re-extracting page HTML after a file change...`;
133821
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is re-extracting page HTML after a file change...`;
132730
133822
  }
132731
133823
  function sourceInspectorAttemptingReconnection() {
132732
- return `${messages_getLoggingPrefix('warn')} Chrome is attempting to reconnect to the target...`;
133824
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome is attempting to reconnect to the target...`;
132733
133825
  }
132734
133826
  function sourceInspectorCannotReconnect() {
132735
- return `${messages_getLoggingPrefix('error')} Chrome cannot reconnect: missing CDP client or target ID`;
133827
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome cannot reconnect: missing CDP client or target ID`;
132736
133828
  }
132737
133829
  function sourceInspectorReconnectingToTarget() {
132738
- return `${messages_getLoggingPrefix('info')} Chrome is reconnecting to the target...`;
133830
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome is reconnecting to the target...`;
132739
133831
  }
132740
133832
  function sourceInspectorReconnectedToTarget(sessionId) {
132741
- return `${messages_getLoggingPrefix('success')} Chrome reconnected to target with session ID: ${external_pintor_default().gray(sessionId)}`;
133833
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome reconnected to target with session ID: ${external_pintor_default().gray(sessionId)}`;
132742
133834
  }
132743
133835
  function sourceInspectorReconnectionFailed(error) {
132744
- return `${messages_getLoggingPrefix('error')} Failed to reconnect to Chrome target: ${external_pintor_default().red(error)}`;
133836
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to reconnect to Chrome target: ${external_pintor_default().red(error)}`;
132745
133837
  }
132746
133838
  function sourceInspectorEnsuringNavigation() {
132747
- return `${messages_getLoggingPrefix('info')} Chrome ensuring target navigates to URL...`;
133839
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome ensuring target navigates to URL...`;
132748
133840
  }
132749
133841
  function sourceInspectorEnablingPageDomain() {
132750
- return `${messages_getLoggingPrefix('info')} Chrome enabling page domain for load events...`;
133842
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome enabling page domain for load events...`;
132751
133843
  }
132752
133844
  function sourceInspectorWaitingForContentScripts() {
132753
- return `${messages_getLoggingPrefix('info')} Chrome waiting for content scripts to inject...`;
133845
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome waiting for content scripts to inject...`;
132754
133846
  }
132755
133847
  function sourceInspectorWaitingForContentScriptReinjection() {
132756
- return `${messages_getLoggingPrefix('info')} Chrome waiting for content scripts to reinject...`;
133848
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome waiting for content scripts to reinject...`;
132757
133849
  }
132758
133850
  function sourceInspectorFileChanged() {
132759
- return `${messages_getLoggingPrefix('warn')} Chrome source file changed, updating HTML...`;
133851
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome source file changed, updating HTML...`;
132760
133852
  }
132761
133853
  function sourceInspectorHTMLUpdateFailed(error) {
132762
- return `${messages_getLoggingPrefix('error')} Failed to update Chrome HTML: ${external_pintor_default().red(error)}`;
133854
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to update Chrome HTML: ${external_pintor_default().red(error)}`;
132763
133855
  }
132764
133856
  function sourceInspectorCleanupComplete() {
132765
- return `${messages_getLoggingPrefix('success')} Chrome source inspector cleaned up`;
133857
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome source inspector cleaned up`;
132766
133858
  }
132767
133859
  function sourceInspectorCleanupError(error) {
132768
- return `${messages_getLoggingPrefix('error')} Error during Chrome cleanup: ${external_pintor_default().red(error)}`;
133860
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Error during Chrome cleanup: ${external_pintor_default().red(error)}`;
132769
133861
  }
132770
133862
  function sourceInspectorNotInitialized() {
132771
- return `${messages_getLoggingPrefix('error')} Chrome source inspector not initialized`;
133863
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome source inspector not initialized`;
132772
133864
  }
132773
133865
  function sourceInspectorInvalidWebSocketServer() {
132774
- return `${messages_getLoggingPrefix('warn')} Chrome invalid WebSocket server provided`;
133866
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome invalid WebSocket server provided`;
132775
133867
  }
132776
133868
  function sourceInspectorUrlRequired() {
132777
- return `${messages_getLoggingPrefix('error')} Chrome source inspection requires either ${external_pintor_default().blue('--source')} ${external_pintor_default().gray('<url>')} or ${external_pintor_default().blue('--starting-url')} ${external_pintor_default().gray('<url>')} to be specified`;
133869
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome source inspection requires either ${external_pintor_default().blue('--source')} ${external_pintor_default().gray('<url>')} or ${external_pintor_default().blue('--starting-url')} ${external_pintor_default().gray('<url>')} to be specified`;
132778
133870
  }
132779
133871
  function sourceInspectorWillInspect(url) {
132780
- return `${messages_getLoggingPrefix('info')} Chrome source inspection will inspect: ${external_pintor_default().underline(url)}`;
133872
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome source inspection will inspect: ${external_pintor_default().underline(url)}`;
132781
133873
  }
132782
133874
  function sourceInspectorSetupFailed(error) {
132783
- return `${messages_getLoggingPrefix('error')} Failed to setup Chrome source inspection: ${external_pintor_default().red(error)}`;
133875
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to setup Chrome source inspection: ${external_pintor_default().red(error)}`;
132784
133876
  }
132785
133877
  function sourceInspectorHTMLOutputHeader() {
132786
133878
  return '\n' + '='.repeat(80);
@@ -132792,62 +133884,63 @@ var __webpack_exports__ = {};
132792
133884
  return '='.repeat(80) + '\n';
132793
133885
  }
132794
133886
  function sourceInspectorClientNotInitialized() {
132795
- return `${messages_getLoggingPrefix('error')} Firefox source inspector client not initialized`;
133887
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Firefox source inspector client not initialized`;
132796
133888
  }
132797
133889
  function sourceInspectorNoTabActorAvailable() {
132798
- return `${messages_getLoggingPrefix('error')} No Firefox tab actor available for navigation`;
133890
+ return `${browsers_lib_messages_getLoggingPrefix('error')} No Firefox tab actor available for navigation`;
132799
133891
  }
132800
133892
  function sourceInspectorNoTabTargetFound() {
132801
- return `${messages_getLoggingPrefix('error')} No Firefox tab target found`;
133893
+ return `${browsers_lib_messages_getLoggingPrefix('error')} No Firefox tab target found`;
132802
133894
  }
132803
133895
  function sourceInspectorHtmlExtractFailed() {
132804
- return `${messages_getLoggingPrefix('error')} Failed to extract Firefox HTML after retries`;
133896
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to extract Firefox HTML after retries`;
132805
133897
  }
132806
133898
  function cdpClientFoundTargets(count) {
132807
- return `${messages_getLoggingPrefix('info')} Chrome found ${external_pintor_default().gray(count.toString())} targets`;
133899
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome found ${external_pintor_default().gray(count.toString())} targets`;
132808
133900
  }
132809
133901
  function cdpClientTargetWebSocketUrlStored() {
132810
- return `${messages_getLoggingPrefix('info')} Chrome target WebSocket URL stored for future connections`;
133902
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chrome target WebSocket URL stored for future connections`;
132811
133903
  }
132812
133904
  function cdpClientConnected(host, port) {
132813
- return `${messages_getLoggingPrefix('success')} Chrome CDP Client connected to ${external_pintor_default().gray(host)}:${external_pintor_default().gray(port.toString())}`;
133905
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome CDP Client connected to ${external_pintor_default().gray(host)}:${external_pintor_default().gray(port.toString())}`;
132814
133906
  }
132815
133907
  function cdpClientConnectionError(error) {
132816
- return `${messages_getLoggingPrefix('error')} Chrome CDP Client connection error: ${external_pintor_default().red(error)}`;
133908
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome CDP Client connection error: ${external_pintor_default().red(error)}`;
132817
133909
  }
132818
133910
  function cdpClientBrowserConnectionEstablished() {
132819
- return `${messages_getLoggingPrefix('success')} Chrome CDP Client browser connection established`;
133911
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Chrome CDP Client browser connection established`;
132820
133912
  }
132821
133913
  function cdpClientConnectionClosed() {
132822
- return `${messages_getLoggingPrefix('warn')} Chrome CDP connection is closed`;
133914
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome CDP connection is closed`;
132823
133915
  }
132824
133916
  function cdpClientLoadEventTimeout() {
132825
- return `${messages_getLoggingPrefix('warn')} Chrome load event timed out; proceeding anyway...`;
133917
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Chrome load event timed out; proceeding anyway...`;
132826
133918
  }
132827
133919
  function cdpClientExtensionReloadFailed(extensionId, error) {
132828
- return `${messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to force-reload extension ${external_pintor_default().gray(extensionId)}: ${external_pintor_default().red(error)}`;
133920
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to force-reload extension ${external_pintor_default().gray(extensionId)}: ${external_pintor_default().red(error)}`;
132829
133921
  }
132830
133922
  function cdpClientExtensionUnloadFailed(extensionId, error) {
132831
- return `${messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to unload extension ${external_pintor_default().gray(extensionId)}: ${external_pintor_default().red(error)}`;
133923
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to unload extension ${external_pintor_default().gray(extensionId)}: ${external_pintor_default().red(error)}`;
132832
133924
  }
132833
133925
  function cdpClientExtensionInfoFailed(extensionId, error) {
132834
- return `${messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to get extension info for ${external_pintor_default().gray(extensionId)}: ${external_pintor_default().red(error)}`;
133926
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to get extension info for ${external_pintor_default().gray(extensionId)}: ${external_pintor_default().red(error)}`;
132835
133927
  }
132836
133928
  function cdpClientExtensionLoadFailed(path, error) {
132837
- return `${messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to load extension from ${external_pintor_default().underline(path)}: ${external_pintor_default().red(error)}`;
133929
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Chrome CDP Client: Failed to load extension from ${external_pintor_default().underline(path)}: ${external_pintor_default().red(error)}`;
132838
133930
  }
132839
133931
  function firefoxRdpClientConnected(host, port) {
132840
- return `${messages_getLoggingPrefix('success')} Connected to Firefox Remote Debugging Protocol on ${external_pintor_default().gray(host)}:${external_pintor_default().gray(port.toString())}`;
133932
+ return `${browsers_lib_messages_getLoggingPrefix('success')} Connected to Firefox Remote Debugging Protocol on ${external_pintor_default().gray(host)}:${external_pintor_default().gray(port.toString())}`;
132841
133933
  }
132842
133934
  function firefoxRdpClientTestingEvaluation() {
132843
- return `${messages_getLoggingPrefix('info')} Testing basic Firefox RDP evaluation...`;
133935
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Testing basic Firefox RDP evaluation...`;
132844
133936
  }
132845
133937
  function firefoxRdpClientFailedToGetMainHTML() {
132846
- return `${messages_getLoggingPrefix('error')} Failed to get Firefox main HTML`;
133938
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Failed to get Firefox main HTML`;
132847
133939
  }
132848
- function runningInDevelopment(manifest, browser, message) {
133940
+ function runningInDevelopment(manifest, browser, message, browserVersionLine) {
132849
133941
  const capitalize = (str)=>str.charAt(0).toUpperCase() + str.slice(1);
132850
133942
  const manifestName = manifest.name || 'Extension.js';
133943
+ const { hostPermissions, permissions } = manifest;
132851
133944
  let browserDevToolsUrl;
132852
133945
  switch(browser){
132853
133946
  case 'chrome':
@@ -132862,14 +133955,74 @@ var __webpack_exports__ = {};
132862
133955
  default:
132863
133956
  browserDevToolsUrl = '';
132864
133957
  }
132865
- if (!message.data) return `${messages_getLoggingPrefix('error')} No Client Data Received for ${manifestName}\n\n${external_pintor_default().red("This error happens when the program can't get the data from your extension.")}\n${external_pintor_default().red('There are many reasons this might happen. To fix, ensure that:')}\n\n- Your extension is set as enabled in ${external_pintor_default().underline(browserDevToolsUrl)}\n- No previous ${capitalize(browser)} browser instance is open\n\nIf that is not the case, restart both the ${external_pintor_default().yellow(manifest.name || '')} and the\n${external_pintor_default().yellow('Manager Extension')} in ${external_pintor_default().underline(browserDevToolsUrl)} and try again.\nIf the issue still persists, please report a bug:\n` + external_pintor_default().underline("https://github.com/extension-js/extension.js/issues");
133958
+ if (!message.data) return `${browsers_lib_messages_getLoggingPrefix('error')} No Client Data Received for ${manifestName}\n\n${external_pintor_default().red("This error happens when the program can't get the data from your extension.")}\n${external_pintor_default().red('There are many reasons this might happen. To fix, ensure that:')}\n\n- Your extension is set as enabled in ${external_pintor_default().underline(browserDevToolsUrl)}\n- No previous ${capitalize(browser)} browser instance is open\n\nIf that is not the case, restart both the ${external_pintor_default().yellow(manifest.name || '')} and the\n${external_pintor_default().yellow('Manager Extension')} in ${external_pintor_default().underline(browserDevToolsUrl)} and try again.\nIf the issue still persists, please report a bug:\n` + external_pintor_default().underline("https://github.com/extension-js/extension.js/issues");
132866
133959
  const { id = '', management } = message.data;
132867
133960
  if (!management) {
132868
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) return `${messages_getLoggingPrefix('error')} No management API info received from client for ${manifestName}. Investigate.`;
133961
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) return `${browsers_lib_messages_getLoggingPrefix('error')} No management API info received from client for ${manifestName}. Investigate.`;
132869
133962
  }
132870
133963
  const { name = '', version: version1 = '' } = management;
132871
- const extensionVersion = __webpack_require__("./package.json").i8;
132872
- return `${` \u{1F9E9} ${external_pintor_default().blue('Extension.js')} ${external_pintor_default().gray(`${extensionVersion}`)}\n Extension Name ${external_pintor_default().gray(name)}\n Extension Version ${external_pintor_default().gray(version1)}\n Extension ID ${external_pintor_default().gray(id)}`}`;
133964
+ const extensionVersion = messages_require('../../../package.json').version;
133965
+ let effectiveBrowserLine = browserVersionLine && browserVersionLine.trim().length > 0 ? browserVersionLine.trim() : '';
133966
+ if (!effectiveBrowserLine) try {
133967
+ if ('chromium' === browser || 'chromium-based' === browser) {
133968
+ const p = external_chromium_location_default()();
133969
+ if (p && 'string' == typeof p && external_fs_.existsSync(p)) {
133970
+ const v = messages_require('child_process').execFileSync(p, [
133971
+ '--version'
133972
+ ], {
133973
+ encoding: 'utf8'
133974
+ }).trim();
133975
+ effectiveBrowserLine = v || 'Chromium';
133976
+ }
133977
+ } else if ('chrome' === browser) {
133978
+ const p = (0, external_chrome_location2_namespaceObject.locateChromeOrExplain)({
133979
+ allowFallback: true
133980
+ });
133981
+ if (p && external_fs_.existsSync(p)) {
133982
+ const v = messages_require('child_process').execFileSync(p, [
133983
+ '--version'
133984
+ ], {
133985
+ encoding: 'utf8'
133986
+ }).trim();
133987
+ effectiveBrowserLine = v || 'Chrome';
133988
+ }
133989
+ } else if ('edge' === browser) {
133990
+ const p = external_edge_location_default()();
133991
+ if (p && external_fs_.existsSync(p)) {
133992
+ const v = messages_require('child_process').execFileSync(p, [
133993
+ '--version'
133994
+ ], {
133995
+ encoding: 'utf8'
133996
+ }).trim();
133997
+ effectiveBrowserLine = v || 'Microsoft Edge';
133998
+ }
133999
+ } else if ('firefox' === browser) {
134000
+ const p = external_firefox_location2_default()(true);
134001
+ if (p && 'string' == typeof p && external_fs_.existsSync(p)) {
134002
+ const v = messages_require('child_process').execFileSync(p, [
134003
+ '--version'
134004
+ ], {
134005
+ encoding: 'utf8'
134006
+ }).trim();
134007
+ effectiveBrowserLine = v || 'Firefox';
134008
+ }
134009
+ }
134010
+ } catch {}
134011
+ const browserLabel = effectiveBrowserLine && effectiveBrowserLine.trim().length > 0 ? effectiveBrowserLine.trim() : capitalize(String(browser || 'unknown'));
134012
+ const cleanId = String(id || '').trim();
134013
+ const urlScheme = 'firefox' === browser || 'gecko-based' === browser ? 'moz-extension' : 'chrome-extension';
134014
+ cleanId.length;
134015
+ (()=>{
134016
+ if ('firefox' === browser || 'gecko-based' === browser) return 'about:debugging#/runtime/this-firefox';
134017
+ if ('chrome' === browser || 'chromium' === browser || 'chromium-based' === browser || 'edge' === browser) return cleanId.length > 0 ? `chrome://extensions/?id=${cleanId}` : 'chrome://extensions';
134018
+ return cleanId.length > 0 ? `${urlScheme}://${cleanId}` : '(temporary)';
134019
+ })();
134020
+ ('firefox' === browser || 'gecko-based' === browser) && 'true' === process.env.EXTENSION_AUTHOR_MODE && cleanId.length;
134021
+ hostPermissions && hostPermissions.length;
134022
+ permissions && permissions.length;
134023
+ const lines = [];
134024
+ lines.push(` \u{1F9E9} ${external_pintor_default().brightBlue('Extension.js')} ${external_pintor_default().gray(`${extensionVersion}`)}`, ` Browser ${external_pintor_default().gray(browserLabel)}`, ` Extension ${external_pintor_default().gray(version1 ? `${name} ${version1}` : name || manifestName)}`, ` Extension ID ${external_pintor_default().gray(cleanId)}`);
134025
+ return lines.join('\n');
132873
134026
  }
132874
134027
  function emptyLine() {
132875
134028
  return '';
@@ -132878,13 +134031,13 @@ var __webpack_exports__ = {};
132878
134031
  return ''.padEnd(80, '=');
132879
134032
  }
132880
134033
  function devChromiumDebugPort(finalPort, requestedPort) {
132881
- return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Chromium debug port: ${external_pintor_default().gray(finalPort.toString())} (requested ${external_pintor_default().gray(requestedPort.toString())})`;
134034
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Chromium debug port: ${external_pintor_default().gray(finalPort.toString())} (requested ${external_pintor_default().gray(requestedPort.toString())})`;
132882
134035
  }
132883
134036
  function devFirefoxDebugPort(finalPort, requestedPort) {
132884
- return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Firefox debug port: ${external_pintor_default().gray(finalPort.toString())} (requested ${external_pintor_default().gray(requestedPort.toString())})`;
134037
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Firefox debug port: ${external_pintor_default().gray(finalPort.toString())} (requested ${external_pintor_default().gray(requestedPort.toString())})`;
132885
134038
  }
132886
134039
  function devFirefoxProfilePath(profilePath) {
132887
- return `${external_pintor_default().brightMagenta("\u25BA\u25BA\u25BA")} ${external_pintor_default().brightMagenta('Dev')} Firefox profile: ${external_pintor_default().underline(profilePath)}`;
134040
+ return `${browsers_lib_messages_getLoggingPrefix('info')} Firefox profile: ${external_pintor_default().underline(profilePath)}`;
132888
134041
  }
132889
134042
  function devHtmlSampleRetry(sample) {
132890
134043
  return `${external_pintor_default().gray('[Extension.js] HTML sample (retry):')} ${external_pintor_default().gray(sample)}`;
@@ -132903,13 +134056,13 @@ var __webpack_exports__ = {};
132903
134056
  return `[extension-log ${ts}] ${data}`;
132904
134057
  }
132905
134058
  function firefoxInspectSourceNonFatal(message) {
132906
- return `${messages_getLoggingPrefix('warn')} Firefox Inspect non-fatal error: ${external_pintor_default().yellow(message)}`;
134059
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Firefox Inspect non-fatal error: ${external_pintor_default().yellow(message)}`;
132907
134060
  }
132908
134061
  function unsupportedBrowser(browser) {
132909
134062
  const supported = "chrome, edge, firefox";
132910
134063
  const hintFlag = `${external_pintor_default().blue('--browser')} ${external_pintor_default().gray('<chrome|edge|firefox>')}`;
132911
134064
  const docsUrl = external_pintor_default().underline('https://github.com/extension-js/extension.js');
132912
- return `${messages_getLoggingPrefix('error')} Unsupported browser ${external_pintor_default().yellow(`"${browser}"`)}\n\nWe currently support: ${external_pintor_default().green(supported)}.\nTry selecting a supported browser with ${hintFlag}.\n\nNeed another engine? Open a discussion or PR:\n${docsUrl}`;
134065
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Unsupported browser ${external_pintor_default().yellow(`"${browser}"`)}\n\nWe currently support: ${external_pintor_default().green(supported)}.\nTry selecting a supported browser with ${hintFlag}.\n\nNeed another engine? Open a discussion or PR:\n${docsUrl}`;
132913
134066
  }
132914
134067
  function browserRunnerError(body) {
132915
134068
  return `${external_pintor_default().red('ERROR')} ${external_pintor_default().brightBlue('error in browser runner')}\n${body}`;
@@ -132931,12 +134084,12 @@ var __webpack_exports__ = {};
132931
134084
  return browserRunnerError(body);
132932
134085
  }
132933
134086
  function rdpInvalidRequestPayload() {
132934
- return `${messages_getLoggingPrefix('error')} Invalid RDP request payload`;
134087
+ return `${browsers_lib_messages_getLoggingPrefix('error')} Invalid RDP request payload`;
132935
134088
  }
132936
134089
  function chromiumDeveloperModeGuidance(browser) {
132937
134090
  let exts = '';
132938
134091
  exts = 'edge' === browser ? external_pintor_default().underline('edge://extensions') : external_pintor_default().underline('chrome://extensions');
132939
- return `${messages_getLoggingPrefix('warn')} Configuration required\nEnable ${external_pintor_default().yellow('Developer mode')} in ${exts} for reliable reloads.\nWithout it, hard reloads may disable your unpacked extension.`;
134092
+ return `${browsers_lib_messages_getLoggingPrefix('warn')} Configuration required\nEnable ${external_pintor_default().yellow('Developer mode')} in ${exts} for reliable reloads.\nWithout it, hard reloads may disable your unpacked extension.`;
132940
134093
  }
132941
134094
  function createChromiumContext() {
132942
134095
  let controller;
@@ -132983,12 +134136,6 @@ var __webpack_exports__ = {};
132983
134136
  };
132984
134137
  }
132985
134138
  var external_child_process_ = __webpack_require__("child_process");
132986
- var external_chrome_location2_ = __webpack_require__("chrome-location2");
132987
- var external_chrome_location2_default = /*#__PURE__*/ __webpack_require__.n(external_chrome_location2_);
132988
- var external_chromium_location_ = __webpack_require__("chromium-location");
132989
- var external_chromium_location_default = /*#__PURE__*/ __webpack_require__.n(external_chromium_location_);
132990
- var external_edge_location_ = __webpack_require__("edge-location");
132991
- var external_edge_location_default = /*#__PURE__*/ __webpack_require__.n(external_edge_location_);
132992
134139
  const instanceIdToRecord = new Map();
132993
134140
  let lastCDPPort;
132994
134141
  function setInstancePorts(instanceId, ports) {
@@ -133242,6 +134389,93 @@ var __webpack_exports__ = {};
133242
134389
  }
133243
134390
  } catch {}
133244
134391
  }
134392
+ const sharedState = {
134393
+ bannerPrinted: false,
134394
+ pendingCompilationLine: ''
134395
+ };
134396
+ function markBannerPrinted() {
134397
+ sharedState.bannerPrinted = true;
134398
+ if (sharedState.pendingCompilationLine) {
134399
+ console.log(sharedState.pendingCompilationLine);
134400
+ sharedState.pendingCompilationLine = '';
134401
+ }
134402
+ }
134403
+ const printedKeys = new Set();
134404
+ function keyFor(browser, outPath, hp) {
134405
+ const host = ((null == hp ? void 0 : hp.host) || '127.0.0.1').toString();
134406
+ const port = (null == hp ? void 0 : hp.port) == null ? '' : String(hp.port);
134407
+ return `${browser}::${external_path_.resolve(outPath)}::${host}:${port}`;
134408
+ }
134409
+ async function printDevBannerOnce(opts) {
134410
+ var _opts_fallback, _opts_fallback1, _opts_fallback2;
134411
+ const k = keyFor(opts.browser, opts.outPath, opts.hostPort);
134412
+ if (printedKeys.has(k)) return false;
134413
+ const info = await opts.getInfo() || null;
134414
+ const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
134415
+ if (!external_fs_.existsSync(manifestPath)) return false;
134416
+ const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
134417
+ const extensionId = (null == info ? void 0 : info.extensionId) || (null == (_opts_fallback = opts.fallback) ? void 0 : _opts_fallback.extensionId) || '(temporary)';
134418
+ const name = (null == info ? void 0 : info.name) || (null == (_opts_fallback1 = opts.fallback) ? void 0 : _opts_fallback1.name) || manifest.name;
134419
+ const version1 = (null == info ? void 0 : info.version) || (null == (_opts_fallback2 = opts.fallback) ? void 0 : _opts_fallback2.version) || manifest.version;
134420
+ const message = {
134421
+ data: {
134422
+ id: extensionId,
134423
+ management: {
134424
+ name,
134425
+ version: version1
134426
+ }
134427
+ }
134428
+ };
134429
+ console.log(emptyLine());
134430
+ console.log(runningInDevelopment(manifest, opts.browser, message, opts.browserVersionLine));
134431
+ console.log(emptyLine());
134432
+ markBannerPrinted();
134433
+ printedKeys.add(k);
134434
+ return true;
134435
+ }
134436
+ async function printProdBannerOnce(opts) {
134437
+ const k = keyFor(opts.browser, opts.outPath);
134438
+ if (printedKeys.has(k)) return false;
134439
+ const browserLabel = opts.browserVersionLine && opts.browserVersionLine.trim().length > 0 ? opts.browserVersionLine.trim() : String(opts.browser || 'unknown');
134440
+ try {
134441
+ const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
134442
+ const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
134443
+ if (opts.runtime && opts.runtime.extensionId) {
134444
+ const message = {
134445
+ data: {
134446
+ id: opts.runtime.extensionId,
134447
+ management: {
134448
+ name: opts.runtime.name || manifest.name,
134449
+ version: opts.runtime.version || manifest.version
134450
+ }
134451
+ }
134452
+ };
134453
+ console.log(emptyLine());
134454
+ console.log(runningInDevelopment(manifest, opts.browser, message, browserLabel));
134455
+ console.log(emptyLine());
134456
+ } else {
134457
+ const message = {
134458
+ data: {
134459
+ id: '',
134460
+ management: {
134461
+ name: manifest.name,
134462
+ version: manifest.version
134463
+ }
134464
+ }
134465
+ };
134466
+ console.log(emptyLine());
134467
+ console.log(runningInDevelopment(manifest, opts.browser, message, browserLabel));
134468
+ console.log(emptyLine());
134469
+ }
134470
+ } catch {
134471
+ console.log(emptyLine());
134472
+ console.log(webpack_lib_messages.km(opts.outPath, browserLabel));
134473
+ console.log(emptyLine());
134474
+ }
134475
+ markBannerPrinted();
134476
+ printedKeys.add(k);
134477
+ return true;
134478
+ }
133245
134479
  const external_unique_names_generator_namespaceObject = require("unique-names-generator");
133246
134480
  const DEFAULT_BROWSER_FLAGS = [
133247
134481
  '--no-first-run',
@@ -133404,50 +134638,6 @@ var __webpack_exports__ = {};
133404
134638
  console.log(chromiumDryRunBinary(browserBinaryLocation));
133405
134639
  console.log(chromiumDryRunFlags(chromiumConfig.join(' ')));
133406
134640
  }
133407
- const sharedState = {
133408
- bannerPrinted: false,
133409
- pendingCompilationLine: ''
133410
- };
133411
- function markBannerPrinted() {
133412
- sharedState.bannerPrinted = true;
133413
- if (sharedState.pendingCompilationLine) {
133414
- console.log(sharedState.pendingCompilationLine);
133415
- sharedState.pendingCompilationLine = '';
133416
- }
133417
- }
133418
- const printedKeys = new Set();
133419
- function keyFor(browser, outPath, hp) {
133420
- const host = ((null == hp ? void 0 : hp.host) || '127.0.0.1').toString();
133421
- const port = (null == hp ? void 0 : hp.port) == null ? '' : String(hp.port);
133422
- return `${browser}::${external_path_.resolve(outPath)}::${host}:${port}`;
133423
- }
133424
- async function printDevBannerOnce(opts) {
133425
- var _opts_fallback, _opts_fallback1, _opts_fallback2;
133426
- const k = keyFor(opts.browser, opts.outPath, opts.hostPort);
133427
- if (printedKeys.has(k)) return false;
133428
- const info = await opts.getInfo() || null;
133429
- const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
133430
- if (!external_fs_.existsSync(manifestPath)) return false;
133431
- const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
133432
- const extensionId = (null == info ? void 0 : info.extensionId) || (null == (_opts_fallback = opts.fallback) ? void 0 : _opts_fallback.extensionId) || '(temporary)';
133433
- const name = (null == info ? void 0 : info.name) || (null == (_opts_fallback1 = opts.fallback) ? void 0 : _opts_fallback1.name) || manifest.name;
133434
- const version1 = (null == info ? void 0 : info.version) || (null == (_opts_fallback2 = opts.fallback) ? void 0 : _opts_fallback2.version) || manifest.version;
133435
- const message = {
133436
- data: {
133437
- id: extensionId,
133438
- management: {
133439
- name,
133440
- version: version1
133441
- }
133442
- }
133443
- };
133444
- console.log(emptyLine());
133445
- console.log(runningInDevelopment(manifest, opts.browser, message));
133446
- console.log(emptyLine());
133447
- markBannerPrinted();
133448
- printedKeys.add(k);
133449
- return true;
133450
- }
133451
134641
  async function deriveExtensionIdFromTargetsHelper(cdp, outPath, maxRetries = 20, backoffMs = 200) {
133452
134642
  let expectedName;
133453
134643
  try {
@@ -134318,7 +135508,6 @@ var __webpack_exports__ = {};
134318
135508
  return (userCandidates.length ? userCandidates : entries).slice(-1)[0];
134319
135509
  }
134320
135510
  async function setupCdpAfterLaunch(compilation, plugin, chromiumArgs) {
134321
- var _compilation_options;
134322
135511
  const loadExtensionFlag = chromiumArgs.find((flag)=>flag.startsWith('--load-extension='));
134323
135512
  const extensionOutputPath = getExtensionOutputPath(compilation, loadExtensionFlag);
134324
135513
  const remoteDebugPortFlag = chromiumArgs.find((flag)=>flag.startsWith('--remote-debugging-port='));
@@ -134350,27 +135539,51 @@ var __webpack_exports__ = {};
134350
135539
  await retryAsync(()=>cdpExtensionController.connect());
134351
135540
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(cdpClientConnected('127.0.0.1', chromeRemoteDebugPort));
134352
135541
  const extensionControllerInfo = await cdpExtensionController.ensureLoaded();
134353
- if ((null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : _compilation_options.mode) !== 'production') try {
134354
- const bannerPrinted = await printDevBannerOnce({
134355
- outPath: extensionOutputPath,
135542
+ try {
135543
+ var _compilation_options;
135544
+ const mode = (null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : _compilation_options.mode) || 'development';
135545
+ if ('development' === mode) {
135546
+ const bannerPrinted = await printDevBannerOnce({
135547
+ outPath: extensionOutputPath,
135548
+ browser: plugin.browser,
135549
+ hostPort: {
135550
+ host: '127.0.0.1',
135551
+ port: chromeRemoteDebugPort
135552
+ },
135553
+ getInfo: async ()=>extensionControllerInfo,
135554
+ browserVersionLine: plugin.browserVersionLine
135555
+ });
135556
+ if (!bannerPrinted) await printDevBannerOnce({
135557
+ outPath: extensionOutputPath,
135558
+ browser: plugin.browser,
135559
+ hostPort: {
135560
+ host: '127.0.0.1',
135561
+ port: chromeRemoteDebugPort
135562
+ },
135563
+ getInfo: async ()=>cdpExtensionController.getInfoBestEffort(),
135564
+ browserVersionLine: plugin.browserVersionLine
135565
+ });
135566
+ } else if ('production' === mode) await printProdBannerOnce({
134356
135567
  browser: plugin.browser,
134357
- hostPort: {
134358
- host: '127.0.0.1',
134359
- port: chromeRemoteDebugPort
134360
- },
134361
- getInfo: async ()=>extensionControllerInfo
134362
- });
134363
- if (!bannerPrinted) await printDevBannerOnce({
134364
135568
  outPath: extensionOutputPath,
134365
- browser: plugin.browser,
134366
- hostPort: {
134367
- host: '127.0.0.1',
134368
- port: chromeRemoteDebugPort
134369
- },
134370
- getInfo: async ()=>cdpExtensionController.getInfoBestEffort()
135569
+ browserVersionLine: plugin.browserVersionLine,
135570
+ runtime: {
135571
+ extensionId: extensionControllerInfo.extensionId,
135572
+ name: extensionControllerInfo.name,
135573
+ version: extensionControllerInfo.version
135574
+ }
134371
135575
  });
134372
135576
  } catch (bannerErr) {
134373
135577
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(bestEffortBannerPrintFailed(String(bannerErr)));
135578
+ try {
135579
+ var _compilation_options1;
135580
+ const mode = (null == compilation ? void 0 : null == (_compilation_options1 = compilation.options) ? void 0 : _compilation_options1.mode) || 'development';
135581
+ if ('production' === mode) await printProdBannerOnce({
135582
+ browser: plugin.browser,
135583
+ outPath: extensionOutputPath,
135584
+ browserVersionLine: plugin.browserVersionLine
135585
+ });
135586
+ } catch {}
134374
135587
  }
134375
135588
  plugin.cdpController = cdpExtensionController;
134376
135589
  }
@@ -134418,51 +135631,25 @@ var __webpack_exports__ = {};
134418
135631
  if (resolved && external_fs_.existsSync(resolved)) browserBinaryLocation = resolved;
134419
135632
  } catch {}
134420
135633
  const skipDetection = Boolean(browserBinaryLocation);
134421
- const getChromeVersionLine = (bin)=>{
135634
+ const getBrowserVersionLine = (bin)=>{
134422
135635
  try {
134423
- const versionLine = (0, external_child_process_.execFileSync)(bin, [
134424
- '--version'
134425
- ], {
134426
- encoding: 'utf8'
134427
- }).trim();
134428
- if (versionLine) return versionLine;
134429
- } catch {}
134430
- if ('win32' === process.platform) try {
134431
- const psPath = bin.replace(/'/g, "''");
134432
- const pv = (0, external_child_process_.execFileSync)('powershell.exe', [
134433
- '-NoProfile',
134434
- '-Command',
134435
- `(Get-Item -LiteralPath '${psPath}').VersionInfo.ProductVersion`
134436
- ], {
134437
- encoding: 'utf8',
134438
- stdio: [
134439
- 'ignore',
134440
- 'pipe',
134441
- 'ignore'
134442
- ]
134443
- }).trim();
134444
- const pn = (0, external_child_process_.execFileSync)('powershell.exe', [
134445
- '-NoProfile',
134446
- '-Command',
134447
- `(Get-Item -LiteralPath '${psPath}').VersionInfo.ProductName`
134448
- ], {
134449
- encoding: 'utf8',
134450
- stdio: [
134451
- 'ignore',
134452
- 'pipe',
134453
- 'ignore'
134454
- ]
134455
- }).trim();
134456
- if (pv) return pn ? `${pn} ${pv}` : pv;
134457
- } catch {}
134458
- return '';
135636
+ if ('edge' === browser) return (0, external_edge_location_namespaceObject.getEdgeVersion)(bin, {
135637
+ allowExec: true
135638
+ }) || '';
135639
+ if ('chromium' === browser || 'chromium-based' === browser) return (0, external_chromium_location_namespaceObject.getChromiumVersion)(bin, {
135640
+ allowExec: true
135641
+ }) || '';
135642
+ return (0, external_chrome_location2_namespaceObject.getChromeVersion)(bin, {
135643
+ allowExec: true
135644
+ }) || '';
135645
+ } catch {
135646
+ return '';
135647
+ }
134459
135648
  };
134460
135649
  const looksOfficialChrome = (line)=>/^Google Chrome\s(?!for Testing)/i.test(line);
134461
135650
  const getInstallGuidanceText = ()=>{
134462
135651
  try {
134463
- const f = null == external_chrome_location2_ ? void 0 : external_chrome_location2_.getInstallGuidance;
134464
- const txt = 'function' == typeof f ? f() : '';
134465
- return txt && 'string' == typeof txt ? txt : 'npx @puppeteer/browsers install chrome@stable';
135652
+ return (0, external_chrome_location2_namespaceObject.getInstallGuidance)();
134466
135653
  } catch {
134467
135654
  return 'npx @puppeteer/browsers install chrome@stable';
134468
135655
  }
@@ -134471,13 +135658,12 @@ var __webpack_exports__ = {};
134471
135658
  case 'chrome':
134472
135659
  console.log(locatingBrowser(browser));
134473
135660
  if (!skipDetection) try {
134474
- const locate = external_chrome_location2_.locateChromeOrExplain;
134475
- if ('function' == typeof locate) try {
134476
- const located = locate({
135661
+ try {
135662
+ const located = (0, external_chrome_location2_namespaceObject.locateChromeOrExplain)({
134477
135663
  allowFallback: true
134478
135664
  });
134479
135665
  if (located && external_fs_.existsSync(located)) {
134480
- const versionLine = getChromeVersionLine(located);
135666
+ const versionLine = getBrowserVersionLine(located);
134481
135667
  if (looksOfficialChrome(versionLine)) {
134482
135668
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
134483
135669
  printedGuidance = true;
@@ -134485,23 +135671,9 @@ var __webpack_exports__ = {};
134485
135671
  } else browserBinaryLocation = located;
134486
135672
  } else browserBinaryLocation = null;
134487
135673
  } catch (err) {
134488
- var _chromeLocation_default;
134489
- let candidate = (null == (_chromeLocation_default = external_chrome_location2_default()) ? void 0 : _chromeLocation_default.call(external_chrome_location2_, true)) || null;
134490
- if (candidate) {
134491
- const versionLine = getChromeVersionLine(candidate);
134492
- if (looksOfficialChrome(versionLine)) {
134493
- this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
134494
- printedGuidance = true;
134495
- candidate = null;
134496
- }
134497
- }
134498
- browserBinaryLocation = candidate;
134499
- if (!browserBinaryLocation) throw err;
134500
- }
134501
- else {
134502
135674
  let candidate = external_chrome_location2_default()(true) || null;
134503
135675
  if (candidate) {
134504
- const versionLine = getChromeVersionLine(candidate);
135676
+ const versionLine = getBrowserVersionLine(candidate);
134505
135677
  if (looksOfficialChrome(versionLine)) {
134506
135678
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
134507
135679
  printedGuidance = true;
@@ -134509,6 +135681,7 @@ var __webpack_exports__ = {};
134509
135681
  }
134510
135682
  }
134511
135683
  browserBinaryLocation = candidate;
135684
+ if (!browserBinaryLocation) throw err;
134512
135685
  }
134513
135686
  } catch (e) {
134514
135687
  this.printEnhancedPuppeteerInstallHint(compilation, String(e), browser);
@@ -134527,8 +135700,7 @@ var __webpack_exports__ = {};
134527
135700
  }
134528
135701
  }
134529
135702
  if (!browserBinaryLocation && !skipDetection) try {
134530
- const loc = (null === external_chromium_location_default() || void 0 === external_chromium_location_default() ? void 0 : external_chromium_location_default()["default"]) || external_chromium_location_default();
134531
- const p = 'function' == typeof loc ? loc() : null;
135703
+ const p = external_chromium_location_default()();
134532
135704
  if (p && 'string' == typeof p && external_fs_.existsSync(p)) browserBinaryLocation = p;
134533
135705
  } catch {}
134534
135706
  break;
@@ -134543,9 +135715,7 @@ var __webpack_exports__ = {};
134543
135715
  if (!browserBinaryLocation || !external_fs_.existsSync(String(browserBinaryLocation))) {
134544
135716
  const guidance = (()=>{
134545
135717
  try {
134546
- const f = null === external_edge_location_default() || void 0 === external_edge_location_default() ? void 0 : external_edge_location_default().getInstallGuidance;
134547
- const txt = 'function' == typeof f ? f() : '';
134548
- return txt && 'string' == typeof txt ? txt : 'npx playwright install msedge';
135718
+ return (0, external_edge_location_namespaceObject.getInstallGuidance)();
134549
135719
  } catch {
134550
135720
  return 'npx playwright install msedge';
134551
135721
  }
@@ -134560,9 +135730,7 @@ var __webpack_exports__ = {};
134560
135730
  } catch {
134561
135731
  const guidance = (()=>{
134562
135732
  try {
134563
- const f = null === external_edge_location_default() || void 0 === external_edge_location_default() ? void 0 : external_edge_location_default().getInstallGuidance;
134564
- const txt = 'function' == typeof f ? f() : '';
134565
- return txt && 'string' == typeof txt ? txt : 'npx playwright install msedge';
135733
+ return (0, external_edge_location_namespaceObject.getInstallGuidance)();
134566
135734
  } catch {
134567
135735
  return 'npx playwright install msedge';
134568
135736
  }
@@ -134587,20 +135755,18 @@ var __webpack_exports__ = {};
134587
135755
  process.exit(1);
134588
135756
  }
134589
135757
  if (!browserBinaryLocation && !skipDetection) try {
134590
- const loc = (null === external_chromium_location_default() || void 0 === external_chromium_location_default() ? void 0 : external_chromium_location_default()["default"]) || external_chromium_location_default();
134591
- const p = 'function' == typeof loc ? loc() : null;
135758
+ const p = external_chromium_location_default()();
134592
135759
  if (p && 'string' == typeof p && external_fs_.existsSync(p)) browserBinaryLocation = p;
134593
135760
  } catch {}
134594
135761
  break;
134595
135762
  default:
134596
135763
  try {
134597
- const locate = external_chrome_location2_.locateChromeOrExplain;
134598
- if ('function' == typeof locate) try {
134599
- const located = locate({
135764
+ try {
135765
+ const located = (0, external_chrome_location2_namespaceObject.locateChromeOrExplain)({
134600
135766
  allowFallback: true
134601
135767
  });
134602
135768
  if (located && external_fs_.existsSync(located)) {
134603
- const versionLine = getChromeVersionLine(located);
135769
+ const versionLine = getBrowserVersionLine(located);
134604
135770
  if (looksOfficialChrome(versionLine)) {
134605
135771
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
134606
135772
  printedGuidance = true;
@@ -134608,23 +135774,9 @@ var __webpack_exports__ = {};
134608
135774
  } else browserBinaryLocation = located;
134609
135775
  } else browserBinaryLocation = null;
134610
135776
  } catch (err) {
134611
- var _chromeLocation_default1;
134612
- let candidate = (null == (_chromeLocation_default1 = external_chrome_location2_default()) ? void 0 : _chromeLocation_default1.call(external_chrome_location2_, true)) || null;
134613
- if (candidate) {
134614
- const versionLine = getChromeVersionLine(candidate);
134615
- if (looksOfficialChrome(versionLine)) {
134616
- this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
134617
- printedGuidance = true;
134618
- candidate = null;
134619
- }
134620
- }
134621
- browserBinaryLocation = candidate;
134622
- if (!browserBinaryLocation) throw err;
134623
- }
134624
- else {
134625
135777
  let candidate = external_chrome_location2_default()(true) || null;
134626
135778
  if (candidate) {
134627
- const versionLine = getChromeVersionLine(candidate);
135779
+ const versionLine = getBrowserVersionLine(candidate);
134628
135780
  if (looksOfficialChrome(versionLine)) {
134629
135781
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
134630
135782
  printedGuidance = true;
@@ -134632,6 +135784,7 @@ var __webpack_exports__ = {};
134632
135784
  }
134633
135785
  }
134634
135786
  browserBinaryLocation = candidate;
135787
+ if (!browserBinaryLocation) throw err;
134635
135788
  }
134636
135789
  } catch (e) {
134637
135790
  this.printEnhancedPuppeteerInstallHint(compilation, String(e), browser);
@@ -134649,9 +135802,7 @@ var __webpack_exports__ = {};
134649
135802
  if ('chromium' === browser || 'chromium-based' === browser) {
134650
135803
  const chromiumGuidance = (()=>{
134651
135804
  try {
134652
- const f = null === external_chromium_location_default() || void 0 === external_chromium_location_default() ? void 0 : external_chromium_location_default().getInstallGuidance;
134653
- const txt = 'function' == typeof f ? f() : '';
134654
- return txt && 'string' == typeof txt ? txt : 'npx @puppeteer/browsers install chromium';
135805
+ return (0, external_chromium_location_namespaceObject.getInstallGuidance)();
134655
135806
  } catch {
134656
135807
  return 'npx @puppeteer/browsers install chromium';
134657
135808
  }
@@ -134673,7 +135824,10 @@ var __webpack_exports__ = {};
134673
135824
  const last = [
134674
135825
  ...extensionsToLoad
134675
135826
  ].reverse().find((e)=>'string' == typeof e);
134676
- if (last) this.ctx.setExtensionRoot(String(last));
135827
+ if (last) {
135828
+ const root = String(last);
135829
+ this.ctx.setExtensionRoot(root);
135830
+ }
134677
135831
  } catch {}
134678
135832
  let chromiumConfig = browser_config_browserConfig(compilation, {
134679
135833
  ...this.options,
@@ -134693,6 +135847,26 @@ var __webpack_exports__ = {};
134693
135847
  if (this.options.dryRun) return void logChromiumDryRun(browserBinaryLocation, chromiumConfig);
134694
135848
  await this.launchWithDirectSpawn(browserBinaryLocation, chromiumConfig);
134695
135849
  try {
135850
+ let browserVersionLine;
135851
+ try {
135852
+ if (browserBinaryLocation && external_fs_.existsSync(browserBinaryLocation)) {
135853
+ const vLine = getBrowserVersionLine(browserBinaryLocation);
135854
+ if (vLine && vLine.trim().length > 0) browserVersionLine = vLine.trim();
135855
+ }
135856
+ } catch {}
135857
+ try {
135858
+ var _compilation_options;
135859
+ const mode = (null == compilation ? void 0 : null == (_compilation_options = compilation.options) ? void 0 : _compilation_options.mode) || 'development';
135860
+ if ('production' === mode) {
135861
+ const loadExtensionFlag = chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
135862
+ const extensionOutputPath = getExtensionOutputPath(compilation, loadExtensionFlag);
135863
+ if (extensionOutputPath) await printProdBannerOnce({
135864
+ browser: this.options.browser,
135865
+ outPath: extensionOutputPath,
135866
+ browserVersionLine
135867
+ });
135868
+ }
135869
+ } catch {}
134696
135870
  const cdpConfig = {
134697
135871
  extension: Array.isArray(this.options.extension) ? this.options.extension : [
134698
135872
  this.options.extension
@@ -134718,7 +135892,8 @@ var __webpack_exports__ = {};
134718
135892
  chromiumBinary: this.options.chromiumBinary,
134719
135893
  source: this.options.source,
134720
135894
  watchSource: this.options.watchSource,
134721
- dryRun: this.options.dryRun
135895
+ dryRun: this.options.dryRun,
135896
+ browserVersionLine
134722
135897
  };
134723
135898
  await setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig);
134724
135899
  if (cdpConfig.cdpController) this.ctx.setController(cdpConfig.cdpController, selectedPort);
@@ -134972,20 +136147,27 @@ var __webpack_exports__ = {};
134972
136147
  return null == (_console = console) ? void 0 : null == (_console_debug = _console.debug) ? void 0 : _console_debug.call(_console, ...a);
134973
136148
  }
134974
136149
  };
134975
- if (null == (_compiler_hooks = compiler.hooks) ? void 0 : null == (_compiler_hooks_watchRun = _compiler_hooks.watchRun) ? void 0 : _compiler_hooks_watchRun.tapAsync) compiler.hooks.watchRun.tapAsync('run-browsers:watch', (compilation, done)=>{
136150
+ if (null == (_compiler_hooks = compiler.hooks) ? void 0 : null == (_compiler_hooks_watchRun = _compiler_hooks.watchRun) ? void 0 : _compiler_hooks_watchRun.tapAsync) compiler.hooks.watchRun.tapAsync('run-browsers:watch', (compilerWithModifiedFiles, done)=>{
134976
136151
  try {
134977
- const files = (null == compilation ? void 0 : compilation.modifiedFiles) || new Set();
134978
- const normalizedFilePaths = Array.from(files).map((filePath)=>filePath.replace(/\\/g, '/'));
134979
- const hitManifest = normalizedFilePaths.some((filePath)=>/(^|\/)manifest\.json$/i.test(filePath));
134980
- const localeChanged = normalizedFilePaths.some((filePath)=>/(^|\/)__?locales\/.+\.json$/i.test(filePath));
136152
+ const modifiedFiles = (null == compilerWithModifiedFiles ? void 0 : compilerWithModifiedFiles.modifiedFiles) || new Set();
136153
+ const normalizedModifiedFilePaths = Array.from(modifiedFiles).map((filePath)=>String(filePath).replace(/\\/g, '/'));
136154
+ const hitManifest = normalizedModifiedFilePaths.some((filePath)=>/(^|\/)manifest\.json$/i.test(filePath));
136155
+ const localeChanged = normalizedModifiedFilePaths.some((filePath)=>/(^|\/)__?locales\/.+\.json$/i.test(filePath));
134981
136156
  let serviceWorkerChanged = false;
134982
- const { absolutePath: serviceWorkerAbsolutePath, relativePath: serviceWorkerRelativePath } = this.ctx.getServiceWorkerPaths() || {};
134983
- if (serviceWorkerAbsolutePath) {
134984
- const normalizedServiceWorkerAbsolutePath = serviceWorkerAbsolutePath.replace(/\\/g, '/');
134985
- serviceWorkerChanged = normalizedFilePaths.some((filePath)=>{
134986
- const normalizedPath = filePath.replace(/\\/g, '/');
134987
- return normalizedPath === normalizedServiceWorkerAbsolutePath || normalizedPath.endsWith(normalizedServiceWorkerAbsolutePath) || (serviceWorkerRelativePath ? normalizedPath === serviceWorkerRelativePath.replace(/\\/g, '/') || normalizedPath.endsWith('/' + serviceWorkerRelativePath.replace(/\\/g, '/')) : false);
134988
- });
136157
+ if (this.serviceWorkerSourceDependencyPaths.size > 0) serviceWorkerChanged = normalizedModifiedFilePaths.some((modifiedFilePath)=>{
136158
+ if (this.serviceWorkerSourceDependencyPaths.has(modifiedFilePath)) return true;
136159
+ for (const serviceWorkerSourceDependencyPath of this.serviceWorkerSourceDependencyPaths)if (modifiedFilePath.endsWith(serviceWorkerSourceDependencyPath)) return true;
136160
+ return false;
136161
+ });
136162
+ else {
136163
+ const { absolutePath: serviceWorkerAbsolutePath, relativePath: serviceWorkerRelativePath } = this.ctx.getServiceWorkerPaths() || {};
136164
+ if (serviceWorkerAbsolutePath) {
136165
+ const normalizedServiceWorkerAbsolutePath = serviceWorkerAbsolutePath.replace(/\\/g, '/');
136166
+ serviceWorkerChanged = normalizedModifiedFilePaths.some((filePath)=>{
136167
+ const normalizedPath = filePath.replace(/\\/g, '/');
136168
+ return normalizedPath === normalizedServiceWorkerAbsolutePath || normalizedPath.endsWith(normalizedServiceWorkerAbsolutePath) || (serviceWorkerRelativePath ? normalizedPath === serviceWorkerRelativePath.replace(/\\/g, '/') || normalizedPath.endsWith('/' + serviceWorkerRelativePath.replace(/\\/g, '/')) : false);
136169
+ });
136170
+ }
134989
136171
  }
134990
136172
  if (hitManifest) this.ctx.setPendingReloadReason('manifest');
134991
136173
  else if (localeChanged) this.ctx.setPendingReloadReason('locales');
@@ -135001,6 +136183,7 @@ var __webpack_exports__ = {};
135001
136183
  const hasErrors = 'function' == typeof (null == stats ? void 0 : stats.hasErrors) ? stats.hasErrors() : !!(null == stats ? void 0 : null == (_stats_compilation = stats.compilation) ? void 0 : null == (_stats_compilation_errors = _stats_compilation.errors) ? void 0 : _stats_compilation_errors.length);
135002
136184
  if (hasErrors) return;
135003
136185
  this.refreshSWFromManifest(stats.compilation);
136186
+ this.refreshServiceWorkerSourceDependencyPaths(stats.compilation);
135004
136187
  const reason = this.ctx.getPendingReloadReason();
135005
136188
  if (!reason) return;
135006
136189
  this.ctx.clearPendingReloadReason();
@@ -135030,13 +136213,42 @@ var __webpack_exports__ = {};
135030
136213
  }
135031
136214
  } catch {}
135032
136215
  }
136216
+ refreshServiceWorkerSourceDependencyPaths(compilation) {
136217
+ try {
136218
+ const serviceWorkerEntrypointName = 'background/service_worker';
136219
+ const discovered = this.collectEntrypointModuleResourcePaths(compilation, serviceWorkerEntrypointName);
136220
+ this.serviceWorkerSourceDependencyPaths = discovered;
136221
+ } catch {}
136222
+ }
136223
+ collectEntrypointModuleResourcePaths(compilation, entrypointName) {
136224
+ var _entrypoints_get;
136225
+ const collectedResourcePaths = new Set();
136226
+ const entrypoints = null == compilation ? void 0 : compilation.entrypoints;
136227
+ const entrypoint = null == entrypoints ? void 0 : null == (_entrypoints_get = entrypoints.get) ? void 0 : _entrypoints_get.call(entrypoints, entrypointName);
136228
+ if (!entrypoint) return collectedResourcePaths;
136229
+ const chunkGraph = null == compilation ? void 0 : compilation.chunkGraph;
136230
+ if (!chunkGraph) return collectedResourcePaths;
136231
+ const entrypointChunks = Array.from((null == entrypoint ? void 0 : entrypoint.chunks) || []);
136232
+ for (const chunk of entrypointChunks){
136233
+ var _chunkGraph_getChunkModulesIterable, _chunkGraph_getChunkModulesIterableBySourceType, _chunkGraph_getChunkModules;
136234
+ const modulesIterable = (null == (_chunkGraph_getChunkModulesIterable = chunkGraph.getChunkModulesIterable) ? void 0 : _chunkGraph_getChunkModulesIterable.call(chunkGraph, chunk)) || (null == (_chunkGraph_getChunkModulesIterableBySourceType = chunkGraph.getChunkModulesIterableBySourceType) ? void 0 : _chunkGraph_getChunkModulesIterableBySourceType.call(chunkGraph, chunk, "javascript")) || (null == (_chunkGraph_getChunkModules = chunkGraph.getChunkModules) ? void 0 : _chunkGraph_getChunkModules.call(chunkGraph, chunk));
136235
+ if (modulesIterable) for (const module of modulesIterable){
136236
+ var _module_rootModule, _module_originalSource, _module_originalSource1;
136237
+ const resourcePath = (null == module ? void 0 : module.resource) || (null == module ? void 0 : null == (_module_rootModule = module.rootModule) ? void 0 : _module_rootModule.resource) || (null == module ? void 0 : null == (_module_originalSource1 = module.originalSource) ? void 0 : null == (_module_originalSource = _module_originalSource1.call(module)) ? void 0 : _module_originalSource.resource);
136238
+ if ('string' == typeof resourcePath && resourcePath.length > 0) collectedResourcePaths.add(resourcePath.replace(/\\/g, '/'));
136239
+ }
136240
+ }
136241
+ return collectedResourcePaths;
136242
+ }
135033
136243
  constructor(options, ctx){
135034
136244
  chromium_hard_reload_define_property(this, "options", void 0);
135035
136245
  chromium_hard_reload_define_property(this, "ctx", void 0);
135036
136246
  chromium_hard_reload_define_property(this, "logger", void 0);
135037
136247
  chromium_hard_reload_define_property(this, "warnedDevMode", void 0);
136248
+ chromium_hard_reload_define_property(this, "serviceWorkerSourceDependencyPaths", void 0);
135038
136249
  this.options = options;
135039
136250
  this.ctx = ctx;
136251
+ this.serviceWorkerSourceDependencyPaths = new Set();
135040
136252
  }
135041
136253
  }
135042
136254
  async function waitForChromeRemoteDebugging(port, instanceId) {
@@ -135525,8 +136737,6 @@ var __webpack_exports__ = {};
135525
136737
  didLaunch: false
135526
136738
  };
135527
136739
  }
135528
- var external_firefox_location2_ = __webpack_require__("firefox-location2");
135529
- var external_firefox_location2_default = /*#__PURE__*/ __webpack_require__.n(external_firefox_location2_);
135530
136740
  function setupFirefoxProcessHandlers(browser, childRef, cleanupInstance) {
135531
136741
  let isCleaningUp = false;
135532
136742
  const attemptCleanup = async ()=>{
@@ -136120,7 +137330,7 @@ var __webpack_exports__ = {};
136120
137330
  if (Array.isArray(codeWanted)) return codeWanted.includes(code);
136121
137331
  return code === codeWanted;
136122
137332
  }
136123
- async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId) {
137333
+ async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
136124
137334
  try {
136125
137335
  let chosenPath = null;
136126
137336
  for (const p of candidateAddonPaths){
@@ -136149,7 +137359,8 @@ var __webpack_exports__ = {};
136149
137359
  extensionId: extensionId || '(temporary)',
136150
137360
  name: manifest.name,
136151
137361
  version: manifest.version
136152
- })
137362
+ }),
137363
+ browserVersionLine
136153
137364
  });
136154
137365
  }
136155
137366
  }
@@ -136465,7 +137676,7 @@ var __webpack_exports__ = {};
136465
137676
  throw lastError;
136466
137677
  }
136467
137678
  async installAddons(compilation) {
136468
- var _compilation_options_devServer, _compilation_options, _this_options, _compilation_options1;
137679
+ var _compilation_options_devServer, _compilation_options, _this_options;
136469
137680
  const { devtools } = this.options;
136470
137681
  const rawExtensions = (Array.isArray(this.options.extensionsToLoad) && this.options.extensionsToLoad.length ? this.options.extensionsToLoad : void 0) || (Array.isArray(this.options.extension) ? this.options.extension : [
136471
137682
  this.options.extension
@@ -136518,7 +137729,7 @@ var __webpack_exports__ = {};
136518
137729
  if (!this.derivedExtensionId) this.derivedExtensionId = await deriveMozExtensionId(client);
136519
137730
  } catch {}
136520
137731
  this.lastInstalledAddonPath = candidateAddonPaths[0];
136521
- if ((null == compilation ? void 0 : null == (_compilation_options1 = compilation.options) ? void 0 : _compilation_options1.mode) !== 'production') printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId);
137732
+ printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
136522
137733
  }
136523
137734
  markNeedsReinstall() {
136524
137735
  this.needsReinstall = true;
@@ -136700,7 +137911,8 @@ var __webpack_exports__ = {};
136700
137911
  instanceId: plugin.instanceId,
136701
137912
  port: debugPort,
136702
137913
  source: 'string' == typeof plugin.source ? plugin.source : void 0,
136703
- watchSource: plugin.watchSource
137914
+ watchSource: plugin.watchSource,
137915
+ browserVersionLine: plugin.browserVersionLine
136704
137916
  });
136705
137917
  this.debugPort = 'string' == typeof debugPort ? parseInt(debugPort, 10) : debugPort;
136706
137918
  }
@@ -136726,12 +137938,6 @@ var __webpack_exports__ = {};
136726
137938
  await retry(()=>controller.ensureLoaded(compilation));
136727
137939
  plugin.rdpController = controller;
136728
137940
  }
136729
- try {
136730
- const list = Array.isArray(plugin.extensionsToLoad) ? plugin.extensionsToLoad : Array.isArray(plugin.extension) ? plugin.extension : 'string' == typeof plugin.extension ? [
136731
- plugin.extension
136732
- ] : [];
136733
- if (list.length) await printRunningInDevelopmentSummary(list, 'firefox');
136734
- } catch {}
136735
137941
  return controller;
136736
137942
  }
136737
137943
  function logFirefoxDryRun(browserBinaryLocation, firefoxConfig) {
@@ -137000,10 +138206,7 @@ var __webpack_exports__ = {};
137000
138206
  else if (!skipDetection) if (engineBased) {
137001
138207
  console.error(requireGeckoBinaryForGeckoBased());
137002
138208
  process.exit(1);
137003
- } else {
137004
- const locate = external_firefox_location2_default()["default"] || external_firefox_location2_default();
137005
- browserBinaryLocation = 'function' == typeof locate ? locate(true) : null;
137006
- }
138209
+ } else browserBinaryLocation = external_firefox_location2_default()(true);
137007
138210
  } catch (_error) {
137008
138211
  console.error(this.host.geckoBinary ? invalidGeckoBinaryPath(this.host.geckoBinary) : requireGeckoBinaryForGeckoBased());
137009
138212
  process.exit(1);
@@ -137017,9 +138220,7 @@ var __webpack_exports__ = {};
137017
138220
  } else {
137018
138221
  const guidance = (()=>{
137019
138222
  try {
137020
- const f = null === external_firefox_location2_default() || void 0 === external_firefox_location2_default() ? void 0 : external_firefox_location2_default().getInstallGuidance;
137021
- const txt = 'function' == typeof f ? f() : '';
137022
- return txt && 'string' == typeof txt ? txt : 'npx @puppeteer/browsers install firefox';
138223
+ return (0, external_firefox_location2_namespaceObject.getInstallGuidance)();
137023
138224
  } catch {
137024
138225
  return 'npx @puppeteer/browsers install firefox';
137025
138226
  }
@@ -137030,6 +138231,11 @@ var __webpack_exports__ = {};
137030
138231
  }
137031
138232
  }
137032
138233
  const binaryPath = browserBinaryLocation;
138234
+ try {
138235
+ this.host.browserVersionLine = (0, external_firefox_location2_namespaceObject.getFirefoxVersion)(binaryPath, {
138236
+ allowExec: true
138237
+ }) || '';
138238
+ } catch {}
137033
138239
  try {
137034
138240
  await FirefoxBinaryDetector.validateFirefoxBinary(binaryPath);
137035
138241
  } catch {}
@@ -137724,14 +138930,19 @@ var __webpack_exports__ = {};
137724
138930
  const { manifestPath } = projectStructure;
137725
138931
  const { packageJsonDir } = getDirs(projectStructure);
137726
138932
  const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
137727
- const userExtensionOutputPath = asAbsolute(external_path_.isAbsolute(devOptions.output.path) ? devOptions.output.path : external_path_.resolve(packageJsonDir, devOptions.output.path));
137728
- const extensionsToLoad = computeExtensionsToLoad(__dirname, devOptions.mode, devOptions.browser, userExtensionOutputPath);
138933
+ const primaryExtensionOutputDir = asAbsolute(external_path_.isAbsolute(devOptions.output.path) ? devOptions.output.path : external_path_.resolve(packageJsonDir, devOptions.output.path));
138934
+ const companionUnpackedExtensionDirs = resolveCompanionExtensionDirs({
138935
+ projectRoot: packageJsonDir,
138936
+ config: devOptions.extensions
138937
+ });
138938
+ const unpackedExtensionDirsToLoad = computeExtensionsToLoad(external_path_.resolve(__dirname, '..'), devOptions.mode, devOptions.browser, primaryExtensionOutputDir, companionUnpackedExtensionDirs);
137729
138939
  const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
137730
138940
  if (debug) {
137731
138941
  console.log(webpack_lib_messages.Ry(devOptions.browser, devOptions.chromiumBinary, devOptions.geckoBinary));
137732
138942
  console.log(webpack_lib_messages.ZE(packageJsonDir));
137733
- console.log(webpack_lib_messages.$T(userExtensionOutputPath));
137734
- console.log(webpack_lib_messages.KH(extensionsToLoad));
138943
+ console.log(webpack_lib_messages.$T(primaryExtensionOutputDir));
138944
+ console.log(webpack_lib_messages.KH(unpackedExtensionDirsToLoad));
138945
+ if (void 0 !== devOptions.extensions && 0 === companionUnpackedExtensionDirs.length) console.warn(webpack_lib_messages.fH());
137735
138946
  }
137736
138947
  const darkDefaults = withDarkMode({
137737
138948
  browser: devOptions.browser,
@@ -137747,7 +138958,7 @@ var __webpack_exports__ = {};
137747
138958
  devtool: 'production' === (devOptions.mode || 'development') ? false : 3 === manifest.manifest_version ? 'cheap-source-map' : 'eval-cheap-source-map',
137748
138959
  output: {
137749
138960
  clean: devOptions.output.clean,
137750
- path: userExtensionOutputPath,
138961
+ path: primaryExtensionOutputDir,
137751
138962
  publicPath: '/',
137752
138963
  hotUpdateChunkFilename: 'hot/[id].[fullhash].hot-update.js',
137753
138964
  hotUpdateMainFilename: 'hot/[runtime].[fullhash].hot-update.json',
@@ -137834,7 +139045,7 @@ var __webpack_exports__ = {};
137834
139045
  browser: devOptions.browser
137835
139046
  }),
137836
139047
  new BrowsersPlugin({
137837
- extension: extensionsToLoad,
139048
+ extension: unpackedExtensionDirsToLoad,
137838
139049
  browser: devOptions.browser,
137839
139050
  noOpen: devOptions.noOpen,
137840
139051
  startingUrl: devOptions.startingUrl,
@@ -137894,22 +139105,11 @@ var __webpack_exports__ = {};
137894
139105
  runtimeChunk: false,
137895
139106
  moduleIds: 'deterministic',
137896
139107
  chunkIds: 'deterministic'
137897
- },
137898
- experiments: {
137899
- css: true,
137900
- asyncWebAssembly: true
137901
- }
137902
- };
137903
- }
137904
- function getBuildSummary(browser, info) {
137905
- const assets = (null == info ? void 0 : info.assets) || [];
137906
- return {
137907
- browser,
137908
- total_assets: assets.length,
137909
- total_bytes: assets.reduce((n, a)=>n + (a.size || 0), 0),
137910
- largest_asset_bytes: assets.reduce((m, a)=>Math.max(m, a.size || 0), 0),
137911
- warnings_count: ((null == info ? void 0 : info.warnings) || []).length,
137912
- errors_count: ((null == info ? void 0 : info.errors) || []).length
139108
+ },
139109
+ experiments: {
139110
+ css: true,
139111
+ asyncWebAssembly: true
139112
+ }
137913
139113
  };
137914
139114
  }
137915
139115
  async function extensionBuild(pathOrRemoteUrl, buildOptions) {
@@ -137969,26 +139169,7 @@ var __webpack_exports__ = {};
137969
139169
  }
137970
139170
  if (!(null == buildOptions ? void 0 : buildOptions.silent) && stats) console.log(webpack_lib_messages.LO(manifestDir, stats, browser));
137971
139171
  if (null == stats ? void 0 : stats.hasErrors()) {
137972
- try {
137973
- const verbose = '1' === String(process.env.EXTENSION_VERBOSE || '').trim();
137974
- const str = stats.toString({
137975
- colors: true,
137976
- all: false,
137977
- errors: true,
137978
- warnings: !!verbose
137979
- });
137980
- if (str) console.error(scrubBrand(str));
137981
- } catch {
137982
- try {
137983
- const str = stats.toString({
137984
- colors: true,
137985
- all: false,
137986
- errors: true,
137987
- warnings: true
137988
- });
137989
- if (str) console.error(str);
137990
- } catch {}
137991
- }
139172
+ handleStatsErrors(stats);
137992
139173
  if (!shouldExitOnError) return reject(new Error('Build failed with errors'));
137993
139174
  process.exit(1);
137994
139175
  } else {
@@ -138011,12 +139192,23 @@ var __webpack_exports__ = {};
138011
139192
  }
138012
139193
  }
138013
139194
  const dev_server_namespaceObject = require("@rspack/dev-server");
139195
+ function dev_server_messages_getLoggingPrefix(type) {
139196
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
139197
+ if (isAuthor) {
139198
+ const base = 'error' === type ? 'ERROR Author says' : "\u25BA\u25BA\u25BA Author says";
139199
+ return external_pintor_default().brightMagenta(base);
139200
+ }
139201
+ if ('error' === type) return external_pintor_default().red('ERROR');
139202
+ if ('warn' === type) return external_pintor_default().brightYellow("\u25BA\u25BA\u25BA");
139203
+ if ('info' === type) return external_pintor_default().gray("\u25BA\u25BA\u25BA");
139204
+ return external_pintor_default().green("\u25BA\u25BA\u25BA");
139205
+ }
138014
139206
  function messages_ready(mode, browser) {
138015
139207
  const extensionOutput = 'firefox' === browser || 'gecko-based' === browser || 'edge' === browser ? 'Add-on' : 'Extension';
138016
139208
  const b = String(browser || '');
138017
139209
  const cap = b.charAt(0).toUpperCase() + b.slice(1);
138018
139210
  const pretty = external_pintor_default().green('ready for ' + mode);
138019
- return `${external_pintor_default().gray("\u25BA\u25BA\u25BA")} ${cap} ${extensionOutput} ${pretty}.`;
139211
+ return `${dev_server_messages_getLoggingPrefix('info')} ${cap} ${extensionOutput} ${pretty}.`;
138020
139212
  }
138021
139213
  function messages_portInUse(requestedPort, newPort) {
138022
139214
  return `Port: Requested port ${external_pintor_default().brightBlue(requestedPort.toString())} is in use; using ${external_pintor_default().brightBlue(newPort.toString())} instead.`;
@@ -138132,48 +139324,6 @@ var __webpack_exports__ = {};
138132
139324
  this.basePort = basePort;
138133
139325
  }
138134
139326
  }
138135
- function parseMilliseconds(value) {
138136
- if ('number' == typeof value) return Number.isFinite(value) && value > 0 ? value : null;
138137
- if ('string' == typeof value) {
138138
- const parsed = parseInt(value, 10);
138139
- return !Number.isNaN(parsed) && parsed > 0 ? parsed : null;
138140
- }
138141
- return null;
138142
- }
138143
- function setupAutoExit(autoExitMsRaw, forceKillMsRaw, onCleanup) {
138144
- let autoExitTimer = null;
138145
- let forceKillTimer = null;
138146
- const autoExitMs = parseMilliseconds(autoExitMsRaw);
138147
- if (null === autoExitMs) return ()=>{};
138148
- try {
138149
- console.log(autoExitModeEnabled(autoExitMs));
138150
- } catch {}
138151
- autoExitTimer = setTimeout(async ()=>{
138152
- try {
138153
- console.log(autoExitTriggered(autoExitMs));
138154
- } catch {}
138155
- await onCleanup();
138156
- }, autoExitMs);
138157
- const parsedForceKillMs = parseMilliseconds(forceKillMsRaw);
138158
- const forceKillMs = null !== parsedForceKillMs && parsedForceKillMs > 0 ? parsedForceKillMs : autoExitMs + 4000;
138159
- forceKillTimer = setTimeout(()=>{
138160
- try {
138161
- console.log(autoExitForceKill(forceKillMs));
138162
- } catch {}
138163
- process.exit(0);
138164
- }, forceKillMs);
138165
- function cancelAutoExitTimers() {
138166
- if (null !== autoExitTimer) {
138167
- clearTimeout(autoExitTimer);
138168
- autoExitTimer = null;
138169
- }
138170
- if (null !== forceKillTimer) {
138171
- clearTimeout(forceKillTimer);
138172
- forceKillTimer = null;
138173
- }
138174
- }
138175
- return cancelAutoExitTimers;
138176
- }
138177
139327
  function hasDependency(projectPath, dependency) {
138178
139328
  const findNearestPackageJsonDirectory = (startPath)=>{
138179
139329
  let currentDirectory = startPath;
@@ -138206,48 +139356,10 @@ var __webpack_exports__ = {};
138206
139356
  ];
138207
139357
  return frameworks.some((fw)=>hasDependency(projectPath, fw));
138208
139358
  }
138209
- function closeAll(devServer, portManager) {
138210
- devServer.stop().then(async ()=>{
138211
- await portManager.terminateCurrentInstance();
138212
- setTimeout(()=>process.exit(), 500);
138213
- }).catch(async (error)=>{
138214
- console.log(messages_extensionJsRunnerError(error));
138215
- await portManager.terminateCurrentInstance();
138216
- setTimeout(()=>process.exit(1), 500);
138217
- });
139359
+ function sanitize_sanitize(obj) {
139360
+ return Object.fromEntries(Object.entries(obj || {}).filter(([, value])=>void 0 !== value));
138218
139361
  }
138219
- async function dev_server_devServer(projectStructure, devOptions) {
138220
- const { manifestPath, packageJsonPath } = projectStructure;
138221
- const manifestDir = external_path_.dirname(manifestPath);
138222
- const packageJsonDir = external_path_.dirname(packageJsonPath);
138223
- const commandConfig = await loadCommandConfig(packageJsonDir, 'dev');
138224
- const browserConfig = await loadBrowserConfig(packageJsonDir, devOptions.browser);
138225
- const portManager = new PortManager(devOptions.browser, packageJsonDir, 8080);
138226
- const desiredPort = 'string' == typeof devOptions.port ? parseInt(devOptions.port, 10) : devOptions.port;
138227
- const portAllocation = await portManager.allocatePorts(devOptions.browser, packageJsonDir, desiredPort);
138228
- const currentInstance = portManager.getCurrentInstance();
138229
- if (!currentInstance) throw new Error('Failed to create instance');
138230
- const sanitize = (obj)=>Object.fromEntries(Object.entries(obj || {}).filter(([, v])=>void 0 !== v));
138231
- const safeBrowserConfig = sanitize(browserConfig);
138232
- const safeCommandConfig = sanitize(commandConfig);
138233
- const safeDevOptions = sanitize(devOptions);
138234
- const baseConfig = webpackConfig(projectStructure, {
138235
- ...safeBrowserConfig,
138236
- ...safeCommandConfig,
138237
- ...safeDevOptions,
138238
- browser: devOptions.browser,
138239
- mode: 'development',
138240
- instanceId: currentInstance.instanceId,
138241
- port: portAllocation.port,
138242
- output: {
138243
- clean: false,
138244
- path: external_path_.join(packageJsonDir, 'dist', devOptions.browser)
138245
- }
138246
- });
138247
- const customWebpackConfig = await loadCustomWebpackConfig(manifestDir);
138248
- const finalConfig = customWebpackConfig(baseConfig);
138249
- const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(finalConfig, {});
138250
- const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
139362
+ function setupCompilerHooks(compiler, port) {
138251
139363
  const verbose = '1' === String(process.env.EXTENSION_VERBOSE || '').trim();
138252
139364
  let reportedNoEntries = false;
138253
139365
  compiler.hooks.invalid.tap('extension.js:invalid', ()=>{
@@ -138289,8 +139401,7 @@ var __webpack_exports__ = {};
138289
139401
  const hasEntrypoints = entrypoints && Object.keys(entrypoints).length > 0;
138290
139402
  if (!hasAssets && !hasEntrypoints) {
138291
139403
  reportedNoEntries = true;
138292
- const hookPort = portAllocation.port;
138293
- console.warn(noEntrypointsDetected(hookPort));
139404
+ console.warn(noEntrypointsDetected(port));
138294
139405
  }
138295
139406
  }
138296
139407
  } catch (error) {
@@ -138303,6 +139414,121 @@ var __webpack_exports__ = {};
138303
139414
  if (str) console.error(scrubBrand(str));
138304
139415
  }
138305
139416
  });
139417
+ }
139418
+ function parseMilliseconds(value) {
139419
+ if ('number' == typeof value) return Number.isFinite(value) && value > 0 ? value : null;
139420
+ if ('string' == typeof value) {
139421
+ const parsed = parseInt(value, 10);
139422
+ return !Number.isNaN(parsed) && parsed > 0 ? parsed : null;
139423
+ }
139424
+ return null;
139425
+ }
139426
+ function setupAutoExit(autoExitMsRaw, forceKillMsRaw, onCleanup) {
139427
+ let autoExitTimer = null;
139428
+ let forceKillTimer = null;
139429
+ const autoExitMs = parseMilliseconds(autoExitMsRaw);
139430
+ if (null === autoExitMs) return ()=>{};
139431
+ try {
139432
+ console.log(autoExitModeEnabled(autoExitMs));
139433
+ } catch {}
139434
+ autoExitTimer = setTimeout(async ()=>{
139435
+ try {
139436
+ console.log(autoExitTriggered(autoExitMs));
139437
+ } catch {}
139438
+ await onCleanup();
139439
+ }, autoExitMs);
139440
+ const parsedForceKillMs = parseMilliseconds(forceKillMsRaw);
139441
+ const forceKillMs = null !== parsedForceKillMs && parsedForceKillMs > 0 ? parsedForceKillMs : autoExitMs + 4000;
139442
+ forceKillTimer = setTimeout(()=>{
139443
+ try {
139444
+ console.log(autoExitForceKill(forceKillMs));
139445
+ } catch {}
139446
+ process.exit(0);
139447
+ }, forceKillMs);
139448
+ function cancelAutoExitTimers() {
139449
+ if (null !== autoExitTimer) {
139450
+ clearTimeout(autoExitTimer);
139451
+ autoExitTimer = null;
139452
+ }
139453
+ if (null !== forceKillTimer) {
139454
+ clearTimeout(forceKillTimer);
139455
+ forceKillTimer = null;
139456
+ }
139457
+ }
139458
+ return cancelAutoExitTimers;
139459
+ }
139460
+ function closeAll(devServer, portManager) {
139461
+ return devServer.stop().then(async ()=>{
139462
+ await portManager.terminateCurrentInstance();
139463
+ setTimeout(()=>process.exit(), 500);
139464
+ }).catch(async (error)=>{
139465
+ console.log(messages_extensionJsRunnerError(error));
139466
+ await portManager.terminateCurrentInstance();
139467
+ setTimeout(()=>process.exit(1), 500);
139468
+ });
139469
+ }
139470
+ function setupCleanupHandlers(devServer, portManager) {
139471
+ const cleanup = async ()=>{
139472
+ try {
139473
+ await closeAll(devServer, portManager);
139474
+ } catch (error) {
139475
+ console.error('[Extension.js Runner] Error during cleanup.', error);
139476
+ process.exit(1);
139477
+ }
139478
+ };
139479
+ process.on('uncaughtException', async (error)=>{
139480
+ console.error('[Extension.js Runner] Uncaught exception.', error);
139481
+ await cleanup();
139482
+ });
139483
+ process.on('unhandledRejection', async (reason, promise)=>{
139484
+ console.error('[Extension.js Runner] Unhandled rejection.', promise, reason);
139485
+ await cleanup();
139486
+ });
139487
+ const cancelAutoExit = setupAutoExit(process.env.EXTENSION_AUTO_EXIT_MS, process.env.EXTENSION_FORCE_KILL_MS, cleanup);
139488
+ const cancelAndCleanup = async ()=>{
139489
+ try {
139490
+ cancelAutoExit();
139491
+ } catch {}
139492
+ await cleanup();
139493
+ };
139494
+ process.on('ERROR', cancelAndCleanup);
139495
+ process.on('SIGINT', cancelAndCleanup);
139496
+ process.on('SIGTERM', cancelAndCleanup);
139497
+ process.on('SIGHUP', cancelAndCleanup);
139498
+ return cancelAutoExit;
139499
+ }
139500
+ async function dev_server_devServer(projectStructure, devOptions) {
139501
+ const { manifestPath, packageJsonPath } = projectStructure;
139502
+ const manifestDir = external_path_.dirname(manifestPath);
139503
+ const packageJsonDir = external_path_.dirname(packageJsonPath);
139504
+ const commandConfig = await loadCommandConfig(packageJsonDir, 'dev');
139505
+ const browserConfig = await loadBrowserConfig(packageJsonDir, devOptions.browser);
139506
+ const portManager = new PortManager(devOptions.browser, packageJsonDir, 8080);
139507
+ const desiredPort = 'string' == typeof devOptions.port ? parseInt(devOptions.port, 10) : devOptions.port;
139508
+ const portAllocation = await portManager.allocatePorts(devOptions.browser, packageJsonDir, desiredPort);
139509
+ const currentInstance = portManager.getCurrentInstance();
139510
+ if (!currentInstance) throw new Error('Failed to create instance');
139511
+ const safeBrowserConfig = sanitize_sanitize(browserConfig);
139512
+ const safeCommandConfig = sanitize_sanitize(commandConfig);
139513
+ const safeDevOptions = sanitize_sanitize(devOptions);
139514
+ const baseConfig = webpackConfig(projectStructure, {
139515
+ ...safeBrowserConfig,
139516
+ ...safeCommandConfig,
139517
+ ...safeDevOptions,
139518
+ browser: devOptions.browser,
139519
+ mode: 'development',
139520
+ instanceId: currentInstance.instanceId,
139521
+ port: portAllocation.port,
139522
+ output: {
139523
+ clean: false,
139524
+ path: external_path_.join(packageJsonDir, 'dist', devOptions.browser)
139525
+ }
139526
+ });
139527
+ const customWebpackConfig = await loadCustomWebpackConfig(manifestDir);
139528
+ const finalConfig = customWebpackConfig(baseConfig);
139529
+ const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(finalConfig, {});
139530
+ const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
139531
+ setupCompilerHooks(compiler, portAllocation.port);
138306
139532
  const port = portAllocation.port;
138307
139533
  if (void 0 !== devOptions.port && devOptions.port !== port) console.log(messages_portInUse(devOptions.port, port));
138308
139534
  const serverConfig = {
@@ -138344,7 +139570,8 @@ var __webpack_exports__ = {};
138344
139570
  'Access-Control-Allow-Origin': '*'
138345
139571
  },
138346
139572
  port,
138347
- hot: true
139573
+ hot: 'only',
139574
+ liveReload: true
138348
139575
  };
138349
139576
  const devServer = new dev_server_namespaceObject.RspackDevServer(serverConfig, compiler);
138350
139577
  const START_TIMEOUT_MS = parseInt(String(process.env.EXTENSION_START_TIMEOUT_MS || '30000'), 10);
@@ -138361,37 +139588,7 @@ var __webpack_exports__ = {};
138361
139588
  console.log(messages_extensionJsRunnerError(error));
138362
139589
  process.exit(1);
138363
139590
  }
138364
- const cleanup = async ()=>{
138365
- try {
138366
- await closeAll(devServer, portManager);
138367
- } catch (error) {
138368
- console.error('[Extension.js Runner] Error during cleanup.', error);
138369
- process.exit(1);
138370
- }
138371
- };
138372
- process.on('ERROR', cleanup);
138373
- process.on('SIGINT', cleanup);
138374
- process.on('SIGTERM', cleanup);
138375
- process.on('SIGHUP', cleanup);
138376
- process.on('uncaughtException', async (error)=>{
138377
- console.error('[Extension.js Runner] Uncaught exception.', error);
138378
- await cleanup();
138379
- });
138380
- process.on('unhandledRejection', async (reason, promise)=>{
138381
- console.error('[Extension.js Runner] Unhandled rejection.', promise, reason);
138382
- await cleanup();
138383
- });
138384
- const cancelAutoExit = setupAutoExit(process.env.EXTENSION_AUTO_EXIT_MS, process.env.EXTENSION_FORCE_KILL_MS, cleanup);
138385
- const cancelAndCleanup = async ()=>{
138386
- try {
138387
- cancelAutoExit();
138388
- } catch {}
138389
- await cleanup();
138390
- };
138391
- process.on('ERROR', cancelAndCleanup);
138392
- process.on('SIGINT', cancelAndCleanup);
138393
- process.on('SIGTERM', cancelAndCleanup);
138394
- process.on('SIGHUP', cancelAndCleanup);
139591
+ setupCleanupHandlers(devServer, portManager);
138395
139592
  }
138396
139593
  const promises_namespaceObject = require("fs/promises");
138397
139594
  async function generateExtensionTypes(manifestDir, packageJsonDir) {
@@ -138453,6 +139650,25 @@ var __webpack_exports__ = {};
138453
139650
  process.exit(1);
138454
139651
  }
138455
139652
  }
139653
+ function createShutdownHandler(compiler) {
139654
+ let isShuttingDown = false;
139655
+ const shutdown = (code = 0)=>{
139656
+ if (isShuttingDown) return;
139657
+ isShuttingDown = true;
139658
+ try {
139659
+ compiler.close(()=>{
139660
+ process.exit(code);
139661
+ });
139662
+ setTimeout(()=>process.exit(code), 2000);
139663
+ } catch {
139664
+ process.exit(code);
139665
+ }
139666
+ };
139667
+ process.on('SIGINT', ()=>shutdown(0));
139668
+ process.on('SIGTERM', ()=>shutdown(0));
139669
+ process.on('SIGHUP', ()=>shutdown(0));
139670
+ return shutdown;
139671
+ }
138456
139672
  async function extensionPreview(pathOrRemoteUrl, previewOptions) {
138457
139673
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
138458
139674
  const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
@@ -138471,28 +139687,19 @@ var __webpack_exports__ = {};
138471
139687
  } catch {}
138472
139688
  try {
138473
139689
  var _baseConfig_plugins;
138474
- const commandConfig = await loadCommandConfig(manifestDir, 'preview');
138475
- const browserConfig = await loadBrowserConfig(manifestDir, browser);
139690
+ const commandConfig = await loadCommandConfig(packageJsonDir, 'preview');
139691
+ const browserConfig = await loadBrowserConfig(packageJsonDir, browser);
138476
139692
  console.log(webpack_lib_messages.WW(browser));
139693
+ const safeBrowserConfig = sanitize_sanitize(browserConfig);
139694
+ const safeCommandConfig = sanitize_sanitize(commandConfig);
139695
+ const safePreviewOptions = sanitize_sanitize(previewOptions);
138477
139696
  const baseConfig = webpackConfig(projectStructure, {
138478
- ...browserConfig,
138479
- ...commandConfig,
139697
+ ...safeBrowserConfig,
139698
+ ...safeCommandConfig,
139699
+ ...safePreviewOptions,
138480
139700
  mode: 'production',
138481
- profile: previewOptions.profile,
138482
139701
  browser,
138483
- chromiumBinary: previewOptions.chromiumBinary,
138484
- geckoBinary: previewOptions.geckoBinary || previewOptions.firefoxBinary,
138485
- startingUrl: previewOptions.startingUrl,
138486
- port: previewOptions.port,
138487
- source: previewOptions.source,
138488
- watchSource: previewOptions.watchSource,
138489
- logLevel: previewOptions.logLevel,
138490
- logContexts: previewOptions.logContexts,
138491
- logFormat: previewOptions.logFormat,
138492
- logTimestamps: previewOptions.logTimestamps,
138493
- logColor: previewOptions.logColor,
138494
- logUrl: previewOptions.logUrl,
138495
- logTab: previewOptions.logTab,
139702
+ geckoBinary: safePreviewOptions.geckoBinary || safePreviewOptions.firefoxBinary,
138496
139703
  output: {
138497
139704
  clean: false,
138498
139705
  path: outputPath
@@ -138506,54 +139713,15 @@ var __webpack_exports__ = {};
138506
139713
  });
138507
139714
  const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(userConfig);
138508
139715
  const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
138509
- let isShuttingDown = false;
138510
- const shutdown = (code = 0)=>{
138511
- if (isShuttingDown) return;
138512
- isShuttingDown = true;
138513
- try {
138514
- compiler.close(()=>{
138515
- process.exit(code);
138516
- });
138517
- setTimeout(()=>process.exit(code), 2000);
138518
- } catch {
138519
- process.exit(code);
138520
- }
138521
- };
138522
- process.on('SIGINT', ()=>shutdown(0));
138523
- process.on('SIGTERM', ()=>shutdown(0));
138524
- process.on('SIGHUP', ()=>shutdown(0));
139716
+ const shutdown = createShutdownHandler(compiler);
138525
139717
  compiler.run((err, stats)=>{
138526
139718
  if (err) {
138527
139719
  console.error(err.stack || err);
138528
139720
  shutdown(1);
138529
139721
  }
138530
139722
  if (null == stats ? void 0 : stats.hasErrors()) {
138531
- try {
138532
- var _stats_toString;
138533
- const verbose = '1' === String(process.env.EXTENSION_VERBOSE || '').trim();
138534
- const str = null == stats ? void 0 : null == (_stats_toString = stats.toString) ? void 0 : _stats_toString.call(stats, {
138535
- colors: true,
138536
- all: false,
138537
- errors: true,
138538
- warnings: !!verbose
138539
- });
138540
- if (str) console.error(scrubBrand(str));
138541
- } catch {
138542
- try {
138543
- var _stats_toString1;
138544
- const str = null == stats ? void 0 : null == (_stats_toString1 = stats.toString) ? void 0 : _stats_toString1.call(stats, {
138545
- colors: true,
138546
- all: false,
138547
- errors: true,
138548
- warnings: true
138549
- });
138550
- if (str) console.error(str);
138551
- } catch {}
138552
- }
139723
+ handleStatsErrors(stats);
138553
139724
  shutdown(1);
138554
- } else {
138555
- console.log('');
138556
- console.log(webpack_lib_messages.km(manifestDir));
138557
139725
  }
138558
139726
  });
138559
139727
  } catch (error) {
@@ -138567,8 +139735,8 @@ var __webpack_exports__ = {};
138567
139735
  const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
138568
139736
  const browser = normalizeBrowser(startOptions.browser || 'chrome', startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary);
138569
139737
  const { manifestDir, packageJsonDir } = getDirs(projectStructure);
138570
- const commandConfig = await loadCommandConfig(manifestDir, 'start');
138571
- const browserConfig = await loadBrowserConfig(manifestDir, browser);
139738
+ const commandConfig = await loadCommandConfig(packageJsonDir, 'start');
139739
+ const browserConfig = await loadBrowserConfig(packageJsonDir, browser);
138572
139740
  const distPath = getDistPath(packageJsonDir, browser);
138573
139741
  if (debug) {
138574
139742
  console.log(webpack_lib_messages.OF(manifestDir, packageJsonDir));