extension-develop 3.5.0-next.8 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +8 -8
  2. package/dist/323.cjs +33 -40
  3. package/dist/547.cjs +69 -6
  4. package/dist/extension-js-devtools/chrome/assets/developer-mode-off.f9a94937.jpeg +0 -0
  5. package/dist/extension-js-devtools/chrome/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  6. package/dist/extension-js-devtools/chrome/background/service_worker.js +2 -2
  7. package/dist/extension-js-devtools/chrome/devtools/index.js +1 -1
  8. package/dist/extension-js-devtools/chrome/manifest.json +3 -3
  9. package/dist/extension-js-devtools/chrome/pages/centralized-logger.css +1 -1
  10. package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +1 -1
  11. package/dist/extension-js-devtools/chrome/pages/welcome.css +1 -1
  12. package/dist/extension-js-devtools/chrome/pages/welcome.js +4 -78
  13. package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
  14. package/dist/extension-js-devtools/chromium/assets/developer-mode-off.f9a94937.jpeg +0 -0
  15. package/dist/extension-js-devtools/chromium/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  16. package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
  17. package/dist/extension-js-devtools/chromium/devtools/index.js +1 -1
  18. package/dist/extension-js-devtools/chromium/manifest.json +3 -3
  19. package/dist/extension-js-devtools/chromium/pages/centralized-logger.css +1 -1
  20. package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +1 -1
  21. package/dist/extension-js-devtools/chromium/pages/welcome.css +1 -1
  22. package/dist/extension-js-devtools/chromium/pages/welcome.js +4 -78
  23. package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
  24. package/dist/extension-js-devtools/edge/assets/developer-mode-off.f9a94937.jpeg +0 -0
  25. package/dist/extension-js-devtools/edge/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  26. package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
  27. package/dist/extension-js-devtools/edge/devtools/index.js +1 -1
  28. package/dist/extension-js-devtools/edge/manifest.json +3 -3
  29. package/dist/extension-js-devtools/edge/pages/centralized-logger.css +1 -1
  30. package/dist/extension-js-devtools/edge/pages/centralized-logger.js +1 -1
  31. package/dist/extension-js-devtools/edge/pages/welcome.css +1 -1
  32. package/dist/extension-js-devtools/edge/pages/welcome.js +4 -78
  33. package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
  34. package/dist/extension-js-devtools/firefox/assets/developer-mode-off.f9a94937.jpeg +0 -0
  35. package/dist/extension-js-devtools/firefox/assets/developer-mode-on.ede80e5b.jpeg +0 -0
  36. package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
  37. package/dist/extension-js-devtools/firefox/devtools/index.js +1 -1
  38. package/dist/extension-js-devtools/firefox/manifest.json +0 -3
  39. package/dist/extension-js-devtools/firefox/pages/centralized-logger.css +1 -1
  40. package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +1 -1
  41. package/dist/extension-js-devtools/firefox/pages/welcome.css +1 -1
  42. package/dist/extension-js-devtools/firefox/pages/welcome.js +4 -78
  43. package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
  44. package/dist/extension-js-theme/firefox/manifest.json +60 -1
  45. package/dist/module.cjs +551 -399
  46. package/package.json +5 -5
  47. package/webpack/webpack-lib/build-dependencies.json +24 -0
  48. package/dist/postinstall.cjs +0 -128855
  49. package/dist/postinstall.cjs.LICENSE.txt +0 -24
