extension 4.1.25 → 4.1.27

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/browsers.cjs CHANGED
@@ -70,14 +70,27 @@ var __webpack_modules__ = {
70
70
  return '';
71
71
  }
72
72
  }
73
+ function registeredDirectoryPath(dir, platform) {
74
+ const absolute = node_path__rspack_import_2.resolve(dir);
75
+ if ('win32' === platform) return absolute;
76
+ try {
77
+ return node_fs__rspack_import_1.realpathSync.native(absolute);
78
+ } catch {
79
+ return absolute;
80
+ }
81
+ }
82
+ function upperCaseDriveLetter(windowsPath) {
83
+ return /^[a-z]:/.test(windowsPath) ? windowsPath[0].toUpperCase() + windowsPath.slice(1) : windowsPath;
84
+ }
85
+ function chromiumExtensionIdFromRegisteredPath(registeredPath, platform = process.platform) {
86
+ const bytes = 'win32' === platform ? Buffer.from(upperCaseDriveLetter(registeredPath.replace(/\//g, '\\')), 'utf16le') : Buffer.from(registeredPath, 'utf8');
87
+ const digest = (0, node_crypto__rspack_import_0.createHash)('sha256').update(bytes).digest().subarray(0, 16);
88
+ return encodeChromiumExtensionIdFromDigest(digest);
89
+ }
73
90
  function deriveChromiumExtensionIdFromPath(extensionPath) {
74
91
  if (!extensionPath || 'string' != typeof extensionPath) return '';
75
92
  try {
76
- const absolute = node_path__rspack_import_2.resolve(extensionPath);
77
- const isWindows = 'win32' === process.platform;
78
- const seedBuffer = isWindows ? Buffer.from(absolute.replace(/\//g, '\\'), 'utf16le') : Buffer.from(absolute, 'utf8');
79
- const digest = (0, node_crypto__rspack_import_0.createHash)('sha256').update(seedBuffer).digest().subarray(0, 16);
80
- return encodeChromiumExtensionIdFromDigest(digest);
93
+ return chromiumExtensionIdFromRegisteredPath(registeredDirectoryPath(extensionPath, process.platform), process.platform);
81
94
  } catch {
82
95
  return '';
83
96
  }
@@ -274,6 +287,8 @@ var __webpack_modules__ = {
274
287
  'firefox',
275
288
  'waterfox',
276
289
  'librewolf',
290
+ 'zen',
291
+ 'floorp',
277
292
  'gecko-based',
278
293
  'firefox-based'
279
294
  ]);
@@ -283,8 +298,15 @@ var __webpack_modules__ = {
283
298
  function isFirefoxBrowser(browser) {
284
299
  return FIREFOX_BROWSERS.has(String(browser));
285
300
  }
301
+ const EMULATOR_BROWSERS = new Set([
302
+ 'chromium-emulator'
303
+ ]);
304
+ function isEmulatorBrowser(browser) {
305
+ return EMULATOR_BROWSERS.has(String(browser));
306
+ }
286
307
  __webpack_require__.d(__webpack_exports__, {
287
308
  M_: ()=>isFirefoxBrowser,
309
+ eP: ()=>isEmulatorBrowser,
288
310
  rG: ()=>isChromiumBrowser
289
311
  });
290
312
  },
@@ -420,7 +442,8 @@ var __webpack_modules__ = {
420
442
  var pintor__rspack_import_8 = __webpack_require__("pintor");
421
443
  var pintor__rspack_import_8_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_8);
422
444
  var _helpers_messaging__rspack_import_9 = __webpack_require__("./helpers/messaging.ts");
423
- var _browser_family__rspack_import_10 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
445
+ var _run_firefox_firefox_launch_librewolf_overrides__rspack_import_10 = __webpack_require__("./browsers/run-firefox/firefox-launch/librewolf-overrides.ts");
446
+ var _browser_family__rspack_import_11 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
424
447
  const require1 = (0, node_module__rspack_import_1.createRequire)(__rslib_import_meta_url__);
425
448
  function getLoggingPrefix(type) {
426
449
  return (0, _helpers_messaging__rspack_import_9.Pl)(type);
@@ -496,7 +519,7 @@ var __webpack_modules__ = {
496
519
  return browser;
497
520
  }
498
521
  function capitalizedBrowserName(browser) {
499
- return `${browser.charAt(0).toUpperCase() + browser.slice(1)}`;
522
+ return (0, _helpers_messaging__rspack_import_9.QZ)(String(browser));
500
523
  }
501
524
  function resolveBrowserVersionLine(browser, pinnedLine, opts) {
502
525
  const pinned = String(pinnedLine || '').trim();
@@ -545,6 +568,10 @@ var __webpack_modules__ = {
545
568
  })();
546
569
  return `${getLoggingPrefix('error')} ${isUnreachable}${pintor__rspack_import_8_default().gray('NOT FOUND')} ${pintor__rspack_import_8_default().underline(browserBinaryLocation || `${capitalizedBrowserName(browser)}BROWSER`)}\nInstall the missing browser, or choose another one with ${pintor__rspack_import_8_default().blue('--browser')} ${pintor__rspack_import_8_default().gray('<chrome|edge|firefox>')}.` + wslHint;
547
570
  }
571
+ function geckoForkNotInstalled(browser, guidance) {
572
+ const steps = String(guidance || '').split('\n').map((line)=>line.trimEnd()).filter((line)=>line && !/^We couldn't find/i.test(line)).filter((line)=>!/^Re-run your command/i.test(line)).join('\n');
573
+ return `${getLoggingPrefix('error')} ${capitalizedBrowserName(browser)} isn't installed.\n${steps}\nOr point at a binary with ${pintor__rspack_import_8_default().blue('--gecko-binary')} ${pintor__rspack_import_8_default().gray('<path>')}, or choose another browser with ${pintor__rspack_import_8_default().blue('--browser')} ${pintor__rspack_import_8_default().gray('<firefox|waterfox|librewolf|zen|floorp>')}.`;
574
+ }
548
575
  function usingManagedChromiumFamilyFallback(requestedBrowser, _fallbackBrowser, _binaryPath) {
549
576
  return `${getLoggingPrefix('warn')} ${managedBrowserDisplayName(requestedBrowser)} isn't installed.\nRun ${pintor__rspack_import_8_default().blue(`npx extension install ${requestedBrowser}`)} to use ${managedBrowserDisplayName(requestedBrowser)} itself.`;
550
577
  }
@@ -685,8 +712,11 @@ var __webpack_modules__ = {
685
712
  body.push("Run your command again after the install finishes.");
686
713
  return `${body.join('\n')}\n`;
687
714
  }
688
- function firefoxLaunchCalled() {
689
- return `${getLoggingPrefix('debug')} browser launch browser=firefox`;
715
+ function firefoxLaunchCalled(browser = 'firefox') {
716
+ return `${getLoggingPrefix('debug')} browser launch browser=${browser}`;
717
+ }
718
+ function librewolfRemoteDebuggingLocked(overridesPath) {
719
+ return `${getLoggingPrefix('error')} LibreWolf keeps remote debugging off, so Extension.js can't reach it.\nLibreWolf resets ${pintor__rspack_import_8_default().gray('devtools.debugger.remote-enabled')} to false at every start. Add these two lines to ${pintor__rspack_import_8_default().underline(overridesPath)} and run the command again:\n` + _run_firefox_firefox_launch_librewolf_overrides__rspack_import_10.Tu.map((line)=>` ${pintor__rspack_import_8_default().blue(line)}\n`).join('') + `Or choose another browser with ${pintor__rspack_import_8_default().blue('--browser')} ${pintor__rspack_import_8_default().gray('<firefox|waterfox|zen|floorp>')}.`;
690
720
  }
691
721
  function firefoxFailedToStart(error) {
692
722
  return `${getLoggingPrefix('error')} Firefox failed to start.\n${pintor__rspack_import_8_default().red(errorDetail(error))}`;
@@ -835,7 +865,7 @@ var __webpack_modules__ = {
835
865
  }
836
866
  function pinnedBinaryFlag(browser) {
837
867
  const name = String(browser || '');
838
- if ((0, _browser_family__rspack_import_10.M_)(name)) return '--gecko-binary';
868
+ if ((0, _browser_family__rspack_import_11.M_)(name)) return '--gecko-binary';
839
869
  if ('safari' === name || 'webkit-based' === name) return '--safari-binary';
840
870
  return '--chromium-binary';
841
871
  }
@@ -851,11 +881,8 @@ var __webpack_modules__ = {
851
881
  case 'edge':
852
882
  browserDevToolsUrl = 'edge://extensions';
853
883
  break;
854
- case 'firefox':
855
- browserDevToolsUrl = 'about:debugging#/runtime/this-firefox';
856
- break;
857
884
  default:
858
- browserDevToolsUrl = '';
885
+ browserDevToolsUrl = (0, _browser_family__rspack_import_11.M_)(browser) ? 'about:debugging#/runtime/this-firefox' : '';
859
886
  }
860
887
  if (!message.data) return `${getLoggingPrefix('error')} No client data received for ${manifestName}.\n\n${pintor__rspack_import_8_default().red("Extension.js can't read data from your extension.")}\n${pintor__rspack_import_8_default().red('To fix, ensure that:')}\n\n- Your extension is enabled in ${pintor__rspack_import_8_default().underline(browserDevToolsUrl)}\n- No previous ${capitalize(browser)} browser instance is open\n\nIf both hold, restart the ${pintor__rspack_import_8_default().yellow(manifest.name || '')} and the\n${pintor__rspack_import_8_default().yellow('Manager Extension')} in ${pintor__rspack_import_8_default().underline(browserDevToolsUrl)} and try again.\nIf the issue persists, report a bug:\n` + pintor__rspack_import_8_default().underline("https://github.com/extension-js/extension.js/issues");
861
888
  const { id = '', management } = message.data;
@@ -1024,6 +1051,7 @@ var __webpack_modules__ = {
1024
1051
  _D: ()=>browserLaunchError,
1025
1052
  aI: ()=>devChromeProfilePath,
1026
1053
  aO: ()=>safariOpenHint,
1054
+ bC: ()=>librewolfRemoteDebuggingLocked,
1027
1055
  bv: ()=>cdpUnifiedExtensionLog,
1028
1056
  cD: ()=>targetActorHasActiveRequestError,
1029
1057
  cF: ()=>safariRebuilt,
@@ -1061,6 +1089,7 @@ var __webpack_modules__ = {
1061
1089
  sP: ()=>mv2NotSupportedByChromium,
1062
1090
  sY: ()=>creatingUserProfile,
1063
1091
  uK: ()=>safariConverting,
1092
+ v5: ()=>geckoForkNotInstalled,
1064
1093
  wk: ()=>chromeFailedToSpawn,
1065
1094
  xX: ()=>binaryProvenanceNote,
1066
1095
  xy: ()=>chromeInitializingEnhancedReload,
@@ -1138,7 +1167,7 @@ var __webpack_modules__ = {
1138
1167
  const root = String(cacheRoot || '').trim();
1139
1168
  if (!root) return {};
1140
1169
  if ('safari' === browser || 'webkit-based' === browser) return {};
1141
- if ('brave' === browser || 'opera' === browser || 'vivaldi' === browser || 'yandex' === browser || 'waterfox' === browser || 'librewolf' === browser) return {};
1170
+ if ('brave' === browser || 'opera' === browser || 'vivaldi' === browser || 'yandex' === browser || 'waterfox' === browser || 'librewolf' === browser || 'zen' === browser || 'floorp' === browser) return {};
1142
1171
  if ('chrome' === browser) return {
1143
1172
  PUPPETEER_CACHE_DIR: node_path__rspack_import_1.join(root, 'chrome', 'chrome')
1144
1173
  };
@@ -2031,17 +2060,127 @@ var __webpack_modules__ = {
2031
2060
  },
2032
2061
  "./browsers/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
2033
2062
  __webpack_require__.r(__webpack_exports__);
2034
- var _browsers_lib_browser_family__rspack_import_0 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
2035
- var _browsers_lib_output_binaries_resolver__rspack_import_1 = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
2036
- var _browsers_lib_runtime_options__rspack_import_10 = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
2037
- var _run_chromium_chromium_context__rspack_import_8 = __webpack_require__("./browsers/run-chromium/chromium-context/index.ts");
2038
- var _run_chromium_chromium_launch__rspack_import_2 = __webpack_require__("./browsers/run-chromium/chromium-launch/index.ts");
2039
- var _run_firefox_firefox_context__rspack_import_9 = __webpack_require__("./browsers/run-firefox/firefox-context/index.ts");
2040
- var _run_firefox_firefox_launch__rspack_import_3 = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
2041
- var _run_only__rspack_import_4 = __webpack_require__("./browsers/run-only.ts");
2042
- var _run_safari_safari_launch__rspack_import_5 = __webpack_require__("./browsers/run-safari/safari-launch/index.ts");
2043
- var _run_safari_safari_launch_safari_config__rspack_import_6 = __webpack_require__("./browsers/run-safari/safari-launch/safari-config.ts");
2044
- var _run_safari_safari_packager__rspack_import_7 = __webpack_require__("./browsers/run-safari/safari-packager.ts");
2063
+ __webpack_require__.d(__webpack_exports__, {
2064
+ builtAppPath: ()=>safari_config.fd,
2065
+ createSafariPackager: ()=>safari_packager.P,
2066
+ isValidBundleId: ()=>safari_config.OA,
2067
+ launchBrowser: ()=>launchBrowser,
2068
+ macOsSchemeName: ()=>safari_config.aD,
2069
+ packageSafariExtension: ()=>safari_launch.Ah,
2070
+ resolveSafariBuildConfig: ()=>safari_config.F7,
2071
+ runOnlyPreviewBrowser: ()=>run_only.E,
2072
+ safariBuildPreflight: ()=>safari_launch.QW,
2073
+ safariPreflightError: ()=>safari_launch.iF,
2074
+ xcodeProjectPath: ()=>safari_config.Gi
2075
+ });
2076
+ var browser_family = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
2077
+ var output_binaries_resolver = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
2078
+ var runtime_options = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
2079
+ var chromium_context = __webpack_require__("./browsers/run-chromium/chromium-context/index.ts");
2080
+ var chromium_launch = __webpack_require__("./browsers/run-chromium/chromium-launch/index.ts");
2081
+ var external_node_child_process_ = __webpack_require__("node:child_process");
2082
+ var external_pintor_ = __webpack_require__("pintor");
2083
+ var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
2084
+ var emulator_session = __webpack_require__("./helpers/emulator-session.ts");
2085
+ var messaging = __webpack_require__("./helpers/messaging.ts");
2086
+ function emulatorViewerUrlLine(url) {
2087
+ return `${(0, messaging.Pl)('info')} Emulated Chromium runs in a web page. Open this address to load your extension:\n${external_pintor_default().underline(url)}`;
2088
+ }
2089
+ function emulatorLogsLimitLine() {
2090
+ return `${(0, messaging.Pl)('warn')} --logs has no effect here: ${emulator_session.fg}`;
2091
+ }
2092
+ function openCommandFor(url, platform = process.platform) {
2093
+ if ('darwin' === platform) return {
2094
+ command: 'open',
2095
+ args: [
2096
+ url
2097
+ ]
2098
+ };
2099
+ if ('win32' === platform) return {
2100
+ command: 'rundll32',
2101
+ args: [
2102
+ 'url.dll,FileProtocolHandler',
2103
+ url
2104
+ ]
2105
+ };
2106
+ return {
2107
+ command: 'xdg-open',
2108
+ args: [
2109
+ url
2110
+ ]
2111
+ };
2112
+ }
2113
+ function engineVersionUrl(viewerUrl) {
2114
+ try {
2115
+ const parsed = new URL(viewerUrl);
2116
+ const base = parsed.pathname.endsWith('/') ? parsed.pathname : `${parsed.pathname.replace(/[^/]*$/, '')}`;
2117
+ return `${parsed.origin}${base}version.json`;
2118
+ } catch {
2119
+ return null;
2120
+ }
2121
+ }
2122
+ async function probeEngineOrigin(viewerUrl, fetchImpl = (url, init)=>fetch(url, init), timeoutMs = 3000) {
2123
+ const url = engineVersionUrl(viewerUrl);
2124
+ if (!url) return 'unknown';
2125
+ const controller = new AbortController();
2126
+ const timer = setTimeout(()=>controller.abort(), timeoutMs);
2127
+ try {
2128
+ const response = await fetchImpl(url, {
2129
+ signal: controller.signal
2130
+ });
2131
+ if (429 === response.status) return 'throttled';
2132
+ if (503 === response.status) return 'held';
2133
+ if (200 !== response.status) return 'unknown';
2134
+ const report = await response.json();
2135
+ return report && 'held' === report.hold ? 'held' : 'open';
2136
+ } catch {
2137
+ return 'unknown';
2138
+ } finally{
2139
+ clearTimeout(timer);
2140
+ }
2141
+ }
2142
+ function engineOriginLine(verdict) {
2143
+ if ('held' === verdict) return `${(0, messaging.Pl)('warn')} emulated Chromium is not open to the public yet, so this address answers 503 until it is. Run this project with --browser=chrome in the meantime.`;
2144
+ if ('throttled' === verdict) return `${(0, messaging.Pl)('warn')} the emulated Chromium origin is rate limiting this address (HTTP 429). Wait a minute, then run extension dev again, or run this project with --browser=chrome.`;
2145
+ return null;
2146
+ }
2147
+ function openInDefaultBrowser(url) {
2148
+ const { command, args } = openCommandFor(url);
2149
+ try {
2150
+ const child = (0, external_node_child_process_.spawn)(command, args, {
2151
+ detached: true,
2152
+ stdio: 'ignore',
2153
+ windowsHide: true
2154
+ });
2155
+ child.on('error', ()=>{});
2156
+ child.unref();
2157
+ } catch {
2158
+ return;
2159
+ }
2160
+ }
2161
+ async function launchEmulator(opts, opener = openInDefaultBrowser, probe = probeEngineOrigin) {
2162
+ if ('development' !== (opts.mode || 'production')) throw new Error('emulated Chromium needs the dev server that serves the files the page reads. Run extension dev instead.');
2163
+ const url = opts.emulatorViewerUrl;
2164
+ if (!url) throw new Error('this version of extension-develop does not serve emulated Chromium. Update extension-develop so it matches the CLI, then run extension dev again.');
2165
+ console.log(emulatorViewerUrlLine(url));
2166
+ const willOpen = !opts.noOpen && !opts.dryRun;
2167
+ const verdict = willOpen ? await probe(url) : 'unknown';
2168
+ const originLine = engineOriginLine(verdict);
2169
+ if (originLine) console.warn(originLine);
2170
+ if (willOpen && !originLine) opener(url);
2171
+ const logsRequested = Boolean(opts.logLevel && 'off' !== opts.logLevel);
2172
+ return {
2173
+ async enableUnifiedLogging () {
2174
+ if (logsRequested) console.warn(emulatorLogsLimitLine());
2175
+ }
2176
+ };
2177
+ }
2178
+ var firefox_context = __webpack_require__("./browsers/run-firefox/firefox-context/index.ts");
2179
+ var firefox_launch = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
2180
+ var run_only = __webpack_require__("./browsers/run-only.ts");
2181
+ var safari_launch = __webpack_require__("./browsers/run-safari/safari-launch/index.ts");
2182
+ var safari_config = __webpack_require__("./browsers/run-safari/safari-launch/safari-config.ts");
2183
+ var safari_packager = __webpack_require__("./browsers/run-safari/safari-packager.ts");
2045
2184
  function createCompilationLike(opts) {
2046
2185
  return {
2047
2186
  options: {
@@ -2057,11 +2196,12 @@ var __webpack_modules__ = {
2057
2196
  };
2058
2197
  }
2059
2198
  async function launchBrowser(opts) {
2199
+ if ((0, browser_family.eP)(opts.browser)) return launchEmulator(opts);
2060
2200
  const compilationLike = createCompilationLike(opts);
2061
2201
  const mode = opts.mode || 'production';
2062
- (0, _browsers_lib_output_binaries_resolver__rspack_import_1.LB)(compilationLike);
2063
- if ((0, _browsers_lib_browser_family__rspack_import_0.rG)(opts.browser)) return launchChromium(opts, compilationLike, mode);
2064
- if ((0, _browsers_lib_browser_family__rspack_import_0.M_)(opts.browser)) return launchFirefox(opts, compilationLike, mode);
2202
+ (0, output_binaries_resolver.LB)(compilationLike);
2203
+ if ((0, browser_family.rG)(opts.browser)) return launchChromium(opts, compilationLike, mode);
2204
+ if ((0, browser_family.M_)(opts.browser)) return launchFirefox(opts, compilationLike, mode);
2065
2205
  throw new Error(`Unsupported browser: ${String(opts.browser)}`);
2066
2206
  }
2067
2207
  async function launchChromium(opts, compilationLike, mode) {
@@ -2090,8 +2230,8 @@ var __webpack_modules__ = {
2090
2230
  logTab: opts.logTab,
2091
2231
  logSink: opts.logSink
2092
2232
  };
2093
- const ctx = (0, _run_chromium_chromium_context__rspack_import_8.g)();
2094
- const launcher = new _run_chromium_chromium_launch__rspack_import_2.f(chromiumOpts, ctx);
2233
+ const ctx = (0, chromium_context.g)();
2234
+ const launcher = new chromium_launch.f(chromiumOpts, ctx);
2095
2235
  const enableCdp = 'development' === mode;
2096
2236
  await launcher.runOnce(compilationLike, {
2097
2237
  enableCdpPostLaunch: enableCdp
@@ -2165,9 +2305,9 @@ var __webpack_modules__ = {
2165
2305
  port: opts.port,
2166
2306
  dryRun: opts.dryRun
2167
2307
  };
2168
- const ctx = (0, _run_firefox_firefox_context__rspack_import_9.D)();
2169
- const launcher = new _run_firefox_firefox_launch__rspack_import_3.c(firefoxOpts, ctx);
2170
- const launchRequest = (0, _browsers_lib_runtime_options__rspack_import_10.zU)(pluginOptions, mode, {
2308
+ const ctx = (0, firefox_context.D)();
2309
+ const launcher = new firefox_launch.c(firefoxOpts, ctx);
2310
+ const launchRequest = (0, runtime_options.zU)(pluginOptions, mode, {
2171
2311
  persistProfile: opts.persistProfile,
2172
2312
  geckoBinary: opts.geckoBinary
2173
2313
  });
@@ -2197,19 +2337,6 @@ var __webpack_modules__ = {
2197
2337
  }
2198
2338
  };
2199
2339
  }
2200
- __webpack_require__.d(__webpack_exports__, {
2201
- builtAppPath: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.fd,
2202
- createSafariPackager: ()=>_run_safari_safari_packager__rspack_import_7.P,
2203
- isValidBundleId: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.OA,
2204
- launchBrowser: ()=>launchBrowser,
2205
- macOsSchemeName: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.aD,
2206
- packageSafariExtension: ()=>_run_safari_safari_launch__rspack_import_5.Ah,
2207
- resolveSafariBuildConfig: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.F7,
2208
- runOnlyPreviewBrowser: ()=>_run_only__rspack_import_4.E,
2209
- safariBuildPreflight: ()=>_run_safari_safari_launch__rspack_import_5.QW,
2210
- safariPreflightError: ()=>_run_safari_safari_launch__rspack_import_5.iF,
2211
- xcodeProjectPath: ()=>_run_safari_safari_launch_safari_config__rspack_import_6.Gi
2212
- });
2213
2340
  },
2214
2341
  "./browsers/run-chromium/cdp/discovery.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
2215
2342
  __webpack_require__.d(__webpack_exports__, {
@@ -3634,10 +3761,11 @@ var __webpack_modules__ = {
3634
3761
  stderrStream.on('error', ()=>{});
3635
3762
  }
3636
3763
  let disposeSignalHandlers;
3637
- child.on('close', (code)=>{
3764
+ child.on('close', (code, signal)=>{
3638
3765
  if ((0, messaging._o)()) this.logger.info(messages.nn(code || 0));
3766
+ const how = null == code ? `signal ${signal || 'unknown'}` : `code ${code}`;
3639
3767
  if (!(0, process_teardown.Op)(child)) {
3640
- this.logger.error(this.closeHandlerContext?.isDevMode ? `[browser] ${this.options.browser} exited mid-session (code ${code ?? 'unknown'}). The dev server is still running but reloads cannot be delivered, restart "extension dev" to relaunch the browser.` : `[browser] ${this.options.browser} exited (code ${code ?? 'unknown'}); the preview session is over.`);
3768
+ this.logger.error(this.closeHandlerContext?.isDevMode ? `[browser] ${this.options.browser} exited mid-session (${how}). The dev server is still running but reloads cannot be delivered, restart "extension dev" to relaunch the browser.` : `[browser] ${this.options.browser} exited (${how}); the preview session is over.`);
3641
3769
  (0, ready_stamp.Wi)(this.closeHandlerContext?.extensionOutputPath, code);
3642
3770
  }
3643
3771
  disposeSignalHandlers?.();
@@ -3845,10 +3973,14 @@ var __webpack_modules__ = {
3845
3973
  var external_node_fs_ = __webpack_require__("node:fs");
3846
3974
  var external_firefox_location2_ = __webpack_require__("firefox-location2");
3847
3975
  var external_firefox_location2_default = /*#__PURE__*/ __webpack_require__.n(external_firefox_location2_);
3976
+ const external_floorp_location_namespaceObject = require("floorp-location");
3977
+ var external_floorp_location_default = /*#__PURE__*/ __webpack_require__.n(external_floorp_location_namespaceObject);
3848
3978
  const external_librewolf_location_namespaceObject = require("librewolf-location");
3849
3979
  var external_librewolf_location_default = /*#__PURE__*/ __webpack_require__.n(external_librewolf_location_namespaceObject);
3850
3980
  const external_waterfox_location_namespaceObject = require("waterfox-location");
3851
3981
  var external_waterfox_location_default = /*#__PURE__*/ __webpack_require__.n(external_waterfox_location_namespaceObject);
3982
+ const external_zen_location_namespaceObject = require("zen-location");
3983
+ var external_zen_location_default = /*#__PURE__*/ __webpack_require__.n(external_zen_location_namespaceObject);
3852
3984
  var messaging = __webpack_require__("./helpers/messaging.ts");
3853
3985
  var banner = __webpack_require__("./browsers/browsers-lib/banner.ts");
3854
3986
  var instance_registry = __webpack_require__("./browsers/browsers-lib/instance-registry.ts");
@@ -4254,12 +4386,30 @@ var __webpack_modules__ = {
4254
4386
  extensionsToLoad
4255
4387
  };
4256
4388
  }
4389
+ function attachChildOutput(child, opts) {
4390
+ const sinks = opts.sinks || {
4391
+ stdout: process.stdout,
4392
+ stderr: process.stderr
4393
+ };
4394
+ for (const [stream, sink] of [
4395
+ [
4396
+ child.stdout,
4397
+ sinks.stdout
4398
+ ],
4399
+ [
4400
+ child.stderr,
4401
+ sinks.stderr
4402
+ ]
4403
+ ])if (stream) if (opts.debug) stream.pipe(sink);
4404
+ else stream.resume();
4405
+ }
4257
4406
  function logFirefoxDryRun(browserBinaryLocation, launchArgs) {
4258
4407
  if ((0, messaging._o)()) (0, messaging._w)(messages.A9());
4259
4408
  (0, messaging._w)(messages.qn());
4260
4409
  (0, messaging._w)(messages.LD(browserBinaryLocation));
4261
4410
  (0, messaging._w)(messages.lO(launchArgs.join(' ')));
4262
4411
  }
4412
+ var librewolf_overrides = __webpack_require__("./browsers/run-firefox/firefox-launch/librewolf-overrides.ts");
4263
4413
  const activeInstances = new Set();
4264
4414
  let globalHandlersInstalled = false;
4265
4415
  async function attemptCleanup(instance) {
@@ -5266,7 +5416,7 @@ var __webpack_modules__ = {
5266
5416
  }
5267
5417
  } catch {}
5268
5418
  this.lastInstalledAddonPath = primaryAddonPath;
5269
- const bannerPrinted = await printRunningInDevelopmentSummary(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine, {
5419
+ const bannerPrinted = await printRunningInDevelopmentSummary(candidateAddonPaths, this.options.browser, this.derivedExtensionId, this.options.browserVersionLine, {
5270
5420
  profilePath: this.options.launchProfilePath,
5271
5421
  binaryPath: this.options.launchBinaryPath,
5272
5422
  binaryProvenance: this.options.launchBinaryProvenance
@@ -5518,12 +5668,13 @@ var __webpack_modules__ = {
5518
5668
  async launch(compilation, options) {
5519
5669
  const compilationErrors = compilation?.errors || [];
5520
5670
  if (compilationErrors.length > 0) return void this.ctx.logger?.info?.(messages.y7());
5521
- if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.A9());
5671
+ if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.A9(this.host.browser));
5522
5672
  const normalizePath = (value)=>{
5523
5673
  const normalized = value ? (0, wsl_support.f7)(value) : null;
5524
5674
  return normalized && external_node_fs_.existsSync(normalized) ? normalized : null;
5525
5675
  };
5526
- const resolveManagedBinary = ()=>normalizePath((0, output_binaries_resolver.kI)(compilation, 'firefox') || null);
5676
+ const isNamedGeckoFork = 'waterfox' === this.host.browser || 'librewolf' === this.host.browser || 'zen' === this.host.browser || 'floorp' === this.host.browser;
5677
+ const resolveManagedBinary = ()=>isNamedGeckoFork ? null : normalizePath((0, output_binaries_resolver.kI)(compilation, 'firefox') || null);
5527
5678
  const resolveWslFallback = ()=>resolveWslWindowsBinary();
5528
5679
  const getInstallGuidanceText = ()=>{
5529
5680
  try {
@@ -5553,6 +5704,14 @@ var __webpack_modules__ = {
5553
5704
  const dryRun = Boolean(this.host.dryRun);
5554
5705
  if (inTestRunner && !dryRun) return void logFirefoxDryRun('firefox-mock-binary', []);
5555
5706
  if (inTestRunner && dryRun) return void await this.printDryRunPlan(compilation, options, this.host.geckoBinary ? (0, wsl_support.f7)(String(this.host.geckoBinary)) : 'firefox-mock-binary');
5707
+ if ('librewolf' === this.host.browser) {
5708
+ const remoteDebugging = (0, librewolf_overrides.u5)(external_node_fs_, process.env, process.platform);
5709
+ if (!remoteDebugging.enabled) {
5710
+ (0, messaging.Gg)(messages.bC(remoteDebugging.expectedPath));
5711
+ if (inTestRunner) throw new Error('LibreWolf remote debugging is disabled');
5712
+ process.exit(1);
5713
+ }
5714
+ }
5556
5715
  let browserBinaryLocation = resolveManagedBinary();
5557
5716
  let skipDetection = Boolean(browserBinaryLocation);
5558
5717
  const engineBased = 'gecko-based' === this.host.browser || 'firefox-based' === this.host.browser;
@@ -5591,6 +5750,18 @@ var __webpack_modules__ = {
5591
5750
  });
5592
5751
  const normalized = normalizePath(located);
5593
5752
  if (normalized) browserBinaryLocation = normalized;
5753
+ } else if ('zen' === this.host.browser) {
5754
+ const located = external_zen_location_default()(true, {
5755
+ env: process.env
5756
+ });
5757
+ const normalized = normalizePath(located);
5758
+ if (normalized) browserBinaryLocation = normalized;
5759
+ } else if ('floorp' === this.host.browser) {
5760
+ const located = external_floorp_location_default()(true, {
5761
+ env: process.env
5762
+ });
5763
+ const normalized = normalizePath(located);
5764
+ if (normalized) browserBinaryLocation = normalized;
5594
5765
  } else {
5595
5766
  const cacheRoot = (0, output_binaries_resolver.LB)(compilation);
5596
5767
  const env = {
@@ -5762,9 +5933,9 @@ var __webpack_modules__ = {
5762
5933
  });
5763
5934
  }
5764
5935
  pipeChildOutput(child) {
5765
- if (!(0, messaging._o)()) return;
5766
- child.stdout?.pipe(process.stdout);
5767
- child.stderr?.pipe(process.stderr);
5936
+ attachChildOutput(child, {
5937
+ debug: (0, messaging._o)()
5938
+ });
5768
5939
  }
5769
5940
  wireChildLifecycle() {
5770
5941
  const child = this.child;
@@ -5774,15 +5945,15 @@ var __webpack_modules__ = {
5774
5945
  if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Firefox startup timed out');
5775
5946
  process.exit(1);
5776
5947
  });
5777
- child.on('close', (code)=>{
5948
+ child.on('close', (code, signal)=>{
5778
5949
  const expected = (0, process_teardown.Op)(child);
5779
5950
  if (!expected && this.adoptHandedOffBrowser()) return;
5780
- this.onBrowserGone(code, expected);
5951
+ this.onBrowserGone(code, expected, signal);
5781
5952
  });
5782
5953
  this.pipeChildOutput(child);
5783
5954
  this.disposeProcessHandlers = setupFirefoxProcessHandlers(this.host.browser, ()=>this.child, ()=>this.cleanupInstance(), ()=>this.livePid);
5784
5955
  }
5785
- onBrowserGone(code, expected) {
5956
+ onBrowserGone(code, expected, signal) {
5786
5957
  if (this.browserGone) return;
5787
5958
  this.browserGone = true;
5788
5959
  if (this.watchTimeout) {
@@ -5796,7 +5967,7 @@ var __webpack_modules__ = {
5796
5967
  if (this.host.launchProfilePath) (0, shared_utils.sW)(this.host.launchProfilePath);
5797
5968
  if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.Th(this.host.browser));
5798
5969
  if (!expected) {
5799
- this.ctx.logger?.error?.(`[browser] ${this.host.browser} exited (code ${code ?? 'unknown'}) without being asked to. The add-on may have been rejected or the browser crashed; the session cannot be driven.`);
5970
+ this.ctx.logger?.error?.(`[browser] ${this.host.browser} exited (${null == code ? `signal ${signal || 'unknown'}` : `code ${code}`}) without being asked to. The add-on may have been rejected or the browser crashed; the session cannot be driven.`);
5800
5971
  (0, ready_stamp.Wi)(this.extensionOutputPath, code);
5801
5972
  }
5802
5973
  this.cleanupInstance().catch((err)=>{
@@ -5912,6 +6083,8 @@ var __webpack_modules__ = {
5912
6083
  if ('function' == typeof this.watchTimeout.unref) this.watchTimeout.unref();
5913
6084
  }
5914
6085
  printInstallHint(compilation, raw) {
6086
+ const forkGuidance = geckoForkInstallGuidance(this.host.browser);
6087
+ if (null !== forkGuidance) return void (0, messaging.Gg)(messages.v5(this.host.browser, forkGuidance));
5915
6088
  try {
5916
6089
  const displayCacheDir = (0, output_binaries_resolver.LB)(compilation);
5917
6090
  const pretty = messages.MG(this.host.browser || 'firefox', raw, displayCacheDir);
@@ -5934,6 +6107,69 @@ var __webpack_modules__ = {
5934
6107
  this.ctx = ctx;
5935
6108
  }
5936
6109
  }
6110
+ function geckoForkInstallGuidance(browser) {
6111
+ const read = (fn)=>{
6112
+ try {
6113
+ return fn();
6114
+ } catch {
6115
+ return '';
6116
+ }
6117
+ };
6118
+ switch(browser){
6119
+ case 'waterfox':
6120
+ return read(()=>(0, external_waterfox_location_namespaceObject.getInstallGuidance)());
6121
+ case 'librewolf':
6122
+ return read(()=>(0, external_librewolf_location_namespaceObject.getInstallGuidance)());
6123
+ case 'zen':
6124
+ return read(()=>(0, external_zen_location_namespaceObject.getInstallGuidance)());
6125
+ case 'floorp':
6126
+ return read(()=>(0, external_floorp_location_namespaceObject.getInstallGuidance)());
6127
+ default:
6128
+ return null;
6129
+ }
6130
+ }
6131
+ },
6132
+ "./browsers/run-firefox/firefox-launch/librewolf-overrides.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
6133
+ var node_path__rspack_import_0 = __webpack_require__("node:path");
6134
+ const LIBREWOLF_REMOTE_DEBUGGING_LINES = [
6135
+ 'pref("devtools.debugger.remote-enabled", true);',
6136
+ 'pref("devtools.debugger.prompt-connection", false);'
6137
+ ];
6138
+ const OVERRIDES_FILE = 'librewolf.overrides.cfg';
6139
+ function librewolfOverridesCandidates(env, platform) {
6140
+ const home = String(env.HOME || env.USERPROFILE || '').trim();
6141
+ const candidates = [];
6142
+ if ('win32' === platform) {
6143
+ if (home) candidates.push(node_path__rspack_import_0.join(home, '.librewolf', OVERRIDES_FILE));
6144
+ return candidates;
6145
+ }
6146
+ if (home) candidates.push(node_path__rspack_import_0.join(home, '.librewolf', OVERRIDES_FILE));
6147
+ const xdg = String(env.XDG_CONFIG_HOME || '').trim();
6148
+ if (xdg) candidates.push(node_path__rspack_import_0.join(xdg, 'librewolf', 'librewolf', OVERRIDES_FILE));
6149
+ if (home) candidates.push(node_path__rspack_import_0.join(home, '.config', 'librewolf', 'librewolf', OVERRIDES_FILE));
6150
+ return candidates;
6151
+ }
6152
+ function librewolfRemoteDebuggingEnabled(fsLike, env, platform) {
6153
+ const candidates = librewolfOverridesCandidates(env, platform);
6154
+ const expectedPath = candidates[0] || node_path__rspack_import_0.join('~', '.librewolf', OVERRIDES_FILE);
6155
+ const enabledLine = /^\s*(?:pref|defaultPref|lockPref)\(\s*"devtools\.debugger\.remote-enabled"\s*,\s*true\s*\)/m;
6156
+ for (const candidate of candidates)try {
6157
+ if (!fsLike.existsSync(candidate)) continue;
6158
+ if (enabledLine.test(fsLike.readFileSync(candidate, 'utf-8'))) return {
6159
+ enabled: true,
6160
+ expectedPath: candidate
6161
+ };
6162
+ } catch {}
6163
+ return {
6164
+ enabled: false,
6165
+ expectedPath
6166
+ };
6167
+ }
6168
+ __webpack_require__.d(__webpack_exports__, {
6169
+ u5: ()=>librewolfRemoteDebuggingEnabled
6170
+ }, {
6171
+ Tu: LIBREWOLF_REMOTE_DEBUGGING_LINES
6172
+ });
5937
6173
  },
5938
6174
  "./browsers/run-only.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
5939
6175
  var node_fs__rspack_import_0 = __webpack_require__("node:fs");
@@ -6712,6 +6948,13 @@ var __webpack_modules__ = {
6712
6948
  rQ: ()=>recordBrowserInstall
6713
6949
  });
6714
6950
  },
6951
+ "./helpers/emulator-session.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
6952
+ __webpack_require__("./helpers/vendors.ts");
6953
+ const EMULATOR_LOGS_REFUSAL = 'emulated Chromium runs in a web page, so extension logs has nothing to attach to. Open your browser devtools on that page to read the console.';
6954
+ __webpack_require__.d(__webpack_exports__, {}, {
6955
+ fg: EMULATOR_LOGS_REFUSAL
6956
+ });
6957
+ },
6715
6958
  "./helpers/messaging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
6716
6959
  var pintor__rspack_import_0 = __webpack_require__("pintor");
6717
6960
  var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
@@ -6770,9 +7013,20 @@ var __webpack_modules__ = {
6770
7013
  ...body
6771
7014
  ].join('\n');
6772
7015
  }
6773
- function browserRowValue(browser, versionLine) {
7016
+ const BRAND_SPELLINGS = {
7017
+ librewolf: 'LibreWolf',
7018
+ chromium: 'Chromium',
7019
+ 'chromium-based': 'Chromium-based',
7020
+ 'gecko-based': 'Gecko-based',
7021
+ 'firefox-based': 'Firefox-based',
7022
+ 'webkit-based': 'WebKit-based'
7023
+ };
7024
+ function browserDisplayName(browser) {
6774
7025
  const name = String(browser || '').trim() || 'unknown';
6775
- const display = name.charAt(0).toUpperCase() + name.slice(1);
7026
+ return BRAND_SPELLINGS[name] || name.charAt(0).toUpperCase() + name.slice(1);
7027
+ }
7028
+ function browserRowValue(browser, versionLine) {
7029
+ const display = browserDisplayName(browser);
6776
7030
  const line = String(versionLine || '').trim();
6777
7031
  if (!line) return display;
6778
7032
  if (!/[a-zA-Z]/.test(line)) return `${display} ${line}`;
@@ -6796,6 +7050,8 @@ var __webpack_modules__ = {
6796
7050
  'firefox-based',
6797
7051
  'gecko-based',
6798
7052
  'librewolf',
7053
+ 'zen',
7054
+ 'floorp',
6799
7055
  'waterfox'
6800
7056
  ]);
6801
7057
  function artifactNoun(browser) {
@@ -6809,6 +7065,7 @@ var __webpack_modules__ = {
6809
7065
  Gg: ()=>humanError,
6810
7066
  Nr: ()=>card,
6811
7067
  Pl: ()=>prefix,
7068
+ QZ: ()=>browserDisplayName,
6812
7069
  T_: ()=>artifactNoun,
6813
7070
  VR: ()=>isCardKeyClaimed,
6814
7071
  _o: ()=>isDebug,
@@ -6817,6 +7074,48 @@ var __webpack_modules__ = {
6817
7074
  od: ()=>claimCardKey
6818
7075
  });
6819
7076
  },
7077
+ "./helpers/vendors.ts" () {
7078
+ function isSafariVendor(value) {
7079
+ return 'safari' === value || 'webkit-based' === value;
7080
+ }
7081
+ const SUPPORTED_BROWSER_TARGETS = [
7082
+ 'chrome',
7083
+ 'chromium',
7084
+ 'edge',
7085
+ 'firefox',
7086
+ 'brave',
7087
+ 'opera',
7088
+ 'vivaldi',
7089
+ 'yandex',
7090
+ 'waterfox',
7091
+ 'librewolf',
7092
+ 'zen',
7093
+ 'floorp',
7094
+ 'chromium-based',
7095
+ 'gecko-based',
7096
+ 'firefox-based',
7097
+ 'safari',
7098
+ 'webkit-based'
7099
+ ];
7100
+ SUPPORTED_BROWSER_TARGETS.join(' | ');
7101
+ "chrome | chromium | edge | firefox | safari";
7102
+ SUPPORTED_BROWSER_TARGETS.filter((target)=>!isSafariVendor(target)).join(' | ');
7103
+ const MANAGED_INSTALL_TARGETS = [
7104
+ 'chrome',
7105
+ 'chromium',
7106
+ 'edge',
7107
+ 'firefox',
7108
+ 'chromium-based',
7109
+ 'gecko-based',
7110
+ 'firefox-based'
7111
+ ];
7112
+ [
7113
+ ...MANAGED_INSTALL_TARGETS,
7114
+ 'all'
7115
+ ].join(' | ');
7116
+ new Set(MANAGED_INSTALL_TARGETS);
7117
+ new Set(SUPPORTED_BROWSER_TARGETS);
7118
+ },
6820
7119
  "chrome-location2" (module) {
6821
7120
  module.exports = require("chrome-location2");
6822
7121
  },