extension-develop 3.3.2 → 3.3.3-mext.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 (2) hide show
  1. package/dist/module.js +341 -86
  2. package/package.json +1 -1
package/dist/module.js CHANGED
@@ -128318,7 +128318,6 @@ var __webpack_modules__ = {
128318
128318
  f: ()=>ChromiumLaunchPlugin
128319
128319
  });
128320
128320
  var external_fs_ = __webpack_require__("fs");
128321
- var external_child_process_ = __webpack_require__("child_process");
128322
128321
  var external_chrome_location2_ = __webpack_require__("chrome-location2");
128323
128322
  var external_chrome_location2_default = /*#__PURE__*/ __webpack_require__.n(external_chrome_location2_);
128324
128323
  var external_chromium_location_ = __webpack_require__("chromium-location");
@@ -128440,6 +128439,7 @@ var __webpack_modules__ = {
128440
128439
  ];
128441
128440
  return baseFlags;
128442
128441
  }
128442
+ var external_child_process_ = __webpack_require__("child_process");
128443
128443
  function setupProcessSignalHandlers(browser, child, cleanupInstance) {
128444
128444
  const cleanup = ()=>{
128445
128445
  try {
@@ -128492,6 +128492,86 @@ var __webpack_modules__ = {
128492
128492
  console.log(messages.E8B(chromiumConfig.join(' ')));
128493
128493
  }
128494
128494
  var extension_output_path = __webpack_require__("./webpack/plugin-browsers/run-chromium/chromium-launch/extension-output-path.ts");
128495
+ function isWslEnv() {
128496
+ return Boolean(String(process.env.WSL_DISTRO_NAME || '').trim() || String(process.env.WSL_INTEROP || '').trim() || String(process.env.WSLENV || '').trim());
128497
+ }
128498
+ function normalizeBinaryPathForWsl(input) {
128499
+ let value = String(input || '').trim();
128500
+ if (!value) return value;
128501
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
128502
+ if (!isWslEnv()) return value;
128503
+ if (/^[a-zA-Z]:[\\/]/.test(value)) {
128504
+ const drive = value[0].toLowerCase();
128505
+ const rest = value.slice(2).replace(/\\/g, '/').replace(/^\/+/, '');
128506
+ return `/mnt/${drive}/${rest}`;
128507
+ }
128508
+ return value;
128509
+ }
128510
+ function resolveWslWindowsBinary(browser) {
128511
+ if (!isWslEnv()) return null;
128512
+ const chromeCandidates = [
128513
+ '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe',
128514
+ '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
128515
+ ];
128516
+ const chromiumCandidates = [
128517
+ '/mnt/c/Program Files/Chromium/Application/chrome.exe',
128518
+ '/mnt/c/Program Files (x86)/Chromium/Application/chrome.exe'
128519
+ ];
128520
+ const edgeCandidates = [
128521
+ '/mnt/c/Program Files/Microsoft/Edge/Application/msedge.exe',
128522
+ '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
128523
+ ];
128524
+ const candidates = 'edge' === browser ? edgeCandidates : 'chromium' === browser || 'chromium-based' === browser ? [
128525
+ ...chromiumCandidates,
128526
+ ...chromeCandidates
128527
+ ] : chromeCandidates;
128528
+ for (const candidate of candidates)if (external_fs_.existsSync(candidate)) return candidate;
128529
+ return null;
128530
+ }
128531
+ async function spawnChromiumProcess(opts) {
128532
+ const { binary, launchArgs, stdio, browser, logger } = opts;
128533
+ const isWin = 'win32' === process.platform;
128534
+ const spawnOnce = async (bin)=>{
128535
+ const child = (0, external_child_process_.spawn)(bin, launchArgs, {
128536
+ stdio,
128537
+ detached: false,
128538
+ ...isWin ? {
128539
+ windowsHide: true
128540
+ } : {},
128541
+ ...isWin && /\s/.test(bin) ? {
128542
+ shell: true
128543
+ } : {},
128544
+ ...'win32' !== process.platform && {
128545
+ group: process.getgid?.()
128546
+ }
128547
+ });
128548
+ await new Promise((resolve, reject)=>{
128549
+ const handleError = (error)=>{
128550
+ child.removeListener('spawn', handleSpawn);
128551
+ reject(error);
128552
+ };
128553
+ const handleSpawn = ()=>{
128554
+ child.removeListener('error', handleError);
128555
+ resolve();
128556
+ };
128557
+ child.once('error', handleError);
128558
+ child.once('spawn', handleSpawn);
128559
+ });
128560
+ return child;
128561
+ };
128562
+ try {
128563
+ return await spawnOnce(binary);
128564
+ } catch (error) {
128565
+ if (isWslEnv()) {
128566
+ const fallback = resolveWslWindowsBinary(browser);
128567
+ if (fallback && fallback !== binary) {
128568
+ logger?.warn?.('[plugin-browsers] WSL detected: retrying with Windows browser binary.');
128569
+ return await spawnOnce(fallback);
128570
+ }
128571
+ }
128572
+ throw error;
128573
+ }
128574
+ }
128495
128575
  function _define_property(obj, key, value) {
128496
128576
  if (key in obj) Object.defineProperty(obj, key, {
128497
128577
  value: value,
@@ -128539,11 +128619,24 @@ var __webpack_modules__ = {
128539
128619
  const browser = this.options?.browser;
128540
128620
  let browserBinaryLocation = null;
128541
128621
  let printedGuidance = false;
128622
+ const normalizePath = (p)=>{
128623
+ if (!p) return null;
128624
+ const normalized = normalizeBinaryPathForWsl(p);
128625
+ return normalized || null;
128626
+ };
128542
128627
  try {
128543
128628
  const resolved = output_binaries_resolver.kI(compilation, 'chromium' === browser || 'chromium-based' === browser ? 'chromium' : 'edge' === browser ? 'edge' : 'chrome');
128544
- if (resolved && external_fs_.existsSync(resolved)) browserBinaryLocation = resolved;
128629
+ const normalized = normalizePath(resolved || null);
128630
+ if (normalized && external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
128545
128631
  } catch {}
128546
- const skipDetection = Boolean(browserBinaryLocation);
128632
+ let skipDetection = Boolean(browserBinaryLocation);
128633
+ if (!browserBinaryLocation && isWslEnv()) {
128634
+ const wslFallback = resolveWslWindowsBinary(browser);
128635
+ if (wslFallback) {
128636
+ browserBinaryLocation = wslFallback;
128637
+ skipDetection = true;
128638
+ }
128639
+ }
128547
128640
  const getBrowserVersionLine = (bin)=>{
128548
128641
  try {
128549
128642
  if ('edge' === browser) return (0, external_edge_location_.getEdgeVersion)(bin, {
@@ -128575,25 +128668,28 @@ var __webpack_modules__ = {
128575
128668
  const located = (0, external_chrome_location2_.locateChromeOrExplain)({
128576
128669
  allowFallback: true
128577
128670
  });
128578
- if (located && external_fs_.existsSync(located)) {
128579
- const versionLine = getBrowserVersionLine(located);
128580
- if (looksOfficialChrome(versionLine)) {
128671
+ const normalized = normalizePath(located || null);
128672
+ if (normalized && external_fs_.existsSync(normalized)) {
128673
+ const versionLine = getBrowserVersionLine(normalized);
128674
+ if (looksOfficialChrome(versionLine) && !isWslEnv()) {
128581
128675
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
128582
128676
  printedGuidance = true;
128583
128677
  browserBinaryLocation = null;
128584
- } else browserBinaryLocation = located;
128678
+ } else browserBinaryLocation = normalized;
128585
128679
  } else browserBinaryLocation = null;
128586
128680
  } catch (err) {
128587
128681
  let candidate = external_chrome_location2_default()(true) || null;
128588
- if (candidate) {
128589
- const versionLine = getBrowserVersionLine(candidate);
128590
- if (looksOfficialChrome(versionLine)) {
128682
+ const normalized = normalizePath(candidate || null);
128683
+ if (normalized) {
128684
+ const versionLine = getBrowserVersionLine(normalized);
128685
+ if (looksOfficialChrome(versionLine) && !isWslEnv()) {
128591
128686
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
128592
128687
  printedGuidance = true;
128593
128688
  candidate = null;
128594
128689
  }
128595
128690
  }
128596
- browserBinaryLocation = candidate;
128691
+ browserBinaryLocation = normalized;
128692
+ if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
128597
128693
  if (!browserBinaryLocation) throw err;
128598
128694
  }
128599
128695
  } catch (e) {
@@ -128606,25 +128702,40 @@ var __webpack_modules__ = {
128606
128702
  console.log(messages.GqE(browser));
128607
128703
  browserBinaryLocation = this.options?.chromiumBinary || null;
128608
128704
  if (this.options?.chromiumBinary) {
128609
- if (!external_fs_.existsSync(String(this.options.chromiumBinary))) {
128705
+ const normalized = normalizePath(String(this.options.chromiumBinary));
128706
+ if (!normalized || !external_fs_.existsSync(normalized)) {
128610
128707
  console.error(messages.Spm(String(this.options.chromiumBinary)));
128611
128708
  process.exit(1);
128612
128709
  }
128710
+ browserBinaryLocation = normalized;
128613
128711
  }
128614
128712
  if (!browserBinaryLocation && !skipDetection) try {
128615
128713
  const p = external_chromium_location_default()();
128616
- if (p && 'string' == typeof p && external_fs_.existsSync(p)) browserBinaryLocation = p;
128714
+ const normalized = normalizePath(p || null);
128715
+ if (normalized && 'string' == typeof normalized) {
128716
+ if (external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
128717
+ }
128617
128718
  } catch {}
128719
+ if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
128618
128720
  break;
128619
128721
  case 'edge':
128620
128722
  console.log(messages.GqE(browser));
128621
128723
  try {
128622
128724
  const override = String(process.env.EDGE_BINARY || '').trim();
128623
- if (override) if (external_fs_.existsSync(override)) browserBinaryLocation = override;
128624
- else throw new Error('EDGE_BINARY points to a non-existent path');
128625
- else {
128626
- browserBinaryLocation = external_edge_location_default()();
128725
+ if (override) {
128726
+ const normalized = normalizePath(override);
128727
+ if (normalized && external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
128728
+ else throw new Error('EDGE_BINARY points to a non-existent path');
128729
+ } else {
128730
+ const located = external_edge_location_default()();
128731
+ const normalized = normalizePath(located || null);
128732
+ browserBinaryLocation = normalized;
128627
128733
  if (!browserBinaryLocation || !external_fs_.existsSync(String(browserBinaryLocation))) {
128734
+ const fallback = resolveWslWindowsBinary(browser);
128735
+ if (fallback) {
128736
+ browserBinaryLocation = fallback;
128737
+ break;
128738
+ }
128628
128739
  const guidance = (()=>{
128629
128740
  try {
128630
128741
  return (0, external_edge_location_.getInstallGuidance)();
@@ -128647,28 +128758,38 @@ var __webpack_modules__ = {
128647
128758
  return 'npx playwright install msedge';
128648
128759
  }
128649
128760
  })();
128650
- this.printEnhancedPuppeteerInstallHint(compilation, guidance, 'edge');
128651
- printedGuidance = true;
128652
- browserBinaryLocation = null;
128653
- if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Chromium launch failed');
128654
- process.exit(1);
128761
+ const fallback = resolveWslWindowsBinary(browser);
128762
+ if (fallback) browserBinaryLocation = fallback;
128763
+ else {
128764
+ this.printEnhancedPuppeteerInstallHint(compilation, guidance, 'edge');
128765
+ printedGuidance = true;
128766
+ browserBinaryLocation = null;
128767
+ }
128768
+ if (!browserBinaryLocation) if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Chromium launch failed');
128769
+ else process.exit(1);
128655
128770
  }
128656
128771
  break;
128657
128772
  case 'chromium-based':
128658
128773
  browserBinaryLocation = this.options?.chromiumBinary || null;
128659
128774
  if (this.options?.chromiumBinary) {
128660
- if (!external_fs_.existsSync(String(this.options.chromiumBinary))) {
128775
+ const normalized = normalizePath(String(this.options.chromiumBinary));
128776
+ if (!normalized || !external_fs_.existsSync(normalized)) {
128661
128777
  console.error(messages.Spm(String(this.options.chromiumBinary)));
128662
128778
  process.exit(1);
128663
128779
  }
128780
+ browserBinaryLocation = normalized;
128664
128781
  } else {
128665
128782
  console.error(messages.nek());
128666
128783
  process.exit(1);
128667
128784
  }
128668
128785
  if (!browserBinaryLocation && !skipDetection) try {
128669
128786
  const p = external_chromium_location_default()();
128670
- if (p && 'string' == typeof p && external_fs_.existsSync(p)) browserBinaryLocation = p;
128787
+ const normalized = normalizePath(p || null);
128788
+ if (normalized && 'string' == typeof normalized) {
128789
+ if (external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
128790
+ }
128671
128791
  } catch {}
128792
+ if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
128672
128793
  break;
128673
128794
  default:
128674
128795
  try {
@@ -128676,25 +128797,28 @@ var __webpack_modules__ = {
128676
128797
  const located = (0, external_chrome_location2_.locateChromeOrExplain)({
128677
128798
  allowFallback: true
128678
128799
  });
128679
- if (located && external_fs_.existsSync(located)) {
128680
- const versionLine = getBrowserVersionLine(located);
128681
- if (looksOfficialChrome(versionLine)) {
128800
+ const normalized = normalizePath(located || null);
128801
+ if (normalized && external_fs_.existsSync(normalized)) {
128802
+ const versionLine = getBrowserVersionLine(normalized);
128803
+ if (looksOfficialChrome(versionLine) && !isWslEnv()) {
128682
128804
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
128683
128805
  printedGuidance = true;
128684
128806
  browserBinaryLocation = null;
128685
- } else browserBinaryLocation = located;
128807
+ } else browserBinaryLocation = normalized;
128686
128808
  } else browserBinaryLocation = null;
128687
128809
  } catch (err) {
128688
128810
  let candidate = external_chrome_location2_default()(true) || null;
128689
- if (candidate) {
128690
- const versionLine = getBrowserVersionLine(candidate);
128691
- if (looksOfficialChrome(versionLine)) {
128811
+ const normalized = normalizePath(candidate || null);
128812
+ if (normalized) {
128813
+ const versionLine = getBrowserVersionLine(normalized);
128814
+ if (looksOfficialChrome(versionLine) && !isWslEnv()) {
128692
128815
  this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
128693
128816
  printedGuidance = true;
128694
128817
  candidate = null;
128695
128818
  }
128696
128819
  }
128697
- browserBinaryLocation = candidate;
128820
+ browserBinaryLocation = normalized;
128821
+ if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
128698
128822
  if (!browserBinaryLocation) throw err;
128699
128823
  }
128700
128824
  } catch (e) {
@@ -128707,8 +128831,10 @@ var __webpack_modules__ = {
128707
128831
  if (!browserBinaryLocation || !external_fs_.existsSync(browserBinaryLocation)) {
128708
128832
  try {
128709
128833
  const resolved = output_binaries_resolver.kI(compilation, 'chromium' === browser || 'chromium-based' === browser ? 'chromium' : 'edge' === browser ? 'edge' : 'chrome');
128710
- if (resolved && external_fs_.existsSync(resolved)) browserBinaryLocation = resolved;
128834
+ const normalized = normalizePath(resolved || null);
128835
+ if (normalized && external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
128711
128836
  } catch {}
128837
+ if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
128712
128838
  if (!browserBinaryLocation || !external_fs_.existsSync(browserBinaryLocation)) {
128713
128839
  if ('chromium' === browser || 'chromium-based' === browser) {
128714
128840
  const chromiumGuidance = (()=>{
@@ -128827,13 +128953,14 @@ var __webpack_modules__ = {
128827
128953
  ...chromeFlags
128828
128954
  ];
128829
128955
  const stdio = 'ignore';
128956
+ const normalizedBinary = normalizeBinaryPathForWsl(binary);
128830
128957
  try {
128831
- const child = (0, external_child_process_.spawn)(`${binary}`, launchArgs, {
128958
+ const child = await spawnChromiumProcess({
128959
+ binary: normalizedBinary,
128960
+ launchArgs,
128832
128961
  stdio,
128833
- detached: false,
128834
- ...'win32' !== process.platform && {
128835
- group: process.getgid?.()
128836
- }
128962
+ browser: this.options.browser,
128963
+ logger: this.logger
128837
128964
  });
128838
128965
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.logger.debug?.('[plugin-browsers] Final Chrome flags:', launchArgs.join(' '));
128839
128966
  child.on('close', (code)=>{
@@ -128931,13 +129058,13 @@ var __webpack_modules__ = {
128931
129058
  c: ()=>FirefoxLaunchPlugin
128932
129059
  });
128933
129060
  var external_fs_ = __webpack_require__("fs");
128934
- var external_child_process_ = __webpack_require__("child_process");
128935
129061
  var external_firefox_location2_ = __webpack_require__("firefox-location2");
128936
129062
  var external_firefox_location2_default = /*#__PURE__*/ __webpack_require__.n(external_firefox_location2_);
128937
129063
  var messages = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
128938
129064
  var output_binaries_resolver = __webpack_require__("./webpack/plugin-browsers/browsers-lib/output-binaries-resolver.ts");
128939
129065
  var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
128940
129066
  var instance_registry = __webpack_require__("./webpack/plugin-browsers/browsers-lib/instance-registry.ts");
129067
+ var external_child_process_ = __webpack_require__("child_process");
128941
129068
  function setupFirefoxProcessHandlers(browser, childRef, cleanupInstance) {
128942
129069
  let isCleaningUp = false;
128943
129070
  const attemptCleanup = async ()=>{
@@ -129717,6 +129844,64 @@ var __webpack_modules__ = {
129717
129844
  }
129718
129845
  }
129719
129846
  }
129847
+ function isWslEnv() {
129848
+ return Boolean(String(process.env.WSL_DISTRO_NAME || '').trim() || String(process.env.WSL_INTEROP || '').trim() || String(process.env.WSLENV || '').trim());
129849
+ }
129850
+ function normalizeBinaryPathForWsl(input) {
129851
+ let value = String(input || '').trim();
129852
+ if (!value) return value;
129853
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
129854
+ if (!isWslEnv()) return value;
129855
+ if (/^[a-zA-Z]:[\\/]/.test(value)) {
129856
+ const drive = value[0].toLowerCase();
129857
+ const rest = value.slice(2).replace(/\\/g, '/').replace(/^\/+/, '');
129858
+ return `/mnt/${drive}/${rest}`;
129859
+ }
129860
+ return value;
129861
+ }
129862
+ function resolveWslWindowsBinary() {
129863
+ if (!isWslEnv()) return null;
129864
+ const candidates = [
129865
+ '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',
129866
+ '/mnt/c/Program Files (x86)/Mozilla Firefox/firefox.exe'
129867
+ ];
129868
+ for (const candidate of candidates)if (external_fs_.existsSync(candidate)) return candidate;
129869
+ return null;
129870
+ }
129871
+ async function spawnFirefoxProcess(opts) {
129872
+ const { binary, args, stdio, fallbackBinary, logger } = opts;
129873
+ const spawnOnce = async (bin)=>{
129874
+ const child = (0, external_child_process_.spawn)(bin, args, {
129875
+ stdio,
129876
+ detached: false,
129877
+ ...'win32' === process.platform ? {
129878
+ windowsHide: true
129879
+ } : {}
129880
+ });
129881
+ await new Promise((resolve, reject)=>{
129882
+ const handleError = (error)=>{
129883
+ child.removeListener('spawn', handleSpawn);
129884
+ reject(error);
129885
+ };
129886
+ const handleSpawn = ()=>{
129887
+ child.removeListener('error', handleError);
129888
+ resolve();
129889
+ };
129890
+ child.once('error', handleError);
129891
+ child.once('spawn', handleSpawn);
129892
+ });
129893
+ return child;
129894
+ };
129895
+ try {
129896
+ return await spawnOnce(binary);
129897
+ } catch (error) {
129898
+ if (isWslEnv() && fallbackBinary && fallbackBinary !== binary) {
129899
+ logger?.warn?.('[plugin-browsers] WSL detected: retrying with Windows Firefox binary.');
129900
+ return await spawnOnce(fallbackBinary);
129901
+ }
129902
+ throw error;
129903
+ }
129904
+ }
129720
129905
  function firefox_launch_define_property(obj, key, value) {
129721
129906
  if (key in obj) Object.defineProperty(obj, key, {
129722
129907
  value: value,
@@ -129779,42 +129964,65 @@ var __webpack_modules__ = {
129779
129964
  return;
129780
129965
  }
129781
129966
  let browserBinaryLocation = (0, output_binaries_resolver.kI)(compilation, 'firefox') || null;
129782
- const skipDetection = Boolean(browserBinaryLocation);
129967
+ if (browserBinaryLocation) {
129968
+ const normalized = normalizeBinaryPathForWsl(browserBinaryLocation);
129969
+ browserBinaryLocation = normalized && external_fs_.existsSync(normalized) ? normalized : null;
129970
+ }
129971
+ let skipDetection = Boolean(browserBinaryLocation);
129783
129972
  const engineBased = 'gecko-based' === this.host.browser || 'firefox-based' === this.host.browser;
129784
- try {
129785
- if (this.host.geckoBinary && 'string' == typeof this.host.geckoBinary) if (external_fs_.existsSync(this.host.geckoBinary)) browserBinaryLocation = this.host.geckoBinary;
129786
- else {
129787
- console.error(messages.DhR(this.host.geckoBinary));
129788
- process.exit(1);
129973
+ if (!browserBinaryLocation && !engineBased && isWslEnv()) {
129974
+ const wslFallback = resolveWslWindowsBinary();
129975
+ if (wslFallback) {
129976
+ browserBinaryLocation = wslFallback;
129977
+ skipDetection = true;
129789
129978
  }
129790
- else if (!skipDetection) if (engineBased) {
129979
+ }
129980
+ try {
129981
+ if (this.host.geckoBinary && 'string' == typeof this.host.geckoBinary) {
129982
+ const normalized = normalizeBinaryPathForWsl(this.host.geckoBinary);
129983
+ if (normalized && external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
129984
+ else {
129985
+ console.error(messages.DhR(this.host.geckoBinary));
129986
+ process.exit(1);
129987
+ }
129988
+ } else if (!skipDetection) if (engineBased) {
129791
129989
  console.error(messages.jk4());
129792
129990
  process.exit(1);
129793
- } else browserBinaryLocation = external_firefox_location2_default()(true);
129991
+ } else {
129992
+ const located = external_firefox_location2_default()(true);
129993
+ const normalized = located ? normalizeBinaryPathForWsl(located) : null;
129994
+ if (normalized && external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
129995
+ }
129794
129996
  } catch (_error) {
129795
129997
  console.error(this.host.geckoBinary ? messages.DhR(this.host.geckoBinary) : messages.jk4());
129796
129998
  process.exit(1);
129797
129999
  }
129798
130000
  if (!browserBinaryLocation || !browserBinaryLocation.trim() || !external_fs_.existsSync(browserBinaryLocation)) {
129799
130001
  const fallback = (0, output_binaries_resolver.kI)(compilation, 'firefox');
129800
- if (fallback && external_fs_.existsSync(fallback)) browserBinaryLocation = fallback;
130002
+ const normalizedFallback = fallback ? normalizeBinaryPathForWsl(fallback) : null;
130003
+ if (normalizedFallback && external_fs_.existsSync(normalizedFallback)) browserBinaryLocation = normalizedFallback;
129801
130004
  else if (engineBased || this.host.geckoBinary) {
129802
130005
  console.error(this.host.geckoBinary ? messages.DhR(this.host.geckoBinary) : messages.jk4());
129803
130006
  process.exit(1);
129804
130007
  } else {
129805
- const guidance = (()=>{
129806
- try {
129807
- return (0, external_firefox_location2_.getInstallGuidance)();
129808
- } catch {
129809
- return 'npx @puppeteer/browsers install firefox';
129810
- }
129811
- })();
129812
- this.printInstallHint(compilation, guidance);
129813
- if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Firefox not installed or binary path not found');
129814
- process.exit(1);
130008
+ const wslFallback = resolveWslWindowsBinary();
130009
+ if (wslFallback) browserBinaryLocation = wslFallback;
130010
+ else {
130011
+ const guidance = (()=>{
130012
+ try {
130013
+ return (0, external_firefox_location2_.getInstallGuidance)();
130014
+ } catch {
130015
+ return 'npx @puppeteer/browsers install firefox';
130016
+ }
130017
+ })();
130018
+ this.printInstallHint(compilation, guidance);
130019
+ if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Firefox not installed or binary path not found');
130020
+ process.exit(1);
130021
+ }
129815
130022
  }
129816
130023
  }
129817
130024
  const binaryPath = browserBinaryLocation;
130025
+ const wslFallbackBinary = isWslEnv() && !engineBased ? resolveWslWindowsBinary() : null;
129818
130026
  try {
129819
130027
  this.host.browserVersionLine = (0, external_firefox_location2_.getFirefoxVersion)(binaryPath, {
129820
130028
  allowExec: true
@@ -129864,12 +130072,12 @@ var __webpack_modules__ = {
129864
130072
  'pipe',
129865
130073
  'pipe'
129866
130074
  ];
129867
- this.child = (0, external_child_process_.spawn)(binary, args, {
130075
+ this.child = await spawnFirefoxProcess({
130076
+ binary,
130077
+ args,
129868
130078
  stdio,
129869
- detached: false,
129870
- ...isWin ? {
129871
- windowsHide: true
129872
- } : {}
130079
+ fallbackBinary: wslFallbackBinary,
130080
+ logger: this.ctx.logger
129873
130081
  });
129874
130082
  this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
129875
130083
  const ctrl = await setupRdpAfterLaunch({
@@ -129902,12 +130110,12 @@ var __webpack_modules__ = {
129902
130110
  'pipe',
129903
130111
  'pipe'
129904
130112
  ];
129905
- this.child = (0, external_child_process_.spawn)(binaryPath, args, {
130113
+ this.child = await spawnFirefoxProcess({
130114
+ binary: binaryPath,
130115
+ args,
129906
130116
  stdio,
129907
- detached: false,
129908
- ...isWin ? {
129909
- windowsHide: true
129910
- } : {}
130117
+ fallbackBinary: wslFallbackBinary,
130118
+ logger: this.ctx.logger
129911
130119
  });
129912
130120
  this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
129913
130121
  }
@@ -130596,6 +130804,7 @@ var __webpack_modules__ = {
130596
130804
  "use strict";
130597
130805
  __webpack_require__.d(__webpack_exports__, {
130598
130806
  Dy: ()=>installOptionalDependenciesBatch,
130807
+ He: ()=>resolveDevelopInstallRoot,
130599
130808
  tm: ()=>installOptionalDependencies,
130600
130809
  ws: ()=>hasDependency
130601
130810
  });
@@ -130653,8 +130862,26 @@ var __webpack_modules__ = {
130653
130862
  }
130654
130863
  async function resolvePackageManager() {
130655
130864
  const envPm = getPackageManagerFromEnv();
130656
- if (envPm) return envPm;
130657
- return 'npm';
130865
+ if (envPm && commandExists(envPm)) return envPm;
130866
+ const candidates = [
130867
+ 'pnpm',
130868
+ 'yarn',
130869
+ 'npm'
130870
+ ];
130871
+ for (const candidate of candidates)if (commandExists(candidate)) return candidate;
130872
+ throw new Error(_messages__rspack_import_3.Vo('Optional'));
130873
+ }
130874
+ function commandExists(command) {
130875
+ try {
130876
+ const result = (0, child_process__rspack_import_2.spawnSync)(command, [
130877
+ '-v'
130878
+ ], {
130879
+ stdio: 'ignore'
130880
+ });
130881
+ return 0 === result.status;
130882
+ } catch {
130883
+ return false;
130884
+ }
130658
130885
  }
130659
130886
  function resolveDevelopInstallRoot() {
130660
130887
  const directRoot = (0, _webpack_lib_check_build_dependencies__rspack_import_4.w1)();
@@ -130778,9 +131005,11 @@ var __webpack_modules__ = {
130778
131005
  });
130779
131006
  console.log(_messages__rspack_import_3.ys(integration));
130780
131007
  }
131008
+ return true;
130781
131009
  } catch (error) {
130782
131010
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
130783
131011
  console.error(_messages__rspack_import_3.DX(integration, error, isAuthor));
131012
+ return false;
130784
131013
  }
130785
131014
  }
130786
131015
  async function installOptionalDependenciesBatch(integration, dependencies, integrations) {
@@ -130806,9 +131035,11 @@ var __webpack_modules__ = {
130806
131035
  });
130807
131036
  console.log(_messages__rspack_import_3.ys(integration));
130808
131037
  }
131038
+ return true;
130809
131039
  } catch (error) {
130810
131040
  const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
130811
131041
  console.error(_messages__rspack_import_3.DX(integration, error, isAuthor));
131042
+ return false;
130812
131043
  }
130813
131044
  }
130814
131045
  function hasDependency(projectPath, dependency) {
@@ -130861,6 +131092,7 @@ var __webpack_modules__ = {
130861
131092
  DX: ()=>optionalInstallFailed,
130862
131093
  Jv: ()=>youAreAllSet,
130863
131094
  Se: ()=>missingSassDependency,
131095
+ Vo: ()=>optionalInstallManagerMissing,
130864
131096
  _j: ()=>optionalToolingSetup,
130865
131097
  cr: ()=>optionalToolingRootInstall,
130866
131098
  eG: ()=>optionalInstallRootMissing,
@@ -130908,6 +131140,14 @@ var __webpack_modules__ = {
130908
131140
  'Reinstall Extension.js or run the command from a valid Extension.js installation.'
130909
131141
  ].join('\n');
130910
131142
  }
131143
+ function optionalInstallManagerMissing(integration) {
131144
+ const prefix = pintor__rspack_import_0_default().red('ERROR');
131145
+ return [
131146
+ `${prefix} [${integration}] No supported package manager found in PATH.`,
131147
+ 'Install pnpm, npm, or yarn and retry.',
131148
+ 'If you use pnpm, ensure it is available in your environment (e.g. corepack or PATH).'
131149
+ ].join('\n');
131150
+ }
130911
131151
  function missingSassDependency() {
130912
131152
  const prefix = pintor__rspack_import_0_default().red('►►►');
130913
131153
  return [
@@ -130959,7 +131199,8 @@ var __webpack_modules__ = {
130959
131199
  'less',
130960
131200
  'less-loader'
130961
131201
  ];
130962
- await (0, _css_lib_integrations__rspack_import_3.tm)('LESS', lessDependencies);
131202
+ const didInstall = await (0, _css_lib_integrations__rspack_import_3.tm)('LESS', lessDependencies);
131203
+ if (!didInstall) throw new Error('[LESS] Optional dependencies failed to install.');
130963
131204
  console.log(_css_lib_messages__rspack_import_2.Jv('LESS'));
130964
131205
  process.exit(0);
130965
131206
  }
@@ -131084,7 +131325,8 @@ var __webpack_modules__ = {
131084
131325
  'postcss',
131085
131326
  'postcss-loader'
131086
131327
  ];
131087
- await (0, _css_lib_integrations__rspack_import_5.tm)('PostCSS', postCssDependencies);
131328
+ const didInstall = await (0, _css_lib_integrations__rspack_import_5.tm)('PostCSS', postCssDependencies);
131329
+ if (!didInstall) throw new Error('[PostCSS] Optional dependencies failed to install.');
131088
131330
  }
131089
131331
  console.log(_css_lib_messages__rspack_import_4.Jv('PostCSS'));
131090
131332
  process.exit(0);
@@ -131207,11 +131449,13 @@ var __webpack_modules__ = {
131207
131449
  'postcss-scss',
131208
131450
  'postcss-preset-env'
131209
131451
  ];
131210
- await (0, _css_lib_integrations__rspack_import_4.tm)('PostCSS', postCssDependencies);
131452
+ const didInstallPostCss = await (0, _css_lib_integrations__rspack_import_4.tm)('PostCSS', postCssDependencies);
131453
+ if (!didInstallPostCss) throw new Error('[PostCSS] Optional dependencies failed to install.');
131211
131454
  const sassDependencies = [
131212
131455
  'sass-loader'
131213
131456
  ];
131214
- await (0, _css_lib_integrations__rspack_import_4.tm)('SASS', sassDependencies);
131457
+ const didInstallSass = await (0, _css_lib_integrations__rspack_import_4.tm)('SASS', sassDependencies);
131458
+ if (!didInstallSass) throw new Error('[SASS] Optional dependencies failed to install.');
131215
131459
  console.log(_css_lib_messages__rspack_import_3.Jv('SASS'));
131216
131460
  process.exit(0);
131217
131461
  }
@@ -131420,7 +131664,8 @@ var __webpack_modules__ = {
131420
131664
  '@rspack/plugin-preact-refresh',
131421
131665
  'preact'
131422
131666
  ];
131423
- await (0, _frameworks_lib_integrations__rspack_import_2.tm)('Preact', preactDependencies);
131667
+ const didInstall = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('Preact', preactDependencies);
131668
+ if (!didInstall) throw new Error('[Preact] Optional dependencies failed to install.');
131424
131669
  console.log(_js_frameworks_lib_messages__rspack_import_1.Jv('Preact'));
131425
131670
  process.exit(0);
131426
131671
  }
@@ -131483,7 +131728,8 @@ var __webpack_modules__ = {
131483
131728
  'react-refresh',
131484
131729
  '@rspack/plugin-react-refresh'
131485
131730
  ];
131486
- await (0, _frameworks_lib_integrations__rspack_import_4.tm)('React', reactDependencies);
131731
+ const didInstall = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('React', reactDependencies);
131732
+ if (!didInstall) throw new Error('[React] Optional dependencies failed to install.');
131487
131733
  console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('React'));
131488
131734
  process.exit(0);
131489
131735
  }
@@ -131562,11 +131808,13 @@ var __webpack_modules__ = {
131562
131808
  const typeScriptDependencies = [
131563
131809
  "typescript"
131564
131810
  ];
131565
- await (0, _frameworks_lib_integrations__rspack_import_2.tm)('TypeScript', typeScriptDependencies);
131811
+ const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('TypeScript', typeScriptDependencies);
131812
+ if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
131566
131813
  const svelteDependencies = [
131567
131814
  'svelte-loader'
131568
131815
  ];
131569
- await (0, _frameworks_lib_integrations__rspack_import_2.tm)('Svelte', svelteDependencies);
131816
+ const didInstallSvelte = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('Svelte', svelteDependencies);
131817
+ if (!didInstallSvelte) throw new Error('[Svelte] Optional dependencies failed to install.');
131570
131818
  console.log(_js_frameworks_lib_messages__rspack_import_1.Jv('Svelte'));
131571
131819
  process.exit(0);
131572
131820
  }
@@ -131581,7 +131829,8 @@ var __webpack_modules__ = {
131581
131829
  const typeScriptDependencies = [
131582
131830
  "typescript"
131583
131831
  ];
131584
- await (0, _frameworks_lib_integrations__rspack_import_2.tm)('TypeScript', typeScriptDependencies);
131832
+ const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_2.tm)('TypeScript', typeScriptDependencies);
131833
+ if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
131585
131834
  console.log(_js_frameworks_lib_messages__rspack_import_1.Jv('TypeScript'));
131586
131835
  process.exit(0);
131587
131836
  }
@@ -131823,7 +132072,8 @@ var __webpack_modules__ = {
131823
132072
  'vue-loader',
131824
132073
  '@vue/compiler-sfc'
131825
132074
  ];
131826
- await (0, _frameworks_lib_integrations__rspack_import_3.tm)('Vue', vueDependencies);
132075
+ const didInstall = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('Vue', vueDependencies);
132076
+ if (!didInstall) throw new Error('[Vue] Optional dependencies failed to install.');
131827
132077
  console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('Vue'));
131828
132078
  process.exit(0);
131829
132079
  }
@@ -132801,7 +133051,7 @@ var __webpack_modules__ = {
132801
133051
  },
132802
133052
  "./package.json" (module) {
132803
133053
  "use strict";
132804
- module.exports = JSON.parse('{"rE":"3.3.2","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"}}');
133054
+ module.exports = JSON.parse('{"rE":"3.3.3-mext.0","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"}}');
132805
133055
  }
132806
133056
  };
132807
133057
  var __webpack_module_cache__ = {};
@@ -133252,6 +133502,7 @@ var __webpack_exports__ = {};
133252
133502
  installedUser: needsUserInstall
133253
133503
  };
133254
133504
  }
133505
+ var integrations = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
133255
133506
  var external_pintor_ = __webpack_require__("pintor");
133256
133507
  var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
133257
133508
  var external_crypto_ = __webpack_require__("crypto");
@@ -133313,7 +133564,7 @@ var __webpack_exports__ = {};
133313
133564
  }
133314
133565
  }
133315
133566
  function getPreflightMarkerPath(projectPath) {
133316
- const packageRoot = (0, check_build_dependencies.w1)();
133567
+ const packageRoot = (0, integrations.He)();
133317
133568
  if (!packageRoot) return;
133318
133569
  const cacheDir = getPreflightCacheDir(packageRoot);
133319
133570
  return external_path_.join(cacheDir, `${getProjectKey(projectPath)}.json`);
@@ -133368,13 +133619,13 @@ var __webpack_exports__ = {};
133368
133619
  var vue = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/vue.ts");
133369
133620
  var svelte = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/svelte.ts");
133370
133621
  var typescript = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/typescript.ts");
133371
- var integrations = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
133622
+ var frameworks_lib_integrations = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
133372
133623
  var sass = __webpack_require__("./webpack/plugin-css/css-tools/sass.ts");
133373
133624
  var less = __webpack_require__("./webpack/plugin-css/css-tools/less.ts");
133374
133625
  var postcss = __webpack_require__("./webpack/plugin-css/css-tools/postcss.ts");
133375
133626
  var js_frameworks_lib_messages = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
133376
133627
  function getResolutionPaths(projectPath) {
133377
- const extensionRoot = (0, check_build_dependencies.w1)();
133628
+ const extensionRoot = (0, integrations.He)();
133378
133629
  const paths = [
133379
133630
  projectPath || void 0,
133380
133631
  extensionRoot || void 0,
@@ -133473,9 +133724,13 @@ var __webpack_exports__ = {};
133473
133724
  }
133474
133725
  if (missingOptionalDeps.size > 0) {
133475
133726
  const uniqueIntegrations = Array.from(new Set(usedIntegrations));
133476
- await (0, integrations.Dy)('Optional', Array.from(missingOptionalDeps), uniqueIntegrations);
133727
+ const didInstall = await (0, frameworks_lib_integrations.Dy)('Optional', Array.from(missingOptionalDeps), uniqueIntegrations);
133728
+ if (!didInstall) throw new Error('[Optional] Optional dependencies failed to install.');
133477
133729
  if (opts?.showRunAgainMessage !== false && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.log(js_frameworks_lib_messages.Q2(uniqueIntegrations));
133478
- if (opts?.exitOnInstall !== false) process.exit(0);
133730
+ if (opts?.exitOnInstall !== false) {
133731
+ writePreflightMarker(projectPath);
133732
+ process.exit(0);
133733
+ }
133479
133734
  }
133480
133735
  writePreflightMarker(projectPath);
133481
133736
  }
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "name": "extension-develop",
25
- "version": "3.3.2",
25
+ "version": "3.3.3-mext.0",
26
26
  "description": "Develop, build, preview, and package Extension.js projects.",
27
27
  "author": {
28
28
  "name": "Cezar Augusto",