extension-develop 3.7.0 → 3.8.1-canary.186.23220b7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.cjs CHANGED
@@ -127339,8 +127339,7 @@ var __webpack_modules__ = {
127339
127339
  });
127340
127340
  var path__rspack_import_0 = __webpack_require__("path");
127341
127341
  var path__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(path__rspack_import_0);
127342
- var fs__rspack_import_1 = __webpack_require__("fs");
127343
- var browser_extension_manifest_fields__rspack_import_2 = __webpack_require__("browser-extension-manifest-fields");
127342
+ var browser_extension_manifest_fields__rspack_import_1 = __webpack_require__("browser-extension-manifest-fields");
127344
127343
  function isUnderPublicDir(entry, projectRoot, publicDir) {
127345
127344
  if (!entry) return false;
127346
127345
  const normalizedEntry = String(entry);
@@ -127366,14 +127365,14 @@ var __webpack_modules__ = {
127366
127365
  function getSpecialFoldersDataForCompiler(compiler) {
127367
127366
  const projectRoot = compiler.options.context || '';
127368
127367
  const publicDir = path__rspack_import_0_default().join(projectRoot, 'public');
127369
- const data = (0, browser_extension_manifest_fields__rspack_import_2.getSpecialFoldersData)({
127368
+ const data = (0, browser_extension_manifest_fields__rspack_import_1.getSpecialFoldersData)({
127370
127369
  manifestPath: path__rspack_import_0_default().join(projectRoot, 'package.json')
127371
127370
  });
127372
127371
  return finalizeSpecialFoldersData(data, projectRoot, publicDir);
127373
127372
  }
127374
127373
  function getSpecialFoldersDataForProjectRoot(projectRoot) {
127375
127374
  const publicDir = path__rspack_import_0_default().join(projectRoot, 'public');
127376
- const data = (0, browser_extension_manifest_fields__rspack_import_2.getSpecialFoldersData)({
127375
+ const data = (0, browser_extension_manifest_fields__rspack_import_1.getSpecialFoldersData)({
127377
127376
  manifestPath: path__rspack_import_0_default().join(projectRoot, 'package.json')
127378
127377
  });
127379
127378
  return finalizeSpecialFoldersData(data, projectRoot, publicDir);
@@ -127383,40 +127382,22 @@ var __webpack_modules__ = {
127383
127382
  ...data,
127384
127383
  pages: filterPublicEntrypoints(data.pages, projectRoot, publicDir),
127385
127384
  scripts: filterPublicEntrypoints(data.scripts, projectRoot, publicDir),
127386
- extensions: getLocalExtensionsConfig(projectRoot)
127385
+ extensions: void 0
127387
127386
  };
127388
127387
  }
127389
- function getLocalExtensionsConfig(projectRoot) {
127390
- if (!projectRoot) return;
127391
- const extensionsDir = path__rspack_import_0_default().join(projectRoot, 'extensions');
127392
- try {
127393
- if (fs__rspack_import_1.existsSync(extensionsDir) && fs__rspack_import_1.statSync(extensionsDir).isDirectory()) return {
127394
- dir: './extensions'
127395
- };
127396
- } catch {}
127397
- }
127398
127388
  },
127399
127389
  "./webpack/plugin-browsers/browsers-lib/banner.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
127400
127390
  "use strict";
127401
127391
  __webpack_require__.d(__webpack_exports__, {
127402
- a: ()=>printDevBannerOnce,
127403
- M: ()=>printProdBannerOnce
127392
+ M: ()=>printProdBannerOnce,
127393
+ a: ()=>printDevBannerOnce
127404
127394
  });
127405
- var external_fs_ = __webpack_require__("fs");
127406
- var external_path_ = __webpack_require__("path");
127407
- var messages = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
127408
- var webpack_lib_messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
127409
- const sharedState = {
127410
- bannerPrinted: false,
127411
- pendingCompilationLine: ''
127412
- };
127413
- function markBannerPrinted() {
127414
- sharedState.bannerPrinted = true;
127415
- if (sharedState.pendingCompilationLine) {
127416
- console.log(sharedState.pendingCompilationLine);
127417
- sharedState.pendingCompilationLine = '';
127418
- }
127419
- }
127395
+ var fs__rspack_import_0 = __webpack_require__("fs");
127396
+ var path__rspack_import_1 = __webpack_require__("path");
127397
+ var crypto__rspack_import_2 = __webpack_require__("crypto");
127398
+ var _messages__rspack_import_3 = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
127399
+ var _webpack_lib_messages__rspack_import_4 = __webpack_require__("./webpack/webpack-lib/messages.ts");
127400
+ var _plugin_compilation_compilation_lib_shared_state__rspack_import_5 = __webpack_require__("./webpack/plugin-compilation/compilation-lib/shared-state.ts");
127420
127401
  const printedKeys = new Set();
127421
127402
  function readUpdateSuffixOnce() {
127422
127403
  const suffix = process.env.EXTENSION_CLI_UPDATE_SUFFIX;
@@ -127427,17 +127408,67 @@ var __webpack_modules__ = {
127427
127408
  function keyFor(browser, outPath, hp) {
127428
127409
  const host = (hp?.host || '127.0.0.1').toString();
127429
127410
  const port = hp?.port == null ? '' : String(hp.port);
127430
- return `${browser}::${external_path_.resolve(outPath)}::${host}:${port}`;
127411
+ return `${browser}::${path__rspack_import_1.resolve(outPath)}::${host}:${port}`;
127412
+ }
127413
+ function toNormalizedId(value) {
127414
+ if ('string' != typeof value) return '';
127415
+ return value.trim();
127416
+ }
127417
+ function deriveChromiumExtensionIdFromManifest(manifest) {
127418
+ const key = toNormalizedId(manifest?.key);
127419
+ if (!key) return '';
127420
+ try {
127421
+ const decodedKey = Buffer.from(key.replace(/\s+/g, ''), 'base64');
127422
+ if (!decodedKey.length) return '';
127423
+ const digest = (0, crypto__rspack_import_2.createHash)('sha256').update(decodedKey).digest().subarray(0, 16);
127424
+ let extensionId = '';
127425
+ for (const byte of digest){
127426
+ extensionId += String.fromCharCode(97 + (byte >> 4 & 0x0f));
127427
+ extensionId += String.fromCharCode(97 + (0x0f & byte));
127428
+ }
127429
+ return extensionId;
127430
+ } catch {
127431
+ return '';
127432
+ }
127433
+ }
127434
+ function deriveFirefoxExtensionIdFromManifest(manifest) {
127435
+ const fromBrowserSpecificSettings = toNormalizedId(manifest?.browser_specific_settings?.gecko?.id);
127436
+ if (fromBrowserSpecificSettings) return fromBrowserSpecificSettings;
127437
+ return toNormalizedId(manifest?.applications?.gecko?.id);
127438
+ }
127439
+ function resolveExtensionId(args) {
127440
+ const fromInfo = toNormalizedId(args.info?.extensionId);
127441
+ if (fromInfo) return fromInfo;
127442
+ const fromFallback = toNormalizedId(args.fallback?.extensionId);
127443
+ if (fromFallback) return fromFallback;
127444
+ if ('chrome' === args.browser || 'edge' === args.browser || 'chromium' === args.browser || 'chromium-based' === args.browser) return deriveChromiumExtensionIdFromManifest(args.manifest);
127445
+ if ('firefox' === args.browser || 'firefox-based' === args.browser) return deriveFirefoxExtensionIdFromManifest(args.manifest);
127446
+ return '';
127431
127447
  }
127432
127448
  async function printDevBannerOnce(opts) {
127433
127449
  const k = keyFor(opts.browser, opts.outPath, opts.hostPort);
127434
127450
  if (printedKeys.has(k)) return false;
127435
- const info = await opts.getInfo() || null;
127436
- const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
127451
+ const manifestPath = path__rspack_import_1.join(opts.outPath, 'manifest.json');
127437
127452
  const updateSuffix = readUpdateSuffixOnce();
127438
- if (!external_fs_.existsSync(manifestPath)) return false;
127439
- const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
127440
- const extensionId = info?.extensionId || opts.fallback?.extensionId || '(temporary)';
127453
+ if (!fs__rspack_import_0.existsSync(manifestPath)) return false;
127454
+ const manifest = JSON.parse(fs__rspack_import_0.readFileSync(manifestPath, 'utf-8'));
127455
+ const manifestDerivedExtensionId = resolveExtensionId({
127456
+ browser: opts.browser,
127457
+ info: null,
127458
+ fallback: opts.fallback,
127459
+ manifest
127460
+ });
127461
+ const info = manifestDerivedExtensionId ? await Promise.race([
127462
+ opts.getInfo().catch(()=>null),
127463
+ new Promise((resolve)=>setTimeout(()=>resolve(null), 250))
127464
+ ]) : await opts.getInfo().catch(()=>null);
127465
+ const extensionId = resolveExtensionId({
127466
+ browser: opts.browser,
127467
+ info,
127468
+ fallback: opts.fallback,
127469
+ manifest
127470
+ });
127471
+ if (!extensionId) return false;
127441
127472
  const name = info?.name || opts.fallback?.name || manifest.name;
127442
127473
  const version1 = info?.version || opts.fallback?.version || manifest.version;
127443
127474
  const message = {
@@ -127449,10 +127480,10 @@ var __webpack_modules__ = {
127449
127480
  }
127450
127481
  }
127451
127482
  };
127452
- console.log(messages.io8());
127453
- console.log(messages.e_P(manifest, opts.browser, message, opts.browserVersionLine, updateSuffix || void 0));
127454
- console.log(messages.io8());
127455
- markBannerPrinted();
127483
+ console.log(_messages__rspack_import_3.io8());
127484
+ console.log(_messages__rspack_import_3.e_P(manifest, opts.browser, message, opts.browserVersionLine, updateSuffix || void 0));
127485
+ console.log(_messages__rspack_import_3.io8());
127486
+ (0, _plugin_compilation_compilation_lib_shared_state__rspack_import_5.If)();
127456
127487
  process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
127457
127488
  printedKeys.add(k);
127458
127489
  return true;
@@ -127463,23 +127494,33 @@ var __webpack_modules__ = {
127463
127494
  const browserLabel = opts.browserVersionLine && opts.browserVersionLine.trim().length > 0 ? opts.browserVersionLine.trim() : String(opts.browser || 'unknown');
127464
127495
  const updateSuffix = readUpdateSuffixOnce();
127465
127496
  try {
127466
- const manifestPath = external_path_.join(opts.outPath, 'manifest.json');
127467
- const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
127468
- if (opts.runtime && opts.runtime.extensionId) {
127497
+ const manifestPath = path__rspack_import_1.join(opts.outPath, 'manifest.json');
127498
+ const manifest = JSON.parse(fs__rspack_import_0.readFileSync(manifestPath, 'utf-8'));
127499
+ const runtimeInfo = opts.runtime ? {
127500
+ extensionId: opts.runtime.extensionId,
127501
+ name: opts.runtime.name,
127502
+ version: opts.runtime.version
127503
+ } : null;
127504
+ const resolvedExtensionId = resolveExtensionId({
127505
+ browser: opts.browser,
127506
+ info: runtimeInfo,
127507
+ manifest
127508
+ });
127509
+ if (resolvedExtensionId) {
127469
127510
  const message = {
127470
127511
  data: {
127471
- id: opts.runtime.extensionId,
127512
+ id: resolvedExtensionId,
127472
127513
  management: {
127473
- name: opts.runtime.name || manifest.name,
127474
- version: opts.runtime.version || manifest.version
127514
+ name: opts.runtime?.name || manifest.name,
127515
+ version: opts.runtime?.version || manifest.version
127475
127516
  }
127476
127517
  }
127477
127518
  };
127478
- console.log(messages.io8());
127479
- console.log(messages.e_P(manifest, opts.browser, message, browserLabel, updateSuffix || void 0, {
127519
+ console.log(_messages__rspack_import_3.io8());
127520
+ console.log(_messages__rspack_import_3.e_P(manifest, opts.browser, message, browserLabel, updateSuffix || void 0, {
127480
127521
  includeExtensionId: opts.includeExtensionId
127481
127522
  }));
127482
- console.log(messages.io8());
127523
+ console.log(_messages__rspack_import_3.io8());
127483
127524
  } else {
127484
127525
  const message = {
127485
127526
  data: {
@@ -127490,18 +127531,18 @@ var __webpack_modules__ = {
127490
127531
  }
127491
127532
  }
127492
127533
  };
127493
- console.log(messages.io8());
127494
- console.log(messages.e_P(manifest, opts.browser, message, browserLabel, updateSuffix || void 0, {
127534
+ console.log(_messages__rspack_import_3.io8());
127535
+ console.log(_messages__rspack_import_3.e_P(manifest, opts.browser, message, browserLabel, updateSuffix || void 0, {
127495
127536
  includeExtensionId: opts.includeExtensionId
127496
127537
  }));
127497
- console.log(messages.io8());
127538
+ console.log(_messages__rspack_import_3.io8());
127498
127539
  }
127499
127540
  } catch {
127500
- console.log(messages.io8());
127501
- console.log(webpack_lib_messages.Al(opts.outPath, browserLabel));
127502
- console.log(messages.io8());
127541
+ console.log(_messages__rspack_import_3.io8());
127542
+ console.log(_webpack_lib_messages__rspack_import_4.Al(opts.outPath, browserLabel));
127543
+ console.log(_messages__rspack_import_3.io8());
127503
127544
  }
127504
- markBannerPrinted();
127545
+ (0, _plugin_compilation_compilation_lib_shared_state__rspack_import_5.If)();
127505
127546
  process.env.EXTENSION_CLI_BANNER_PRINTED = 'true';
127506
127547
  printedKeys.add(k);
127507
127548
  return true;
@@ -127886,24 +127927,11 @@ var __webpack_modules__ = {
127886
127927
  else if ('chrome' === browser || 'chromium' === browser || 'firefox' === browser || 'edge' === browser) browserNorm = browser;
127887
127928
  const finalCachePath = browserNorm && cacheDir ? path__rspack_import_0.join(cacheDir, browserNorm) : cacheDir;
127888
127929
  try {
127889
- if (finalCachePath && finalCachePath.trim().length > 0) {
127890
- const lines = cleaned.split(/\r?\n/);
127891
- const idx = lines.findIndex((l)=>/npx\s+@puppeteer\/browsers\s+install\s+/i.test(l));
127892
- if (-1 !== idx && !/--path\s+/i.test(lines[idx])) {
127893
- lines[idx] = `${lines[idx].trim()} --path "${finalCachePath}"`;
127894
- cleaned = lines.join('\n');
127895
- }
127896
- try {
127897
- const pwIdx = lines.findIndex((l)=>/npx\s+playwright\s+install(\s+.+)?/i.test(l));
127898
- if (-1 !== pwIdx) {
127899
- if (finalCachePath && finalCachePath.trim().length > 0) {
127900
- const cmd = lines[pwIdx].trim();
127901
- const withEnv = 'win32' === process.platform ? `set PLAYWRIGHT_BROWSERS_PATH="${finalCachePath}" && ${cmd}` : `PLAYWRIGHT_BROWSERS_PATH="${finalCachePath}" ${cmd}`;
127902
- lines[pwIdx] = withEnv;
127903
- cleaned = lines.join('\n');
127904
- }
127905
- }
127906
- } catch {}
127930
+ const lines = cleaned.split(/\r?\n/);
127931
+ const idx = lines.findIndex((l)=>/npx\s+@puppeteer\/browsers\s+install\s+|npx\s+playwright\s+install(\s+.+)?/i.test(l));
127932
+ if (-1 !== idx) {
127933
+ lines[idx] = `npx extension install ${browserNorm}`;
127934
+ cleaned = lines.join('\n');
127907
127935
  }
127908
127936
  } catch {}
127909
127937
  body.push(cleaned);
@@ -128218,7 +128246,7 @@ var __webpack_modules__ = {
128218
128246
  const displayName = String(manifestName);
128219
128247
  const displayVersion = String(version1 || manifest.version || '');
128220
128248
  lines.push(` 🧩 ${pintor__rspack_import_4_default().brightBlue('Extension.js')} ${pintor__rspack_import_4_default().gray(`${extensionVersion}`)}${updateNotice}`, ` Browser ${pintor__rspack_import_4_default().gray(browserLabel)}`, ` Extension ${pintor__rspack_import_4_default().gray(displayVersion ? `${displayName} ${displayVersion}` : displayName)}`);
128221
- if (includeExtensionId) lines.push(` Extension ID ${pintor__rspack_import_4_default().gray(cleanId)}`);
128249
+ if (includeExtensionId && cleanId) lines.push(` Extension ID ${pintor__rspack_import_4_default().gray(cleanId)}`);
128222
128250
  return lines.join('\n');
128223
128251
  }
128224
128252
  function emptyLine() {
@@ -128956,9 +128984,6 @@ var __webpack_modules__ = {
128956
128984
  ...isWin ? {
128957
128985
  windowsHide: true
128958
128986
  } : {},
128959
- ...isWin && /\s/.test(bin) ? {
128960
- shell: true
128961
- } : {},
128962
128987
  ...'win32' !== process.platform && {
128963
128988
  group: process.getgid?.()
128964
128989
  }
@@ -129103,7 +129128,7 @@ var __webpack_modules__ = {
129103
129128
  try {
129104
129129
  return (0, external_chrome_location2_.getInstallGuidance)();
129105
129130
  } catch {
129106
- return 'npx @puppeteer/browsers install chrome@stable';
129131
+ return 'npx extension install chrome';
129107
129132
  }
129108
129133
  };
129109
129134
  switch(browser){
@@ -129186,7 +129211,7 @@ var __webpack_modules__ = {
129186
129211
  try {
129187
129212
  return (0, external_edge_location_.getInstallGuidance)();
129188
129213
  } catch {
129189
- return 'npx playwright install msedge';
129214
+ return 'npx extension install edge';
129190
129215
  }
129191
129216
  })();
129192
129217
  this.printEnhancedPuppeteerInstallHint(compilation, guidance, 'edge');
@@ -129201,7 +129226,7 @@ var __webpack_modules__ = {
129201
129226
  try {
129202
129227
  return (0, external_edge_location_.getInstallGuidance)();
129203
129228
  } catch {
129204
- return 'npx playwright install msedge';
129229
+ return 'npx extension install edge';
129205
129230
  }
129206
129231
  })();
129207
129232
  const fallback = resolveWslWindowsBinary(browser);
@@ -129287,7 +129312,7 @@ var __webpack_modules__ = {
129287
129312
  try {
129288
129313
  return (0, external_chromium_location_.getInstallGuidance)();
129289
129314
  } catch {
129290
- return 'npx @puppeteer/browsers install chromium';
129315
+ return 'npx extension install chromium';
129291
129316
  }
129292
129317
  })();
129293
129318
  this.printEnhancedPuppeteerInstallHint(compilation, chromiumGuidance, 'chromium');
@@ -130147,6 +130172,9 @@ var __webpack_modules__ = {
130147
130172
  const args = [
130148
130173
  '--no-remote',
130149
130174
  '--new-instance',
130175
+ ...'win32' === process.platform ? [
130176
+ '-wait-for-browser'
130177
+ ] : [],
130150
130178
  '-profile',
130151
130179
  profilePath,
130152
130180
  ...debugPort > 0 ? [
@@ -130357,7 +130385,7 @@ var __webpack_modules__ = {
130357
130385
  try {
130358
130386
  return (0, external_firefox_location2_.getInstallGuidance)();
130359
130387
  } catch {
130360
- return 'npx @puppeteer/browsers install firefox';
130388
+ return 'npx extension install firefox';
130361
130389
  }
130362
130390
  })();
130363
130391
  this.printInstallHint(compilation, guidance);
@@ -130454,6 +130482,9 @@ var __webpack_modules__ = {
130454
130482
  '-start-debugger-server',
130455
130483
  String(debugPort)
130456
130484
  ] : [],
130485
+ ...'win32' === process.platform ? [
130486
+ '-wait-for-browser'
130487
+ ] : [],
130457
130488
  '--foreground',
130458
130489
  '--disable-background-timer-throttling',
130459
130490
  '--disable-backgrounding-occluded-windows',
@@ -130499,9 +130530,7 @@ var __webpack_modules__ = {
130499
130530
  this.watchTimeout = void 0;
130500
130531
  }
130501
130532
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.Tho(this.host.browser));
130502
- this.cleanupInstance().finally(()=>{
130503
- process.exit();
130504
- });
130533
+ this.cleanupInstance().catch(()=>{});
130505
130534
  });
130506
130535
  if ('true' === process.env.EXTENSION_AUTHOR_MODE && child) {
130507
130536
  child.stdout?.pipe(process.stdout);
@@ -130615,7 +130644,7 @@ var __webpack_modules__ = {
130615
130644
  host: '127.0.0.1'
130616
130645
  },
130617
130646
  getInfo: async ()=>({
130618
- extensionId: extensionId || '(temporary)',
130647
+ extensionId,
130619
130648
  name: manifest.name,
130620
130649
  version: manifest.version
130621
130650
  }),
@@ -131382,6 +131411,31 @@ var __webpack_modules__ = {
131382
131411
  }
131383
131412
  }
131384
131413
  },
131414
+ "./webpack/plugin-compilation/compilation-lib/shared-state.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
131415
+ "use strict";
131416
+ __webpack_require__.d(__webpack_exports__, {
131417
+ FF: ()=>setPendingCompilationLine,
131418
+ If: ()=>markBannerPrinted,
131419
+ TC: ()=>isBannerPrinted
131420
+ });
131421
+ const sharedState = {
131422
+ bannerPrinted: false,
131423
+ pendingCompilationLine: ''
131424
+ };
131425
+ function markBannerPrinted() {
131426
+ sharedState.bannerPrinted = true;
131427
+ if (sharedState.pendingCompilationLine) {
131428
+ console.log(sharedState.pendingCompilationLine);
131429
+ sharedState.pendingCompilationLine = '';
131430
+ }
131431
+ }
131432
+ function isBannerPrinted() {
131433
+ return sharedState.bannerPrinted;
131434
+ }
131435
+ function setPendingCompilationLine(line) {
131436
+ sharedState.pendingCompilationLine = line;
131437
+ }
131438
+ },
131385
131439
  "./webpack/plugin-css/css-lib/integrations.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
131386
131440
  "use strict";
131387
131441
  __webpack_require__.d(__webpack_exports__, {
@@ -131859,36 +131913,56 @@ var __webpack_modules__ = {
131859
131913
  V: ()=>maybeUseLess
131860
131914
  });
131861
131915
  var path__rspack_import_0 = __webpack_require__("path");
131862
- var pintor__rspack_import_1 = __webpack_require__("pintor");
131863
- var pintor__rspack_import_1_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_1);
131864
- var _css_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
131865
- var _css_lib_integrations__rspack_import_3 = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
131866
- var _css_lib_is_content_script__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/is-content-script.ts");
131916
+ var module__rspack_import_1 = __webpack_require__("module");
131917
+ var pintor__rspack_import_2 = __webpack_require__("pintor");
131918
+ var pintor__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_2);
131919
+ var _css_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
131920
+ var _css_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
131921
+ var _css_lib_is_content_script__rspack_import_5 = __webpack_require__("./webpack/plugin-css/css-lib/is-content-script.ts");
131867
131922
  let userMessageDelivered = false;
131868
131923
  function isUsingLess(projectPath) {
131869
- if ((0, _css_lib_integrations__rspack_import_3.ws)(projectPath, 'less')) {
131924
+ if ((0, _css_lib_integrations__rspack_import_4.ws)(projectPath, 'less')) {
131870
131925
  if (!userMessageDelivered) {
131871
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_1_default().brightMagenta('►►► Author says')} ${_css_lib_messages__rspack_import_2.zA('LESS')}`);
131926
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_2_default().brightMagenta('►►► Author says')} ${_css_lib_messages__rspack_import_3.zA('LESS')}`);
131872
131927
  userMessageDelivered = true;
131873
131928
  }
131874
131929
  return true;
131875
131930
  }
131876
131931
  return false;
131877
131932
  }
131933
+ function resolveLessLoader(projectPath) {
131934
+ const extensionRoot = (0, _css_lib_integrations__rspack_import_4.He)();
131935
+ const bases = [
131936
+ projectPath,
131937
+ extensionRoot || void 0,
131938
+ process.cwd()
131939
+ ].filter(Boolean);
131940
+ for (const base of bases)try {
131941
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
131942
+ return req.resolve('less-loader');
131943
+ } catch {}
131944
+ try {
131945
+ return require.resolve('less-loader', {
131946
+ paths: bases
131947
+ });
131948
+ } catch {
131949
+ return;
131950
+ }
131951
+ }
131878
131952
  async function maybeUseLess(projectPath, manifestPath) {
131879
131953
  const resolvedManifestPath = manifestPath || path__rspack_import_0.join(projectPath, 'manifest.json');
131880
131954
  if (!isUsingLess(projectPath)) return [];
131881
- try {
131882
- require.resolve('less-loader');
131883
- } catch (e) {
131955
+ let lessLoaderPath = resolveLessLoader(projectPath);
131956
+ if (!lessLoaderPath) {
131884
131957
  const lessDependencies = [
131885
131958
  'less',
131886
131959
  'less-loader'
131887
131960
  ];
131888
- const didInstall = await (0, _css_lib_integrations__rspack_import_3.tm)('LESS', lessDependencies);
131961
+ const didInstall = await (0, _css_lib_integrations__rspack_import_4.tm)('LESS', lessDependencies);
131889
131962
  if (!didInstall) throw new Error('[LESS] Optional dependencies failed to install.');
131890
- console.log(_css_lib_messages__rspack_import_2.Jv('LESS'));
131891
- process.exit(0);
131963
+ lessLoaderPath = resolveLessLoader(projectPath);
131964
+ if (!lessLoaderPath) throw new Error('[LESS] less-loader could not be resolved after optional dependency installation.');
131965
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_css_lib_messages__rspack_import_3.Jv('LESS'));
131892
131966
  }
131893
131967
  return [
131894
131968
  {
@@ -131896,7 +131970,7 @@ var __webpack_modules__ = {
131896
131970
  exclude: /\.module\.less$/,
131897
131971
  use: [
131898
131972
  {
131899
- loader: require.resolve('less-loader'),
131973
+ loader: lessLoaderPath,
131900
131974
  options: {
131901
131975
  sourceMap: true
131902
131976
  }
@@ -131907,7 +131981,7 @@ var __webpack_modules__ = {
131907
131981
  test: /\.module\.less$/,
131908
131982
  use: [
131909
131983
  {
131910
- loader: require.resolve('less-loader'),
131984
+ loader: lessLoaderPath,
131911
131985
  options: {
131912
131986
  sourceMap: true
131913
131987
  }
@@ -131921,7 +131995,7 @@ var __webpack_modules__ = {
131921
131995
  generator: {
131922
131996
  filename: "content_scripts/[name].[contenthash:8].css"
131923
131997
  },
131924
- issuer: (issuer)=>(0, _css_lib_is_content_script__rspack_import_4.z)(issuer, resolvedManifestPath, projectPath)
131998
+ issuer: (issuer)=>(0, _css_lib_is_content_script__rspack_import_5.z)(issuer, resolvedManifestPath, projectPath)
131925
131999
  }
131926
132000
  ];
131927
132001
  }
@@ -132112,6 +132186,33 @@ var __webpack_modules__ = {
132112
132186
  return false;
132113
132187
  }
132114
132188
  async function maybeUsePostCss(projectPath, opts) {
132189
+ const getResolutionPaths = ()=>{
132190
+ const extensionRoot = (0, _css_lib_integrations__rspack_import_5.He)();
132191
+ const paths = [
132192
+ projectPath,
132193
+ extensionRoot || void 0,
132194
+ process.cwd()
132195
+ ].filter(Boolean);
132196
+ return Array.from(new Set(paths));
132197
+ };
132198
+ const resolveWithCreateRequire = (id)=>{
132199
+ const bases = getResolutionPaths();
132200
+ for (const base of bases)try {
132201
+ const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132202
+ return req.resolve(id);
132203
+ } catch {}
132204
+ };
132205
+ const resolvePostCssLoader = ()=>{
132206
+ const fromRuntimeRequire = resolveWithCreateRequire('postcss-loader');
132207
+ if (fromRuntimeRequire) return fromRuntimeRequire;
132208
+ try {
132209
+ return require.resolve('postcss-loader', {
132210
+ paths: getResolutionPaths()
132211
+ });
132212
+ } catch {
132213
+ return;
132214
+ }
132215
+ };
132115
132216
  const userPostCssConfig = findPostCssConfig(projectPath);
132116
132217
  const userConfigMentionsTailwind = userConfigMentionsTailwindPlugin(userPostCssConfig);
132117
132218
  const userConfigUsesDirectTailwindReference = userConfigUsesDirectTailwindPluginReference(userPostCssConfig);
@@ -132134,9 +132235,8 @@ var __webpack_modules__ = {
132134
132235
  const tailwindPresent = (0, _tailwind__rspack_import_6.F)(projectPath);
132135
132236
  const tailwindConfigured = tailwindPresent || userConfigMentionsTailwind;
132136
132237
  if (!userPostCssConfig && !pkgHasPostCss && !tailwindPresent) return {};
132137
- try {
132138
- require.resolve('postcss-loader');
132139
- } catch (_error) {
132238
+ let resolvedPostCssLoader = resolvePostCssLoader();
132239
+ if (!resolvedPostCssLoader) {
132140
132240
  if (!(0, _sass__rspack_import_7.fZ)(projectPath) && !(0, _less__rspack_import_8.K)(projectPath)) {
132141
132241
  const postCssDependencies = [
132142
132242
  'postcss',
@@ -132145,8 +132245,9 @@ var __webpack_modules__ = {
132145
132245
  const didInstall = await (0, _css_lib_integrations__rspack_import_5.tm)('PostCSS', postCssDependencies);
132146
132246
  if (!didInstall) throw new Error('[PostCSS] Optional dependencies failed to install.');
132147
132247
  }
132148
- console.log(_css_lib_messages__rspack_import_4.Jv('PostCSS'));
132149
- process.exit(0);
132248
+ resolvedPostCssLoader = resolvePostCssLoader();
132249
+ if (!resolvedPostCssLoader) throw new Error('[PostCSS] postcss-loader could not be resolved after optional dependency installation.');
132250
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_css_lib_messages__rspack_import_4.Jv('PostCSS'));
132150
132251
  }
132151
132252
  let pluginsFromOptions;
132152
132253
  const shouldInjectTailwindPlugin = tailwindConfigured && !pkgHasPostCss && (!userPostCssConfig || userConfigIsCjsInEsm || userConfigMentionsTailwind);
@@ -132255,7 +132356,7 @@ var __webpack_modules__ = {
132255
132356
  return {
132256
132357
  test: /\.css$/,
132257
132358
  type: 'css',
132258
- loader: require.resolve('postcss-loader'),
132359
+ loader: resolvedPostCssLoader,
132259
132360
  options: {
132260
132361
  postcssOptions,
132261
132362
  sourceMap: 'development' === opts.mode
@@ -132287,11 +132388,32 @@ var __webpack_modules__ = {
132287
132388
  }
132288
132389
  return false;
132289
132390
  }
132391
+ function resolveSassLoader(projectPath) {
132392
+ const extensionRoot = (0, _css_lib_integrations__rspack_import_4.He)();
132393
+ const bases = [
132394
+ projectPath,
132395
+ extensionRoot || void 0,
132396
+ process.cwd()
132397
+ ].filter(Boolean);
132398
+ for (const base of bases)try {
132399
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132400
+ return req.resolve('sass-loader');
132401
+ } catch {}
132402
+ try {
132403
+ return require.resolve('sass-loader', {
132404
+ paths: bases
132405
+ });
132406
+ } catch {
132407
+ return;
132408
+ }
132409
+ }
132290
132410
  function resolveSassImplementation(projectPath) {
132411
+ const extensionRoot = (0, _css_lib_integrations__rspack_import_4.He)();
132291
132412
  const bases = [
132292
132413
  projectPath,
132414
+ extensionRoot || void 0,
132293
132415
  process.cwd()
132294
- ];
132416
+ ].filter(Boolean);
132295
132417
  for (const base of bases)try {
132296
132418
  const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132297
132419
  let mod = req('sass');
@@ -132321,9 +132443,8 @@ var __webpack_modules__ = {
132321
132443
  }
132322
132444
  async function maybeUseSass(projectPath) {
132323
132445
  if (!isUsingSass(projectPath)) return [];
132324
- try {
132325
- require.resolve('sass-loader');
132326
- } catch (e) {
132446
+ let sassLoaderPath = resolveSassLoader(projectPath);
132447
+ if (!sassLoaderPath) {
132327
132448
  const postCssDependencies = [
132328
132449
  'postcss-loader',
132329
132450
  'postcss-scss',
@@ -132336,8 +132457,9 @@ var __webpack_modules__ = {
132336
132457
  ];
132337
132458
  const didInstallSass = await (0, _css_lib_integrations__rspack_import_4.tm)('SASS', sassDependencies);
132338
132459
  if (!didInstallSass) throw new Error('[SASS] Optional dependencies failed to install.');
132339
- console.log(_css_lib_messages__rspack_import_3.Jv('SASS'));
132340
- process.exit(0);
132460
+ sassLoaderPath = resolveSassLoader(projectPath);
132461
+ if (!sassLoaderPath) throw new Error('[SASS] sass-loader could not be resolved after optional dependency installation.');
132462
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_css_lib_messages__rspack_import_3.Jv('SASS'));
132341
132463
  }
132342
132464
  return [
132343
132465
  {
@@ -132345,7 +132467,7 @@ var __webpack_modules__ = {
132345
132467
  exclude: /\.module\.(sass|scss)$/,
132346
132468
  use: [
132347
132469
  {
132348
- loader: require.resolve('sass-loader'),
132470
+ loader: sassLoaderPath,
132349
132471
  options: createSassLoaderOptions(projectPath, 'development')
132350
132472
  }
132351
132473
  ]
@@ -132354,7 +132476,7 @@ var __webpack_modules__ = {
132354
132476
  test: /\.module\.(sass|scss)$/,
132355
132477
  use: [
132356
132478
  {
132357
- loader: require.resolve('sass-loader'),
132479
+ loader: sassLoaderPath,
132358
132480
  options: createSassLoaderOptions(projectPath, 'development')
132359
132481
  }
132360
132482
  ]
@@ -132398,6 +132520,7 @@ var __webpack_modules__ = {
132398
132520
  "use strict";
132399
132521
  __webpack_require__.d(__webpack_exports__, {
132400
132522
  Dy: ()=>_plugin_css_css_lib_integrations__rspack_import_0.Dy,
132523
+ He: ()=>_plugin_css_css_lib_integrations__rspack_import_0.He,
132401
132524
  qQ: ()=>isUsingJSFramework,
132402
132525
  tm: ()=>_plugin_css_css_lib_integrations__rspack_import_0.tm,
132403
132526
  ws: ()=>_plugin_css_css_lib_integrations__rspack_import_0.ws
@@ -132515,14 +132638,37 @@ var __webpack_modules__ = {
132515
132638
  var _js_frameworks_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132516
132639
  var _frameworks_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132517
132640
  let userMessageDelivered = false;
132518
- let cachedPreactRefreshPlugin;
132519
- function getPreactRefreshPlugin() {
132520
- if (cachedPreactRefreshPlugin) return cachedPreactRefreshPlugin;
132641
+ function resolveWithRuntimePaths(id, projectPath) {
132642
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_4.He)();
132643
+ const bases = [
132644
+ projectPath,
132645
+ extensionRoot || void 0,
132646
+ process.cwd()
132647
+ ].filter(Boolean);
132648
+ for (const base of bases)try {
132649
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132650
+ return req.resolve(id);
132651
+ } catch {}
132521
132652
  try {
132522
- const mod = __webpack_require__("@rspack/plugin-preact-refresh");
132653
+ return require.resolve(id, {
132654
+ paths: bases
132655
+ });
132656
+ } catch {
132657
+ return;
132658
+ }
132659
+ }
132660
+ function getPreactRefreshPlugin(projectPath) {
132661
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_4.He)();
132662
+ const bases = [
132663
+ projectPath,
132664
+ extensionRoot || void 0,
132665
+ process.cwd()
132666
+ ].filter(Boolean);
132667
+ for (const base of bases)try {
132668
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132669
+ const mod = req('@rspack/plugin-preact-refresh');
132523
132670
  const plugin = mod && mod.default || mod;
132524
- cachedPreactRefreshPlugin = plugin;
132525
- return cachedPreactRefreshPlugin;
132671
+ if (plugin) return plugin;
132526
132672
  } catch {}
132527
132673
  }
132528
132674
  function isUsingPreact(projectPath) {
@@ -132537,9 +132683,8 @@ var __webpack_modules__ = {
132537
132683
  }
132538
132684
  async function maybeUsePreact(projectPath) {
132539
132685
  if (!isUsingPreact(projectPath)) return;
132540
- try {
132541
- require.resolve('@rspack/plugin-preact-refresh');
132542
- } catch (e) {
132686
+ let preactRefreshPath = resolveWithRuntimePaths('@rspack/plugin-preact-refresh', projectPath);
132687
+ if (!preactRefreshPath) {
132543
132688
  const preactDependencies = [
132544
132689
  '@prefresh/core',
132545
132690
  '@prefresh/utils',
@@ -132548,10 +132693,11 @@ var __webpack_modules__ = {
132548
132693
  ];
132549
132694
  const didInstall = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('Preact', preactDependencies);
132550
132695
  if (!didInstall) throw new Error('[Preact] Optional dependencies failed to install.');
132551
- console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('Preact'));
132552
- process.exit(0);
132696
+ preactRefreshPath = resolveWithRuntimePaths('@rspack/plugin-preact-refresh', projectPath);
132697
+ if (!preactRefreshPath) throw new Error('[Preact] @rspack/plugin-preact-refresh could not be resolved after optional dependency installation.');
132698
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('Preact'));
132553
132699
  }
132554
- const PreactRefreshPlugin = getPreactRefreshPlugin();
132700
+ const PreactRefreshPlugin = getPreactRefreshPlugin(projectPath);
132555
132701
  if (!PreactRefreshPlugin) throw new Error('[Preact] @rspack/plugin-preact-refresh is installed but its plugin could not be resolved.');
132556
132702
  const preactPlugins = [
132557
132703
  new PreactRefreshPlugin({})
@@ -132596,14 +132742,37 @@ var __webpack_modules__ = {
132596
132742
  var _js_frameworks_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132597
132743
  var _frameworks_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132598
132744
  let userMessageDelivered = false;
132599
- let cachedReactRefreshPlugin;
132600
- function getReactRefreshPlugin() {
132601
- if (cachedReactRefreshPlugin) return cachedReactRefreshPlugin;
132745
+ function resolveWithRuntimePaths(id, projectPath) {
132746
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_4.He)();
132747
+ const bases = [
132748
+ projectPath,
132749
+ extensionRoot || void 0,
132750
+ process.cwd()
132751
+ ].filter(Boolean);
132752
+ for (const base of bases)try {
132753
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132754
+ return req.resolve(id);
132755
+ } catch {}
132602
132756
  try {
132603
- const mod = __webpack_require__("@rspack/plugin-react-refresh");
132757
+ return require.resolve(id, {
132758
+ paths: bases
132759
+ });
132760
+ } catch {
132761
+ return;
132762
+ }
132763
+ }
132764
+ function getReactRefreshPlugin(projectPath) {
132765
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_4.He)();
132766
+ const bases = [
132767
+ projectPath,
132768
+ extensionRoot || void 0,
132769
+ process.cwd()
132770
+ ].filter(Boolean);
132771
+ for (const base of bases)try {
132772
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132773
+ const mod = req('@rspack/plugin-react-refresh');
132604
132774
  const plugin = mod && mod.default || mod;
132605
- cachedReactRefreshPlugin = plugin;
132606
- return cachedReactRefreshPlugin;
132775
+ if (plugin) return plugin;
132607
132776
  } catch {}
132608
132777
  }
132609
132778
  function isUsingReact(projectPath) {
@@ -132618,19 +132787,19 @@ var __webpack_modules__ = {
132618
132787
  }
132619
132788
  async function maybeUseReact(projectPath) {
132620
132789
  if (!isUsingReact(projectPath)) return;
132621
- try {
132622
- require.resolve('react-refresh');
132623
- } catch (e) {
132790
+ let reactRefreshPath = resolveWithRuntimePaths('react-refresh', projectPath);
132791
+ if (!reactRefreshPath) {
132624
132792
  const reactDependencies = [
132625
132793
  'react-refresh',
132626
132794
  '@rspack/plugin-react-refresh'
132627
132795
  ];
132628
132796
  const didInstall = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('React', reactDependencies);
132629
132797
  if (!didInstall) throw new Error('[React] Optional dependencies failed to install.');
132630
- console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('React'));
132631
- process.exit(0);
132798
+ reactRefreshPath = resolveWithRuntimePaths('react-refresh', projectPath);
132799
+ if (!reactRefreshPath) throw new Error('[React] react-refresh could not be resolved after optional dependency installation.');
132800
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('React'));
132632
132801
  }
132633
- const ReactRefreshPlugin = getReactRefreshPlugin();
132802
+ const ReactRefreshPlugin = getReactRefreshPlugin(projectPath);
132634
132803
  if (!ReactRefreshPlugin) throw new Error('[React] @rspack/plugin-react-refresh is installed but its plugin could not be resolved.');
132635
132804
  const reactPlugins = [
132636
132805
  new ReactRefreshPlugin({
@@ -132679,11 +132848,38 @@ var __webpack_modules__ = {
132679
132848
  });
132680
132849
  var path__rspack_import_0 = __webpack_require__("path");
132681
132850
  var fs__rspack_import_1 = __webpack_require__("fs");
132682
- var _js_frameworks_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132683
- var _frameworks_lib_integrations__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132684
- var _js_frameworks_lib_load_loader_options__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
132851
+ var module__rspack_import_2 = __webpack_require__("module");
132852
+ var _js_frameworks_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132853
+ var _frameworks_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132854
+ var _js_frameworks_lib_load_loader_options__rspack_import_5 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
132685
132855
  let userMessageDelivered = false;
132856
+ function resolveWithRuntimePaths(id, projectPath) {
132857
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_4.He)();
132858
+ const bases = [
132859
+ projectPath,
132860
+ extensionRoot || void 0,
132861
+ process.cwd()
132862
+ ].filter(Boolean);
132863
+ for (const base of bases)try {
132864
+ const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132865
+ return req.resolve(id);
132866
+ } catch {}
132867
+ try {
132868
+ return require.resolve(id, {
132869
+ paths: bases
132870
+ });
132871
+ } catch {
132872
+ return;
132873
+ }
132874
+ }
132686
132875
  function resolveFromProject(id, projectPath) {
132876
+ for (const base of [
132877
+ projectPath,
132878
+ process.cwd()
132879
+ ])try {
132880
+ const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, 'package.json'));
132881
+ return req.resolve(id);
132882
+ } catch {}
132687
132883
  try {
132688
132884
  return require.resolve(id, {
132689
132885
  paths: [
@@ -132696,49 +132892,43 @@ var __webpack_modules__ = {
132696
132892
  }
132697
132893
  }
132698
132894
  function isUsingSvelte(projectPath) {
132699
- const using = (0, _frameworks_lib_integrations__rspack_import_3.ws)(projectPath, 'svelte');
132895
+ const using = (0, _frameworks_lib_integrations__rspack_import_4.ws)(projectPath, 'svelte');
132700
132896
  if (using && !userMessageDelivered) {
132701
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_2.zA('Svelte'));
132897
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_3.zA('Svelte'));
132702
132898
  userMessageDelivered = true;
132703
132899
  }
132704
132900
  return using;
132705
132901
  }
132706
132902
  async function maybeUseSvelte(projectPath, mode) {
132707
132903
  if (!isUsingSvelte(projectPath)) return;
132708
- try {
132709
- resolveFromProject('svelte-loader', projectPath) || require.resolve('svelte-loader');
132710
- } catch (e) {
132904
+ let svelteLoaderPath = resolveFromProject('svelte-loader', projectPath) || resolveWithRuntimePaths('svelte-loader', projectPath);
132905
+ if (!svelteLoaderPath) {
132711
132906
  const typeScriptDependencies = [
132712
132907
  "typescript"
132713
132908
  ];
132714
- const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('TypeScript', typeScriptDependencies);
132909
+ const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('TypeScript', typeScriptDependencies);
132715
132910
  if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
132716
132911
  const svelteDependencies = [
132717
132912
  'svelte-loader'
132718
132913
  ];
132719
- const didInstallSvelte = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('Svelte', svelteDependencies);
132914
+ const didInstallSvelte = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('Svelte', svelteDependencies);
132720
132915
  if (!didInstallSvelte) throw new Error('[Svelte] Optional dependencies failed to install.');
132721
- console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('Svelte'));
132722
- process.exit(0);
132916
+ svelteLoaderPath = resolveFromProject('svelte-loader', projectPath) || resolveWithRuntimePaths('svelte-loader', projectPath);
132917
+ if (!svelteLoaderPath) throw new Error('[Svelte] svelte-loader could not be resolved after optional dependency installation.');
132918
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('Svelte'));
132723
132919
  }
132724
- try {
132725
- require.resolve("typescript", {
132726
- paths: [
132727
- projectPath,
132728
- process.cwd()
132729
- ]
132730
- });
132731
- } catch (e) {
132920
+ const resolvedTypescript = resolveFromProject("typescript", projectPath) || resolveWithRuntimePaths("typescript", projectPath);
132921
+ if (!resolvedTypescript) {
132732
132922
  const typeScriptDependencies = [
132733
132923
  "typescript"
132734
132924
  ];
132735
- const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('TypeScript', typeScriptDependencies);
132925
+ const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('TypeScript', typeScriptDependencies);
132736
132926
  if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
132737
- console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('TypeScript'));
132738
- process.exit(0);
132927
+ const reResolvedTypescript = resolveFromProject("typescript", projectPath) || resolveWithRuntimePaths("typescript", projectPath);
132928
+ if (!reResolvedTypescript) throw new Error('[TypeScript] TypeScript could not be resolved after optional dependency installation.');
132929
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('TypeScript'));
132739
132930
  }
132740
- const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_4.g)(projectPath, 'svelte');
132741
- const svelteLoaderPath = resolveFromProject('svelte-loader', projectPath) || require.resolve('svelte-loader');
132931
+ const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_5.g)(projectPath, 'svelte');
132742
132932
  const defaultLoaders = [
132743
132933
  {
132744
132934
  test: /\.svelte\.ts$/,
@@ -132828,10 +133018,11 @@ var __webpack_modules__ = {
132828
133018
  });
132829
133019
  var path__rspack_import_0 = __webpack_require__("path");
132830
133020
  var fs__rspack_import_1 = __webpack_require__("fs");
132831
- var pintor__rspack_import_2 = __webpack_require__("pintor");
132832
- var pintor__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_2);
132833
- var _js_frameworks_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
132834
- var _frameworks_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
133021
+ __webpack_require__("module");
133022
+ var pintor__rspack_import_3 = __webpack_require__("pintor");
133023
+ var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
133024
+ var _js_frameworks_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
133025
+ var _frameworks_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132835
133026
  let hasShownUserMessage = false;
132836
133027
  function findNearestPackageJsonDirectory(startPath) {
132837
133028
  let currentDirectory = startPath;
@@ -132886,12 +133077,12 @@ var __webpack_modules__ = {
132886
133077
  const hasTsFiles = hasTypeScriptSourceFiles(projectPath);
132887
133078
  if (!hasShownUserMessage) {
132888
133079
  if (TypeScriptAsDevDep || TypeScriptAsDep || hasTsFiles) if (tsConfigFilePath) {
132889
- if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_2_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_3.zA('TypeScript')}`);
133080
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_3_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_4.zA('TypeScript')}`);
132890
133081
  } else if (hasTsFiles) {
132891
133082
  const errorMessage = '[Extension.js] Missing tsconfig.json next to package.json. Create one to use TypeScript.';
132892
133083
  throw new Error(errorMessage);
132893
133084
  } else {
132894
- console.log(_js_frameworks_lib_messages__rspack_import_3.LR());
133085
+ console.log(_js_frameworks_lib_messages__rspack_import_4.LR());
132895
133086
  writeTsConfig(projectPath);
132896
133087
  }
132897
133088
  hasShownUserMessage = true;
@@ -132905,7 +133096,7 @@ var __webpack_modules__ = {
132905
133096
  allowSyntheticDefaultImports: true,
132906
133097
  esModuleInterop: true,
132907
133098
  forceConsistentCasingInFileNames: true,
132908
- jsx: (0, _frameworks_lib_integrations__rspack_import_4.qQ)(projectPath) ? 'react-jsx' : 'preserve',
133099
+ jsx: (0, _frameworks_lib_integrations__rspack_import_5.qQ)(projectPath) ? 'react-jsx' : 'preserve',
132909
133100
  lib: [
132910
133101
  'dom',
132911
133102
  'dom.iterable',
@@ -132953,16 +133144,37 @@ var __webpack_modules__ = {
132953
133144
  var _frameworks_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
132954
133145
  var _js_frameworks_lib_load_loader_options__rspack_import_6 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
132955
133146
  let userMessageDelivered = false;
132956
- let cachedVueLoaderPlugin;
132957
- function getVueLoaderPlugin() {
132958
- if (cachedVueLoaderPlugin) return cachedVueLoaderPlugin;
133147
+ function resolveWithRuntimePaths(id, projectPath) {
133148
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_5.He)();
133149
+ const bases = [
133150
+ projectPath,
133151
+ extensionRoot || void 0,
133152
+ process.cwd()
133153
+ ].filter(Boolean);
133154
+ for (const base of bases)try {
133155
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
133156
+ return req.resolve(id);
133157
+ } catch {}
132959
133158
  try {
132960
- const mod = __webpack_require__("vue-loader");
133159
+ return require.resolve(id, {
133160
+ paths: bases
133161
+ });
133162
+ } catch {
133163
+ return;
133164
+ }
133165
+ }
133166
+ function getVueLoaderPlugin(projectPath) {
133167
+ const extensionRoot = (0, _frameworks_lib_integrations__rspack_import_5.He)();
133168
+ const bases = [
133169
+ projectPath,
133170
+ extensionRoot || void 0,
133171
+ process.cwd()
133172
+ ].filter(Boolean);
133173
+ for (const base of bases)try {
133174
+ const req = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(base, 'package.json'));
133175
+ const mod = req('vue-loader');
132961
133176
  const plugin = mod && mod.VueLoaderPlugin || mod && mod.default && mod.default.VueLoaderPlugin;
132962
- if (plugin) {
132963
- cachedVueLoaderPlugin = plugin;
132964
- return cachedVueLoaderPlugin;
132965
- }
133177
+ if (plugin) return plugin;
132966
133178
  } catch {}
132967
133179
  }
132968
133180
  function isUsingVue(projectPath) {
@@ -132975,25 +133187,25 @@ var __webpack_modules__ = {
132975
133187
  }
132976
133188
  async function maybeUseVue(projectPath, mode = 'development') {
132977
133189
  if (!isUsingVue(projectPath)) return;
132978
- try {
132979
- require.resolve('vue-loader');
132980
- } catch (e) {
133190
+ let vueLoaderPath = resolveWithRuntimePaths('vue-loader', projectPath);
133191
+ if (!vueLoaderPath) {
132981
133192
  const vueDependencies = [
132982
133193
  'vue-loader',
132983
133194
  '@vue/compiler-sfc'
132984
133195
  ];
132985
133196
  const didInstall = await (0, _frameworks_lib_integrations__rspack_import_5.tm)('Vue', vueDependencies);
132986
133197
  if (!didInstall) throw new Error('[Vue] Optional dependencies failed to install.');
132987
- console.log(_js_frameworks_lib_messages__rspack_import_4.Jv('Vue'));
132988
- process.exit(0);
133198
+ vueLoaderPath = resolveWithRuntimePaths('vue-loader', projectPath);
133199
+ if (!vueLoaderPath) throw new Error('[Vue] vue-loader could not be resolved after optional dependency installation.');
133200
+ if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_4.Jv('Vue'));
132989
133201
  }
132990
- const VueLoaderPlugin = getVueLoaderPlugin();
133202
+ const VueLoaderPlugin = getVueLoaderPlugin(projectPath);
132991
133203
  if (!VueLoaderPlugin) throw new Error('[Vue] vue-loader is installed but VueLoaderPlugin could not be resolved.');
132992
133204
  const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_6.g)(projectPath, 'vue');
132993
133205
  const defaultLoaders = [
132994
133206
  {
132995
133207
  test: /\.vue$/,
132996
- loader: require.resolve('vue-loader'),
133208
+ loader: vueLoaderPath,
132997
133209
  options: {
132998
133210
  experimentalInlineMatchResource: true,
132999
133211
  ...customOptions || {}
@@ -134172,11 +134384,15 @@ var __webpack_modules__ = {
134172
134384
  const invocation = buildSpawnInvocation(command, args);
134173
134385
  const env = buildExecEnv();
134174
134386
  const stdio = options?.stdio ?? 'ignore';
134387
+ const useShell = 'win32' === process.platform && /\.(cmd|bat)$/i.test(invocation.command);
134175
134388
  return new Promise((resolve, reject)=>{
134176
134389
  const child = (0, child_process__rspack_import_2.spawn)(invocation.command, invocation.args, {
134177
134390
  cwd: options?.cwd,
134178
134391
  stdio,
134179
- env: env || process.env
134392
+ env: env || process.env,
134393
+ ...useShell ? {
134394
+ shell: true
134395
+ } : {}
134180
134396
  });
134181
134397
  child.on('close', (code)=>{
134182
134398
  if (0 !== code) reject(new Error(`Install failed with exit code ${code}`));
@@ -134231,7 +134447,8 @@ var __webpack_modules__ = {
134231
134447
  if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.pnpm'))) return false;
134232
134448
  if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.modules.yaml'))) return false;
134233
134449
  if (hasMarker) try {
134234
- if (fs__rspack_import_0.readdirSync(nm).length > 0) return false;
134450
+ const entries = fs__rspack_import_0.readdirSync(nm).filter((name)=>'.bin' !== name && !name.startsWith('.cache'));
134451
+ if (entries.length > 0) return false;
134235
134452
  } catch {}
134236
134453
  const hasInstalledDep = [
134237
134454
  ...deps,
@@ -134375,14 +134592,6 @@ var __webpack_modules__ = {
134375
134592
  "use strict";
134376
134593
  module.exports = require("@rspack/dev-server");
134377
134594
  },
134378
- "@rspack/plugin-preact-refresh" (module) {
134379
- "use strict";
134380
- module.exports = require("@rspack/plugin-preact-refresh");
134381
- },
134382
- "@rspack/plugin-react-refresh" (module) {
134383
- "use strict";
134384
- module.exports = require("@rspack/plugin-react-refresh");
134385
- },
134386
134595
  "adm-zip" (module) {
134387
134596
  "use strict";
134388
134597
  module.exports = require("adm-zip");
@@ -134487,10 +134696,6 @@ var __webpack_modules__ = {
134487
134696
  "use strict";
134488
134697
  module.exports = require("util");
134489
134698
  },
134490
- "vue-loader" (module) {
134491
- "use strict";
134492
- module.exports = require("vue-loader");
134493
- },
134494
134699
  "webpack-merge" (module) {
134495
134700
  "use strict";
134496
134701
  module.exports = require("webpack-merge");
@@ -134501,7 +134706,7 @@ var __webpack_modules__ = {
134501
134706
  },
134502
134707
  "./package.json" (module) {
134503
134708
  "use strict";
134504
- module.exports = JSON.parse('{"rE":"3.7.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","extension-from-store":"^0.1.1","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"}}');
134709
+ module.exports = JSON.parse('{"rE":"3.8.1-canary.186.23220b7","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","extension-from-store":"^0.1.1","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"}}');
134505
134710
  }
134506
134711
  };
134507
134712
  var __webpack_module_cache__ = {};
@@ -134700,6 +134905,8 @@ var __webpack_exports__ = {};
134700
134905
  if (isUrl(pathOrRemoteUrl)) {
134701
134906
  const url = new URL(pathOrRemoteUrl);
134702
134907
  if (url.protocol.startsWith('http')) {
134908
+ const pathname = url.pathname.toLowerCase();
134909
+ if (pathname.endsWith('.zip')) return await importUrlSourceFromZip(pathOrRemoteUrl);
134703
134910
  if ('https://github.com' !== url.origin) {
134704
134911
  const urlSource = await importUrlSourceFromZip(pathOrRemoteUrl);
134705
134912
  return urlSource;
@@ -134866,6 +135073,77 @@ var __webpack_exports__ = {};
134866
135073
  'install'
134867
135074
  ];
134868
135075
  }
135076
+ function findNearestWorkspaceRoot(startDir) {
135077
+ let current = external_path_.resolve(startDir);
135078
+ while(true){
135079
+ const workspaceFile = external_path_.join(current, 'pnpm-workspace.yaml');
135080
+ if (external_fs_.existsSync(workspaceFile)) return current;
135081
+ const parent = external_path_.dirname(current);
135082
+ if (parent === current) return;
135083
+ current = parent;
135084
+ }
135085
+ }
135086
+ function toRelativePath(baseDir, targetDir) {
135087
+ return external_path_.relative(baseDir, targetDir).split(external_path_.sep).join('/');
135088
+ }
135089
+ function parseWorkspacePatterns(workspaceFilePath) {
135090
+ try {
135091
+ const raw = external_fs_.readFileSync(workspaceFilePath, 'utf8');
135092
+ const lines = raw.split(/\r?\n/);
135093
+ const patterns = [];
135094
+ let inPackages = false;
135095
+ for (const line of lines){
135096
+ const trimmed = line.trim();
135097
+ if (!inPackages) {
135098
+ if ('packages:' === trimmed) inPackages = true;
135099
+ continue;
135100
+ }
135101
+ if (0 === trimmed.length || trimmed.startsWith('#')) continue;
135102
+ if (!trimmed.startsWith('-')) break;
135103
+ const value = trimmed.slice(1).trim();
135104
+ const unquoted = value.replace(/^['"]|['"]$/g, '');
135105
+ if (unquoted.length > 0) patterns.push(unquoted);
135106
+ }
135107
+ return patterns;
135108
+ } catch {
135109
+ return [];
135110
+ }
135111
+ }
135112
+ function globToRegExp(glob) {
135113
+ const normalized = glob.replace(/^\.\//, '').replace(/^!/, '').replace(/\/+$/, '');
135114
+ let pattern = '';
135115
+ for(let i = 0; i < normalized.length; i++){
135116
+ const char = normalized[i];
135117
+ if ('*' === char) {
135118
+ if ('*' === normalized[i + 1]) {
135119
+ pattern += '.*';
135120
+ i += 1;
135121
+ } else pattern += '[^/]*';
135122
+ continue;
135123
+ }
135124
+ if (/[|\\{}()[\]^$+?.]/.test(char)) pattern += `\\${char}`;
135125
+ else pattern += char;
135126
+ }
135127
+ return new RegExp(`^${pattern}$`);
135128
+ }
135129
+ function isProjectIncludedByWorkspace(workspaceRoot, projectPath) {
135130
+ const workspaceFile = external_path_.join(workspaceRoot, 'pnpm-workspace.yaml');
135131
+ const patterns = parseWorkspacePatterns(workspaceFile);
135132
+ if (0 === patterns.length) return true;
135133
+ const relativeProjectPath = toRelativePath(workspaceRoot, projectPath);
135134
+ let included = false;
135135
+ for (const pattern of patterns){
135136
+ const isNegated = pattern.startsWith('!');
135137
+ const matcher = globToRegExp(pattern);
135138
+ if (matcher.test(relativeProjectPath)) included = !isNegated;
135139
+ }
135140
+ return included;
135141
+ }
135142
+ function shouldUsePnpmIsolatedInstall(projectPath) {
135143
+ const workspaceRoot = findNearestWorkspaceRoot(projectPath);
135144
+ if (!workspaceRoot) return false;
135145
+ return !isProjectIncludedByWorkspace(workspaceRoot, projectPath);
135146
+ }
134869
135147
  async function hasDependenciesToInstall(projectPath) {
134870
135148
  try {
134871
135149
  const raw = await external_fs_.promises.readFile(external_path_.join(projectPath, 'package.json'), 'utf8');
@@ -134893,6 +135171,11 @@ var __webpack_exports__ = {};
134893
135171
  ...dependenciesArgs,
134894
135172
  '--include=dev'
134895
135173
  ];
135174
+ if ('pnpm' === pm.name && shouldUsePnpmIsolatedInstall(projectPath)) dependenciesArgs = [
135175
+ ...dependenciesArgs,
135176
+ '--ignore-workspace',
135177
+ '--lockfile=false'
135178
+ ];
134896
135179
  await external_fs_.promises.mkdir(nodeModulesPath, {
134897
135180
  recursive: true
134898
135181
  });
@@ -135297,8 +135580,9 @@ var __webpack_exports__ = {};
135297
135580
  console.error(err.stack || err);
135298
135581
  return reject(err);
135299
135582
  }
135583
+ if (!stats || 'function' != typeof stats.hasErrors) return reject(new Error('Build failed: bundler returned invalid stats output (no reliable compilation result).'));
135300
135584
  if (!buildOptions?.silent && stats) console.log(messages.I(manifestDir, stats, browser));
135301
- if (stats?.hasErrors()) {
135585
+ if (stats.hasErrors()) {
135302
135586
  handleStatsErrors(stats);
135303
135587
  if (!shouldExitOnError) return reject(new Error('Build failed with errors'));
135304
135588
  process.exit(1);