package/dist/module.cjs CHANGED
@@ -127238,14 +127238,16 @@ var __webpack_modules__ = {
127238
127238
  __webpack_require__.d(__webpack_exports__, {
127239
127239
  Bf: ()=>getLastCDPPort,
127240
127240
  Ef: ()=>getInstancePorts,
127241
- UF: ()=>setInstancePorts
127241
+ UF: ()=>setInstancePorts,
127242
+ mm: ()=>getLastRDPPort
127242
127243
  });
127243
127244
  const instanceIdToRecord = new Map();
127244
127245
  let lastCDPPort;
127246
+ let lastRDPPort;
127245
127247
  function setInstancePorts(instanceId, ports) {
127246
127248
  try {
127247
127249
  if ('number' == typeof ports.cdpPort) lastCDPPort = ports.cdpPort;
127248
- if ('number' == typeof ports.rdpPort) ports.rdpPort;
127250
+ if ('number' == typeof ports.rdpPort) lastRDPPort = ports.rdpPort;
127249
127251
  if (!instanceId) return;
127250
127252
  const prev = instanceIdToRecord.get(instanceId) || {};
127251
127253
  instanceIdToRecord.set(instanceId, {
@@ -127261,6 +127263,9 @@ var __webpack_modules__ = {
127261
127263
  function getLastCDPPort() {
127262
127264
  return lastCDPPort;
127263
127265
  }
127266
+ function getLastRDPPort() {
127267
+ return lastRDPPort;
127268
+ }
127264
127269
  },
127265
127270
  "./webpack/plugin-browsers/browsers-lib/messages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127266
127271
  "use strict";
@@ -127874,7 +127879,7 @@ var __webpack_modules__ = {
127874
127879
  if (!management) {
127875
127880
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) return `${getLoggingPrefix('error')} No management API info received from client for ${manifestName}. Investigate.`;
127876
127881
  }
127877
- const { name = '', version: version1 = '' } = management;
127882
+ const { version: version1 = '' } = management;
127878
127883
  const extensionVersion = process.env.EXTENSION_DEVELOP_VERSION || process.env.EXTENSION_CLI_VERSION || (()=>{
127879
127884
  try {
127880
127885
  return require1('../../../package.json').version;
@@ -127928,22 +127933,15 @@ var __webpack_modules__ = {
127928
127933
  }
127929
127934
  }
127930
127935
  } catch {}
127931
- const browserLabel = effectiveBrowserLine && effectiveBrowserLine.trim().length > 0 ? effectiveBrowserLine.trim() : capitalize(String(browser || 'unknown'));
127936
+ let browserLabel = effectiveBrowserLine && effectiveBrowserLine.trim().length > 0 ? effectiveBrowserLine.trim() : capitalize(String(browser || 'unknown'));
127937
+ if (browserLabel && !/[a-zA-Z]/.test(browserLabel)) browserLabel = `${capitalize(String(browser || 'unknown'))} ${browserLabel}`;
127932
127938
  const cleanId = String(id || '').trim();
127933
- const urlScheme = 'firefox' === browser || 'gecko-based' === browser ? 'moz-extension' : 'chrome-extension';
127934
- cleanId.length;
127935
- (()=>{
127936
- if ('firefox' === browser || 'gecko-based' === browser) return 'about:debugging#/runtime/this-firefox';
127937
- if ('chrome' === browser || 'chromium' === browser || 'chromium-based' === browser || 'edge' === browser) return cleanId.length > 0 ? `chrome://extensions/?id=${cleanId}` : 'chrome://extensions';
127938
- return cleanId.length > 0 ? `${urlScheme}://${cleanId}` : '(temporary)';
127939
- })();
127940
- ('firefox' === browser || 'gecko-based' === browser) && 'true' === process.env.EXTENSION_AUTHOR_MODE && cleanId.length;
127941
- hostPermissions && hostPermissions.length;
127942
- permissions && permissions.length;
127943
127939
  const lines = [];
127944
127940
  const includeExtensionId = opts?.includeExtensionId !== false;
127945
127941
  const updateNotice = updateSuffix ? ` ${updateSuffix}` : '';
127946
- lines.push(` 🧩 ${pintor__rspack_import_3_default().brightBlue('Extension.js')} ${pintor__rspack_import_3_default().gray(`${extensionVersion}`)}${updateNotice}`, ` Browser ${pintor__rspack_import_3_default().gray(browserLabel)}`, ` Extension ${pintor__rspack_import_3_default().gray(version1 ? `${name} ${version1}` : name || manifestName)}`);
127942
+ const displayName = String(manifestName);
127943
+ const displayVersion = String(version1 || manifest.version || '');
127944
+ lines.push(` 🧩 ${pintor__rspack_import_3_default().brightBlue('Extension.js')} ${pintor__rspack_import_3_default().gray(`${extensionVersion}`)}${updateNotice}`, ` Browser ${pintor__rspack_import_3_default().gray(browserLabel)}`, ` Extension ${pintor__rspack_import_3_default().gray(displayVersion ? `${displayName} ${displayVersion}` : displayName)}`);
127947
127945
  if (includeExtensionId) lines.push(` Extension ID ${pintor__rspack_import_3_default().gray(cleanId)}`);
127948
127946
  return lines.join('\n');
127949
127947
  }
@@ -128596,6 +128594,34 @@ var __webpack_modules__ = {
128596
128594
  else obj[key] = value;
128597
128595
  return obj;
128598
128596
  }
128597
+ async function waitForManifest(outPath, timeoutMs = 8000) {
128598
+ const manifestPath = `${outPath}/manifest.json`;
128599
+ const start = Date.now();
128600
+ while(Date.now() - start < timeoutMs){
128601
+ try {
128602
+ if (external_fs_.existsSync(manifestPath)) return true;
128603
+ } catch {}
128604
+ await new Promise((resolve)=>setTimeout(resolve, 150));
128605
+ }
128606
+ return false;
128607
+ }
128608
+ async function maybePrintDevBanner(args) {
128609
+ const mode = args.compilation?.options?.mode || 'development';
128610
+ if ('development' !== mode) return;
128611
+ if (args.enableCdp) return;
128612
+ const loadExtensionFlag = args.chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
128613
+ const extensionOutputPath = (0, extension_output_path.W)(args.compilation, loadExtensionFlag);
128614
+ if (!extensionOutputPath) return;
128615
+ const ready = await waitForManifest(extensionOutputPath, 10000);
128616
+ if (!ready) return;
128617
+ await (0, banner.a)({
128618
+ browser: args.browser,
128619
+ outPath: extensionOutputPath,
128620
+ hostPort: args.hostPort,
128621
+ getInfo: async ()=>null,
128622
+ browserVersionLine: args.browserVersionLine
128623
+ });
128624
+ }
128599
128625
  class ChromiumLaunchPlugin {
128600
128626
  async runOnce(compilation, opts) {
128601
128627
  if (!this.logger) this.logger = {
@@ -128895,6 +128921,17 @@ var __webpack_modules__ = {
128895
128921
  instance_registry.UF(this.options.instanceId, {
128896
128922
  cdpPort: selectedPort
128897
128923
  });
128924
+ const enableCdp = opts?.enableCdpPostLaunch !== false;
128925
+ await maybePrintDevBanner({
128926
+ compilation,
128927
+ chromiumConfig,
128928
+ browser: this.options.browser,
128929
+ hostPort: {
128930
+ host: '127.0.0.1',
128931
+ port: selectedPort
128932
+ },
128933
+ enableCdp
128934
+ });
128898
128935
  if (this.options.dryRun) return void logChromiumDryRun(browserBinaryLocation, chromiumConfig);
128899
128936
  await this.launchWithDirectSpawn(browserBinaryLocation, chromiumConfig);
128900
128937
  try {
@@ -128905,8 +128942,8 @@ var __webpack_modules__ = {
128905
128942
  if (vLine && vLine.trim().length > 0) browserVersionLine = vLine.trim();
128906
128943
  }
128907
128944
  } catch {}
128945
+ const mode = compilation?.options?.mode || 'development';
128908
128946
  try {
128909
- const mode = compilation?.options?.mode || 'development';
128910
128947
  if ('production' === mode) {
128911
128948
  const loadExtensionFlag = chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
128912
128949
  const extensionOutputPath = (0, extension_output_path.W)(compilation, loadExtensionFlag);
@@ -128945,7 +128982,6 @@ var __webpack_modules__ = {
128945
128982
  dryRun: this.options.dryRun,
128946
128983
  browserVersionLine
128947
128984
  };
128948
- const enableCdp = opts?.enableCdpPostLaunch !== false;
128949
128985
  if (enableCdp) {
128950
128986
  const mod = await Promise.all([
128951
128987
  __webpack_require__.e("215"),
@@ -129155,41 +129191,61 @@ var __webpack_modules__ = {
129155
129191
  }
129156
129192
  var external_path_ = __webpack_require__("path");
129157
129193
  var banner = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
129194
+ async function waitForManifest(outPath, timeoutMs = 8000) {
129195
+ const manifestPath = external_path_.join(outPath, 'manifest.json');
129196
+ const start = Date.now();
129197
+ while(Date.now() - start < timeoutMs){
129198
+ try {
129199
+ if (external_fs_.existsSync(manifestPath)) return true;
129200
+ } catch {}
129201
+ await new Promise((resolve)=>setTimeout(resolve, 150));
129202
+ }
129203
+ return false;
129204
+ }
129158
129205
  async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
129159
129206
  try {
129160
129207
  let chosenPath = null;
129161
129208
  for (const p of candidateAddonPaths){
129209
+ const isManager = /extensions\/[a-z-]+-manager/.test(String(p));
129210
+ const isDevtools = /extension-js-devtools/.test(String(p));
129211
+ const isThemePath = /extension-js-theme/.test(String(p));
129212
+ if (isManager || isDevtools || isThemePath) continue;
129162
129213
  const mp = external_path_.join(p, 'manifest.json');
129163
129214
  if (external_fs_.existsSync(mp)) {
129164
129215
  const mf = JSON.parse(external_fs_.readFileSync(mp, 'utf-8'));
129165
129216
  const name = mf?.name || '';
129166
- if ('string' == typeof name && !/Extension\.js DevTools/i.test(name)) {
129217
+ const isThemeManifest = mf?.theme != null || 'theme' === String(mf?.type || '');
129218
+ if ('string' == typeof name && !/Extension\.js DevTools/i.test(name) && !/theme/i.test(name) && !isThemeManifest) {
129167
129219
  chosenPath = p;
129168
129220
  break;
129169
129221
  }
129170
129222
  }
129171
129223
  }
129172
129224
  if (!chosenPath && candidateAddonPaths.length > 0) chosenPath = candidateAddonPaths[candidateAddonPaths.length - 1];
129173
- if (chosenPath) {
129174
- const manifestPath = external_path_.join(chosenPath, 'manifest.json');
129175
- if (external_fs_.existsSync(manifestPath)) {
129176
- const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
129177
- await (0, banner.a)({
129178
- browser,
129179
- outPath: chosenPath,
129180
- hostPort: {
129181
- host: '127.0.0.1'
129182
- },
129183
- getInfo: async ()=>({
129184
- extensionId: extensionId || '(temporary)',
129185
- name: manifest.name,
129186
- version: manifest.version
129187
- }),
129188
- browserVersionLine
129189
- });
129190
- }
129225
+ if (!chosenPath) return false;
129226
+ const manifestPath = external_path_.join(chosenPath, 'manifest.json');
129227
+ if (!external_fs_.existsSync(manifestPath)) {
129228
+ const ready = await waitForManifest(chosenPath, 10000);
129229
+ if (!ready) return false;
129191
129230
  }
129192
- } catch {}
129231
+ const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
129232
+ const printed = await (0, banner.a)({
129233
+ browser,
129234
+ outPath: chosenPath,
129235
+ hostPort: {
129236
+ host: '127.0.0.1'
129237
+ },
129238
+ getInfo: async ()=>({
129239
+ extensionId: extensionId || '(temporary)',
129240
+ name: manifest.name,
129241
+ version: manifest.version
129242
+ }),
129243
+ browserVersionLine
129244
+ });
129245
+ return printed;
129246
+ } catch {
129247
+ return false;
129248
+ }
129193
129249
  }
129194
129250
  function printSourceInspection(html) {
129195
129251
  console.log(messages.sew());
@@ -129386,6 +129442,16 @@ var __webpack_modules__ = {
129386
129442
  const MAX_RETRIES = 150;
129387
129443
  const RETRY_INTERVAL = 1000;
129388
129444
  class RemoteFirefox {
129445
+ resolveRdpPort(compilation) {
129446
+ const instanceId = this.options?.instanceId;
129447
+ const devPort = compilation?.options?.devServer?.port;
129448
+ const optionPort = this.options?.port;
129449
+ const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129450
+ const basePort = normalizedOptionPort || devPort;
129451
+ const desired = (0, shared_utils.jl)(basePort, instanceId);
129452
+ const fromInstance = instanceId ? (0, instance_registry.Ef)(instanceId)?.rdpPort : void 0;
129453
+ return fromInstance || (0, instance_registry.mm)() || desired;
129454
+ }
129389
129455
  async connectClient(port) {
129390
129456
  let lastError;
129391
129457
  for (const _ of Array.from({
@@ -129422,15 +129488,13 @@ var __webpack_modules__ = {
129422
129488
  return 0;
129423
129489
  });
129424
129490
  const extensionsToLoad = userFirst;
129425
- const devPort = compilation.options?.devServer?.port;
129426
- const optionPort = this.options?.port;
129427
- const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129428
- const port = normalizedOptionPort || (devPort ? devPort + 100 : 9222);
129491
+ const port = this.resolveRdpPort(compilation);
129429
129492
  const client = await this.connectClient(port);
129430
129493
  let addonsActor = await getAddonsActorWithRetry(client, this.cachedAddonsActor);
129431
129494
  if (addonsActor) this.cachedAddonsActor = addonsActor;
129432
129495
  const candidateAddonPaths = computeCandidateAddonPaths(compilation, extensionsToLoad);
129433
129496
  for (const [index, addonPath] of candidateAddonPaths.entries()){
129497
+ const isManager = /extensions\/[a-z-]+-manager/.test(String(addonPath));
129434
129498
  const isDevtoolsEnabled = 0 === index && Boolean(devtools);
129435
129499
  try {
129436
129500
  const installResponse = await installTemporaryAddon(client, String(addonsActor || ''), addonPath, isDevtoolsEnabled);
@@ -129438,7 +129502,7 @@ var __webpack_modules__ = {
129438
129502
  const maybeId = installResponse?.addon?.id;
129439
129503
  if ('string' == typeof maybeId && maybeId.length > 0) this.derivedExtensionId = maybeId;
129440
129504
  }
129441
- if (1 === index || 0 === index && /extensions\/[a-z-]+-manager/.test(String(addonPath))) await waitForManagerWelcome(client);
129505
+ if (isManager) await waitForManagerWelcome(client);
129442
129506
  } catch (err) {
129443
129507
  const message = requestErrorToMessage(err);
129444
129508
  throw new Error(messages.WVu(this.options.browser, message));
@@ -129460,7 +129524,8 @@ var __webpack_modules__ = {
129460
129524
  if (!this.derivedExtensionId) this.derivedExtensionId = await deriveMozExtensionId(client);
129461
129525
  } catch {}
129462
129526
  this.lastInstalledAddonPath = candidateAddonPaths[0];
129463
- printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
129527
+ const bannerPrinted = await printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
129528
+ if (!bannerPrinted) throw new Error(messages.WVu(this.options.browser, 'Failed to print runningInDevelopment banner; add-on may not be installed.'));
129464
129529
  }
129465
129530
  markNeedsReinstall() {
129466
129531
  this.needsReinstall = true;
@@ -129512,10 +129577,7 @@ var __webpack_modules__ = {
129512
129577
  }
129513
129578
  async hardReloadIfNeeded(compilation, changedAssets) {
129514
129579
  try {
129515
- const devPort = compilation.options.devServer?.port;
129516
- const optionPort = this.options?.port;
129517
- const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129518
- const rdpPort = normalizedOptionPort || (devPort ? devPort + 100 : 9222);
129580
+ const rdpPort = this.resolveRdpPort(compilation);
129519
129581
  const client = this.client || await this.connectClient(rdpPort);
129520
129582
  const normalized = (changedAssets || []).map((n)=>String(n || '')).map((n)=>n.replace(/\\/g, '/'));
129521
129583
  const isManifestChanged = normalized.includes('manifest.json');
@@ -129540,10 +129602,7 @@ var __webpack_modules__ = {
129540
129602
  }
129541
129603
  async inspectSource(compilation, opts) {
129542
129604
  try {
129543
- const devServerPort = compilation.options.devServer?.port;
129544
- const optionPort = this.options?.port;
129545
- const normalizedOptionPort = 'string' == typeof optionPort ? parseInt(optionPort, 10) : optionPort;
129546
- const rdpPort = normalizedOptionPort || (devServerPort ? devServerPort + 100 : 9222);
129605
+ const rdpPort = this.resolveRdpPort(compilation);
129547
129606
  const client = this.client || await this.connectClient(rdpPort);
129548
129607
  const urlToInspect = 'string' == typeof opts.source && 'true' !== opts.source ? opts.source : opts.startingUrl;
129549
129608
  const tab = await (0, source_inspect.oc)(client, urlToInspect);
@@ -129559,9 +129618,7 @@ var __webpack_modules__ = {
129559
129618
  async enableUnifiedLogging(opts) {
129560
129619
  try {
129561
129620
  if (this.loggingAttached) return;
129562
- const devPort = this.options?.port;
129563
- const normalized = 'string' == typeof devPort ? parseInt(devPort, 10) : devPort;
129564
- const rdpPort = normalized || 9222;
129621
+ const rdpPort = this.resolveRdpPort();
129565
129622
  const client = this.client || await this.connectClient(rdpPort);
129566
129623
  await attachConsoleListeners(client);
129567
129624
  const wantLevel = String(opts.level || 'info').toLowerCase();
@@ -129685,6 +129742,11 @@ var __webpack_modules__ = {
129685
129742
  'browser.formfill.enable': false,
129686
129743
  'browser.link.open_newwindow': 3,
129687
129744
  'browser.sessionstore.enabled': false,
129745
+ 'browser.sessionstore.resume_from_crash': false,
129746
+ 'browser.sessionstore.max_resumed_crashes': 0,
129747
+ 'browser.sessionstore.restore_on_demand': false,
129748
+ 'browser.sessionstore.resume_session_once': false,
129749
+ 'toolkit.startup.max_resumed_crashes': -1,
129688
129750
  'browser.shell.checkDefaultBrowser': false,
129689
129751
  'browser.sync.enabled': false,
129690
129752
  'browser.startup.page': 0,
@@ -129789,29 +129851,31 @@ var __webpack_modules__ = {
129789
129851
  });
129790
129852
  profilePath = tmp;
129791
129853
  }
129792
- external_fs_.mkdirSync(profilePath, {
129793
- recursive: true
129794
- });
129795
- try {
129796
- const prefs = getPreferences(configOptions?.preferences || {});
129797
- function serializeValue(value) {
129798
- if ('string' == typeof value) return JSON.stringify(value);
129799
- if ('boolean' == typeof value) return String(value);
129800
- if ('number' == typeof value && Number.isFinite(value)) return String(value);
129801
- return JSON.stringify(value);
129802
- }
129803
- function prefsToUserJs(prefsObject) {
129804
- return Object.entries(prefsObject).map(([key, val])=>`user_pref(${JSON.stringify(key)}, ${serializeValue(val)});`).join('\n');
129805
- }
129806
- const userJsPath = external_path_.join(profilePath, 'user.js');
129807
- const userJsContent = prefsToUserJs(prefs);
129808
- external_fs_.writeFileSync(userJsPath, userJsContent);
129809
- } catch {}
129810
129854
  try {
129811
129855
  const maxAgeHours = parseInt(String(process.env.EXTENSION_TMP_PROFILE_MAX_AGE_HOURS || ''), 10);
129812
129856
  (0, shared_utils.CW)(base, external_path_.basename(profilePath), Number.isFinite(maxAgeHours) ? maxAgeHours : 12);
129813
129857
  } catch {}
129814
129858
  }
129859
+ if (profilePath) try {
129860
+ external_fs_.mkdirSync(profilePath, {
129861
+ recursive: true
129862
+ });
129863
+ } catch {}
129864
+ if (profilePath) try {
129865
+ const prefs = getPreferences(configOptions?.preferences || {});
129866
+ function serializeValue(value) {
129867
+ if ('string' == typeof value) return JSON.stringify(value);
129868
+ if ('boolean' == typeof value) return String(value);
129869
+ if ('number' == typeof value && Number.isFinite(value)) return String(value);
129870
+ return JSON.stringify(value);
129871
+ }
129872
+ function prefsToUserJs(prefsObject) {
129873
+ return Object.entries(prefsObject).map(([key, val])=>`user_pref(${JSON.stringify(key)}, ${serializeValue(val)});`).join('\n');
129874
+ }
129875
+ const userJsPath = external_path_.join(profilePath, 'user.js');
129876
+ const userJsContent = prefsToUserJs(prefs);
129877
+ external_fs_.writeFileSync(userJsPath, userJsContent);
129878
+ } catch {}
129815
129879
  const parts = [
129816
129880
  `--binary-args="${binaryArgs.join(' ')}"`,
129817
129881
  '--verbose'
@@ -129888,6 +129952,12 @@ var __webpack_modules__ = {
129888
129952
  const child = (0, external_child_process_.spawn)(bin, args, {
129889
129953
  stdio,
129890
129954
  detached: false,
129955
+ env: {
129956
+ ...process.env,
129957
+ MOZ_DISABLE_AUTO_SAFE_MODE: '1',
129958
+ MOZ_CRASHREPORTER_DISABLE: '1',
129959
+ MOZ_CRASHREPORTER: '0'
129960
+ },
129891
129961
  ...'win32' === process.platform ? {
129892
129962
  windowsHide: true
129893
129963
  } : {}
@@ -130825,9 +130895,11 @@ var __webpack_modules__ = {
130825
130895
  var path__rspack_import_0 = __webpack_require__("path");
130826
130896
  var fs__rspack_import_1 = __webpack_require__("fs");
130827
130897
  var _messages__rspack_import_2 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
130828
- var _webpack_lib_check_build_dependencies__rspack_import_3 = __webpack_require__("./webpack/webpack-lib/check-build-dependencies.ts");
130829
- var _webpack_lib_package_manager__rspack_import_4 = __webpack_require__("./webpack/webpack-lib/package-manager.ts");
130830
- var _webpack_lib_progress__rspack_import_5 = __webpack_require__("./webpack/webpack-lib/progress.ts");
130898
+ var pintor__rspack_import_3 = __webpack_require__("pintor");
130899
+ var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
130900
+ var _webpack_lib_check_build_dependencies__rspack_import_4 = __webpack_require__("./webpack/webpack-lib/check-build-dependencies.ts");
130901
+ var _webpack_lib_package_manager__rspack_import_5 = __webpack_require__("./webpack/webpack-lib/package-manager.ts");
130902
+ var _webpack_lib_progress__rspack_import_6 = __webpack_require__("./webpack/webpack-lib/progress.ts");
130831
130903
  function parseJsonSafe(text) {
130832
130904
  const s = text && 0xfeff === text.charCodeAt(0) ? text.slice(1) : text;
130833
130905
  return JSON.parse(s || '{}');
@@ -130931,13 +131003,13 @@ var __webpack_modules__ = {
130931
131003
  }
130932
131004
  async function execInstallWithFallback(command, options) {
130933
131005
  try {
130934
- await (0, _webpack_lib_package_manager__rspack_import_4.Qt)(command.command, command.args, {
131006
+ await (0, _webpack_lib_package_manager__rspack_import_5.Qt)(command.command, command.args, {
130935
131007
  cwd: options.cwd,
130936
131008
  stdio: 'inherit'
130937
131009
  });
130938
131010
  return;
130939
131011
  } catch (error) {
130940
- if (options.fallbackNpmCommand && isMissingManagerError(error)) return void await (0, _webpack_lib_package_manager__rspack_import_4.Qt)(options.fallbackNpmCommand.command, options.fallbackNpmCommand.args, {
131012
+ if (options.fallbackNpmCommand && isMissingManagerError(error)) return void await (0, _webpack_lib_package_manager__rspack_import_5.Qt)(options.fallbackNpmCommand.command, options.fallbackNpmCommand.args, {
130941
131013
  cwd: options.cwd,
130942
131014
  stdio: 'inherit'
130943
131015
  });
@@ -130945,7 +131017,7 @@ var __webpack_modules__ = {
130945
131017
  }
130946
131018
  }
130947
131019
  function resolveDevelopInstallRoot() {
130948
- const directRoot = (0, _webpack_lib_check_build_dependencies__rspack_import_3.w1)();
131020
+ const directRoot = (0, _webpack_lib_check_build_dependencies__rspack_import_4.w1)();
130949
131021
  if (directRoot) return directRoot;
130950
131022
  try {
130951
131023
  const candidateRoot = findDevelopRootFrom(__dirname);
@@ -130962,78 +131034,40 @@ var __webpack_modules__ = {
130962
131034
  return;
130963
131035
  }
130964
131036
  }
130965
- function getOptionalInstallCommand(pm, dependencies, installBaseDir, saveMode = 'optional') {
131037
+ function getOptionalInstallCommand(pm, dependencies, installBaseDir) {
130966
131038
  const pmName = pm.name;
130967
- if ('yarn' === pmName) {
130968
- if ('none' === saveMode) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
130969
- '--silent',
130970
- 'add',
130971
- ...dependencies,
130972
- '--cwd',
130973
- installBaseDir,
130974
- '--optional'
130975
- ]);
130976
- return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
130977
- '--silent',
130978
- 'add',
130979
- ...dependencies,
130980
- '--cwd',
130981
- installBaseDir,
130982
- 'dev' === saveMode ? '--dev' : '--optional'
130983
- ]);
130984
- }
130985
- if ('npm' === pmName) {
130986
- if ('none' === saveMode) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
130987
- '--silent',
130988
- 'install',
130989
- ...dependencies,
130990
- '--prefix',
130991
- installBaseDir,
130992
- '--no-save'
130993
- ]);
130994
- return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
130995
- '--silent',
130996
- 'install',
130997
- ...dependencies,
130998
- '--prefix',
130999
- installBaseDir,
131000
- 'dev' === saveMode ? '--save-dev' : '--save-optional'
131001
- ]);
131002
- }
131003
- if ('pnpm' === pmName) {
131004
- if ('none' === saveMode) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131005
- 'add',
131006
- ...dependencies,
131007
- '--dir',
131008
- installBaseDir,
131009
- '--no-save',
131010
- '--silent'
131011
- ]);
131012
- return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131013
- 'add',
131014
- ...dependencies,
131015
- '--dir',
131016
- installBaseDir,
131017
- 'dev' === saveMode ? '--save-dev' : '--save-optional',
131018
- '--silent'
131019
- ]);
131020
- }
131021
- if ('bun' === pmName) {
131022
- if ('none' === saveMode) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131023
- 'add',
131024
- ...dependencies,
131025
- '--cwd',
131026
- installBaseDir
131027
- ]);
131028
- return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131029
- 'add',
131030
- ...dependencies,
131031
- '--cwd',
131032
- installBaseDir,
131033
- 'dev' === saveMode ? '--dev' : '--optional'
131034
- ]);
131035
- }
131036
- return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131039
+ if ('yarn' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131040
+ '--silent',
131041
+ 'add',
131042
+ ...dependencies,
131043
+ '--cwd',
131044
+ installBaseDir,
131045
+ '--optional'
131046
+ ]);
131047
+ if ('npm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131048
+ '--silent',
131049
+ 'install',
131050
+ ...dependencies,
131051
+ '--prefix',
131052
+ installBaseDir,
131053
+ '--save-optional'
131054
+ ]);
131055
+ if ('pnpm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131056
+ 'add',
131057
+ ...dependencies,
131058
+ '--dir',
131059
+ installBaseDir,
131060
+ '--save-optional',
131061
+ '--silent'
131062
+ ]);
131063
+ if ('bun' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131064
+ 'add',
131065
+ ...dependencies,
131066
+ '--cwd',
131067
+ installBaseDir,
131068
+ '--optional'
131069
+ ]);
131070
+ return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131037
131071
  '--silent',
131038
131072
  'install',
131039
131073
  ...dependencies,
@@ -131057,32 +131091,32 @@ var __webpack_modules__ = {
131057
131091
  '--prefix',
131058
131092
  installBaseDir
131059
131093
  ] : [];
131060
- if ('yarn' === pmName) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131094
+ if ('yarn' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131061
131095
  'install',
131062
131096
  '--silent',
131063
131097
  ...dirArgs
131064
131098
  ]);
131065
- if ('npm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131099
+ if ('npm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131066
131100
  'install',
131067
131101
  '--silent',
131068
131102
  ...dirArgs
131069
131103
  ]);
131070
- if ('pnpm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131104
+ if ('pnpm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131071
131105
  'install',
131072
131106
  '--silent',
131073
131107
  ...dirArgs
131074
131108
  ]);
131075
- if ('bun' === pmName) return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131109
+ if ('bun' === pmName) return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131076
131110
  'install',
131077
131111
  ...dirArgs
131078
131112
  ]);
131079
- return (0, _webpack_lib_package_manager__rspack_import_4.tj)(pm, [
131113
+ return (0, _webpack_lib_package_manager__rspack_import_5.tj)(pm, [
131080
131114
  'install',
131081
131115
  '--silent',
131082
131116
  ...dirArgs
131083
131117
  ]);
131084
131118
  }
131085
- async function installOptionalDependencies(integration, dependencies) {
131119
+ async function installOptionalDependencies(integration, dependencies, options) {
131086
131120
  if (!dependencies.length) return;
131087
131121
  let pm;
131088
131122
  let wslContext;
@@ -131090,36 +131124,44 @@ var __webpack_modules__ = {
131090
131124
  try {
131091
131125
  installBaseDir = resolveDevelopInstallRoot();
131092
131126
  if (!installBaseDir) throw new Error(_messages__rspack_import_2.eG(integration));
131093
- pm = (0, _webpack_lib_package_manager__rspack_import_4._c)({
131127
+ pm = (0, _webpack_lib_package_manager__rspack_import_5._c)({
131094
131128
  cwd: installBaseDir
131095
131129
  });
131096
131130
  wslContext = resolveWslContext(installBaseDir);
131097
131131
  if (!wslContext.useWsl) pm = await preferCorepackFallback(pm);
131098
- const installCommand = getOptionalInstallCommand(pm, dependencies, wslContext.installDir || installBaseDir);
131099
- const execCommand = wrapCommandForWsl(installCommand, wslContext);
131100
- const fallbackNpmCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_4.sX)([
131101
- '--silent',
131102
- 'install',
131103
- ...dependencies,
131104
- '--prefix',
131105
- installBaseDir,
131106
- '--save-optional'
131107
- ]);
131108
131132
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
131109
- const setupMessage = _messages__rspack_import_2._j([
131133
+ const setupMessages = _messages__rspack_import_2._j([
131110
131134
  integration
131111
131135
  ], integration, isAuthor);
131112
- const progressEnabled = !isAuthor && (0, _webpack_lib_progress__rspack_import_5.u)();
131113
- const progress = (0, _webpack_lib_progress__rspack_import_5.J)(setupMessage, {
131114
- enabled: progressEnabled
131136
+ const setupMessage = setupMessages[0];
131137
+ const hasIndex = Boolean(options?.index && options?.total);
131138
+ const setupMessageWithIndex = hasIndex ? setupMessage.replace('►►► ', `►►► [${options?.index}/${options?.total}] `) : setupMessage;
131139
+ const progressEnabled = !isAuthor && (0, _webpack_lib_progress__rspack_import_6.u)();
131140
+ const progress = (0, _webpack_lib_progress__rspack_import_6.J)(setupMessageWithIndex, {
131141
+ enabled: progressEnabled,
131142
+ persistLabel: true
131115
131143
  });
131116
- if (isAuthor) console.warn(setupMessage);
131117
- else if (!progressEnabled) console.log(setupMessage);
131144
+ if (isAuthor) console.warn(setupMessageWithIndex);
131145
+ else if (!progressEnabled) console.log(setupMessageWithIndex);
131118
131146
  try {
131119
- await execInstallWithFallback(execCommand, {
131120
- cwd: wslContext.useWsl ? void 0 : installBaseDir,
131121
- fallbackNpmCommand
131122
- });
131147
+ for (const dependency of dependencies){
131148
+ const installCommand = getOptionalInstallCommand(pm, [
131149
+ dependency
131150
+ ], wslContext.installDir || installBaseDir);
131151
+ const execCommand = wrapCommandForWsl(installCommand, wslContext);
131152
+ const fallbackNpmCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_5.sX)([
131153
+ '--silent',
131154
+ 'install',
131155
+ dependency,
131156
+ '--prefix',
131157
+ installBaseDir,
131158
+ '--save-optional'
131159
+ ]);
131160
+ await execInstallWithFallback(execCommand, {
131161
+ cwd: wslContext.useWsl ? void 0 : installBaseDir,
131162
+ fallbackNpmCommand
131163
+ });
131164
+ }
131123
131165
  } finally{
131124
131166
  progress.stop();
131125
131167
  }
@@ -131128,7 +131170,7 @@ var __webpack_modules__ = {
131128
131170
  console.log(_messages__rspack_import_2.cr(integration));
131129
131171
  const rootInstall = getRootInstallCommand(pm, wslContext.useWsl ? wslContext.installDir : void 0);
131130
131172
  const rootCommand = wrapCommandForWsl(rootInstall, wslContext);
131131
- const rootFallbackCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_4.sX)([
131173
+ const rootFallbackCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_5.sX)([
131132
131174
  '--silent',
131133
131175
  'install',
131134
131176
  '--prefix',
@@ -131164,85 +131206,17 @@ var __webpack_modules__ = {
131164
131206
  return false;
131165
131207
  }
131166
131208
  }
131167
- async function installOptionalDependenciesBatch(integration, dependencies, integrations, opts) {
131168
- if (!dependencies.length) return;
131169
- let pm;
131170
- let wslContext;
131171
- let installBaseDir;
131172
- try {
131173
- installBaseDir = opts?.installBaseDir || resolveDevelopInstallRoot();
131174
- if (!installBaseDir) throw new Error(_messages__rspack_import_2.eG(integration));
131175
- pm = (0, _webpack_lib_package_manager__rspack_import_4._c)({
131176
- cwd: installBaseDir
131177
- });
131178
- wslContext = resolveWslContext(installBaseDir);
131179
- if (!wslContext.useWsl) pm = await preferCorepackFallback(pm);
131180
- const installCommand = getOptionalInstallCommand(pm, dependencies, wslContext.installDir || installBaseDir, opts?.saveMode);
131181
- const execCommand = wrapCommandForWsl(installCommand, wslContext);
131182
- const fallbackNpmCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_4.sX)([
131183
- '--silent',
131184
- 'install',
131185
- ...dependencies,
131186
- '--prefix',
131187
- installBaseDir,
131188
- '--save-optional'
131189
- ]);
131190
- const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
131191
- const setupMessage = _messages__rspack_import_2._j(integrations, integration, isAuthor);
131192
- const progressEnabled = !isAuthor && (0, _webpack_lib_progress__rspack_import_5.u)();
131193
- const progress = (0, _webpack_lib_progress__rspack_import_5.J)(setupMessage, {
131194
- enabled: progressEnabled
131195
- });
131196
- if (isAuthor) console.warn(setupMessage);
131197
- else if (!progressEnabled) console.log(setupMessage);
131198
- try {
131199
- await execInstallWithFallback(execCommand, {
131200
- cwd: wslContext.useWsl ? void 0 : installBaseDir,
131201
- fallbackNpmCommand
131202
- });
131203
- } finally{
131204
- progress.stop();
131205
- }
131206
- await new Promise((resolve)=>setTimeout(resolve, 500));
131207
- if (isAuthor) {
131208
- console.log(_messages__rspack_import_2.cr(integration));
131209
- const rootInstall = getRootInstallCommand(pm, wslContext.useWsl ? wslContext.installDir : void 0);
131210
- const rootCommand = wrapCommandForWsl(rootInstall, wslContext);
131211
- const rootFallbackCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_4.sX)([
131212
- '--silent',
131213
- 'install',
131214
- '--prefix',
131215
- installBaseDir
131216
- ]);
131217
- await execInstallWithFallback(rootCommand, {
131218
- cwd: wslContext.useWsl ? void 0 : installBaseDir,
131219
- fallbackNpmCommand: rootFallbackCommand
131220
- });
131221
- console.log(_messages__rspack_import_2.ys(integration));
131222
- }
131223
- return true;
131224
- } catch (error) {
131225
- console.error('[extension.js][optional-deps] debug', {
131226
- platform: process.platform,
131227
- execPath: process.execPath,
131228
- cwd: process.cwd(),
131229
- path: process.env.PATH || process.env.Path,
131230
- comspec: process.env.ComSpec,
131231
- systemRoot: process.env.SystemRoot,
131232
- npm_execpath: process.env.npm_execpath,
131233
- npm_config_user_agent: process.env.npm_config_user_agent,
131234
- npm_config_prefix: process.env.npm_config_prefix,
131235
- npm_config_cache: process.env.npm_config_cache,
131236
- npm_config_userconfig: process.env.npm_config_userconfig,
131237
- installBaseDir,
131238
- wslContext,
131239
- pm
131209
+ async function installOptionalDependenciesBatch(plans) {
131210
+ if (!plans.length) return;
131211
+ console.log(`${pintor__rspack_import_3_default().gray('►►►')} Found ${pintor__rspack_import_3_default().yellow(String(plans.length))} specialized integration${1 === plans.length ? '' : 's'} needing installation...`);
131212
+ for (const [index, plan] of plans.entries()){
131213
+ const didInstall = await installOptionalDependencies(plan.integration, plan.dependencies, {
131214
+ index: index + 1,
131215
+ total: plans.length
131240
131216
  });
131241
- const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
131242
- if (isMissingManagerError(error)) console.error(_messages__rspack_import_2.Vo(integration));
131243
- else console.error(_messages__rspack_import_2.DX(integration, error, isAuthor));
131244
- return false;
131217
+ if (!didInstall) return false;
131245
131218
  }
131219
+ return true;
131246
131220
  }
131247
131221
  function hasDependency(projectPath, dependency) {
131248
131222
  const findNearestPackageJsonDirectory = (startPath)=>{
@@ -131320,9 +131294,12 @@ var __webpack_modules__ = {
131320
131294
  return `${pintor__rspack_import_0_default().green('►►►')} ${name} installation completed.`;
131321
131295
  }
131322
131296
  function optionalToolingSetup(integrations, fallback, isAuthor) {
131323
- const list = integrations && integrations.length > 0 ? integrations.join('/') : fallback;
131297
+ const list = integrations && integrations.length > 0 ? integrations : [
131298
+ fallback
131299
+ ];
131324
131300
  const prefix = isAuthor ? pintor__rspack_import_0_default().brightMagenta('►►► Author says') : pintor__rspack_import_0_default().gray('►►►');
131325
- return `${prefix} Setting up ${list} tooling after a fresh install... (this is a one time operation)`;
131301
+ const suffix = 'true' === process.env.EXTENSION_ONE_TIME_INSTALL_HINT ? ' (this is a one time operation)' : '';
131302
+ return list.map((integration)=>`${prefix} Installing specialized dependencies for ${integration}...${suffix}`);
131326
131303
  }
131327
131304
  function optionalToolingRootInstall(integration) {
131328
131305
  return `${pintor__rspack_import_0_default().brightMagenta('►►► Author says')} [${integration}] Installing root dependencies for dev...`;
@@ -132324,6 +132301,7 @@ var __webpack_modules__ = {
132324
132301
  });
132325
132302
  var path__rspack_import_0 = __webpack_require__("path");
132326
132303
  var fs__rspack_import_1 = __webpack_require__("fs");
132304
+ var module__rspack_import_2 = __webpack_require__("module");
132327
132305
  function findExtensionDevelopRoot() {
132328
132306
  const webpackLibDir = __dirname;
132329
132307
  const webpackDir = path__rspack_import_0.resolve(webpackLibDir, '..');
@@ -132345,9 +132323,20 @@ var __webpack_modules__ = {
132345
132323
  throw new Error(`Failed to load build-dependencies.json: ${error.message}`);
132346
132324
  }
132347
132325
  }
132326
+ const require1 = (0, module__rspack_import_2.createRequire)(__rslib_import_meta_url__);
132348
132327
  function isDependencyInstalled(dependency, packageRoot) {
132349
132328
  const nodeModulesPath = path__rspack_import_0.join(packageRoot, 'node_modules', dependency);
132350
- return fs__rspack_import_1.existsSync(nodeModulesPath);
132329
+ if (fs__rspack_import_1.existsSync(nodeModulesPath)) return true;
132330
+ try {
132331
+ require1.resolve(dependency, {
132332
+ paths: [
132333
+ packageRoot
132334
+ ]
132335
+ });
132336
+ return true;
132337
+ } catch {
132338
+ return false;
132339
+ }
132351
132340
  }
132352
132341
  function areBuildDependenciesInstalled(packageRoot) {
132353
132342
  const dependencies = loadBuildDependencies();
@@ -132728,6 +132717,126 @@ var __webpack_modules__ = {
132728
132717
  return list;
132729
132718
  }
132730
132719
  },
132720
+ "./webpack/webpack-lib/install-cache.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
132721
+ "use strict";
132722
+ __webpack_require__.d(__webpack_exports__, {
132723
+ Q: ()=>hasInstallMarker,
132724
+ h: ()=>writeInstallMarker
132725
+ });
132726
+ var path__rspack_import_0 = __webpack_require__("path");
132727
+ var fs__rspack_import_1 = __webpack_require__("fs");
132728
+ var crypto__rspack_import_2 = __webpack_require__("crypto");
132729
+ var _package_json__rspack_import_3 = __webpack_require__("./package.json");
132730
+ var _plugin_css_css_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
132731
+ function getInstallCacheDir(packageRoot) {
132732
+ return path__rspack_import_0.join(packageRoot, '.cache', 'extensionjs', 'install');
132733
+ }
132734
+ function getProjectKey(projectPath) {
132735
+ return (0, crypto__rspack_import_2.createHash)('sha1').update(path__rspack_import_0.resolve(projectPath)).digest('hex');
132736
+ }
132737
+ function getCacheVersionPath(cacheDir) {
132738
+ return path__rspack_import_0.join(cacheDir, 'version.json');
132739
+ }
132740
+ function getProjectDepsHash(projectPath) {
132741
+ try {
132742
+ const packageJsonPath = path__rspack_import_0.join(projectPath, 'package.json');
132743
+ if (!fs__rspack_import_1.existsSync(packageJsonPath)) return 'no-package-json';
132744
+ const raw = fs__rspack_import_1.readFileSync(packageJsonPath, 'utf8');
132745
+ const parsed = JSON.parse(raw || '{}');
132746
+ const deps = parsed?.dependencies || {};
132747
+ const devDeps = parsed?.devDependencies || {};
132748
+ const normalize = (input)=>{
132749
+ const sortedKeys = Object.keys(input).sort();
132750
+ const normalized = {};
132751
+ for (const key of sortedKeys)normalized[key] = input[key];
132752
+ return normalized;
132753
+ };
132754
+ const stable = JSON.stringify({
132755
+ dependencies: normalize(deps),
132756
+ devDependencies: normalize(devDeps)
132757
+ });
132758
+ return (0, crypto__rspack_import_2.createHash)('sha1').update(stable).digest('hex');
132759
+ } catch {
132760
+ return 'invalid-package-json';
132761
+ }
132762
+ }
132763
+ function ensureCacheVersion(cacheDir) {
132764
+ const versionPath = getCacheVersionPath(cacheDir);
132765
+ const expectedVersion = _package_json__rspack_import_3.rE;
132766
+ try {
132767
+ if (!fs__rspack_import_1.existsSync(versionPath)) return true;
132768
+ const raw = fs__rspack_import_1.readFileSync(versionPath, 'utf8');
132769
+ const data = JSON.parse(raw || '{}');
132770
+ if (data?.version !== expectedVersion) {
132771
+ fs__rspack_import_1.rmSync(cacheDir, {
132772
+ recursive: true,
132773
+ force: true
132774
+ });
132775
+ return false;
132776
+ }
132777
+ return true;
132778
+ } catch {
132779
+ try {
132780
+ fs__rspack_import_1.rmSync(cacheDir, {
132781
+ recursive: true,
132782
+ force: true
132783
+ });
132784
+ } catch {}
132785
+ return false;
132786
+ }
132787
+ }
132788
+ function getInstallMarkerPath(projectPath) {
132789
+ const packageRoot = (0, _plugin_css_css_lib_integrations__rspack_import_4.He)();
132790
+ if (!packageRoot) return;
132791
+ const cacheDir = getInstallCacheDir(packageRoot);
132792
+ return path__rspack_import_0.join(cacheDir, `${getProjectKey(projectPath)}.json`);
132793
+ }
132794
+ function hasInstallMarker(projectPath) {
132795
+ const marker = getInstallMarkerPath(projectPath);
132796
+ if (!marker) return false;
132797
+ const cacheDir = path__rspack_import_0.dirname(marker);
132798
+ if (!ensureCacheVersion(cacheDir)) return false;
132799
+ if (!fs__rspack_import_1.existsSync(marker)) return false;
132800
+ try {
132801
+ const raw = fs__rspack_import_1.readFileSync(marker, 'utf8');
132802
+ const data = JSON.parse(raw || '{}');
132803
+ const depsHash = getProjectDepsHash(projectPath);
132804
+ if (data?.depsHash !== depsHash) {
132805
+ fs__rspack_import_1.rmSync(marker, {
132806
+ force: true
132807
+ });
132808
+ return false;
132809
+ }
132810
+ return true;
132811
+ } catch {
132812
+ try {
132813
+ fs__rspack_import_1.rmSync(marker, {
132814
+ force: true
132815
+ });
132816
+ } catch {}
132817
+ return false;
132818
+ }
132819
+ }
132820
+ function writeInstallMarker(projectPath) {
132821
+ const marker = getInstallMarkerPath(projectPath);
132822
+ if (!marker) return;
132823
+ const cacheDir = path__rspack_import_0.dirname(marker);
132824
+ try {
132825
+ fs__rspack_import_1.mkdirSync(cacheDir, {
132826
+ recursive: true
132827
+ });
132828
+ fs__rspack_import_1.writeFileSync(getCacheVersionPath(cacheDir), JSON.stringify({
132829
+ version: _package_json__rspack_import_3.rE
132830
+ }));
132831
+ fs__rspack_import_1.writeFileSync(marker, JSON.stringify({
132832
+ projectPath: path__rspack_import_0.resolve(projectPath),
132833
+ depsHash: getProjectDepsHash(projectPath),
132834
+ version: _package_json__rspack_import_3.rE,
132835
+ ts: Date.now()
132836
+ }));
132837
+ } catch {}
132838
+ }
132839
+ },
132731
132840
  "./webpack/webpack-lib/messages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
132732
132841
  "use strict";
132733
132842
  __webpack_require__.d(__webpack_exports__, {
@@ -132751,6 +132860,7 @@ var __webpack_modules__ = {
132751
132860
  Ud: ()=>downloadingText,
132752
132861
  Ut: ()=>treeWithDistFilesbrowser,
132753
132862
  V_: ()=>previewing,
132863
+ Vy: ()=>installingDependencies,
132754
132864
  W4: ()=>creatingProjectPath,
132755
132865
  W6: ()=>treeWithSourceAndDistFiles,
132756
132866
  Z0: ()=>dependenciesInstalledRunAgain,
@@ -132832,7 +132942,8 @@ var __webpack_modules__ = {
132832
132942
  return `${getLoggingPrefix('info')} Skipping browser runner for ${capitalizedBrowserName(browser)} (no-runner).`;
132833
132943
  }
132834
132944
  function installingRequiredDependencies() {
132835
- return `${getLoggingPrefix('info')} Installing required dependencies...`;
132945
+ const suffix = 'true' === process.env.EXTENSION_ONE_TIME_INSTALL_HINT ? ' (this is a one time operation)' : '';
132946
+ return `${getLoggingPrefix('info')} Installing general build dependencies...${suffix}`;
132836
132947
  }
132837
132948
  function installingBuildDependencies(dependencies) {
132838
132949
  const list = dependencies.map((dep)=>pintor__rspack_import_2_default().gray(dep)).join(', ');
@@ -132978,6 +133089,9 @@ var __webpack_modules__ = {
132978
133089
  function isUsingExperimentalConfig(integration) {
132979
133090
  return `${getLoggingPrefix('info')} Using ${pintor__rspack_import_2_default().yellow(integration)}.`;
132980
133091
  }
133092
+ function installingDependencies() {
133093
+ return `${getLoggingPrefix('info')} Installing project dependencies...`;
133094
+ }
132981
133095
  function debugDirs(manifestDir, packageJsonDir) {
132982
133096
  return `${getLoggingPrefix('info')} Directories\n${pintor__rspack_import_2_default().gray('MANIFEST_DIR')} ${pintor__rspack_import_2_default().underline(manifestDir)}\n${pintor__rspack_import_2_default().gray('PACKAGE_JSON_DIR')} ${pintor__rspack_import_2_default().underline(packageJsonDir)}`;
132983
133097
  }
@@ -133106,44 +133220,18 @@ var __webpack_modules__ = {
133106
133220
  } catch {}
133107
133221
  return resolveNpmCliFromNode(process.execPath);
133108
133222
  }
133109
- function resolveWindowsCmdExe() {
133110
- if ('win32' !== process.platform) return 'cmd.exe';
133111
- const comspec = process.env.ComSpec;
133112
- if (comspec && fs__rspack_import_0.existsSync(comspec)) return comspec;
133113
- const systemRoot = process.env.SystemRoot || 'C:\\Windows';
133114
- const fallback = path__rspack_import_1.join(systemRoot, 'System32', 'cmd.exe');
133115
- if (fs__rspack_import_0.existsSync(fallback)) return fallback;
133116
- return 'cmd.exe';
133117
- }
133118
- function formatCmdArgs(command, args) {
133119
- const quotedCommand = command.includes(' ') ? `"${command}"` : command;
133120
- const quotedArgs = args.map((arg)=>arg.includes(' ') ? `"${arg}"` : arg);
133121
- return `${quotedCommand} ${quotedArgs.join(' ')}`.trim();
133122
- }
133123
133223
  function isWindowsExecutablePath(value) {
133124
133224
  if (!value || 'win32' !== process.platform) return false;
133125
133225
  return /\.(cmd|bat|exe)$/i.test(value);
133126
133226
  }
133127
- function shouldUseCmdExe(command) {
133128
- if ('win32' !== process.platform) return false;
133129
- if (/\.(cmd|bat)$/i.test(command)) return true;
133130
- return [
133131
- 'npm',
133132
- 'pnpm',
133133
- 'yarn',
133134
- 'corepack',
133135
- 'bun'
133136
- ].includes(command);
133137
- }
133138
133227
  function resolveWindowsCommandPath(command) {
133139
133228
  if ('win32' !== process.platform) return;
133140
133229
  try {
133141
- const cmdExe = resolveWindowsCmdExe();
133142
- const output = (0, child_process__rspack_import_2.execFileSync)(cmdExe, [
133143
- '/d',
133144
- '/s',
133145
- '/c',
133146
- `where ${command}`
133230
+ const systemRoot = process.env.SystemRoot || 'C:\\Windows';
133231
+ const whereExe = path__rspack_import_1.join(systemRoot, 'System32', 'where.exe');
133232
+ const whereCommand = fs__rspack_import_0.existsSync(whereExe) ? whereExe : 'where';
133233
+ const output = (0, child_process__rspack_import_2.execFileSync)(whereCommand, [
133234
+ command
133147
133235
  ], {
133148
133236
  encoding: 'utf8',
133149
133237
  stdio: [
@@ -133222,10 +133310,15 @@ var __webpack_modules__ = {
133222
133310
  ];
133223
133311
  for (const candidate of candidates){
133224
133312
  const resolved = resolveCommandOnPath(candidate);
133225
- if (resolved) return {
133226
- name: candidate,
133227
- execPath: resolved
133228
- };
133313
+ if (resolved) {
133314
+ if ('win32' === process.platform && /\.(cmd|bat)$/i.test(resolved)) return {
133315
+ name: candidate
133316
+ };
133317
+ return {
133318
+ name: candidate,
133319
+ execPath: resolved
133320
+ };
133321
+ }
133229
133322
  }
133230
133323
  const corepackPath = resolveCommandOnPath('corepack');
133231
133324
  if (corepackPath || canRunCorepack()) return {
@@ -133298,20 +133391,10 @@ var __webpack_modules__ = {
133298
133391
  };
133299
133392
  }
133300
133393
  function buildSpawnInvocation(command, args) {
133301
- if (!shouldUseCmdExe(command)) return {
133394
+ return {
133302
133395
  command,
133303
133396
  args
133304
133397
  };
133305
- const cmdExe = resolveWindowsCmdExe();
133306
- return {
133307
- command: cmdExe,
133308
- args: [
133309
- '/d',
133310
- '/s',
133311
- '/c',
133312
- formatCmdArgs(command, args)
133313
- ]
133314
- };
133315
133398
  }
133316
133399
  function execInstallCommand(command, args, options) {
133317
133400
  const invocation = buildSpawnInvocation(command, args);
@@ -133344,6 +133427,7 @@ var __webpack_modules__ = {
133344
133427
  });
133345
133428
  var fs__rspack_import_0 = __webpack_require__("fs");
133346
133429
  var path__rspack_import_1 = __webpack_require__("path");
133430
+ var _install_cache__rspack_import_2 = __webpack_require__("./webpack/webpack-lib/install-cache.ts");
133347
133431
  function asAbsolute(p) {
133348
133432
  return path__rspack_import_1.isAbsolute(p) ? p : path__rspack_import_1.resolve(p);
133349
133433
  }
@@ -133361,6 +133445,25 @@ var __webpack_modules__ = {
133361
133445
  function needsInstall(packageJsonDir) {
133362
133446
  const nm = getNodeModulesDir(packageJsonDir);
133363
133447
  try {
133448
+ const packageJsonPath = path__rspack_import_1.join(packageJsonDir, 'package.json');
133449
+ if (fs__rspack_import_0.existsSync(packageJsonPath)) {
133450
+ const raw = fs__rspack_import_0.readFileSync(packageJsonPath, 'utf-8');
133451
+ const packageJson = JSON.parse(raw);
133452
+ const depsCount = Object.keys(packageJson?.dependencies || {}).length;
133453
+ const devDepsCount = Object.keys(packageJson?.devDependencies || {}).length;
133454
+ if (depsCount + devDepsCount === 0) return false;
133455
+ if ((0, _install_cache__rspack_import_2.Q)(packageJsonDir)) return false;
133456
+ if (!fs__rspack_import_0.existsSync(nm)) return true;
133457
+ const deps = Object.keys(packageJson?.dependencies || {});
133458
+ const devDeps = Object.keys(packageJson?.devDependencies || {});
133459
+ if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.pnpm'))) return false;
133460
+ if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.modules.yaml'))) return false;
133461
+ const hasInstalledDep = [
133462
+ ...deps,
133463
+ ...devDeps
133464
+ ].some((dep)=>fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, dep)));
133465
+ return !hasInstalledDep;
133466
+ }
133364
133467
  return !fs__rspack_import_0.existsSync(nm) || 0 === fs__rspack_import_0.readdirSync(nm).length;
133365
133468
  } catch {
133366
133469
  return true;
@@ -133369,7 +133472,8 @@ var __webpack_modules__ = {
133369
133472
  function normalizeBrowser(browser, chromiumBinary, geckoBinary) {
133370
133473
  const requested = String(browser || '');
133371
133474
  if (chromiumBinary) {
133372
- if (!requested || 'chromium' === requested || 'chromium-based' === requested) return 'chromium-based';
133475
+ if (!requested || 'chromium-based' === requested) return 'chromium-based';
133476
+ if ('chromium' === requested) return 'chromium';
133373
133477
  if ('edge' === requested) return 'edge';
133374
133478
  if ('chrome' === requested) return 'chrome';
133375
133479
  }
@@ -133461,7 +133565,10 @@ var __webpack_modules__ = {
133461
133565
  return {
133462
133566
  stop: ()=>{
133463
133567
  clearInterval(timer);
133464
- if (process.stdout.isTTY) process.stdout.write(`\r${' '.repeat(lastVisibleLength)}\r`);
133568
+ if (process.stdout.isTTY) {
133569
+ process.stdout.write(`\r${' '.repeat(lastVisibleLength)}\r`);
133570
+ if (options?.persistLabel) process.stdout.write(`${label}\n`);
133571
+ }
133465
133572
  }
133466
133573
  };
133467
133574
  }
@@ -133609,7 +133716,7 @@ var __webpack_modules__ = {
133609
133716
  },
133610
133717
  "./package.json" (module) {
133611
133718
  "use strict";
133612
- module.exports = JSON.parse('{"rE":"3.5.0-next.8","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"}}');
133719
+ module.exports = JSON.parse('{"rE":"3.5.0","El":{"@rspack/core":"^1.7.5","@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.1.1","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"}}');
133613
133720
  }
133614
133721
  };
133615
133722
  var __webpack_module_cache__ = {};
@@ -133686,9 +133793,9 @@ var __webpack_exports__ = {};
133686
133793
  extensionStart: ()=>extensionStart,
133687
133794
  ensureDependencies: ()=>ensureDependencies,
133688
133795
  extensionPreview: ()=>extensionPreview,
133689
- extensionBuild: ()=>extensionBuild
133796
+ extensionBuild: ()=>extensionBuild,
133797
+ preflightOptionalDependenciesForProject: ()=>preflightOptionalDependenciesForProject
133690
133798
  });
133691
- var external_module_ = __webpack_require__("module");
133692
133799
  function getBuildSummary(browser, info) {
133693
133800
  const assets = info?.assets || [];
133694
133801
  return {
@@ -133700,6 +133807,7 @@ var __webpack_exports__ = {};
133700
133807
  errors_count: (info?.errors || []).length
133701
133808
  };
133702
133809
  }
133810
+ var external_module_ = __webpack_require__("module");
133703
133811
  var external_path_ = __webpack_require__("path");
133704
133812
  var external_fs_ = __webpack_require__("fs");
133705
133813
  var messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
@@ -133958,8 +134066,10 @@ var __webpack_exports__ = {};
133958
134066
  const stdio = isAuthor ? 'inherit' : 'ignore';
133959
134067
  const progressLabel = messages.xK(dependencies);
133960
134068
  const progressEnabled = !isAuthor && (0, webpack_lib_progress.u)();
134069
+ const persistLabel = 'true' === process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
133961
134070
  const progress = (0, webpack_lib_progress.J)(progressLabel, {
133962
- enabled: progressEnabled
134071
+ enabled: progressEnabled,
134072
+ persistLabel
133963
134073
  });
133964
134074
  if (!progressEnabled) console.log(progressLabel);
133965
134075
  if (isAuthor) console.warn(messages.TL('build dependencies'));
@@ -133980,14 +134090,29 @@ var __webpack_exports__ = {};
133980
134090
  process.chdir(originalDirectory);
133981
134091
  }
133982
134092
  }
134093
+ var install_cache = __webpack_require__("./webpack/webpack-lib/install-cache.ts");
133983
134094
  function install_dependencies_getInstallArgs() {
133984
134095
  return [
133985
134096
  'install'
133986
134097
  ];
133987
134098
  }
134099
+ async function hasDependenciesToInstall(projectPath) {
134100
+ try {
134101
+ const raw = await external_fs_.promises.readFile(external_path_.join(projectPath, 'package.json'), 'utf8');
134102
+ const packageJson = JSON.parse(raw);
134103
+ const depsCount = Object.keys(packageJson?.dependencies || {}).length;
134104
+ const devDepsCount = Object.keys(packageJson?.devDependencies || {}).length;
134105
+ return depsCount + devDepsCount > 0;
134106
+ } catch (error) {
134107
+ return true;
134108
+ }
134109
+ }
133988
134110
  async function installDependencies(projectPath) {
133989
134111
  const nodeModulesPath = external_path_.join(projectPath, 'node_modules');
133990
134112
  const originalDirectory = process.cwd();
134113
+ const shouldInstall = await hasDependenciesToInstall(projectPath);
134114
+ if (!shouldInstall) return;
134115
+ const progressLabel = messages.Vy();
133991
134116
  try {
133992
134117
  process.chdir(projectPath);
133993
134118
  const pm = (0, package_manager._c)({
@@ -134003,12 +134128,24 @@ var __webpack_exports__ = {};
134003
134128
  });
134004
134129
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
134005
134130
  const stdio = isAuthor ? 'inherit' : 'ignore';
134131
+ const progressEnabled = !isAuthor && (0, webpack_lib_progress.u)();
134132
+ const persistLabel = 'true' === process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134133
+ const progress = (0, webpack_lib_progress.J)(progressLabel, {
134134
+ enabled: progressEnabled,
134135
+ persistLabel
134136
+ });
134137
+ if (!progressEnabled) console.log(progressLabel);
134006
134138
  if (isAuthor) console.warn(messages.TL('project dependencies'));
134007
134139
  const command = (0, package_manager.tj)(pm, dependenciesArgs);
134008
- await (0, package_manager.Qt)(command.command, command.args, {
134009
- cwd: projectPath,
134010
- stdio
134011
- });
134140
+ try {
134141
+ await (0, package_manager.Qt)(command.command, command.args, {
134142
+ cwd: projectPath,
134143
+ stdio
134144
+ });
134145
+ (0, install_cache.h)(projectPath);
134146
+ } finally{
134147
+ progress.stop();
134148
+ }
134012
134149
  } catch (error) {
134013
134150
  console.error(messages.RB(error));
134014
134151
  process.exit(1);
@@ -134018,10 +134155,8 @@ var __webpack_exports__ = {};
134018
134155
  }
134019
134156
  async function ensureDependencies(projectPath, opts) {
134020
134157
  const packageRoot = (0, check_build_dependencies.w1)();
134021
- const shouldCheckBuildDeps = opts?.installBuildDeps !== false;
134022
- const missingBuild = shouldCheckBuildDeps && packageRoot && !(0, check_build_dependencies.S)(packageRoot) ? (0, check_build_dependencies.Cf)(packageRoot) : [];
134023
- const shouldCheckUserDeps = opts?.installUserDeps !== false;
134024
- const shouldInstallUserDeps = shouldCheckUserDeps && !!projectPath && (0, webpack_lib_paths.Bi)((0, webpack_lib_paths.G6)(projectPath));
134158
+ const missingBuild = packageRoot && !(0, check_build_dependencies.S)(packageRoot) ? (0, check_build_dependencies.Cf)(packageRoot) : [];
134159
+ const shouldInstallUserDeps = !!projectPath && !opts?.skipProjectInstall && (0, webpack_lib_paths.Bi)((0, webpack_lib_paths.G6)(projectPath));
134025
134160
  const needsBuildInstall = missingBuild.length > 0;
134026
134161
  const needsUserInstall = shouldInstallUserDeps;
134027
134162
  if (!needsBuildInstall && !needsUserInstall) return {
@@ -134029,7 +134164,7 @@ var __webpack_exports__ = {};
134029
134164
  installedBuild: false,
134030
134165
  installedUser: false
134031
134166
  };
134032
- console.log(messages.G2());
134167
+ if (needsBuildInstall) console.log(messages.G2());
134033
134168
  if (needsBuildInstall && packageRoot) await installOwnDependencies(missingBuild, packageRoot);
134034
134169
  if (needsUserInstall && projectPath) await installDependencies(projectPath);
134035
134170
  if (opts?.showRunAgainMessage !== false) console.log(messages.Z0());
@@ -134189,9 +134324,22 @@ var __webpack_exports__ = {};
134189
134324
  return;
134190
134325
  }
134191
134326
  }
134192
- function getMissingOptionalDependencies(projectPath) {
134327
+ async function preflightOptionalDependencies(projectStructure, mode, opts) {
134328
+ const { packageJsonDir } = (0, webpack_lib_paths.fu)(projectStructure);
134329
+ const projectPath = packageJsonDir;
134330
+ if (hasPreflightMarker(projectPath)) {
134331
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} Optional deps preflight skipped (cache hit).`);
134332
+ return;
134333
+ }
134193
134334
  const missingOptionalDeps = new Set();
134335
+ const missingByIntegration = {};
134194
134336
  const usedIntegrations = [];
134337
+ const addMissing = (integration, dependency)=>{
134338
+ if (missingOptionalDeps.has(dependency)) return;
134339
+ missingOptionalDeps.add(dependency);
134340
+ if (!missingByIntegration[integration]) missingByIntegration[integration] = [];
134341
+ missingByIntegration[integration].push(dependency);
134342
+ };
134195
134343
  const usesTypeScript = (0, typescript.eE)(projectPath);
134196
134344
  const usesReact = (0, react.S)(projectPath);
134197
134345
  const usesPreact = (0, preact.K)(projectPath);
@@ -134201,31 +134349,29 @@ var __webpack_exports__ = {};
134201
134349
  const usesLess = (0, less.K)(projectPath);
134202
134350
  const usesPostCss = (0, postcss.A)(projectPath);
134203
134351
  if (usesTypeScript) {
134204
- if (!canResolveFromProject("typescript", projectPath)) {
134205
- missingOptionalDeps.add("typescript");
134206
- usedIntegrations.push('TypeScript');
134207
- }
134352
+ usedIntegrations.push('TypeScript');
134353
+ if (!canResolveFromProject("typescript", projectPath)) addMissing('TypeScript', "typescript");
134208
134354
  }
134209
134355
  if (usesReact) {
134210
- if (!canResolve('react-refresh', projectPath)) missingOptionalDeps.add('react-refresh');
134211
- if (!canResolve('@rspack/plugin-react-refresh', projectPath)) missingOptionalDeps.add('@rspack/plugin-react-refresh');
134356
+ if (!canResolve('react-refresh', projectPath)) addMissing('React', 'react-refresh');
134357
+ if (!canResolve('@rspack/plugin-react-refresh', projectPath)) addMissing('React', '@rspack/plugin-react-refresh');
134212
134358
  usedIntegrations.push('React');
134213
134359
  }
134214
134360
  if (usesPreact) {
134215
- if (!canResolve('@prefresh/core', projectPath)) missingOptionalDeps.add('@prefresh/core');
134216
- if (!canResolve('@prefresh/utils', projectPath)) missingOptionalDeps.add('@prefresh/utils');
134217
- if (!canResolve('@rspack/plugin-preact-refresh', projectPath)) missingOptionalDeps.add('@rspack/plugin-preact-refresh');
134218
- if (!canResolve('preact', projectPath)) missingOptionalDeps.add('preact');
134361
+ if (!canResolve('@prefresh/core', projectPath)) addMissing('Preact', '@prefresh/core');
134362
+ if (!canResolve('@prefresh/utils', projectPath)) addMissing('Preact', '@prefresh/utils');
134363
+ if (!canResolve('@rspack/plugin-preact-refresh', projectPath)) addMissing('Preact', '@rspack/plugin-preact-refresh');
134364
+ if (!canResolve('preact', projectPath)) addMissing('Preact', 'preact');
134219
134365
  usedIntegrations.push('Preact');
134220
134366
  }
134221
134367
  if (usesVue) {
134222
- if (!canResolve('vue-loader', projectPath)) missingOptionalDeps.add('vue-loader');
134223
- if (!canResolve('@vue/compiler-sfc', projectPath)) missingOptionalDeps.add('@vue/compiler-sfc');
134368
+ if (!canResolve('vue-loader', projectPath)) addMissing('Vue', 'vue-loader');
134369
+ if (!canResolve('@vue/compiler-sfc', projectPath)) addMissing('Vue', '@vue/compiler-sfc');
134224
134370
  usedIntegrations.push('Vue');
134225
134371
  }
134226
134372
  if (usesSvelte) {
134227
- if (!canResolveFromProject('svelte-loader', projectPath) && !canResolve('svelte-loader', projectPath)) missingOptionalDeps.add('svelte-loader');
134228
- if (!canResolveFromProject("typescript", projectPath)) missingOptionalDeps.add("typescript");
134373
+ if (!canResolveFromProject('svelte-loader', projectPath) && !canResolve('svelte-loader', projectPath)) addMissing('Svelte', 'svelte-loader');
134374
+ if (!canResolveFromProject("typescript", projectPath)) addMissing('Svelte', "typescript");
134229
134375
  usedIntegrations.push('Svelte');
134230
134376
  }
134231
134377
  if (usesSass) {
@@ -134235,44 +134381,32 @@ var __webpack_exports__ = {};
134235
134381
  'postcss-scss',
134236
134382
  'postcss-preset-env'
134237
134383
  ];
134238
- for (const dep of postCssDeps)if (!canResolve(dep, projectPath)) missingOptionalDeps.add(dep);
134239
- missingOptionalDeps.add('sass-loader');
134384
+ for (const dep of postCssDeps)if (!canResolve(dep, projectPath)) addMissing('Sass', dep);
134385
+ addMissing('Sass', 'sass-loader');
134240
134386
  usedIntegrations.push('Sass');
134241
134387
  }
134242
134388
  }
134243
134389
  if (usesLess) {
134244
134390
  if (!canResolve('less-loader', projectPath)) {
134245
- if (!canResolve('less', projectPath)) missingOptionalDeps.add('less');
134246
- missingOptionalDeps.add('less-loader');
134391
+ if (!canResolve('less', projectPath)) addMissing('Less', 'less');
134392
+ addMissing('Less', 'less-loader');
134247
134393
  usedIntegrations.push('Less');
134248
134394
  }
134249
134395
  }
134250
134396
  if (!usesPostCss || canResolve('postcss-loader', projectPath) || usesSass || usesLess) {
134251
134397
  if (usesPostCss) usedIntegrations.push('PostCSS');
134252
134398
  } else {
134253
- if (!canResolve('postcss', projectPath)) missingOptionalDeps.add('postcss');
134254
- missingOptionalDeps.add('postcss-loader');
134399
+ if (!canResolve('postcss', projectPath)) addMissing('PostCSS', 'postcss');
134400
+ addMissing('PostCSS', 'postcss-loader');
134255
134401
  usedIntegrations.push('PostCSS');
134256
134402
  }
134257
- return {
134258
- missingOptionalDeps: Array.from(missingOptionalDeps),
134259
- usedIntegrations
134260
- };
134261
- }
134262
- async function preflightOptionalDependencies(projectStructure, mode, opts) {
134263
- const { packageJsonDir } = (0, webpack_lib_paths.fu)(projectStructure);
134264
- const projectPath = packageJsonDir;
134265
- if (hasPreflightMarker(projectPath)) {
134266
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} Optional deps preflight skipped (cache hit).`);
134267
- return;
134268
- }
134269
- const { missingOptionalDeps, usedIntegrations } = getMissingOptionalDependencies(projectPath);
134270
- if (missingOptionalDeps.length > 0) {
134403
+ if (missingOptionalDeps.size > 0) {
134271
134404
  const uniqueIntegrations = Array.from(new Set(usedIntegrations));
134272
- const didInstall = await (0, frameworks_lib_integrations.Dy)('Optional', missingOptionalDeps, uniqueIntegrations, {
134273
- installBaseDir: opts?.installBaseDir,
134274
- saveMode: opts?.saveMode
134275
- });
134405
+ const installPlans = uniqueIntegrations.map((integration)=>({
134406
+ integration,
134407
+ dependencies: missingByIntegration[integration] || []
134408
+ })).filter((plan)=>plan.dependencies.length > 0);
134409
+ const didInstall = await (0, frameworks_lib_integrations.Dy)(installPlans);
134276
134410
  if (!didInstall) throw new Error('[Optional] Optional dependencies failed to install.');
134277
134411
  if (opts?.showRunAgainMessage !== false && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.log(js_frameworks_lib_messages.Q2(uniqueIntegrations));
134278
134412
  if (opts?.exitOnInstall !== false) {
@@ -134290,24 +134424,11 @@ var __webpack_exports__ = {};
134290
134424
  }
134291
134425
  async function ensureProjectReady(projectStructure, mode, opts) {
134292
134426
  const { packageJsonDir } = (0, webpack_lib_paths.fu)(projectStructure);
134293
- const result = await ensureDependencies(packageJsonDir, {
134294
- installUserDeps: opts?.installUserDeps,
134295
- installBuildDeps: opts?.installBuildDeps,
134296
- exitOnInstall: opts?.exitOnInstall,
134297
- showRunAgainMessage: opts?.showRunAgainMessage
134427
+ const result = await ensureDependencies(packageJsonDir, opts);
134428
+ await ensureDevelopArtifacts();
134429
+ if (shouldRunOptionalPreflight(projectStructure)) await preflightOptionalDependencies(projectStructure, mode, {
134430
+ exitOnInstall: opts?.exitOnInstall
134298
134431
  });
134299
- if (opts?.installBuildDeps !== false) await ensureDevelopArtifacts();
134300
- const shouldInstallOptional = opts?.installOptionalDeps !== false;
134301
- if (shouldInstallOptional && shouldRunOptionalPreflight(projectStructure)) {
134302
- const runOptional = ()=>preflightOptionalDependencies(projectStructure, mode, {
134303
- exitOnInstall: opts?.exitOnInstall,
134304
- showRunAgainMessage: opts?.showRunAgainMessage
134305
- });
134306
- if (opts?.backgroundOptionalDeps) runOptional().catch((error)=>{
134307
- console.error(error);
134308
- });
134309
- else await runOptional();
134310
- }
134311
134432
  return result;
134312
134433
  }
134313
134434
  async function ensureDevelopArtifacts() {
@@ -134343,13 +134464,19 @@ var __webpack_exports__ = {};
134343
134464
  const { manifestDir, packageJsonDir } = (0, webpack_lib_paths.fu)(projectStructure);
134344
134465
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
134345
134466
  try {
134346
- await ensureProjectReady(projectStructure, 'production', {
134347
- installUserDeps: false,
134348
- installBuildDeps: false,
134349
- installOptionalDeps: false,
134350
- exitOnInstall: false,
134351
- showRunAgainMessage: false
134352
- });
134467
+ const shouldInstallProjectDeps = !isAuthor || buildOptions?.install !== false;
134468
+ const previousOneTimeHint = process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134469
+ process.env.EXTENSION_ONE_TIME_INSTALL_HINT = 'true';
134470
+ try {
134471
+ await ensureProjectReady(projectStructure, 'production', {
134472
+ skipProjectInstall: isVitest || !projectStructure.packageJsonPath || !shouldInstallProjectDeps,
134473
+ exitOnInstall: false,
134474
+ showRunAgainMessage: false
134475
+ });
134476
+ } finally{
134477
+ if (void 0 === previousOneTimeHint) delete process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134478
+ else process.env.EXTENSION_ONE_TIME_INSTALL_HINT = previousOneTimeHint;
134479
+ }
134353
134480
  const [{ rspack }, { merge }, { handleStatsErrors }, { default: webpackConfig }] = await Promise.all([
134354
134481
  Promise.resolve(require1('@rspack/core')),
134355
134482
  import("webpack-merge"),
@@ -134462,13 +134589,19 @@ var __webpack_exports__ = {};
134462
134589
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
134463
134590
  const debug = isAuthor;
134464
134591
  const { manifestDir, packageJsonDir } = (0, webpack_lib_paths.fu)(projectStructure);
134465
- await ensureProjectReady(projectStructure, 'development', {
134466
- installUserDeps: false,
134467
- installBuildDeps: false,
134468
- installOptionalDeps: false,
134469
- exitOnInstall: false,
134470
- showRunAgainMessage: false
134471
- });
134592
+ const shouldInstallProjectDeps = !isAuthor || false !== devOptions.install;
134593
+ const previousOneTimeHint = process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134594
+ process.env.EXTENSION_ONE_TIME_INSTALL_HINT = 'true';
134595
+ try {
134596
+ await ensureProjectReady(projectStructure, 'development', {
134597
+ skipProjectInstall: !projectStructure.packageJsonPath || !shouldInstallProjectDeps,
134598
+ exitOnInstall: false,
134599
+ showRunAgainMessage: false
134600
+ });
134601
+ } finally{
134602
+ if (void 0 === previousOneTimeHint) delete process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134603
+ else process.env.EXTENSION_ONE_TIME_INSTALL_HINT = previousOneTimeHint;
134604
+ }
134472
134605
  if ((0, typescript.eE)(manifestDir)) await generateExtensionTypes(manifestDir, packageJsonDir);
134473
134606
  if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
134474
134607
  const browser = (0, webpack_lib_paths.YN)(devOptions.browser || 'chrome', devOptions.chromiumBinary, devOptions.geckoBinary || devOptions.firefoxBinary);
@@ -134477,6 +134610,7 @@ var __webpack_exports__ = {};
134477
134610
  console.log(messages.SG(manifestDir, packageJsonDir));
134478
134611
  console.log(messages._A(browser, devOptions.chromiumBinary, geckoBinary));
134479
134612
  }
134613
+ if ('true' === process.env.EXTENSION_DEV_DRY_RUN) return;
134480
134614
  const { devServer } = await Promise.all([
134481
134615
  __webpack_require__.e("215"),
134482
134616
  __webpack_require__.e("547"),
@@ -134597,11 +134731,14 @@ var __webpack_exports__ = {};
134597
134731
  const safeBrowserConfig = (0, sanitize.a)(browserConfig);
134598
134732
  const safeCommandConfig = (0, sanitize.a)(commandConfig);
134599
134733
  const safePreviewOptions = (0, sanitize.a)(previewOptions);
134734
+ const mergedGeckoBinary = safePreviewOptions.geckoBinary || safePreviewOptions.firefoxBinary || safeCommandConfig.geckoBinary || safeCommandConfig.firefoxBinary || safeBrowserConfig.geckoBinary || safeBrowserConfig.firefoxBinary;
134735
+ const mergedChromiumBinary = safePreviewOptions.chromiumBinary || safeCommandConfig.chromiumBinary || safeBrowserConfig.chromiumBinary;
134600
134736
  const merged = {
134601
134737
  ...safeBrowserConfig,
134602
134738
  ...safeCommandConfig,
134603
134739
  ...safePreviewOptions,
134604
- geckoBinary: safePreviewOptions.geckoBinary || safePreviewOptions.firefoxBinary
134740
+ chromiumBinary: mergedChromiumBinary,
134741
+ geckoBinary: mergedGeckoBinary
134605
134742
  };
134606
134743
  const darkDefaults = (0, dark_mode.U)({
134607
134744
  browser,
@@ -134637,13 +134774,19 @@ var __webpack_exports__ = {};
134637
134774
  try {
134638
134775
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
134639
134776
  const debug = isAuthor;
134640
- await ensureProjectReady(projectStructure, 'development', {
134641
- installUserDeps: false,
134642
- installBuildDeps: false,
134643
- installOptionalDeps: false,
134644
- exitOnInstall: false,
134645
- showRunAgainMessage: false
134646
- });
134777
+ const shouldInstallProjectDeps = !isAuthor || false !== startOptions.install;
134778
+ const previousOneTimeHint = process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134779
+ process.env.EXTENSION_ONE_TIME_INSTALL_HINT = 'true';
134780
+ try {
134781
+ await ensureProjectReady(projectStructure, 'development', {
134782
+ skipProjectInstall: !projectStructure.packageJsonPath || !shouldInstallProjectDeps,
134783
+ exitOnInstall: false,
134784
+ showRunAgainMessage: false
134785
+ });
134786
+ } finally{
134787
+ if (void 0 === previousOneTimeHint) delete process.env.EXTENSION_ONE_TIME_INSTALL_HINT;
134788
+ else process.env.EXTENSION_ONE_TIME_INSTALL_HINT = previousOneTimeHint;
134789
+ }
134647
134790
  const browser = (0, webpack_lib_paths.YN)(startOptions.browser || 'chrome', startOptions.chromiumBinary, startOptions.geckoBinary || startOptions.firefoxBinary);
134648
134791
  const { manifestDir, packageJsonDir } = (0, webpack_lib_paths.fu)(projectStructure);
134649
134792
  const commandConfig = await (0, config_loader.eY)(packageJsonDir, 'start');
@@ -134666,7 +134809,7 @@ var __webpack_exports__ = {};
134666
134809
  ...commandConfig,
134667
134810
  ...startOptions,
134668
134811
  browser,
134669
- geckoBinary: startOptions.geckoBinary || startOptions.firefoxBinary,
134812
+ geckoBinary: startOptions.geckoBinary || startOptions.firefoxBinary || browserConfig.geckoBinary || browserConfig.firefoxBinary || commandConfig.geckoBinary || commandConfig.firefoxBinary,
134670
134813
  outputPath: distPath
134671
134814
  });
134672
134815
  } catch (error) {
@@ -134674,18 +134817,27 @@ var __webpack_exports__ = {};
134674
134817
  process.exit(1);
134675
134818
  }
134676
134819
  }
134820
+ async function preflightOptionalDependenciesForProject(pathOrRemoteUrl, mode = 'development') {
134821
+ const projectStructure = await getProjectStructure(pathOrRemoteUrl);
134822
+ await preflightOptionalDependencies(projectStructure, mode, {
134823
+ exitOnInstall: false,
134824
+ showRunAgainMessage: false
134825
+ });
134826
+ }
134677
134827
  })();
134678
134828
  exports.ensureDependencies = __webpack_exports__.ensureDependencies;
134679
134829
  exports.extensionBuild = __webpack_exports__.extensionBuild;
134680
134830
  exports.extensionDev = __webpack_exports__.extensionDev;
134681
134831
  exports.extensionPreview = __webpack_exports__.extensionPreview;
134682
134832
  exports.extensionStart = __webpack_exports__.extensionStart;
134833
+ exports.preflightOptionalDependenciesForProject = __webpack_exports__.preflightOptionalDependenciesForProject;
134683
134834
  for(var __rspack_i in __webpack_exports__)if (-1 === [
134684
134835
  "ensureDependencies",
134685
134836
  "extensionBuild",
134686
134837
  "extensionDev",
134687
134838
  "extensionPreview",
134688
- "extensionStart"
134839
+ "extensionStart",
134840
+ "preflightOptionalDependenciesForProject"
134689
134841
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
134690
134842
  Object.defineProperty(exports, '__esModule', {
134691
134843
  value: true