extension-develop 3.1.1 → 3.2.0-next.10

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
@@ -127144,11 +127144,11 @@ var __webpack_modules__ = {
127144
127144
  }
127145
127145
  }
127146
127146
  const printedKeys = new Set();
127147
- function readUpdateMessageOnce() {
127148
- const message = process.env.EXTENSION_CLI_UPDATE_MESSAGE;
127149
- if (!message) return null;
127150
- delete process.env.EXTENSION_CLI_UPDATE_MESSAGE;
127151
- return message;
127147
+ function readUpdateSuffixOnce() {
127148
+ const suffix = process.env.EXTENSION_CLI_UPDATE_SUFFIX;
127149
+ if (!suffix) return null;
127150
+ delete process.env.EXTENSION_CLI_UPDATE_SUFFIX;
127151
+ return suffix;
127152
127152
  }
127153
127153
  function keyFor(browser, outPath, hp) {
127154
127154
  const host = (hp?.host || '127.0.0.1').toString();
@@ -127160,6 +127160,7 @@ var __webpack_modules__ = {
127160
127160
  if (printedKeys.has(k)) return false;
127161
127161
  const info = await opts.getInfo() || null;
127162
127162
  const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
127163
+ const updateSuffix = readUpdateSuffixOnce();
127163
127164
  if (!external_fs_.existsSync(manifestPath)) return false;
127164
127165
  const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
127165
127166
  const extensionId = info?.extensionId || opts.fallback?.extensionId || '(temporary)';
@@ -127175,9 +127176,7 @@ var __webpack_modules__ = {
127175
127176
  }
127176
127177
  };
127177
127178
  console.log(messages.io8());
127178
- console.log(messages.e_P(manifest, opts.browser, message, opts.browserVersionLine));
127179
- const updateMessage = readUpdateMessageOnce();
127180
- if (updateMessage) console.log(updateMessage);
127179
+ console.log(messages.e_P(manifest, opts.browser, message, opts.browserVersionLine, updateSuffix || void 0));
127181
127180
  console.log(messages.io8());
127182
127181
  markBannerPrinted();
127183
127182
  process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
@@ -127188,6 +127187,7 @@ var __webpack_modules__ = {
127188
127187
  const k = keyFor(opts.browser, opts.outPath);
127189
127188
  if (printedKeys.has(k)) return false;
127190
127189
  const browserLabel = opts.browserVersionLine && opts.browserVersionLine.trim().length > 0 ? opts.browserVersionLine.trim() : String(opts.browser || 'unknown');
127190
+ const updateSuffix = readUpdateSuffixOnce();
127191
127191
  try {
127192
127192
  const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
127193
127193
  const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
@@ -127202,9 +127202,7 @@ var __webpack_modules__ = {
127202
127202
  }
127203
127203
  };
127204
127204
  console.log(messages.io8());
127205
- console.log(messages.e_P(manifest, opts.browser, message, browserLabel));
127206
- const updateMessage = readUpdateMessageOnce();
127207
- if (updateMessage) console.log(updateMessage);
127205
+ console.log(messages.e_P(manifest, opts.browser, message, browserLabel, updateSuffix || void 0));
127208
127206
  console.log(messages.io8());
127209
127207
  } else {
127210
127208
  const message = {
@@ -127217,16 +127215,12 @@ var __webpack_modules__ = {
127217
127215
  }
127218
127216
  };
127219
127217
  console.log(messages.io8());
127220
- console.log(messages.e_P(manifest, opts.browser, message, browserLabel));
127221
- const updateMessage = readUpdateMessageOnce();
127222
- if (updateMessage) console.log(updateMessage);
127218
+ console.log(messages.e_P(manifest, opts.browser, message, browserLabel, updateSuffix || void 0));
127223
127219
  console.log(messages.io8());
127224
127220
  }
127225
127221
  } catch {
127226
127222
  console.log(messages.io8());
127227
127223
  console.log(webpack_lib_messages.Al(opts.outPath, browserLabel));
127228
- const updateMessage = readUpdateMessageOnce();
127229
- if (updateMessage) console.log(updateMessage);
127230
127224
  console.log(messages.io8());
127231
127225
  }
127232
127226
  markBannerPrinted();
@@ -127428,6 +127422,11 @@ var __webpack_modules__ = {
127428
127422
  const maybe = error?.message;
127429
127423
  return String(maybe || error);
127430
127424
  }
127425
+ function isWsl() {
127426
+ const hasEnv = Boolean(String(process.env.WSL_DISTRO_NAME || '').trim() || String(process.env.WSL_INTEROP || '').trim() || String(process.env.WSLENV || '').trim());
127427
+ if (hasEnv) return true;
127428
+ return false;
127429
+ }
127431
127430
  function capitalizedBrowserName(browser) {
127432
127431
  return `${browser.charAt(0).toUpperCase() + browser.slice(1)}`;
127433
127432
  }
@@ -127474,7 +127473,12 @@ var __webpack_modules__ = {
127474
127473
  }
127475
127474
  function browserNotInstalledError(browser, browserBinaryLocation) {
127476
127475
  const isUnreachable = 'null' == browserBinaryLocation ? `Browser ${capitalizedBrowserName(browser)} is not installed\n` : `Can't find the path for browser ${capitalizedBrowserName(browser)}\n`;
127477
- return `${getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${pintor__rspack_import_0_default().blue('--browser')} ${pintor__rspack_import_0_default().gray('<chrome|edge|firefox>')}.\n\n${pintor__rspack_import_0_default().red('NOT FOUND')} ${pintor__rspack_import_0_default().underline(browserBinaryLocation || capitalizedBrowserName(browser) + 'BROWSER')}`;
127476
+ const wslHint = (()=>{
127477
+ if (!isWsl()) return '';
127478
+ const example = '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe';
127479
+ return `\n\n${getLoggingPrefix('info')} WSL detected\n- Install a Linux browser in WSL, or\n- Provide a Windows binary path via ${pintor__rspack_import_0_default().blue('--chromium-binary')} ${pintor__rspack_import_0_default().gray(`\"${example}\"`)}\n (Tip: a shell alias like ${pintor__rspack_import_0_default().gray('google-chrome=...')} won't be used by Extension.js; use a real path or wrapper script.)`;
127480
+ })();
127481
+ return `${getLoggingPrefix('error')} ${isUnreachable}Either install the missing browser or choose a different one via ${pintor__rspack_import_0_default().blue('--browser')} ${pintor__rspack_import_0_default().gray('<chrome|edge|firefox>')}.\n\n${pintor__rspack_import_0_default().red('NOT FOUND')} ${pintor__rspack_import_0_default().underline(browserBinaryLocation || capitalizedBrowserName(browser) + 'BROWSER')}` + wslHint;
127478
127482
  }
127479
127483
  function browserLaunchError(browser, error) {
127480
127484
  return `${getLoggingPrefix('error')} Error launching ${capitalizedBrowserName(browser)}:\n${pintor__rspack_import_0_default().red(errorDetail(error))}`;
@@ -127835,7 +127839,7 @@ var __webpack_modules__ = {
127835
127839
  function firefoxRdpClientFailedToGetMainHTML() {
127836
127840
  return `${getLoggingPrefix('error')} Failed to get Firefox main HTML`;
127837
127841
  }
127838
- function runningInDevelopment(manifest, browser, message, browserVersionLine) {
127842
+ function runningInDevelopment(manifest, browser, message, browserVersionLine, updateSuffix) {
127839
127843
  const capitalize = (str)=>str.charAt(0).toUpperCase() + str.slice(1);
127840
127844
  const manifestName = manifest.name || 'Extension.js';
127841
127845
  const { hostPermissions, permissions } = manifest;
@@ -127859,7 +127863,7 @@ var __webpack_modules__ = {
127859
127863
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) return `${getLoggingPrefix('error')} No management API info received from client for ${manifestName}. Investigate.`;
127860
127864
  }
127861
127865
  const { name = '', version: version1 = '' } = management;
127862
- const extensionVersion = process.env.EXTENSION_CLI_VERSION || (()=>{
127866
+ const extensionVersion = process.env.EXTENSION_DEVELOP_VERSION || process.env.EXTENSION_CLI_VERSION || (()=>{
127863
127867
  try {
127864
127868
  return require1('../../../package.json').version;
127865
127869
  } catch {
@@ -127925,7 +127929,8 @@ var __webpack_modules__ = {
127925
127929
  hostPermissions && hostPermissions.length;
127926
127930
  permissions && permissions.length;
127927
127931
  const lines = [];
127928
- lines.push(` 🧩 ${pintor__rspack_import_0_default().brightBlue('Extension.js')} ${pintor__rspack_import_0_default().gray(`${extensionVersion}`)}`, ` Browser ${pintor__rspack_import_0_default().gray(browserLabel)}`, ` Extension ${pintor__rspack_import_0_default().gray(version1 ? `${name} ${version1}` : name || manifestName)}`, ` Extension ID ${pintor__rspack_import_0_default().gray(cleanId)}`);
127932
+ const updateNotice = updateSuffix ? ` ${updateSuffix}` : '';
127933
+ lines.push(` 🧩 ${pintor__rspack_import_0_default().brightBlue('Extension.js')} ${pintor__rspack_import_0_default().gray(`${extensionVersion}`)}${updateNotice}`, ` Browser ${pintor__rspack_import_0_default().gray(browserLabel)}`, ` Extension ${pintor__rspack_import_0_default().gray(version1 ? `${name} ${version1}` : name || manifestName)}`, ` Extension ID ${pintor__rspack_import_0_default().gray(cleanId)}`);
127929
127934
  return lines.join('\n');
127930
127935
  }
127931
127936
  function emptyLine() {
@@ -128522,7 +128527,11 @@ var __webpack_modules__ = {
128522
128527
  await this.launchChromium(stats.compilation);
128523
128528
  this.didLaunch = true;
128524
128529
  this.logger.info(messages.ACl(this.options.browser, stats.compilation.options.mode));
128525
- } catch {}
128530
+ } catch (error) {
128531
+ try {
128532
+ this.logger.error(messages._D4(this.options.browser, error));
128533
+ } catch {}
128534
+ }
128526
128535
  });
128527
128536
  }
128528
128537
  async launchChromium(compilation, opts) {
@@ -129595,6 +129604,7 @@ var __webpack_modules__ = {
129595
129604
  const excludeFlags = configOptions.excludeBrowserFlags || [];
129596
129605
  const filteredFlags = (browserFlags || []).filter((flag)=>excludeFlags.every((ex)=>!String(flag).startsWith(ex)));
129597
129606
  if (filteredFlags.length > 0) binaryArgs.push(...filteredFlags);
129607
+ if (configOptions.startingUrl && !configOptions.noOpen) binaryArgs.push(String(configOptions.startingUrl));
129598
129608
  const outPath = compilation.options.output?.path || external_path_.resolve(process.cwd(), 'dist/firefox');
129599
129609
  const distRoot = external_path_.dirname(outPath);
129600
129610
  const useSystemProfile = 'true' === String(process.env.EXTENSION_USE_SYSTEM_PROFILE || process.env.EXTJS_USE_SYSTEM_PROFILE || '').toLowerCase().trim();
@@ -130594,7 +130604,6 @@ var __webpack_modules__ = {
130594
130604
  var child_process__rspack_import_2 = __webpack_require__("child_process");
130595
130605
  var pintor__rspack_import_3 = __webpack_require__("pintor");
130596
130606
  var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
130597
- var package_manager_detector__rspack_import_4 = __webpack_require__("package-manager-detector");
130598
130607
  function parseJsonSafe(text) {
130599
130608
  const s = text && 0xfeff === text.charCodeAt(0) ? text.slice(1) : text;
130600
130609
  return JSON.parse(s || '{}');
@@ -130609,20 +130618,35 @@ var __webpack_modules__ = {
130609
130618
  }
130610
130619
  function getPackageManagerFromEnv() {
130611
130620
  const ua = process.env.npm_config_user_agent;
130612
- if (!ua) return;
130613
- if (ua.includes('pnpm')) return 'pnpm';
130614
- if (ua.includes('yarn')) return 'yarn';
130615
- if (ua.includes('bun')) return 'bun';
130616
- if (ua.includes('npm')) return 'npm';
130621
+ if (ua) {
130622
+ if (ua.includes('pnpm')) return 'pnpm';
130623
+ if (ua.includes('yarn')) return 'yarn';
130624
+ if (ua.includes('bun')) return 'bun';
130625
+ if (ua.includes('npm')) return 'npm';
130626
+ }
130627
+ const execPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH;
130628
+ if (execPath) {
130629
+ if (execPath.includes('pnpm')) return 'pnpm';
130630
+ if (execPath.includes('yarn')) return 'yarn';
130631
+ if (execPath.includes('bun')) return 'bun';
130632
+ if (execPath.includes('npm')) return 'npm';
130633
+ }
130634
+ }
130635
+ function getLogPrefix(type) {
130636
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
130637
+ const base = 'error' === type ? 'ERROR Author says' : '►►► Author says';
130638
+ return pintor__rspack_import_3_default().brightMagenta(base);
130639
+ }
130640
+ return 'error' === type ? pintor__rspack_import_3_default().red('ERROR') : pintor__rspack_import_3_default().gray('►►►');
130617
130641
  }
130618
130642
  async function resolvePackageManager() {
130619
130643
  const envPm = getPackageManagerFromEnv();
130620
130644
  if (envPm) return envPm;
130621
- return (0, package_manager_detector__rspack_import_4.detect)();
130645
+ return 'npm';
130622
130646
  }
130623
130647
  function getOptionalInstallCommand(pm, dependencies) {
130624
130648
  const quotedDir = JSON.stringify(__dirname);
130625
- const pmName = 'string' == typeof pm ? pm : pm?.name;
130649
+ const pmName = pm;
130626
130650
  if ('yarn' === pmName) return `yarn --silent add ${dependencies.join(' ')} --cwd ${quotedDir} --optional`;
130627
130651
  if ('npm' === pmName || isFromNpx()) return `npm --silent install ${dependencies.join(' ')} --prefix ${quotedDir} --save-optional`;
130628
130652
  if (isFromPnpx()) return `pnpm --silent add ${dependencies.join(' ')} --prefix ${quotedDir} --save-optional`;
@@ -130630,7 +130654,7 @@ var __webpack_modules__ = {
130630
130654
  return `${fallback} --silent install ${dependencies.join(' ')} --cwd ${quotedDir} --optional`;
130631
130655
  }
130632
130656
  function getRootInstallCommand(pm) {
130633
- const pmName = 'string' == typeof pm ? pm : pm?.name;
130657
+ const pmName = pm;
130634
130658
  if ('yarn' === pmName) return "yarn install --silent";
130635
130659
  if ('npm' === pmName || isFromNpx()) return "npm install --silent";
130636
130660
  if (isFromPnpx()) return "pnpm install --silent";
@@ -130638,7 +130662,7 @@ var __webpack_modules__ = {
130638
130662
  }
130639
130663
  function formatToolingLabel(integrations, fallback) {
130640
130664
  const list = integrations && integrations.length > 0 ? integrations.join('/') : fallback;
130641
- return `Setting up ${list} tooling...`;
130665
+ return `${getLogPrefix('info')} Setting up ${list} tooling...`;
130642
130666
  }
130643
130667
  async function installOptionalDependencies(integration, dependencies) {
130644
130668
  if (!dependencies.length) return;
@@ -130660,7 +130684,7 @@ var __webpack_modules__ = {
130660
130684
  console.log(`${pintor__rspack_import_3_default().brightMagenta('►►► Author says')} ${integration} tooling ready.`);
130661
130685
  }
130662
130686
  } catch (error) {
130663
- console.error(`[${integration}] Failed to install dependencies.`, error);
130687
+ console.error(`${getLogPrefix('error')} [${integration}] Failed to install dependencies.\n${pintor__rspack_import_3_default().red(String(error?.message || error))}`);
130664
130688
  }
130665
130689
  }
130666
130690
  async function installOptionalDependenciesBatch(integration, dependencies, integrations) {
@@ -130681,7 +130705,7 @@ var __webpack_modules__ = {
130681
130705
  console.log(`${pintor__rspack_import_3_default().brightMagenta('►►► Author says')} ${integration} tooling ready.`);
130682
130706
  }
130683
130707
  } catch (error) {
130684
- console.error(`[${integration}] Failed to install dependencies.`, error);
130708
+ console.error(`${getLogPrefix('error')} [${integration}] Failed to install dependencies.\n${pintor__rspack_import_3_default().red(String(error?.message || error))}`);
130685
130709
  }
130686
130710
  }
130687
130711
  function hasDependency(projectPath, dependency) {
@@ -130751,7 +130775,7 @@ var __webpack_modules__ = {
130751
130775
  return `${pintor__rspack_import_0_default().gray('►►►')} Using ${pintor__rspack_import_0_default().brightBlue(name)}...`;
130752
130776
  }
130753
130777
  function youAreAllSet(name) {
130754
- return `${pintor__rspack_import_0_default().green('►►►')} ${name} installation completed. Run again to proceed.`;
130778
+ return `${pintor__rspack_import_0_default().green('►►►')} ${name} installation completed.`;
130755
130779
  }
130756
130780
  function missingSassDependency() {
130757
130781
  const prefix = pintor__rspack_import_0_default().red('►►►');
@@ -131197,7 +131221,7 @@ var __webpack_modules__ = {
131197
131221
  return `${pintor__rspack_import_0_default().gray('►►►')} Using ${pintor__rspack_import_0_default().brightBlue(name)}...`;
131198
131222
  }
131199
131223
  function youAreAllSet(name) {
131200
- return `${pintor__rspack_import_0_default().green('►►►')} ${name} installation completed. Run again to proceed.`;
131224
+ return `${pintor__rspack_import_0_default().green('►►►')} ${name} installation completed.`;
131201
131225
  }
131202
131226
  function optionalDepsReady(integrations) {
131203
131227
  const list = integrations.length > 0 ? integrations.map((name)=>pintor__rspack_import_0_default().yellow(name)).join(', ') : pintor__rspack_import_0_default().gray('optional');
@@ -132076,6 +132100,7 @@ var __webpack_modules__ = {
132076
132100
  "./webpack/webpack-lib/messages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
132077
132101
  "use strict";
132078
132102
  __webpack_require__.d(__webpack_exports__, {
132103
+ $3: ()=>buildCommandFailed,
132079
132104
  AC: ()=>debugOutputPath,
132080
132105
  Al: ()=>runningInProduction,
132081
132106
  BT: ()=>treeWithSourceFiles,
@@ -132089,6 +132114,7 @@ var __webpack_modules__ = {
132089
132114
  I: ()=>buildWebpack,
132090
132115
  IV: ()=>packagingSourceFiles,
132091
132116
  Ke: ()=>installingDependenciesFailed,
132117
+ Px: ()=>buildDependenciesInstallError,
132092
132118
  RB: ()=>cantInstallDependencies,
132093
132119
  SG: ()=>debugDirs,
132094
132120
  Ud: ()=>downloadingText,
@@ -132108,7 +132134,10 @@ var __webpack_modules__ = {
132108
132134
  ng: ()=>writingTypeDefinitions,
132109
132135
  tQ: ()=>fetchingProjectPath,
132110
132136
  tc: ()=>invalidRemoteZip,
132137
+ um: ()=>buildDependenciesInstallFailed,
132111
132138
  v_: ()=>writingTypeDefinitionsError,
132139
+ vo: ()=>buildDependenciesManualInstall,
132140
+ xK: ()=>installingBuildDependencies,
132112
132141
  yp: ()=>noCompanionExtensionsResolved,
132113
132142
  zM: ()=>unpackagedSuccessfully
132114
132143
  });
@@ -132171,6 +132200,20 @@ var __webpack_modules__ = {
132171
132200
  function installingRequiredDependencies() {
132172
132201
  return `${getLoggingPrefix('info')} Installing required dependencies...`;
132173
132202
  }
132203
+ function installingBuildDependencies(dependencies) {
132204
+ const list = dependencies.map((dep)=>pintor__rspack_import_2_default().gray(dep)).join(', ');
132205
+ return `${getLoggingPrefix('info')} Installing build dependencies: ${list}`;
132206
+ }
132207
+ function buildDependenciesInstallFailed(command, args, code) {
132208
+ return `${getLoggingPrefix('error')} Failed to install build dependencies.\n${pintor__rspack_import_2_default().gray(command)} ${pintor__rspack_import_2_default().gray(args.join(' '))}\n${pintor__rspack_import_2_default().red(`exit code ${pintor__rspack_import_2_default().gray(String(code))}`)}`;
132209
+ }
132210
+ function buildDependenciesInstallError(error) {
132211
+ return `${getLoggingPrefix('error')} Error installing build dependencies.\n${pintor__rspack_import_2_default().red(String(error?.message || error))}`;
132212
+ }
132213
+ function buildDependenciesManualInstall(dependencies, dependenciesMap) {
132214
+ const list = dependencies.map((dep)=>`- ${pintor__rspack_import_2_default().gray(`${dep}@${dependenciesMap[dep]}`)}`).join('\n');
132215
+ return `${getLoggingPrefix('warn')} Please install the following build dependencies manually:\n${list}`;
132216
+ }
132174
132217
  function dependenciesInstalledRunAgain() {
132175
132218
  return `${getLoggingPrefix('success')} Dependencies installed. Run the command again to proceed.`;
132176
132219
  }
@@ -132333,6 +132376,13 @@ var __webpack_modules__ = {
132333
132376
  function configLoadingError(configPath, error) {
132334
132377
  return `${pintor__rspack_import_2_default().red('ERROR')} ${pintor__rspack_import_2_default().brightBlue('config load failed')}\n${fmt.label('PATH')} ${fmt.val(configPath)}\n` + pintor__rspack_import_2_default().red(fmt.truncate(error, 1200));
132335
132378
  }
132379
+ function buildCommandFailed(error) {
132380
+ const message = (()=>{
132381
+ if (error instanceof Error && error.message) return error.message;
132382
+ return String(error || 'Unknown error');
132383
+ })();
132384
+ return `${getLoggingPrefix('error')} Build failed.\n${pintor__rspack_import_2_default().red(fmt.truncate(message, 1200))}`;
132385
+ }
132336
132386
  function managedDependencyConflict(duplicates, userPackageJsonPath) {
132337
132387
  const list = duplicates.map((d)=>`- ${pintor__rspack_import_2_default().yellow(d)}`).join('\n');
132338
132388
  return `${getLoggingPrefix('error')} Your project declares dependencies that are managed by ${pintor__rspack_import_2_default().blue('Extension.js')} and referenced in ${pintor__rspack_import_2_default().underline('extension.config.js')}\n${pintor__rspack_import_2_default().red('This can cause version conflicts and break the development/build process.')}\n\n${pintor__rspack_import_2_default().gray('Managed dependencies (remove these from your package.json):')}\n${list}\n\n${pintor__rspack_import_2_default().gray('PATH')} ${pintor__rspack_import_2_default().underline(userPackageJsonPath)}\nIf you need a different version, open an issue so we can consider bundling it safely.\nOperation aborted.`;
@@ -132474,10 +132524,6 @@ var __webpack_modules__ = {
132474
132524
  "use strict";
132475
132525
  module.exports = require("child_process");
132476
132526
  },
132477
- chokidar (module) {
132478
- "use strict";
132479
- module.exports = require("chokidar");
132480
- },
132481
132527
  "chrome-location2" (module) {
132482
132528
  "use strict";
132483
132529
  module.exports = require("chrome-location2");
@@ -132534,10 +132580,6 @@ var __webpack_modules__ = {
132534
132580
  "use strict";
132535
132581
  module.exports = require("os");
132536
132582
  },
132537
- "package-manager-detector" (module) {
132538
- "use strict";
132539
- module.exports = require("package-manager-detector");
132540
- },
132541
132583
  "parse5-utilities" (module) {
132542
132584
  "use strict";
132543
132585
  module.exports = require("parse5-utilities");
@@ -132584,7 +132626,7 @@ var __webpack_modules__ = {
132584
132626
  },
132585
132627
  "./package.json" (module) {
132586
132628
  "use strict";
132587
- module.exports = JSON.parse('{"rE":"3.1.1","El":{"@rspack/core":"^1.7.2","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^5.0.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.0.3","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","package-manager-detector":"^1.6.0","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","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.19.0"}}');
132629
+ module.exports = JSON.parse('{"rE":"3.2.0-next.10","El":{"@rspack/core":"^1.7.2","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.0.3","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","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.19.0"}}');
132588
132630
  }
132589
132631
  };
132590
132632
  var __webpack_module_cache__ = {};
@@ -132930,20 +132972,28 @@ var __webpack_exports__ = {};
132930
132972
  return Object.keys(dependencies).filter((dep)=>!isDependencyInstalled(dep, packageRoot));
132931
132973
  }
132932
132974
  const external_cross_spawn_namespaceObject = require("cross-spawn");
132933
- var external_package_manager_detector_ = __webpack_require__("package-manager-detector");
132934
- async function getInstallCommand(packageRoot) {
132935
- const hasPnpmLock = external_fs_.existsSync(external_path_.join(packageRoot, 'pnpm-lock.yaml'));
132936
- const hasYarnLock = external_fs_.existsSync(external_path_.join(packageRoot, 'yarn.lock'));
132937
- const hasNpmLock = external_fs_.existsSync(external_path_.join(packageRoot, 'package-lock.json'));
132975
+ function detectPackageManagerFromEnv() {
132976
+ const userAgent = process.env.npm_config_user_agent || '';
132977
+ if (userAgent.includes('pnpm')) return 'pnpm';
132978
+ if (userAgent.includes('yarn')) return 'yarn';
132979
+ if (userAgent.includes('npm')) return 'npm';
132980
+ const execPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || '';
132981
+ if (execPath.includes('pnpm')) return 'pnpm';
132982
+ if (execPath.includes('yarn')) return 'yarn';
132983
+ execPath.includes('npm');
132984
+ return 'npm';
132985
+ }
132986
+ function getInstallCommandForPath(cwd) {
132987
+ const hasPnpmLock = external_fs_.existsSync(external_path_.join(cwd, 'pnpm-lock.yaml'));
132988
+ const hasYarnLock = external_fs_.existsSync(external_path_.join(cwd, 'yarn.lock'));
132989
+ const hasNpmLock = external_fs_.existsSync(external_path_.join(cwd, 'package-lock.json'));
132938
132990
  if (hasPnpmLock) return 'pnpm';
132939
132991
  if (hasYarnLock) return 'yarn';
132940
132992
  if (hasNpmLock) return 'npm';
132941
- const pm = await (0, external_package_manager_detector_.detect)({
132942
- cwd: packageRoot
132943
- });
132944
- if (pm?.name === 'yarn') return 'yarn';
132945
- if (pm?.name === 'pnpm') return 'pnpm';
132946
- return 'npm';
132993
+ return detectPackageManagerFromEnv();
132994
+ }
132995
+ async function getInstallCommand(packageRoot) {
132996
+ return getInstallCommandForPath(packageRoot);
132947
132997
  }
132948
132998
  function getInstallArgs(command, dependencies, dependenciesMap) {
132949
132999
  const depsWithVersions = dependencies.map((dep)=>`${dep}@${dependenciesMap[dep]}`);
@@ -132974,41 +133024,29 @@ var __webpack_exports__ = {};
132974
133024
  const command = await getInstallCommand(packageRoot);
132975
133025
  const installArgs = getInstallArgs(command, dependencies, dependenciesMap);
132976
133026
  const stdio = 'true' === process.env.EXTENSION_AUTHOR_MODE ? 'inherit' : 'ignore';
132977
- console.log(`Installing build dependencies: ${dependencies.join(', ')}`);
133027
+ console.log(messages.xK(dependencies));
132978
133028
  const child = (0, external_cross_spawn_namespaceObject.spawn)(command, installArgs, {
132979
133029
  stdio
132980
133030
  });
132981
133031
  await new Promise((resolve, reject)=>{
132982
133032
  child.on('close', (code)=>{
132983
- if (0 !== code) reject(new Error(`Failed to install build dependencies: ${command} ${installArgs.join(' ')} (exit code ${code})`));
133033
+ if (0 !== code) reject(new Error(messages.um(command, installArgs, code)));
132984
133034
  else resolve();
132985
133035
  });
132986
133036
  child.on('error', (error)=>{
132987
- reject(new Error(`Failed to install build dependencies: ${error.message}`));
133037
+ reject(error);
132988
133038
  });
132989
133039
  });
132990
133040
  } catch (error) {
132991
- console.error(`Error installing build dependencies: ${error.message}`);
132992
- console.error('Please install the following dependencies manually:', dependencies.map((dep)=>` ${dep}@${dependenciesMap[dep]}`).join('\n'));
133041
+ console.error(messages.Px(error));
133042
+ console.error(messages.vo(dependencies, dependenciesMap));
132993
133043
  process.exit(1);
132994
133044
  } finally{
132995
133045
  process.chdir(originalDirectory);
132996
133046
  }
132997
133047
  }
132998
133048
  async function install_dependencies_getInstallCommand() {
132999
- const cwd = process.cwd();
133000
- const hasPnpmLock = external_fs_.existsSync(external_path_.join(cwd, 'pnpm-lock.yaml'));
133001
- const hasYarnLock = external_fs_.existsSync(external_path_.join(cwd, 'yarn.lock'));
133002
- const hasNpmLock = external_fs_.existsSync(external_path_.join(cwd, 'package-lock.json'));
133003
- if (hasPnpmLock) return 'pnpm';
133004
- if (hasYarnLock) return 'yarn';
133005
- if (hasNpmLock) return 'npm';
133006
- const pm = await (0, external_package_manager_detector_.detect)({
133007
- cwd
133008
- });
133009
- if (pm?.name === 'yarn') return 'yarn';
133010
- if (pm?.name === 'pnpm') return 'pnpm';
133011
- return 'npm';
133049
+ return getInstallCommandForPath(process.cwd());
133012
133050
  }
133013
133051
  function install_dependencies_getInstallArgs() {
133014
133052
  return [
@@ -133301,19 +133339,14 @@ var __webpack_exports__ = {};
133301
133339
  const shouldExitOnError = (buildOptions?.exitOnError ?? true) && !isVitest;
133302
133340
  const browser = (0, paths.YN)(buildOptions?.browser || 'chrome', buildOptions?.chromiumBinary, buildOptions?.geckoBinary || buildOptions?.firefoxBinary);
133303
133341
  const { manifestDir, packageJsonDir } = (0, paths.fu)(projectStructure);
133342
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133304
133343
  try {
133305
- const depsResult = await ensureProjectReady(projectStructure, 'production', {
133306
- skipProjectInstall: isVitest || !projectStructure.packageJsonPath,
133307
- exitOnInstall: true
133344
+ const shouldInstallProjectDeps = !isAuthor || buildOptions?.install !== false;
133345
+ await ensureProjectReady(projectStructure, 'production', {
133346
+ skipProjectInstall: isVitest || !projectStructure.packageJsonPath || !shouldInstallProjectDeps,
133347
+ exitOnInstall: false,
133348
+ showRunAgainMessage: false
133308
133349
  });
133309
- if (depsResult.installed) return {
133310
- browser,
133311
- total_assets: 0,
133312
- total_bytes: 0,
133313
- largest_asset_bytes: 0,
133314
- warnings_count: 0,
133315
- errors_count: 0
133316
- };
133317
133350
  const [{ rspack }, { merge }, { handleStatsErrors }, { default: webpackConfig }] = await Promise.all([
133318
133351
  import("@rspack/core"),
133319
133352
  import("webpack-merge"),
@@ -133323,7 +133356,7 @@ var __webpack_exports__ = {};
133323
133356
  __webpack_require__.e("547")
133324
133357
  ]).then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-config.ts"))
133325
133358
  ]);
133326
- const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133359
+ const debug = isAuthor;
133327
133360
  if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
133328
133361
  const commandConfig = await (0, config_loader.eY)(manifestDir, 'build');
133329
133362
  const distPath = (0, paths.q4)(packageJsonDir, browser);
@@ -133383,7 +133416,9 @@ var __webpack_exports__ = {};
133383
133416
  });
133384
133417
  return summary;
133385
133418
  } catch (error) {
133386
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.error(error);
133419
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133420
+ if (isAuthor) console.error(error);
133421
+ else console.error(messages.$3(error));
133387
133422
  if (!shouldExitOnError) throw error;
133388
133423
  process.exit(1);
133389
133424
  }
@@ -133391,17 +133426,141 @@ var __webpack_exports__ = {};
133391
133426
  const promises_namespaceObject = require("fs/promises");
133392
133427
  async function generateExtensionTypes(manifestDir, packageJsonDir) {
133393
133428
  const extensionEnvFile = external_path_.join(packageJsonDir, 'extension-env.d.ts');
133394
- const typePath = 'extension';
133429
+ const { dependencies, devDependencies, peerDependencies, optionalDependencies } = await readPackageJson(packageJsonDir);
133430
+ const hasDependency = (name)=>Boolean(dependencies[name] || devDependencies[name] || peerDependencies[name] || optionalDependencies[name]);
133431
+ const usesReact = hasDependency('react') || hasDependency('@types/react');
133432
+ const usesReactDom = hasDependency('react-dom') || hasDependency('@types/react-dom');
133433
+ const usesSvelte = hasDependency('svelte');
133434
+ const frameworkTypeRefs = [
133435
+ usesReact ? '/// <reference types="react" />' : '',
133436
+ usesReactDom ? '/// <reference types="react-dom" />' : '',
133437
+ usesSvelte ? '/// <reference types="svelte" />' : ''
133438
+ ].filter(Boolean).join('\n');
133395
133439
  const fileContent = `\
133396
133440
  // Required Extension.js types for TypeScript projects.
133397
133441
  // This file is auto-generated and should not be excluded.
133398
- // If you need additional types, consider creating a new *.d.ts file and
133399
- // referencing it in the "include" array of your tsconfig.json file.
133400
- // See https://www.typescriptlang.org/tsconfig#include for more information.
133401
- /// <reference types="${typePath}/types" />
133442
+ //
133443
+ /// <reference types="webextension-polyfill" />
133444
+ /// <reference types="node" />
133445
+ /// <reference types="chrome" />
133446
+ ${frameworkTypeRefs}
133447
+
133448
+ declare global {
133449
+ // Align types with Extension.js runtime: we provide the browser global via
133450
+ // webextension-polyfill in Chromium, and it's natively available in Firefox.
133451
+ const browser: typeof import('webextension-polyfill')
133452
+
133453
+ type ExtensionBrowser =
133454
+ | 'chrome'
133455
+ | 'edge'
133456
+ | 'firefox'
133457
+ | 'chromium-based'
133458
+ | 'gecko-based'
133402
133459
 
133403
- // Polyfill types for browser.* APIs
133404
- /// <reference types="${typePath}/types/polyfill" />
133460
+ type ExtensionMode = 'development' | 'production'
133461
+
133462
+ interface ExtensionEnv {
133463
+ EXTENSION_BROWSER: ExtensionBrowser
133464
+ EXTENSION_MODE: ExtensionMode
133465
+ EXTENSION_PUBLIC_BROWSER: ExtensionBrowser
133466
+ EXTENSION_PUBLIC_MODE: ExtensionMode
133467
+ EXTENSION_PUBLIC_DESCRIPTION_TEXT: string
133468
+ EXTENSION_PUBLIC_LLM_API_KEY: string
133469
+ EXTENSION_AUTHOR_MODE: string
133470
+ EXTENSION_PUBLIC_AUTHOR_MODE: string
133471
+ }
133472
+
133473
+ namespace NodeJS {
133474
+ interface ProcessEnv extends ExtensionEnv {
133475
+ [key: string]: string | undefined
133476
+ }
133477
+ }
133478
+
133479
+ interface ImportMetaEnv extends ExtensionEnv {
133480
+ [key: string]: string | undefined
133481
+ }
133482
+
133483
+ interface ImportMeta {
133484
+ readonly env: ImportMetaEnv
133485
+ readonly webpackHot?: {
133486
+ accept: (module?: string | string[], callback?: () => void) => void
133487
+ dispose: (callback: () => void) => void
133488
+ }
133489
+ url: string
133490
+ }
133491
+
133492
+ interface Window {
133493
+ /**
133494
+ * @deprecated
133495
+ * @description
133496
+ * This is how Extension.js used to inject the shadow root into the window object.
133497
+ * Use the shadowRoot reference from the content script instead.
133498
+ */
133499
+ __EXTENSION_SHADOW_ROOT__: ShadowRoot
133500
+ }
133501
+ }
133502
+
133503
+ // Asset imports (CSS modules + static images)
133504
+ type CSSContentData = Readonly<Record<string, string>>
133505
+ type CSSModuleData = Readonly<Record<string, string>>
133506
+
133507
+ declare module '*.css' {
133508
+ const content: CSSContentData
133509
+ export default content
133510
+ }
133511
+
133512
+ declare module '*.module.css' {
133513
+ const content: CSSModuleData
133514
+ export default content
133515
+ }
133516
+ declare module '*.module.scss' {
133517
+ const content: CSSModuleData
133518
+ export default content
133519
+ }
133520
+ declare module '*.module.sass' {
133521
+ const content: CSSModuleData
133522
+ export default content
133523
+ }
133524
+
133525
+ declare module '*.png' {
133526
+ const content: string
133527
+ export default content
133528
+ }
133529
+ declare module '*.jpg' {
133530
+ const content: string
133531
+ export default content
133532
+ }
133533
+ declare module '*.jpeg' {
133534
+ const content: string
133535
+ export default content
133536
+ }
133537
+ declare module '*.gif' {
133538
+ const content: string
133539
+ export default content
133540
+ }
133541
+ declare module '*.webp' {
133542
+ const content: string
133543
+ export default content
133544
+ }
133545
+ declare module '*.avif' {
133546
+ const content: string
133547
+ export default content
133548
+ }
133549
+ declare module '*.ico' {
133550
+ const content: string
133551
+ export default content
133552
+ }
133553
+ declare module '*.bmp' {
133554
+ const content: string
133555
+ export default content
133556
+ }
133557
+ declare module '*.svg' {
133558
+ // Use any to avoid conflicts with SVGR or other SVG loaders.
133559
+ const content: any
133560
+ export default content
133561
+ }
133562
+
133563
+ export {}
133405
133564
  `;
133406
133565
  try {
133407
133566
  await promises_namespaceObject.access(extensionEnvFile);
@@ -133418,16 +133577,38 @@ var __webpack_exports__ = {};
133418
133577
  }
133419
133578
  }
133420
133579
  }
133580
+ async function readPackageJson(projectPath) {
133581
+ const packageJsonPath = external_path_.join(projectPath, 'package.json');
133582
+ try {
133583
+ const content = await promises_namespaceObject.readFile(packageJsonPath, 'utf8');
133584
+ const parsed = JSON.parse(content) || {};
133585
+ return {
133586
+ dependencies: parsed.dependencies || {},
133587
+ devDependencies: parsed.devDependencies || {},
133588
+ peerDependencies: parsed.peerDependencies || {},
133589
+ optionalDependencies: parsed.optionalDependencies || {}
133590
+ };
133591
+ } catch {
133592
+ return {
133593
+ dependencies: {},
133594
+ devDependencies: {},
133595
+ peerDependencies: {},
133596
+ optionalDependencies: {}
133597
+ };
133598
+ }
133599
+ }
133421
133600
  async function extensionDev(pathOrRemoteUrl, devOptions) {
133422
133601
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
133423
133602
  try {
133424
- const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133603
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133604
+ const debug = isAuthor;
133425
133605
  const { manifestDir, packageJsonDir } = (0, paths.fu)(projectStructure);
133426
- const depsResult = await ensureProjectReady(projectStructure, 'development', {
133427
- skipProjectInstall: !projectStructure.packageJsonPath,
133428
- exitOnInstall: true
133606
+ const shouldInstallProjectDeps = !isAuthor || false !== devOptions.install;
133607
+ await ensureProjectReady(projectStructure, 'development', {
133608
+ skipProjectInstall: !projectStructure.packageJsonPath || !shouldInstallProjectDeps,
133609
+ exitOnInstall: false,
133610
+ showRunAgainMessage: false
133429
133611
  });
133430
- if (depsResult.installed) return;
133431
133612
  if ((0, typescript.eE)(manifestDir)) await generateExtensionTypes(manifestDir, packageJsonDir);
133432
133613
  if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
133433
133614
  const browser = (0, paths.YN)(devOptions.browser || 'chrome', devOptions.chromiumBinary, devOptions.geckoBinary || devOptions.firefoxBinary);
@@ -133592,12 +133773,14 @@ var __webpack_exports__ = {};
133592
133773
  async function extensionStart(pathOrRemoteUrl, startOptions) {
133593
133774
  const projectStructure = await getProjectStructure(pathOrRemoteUrl);
133594
133775
  try {
133595
- const debug = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133596
- const depsResult = await ensureProjectReady(projectStructure, 'development', {
133597
- skipProjectInstall: !projectStructure.packageJsonPath,
133598
- exitOnInstall: true
133776
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
133777
+ const debug = isAuthor;
133778
+ const shouldInstallProjectDeps = !isAuthor || false !== startOptions.install;
133779
+ await ensureProjectReady(projectStructure, 'development', {
133780
+ skipProjectInstall: !projectStructure.packageJsonPath || !shouldInstallProjectDeps,
133781
+ exitOnInstall: false,
133782
+ showRunAgainMessage: false
133599
133783
  });
133600
- if (depsResult.installed) return;
133601
133784
  const browser = (0, paths.YN)(startOptions.browser || 'chrome', startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary);
133602
133785
  const { manifestDir, packageJsonDir } = (0, paths.fu)(projectStructure);
133603
133786
  const commandConfig = await (0, config_loader.eY)(packageJsonDir, 'start');