weapp-vite 5.2.2 → 5.3.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.
@@ -915,13 +915,55 @@ function checkRuntime(minVersions) {
915
915
  }
916
916
  }
917
917
 
918
+ // src/utils/weappConfig.ts
919
+ init_esm_shims();
920
+ import fs from "fs-extra";
921
+ import path from "pathe";
922
+ var WEAPP_VITE_CONFIG_CANDIDATES = [
923
+ "weapp-vite.config.ts",
924
+ "weapp-vite.config.mts",
925
+ "weapp-vite.config.cts",
926
+ "weapp-vite.config.js",
927
+ "weapp-vite.config.mjs",
928
+ "weapp-vite.config.cjs",
929
+ "weapp-vite.config.json"
930
+ ];
931
+ var WEAPP_VITE_CONFIG_SET = new Set(WEAPP_VITE_CONFIG_CANDIDATES);
932
+ async function findWeappConfigInDirectory(directory) {
933
+ for (const filename of WEAPP_VITE_CONFIG_CANDIDATES) {
934
+ const candidatePath = path.resolve(directory, filename);
935
+ if (await fs.pathExists(candidatePath)) {
936
+ return candidatePath;
937
+ }
938
+ }
939
+ return void 0;
940
+ }
941
+ async function resolveWeappConfigFile(options) {
942
+ const { root, specified } = options;
943
+ if (specified) {
944
+ const resolvedSpecified = path.isAbsolute(specified) ? specified : path.resolve(root, specified);
945
+ const specifiedBaseName = path.basename(resolvedSpecified);
946
+ if (WEAPP_VITE_CONFIG_SET.has(specifiedBaseName)) {
947
+ if (await fs.pathExists(resolvedSpecified)) {
948
+ return resolvedSpecified;
949
+ }
950
+ return void 0;
951
+ }
952
+ const fromSpecifiedDirectory = await findWeappConfigInDirectory(path.dirname(resolvedSpecified));
953
+ if (fromSpecifiedDirectory) {
954
+ return fromSpecifiedDirectory;
955
+ }
956
+ }
957
+ return findWeappConfigInDirectory(root);
958
+ }
959
+
918
960
  // src/utils/index.ts
919
961
  init_esm_shims();
920
962
 
921
963
  // src/utils/file.ts
922
964
  init_esm_shims();
923
- import fs from "fs-extra";
924
- import path from "pathe";
965
+ import fs2 from "fs-extra";
966
+ import path2 from "pathe";
925
967
  function isJsOrTs(name) {
926
968
  if (typeof name === "string") {
927
969
  return /\.[jt]s$/.test(name);
@@ -942,15 +984,15 @@ function changeFileExtension(filePath, extension) {
942
984
  return "";
943
985
  }
944
986
  extension = extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
945
- const basename4 = path.basename(filePath, path.extname(filePath));
946
- return path.join(path.dirname(filePath), basename4 + extension);
987
+ const basename4 = path2.basename(filePath, path2.extname(filePath));
988
+ return path2.join(path2.dirname(filePath), basename4 + extension);
947
989
  }
948
990
  async function findJsEntry(filepath) {
949
991
  const predictions = jsExtensions.map((ext2) => {
950
992
  return changeFileExtension(filepath, ext2);
951
993
  });
952
994
  for (const p of predictions) {
953
- if (await fs.exists(p)) {
995
+ if (await fs2.exists(p)) {
954
996
  return {
955
997
  path: p,
956
998
  predictions
@@ -966,7 +1008,7 @@ async function findJsonEntry(filepath) {
966
1008
  return changeFileExtension(filepath, ext2);
967
1009
  });
968
1010
  for (const p of predictions) {
969
- if (await fs.exists(p)) {
1011
+ if (await fs2.exists(p)) {
970
1012
  return {
971
1013
  predictions,
972
1014
  path: p
@@ -982,7 +1024,7 @@ async function findTemplateEntry(filepath) {
982
1024
  return changeFileExtension(filepath, ext2);
983
1025
  });
984
1026
  for (const p of predictions) {
985
- if (await fs.exists(p)) {
1027
+ if (await fs2.exists(p)) {
986
1028
  return {
987
1029
  predictions,
988
1030
  path: p
@@ -999,9 +1041,9 @@ function isTemplate(filepath) {
999
1041
  async function touch(filename) {
1000
1042
  const time = /* @__PURE__ */ new Date();
1001
1043
  try {
1002
- await fs.utimes(filename, time, time);
1044
+ await fs2.utimes(filename, time, time);
1003
1045
  } catch {
1004
- await fs.close(await fs.open(filename, "w"));
1046
+ await fs2.close(await fs2.open(filename, "w"));
1005
1047
  }
1006
1048
  }
1007
1049
 
@@ -1009,7 +1051,7 @@ async function touch(filename) {
1009
1051
  init_esm_shims();
1010
1052
  import { get, isObject, set } from "@weapp-core/shared";
1011
1053
  import { parse as parseJson, stringify } from "comment-json";
1012
- import path2 from "pathe";
1054
+ import path3 from "pathe";
1013
1055
  function jsonFileRemoveJsExtension(fileName) {
1014
1056
  return fileName.replace(/\.[jt]s$/, "");
1015
1057
  }
@@ -1054,7 +1096,7 @@ function resolveImportee(importee, jsonPath, aliasEntries) {
1054
1096
  return importee;
1055
1097
  }
1056
1098
  const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
1057
- return path2.relative(path2.dirname(jsonPath), updatedId);
1099
+ return path3.relative(path3.dirname(jsonPath), updatedId);
1058
1100
  }
1059
1101
  return importee;
1060
1102
  }
@@ -1097,16 +1139,16 @@ import crypto from "crypto";
1097
1139
 
1098
1140
  // src/utils/projectConfig.ts
1099
1141
  init_esm_shims();
1100
- import fs2 from "fs-extra";
1101
- import path3 from "pathe";
1142
+ import fs3 from "fs-extra";
1143
+ import path4 from "pathe";
1102
1144
  async function getProjectConfig(root, options) {
1103
- const baseJsonPath = path3.resolve(root, "project.config.json");
1104
- const privateJsonPath = path3.resolve(root, "project.private.config.json");
1145
+ const baseJsonPath = path4.resolve(root, "project.config.json");
1146
+ const privateJsonPath = path4.resolve(root, "project.private.config.json");
1105
1147
  let baseJson = {};
1106
1148
  let privateJson = {};
1107
- if (await fs2.exists(baseJsonPath)) {
1149
+ if (await fs3.exists(baseJsonPath)) {
1108
1150
  try {
1109
- baseJson = await fs2.readJson(baseJsonPath) || {};
1151
+ baseJson = await fs3.readJson(baseJsonPath) || {};
1110
1152
  } catch {
1111
1153
  throw new Error(`\u89E3\u6790 json \u683C\u5F0F\u5931\u8D25, project.config.json \u4E3A\u975E\u6CD5\u7684 json \u683C\u5F0F`);
1112
1154
  }
@@ -1114,9 +1156,9 @@ async function getProjectConfig(root, options) {
1114
1156
  throw new Error(`\u5728 ${root} \u76EE\u5F55\u4E0B\u627E\u4E0D\u5230 project.config.json`);
1115
1157
  }
1116
1158
  if (!options?.ignorePrivate) {
1117
- if (await fs2.exists(privateJsonPath)) {
1159
+ if (await fs3.exists(privateJsonPath)) {
1118
1160
  try {
1119
- privateJson = await fs2.readJson(privateJsonPath) || {};
1161
+ privateJson = await fs3.readJson(privateJsonPath) || {};
1120
1162
  } catch {
1121
1163
  throw new Error(`\u89E3\u6790 json \u683C\u5F0F\u5931\u8D25, project.private.config.json \u4E3A\u975E\u6CD5\u7684 json \u683C\u5F0F`);
1122
1164
  }
@@ -1169,6 +1211,7 @@ init_esm_shims();
1169
1211
  // src/runtime/autoImportPlugin.ts
1170
1212
  init_esm_shims();
1171
1213
  import { removeExtensionDeep } from "@weapp-core/shared";
1214
+ import fs4 from "fs-extra";
1172
1215
 
1173
1216
  // ../../node_modules/.pnpm/lru-cache@11.2.2/node_modules/lru-cache/dist/esm/index.js
1174
1217
  init_esm_shims();
@@ -2573,11 +2616,12 @@ var LRUCache = class _LRUCache {
2573
2616
  };
2574
2617
 
2575
2618
  // src/runtime/autoImportPlugin.ts
2619
+ import path6 from "pathe";
2576
2620
  import pm from "picomatch";
2577
2621
 
2578
2622
  // src/context/shared.ts
2579
2623
  init_esm_shims();
2580
- import path4 from "pathe";
2624
+ import path5 from "pathe";
2581
2625
 
2582
2626
  // src/debugger.ts
2583
2627
  init_esm_shims();
@@ -2592,16 +2636,16 @@ function createDebugger(namespace) {
2592
2636
  // src/context/shared.ts
2593
2637
  var debug = createDebugger("weapp-vite:context");
2594
2638
  function resolvedComponentName(entry) {
2595
- const base = path4.basename(entry);
2639
+ const base = path5.basename(entry);
2596
2640
  if (base === "index") {
2597
- const dirName = path4.dirname(entry);
2641
+ const dirName = path5.dirname(entry);
2598
2642
  if (dirName === ".") {
2599
2643
  return {
2600
2644
  base
2601
2645
  };
2602
2646
  }
2603
2647
  return {
2604
- componentName: path4.basename(dirName),
2648
+ componentName: path5.basename(dirName),
2605
2649
  base
2606
2650
  // isIndex: true,
2607
2651
  };
@@ -2635,6 +2679,96 @@ function logWarnOnce(message) {
2635
2679
  function createAutoImportService(ctx) {
2636
2680
  const autoImportState = ctx.runtimeState.autoImport;
2637
2681
  const registry = autoImportState.registry;
2682
+ const manifestFileName = "auto-import-components.json";
2683
+ let pendingWrite;
2684
+ let writeRequested = false;
2685
+ function resolveManifestOutputPath() {
2686
+ const configService = ctx.configService;
2687
+ if (!configService) {
2688
+ return void 0;
2689
+ }
2690
+ const autoImportConfig = configService.weappViteConfig?.enhance?.autoImportComponents;
2691
+ if (!autoImportConfig) {
2692
+ return void 0;
2693
+ }
2694
+ const baseDir = (() => {
2695
+ const configFilePath = configService.configFilePath;
2696
+ if (configFilePath) {
2697
+ return path6.dirname(configFilePath);
2698
+ }
2699
+ return configService.cwd;
2700
+ })();
2701
+ const outputOption = autoImportConfig.output;
2702
+ if (outputOption === false) {
2703
+ return void 0;
2704
+ }
2705
+ if (typeof outputOption === "string" && outputOption.length > 0) {
2706
+ return path6.isAbsolute(outputOption) ? outputOption : path6.resolve(baseDir, outputOption);
2707
+ }
2708
+ return path6.resolve(baseDir, manifestFileName);
2709
+ }
2710
+ function collectResolverComponents() {
2711
+ const resolvers = ctx.configService?.weappViteConfig?.enhance?.autoImportComponents?.resolvers;
2712
+ if (!Array.isArray(resolvers)) {
2713
+ return {};
2714
+ }
2715
+ const entries = [];
2716
+ for (const resolver of resolvers) {
2717
+ const map = resolver?.components;
2718
+ if (!map) {
2719
+ continue;
2720
+ }
2721
+ for (const [name, from] of Object.entries(map)) {
2722
+ entries.push([name, from]);
2723
+ }
2724
+ }
2725
+ return Object.fromEntries(entries);
2726
+ }
2727
+ async function writeManifestFile(outputPath) {
2728
+ const resolverEntries = Object.entries(collectResolverComponents());
2729
+ const localEntries = Array.from(registry.entries()).filter((entry) => entry[1].kind === "local");
2730
+ const manifestMap = /* @__PURE__ */ new Map();
2731
+ for (const [componentName, from] of resolverEntries) {
2732
+ manifestMap.set(componentName, from);
2733
+ }
2734
+ for (const [componentName, match2] of localEntries) {
2735
+ manifestMap.set(componentName, match2.value.from);
2736
+ }
2737
+ const manifest = Object.fromEntries(
2738
+ Array.from(manifestMap.entries()).sort(([a], [b]) => a.localeCompare(b))
2739
+ );
2740
+ await fs4.outputJson(outputPath, manifest, { spaces: 2 });
2741
+ }
2742
+ function scheduleManifestWrite(shouldWrite) {
2743
+ if (!shouldWrite) {
2744
+ return;
2745
+ }
2746
+ const configService = ctx.configService;
2747
+ if (!configService?.weappViteConfig?.enhance?.autoImportComponents) {
2748
+ return;
2749
+ }
2750
+ writeRequested = true;
2751
+ if (pendingWrite) {
2752
+ return;
2753
+ }
2754
+ pendingWrite = Promise.resolve().then(async () => {
2755
+ while (writeRequested) {
2756
+ writeRequested = false;
2757
+ const outputPath = resolveManifestOutputPath();
2758
+ if (!outputPath) {
2759
+ return;
2760
+ }
2761
+ try {
2762
+ await writeManifestFile(outputPath);
2763
+ } catch (error) {
2764
+ const message = error instanceof Error ? error.message : String(error);
2765
+ logger_default.error(`\u81EA\u52A8\u5BFC\u51FA\u7EC4\u4EF6\u6E05\u5355\u5931\u8D25: ${message}`);
2766
+ }
2767
+ }
2768
+ }).finally(() => {
2769
+ pendingWrite = void 0;
2770
+ });
2771
+ }
2638
2772
  async function registerLocalComponent(filePath) {
2639
2773
  if (!ctx.configService || !ctx.jsonService) {
2640
2774
  throw new Error("configService/jsonService must be initialized before scanning components");
@@ -2645,26 +2779,30 @@ function createAutoImportService(ctx) {
2645
2779
  findJsonEntry(baseName),
2646
2780
  findTemplateEntry(baseName)
2647
2781
  ]);
2648
- removeRegisteredComponent({
2782
+ const removed = removeRegisteredComponent({
2649
2783
  baseName,
2650
2784
  templatePath,
2651
2785
  jsEntry,
2652
2786
  jsonPath
2653
2787
  });
2654
2788
  if (!jsEntry || !jsonPath || !templatePath) {
2789
+ scheduleManifestWrite(removed);
2655
2790
  return;
2656
2791
  }
2657
2792
  const json = await ctx.jsonService.read(jsonPath);
2658
2793
  if (!json?.component) {
2794
+ scheduleManifestWrite(removed);
2659
2795
  return;
2660
2796
  }
2661
2797
  const { componentName, base } = resolvedComponentName(baseName);
2662
2798
  if (!componentName) {
2799
+ scheduleManifestWrite(removed);
2663
2800
  return;
2664
2801
  }
2665
2802
  const hasComponent = registry.has(componentName);
2666
2803
  if (hasComponent && base !== "index") {
2667
2804
  logWarnOnce(`\u53D1\u73B0 \`${componentName}\` \u7EC4\u4EF6\u91CD\u540D! \u8DF3\u8FC7\u7EC4\u4EF6 \`${ctx.configService.relativeCwd(baseName)}\` \u7684\u81EA\u52A8\u5F15\u5165`);
2805
+ scheduleManifestWrite(removed);
2668
2806
  return;
2669
2807
  }
2670
2808
  const sourceWithoutExt = removeExtensionDeep(jsonPath);
@@ -2685,9 +2823,11 @@ function createAutoImportService(ctx) {
2685
2823
  from
2686
2824
  }
2687
2825
  });
2826
+ scheduleManifestWrite(true);
2688
2827
  }
2689
2828
  function removeRegisteredComponent(paths) {
2690
2829
  const { baseName, templatePath, jsEntry, jsonPath } = paths;
2830
+ let removed = false;
2691
2831
  for (const [key, value] of registry) {
2692
2832
  if (value.kind !== "local") {
2693
2833
  continue;
@@ -2697,9 +2837,10 @@ function createAutoImportService(ctx) {
2697
2837
  templatePath && entry.templatePath === templatePath || jsonPath && entry.jsonPath === jsonPath || jsEntry && entry.path === jsEntry || baseName && removeExtensionDeep(entry.templatePath) === baseName || baseName && removeExtensionDeep(entry.path) === baseName || baseName && removeExtensionDeep(entry.jsonPath ?? "") === baseName
2698
2838
  );
2699
2839
  if (matches2) {
2700
- registry.delete(key);
2840
+ removed = registry.delete(key) || removed;
2701
2841
  }
2702
2842
  }
2843
+ return removed;
2703
2844
  }
2704
2845
  function ensureMatcher() {
2705
2846
  if (!ctx.configService) {
@@ -2743,15 +2884,17 @@ function createAutoImportService(ctx) {
2743
2884
  registry.clear();
2744
2885
  autoImportState.matcher = void 0;
2745
2886
  autoImportState.matcherKey = "";
2887
+ scheduleManifestWrite(true);
2746
2888
  },
2747
2889
  async registerPotentialComponent(filePath) {
2748
2890
  await registerLocalComponent(filePath);
2749
2891
  },
2750
2892
  removePotentialComponent(filePath) {
2751
- removeRegisteredComponent({
2893
+ const removed = removeRegisteredComponent({
2752
2894
  baseName: removeExtensionDeep(filePath),
2753
2895
  templatePath: filePath
2754
2896
  });
2897
+ scheduleManifestWrite(removed);
2755
2898
  },
2756
2899
  resolve(componentName, importerBaseName) {
2757
2900
  const local = registry.get(componentName);
@@ -2769,6 +2912,9 @@ function createAutoImportService(ctx) {
2769
2912
  },
2770
2913
  getRegisteredLocalComponents() {
2771
2914
  return Array.from(registry.values());
2915
+ },
2916
+ awaitManifestWrites() {
2917
+ return pendingWrite ?? Promise.resolve();
2772
2918
  }
2773
2919
  };
2774
2920
  }
@@ -2862,7 +3008,7 @@ var ReaddirpStream = class extends Readable {
2862
3008
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
2863
3009
  const statMethod = opts.lstat ? lstat : stat;
2864
3010
  if (wantBigintFsStats) {
2865
- this._stat = (path25) => statMethod(path25, { bigint: true });
3011
+ this._stat = (path27) => statMethod(path27, { bigint: true });
2866
3012
  } else {
2867
3013
  this._stat = statMethod;
2868
3014
  }
@@ -2887,8 +3033,8 @@ var ReaddirpStream = class extends Readable {
2887
3033
  const par = this.parent;
2888
3034
  const fil = par && par.files;
2889
3035
  if (fil && fil.length > 0) {
2890
- const { path: path25, depth } = par;
2891
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path25));
3036
+ const { path: path27, depth } = par;
3037
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path27));
2892
3038
  const awaited = await Promise.all(slice);
2893
3039
  for (const entry of awaited) {
2894
3040
  if (!entry)
@@ -2928,20 +3074,20 @@ var ReaddirpStream = class extends Readable {
2928
3074
  this.reading = false;
2929
3075
  }
2930
3076
  }
2931
- async _exploreDir(path25, depth) {
3077
+ async _exploreDir(path27, depth) {
2932
3078
  let files;
2933
3079
  try {
2934
- files = await readdir(path25, this._rdOptions);
3080
+ files = await readdir(path27, this._rdOptions);
2935
3081
  } catch (error) {
2936
3082
  this._onError(error);
2937
3083
  }
2938
- return { files, depth, path: path25 };
3084
+ return { files, depth, path: path27 };
2939
3085
  }
2940
- async _formatEntry(dirent, path25) {
3086
+ async _formatEntry(dirent, path27) {
2941
3087
  let entry;
2942
3088
  const basename4 = this._isDirent ? dirent.name : dirent;
2943
3089
  try {
2944
- const fullPath = presolve(pjoin(path25, basename4));
3090
+ const fullPath = presolve(pjoin(path27, basename4));
2945
3091
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
2946
3092
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
2947
3093
  } catch (err) {
@@ -3342,16 +3488,16 @@ var delFromSet = (main, prop, item) => {
3342
3488
  };
3343
3489
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
3344
3490
  var FsWatchInstances = /* @__PURE__ */ new Map();
3345
- function createFsWatchInstance(path25, options, listener, errHandler, emitRaw) {
3491
+ function createFsWatchInstance(path27, options, listener, errHandler, emitRaw) {
3346
3492
  const handleEvent = (rawEvent, evPath) => {
3347
- listener(path25);
3348
- emitRaw(rawEvent, evPath, { watchedPath: path25 });
3349
- if (evPath && path25 !== evPath) {
3350
- fsWatchBroadcast(sysPath.resolve(path25, evPath), KEY_LISTENERS, sysPath.join(path25, evPath));
3493
+ listener(path27);
3494
+ emitRaw(rawEvent, evPath, { watchedPath: path27 });
3495
+ if (evPath && path27 !== evPath) {
3496
+ fsWatchBroadcast(sysPath.resolve(path27, evPath), KEY_LISTENERS, sysPath.join(path27, evPath));
3351
3497
  }
3352
3498
  };
3353
3499
  try {
3354
- return fs_watch(path25, {
3500
+ return fs_watch(path27, {
3355
3501
  persistent: options.persistent
3356
3502
  }, handleEvent);
3357
3503
  } catch (error) {
@@ -3367,12 +3513,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
3367
3513
  listener(val1, val2, val3);
3368
3514
  });
3369
3515
  };
3370
- var setFsWatchListener = (path25, fullPath, options, handlers) => {
3516
+ var setFsWatchListener = (path27, fullPath, options, handlers) => {
3371
3517
  const { listener, errHandler, rawEmitter } = handlers;
3372
3518
  let cont = FsWatchInstances.get(fullPath);
3373
3519
  let watcher;
3374
3520
  if (!options.persistent) {
3375
- watcher = createFsWatchInstance(path25, options, listener, errHandler, rawEmitter);
3521
+ watcher = createFsWatchInstance(path27, options, listener, errHandler, rawEmitter);
3376
3522
  if (!watcher)
3377
3523
  return;
3378
3524
  return watcher.close.bind(watcher);
@@ -3383,7 +3529,7 @@ var setFsWatchListener = (path25, fullPath, options, handlers) => {
3383
3529
  addAndConvert(cont, KEY_RAW, rawEmitter);
3384
3530
  } else {
3385
3531
  watcher = createFsWatchInstance(
3386
- path25,
3532
+ path27,
3387
3533
  options,
3388
3534
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
3389
3535
  errHandler,
@@ -3398,7 +3544,7 @@ var setFsWatchListener = (path25, fullPath, options, handlers) => {
3398
3544
  cont.watcherUnusable = true;
3399
3545
  if (isWindows && error.code === "EPERM") {
3400
3546
  try {
3401
- const fd = await open(path25, "r");
3547
+ const fd = await open(path27, "r");
3402
3548
  await fd.close();
3403
3549
  broadcastErr(error);
3404
3550
  } catch (err) {
@@ -3429,7 +3575,7 @@ var setFsWatchListener = (path25, fullPath, options, handlers) => {
3429
3575
  };
3430
3576
  };
3431
3577
  var FsWatchFileInstances = /* @__PURE__ */ new Map();
3432
- var setFsWatchFileListener = (path25, fullPath, options, handlers) => {
3578
+ var setFsWatchFileListener = (path27, fullPath, options, handlers) => {
3433
3579
  const { listener, rawEmitter } = handlers;
3434
3580
  let cont = FsWatchFileInstances.get(fullPath);
3435
3581
  const copts = cont && cont.options;
@@ -3451,7 +3597,7 @@ var setFsWatchFileListener = (path25, fullPath, options, handlers) => {
3451
3597
  });
3452
3598
  const currmtime = curr.mtimeMs;
3453
3599
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
3454
- foreach(cont.listeners, (listener2) => listener2(path25, curr));
3600
+ foreach(cont.listeners, (listener2) => listener2(path27, curr));
3455
3601
  }
3456
3602
  })
3457
3603
  };
@@ -3479,13 +3625,13 @@ var NodeFsHandler = class {
3479
3625
  * @param listener on fs change
3480
3626
  * @returns closer for the watcher instance
3481
3627
  */
3482
- _watchWithNodeFs(path25, listener) {
3628
+ _watchWithNodeFs(path27, listener) {
3483
3629
  const opts = this.fsw.options;
3484
- const directory = sysPath.dirname(path25);
3485
- const basename4 = sysPath.basename(path25);
3630
+ const directory = sysPath.dirname(path27);
3631
+ const basename4 = sysPath.basename(path27);
3486
3632
  const parent = this.fsw._getWatchedDir(directory);
3487
3633
  parent.add(basename4);
3488
- const absolutePath = sysPath.resolve(path25);
3634
+ const absolutePath = sysPath.resolve(path27);
3489
3635
  const options = {
3490
3636
  persistent: opts.persistent
3491
3637
  };
@@ -3495,12 +3641,12 @@ var NodeFsHandler = class {
3495
3641
  if (opts.usePolling) {
3496
3642
  const enableBin = opts.interval !== opts.binaryInterval;
3497
3643
  options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
3498
- closer = setFsWatchFileListener(path25, absolutePath, options, {
3644
+ closer = setFsWatchFileListener(path27, absolutePath, options, {
3499
3645
  listener,
3500
3646
  rawEmitter: this.fsw._emitRaw
3501
3647
  });
3502
3648
  } else {
3503
- closer = setFsWatchListener(path25, absolutePath, options, {
3649
+ closer = setFsWatchListener(path27, absolutePath, options, {
3504
3650
  listener,
3505
3651
  errHandler: this._boundHandleError,
3506
3652
  rawEmitter: this.fsw._emitRaw
@@ -3522,7 +3668,7 @@ var NodeFsHandler = class {
3522
3668
  let prevStats = stats;
3523
3669
  if (parent.has(basename4))
3524
3670
  return;
3525
- const listener = async (path25, newStats) => {
3671
+ const listener = async (path27, newStats) => {
3526
3672
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
3527
3673
  return;
3528
3674
  if (!newStats || newStats.mtimeMs === 0) {
@@ -3536,11 +3682,11 @@ var NodeFsHandler = class {
3536
3682
  this.fsw._emit(EV.CHANGE, file, newStats2);
3537
3683
  }
3538
3684
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
3539
- this.fsw._closeFile(path25);
3685
+ this.fsw._closeFile(path27);
3540
3686
  prevStats = newStats2;
3541
3687
  const closer2 = this._watchWithNodeFs(file, listener);
3542
3688
  if (closer2)
3543
- this.fsw._addPathCloser(path25, closer2);
3689
+ this.fsw._addPathCloser(path27, closer2);
3544
3690
  } else {
3545
3691
  prevStats = newStats2;
3546
3692
  }
@@ -3572,7 +3718,7 @@ var NodeFsHandler = class {
3572
3718
  * @param item basename of this item
3573
3719
  * @returns true if no more processing is needed for this entry.
3574
3720
  */
3575
- async _handleSymlink(entry, directory, path25, item) {
3721
+ async _handleSymlink(entry, directory, path27, item) {
3576
3722
  if (this.fsw.closed) {
3577
3723
  return;
3578
3724
  }
@@ -3582,7 +3728,7 @@ var NodeFsHandler = class {
3582
3728
  this.fsw._incrReadyCount();
3583
3729
  let linkPath;
3584
3730
  try {
3585
- linkPath = await fsrealpath(path25);
3731
+ linkPath = await fsrealpath(path27);
3586
3732
  } catch (e) {
3587
3733
  this.fsw._emitReady();
3588
3734
  return true;
@@ -3592,12 +3738,12 @@ var NodeFsHandler = class {
3592
3738
  if (dir.has(item)) {
3593
3739
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
3594
3740
  this.fsw._symlinkPaths.set(full, linkPath);
3595
- this.fsw._emit(EV.CHANGE, path25, entry.stats);
3741
+ this.fsw._emit(EV.CHANGE, path27, entry.stats);
3596
3742
  }
3597
3743
  } else {
3598
3744
  dir.add(item);
3599
3745
  this.fsw._symlinkPaths.set(full, linkPath);
3600
- this.fsw._emit(EV.ADD, path25, entry.stats);
3746
+ this.fsw._emit(EV.ADD, path27, entry.stats);
3601
3747
  }
3602
3748
  this.fsw._emitReady();
3603
3749
  return true;
@@ -3626,9 +3772,9 @@ var NodeFsHandler = class {
3626
3772
  return;
3627
3773
  }
3628
3774
  const item = entry.path;
3629
- let path25 = sysPath.join(directory, item);
3775
+ let path27 = sysPath.join(directory, item);
3630
3776
  current2.add(item);
3631
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path25, item)) {
3777
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path27, item)) {
3632
3778
  return;
3633
3779
  }
3634
3780
  if (this.fsw.closed) {
@@ -3637,8 +3783,8 @@ var NodeFsHandler = class {
3637
3783
  }
3638
3784
  if (item === target || !target && !previous.has(item)) {
3639
3785
  this.fsw._incrReadyCount();
3640
- path25 = sysPath.join(dir, sysPath.relative(dir, path25));
3641
- this._addToNodeFs(path25, initialAdd, wh, depth + 1);
3786
+ path27 = sysPath.join(dir, sysPath.relative(dir, path27));
3787
+ this._addToNodeFs(path27, initialAdd, wh, depth + 1);
3642
3788
  }
3643
3789
  }).on(EV.ERROR, this._boundHandleError);
3644
3790
  return new Promise((resolve8, reject) => {
@@ -3707,13 +3853,13 @@ var NodeFsHandler = class {
3707
3853
  * @param depth Child path actually targeted for watch
3708
3854
  * @param target Child path actually targeted for watch
3709
3855
  */
3710
- async _addToNodeFs(path25, initialAdd, priorWh, depth, target) {
3856
+ async _addToNodeFs(path27, initialAdd, priorWh, depth, target) {
3711
3857
  const ready = this.fsw._emitReady;
3712
- if (this.fsw._isIgnored(path25) || this.fsw.closed) {
3858
+ if (this.fsw._isIgnored(path27) || this.fsw.closed) {
3713
3859
  ready();
3714
3860
  return false;
3715
3861
  }
3716
- const wh = this.fsw._getWatchHelpers(path25);
3862
+ const wh = this.fsw._getWatchHelpers(path27);
3717
3863
  if (priorWh) {
3718
3864
  wh.filterPath = (entry) => priorWh.filterPath(entry);
3719
3865
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -3729,8 +3875,8 @@ var NodeFsHandler = class {
3729
3875
  const follow = this.fsw.options.followSymlinks;
3730
3876
  let closer;
3731
3877
  if (stats.isDirectory()) {
3732
- const absPath = sysPath.resolve(path25);
3733
- const targetPath = follow ? await fsrealpath(path25) : path25;
3878
+ const absPath = sysPath.resolve(path27);
3879
+ const targetPath = follow ? await fsrealpath(path27) : path27;
3734
3880
  if (this.fsw.closed)
3735
3881
  return;
3736
3882
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -3740,29 +3886,29 @@ var NodeFsHandler = class {
3740
3886
  this.fsw._symlinkPaths.set(absPath, targetPath);
3741
3887
  }
3742
3888
  } else if (stats.isSymbolicLink()) {
3743
- const targetPath = follow ? await fsrealpath(path25) : path25;
3889
+ const targetPath = follow ? await fsrealpath(path27) : path27;
3744
3890
  if (this.fsw.closed)
3745
3891
  return;
3746
3892
  const parent = sysPath.dirname(wh.watchPath);
3747
3893
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
3748
3894
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
3749
- closer = await this._handleDir(parent, stats, initialAdd, depth, path25, wh, targetPath);
3895
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path27, wh, targetPath);
3750
3896
  if (this.fsw.closed)
3751
3897
  return;
3752
3898
  if (targetPath !== void 0) {
3753
- this.fsw._symlinkPaths.set(sysPath.resolve(path25), targetPath);
3899
+ this.fsw._symlinkPaths.set(sysPath.resolve(path27), targetPath);
3754
3900
  }
3755
3901
  } else {
3756
3902
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
3757
3903
  }
3758
3904
  ready();
3759
3905
  if (closer)
3760
- this.fsw._addPathCloser(path25, closer);
3906
+ this.fsw._addPathCloser(path27, closer);
3761
3907
  return false;
3762
3908
  } catch (error) {
3763
3909
  if (this.fsw._handleError(error)) {
3764
3910
  ready();
3765
- return path25;
3911
+ return path27;
3766
3912
  }
3767
3913
  }
3768
3914
  }
@@ -3805,26 +3951,26 @@ function createPattern(matcher) {
3805
3951
  }
3806
3952
  return () => false;
3807
3953
  }
3808
- function normalizePath(path25) {
3809
- if (typeof path25 !== "string")
3954
+ function normalizePath(path27) {
3955
+ if (typeof path27 !== "string")
3810
3956
  throw new Error("string expected");
3811
- path25 = sysPath2.normalize(path25);
3812
- path25 = path25.replace(/\\/g, "/");
3957
+ path27 = sysPath2.normalize(path27);
3958
+ path27 = path27.replace(/\\/g, "/");
3813
3959
  let prepend = false;
3814
- if (path25.startsWith("//"))
3960
+ if (path27.startsWith("//"))
3815
3961
  prepend = true;
3816
3962
  const DOUBLE_SLASH_RE2 = /\/\//;
3817
- while (path25.match(DOUBLE_SLASH_RE2))
3818
- path25 = path25.replace(DOUBLE_SLASH_RE2, "/");
3963
+ while (path27.match(DOUBLE_SLASH_RE2))
3964
+ path27 = path27.replace(DOUBLE_SLASH_RE2, "/");
3819
3965
  if (prepend)
3820
- path25 = "/" + path25;
3821
- return path25;
3966
+ path27 = "/" + path27;
3967
+ return path27;
3822
3968
  }
3823
3969
  function matchPatterns(patterns, testString, stats) {
3824
- const path25 = normalizePath(testString);
3970
+ const path27 = normalizePath(testString);
3825
3971
  for (let index = 0; index < patterns.length; index++) {
3826
3972
  const pattern = patterns[index];
3827
- if (pattern(path25, stats)) {
3973
+ if (pattern(path27, stats)) {
3828
3974
  return true;
3829
3975
  }
3830
3976
  }
@@ -3864,19 +4010,19 @@ var toUnix = (string) => {
3864
4010
  }
3865
4011
  return str;
3866
4012
  };
3867
- var normalizePathToUnix = (path25) => toUnix(sysPath2.normalize(toUnix(path25)));
3868
- var normalizeIgnored = (cwd = "") => (path25) => {
3869
- if (typeof path25 === "string") {
3870
- return normalizePathToUnix(sysPath2.isAbsolute(path25) ? path25 : sysPath2.join(cwd, path25));
4013
+ var normalizePathToUnix = (path27) => toUnix(sysPath2.normalize(toUnix(path27)));
4014
+ var normalizeIgnored = (cwd = "") => (path27) => {
4015
+ if (typeof path27 === "string") {
4016
+ return normalizePathToUnix(sysPath2.isAbsolute(path27) ? path27 : sysPath2.join(cwd, path27));
3871
4017
  } else {
3872
- return path25;
4018
+ return path27;
3873
4019
  }
3874
4020
  };
3875
- var getAbsolutePath = (path25, cwd) => {
3876
- if (sysPath2.isAbsolute(path25)) {
3877
- return path25;
4021
+ var getAbsolutePath = (path27, cwd) => {
4022
+ if (sysPath2.isAbsolute(path27)) {
4023
+ return path27;
3878
4024
  }
3879
- return sysPath2.join(cwd, path25);
4025
+ return sysPath2.join(cwd, path27);
3880
4026
  };
3881
4027
  var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
3882
4028
  var DirEntry = class {
@@ -3931,10 +4077,10 @@ var DirEntry = class {
3931
4077
  var STAT_METHOD_F = "stat";
3932
4078
  var STAT_METHOD_L = "lstat";
3933
4079
  var WatchHelper = class {
3934
- constructor(path25, follow, fsw) {
4080
+ constructor(path27, follow, fsw) {
3935
4081
  this.fsw = fsw;
3936
- const watchPath = path25;
3937
- this.path = path25 = path25.replace(REPLACER_RE, "");
4082
+ const watchPath = path27;
4083
+ this.path = path27 = path27.replace(REPLACER_RE, "");
3938
4084
  this.watchPath = watchPath;
3939
4085
  this.fullWatchPath = sysPath2.resolve(watchPath);
3940
4086
  this.dirParts = [];
@@ -4056,20 +4202,20 @@ var FSWatcher = class extends EventEmitter {
4056
4202
  this._closePromise = void 0;
4057
4203
  let paths = unifyPaths(paths_);
4058
4204
  if (cwd) {
4059
- paths = paths.map((path25) => {
4060
- const absPath = getAbsolutePath(path25, cwd);
4205
+ paths = paths.map((path27) => {
4206
+ const absPath = getAbsolutePath(path27, cwd);
4061
4207
  return absPath;
4062
4208
  });
4063
4209
  }
4064
- paths.forEach((path25) => {
4065
- this._removeIgnoredPath(path25);
4210
+ paths.forEach((path27) => {
4211
+ this._removeIgnoredPath(path27);
4066
4212
  });
4067
4213
  this._userIgnored = void 0;
4068
4214
  if (!this._readyCount)
4069
4215
  this._readyCount = 0;
4070
4216
  this._readyCount += paths.length;
4071
- Promise.all(paths.map(async (path25) => {
4072
- const res = await this._nodeFsHandler._addToNodeFs(path25, !_internal, void 0, 0, _origAdd);
4217
+ Promise.all(paths.map(async (path27) => {
4218
+ const res = await this._nodeFsHandler._addToNodeFs(path27, !_internal, void 0, 0, _origAdd);
4073
4219
  if (res)
4074
4220
  this._emitReady();
4075
4221
  return res;
@@ -4091,17 +4237,17 @@ var FSWatcher = class extends EventEmitter {
4091
4237
  return this;
4092
4238
  const paths = unifyPaths(paths_);
4093
4239
  const { cwd } = this.options;
4094
- paths.forEach((path25) => {
4095
- if (!sysPath2.isAbsolute(path25) && !this._closers.has(path25)) {
4240
+ paths.forEach((path27) => {
4241
+ if (!sysPath2.isAbsolute(path27) && !this._closers.has(path27)) {
4096
4242
  if (cwd)
4097
- path25 = sysPath2.join(cwd, path25);
4098
- path25 = sysPath2.resolve(path25);
4243
+ path27 = sysPath2.join(cwd, path27);
4244
+ path27 = sysPath2.resolve(path27);
4099
4245
  }
4100
- this._closePath(path25);
4101
- this._addIgnoredPath(path25);
4102
- if (this._watched.has(path25)) {
4246
+ this._closePath(path27);
4247
+ this._addIgnoredPath(path27);
4248
+ if (this._watched.has(path27)) {
4103
4249
  this._addIgnoredPath({
4104
- path: path25,
4250
+ path: path27,
4105
4251
  recursive: true
4106
4252
  });
4107
4253
  }
@@ -4165,38 +4311,38 @@ var FSWatcher = class extends EventEmitter {
4165
4311
  * @param stats arguments to be passed with event
4166
4312
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
4167
4313
  */
4168
- async _emit(event, path25, stats) {
4314
+ async _emit(event, path27, stats) {
4169
4315
  if (this.closed)
4170
4316
  return;
4171
4317
  const opts = this.options;
4172
4318
  if (isWindows)
4173
- path25 = sysPath2.normalize(path25);
4319
+ path27 = sysPath2.normalize(path27);
4174
4320
  if (opts.cwd)
4175
- path25 = sysPath2.relative(opts.cwd, path25);
4176
- const args = [path25];
4321
+ path27 = sysPath2.relative(opts.cwd, path27);
4322
+ const args = [path27];
4177
4323
  if (stats != null)
4178
4324
  args.push(stats);
4179
4325
  const awf = opts.awaitWriteFinish;
4180
4326
  let pw;
4181
- if (awf && (pw = this._pendingWrites.get(path25))) {
4327
+ if (awf && (pw = this._pendingWrites.get(path27))) {
4182
4328
  pw.lastChange = /* @__PURE__ */ new Date();
4183
4329
  return this;
4184
4330
  }
4185
4331
  if (opts.atomic) {
4186
4332
  if (event === EVENTS.UNLINK) {
4187
- this._pendingUnlinks.set(path25, [event, ...args]);
4333
+ this._pendingUnlinks.set(path27, [event, ...args]);
4188
4334
  setTimeout(() => {
4189
- this._pendingUnlinks.forEach((entry, path26) => {
4335
+ this._pendingUnlinks.forEach((entry, path28) => {
4190
4336
  this.emit(...entry);
4191
4337
  this.emit(EVENTS.ALL, ...entry);
4192
- this._pendingUnlinks.delete(path26);
4338
+ this._pendingUnlinks.delete(path28);
4193
4339
  });
4194
4340
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
4195
4341
  return this;
4196
4342
  }
4197
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path25)) {
4343
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path27)) {
4198
4344
  event = EVENTS.CHANGE;
4199
- this._pendingUnlinks.delete(path25);
4345
+ this._pendingUnlinks.delete(path27);
4200
4346
  }
4201
4347
  }
4202
4348
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -4214,16 +4360,16 @@ var FSWatcher = class extends EventEmitter {
4214
4360
  this.emitWithAll(event, args);
4215
4361
  }
4216
4362
  };
4217
- this._awaitWriteFinish(path25, awf.stabilityThreshold, event, awfEmit);
4363
+ this._awaitWriteFinish(path27, awf.stabilityThreshold, event, awfEmit);
4218
4364
  return this;
4219
4365
  }
4220
4366
  if (event === EVENTS.CHANGE) {
4221
- const isThrottled = !this._throttle(EVENTS.CHANGE, path25, 50);
4367
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path27, 50);
4222
4368
  if (isThrottled)
4223
4369
  return this;
4224
4370
  }
4225
4371
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
4226
- const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path25) : path25;
4372
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path27) : path27;
4227
4373
  let stats2;
4228
4374
  try {
4229
4375
  stats2 = await stat3(fullPath);
@@ -4254,23 +4400,23 @@ var FSWatcher = class extends EventEmitter {
4254
4400
  * @param timeout duration of time to suppress duplicate actions
4255
4401
  * @returns tracking object or false if action should be suppressed
4256
4402
  */
4257
- _throttle(actionType, path25, timeout) {
4403
+ _throttle(actionType, path27, timeout) {
4258
4404
  if (!this._throttled.has(actionType)) {
4259
4405
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
4260
4406
  }
4261
4407
  const action = this._throttled.get(actionType);
4262
4408
  if (!action)
4263
4409
  throw new Error("invalid throttle");
4264
- const actionPath = action.get(path25);
4410
+ const actionPath = action.get(path27);
4265
4411
  if (actionPath) {
4266
4412
  actionPath.count++;
4267
4413
  return false;
4268
4414
  }
4269
4415
  let timeoutObject;
4270
4416
  const clear = () => {
4271
- const item = action.get(path25);
4417
+ const item = action.get(path27);
4272
4418
  const count = item ? item.count : 0;
4273
- action.delete(path25);
4419
+ action.delete(path27);
4274
4420
  clearTimeout(timeoutObject);
4275
4421
  if (item)
4276
4422
  clearTimeout(item.timeoutObject);
@@ -4278,7 +4424,7 @@ var FSWatcher = class extends EventEmitter {
4278
4424
  };
4279
4425
  timeoutObject = setTimeout(clear, timeout);
4280
4426
  const thr = { timeoutObject, clear, count: 0 };
4281
- action.set(path25, thr);
4427
+ action.set(path27, thr);
4282
4428
  return thr;
4283
4429
  }
4284
4430
  _incrReadyCount() {
@@ -4292,44 +4438,44 @@ var FSWatcher = class extends EventEmitter {
4292
4438
  * @param event
4293
4439
  * @param awfEmit Callback to be called when ready for event to be emitted.
4294
4440
  */
4295
- _awaitWriteFinish(path25, threshold, event, awfEmit) {
4441
+ _awaitWriteFinish(path27, threshold, event, awfEmit) {
4296
4442
  const awf = this.options.awaitWriteFinish;
4297
4443
  if (typeof awf !== "object")
4298
4444
  return;
4299
4445
  const pollInterval = awf.pollInterval;
4300
4446
  let timeoutHandler;
4301
- let fullPath = path25;
4302
- if (this.options.cwd && !sysPath2.isAbsolute(path25)) {
4303
- fullPath = sysPath2.join(this.options.cwd, path25);
4447
+ let fullPath = path27;
4448
+ if (this.options.cwd && !sysPath2.isAbsolute(path27)) {
4449
+ fullPath = sysPath2.join(this.options.cwd, path27);
4304
4450
  }
4305
4451
  const now = /* @__PURE__ */ new Date();
4306
4452
  const writes = this._pendingWrites;
4307
4453
  function awaitWriteFinishFn(prevStat) {
4308
4454
  statcb(fullPath, (err, curStat) => {
4309
- if (err || !writes.has(path25)) {
4455
+ if (err || !writes.has(path27)) {
4310
4456
  if (err && err.code !== "ENOENT")
4311
4457
  awfEmit(err);
4312
4458
  return;
4313
4459
  }
4314
4460
  const now2 = Number(/* @__PURE__ */ new Date());
4315
4461
  if (prevStat && curStat.size !== prevStat.size) {
4316
- writes.get(path25).lastChange = now2;
4462
+ writes.get(path27).lastChange = now2;
4317
4463
  }
4318
- const pw = writes.get(path25);
4464
+ const pw = writes.get(path27);
4319
4465
  const df = now2 - pw.lastChange;
4320
4466
  if (df >= threshold) {
4321
- writes.delete(path25);
4467
+ writes.delete(path27);
4322
4468
  awfEmit(void 0, curStat);
4323
4469
  } else {
4324
4470
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
4325
4471
  }
4326
4472
  });
4327
4473
  }
4328
- if (!writes.has(path25)) {
4329
- writes.set(path25, {
4474
+ if (!writes.has(path27)) {
4475
+ writes.set(path27, {
4330
4476
  lastChange: now,
4331
4477
  cancelWait: () => {
4332
- writes.delete(path25);
4478
+ writes.delete(path27);
4333
4479
  clearTimeout(timeoutHandler);
4334
4480
  return event;
4335
4481
  }
@@ -4340,8 +4486,8 @@ var FSWatcher = class extends EventEmitter {
4340
4486
  /**
4341
4487
  * Determines whether user has asked to ignore this path.
4342
4488
  */
4343
- _isIgnored(path25, stats) {
4344
- if (this.options.atomic && DOT_RE.test(path25))
4489
+ _isIgnored(path27, stats) {
4490
+ if (this.options.atomic && DOT_RE.test(path27))
4345
4491
  return true;
4346
4492
  if (!this._userIgnored) {
4347
4493
  const { cwd } = this.options;
@@ -4351,17 +4497,17 @@ var FSWatcher = class extends EventEmitter {
4351
4497
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
4352
4498
  this._userIgnored = anymatch(list, void 0);
4353
4499
  }
4354
- return this._userIgnored(path25, stats);
4500
+ return this._userIgnored(path27, stats);
4355
4501
  }
4356
- _isntIgnored(path25, stat6) {
4357
- return !this._isIgnored(path25, stat6);
4502
+ _isntIgnored(path27, stat6) {
4503
+ return !this._isIgnored(path27, stat6);
4358
4504
  }
4359
4505
  /**
4360
4506
  * Provides a set of common helpers and properties relating to symlink handling.
4361
4507
  * @param path file or directory pattern being watched
4362
4508
  */
4363
- _getWatchHelpers(path25) {
4364
- return new WatchHelper(path25, this.options.followSymlinks, this);
4509
+ _getWatchHelpers(path27) {
4510
+ return new WatchHelper(path27, this.options.followSymlinks, this);
4365
4511
  }
4366
4512
  // Directory helpers
4367
4513
  // -----------------
@@ -4393,63 +4539,63 @@ var FSWatcher = class extends EventEmitter {
4393
4539
  * @param item base path of item/directory
4394
4540
  */
4395
4541
  _remove(directory, item, isDirectory) {
4396
- const path25 = sysPath2.join(directory, item);
4397
- const fullPath = sysPath2.resolve(path25);
4398
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path25) || this._watched.has(fullPath);
4399
- if (!this._throttle("remove", path25, 100))
4542
+ const path27 = sysPath2.join(directory, item);
4543
+ const fullPath = sysPath2.resolve(path27);
4544
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path27) || this._watched.has(fullPath);
4545
+ if (!this._throttle("remove", path27, 100))
4400
4546
  return;
4401
4547
  if (!isDirectory && this._watched.size === 1) {
4402
4548
  this.add(directory, item, true);
4403
4549
  }
4404
- const wp = this._getWatchedDir(path25);
4550
+ const wp = this._getWatchedDir(path27);
4405
4551
  const nestedDirectoryChildren = wp.getChildren();
4406
- nestedDirectoryChildren.forEach((nested) => this._remove(path25, nested));
4552
+ nestedDirectoryChildren.forEach((nested) => this._remove(path27, nested));
4407
4553
  const parent = this._getWatchedDir(directory);
4408
4554
  const wasTracked = parent.has(item);
4409
4555
  parent.remove(item);
4410
4556
  if (this._symlinkPaths.has(fullPath)) {
4411
4557
  this._symlinkPaths.delete(fullPath);
4412
4558
  }
4413
- let relPath = path25;
4559
+ let relPath = path27;
4414
4560
  if (this.options.cwd)
4415
- relPath = sysPath2.relative(this.options.cwd, path25);
4561
+ relPath = sysPath2.relative(this.options.cwd, path27);
4416
4562
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
4417
4563
  const event = this._pendingWrites.get(relPath).cancelWait();
4418
4564
  if (event === EVENTS.ADD)
4419
4565
  return;
4420
4566
  }
4421
- this._watched.delete(path25);
4567
+ this._watched.delete(path27);
4422
4568
  this._watched.delete(fullPath);
4423
4569
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
4424
- if (wasTracked && !this._isIgnored(path25))
4425
- this._emit(eventName, path25);
4426
- this._closePath(path25);
4570
+ if (wasTracked && !this._isIgnored(path27))
4571
+ this._emit(eventName, path27);
4572
+ this._closePath(path27);
4427
4573
  }
4428
4574
  /**
4429
4575
  * Closes all watchers for a path
4430
4576
  */
4431
- _closePath(path25) {
4432
- this._closeFile(path25);
4433
- const dir = sysPath2.dirname(path25);
4434
- this._getWatchedDir(dir).remove(sysPath2.basename(path25));
4577
+ _closePath(path27) {
4578
+ this._closeFile(path27);
4579
+ const dir = sysPath2.dirname(path27);
4580
+ this._getWatchedDir(dir).remove(sysPath2.basename(path27));
4435
4581
  }
4436
4582
  /**
4437
4583
  * Closes only file-specific watchers
4438
4584
  */
4439
- _closeFile(path25) {
4440
- const closers = this._closers.get(path25);
4585
+ _closeFile(path27) {
4586
+ const closers = this._closers.get(path27);
4441
4587
  if (!closers)
4442
4588
  return;
4443
4589
  closers.forEach((closer) => closer());
4444
- this._closers.delete(path25);
4590
+ this._closers.delete(path27);
4445
4591
  }
4446
- _addPathCloser(path25, closer) {
4592
+ _addPathCloser(path27, closer) {
4447
4593
  if (!closer)
4448
4594
  return;
4449
- let list = this._closers.get(path25);
4595
+ let list = this._closers.get(path27);
4450
4596
  if (!list) {
4451
4597
  list = [];
4452
- this._closers.set(path25, list);
4598
+ this._closers.set(path27, list);
4453
4599
  }
4454
4600
  list.push(closer);
4455
4601
  }
@@ -4479,7 +4625,7 @@ function watch(paths, options = {}) {
4479
4625
  var esm_default = { watch, FSWatcher };
4480
4626
 
4481
4627
  // src/runtime/buildPlugin.ts
4482
- import path6 from "pathe";
4628
+ import path8 from "pathe";
4483
4629
 
4484
4630
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/index.js
4485
4631
  init_esm_shims();
@@ -5166,11 +5312,11 @@ var qmarksTestNoExtDot = ([$0]) => {
5166
5312
  return (f) => f.length === len && f !== "." && f !== "..";
5167
5313
  };
5168
5314
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
5169
- var path5 = {
5315
+ var path7 = {
5170
5316
  win32: { sep: "\\" },
5171
5317
  posix: { sep: "/" }
5172
5318
  };
5173
- var sep = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
5319
+ var sep = defaultPlatform === "win32" ? path7.win32.sep : path7.posix.sep;
5174
5320
  minimatch.sep = sep;
5175
5321
  var GLOBSTAR = Symbol("globstar **");
5176
5322
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -6981,12 +7127,12 @@ var PathBase = class {
6981
7127
  /**
6982
7128
  * Get the Path object referenced by the string path, resolved from this Path
6983
7129
  */
6984
- resolve(path25) {
6985
- if (!path25) {
7130
+ resolve(path27) {
7131
+ if (!path27) {
6986
7132
  return this;
6987
7133
  }
6988
- const rootPath = this.getRootString(path25);
6989
- const dir = path25.substring(rootPath.length);
7134
+ const rootPath = this.getRootString(path27);
7135
+ const dir = path27.substring(rootPath.length);
6990
7136
  const dirParts = dir.split(this.splitSep);
6991
7137
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
6992
7138
  return result;
@@ -7738,8 +7884,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
7738
7884
  /**
7739
7885
  * @internal
7740
7886
  */
7741
- getRootString(path25) {
7742
- return win32.parse(path25).root;
7887
+ getRootString(path27) {
7888
+ return win32.parse(path27).root;
7743
7889
  }
7744
7890
  /**
7745
7891
  * @internal
@@ -7785,8 +7931,8 @@ var PathPosix = class _PathPosix extends PathBase {
7785
7931
  /**
7786
7932
  * @internal
7787
7933
  */
7788
- getRootString(path25) {
7789
- return path25.startsWith("/") ? "/" : "";
7934
+ getRootString(path27) {
7935
+ return path27.startsWith("/") ? "/" : "";
7790
7936
  }
7791
7937
  /**
7792
7938
  * @internal
@@ -7835,8 +7981,8 @@ var PathScurryBase = class {
7835
7981
  *
7836
7982
  * @internal
7837
7983
  */
7838
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs19 = defaultFS } = {}) {
7839
- this.#fs = fsFromOption(fs19);
7984
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs21 = defaultFS } = {}) {
7985
+ this.#fs = fsFromOption(fs21);
7840
7986
  if (cwd instanceof URL || cwd.startsWith("file://")) {
7841
7987
  cwd = fileURLToPath(cwd);
7842
7988
  }
@@ -7875,11 +8021,11 @@ var PathScurryBase = class {
7875
8021
  /**
7876
8022
  * Get the depth of a provided path, string, or the cwd
7877
8023
  */
7878
- depth(path25 = this.cwd) {
7879
- if (typeof path25 === "string") {
7880
- path25 = this.cwd.resolve(path25);
8024
+ depth(path27 = this.cwd) {
8025
+ if (typeof path27 === "string") {
8026
+ path27 = this.cwd.resolve(path27);
7881
8027
  }
7882
- return path25.depth();
8028
+ return path27.depth();
7883
8029
  }
7884
8030
  /**
7885
8031
  * Return the cache of child entries. Exposed so subclasses can create
@@ -8366,9 +8512,9 @@ var PathScurryBase = class {
8366
8512
  process9();
8367
8513
  return results;
8368
8514
  }
8369
- chdir(path25 = this.cwd) {
8515
+ chdir(path27 = this.cwd) {
8370
8516
  const oldCwd = this.cwd;
8371
- this.cwd = typeof path25 === "string" ? this.cwd.resolve(path25) : path25;
8517
+ this.cwd = typeof path27 === "string" ? this.cwd.resolve(path27) : path27;
8372
8518
  this.cwd[setAsCwd](oldCwd);
8373
8519
  }
8374
8520
  };
@@ -8394,8 +8540,8 @@ var PathScurryWin32 = class extends PathScurryBase {
8394
8540
  /**
8395
8541
  * @internal
8396
8542
  */
8397
- newRoot(fs19) {
8398
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs19 });
8543
+ newRoot(fs21) {
8544
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs21 });
8399
8545
  }
8400
8546
  /**
8401
8547
  * Return true if the provided path string is an absolute path
@@ -8423,8 +8569,8 @@ var PathScurryPosix = class extends PathScurryBase {
8423
8569
  /**
8424
8570
  * @internal
8425
8571
  */
8426
- newRoot(fs19) {
8427
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs19 });
8572
+ newRoot(fs21) {
8573
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs21 });
8428
8574
  }
8429
8575
  /**
8430
8576
  * Return true if the provided path string is an absolute path
@@ -8730,8 +8876,8 @@ var MatchRecord = class {
8730
8876
  }
8731
8877
  // match, absolute, ifdir
8732
8878
  entries() {
8733
- return [...this.store.entries()].map(([path25, n2]) => [
8734
- path25,
8879
+ return [...this.store.entries()].map(([path27, n2]) => [
8880
+ path27,
8735
8881
  !!(n2 & 2),
8736
8882
  !!(n2 & 1)
8737
8883
  ]);
@@ -8936,9 +9082,9 @@ var GlobUtil = class {
8936
9082
  signal;
8937
9083
  maxDepth;
8938
9084
  includeChildMatches;
8939
- constructor(patterns, path25, opts) {
9085
+ constructor(patterns, path27, opts) {
8940
9086
  this.patterns = patterns;
8941
- this.path = path25;
9087
+ this.path = path27;
8942
9088
  this.opts = opts;
8943
9089
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
8944
9090
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -8957,11 +9103,11 @@ var GlobUtil = class {
8957
9103
  });
8958
9104
  }
8959
9105
  }
8960
- #ignored(path25) {
8961
- return this.seen.has(path25) || !!this.#ignore?.ignored?.(path25);
9106
+ #ignored(path27) {
9107
+ return this.seen.has(path27) || !!this.#ignore?.ignored?.(path27);
8962
9108
  }
8963
- #childrenIgnored(path25) {
8964
- return !!this.#ignore?.childrenIgnored?.(path25);
9109
+ #childrenIgnored(path27) {
9110
+ return !!this.#ignore?.childrenIgnored?.(path27);
8965
9111
  }
8966
9112
  // backpressure mechanism
8967
9113
  pause() {
@@ -9176,8 +9322,8 @@ var GlobUtil = class {
9176
9322
  };
9177
9323
  var GlobWalker = class extends GlobUtil {
9178
9324
  matches = /* @__PURE__ */ new Set();
9179
- constructor(patterns, path25, opts) {
9180
- super(patterns, path25, opts);
9325
+ constructor(patterns, path27, opts) {
9326
+ super(patterns, path27, opts);
9181
9327
  }
9182
9328
  matchEmit(e) {
9183
9329
  this.matches.add(e);
@@ -9214,8 +9360,8 @@ var GlobWalker = class extends GlobUtil {
9214
9360
  };
9215
9361
  var GlobStream = class extends GlobUtil {
9216
9362
  results;
9217
- constructor(patterns, path25, opts) {
9218
- super(patterns, path25, opts);
9363
+ constructor(patterns, path27, opts) {
9364
+ super(patterns, path27, opts);
9219
9365
  this.results = new Minipass({
9220
9366
  signal: this.signal,
9221
9367
  objectMode: true
@@ -9552,44 +9698,44 @@ init_esm_shims();
9552
9698
  var platform_default = process.env.__TESTING_RIMRAF_PLATFORM__ || process.platform;
9553
9699
 
9554
9700
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/path-arg.js
9555
- var pathArg = (path25, opt = {}) => {
9556
- const type = typeof path25;
9701
+ var pathArg = (path27, opt = {}) => {
9702
+ const type = typeof path27;
9557
9703
  if (type !== "string") {
9558
- const ctor = path25 && type === "object" && path25.constructor;
9559
- const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path25) : `type ${type} ${path25}`;
9704
+ const ctor = path27 && type === "object" && path27.constructor;
9705
+ const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path27) : `type ${type} ${path27}`;
9560
9706
  const msg = `The "path" argument must be of type string. Received ${received}`;
9561
9707
  throw Object.assign(new TypeError(msg), {
9562
- path: path25,
9708
+ path: path27,
9563
9709
  code: "ERR_INVALID_ARG_TYPE"
9564
9710
  });
9565
9711
  }
9566
- if (/\0/.test(path25)) {
9712
+ if (/\0/.test(path27)) {
9567
9713
  const msg = "path must be a string without null bytes";
9568
9714
  throw Object.assign(new TypeError(msg), {
9569
- path: path25,
9715
+ path: path27,
9570
9716
  code: "ERR_INVALID_ARG_VALUE"
9571
9717
  });
9572
9718
  }
9573
- path25 = resolve3(path25);
9574
- const { root } = parse(path25);
9575
- if (path25 === root && opt.preserveRoot !== false) {
9719
+ path27 = resolve3(path27);
9720
+ const { root } = parse(path27);
9721
+ if (path27 === root && opt.preserveRoot !== false) {
9576
9722
  const msg = "refusing to remove root directory without preserveRoot:false";
9577
9723
  throw Object.assign(new Error(msg), {
9578
- path: path25,
9724
+ path: path27,
9579
9725
  code: "ERR_PRESERVE_ROOT"
9580
9726
  });
9581
9727
  }
9582
9728
  if (platform_default === "win32") {
9583
9729
  const badWinChars = /[*|"<>?:]/;
9584
- const { root: root2 } = parse(path25);
9585
- if (badWinChars.test(path25.substring(root2.length))) {
9730
+ const { root: root2 } = parse(path27);
9731
+ if (badWinChars.test(path27.substring(root2.length))) {
9586
9732
  throw Object.assign(new Error("Illegal characters in path."), {
9587
- path: path25,
9733
+ path: path27,
9588
9734
  code: "EINVAL"
9589
9735
  });
9590
9736
  }
9591
9737
  }
9592
- return path25;
9738
+ return path27;
9593
9739
  };
9594
9740
  var path_arg_default = pathArg;
9595
9741
 
@@ -9601,19 +9747,19 @@ init_esm_shims();
9601
9747
 
9602
9748
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/fs.js
9603
9749
  init_esm_shims();
9604
- import fs3 from "fs";
9750
+ import fs5 from "fs";
9605
9751
  import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync as lstatSync2, unlinkSync } from "fs";
9606
9752
  import { readdirSync as rdSync } from "fs";
9607
- var readdirSync2 = (path25) => rdSync(path25, { withFileTypes: true });
9608
- var chmod = (path25, mode) => new Promise((res, rej) => fs3.chmod(path25, mode, (er, ...d) => er ? rej(er) : res(...d)));
9609
- var mkdir = (path25, options) => new Promise((res, rej) => fs3.mkdir(path25, options, (er, made) => er ? rej(er) : res(made)));
9610
- var readdir4 = (path25) => new Promise((res, rej) => fs3.readdir(path25, { withFileTypes: true }, (er, data2) => er ? rej(er) : res(data2)));
9611
- var rename = (oldPath, newPath) => new Promise((res, rej) => fs3.rename(oldPath, newPath, (er, ...d) => er ? rej(er) : res(...d)));
9612
- var rm = (path25, options) => new Promise((res, rej) => fs3.rm(path25, options, (er, ...d) => er ? rej(er) : res(...d)));
9613
- var rmdir = (path25) => new Promise((res, rej) => fs3.rmdir(path25, (er, ...d) => er ? rej(er) : res(...d)));
9614
- var stat4 = (path25) => new Promise((res, rej) => fs3.stat(path25, (er, data2) => er ? rej(er) : res(data2)));
9615
- var lstat4 = (path25) => new Promise((res, rej) => fs3.lstat(path25, (er, data2) => er ? rej(er) : res(data2)));
9616
- var unlink = (path25) => new Promise((res, rej) => fs3.unlink(path25, (er, ...d) => er ? rej(er) : res(...d)));
9753
+ var readdirSync2 = (path27) => rdSync(path27, { withFileTypes: true });
9754
+ var chmod = (path27, mode) => new Promise((res, rej) => fs5.chmod(path27, mode, (er, ...d) => er ? rej(er) : res(...d)));
9755
+ var mkdir = (path27, options) => new Promise((res, rej) => fs5.mkdir(path27, options, (er, made) => er ? rej(er) : res(made)));
9756
+ var readdir4 = (path27) => new Promise((res, rej) => fs5.readdir(path27, { withFileTypes: true }, (er, data2) => er ? rej(er) : res(data2)));
9757
+ var rename = (oldPath, newPath) => new Promise((res, rej) => fs5.rename(oldPath, newPath, (er, ...d) => er ? rej(er) : res(...d)));
9758
+ var rm = (path27, options) => new Promise((res, rej) => fs5.rm(path27, options, (er, ...d) => er ? rej(er) : res(...d)));
9759
+ var rmdir = (path27) => new Promise((res, rej) => fs5.rmdir(path27, (er, ...d) => er ? rej(er) : res(...d)));
9760
+ var stat4 = (path27) => new Promise((res, rej) => fs5.stat(path27, (er, data2) => er ? rej(er) : res(data2)));
9761
+ var lstat4 = (path27) => new Promise((res, rej) => fs5.lstat(path27, (er, data2) => er ? rej(er) : res(data2)));
9762
+ var unlink = (path27) => new Promise((res, rej) => fs5.unlink(path27, (er, ...d) => er ? rej(er) : res(...d)));
9617
9763
  var promises = {
9618
9764
  chmod,
9619
9765
  mkdir,
@@ -9632,10 +9778,10 @@ import { parse as parse2, resolve as resolve4 } from "path";
9632
9778
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/readdir-or-error.js
9633
9779
  init_esm_shims();
9634
9780
  var { readdir: readdir5 } = promises;
9635
- var readdirOrError = (path25) => readdir5(path25).catch((er) => er);
9636
- var readdirOrErrorSync = (path25) => {
9781
+ var readdirOrError = (path27) => readdir5(path27).catch((er) => er);
9782
+ var readdirOrErrorSync = (path27) => {
9637
9783
  try {
9638
- return readdirSync2(path25);
9784
+ return readdirSync2(path27);
9639
9785
  } catch (er) {
9640
9786
  return er;
9641
9787
  }
@@ -9660,35 +9806,35 @@ var ignoreENOENTSync = (fn) => {
9660
9806
 
9661
9807
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-posix.js
9662
9808
  var { lstat: lstat5, rmdir: rmdir2, unlink: unlink2 } = promises;
9663
- var rimrafPosix = async (path25, opt) => {
9809
+ var rimrafPosix = async (path27, opt) => {
9664
9810
  if (opt?.signal?.aborted) {
9665
9811
  throw opt.signal.reason;
9666
9812
  }
9667
9813
  try {
9668
- return await rimrafPosixDir(path25, opt, await lstat5(path25));
9814
+ return await rimrafPosixDir(path27, opt, await lstat5(path27));
9669
9815
  } catch (er) {
9670
9816
  if (er?.code === "ENOENT")
9671
9817
  return true;
9672
9818
  throw er;
9673
9819
  }
9674
9820
  };
9675
- var rimrafPosixSync = (path25, opt) => {
9821
+ var rimrafPosixSync = (path27, opt) => {
9676
9822
  if (opt?.signal?.aborted) {
9677
9823
  throw opt.signal.reason;
9678
9824
  }
9679
9825
  try {
9680
- return rimrafPosixDirSync(path25, opt, lstatSync2(path25));
9826
+ return rimrafPosixDirSync(path27, opt, lstatSync2(path27));
9681
9827
  } catch (er) {
9682
9828
  if (er?.code === "ENOENT")
9683
9829
  return true;
9684
9830
  throw er;
9685
9831
  }
9686
9832
  };
9687
- var rimrafPosixDir = async (path25, opt, ent) => {
9833
+ var rimrafPosixDir = async (path27, opt, ent) => {
9688
9834
  if (opt?.signal?.aborted) {
9689
9835
  throw opt.signal.reason;
9690
9836
  }
9691
- const entries = ent.isDirectory() ? await readdirOrError(path25) : null;
9837
+ const entries = ent.isDirectory() ? await readdirOrError(path27) : null;
9692
9838
  if (!Array.isArray(entries)) {
9693
9839
  if (entries) {
9694
9840
  if (entries.code === "ENOENT") {
@@ -9698,30 +9844,30 @@ var rimrafPosixDir = async (path25, opt, ent) => {
9698
9844
  throw entries;
9699
9845
  }
9700
9846
  }
9701
- if (opt.filter && !await opt.filter(path25, ent)) {
9847
+ if (opt.filter && !await opt.filter(path27, ent)) {
9702
9848
  return false;
9703
9849
  }
9704
- await ignoreENOENT(unlink2(path25));
9850
+ await ignoreENOENT(unlink2(path27));
9705
9851
  return true;
9706
9852
  }
9707
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path25, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9853
+ const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path27, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9708
9854
  if (!removedAll) {
9709
9855
  return false;
9710
9856
  }
9711
- if (opt.preserveRoot === false && path25 === parse2(path25).root) {
9857
+ if (opt.preserveRoot === false && path27 === parse2(path27).root) {
9712
9858
  return false;
9713
9859
  }
9714
- if (opt.filter && !await opt.filter(path25, ent)) {
9860
+ if (opt.filter && !await opt.filter(path27, ent)) {
9715
9861
  return false;
9716
9862
  }
9717
- await ignoreENOENT(rmdir2(path25));
9863
+ await ignoreENOENT(rmdir2(path27));
9718
9864
  return true;
9719
9865
  };
9720
- var rimrafPosixDirSync = (path25, opt, ent) => {
9866
+ var rimrafPosixDirSync = (path27, opt, ent) => {
9721
9867
  if (opt?.signal?.aborted) {
9722
9868
  throw opt.signal.reason;
9723
9869
  }
9724
- const entries = ent.isDirectory() ? readdirOrErrorSync(path25) : null;
9870
+ const entries = ent.isDirectory() ? readdirOrErrorSync(path27) : null;
9725
9871
  if (!Array.isArray(entries)) {
9726
9872
  if (entries) {
9727
9873
  if (entries.code === "ENOENT") {
@@ -9731,27 +9877,27 @@ var rimrafPosixDirSync = (path25, opt, ent) => {
9731
9877
  throw entries;
9732
9878
  }
9733
9879
  }
9734
- if (opt.filter && !opt.filter(path25, ent)) {
9880
+ if (opt.filter && !opt.filter(path27, ent)) {
9735
9881
  return false;
9736
9882
  }
9737
- ignoreENOENTSync(() => unlinkSync(path25));
9883
+ ignoreENOENTSync(() => unlinkSync(path27));
9738
9884
  return true;
9739
9885
  }
9740
9886
  let removedAll = true;
9741
9887
  for (const ent2 of entries) {
9742
- const p = resolve4(path25, ent2.name);
9888
+ const p = resolve4(path27, ent2.name);
9743
9889
  removedAll = rimrafPosixDirSync(p, opt, ent2) && removedAll;
9744
9890
  }
9745
- if (opt.preserveRoot === false && path25 === parse2(path25).root) {
9891
+ if (opt.preserveRoot === false && path27 === parse2(path27).root) {
9746
9892
  return false;
9747
9893
  }
9748
9894
  if (!removedAll) {
9749
9895
  return false;
9750
9896
  }
9751
- if (opt.filter && !opt.filter(path25, ent)) {
9897
+ if (opt.filter && !opt.filter(path27, ent)) {
9752
9898
  return false;
9753
9899
  }
9754
- ignoreENOENTSync(() => rmdirSync(path25));
9900
+ ignoreENOENTSync(() => rmdirSync(path27));
9755
9901
  return true;
9756
9902
  };
9757
9903
 
@@ -9762,9 +9908,9 @@ import { parse as parse5, resolve as resolve7 } from "path";
9762
9908
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/fix-eperm.js
9763
9909
  init_esm_shims();
9764
9910
  var { chmod: chmod2 } = promises;
9765
- var fixEPERM = (fn) => async (path25) => {
9911
+ var fixEPERM = (fn) => async (path27) => {
9766
9912
  try {
9767
- return await fn(path25);
9913
+ return await fn(path27);
9768
9914
  } catch (er) {
9769
9915
  const fer = er;
9770
9916
  if (fer?.code === "ENOENT") {
@@ -9772,7 +9918,7 @@ var fixEPERM = (fn) => async (path25) => {
9772
9918
  }
9773
9919
  if (fer?.code === "EPERM") {
9774
9920
  try {
9775
- await chmod2(path25, 438);
9921
+ await chmod2(path27, 438);
9776
9922
  } catch (er2) {
9777
9923
  const fer2 = er2;
9778
9924
  if (fer2?.code === "ENOENT") {
@@ -9780,14 +9926,14 @@ var fixEPERM = (fn) => async (path25) => {
9780
9926
  }
9781
9927
  throw er;
9782
9928
  }
9783
- return await fn(path25);
9929
+ return await fn(path27);
9784
9930
  }
9785
9931
  throw er;
9786
9932
  }
9787
9933
  };
9788
- var fixEPERMSync = (fn) => (path25) => {
9934
+ var fixEPERMSync = (fn) => (path27) => {
9789
9935
  try {
9790
- return fn(path25);
9936
+ return fn(path27);
9791
9937
  } catch (er) {
9792
9938
  const fer = er;
9793
9939
  if (fer?.code === "ENOENT") {
@@ -9795,7 +9941,7 @@ var fixEPERMSync = (fn) => (path25) => {
9795
9941
  }
9796
9942
  if (fer?.code === "EPERM") {
9797
9943
  try {
9798
- chmodSync(path25, 438);
9944
+ chmodSync(path27, 438);
9799
9945
  } catch (er2) {
9800
9946
  const fer2 = er2;
9801
9947
  if (fer2?.code === "ENOENT") {
@@ -9803,7 +9949,7 @@ var fixEPERMSync = (fn) => (path25) => {
9803
9949
  }
9804
9950
  throw er;
9805
9951
  }
9806
- return fn(path25);
9952
+ return fn(path27);
9807
9953
  }
9808
9954
  throw er;
9809
9955
  }
@@ -9816,23 +9962,23 @@ var RATE = 1.2;
9816
9962
  var MAXRETRIES = 10;
9817
9963
  var codes = /* @__PURE__ */ new Set(["EMFILE", "ENFILE", "EBUSY"]);
9818
9964
  var retryBusy = (fn) => {
9819
- const method = async (path25, opt, backoff = 1, total = 0) => {
9965
+ const method = async (path27, opt, backoff = 1, total = 0) => {
9820
9966
  const mbo = opt.maxBackoff || MAXBACKOFF;
9821
9967
  const rate = opt.backoff || RATE;
9822
9968
  const max = opt.maxRetries || MAXRETRIES;
9823
9969
  let retries = 0;
9824
9970
  while (true) {
9825
9971
  try {
9826
- return await fn(path25);
9972
+ return await fn(path27);
9827
9973
  } catch (er) {
9828
9974
  const fer = er;
9829
- if (fer?.path === path25 && fer?.code && codes.has(fer.code)) {
9975
+ if (fer?.path === path27 && fer?.code && codes.has(fer.code)) {
9830
9976
  backoff = Math.ceil(backoff * rate);
9831
9977
  total = backoff + total;
9832
9978
  if (total < mbo) {
9833
9979
  return new Promise((res, rej) => {
9834
9980
  setTimeout(() => {
9835
- method(path25, opt, backoff, total).then(res, rej);
9981
+ method(path27, opt, backoff, total).then(res, rej);
9836
9982
  }, backoff);
9837
9983
  });
9838
9984
  }
@@ -9848,15 +9994,15 @@ var retryBusy = (fn) => {
9848
9994
  return method;
9849
9995
  };
9850
9996
  var retryBusySync = (fn) => {
9851
- const method = (path25, opt) => {
9997
+ const method = (path27, opt) => {
9852
9998
  const max = opt.maxRetries || MAXRETRIES;
9853
9999
  let retries = 0;
9854
10000
  while (true) {
9855
10001
  try {
9856
- return fn(path25);
10002
+ return fn(path27);
9857
10003
  } catch (er) {
9858
10004
  const fer = er;
9859
- if (fer?.path === path25 && fer?.code && codes.has(fer.code) && retries < max) {
10005
+ if (fer?.path === path27 && fer?.code && codes.has(fer.code) && retries < max) {
9860
10006
  retries++;
9861
10007
  continue;
9862
10008
  }
@@ -9876,16 +10022,16 @@ init_esm_shims();
9876
10022
  import { tmpdir } from "os";
9877
10023
  import { parse as parse3, resolve as resolve5 } from "path";
9878
10024
  var { stat: stat5 } = promises;
9879
- var isDirSync = (path25) => {
10025
+ var isDirSync = (path27) => {
9880
10026
  try {
9881
- return statSync(path25).isDirectory();
10027
+ return statSync(path27).isDirectory();
9882
10028
  } catch (er) {
9883
10029
  return false;
9884
10030
  }
9885
10031
  };
9886
- var isDir = (path25) => stat5(path25).then((st) => st.isDirectory(), () => false);
9887
- var win32DefaultTmp = async (path25) => {
9888
- const { root } = parse3(path25);
10032
+ var isDir = (path27) => stat5(path27).then((st) => st.isDirectory(), () => false);
10033
+ var win32DefaultTmp = async (path27) => {
10034
+ const { root } = parse3(path27);
9889
10035
  const tmp = tmpdir();
9890
10036
  const { root: tmpRoot } = parse3(tmp);
9891
10037
  if (root.toLowerCase() === tmpRoot.toLowerCase()) {
@@ -9897,8 +10043,8 @@ var win32DefaultTmp = async (path25) => {
9897
10043
  }
9898
10044
  return root;
9899
10045
  };
9900
- var win32DefaultTmpSync = (path25) => {
9901
- const { root } = parse3(path25);
10046
+ var win32DefaultTmpSync = (path27) => {
10047
+ const { root } = parse3(path27);
9902
10048
  const tmp = tmpdir();
9903
10049
  const { root: tmpRoot } = parse3(tmp);
9904
10050
  if (root.toLowerCase() === tmpRoot.toLowerCase()) {
@@ -9917,10 +10063,10 @@ var defaultTmpSync = platform_default === "win32" ? win32DefaultTmpSync : posixD
9917
10063
 
9918
10064
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-move-remove.js
9919
10065
  var { lstat: lstat6, rename: rename2, unlink: unlink3, rmdir: rmdir3, chmod: chmod3 } = promises;
9920
- var uniqueFilename = (path25) => `.${basename3(path25)}.${Math.random()}`;
9921
- var unlinkFixEPERM = async (path25) => unlink3(path25).catch((er) => {
10066
+ var uniqueFilename = (path27) => `.${basename3(path27)}.${Math.random()}`;
10067
+ var unlinkFixEPERM = async (path27) => unlink3(path27).catch((er) => {
9922
10068
  if (er.code === "EPERM") {
9923
- return chmod3(path25, 438).then(() => unlink3(path25), (er2) => {
10069
+ return chmod3(path27, 438).then(() => unlink3(path27), (er2) => {
9924
10070
  if (er2.code === "ENOENT") {
9925
10071
  return;
9926
10072
  }
@@ -9931,13 +10077,13 @@ var unlinkFixEPERM = async (path25) => unlink3(path25).catch((er) => {
9931
10077
  }
9932
10078
  throw er;
9933
10079
  });
9934
- var unlinkFixEPERMSync = (path25) => {
10080
+ var unlinkFixEPERMSync = (path27) => {
9935
10081
  try {
9936
- unlinkSync(path25);
10082
+ unlinkSync(path27);
9937
10083
  } catch (er) {
9938
10084
  if (er?.code === "EPERM") {
9939
10085
  try {
9940
- return chmodSync(path25, 438);
10086
+ return chmodSync(path27, 438);
9941
10087
  } catch (er2) {
9942
10088
  if (er2?.code === "ENOENT") {
9943
10089
  return;
@@ -9950,29 +10096,29 @@ var unlinkFixEPERMSync = (path25) => {
9950
10096
  throw er;
9951
10097
  }
9952
10098
  };
9953
- var rimrafMoveRemove = async (path25, opt) => {
10099
+ var rimrafMoveRemove = async (path27, opt) => {
9954
10100
  if (opt?.signal?.aborted) {
9955
10101
  throw opt.signal.reason;
9956
10102
  }
9957
10103
  try {
9958
- return await rimrafMoveRemoveDir(path25, opt, await lstat6(path25));
10104
+ return await rimrafMoveRemoveDir(path27, opt, await lstat6(path27));
9959
10105
  } catch (er) {
9960
10106
  if (er?.code === "ENOENT")
9961
10107
  return true;
9962
10108
  throw er;
9963
10109
  }
9964
10110
  };
9965
- var rimrafMoveRemoveDir = async (path25, opt, ent) => {
10111
+ var rimrafMoveRemoveDir = async (path27, opt, ent) => {
9966
10112
  if (opt?.signal?.aborted) {
9967
10113
  throw opt.signal.reason;
9968
10114
  }
9969
10115
  if (!opt.tmp) {
9970
- return rimrafMoveRemoveDir(path25, { ...opt, tmp: await defaultTmp(path25) }, ent);
10116
+ return rimrafMoveRemoveDir(path27, { ...opt, tmp: await defaultTmp(path27) }, ent);
9971
10117
  }
9972
- if (path25 === opt.tmp && parse4(path25).root !== path25) {
10118
+ if (path27 === opt.tmp && parse4(path27).root !== path27) {
9973
10119
  throw new Error("cannot delete temp directory used for deletion");
9974
10120
  }
9975
- const entries = ent.isDirectory() ? await readdirOrError(path25) : null;
10121
+ const entries = ent.isDirectory() ? await readdirOrError(path27) : null;
9976
10122
  if (!Array.isArray(entries)) {
9977
10123
  if (entries) {
9978
10124
  if (entries.code === "ENOENT") {
@@ -9982,54 +10128,54 @@ var rimrafMoveRemoveDir = async (path25, opt, ent) => {
9982
10128
  throw entries;
9983
10129
  }
9984
10130
  }
9985
- if (opt.filter && !await opt.filter(path25, ent)) {
10131
+ if (opt.filter && !await opt.filter(path27, ent)) {
9986
10132
  return false;
9987
10133
  }
9988
- await ignoreENOENT(tmpUnlink(path25, opt.tmp, unlinkFixEPERM));
10134
+ await ignoreENOENT(tmpUnlink(path27, opt.tmp, unlinkFixEPERM));
9989
10135
  return true;
9990
10136
  }
9991
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path25, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
10137
+ const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path27, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9992
10138
  if (!removedAll) {
9993
10139
  return false;
9994
10140
  }
9995
- if (opt.preserveRoot === false && path25 === parse4(path25).root) {
10141
+ if (opt.preserveRoot === false && path27 === parse4(path27).root) {
9996
10142
  return false;
9997
10143
  }
9998
- if (opt.filter && !await opt.filter(path25, ent)) {
10144
+ if (opt.filter && !await opt.filter(path27, ent)) {
9999
10145
  return false;
10000
10146
  }
10001
- await ignoreENOENT(tmpUnlink(path25, opt.tmp, rmdir3));
10147
+ await ignoreENOENT(tmpUnlink(path27, opt.tmp, rmdir3));
10002
10148
  return true;
10003
10149
  };
10004
- var tmpUnlink = async (path25, tmp, rm3) => {
10005
- const tmpFile = resolve6(tmp, uniqueFilename(path25));
10006
- await rename2(path25, tmpFile);
10150
+ var tmpUnlink = async (path27, tmp, rm3) => {
10151
+ const tmpFile = resolve6(tmp, uniqueFilename(path27));
10152
+ await rename2(path27, tmpFile);
10007
10153
  return await rm3(tmpFile);
10008
10154
  };
10009
- var rimrafMoveRemoveSync = (path25, opt) => {
10155
+ var rimrafMoveRemoveSync = (path27, opt) => {
10010
10156
  if (opt?.signal?.aborted) {
10011
10157
  throw opt.signal.reason;
10012
10158
  }
10013
10159
  try {
10014
- return rimrafMoveRemoveDirSync(path25, opt, lstatSync2(path25));
10160
+ return rimrafMoveRemoveDirSync(path27, opt, lstatSync2(path27));
10015
10161
  } catch (er) {
10016
10162
  if (er?.code === "ENOENT")
10017
10163
  return true;
10018
10164
  throw er;
10019
10165
  }
10020
10166
  };
10021
- var rimrafMoveRemoveDirSync = (path25, opt, ent) => {
10167
+ var rimrafMoveRemoveDirSync = (path27, opt, ent) => {
10022
10168
  if (opt?.signal?.aborted) {
10023
10169
  throw opt.signal.reason;
10024
10170
  }
10025
10171
  if (!opt.tmp) {
10026
- return rimrafMoveRemoveDirSync(path25, { ...opt, tmp: defaultTmpSync(path25) }, ent);
10172
+ return rimrafMoveRemoveDirSync(path27, { ...opt, tmp: defaultTmpSync(path27) }, ent);
10027
10173
  }
10028
10174
  const tmp = opt.tmp;
10029
- if (path25 === opt.tmp && parse4(path25).root !== path25) {
10175
+ if (path27 === opt.tmp && parse4(path27).root !== path27) {
10030
10176
  throw new Error("cannot delete temp directory used for deletion");
10031
10177
  }
10032
- const entries = ent.isDirectory() ? readdirOrErrorSync(path25) : null;
10178
+ const entries = ent.isDirectory() ? readdirOrErrorSync(path27) : null;
10033
10179
  if (!Array.isArray(entries)) {
10034
10180
  if (entries) {
10035
10181
  if (entries.code === "ENOENT") {
@@ -10039,32 +10185,32 @@ var rimrafMoveRemoveDirSync = (path25, opt, ent) => {
10039
10185
  throw entries;
10040
10186
  }
10041
10187
  }
10042
- if (opt.filter && !opt.filter(path25, ent)) {
10188
+ if (opt.filter && !opt.filter(path27, ent)) {
10043
10189
  return false;
10044
10190
  }
10045
- ignoreENOENTSync(() => tmpUnlinkSync(path25, tmp, unlinkFixEPERMSync));
10191
+ ignoreENOENTSync(() => tmpUnlinkSync(path27, tmp, unlinkFixEPERMSync));
10046
10192
  return true;
10047
10193
  }
10048
10194
  let removedAll = true;
10049
10195
  for (const ent2 of entries) {
10050
- const p = resolve6(path25, ent2.name);
10196
+ const p = resolve6(path27, ent2.name);
10051
10197
  removedAll = rimrafMoveRemoveDirSync(p, opt, ent2) && removedAll;
10052
10198
  }
10053
10199
  if (!removedAll) {
10054
10200
  return false;
10055
10201
  }
10056
- if (opt.preserveRoot === false && path25 === parse4(path25).root) {
10202
+ if (opt.preserveRoot === false && path27 === parse4(path27).root) {
10057
10203
  return false;
10058
10204
  }
10059
- if (opt.filter && !opt.filter(path25, ent)) {
10205
+ if (opt.filter && !opt.filter(path27, ent)) {
10060
10206
  return false;
10061
10207
  }
10062
- ignoreENOENTSync(() => tmpUnlinkSync(path25, tmp, rmdirSync));
10208
+ ignoreENOENTSync(() => tmpUnlinkSync(path27, tmp, rmdirSync));
10063
10209
  return true;
10064
10210
  };
10065
- var tmpUnlinkSync = (path25, tmp, rmSync2) => {
10066
- const tmpFile = resolve6(tmp, uniqueFilename(path25));
10067
- renameSync(path25, tmpFile);
10211
+ var tmpUnlinkSync = (path27, tmp, rmSync2) => {
10212
+ const tmpFile = resolve6(tmp, uniqueFilename(path27));
10213
+ renameSync(path27, tmpFile);
10068
10214
  return rmSync2(tmpFile);
10069
10215
  };
10070
10216
 
@@ -10074,31 +10220,31 @@ var rimrafWindowsFile = retryBusy(fixEPERM(unlink4));
10074
10220
  var rimrafWindowsFileSync = retryBusySync(fixEPERMSync(unlinkSync));
10075
10221
  var rimrafWindowsDirRetry = retryBusy(fixEPERM(rmdir4));
10076
10222
  var rimrafWindowsDirRetrySync = retryBusySync(fixEPERMSync(rmdirSync));
10077
- var rimrafWindowsDirMoveRemoveFallback = async (path25, opt) => {
10223
+ var rimrafWindowsDirMoveRemoveFallback = async (path27, opt) => {
10078
10224
  if (opt?.signal?.aborted) {
10079
10225
  throw opt.signal.reason;
10080
10226
  }
10081
10227
  const { filter: filter3, ...options } = opt;
10082
10228
  try {
10083
- return await rimrafWindowsDirRetry(path25, options);
10229
+ return await rimrafWindowsDirRetry(path27, options);
10084
10230
  } catch (er) {
10085
10231
  if (er?.code === "ENOTEMPTY") {
10086
- return await rimrafMoveRemove(path25, options);
10232
+ return await rimrafMoveRemove(path27, options);
10087
10233
  }
10088
10234
  throw er;
10089
10235
  }
10090
10236
  };
10091
- var rimrafWindowsDirMoveRemoveFallbackSync = (path25, opt) => {
10237
+ var rimrafWindowsDirMoveRemoveFallbackSync = (path27, opt) => {
10092
10238
  if (opt?.signal?.aborted) {
10093
10239
  throw opt.signal.reason;
10094
10240
  }
10095
10241
  const { filter: filter3, ...options } = opt;
10096
10242
  try {
10097
- return rimrafWindowsDirRetrySync(path25, options);
10243
+ return rimrafWindowsDirRetrySync(path27, options);
10098
10244
  } catch (er) {
10099
10245
  const fer = er;
10100
10246
  if (fer?.code === "ENOTEMPTY") {
10101
- return rimrafMoveRemoveSync(path25, options);
10247
+ return rimrafMoveRemoveSync(path27, options);
10102
10248
  }
10103
10249
  throw er;
10104
10250
  }
@@ -10106,35 +10252,35 @@ var rimrafWindowsDirMoveRemoveFallbackSync = (path25, opt) => {
10106
10252
  var START = Symbol("start");
10107
10253
  var CHILD = Symbol("child");
10108
10254
  var FINISH = Symbol("finish");
10109
- var rimrafWindows = async (path25, opt) => {
10255
+ var rimrafWindows = async (path27, opt) => {
10110
10256
  if (opt?.signal?.aborted) {
10111
10257
  throw opt.signal.reason;
10112
10258
  }
10113
10259
  try {
10114
- return await rimrafWindowsDir(path25, opt, await lstat7(path25), START);
10260
+ return await rimrafWindowsDir(path27, opt, await lstat7(path27), START);
10115
10261
  } catch (er) {
10116
10262
  if (er?.code === "ENOENT")
10117
10263
  return true;
10118
10264
  throw er;
10119
10265
  }
10120
10266
  };
10121
- var rimrafWindowsSync = (path25, opt) => {
10267
+ var rimrafWindowsSync = (path27, opt) => {
10122
10268
  if (opt?.signal?.aborted) {
10123
10269
  throw opt.signal.reason;
10124
10270
  }
10125
10271
  try {
10126
- return rimrafWindowsDirSync(path25, opt, lstatSync2(path25), START);
10272
+ return rimrafWindowsDirSync(path27, opt, lstatSync2(path27), START);
10127
10273
  } catch (er) {
10128
10274
  if (er?.code === "ENOENT")
10129
10275
  return true;
10130
10276
  throw er;
10131
10277
  }
10132
10278
  };
10133
- var rimrafWindowsDir = async (path25, opt, ent, state = START) => {
10279
+ var rimrafWindowsDir = async (path27, opt, ent, state = START) => {
10134
10280
  if (opt?.signal?.aborted) {
10135
10281
  throw opt.signal.reason;
10136
10282
  }
10137
- const entries = ent.isDirectory() ? await readdirOrError(path25) : null;
10283
+ const entries = ent.isDirectory() ? await readdirOrError(path27) : null;
10138
10284
  if (!Array.isArray(entries)) {
10139
10285
  if (entries) {
10140
10286
  if (entries.code === "ENOENT") {
@@ -10144,32 +10290,32 @@ var rimrafWindowsDir = async (path25, opt, ent, state = START) => {
10144
10290
  throw entries;
10145
10291
  }
10146
10292
  }
10147
- if (opt.filter && !await opt.filter(path25, ent)) {
10293
+ if (opt.filter && !await opt.filter(path27, ent)) {
10148
10294
  return false;
10149
10295
  }
10150
- await ignoreENOENT(rimrafWindowsFile(path25, opt));
10296
+ await ignoreENOENT(rimrafWindowsFile(path27, opt));
10151
10297
  return true;
10152
10298
  }
10153
10299
  const s = state === START ? CHILD : state;
10154
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path25, ent2.name), opt, ent2, s)))).reduce((a, b) => a && b, true);
10300
+ const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path27, ent2.name), opt, ent2, s)))).reduce((a, b) => a && b, true);
10155
10301
  if (state === START) {
10156
- return rimrafWindowsDir(path25, opt, ent, FINISH);
10302
+ return rimrafWindowsDir(path27, opt, ent, FINISH);
10157
10303
  } else if (state === FINISH) {
10158
- if (opt.preserveRoot === false && path25 === parse5(path25).root) {
10304
+ if (opt.preserveRoot === false && path27 === parse5(path27).root) {
10159
10305
  return false;
10160
10306
  }
10161
10307
  if (!removedAll) {
10162
10308
  return false;
10163
10309
  }
10164
- if (opt.filter && !await opt.filter(path25, ent)) {
10310
+ if (opt.filter && !await opt.filter(path27, ent)) {
10165
10311
  return false;
10166
10312
  }
10167
- await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path25, opt));
10313
+ await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path27, opt));
10168
10314
  }
10169
10315
  return true;
10170
10316
  };
10171
- var rimrafWindowsDirSync = (path25, opt, ent, state = START) => {
10172
- const entries = ent.isDirectory() ? readdirOrErrorSync(path25) : null;
10317
+ var rimrafWindowsDirSync = (path27, opt, ent, state = START) => {
10318
+ const entries = ent.isDirectory() ? readdirOrErrorSync(path27) : null;
10173
10319
  if (!Array.isArray(entries)) {
10174
10320
  if (entries) {
10175
10321
  if (entries.code === "ENOENT") {
@@ -10179,32 +10325,32 @@ var rimrafWindowsDirSync = (path25, opt, ent, state = START) => {
10179
10325
  throw entries;
10180
10326
  }
10181
10327
  }
10182
- if (opt.filter && !opt.filter(path25, ent)) {
10328
+ if (opt.filter && !opt.filter(path27, ent)) {
10183
10329
  return false;
10184
10330
  }
10185
- ignoreENOENTSync(() => rimrafWindowsFileSync(path25, opt));
10331
+ ignoreENOENTSync(() => rimrafWindowsFileSync(path27, opt));
10186
10332
  return true;
10187
10333
  }
10188
10334
  let removedAll = true;
10189
10335
  for (const ent2 of entries) {
10190
10336
  const s = state === START ? CHILD : state;
10191
- const p = resolve7(path25, ent2.name);
10337
+ const p = resolve7(path27, ent2.name);
10192
10338
  removedAll = rimrafWindowsDirSync(p, opt, ent2, s) && removedAll;
10193
10339
  }
10194
10340
  if (state === START) {
10195
- return rimrafWindowsDirSync(path25, opt, ent, FINISH);
10341
+ return rimrafWindowsDirSync(path27, opt, ent, FINISH);
10196
10342
  } else if (state === FINISH) {
10197
- if (opt.preserveRoot === false && path25 === parse5(path25).root) {
10343
+ if (opt.preserveRoot === false && path27 === parse5(path27).root) {
10198
10344
  return false;
10199
10345
  }
10200
10346
  if (!removedAll) {
10201
10347
  return false;
10202
10348
  }
10203
- if (opt.filter && !opt.filter(path25, ent)) {
10349
+ if (opt.filter && !opt.filter(path27, ent)) {
10204
10350
  return false;
10205
10351
  }
10206
10352
  ignoreENOENTSync(() => {
10207
- rimrafWindowsDirMoveRemoveFallbackSync(path25, opt);
10353
+ rimrafWindowsDirMoveRemoveFallbackSync(path27, opt);
10208
10354
  });
10209
10355
  }
10210
10356
  return true;
@@ -10217,16 +10363,16 @@ var rimrafManualSync = platform_default === "win32" ? rimrafWindowsSync : rimraf
10217
10363
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-native.js
10218
10364
  init_esm_shims();
10219
10365
  var { rm: rm2 } = promises;
10220
- var rimrafNative = async (path25, opt) => {
10221
- await rm2(path25, {
10366
+ var rimrafNative = async (path27, opt) => {
10367
+ await rm2(path27, {
10222
10368
  ...opt,
10223
10369
  force: true,
10224
10370
  recursive: true
10225
10371
  });
10226
10372
  return true;
10227
10373
  };
10228
- var rimrafNativeSync = (path25, opt) => {
10229
- rmSync(path25, {
10374
+ var rimrafNativeSync = (path27, opt) => {
10375
+ rmSync(path27, {
10230
10376
  ...opt,
10231
10377
  force: true,
10232
10378
  recursive: true
@@ -10244,26 +10390,26 @@ var useNative = !hasNative || platform_default === "win32" ? () => false : (opt)
10244
10390
  var useNativeSync = !hasNative || platform_default === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
10245
10391
 
10246
10392
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/index.js
10247
- var wrap = (fn) => async (path25, opt) => {
10393
+ var wrap = (fn) => async (path27, opt) => {
10248
10394
  const options = optArg(opt);
10249
10395
  if (options.glob) {
10250
- path25 = await glob(path25, options.glob);
10396
+ path27 = await glob(path27, options.glob);
10251
10397
  }
10252
- if (Array.isArray(path25)) {
10253
- return !!(await Promise.all(path25.map((p) => fn(path_arg_default(p, options), options)))).reduce((a, b) => a && b, true);
10398
+ if (Array.isArray(path27)) {
10399
+ return !!(await Promise.all(path27.map((p) => fn(path_arg_default(p, options), options)))).reduce((a, b) => a && b, true);
10254
10400
  } else {
10255
- return !!await fn(path_arg_default(path25, options), options);
10401
+ return !!await fn(path_arg_default(path27, options), options);
10256
10402
  }
10257
10403
  };
10258
- var wrapSync = (fn) => (path25, opt) => {
10404
+ var wrapSync = (fn) => (path27, opt) => {
10259
10405
  const options = optArgSync(opt);
10260
10406
  if (options.glob) {
10261
- path25 = globSync(path25, options.glob);
10407
+ path27 = globSync(path27, options.glob);
10262
10408
  }
10263
- if (Array.isArray(path25)) {
10264
- return !!path25.map((p) => fn(path_arg_default(p, options), options)).reduce((a, b) => a && b, true);
10409
+ if (Array.isArray(path27)) {
10410
+ return !!path27.map((p) => fn(path_arg_default(p, options), options)).reduce((a, b) => a && b, true);
10265
10411
  } else {
10266
- return !!fn(path_arg_default(path25, options), options);
10412
+ return !!fn(path_arg_default(path27, options), options);
10267
10413
  }
10268
10414
  };
10269
10415
  var nativeSync = wrapSync(rimrafNativeSync);
@@ -10278,8 +10424,8 @@ var moveRemoveSync = wrapSync(rimrafMoveRemoveSync);
10278
10424
  var moveRemove = Object.assign(wrap(rimrafMoveRemove), {
10279
10425
  sync: moveRemoveSync
10280
10426
  });
10281
- var rimrafSync = wrapSync((path25, opt) => useNativeSync(opt) ? rimrafNativeSync(path25, opt) : rimrafManualSync(path25, opt));
10282
- var rimraf_ = wrap((path25, opt) => useNative(opt) ? rimrafNative(path25, opt) : rimrafManual(path25, opt));
10427
+ var rimrafSync = wrapSync((path27, opt) => useNativeSync(opt) ? rimrafNativeSync(path27, opt) : rimrafManualSync(path27, opt));
10428
+ var rimraf_ = wrap((path27, opt) => useNative(opt) ? rimrafNative(path27, opt) : rimrafManual(path27, opt));
10283
10429
  var rimraf = Object.assign(rimraf_, {
10284
10430
  rimraf: rimraf_,
10285
10431
  sync: rimrafSync,
@@ -10366,7 +10512,7 @@ function createBuildService(ctx) {
10366
10512
  }, {});
10367
10513
  const summaryKeys = Object.keys(summary);
10368
10514
  const prefix = summaryKeys.length === 1 ? summaryKeys[0] : "";
10369
- return path6.join(prefix, "common");
10515
+ return path8.join(prefix, "common");
10370
10516
  }
10371
10517
  }
10372
10518
  }
@@ -10391,7 +10537,7 @@ function createBuildService(ctx) {
10391
10537
  if (hasWorkersDir && workersDir) {
10392
10538
  devWorkers(workersDir);
10393
10539
  esm_default.watch(
10394
- path6.resolve(configService.absoluteSrcRoot, workersDir),
10540
+ path8.resolve(configService.absoluteSrcRoot, workersDir),
10395
10541
  {
10396
10542
  persistent: true,
10397
10543
  ignoreInitial: true
@@ -10442,8 +10588,8 @@ function createBuildService(ctx) {
10442
10588
  if (configService.mpDistRoot) {
10443
10589
  const deletedFilePaths = await rimraf(
10444
10590
  [
10445
- path6.resolve(configService.outDir, "*"),
10446
- path6.resolve(configService.outDir, ".*")
10591
+ path8.resolve(configService.outDir, "*"),
10592
+ path8.resolve(configService.outDir, ".*")
10447
10593
  ],
10448
10594
  {
10449
10595
  glob: true,
@@ -10507,13 +10653,13 @@ function createBuildServicePlugin(ctx) {
10507
10653
  init_esm_shims();
10508
10654
  import process7 from "process";
10509
10655
  import { defu as defu3 } from "@weapp-core/shared";
10510
- import fs14 from "fs-extra";
10656
+ import fs16 from "fs-extra";
10511
10657
 
10512
10658
  // ../../node_modules/.pnpm/local-pkg@1.1.2/node_modules/local-pkg/dist/index.mjs
10513
10659
  init_esm_shims();
10514
- import fs5 from "fs";
10660
+ import fs7 from "fs";
10515
10661
  import { createRequire as createRequire2 } from "module";
10516
- import path8, { dirname as dirname4, join as join3, win32 as win322 } from "path";
10662
+ import path10, { dirname as dirname4, join as join3, win32 as win322 } from "path";
10517
10663
  import process4 from "process";
10518
10664
  import fsPromises from "fs/promises";
10519
10665
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -16133,7 +16279,7 @@ Parser.acorn = {
16133
16279
 
16134
16280
  // ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
16135
16281
  import { builtinModules, createRequire } from "module";
16136
- import fs4, { realpathSync as realpathSync2, statSync as statSync2, promises as promises2 } from "fs";
16282
+ import fs6, { realpathSync as realpathSync2, statSync as statSync2, promises as promises2 } from "fs";
16137
16283
 
16138
16284
  // ../../node_modules/.pnpm/ufo@1.6.1/node_modules/ufo/dist/index.mjs
16139
16285
  init_esm_shims();
@@ -16153,17 +16299,17 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
16153
16299
  if (hasTrailingSlash(input, true)) {
16154
16300
  return input || "/";
16155
16301
  }
16156
- let path25 = input;
16302
+ let path27 = input;
16157
16303
  let fragment = "";
16158
16304
  const fragmentIndex = input.indexOf("#");
16159
16305
  if (fragmentIndex !== -1) {
16160
- path25 = input.slice(0, fragmentIndex);
16306
+ path27 = input.slice(0, fragmentIndex);
16161
16307
  fragment = input.slice(fragmentIndex);
16162
- if (!path25) {
16308
+ if (!path27) {
16163
16309
  return fragment;
16164
16310
  }
16165
16311
  }
16166
- const [s0, ...s] = path25.split("?");
16312
+ const [s0, ...s] = path27.split("?");
16167
16313
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
16168
16314
  }
16169
16315
  function isNonEmptyURL(url) {
@@ -16188,12 +16334,12 @@ import { normalize as normalize3, isAbsolute as isAbsolute2, extname as extname$
16188
16334
  import { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL as pathToFileURL$1 } from "url";
16189
16335
  import assert from "assert";
16190
16336
  import process$1 from "process";
16191
- import path7, { dirname as dirname3 } from "path";
16337
+ import path9, { dirname as dirname3 } from "path";
16192
16338
  import v8 from "v8";
16193
16339
  import { format, inspect as inspect2 } from "util";
16194
16340
  var BUILTIN_MODULES = new Set(builtinModules);
16195
- function normalizeSlash(path25) {
16196
- return path25.replace(/\\/g, "/");
16341
+ function normalizeSlash(path27) {
16342
+ return path27.replace(/\\/g, "/");
16197
16343
  }
16198
16344
  var own$1 = {}.hasOwnProperty;
16199
16345
  var classRegExp = /^([A-Z][a-z\d]*)+$/;
@@ -16306,8 +16452,8 @@ codes2.ERR_INVALID_PACKAGE_CONFIG = createError(
16306
16452
  * @param {string} [base]
16307
16453
  * @param {string} [message]
16308
16454
  */
16309
- (path25, base, message) => {
16310
- return `Invalid package config ${path25}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
16455
+ (path27, base, message) => {
16456
+ return `Invalid package config ${path27}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
16311
16457
  },
16312
16458
  Error
16313
16459
  );
@@ -16339,8 +16485,8 @@ codes2.ERR_MODULE_NOT_FOUND = createError(
16339
16485
  * @param {string} base
16340
16486
  * @param {boolean} [exactUrl]
16341
16487
  */
16342
- (path25, base, exactUrl = false) => {
16343
- return `Cannot find ${exactUrl ? "module" : "package"} '${path25}' imported from ${base}`;
16488
+ (path27, base, exactUrl = false) => {
16489
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path27}' imported from ${base}`;
16344
16490
  },
16345
16491
  Error
16346
16492
  );
@@ -16391,8 +16537,8 @@ codes2.ERR_UNKNOWN_FILE_EXTENSION = createError(
16391
16537
  * @param {string} extension
16392
16538
  * @param {string} path
16393
16539
  */
16394
- (extension, path25) => {
16395
- return `Unknown file extension "${extension}" for ${path25}`;
16540
+ (extension, path27) => {
16541
+ return `Unknown file extension "${extension}" for ${path27}`;
16396
16542
  },
16397
16543
  TypeError
16398
16544
  );
@@ -16537,7 +16683,7 @@ function read(jsonPath, { base, specifier }) {
16537
16683
  }
16538
16684
  let string;
16539
16685
  try {
16540
- string = fs4.readFileSync(path7.toNamespacedPath(jsonPath), "utf8");
16686
+ string = fs6.readFileSync(path9.toNamespacedPath(jsonPath), "utf8");
16541
16687
  } catch (error) {
16542
16688
  const exception = (
16543
16689
  /** @type {ErrnoException} */
@@ -16752,7 +16898,7 @@ Default "index" lookups for the main are deprecated for ES modules.`,
16752
16898
  "DeprecationWarning",
16753
16899
  "DEP0151"
16754
16900
  );
16755
- } else if (path7.resolve(packagePath, main) !== urlPath) {
16901
+ } else if (path9.resolve(packagePath, main) !== urlPath) {
16756
16902
  process$1.emitWarning(
16757
16903
  `Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
16758
16904
  packagePath.length
@@ -16763,9 +16909,9 @@ Default "index" lookups for the main are deprecated for ES modules.`,
16763
16909
  );
16764
16910
  }
16765
16911
  }
16766
- function tryStatSync(path25) {
16912
+ function tryStatSync(path27) {
16767
16913
  try {
16768
- return statSync2(path25);
16914
+ return statSync2(path27);
16769
16915
  } catch {
16770
16916
  }
16771
16917
  }
@@ -16859,7 +17005,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
16859
17005
  {
16860
17006
  const real = realpathSync2(filePath);
16861
17007
  const { search, hash } = resolved;
16862
- resolved = pathToFileURL$1(real + (filePath.endsWith(path7.sep) ? "/" : ""));
17008
+ resolved = pathToFileURL$1(real + (filePath.endsWith(path9.sep) ? "/" : ""));
16863
17009
  resolved.search = search;
16864
17010
  resolved.hash = hash;
16865
17011
  }
@@ -17641,12 +17787,12 @@ async function findUp$1(name, {
17641
17787
  type = "file",
17642
17788
  stopAt
17643
17789
  } = {}) {
17644
- let directory = path8.resolve(toPath(cwd) ?? "");
17645
- const { root } = path8.parse(directory);
17646
- stopAt = path8.resolve(directory, toPath(stopAt ?? root));
17647
- const isAbsoluteName = path8.isAbsolute(name);
17790
+ let directory = path10.resolve(toPath(cwd) ?? "");
17791
+ const { root } = path10.parse(directory);
17792
+ stopAt = path10.resolve(directory, toPath(stopAt ?? root));
17793
+ const isAbsoluteName = path10.isAbsolute(name);
17648
17794
  while (directory) {
17649
- const filePath = isAbsoluteName ? name : path8.join(directory, name);
17795
+ const filePath = isAbsoluteName ? name : path10.join(directory, name);
17650
17796
  try {
17651
17797
  const stats = await fsPromises.stat(filePath);
17652
17798
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
@@ -17657,7 +17803,7 @@ async function findUp$1(name, {
17657
17803
  if (directory === stopAt || directory === root) {
17658
17804
  break;
17659
17805
  }
17660
- directory = path8.dirname(directory);
17806
+ directory = path10.dirname(directory);
17661
17807
  }
17662
17808
  }
17663
17809
  function findUpSync(name, {
@@ -17665,14 +17811,14 @@ function findUpSync(name, {
17665
17811
  type = "file",
17666
17812
  stopAt
17667
17813
  } = {}) {
17668
- let directory = path8.resolve(toPath(cwd) ?? "");
17669
- const { root } = path8.parse(directory);
17670
- stopAt = path8.resolve(directory, toPath(stopAt) ?? root);
17671
- const isAbsoluteName = path8.isAbsolute(name);
17814
+ let directory = path10.resolve(toPath(cwd) ?? "");
17815
+ const { root } = path10.parse(directory);
17816
+ stopAt = path10.resolve(directory, toPath(stopAt) ?? root);
17817
+ const isAbsoluteName = path10.isAbsolute(name);
17672
17818
  while (directory) {
17673
- const filePath = isAbsoluteName ? name : path8.join(directory, name);
17819
+ const filePath = isAbsoluteName ? name : path10.join(directory, name);
17674
17820
  try {
17675
- const stats = fs5.statSync(filePath, { throwIfNoEntry: false });
17821
+ const stats = fs7.statSync(filePath, { throwIfNoEntry: false });
17676
17822
  if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
17677
17823
  return filePath;
17678
17824
  }
@@ -17681,10 +17827,10 @@ function findUpSync(name, {
17681
17827
  if (directory === stopAt || directory === root) {
17682
17828
  break;
17683
17829
  }
17684
- directory = path8.dirname(directory);
17830
+ directory = path10.dirname(directory);
17685
17831
  }
17686
17832
  }
17687
- function _resolve2(path25, options = {}) {
17833
+ function _resolve2(path27, options = {}) {
17688
17834
  if (options.platform === "auto" || !options.platform)
17689
17835
  options.platform = process4.platform === "win32" ? "win32" : "posix";
17690
17836
  if (process4.versions.pnp) {
@@ -17693,11 +17839,11 @@ function _resolve2(path25, options = {}) {
17693
17839
  paths.push(process4.cwd());
17694
17840
  const targetRequire = createRequire2(import.meta.url);
17695
17841
  try {
17696
- return targetRequire.resolve(path25, { paths });
17842
+ return targetRequire.resolve(path27, { paths });
17697
17843
  } catch {
17698
17844
  }
17699
17845
  }
17700
- const modulePath = resolvePathSync(path25, {
17846
+ const modulePath = resolvePathSync(path27, {
17701
17847
  url: options.paths
17702
17848
  });
17703
17849
  if (options.platform === "win32")
@@ -17718,8 +17864,8 @@ function getPackageJsonPath(name, options = {}) {
17718
17864
  return searchPackageJSON(entry);
17719
17865
  }
17720
17866
  var readFile = quansync2({
17721
- async: (id) => fs5.promises.readFile(id, "utf8"),
17722
- sync: (id) => fs5.readFileSync(id, "utf8")
17867
+ async: (id) => fs7.promises.readFile(id, "utf8"),
17868
+ sync: (id) => fs7.readFileSync(id, "utf8")
17723
17869
  });
17724
17870
  var getPackageInfo = quansync2(function* (name, options = {}) {
17725
17871
  const packageJsonPath = getPackageJsonPath(name, options);
@@ -17758,7 +17904,7 @@ function searchPackageJSON(dir) {
17758
17904
  return;
17759
17905
  dir = newDir;
17760
17906
  packageJsonPath = join3(dir, "package.json");
17761
- if (fs5.existsSync(packageJsonPath))
17907
+ if (fs7.existsSync(packageJsonPath))
17762
17908
  break;
17763
17909
  }
17764
17910
  return packageJsonPath;
@@ -17768,10 +17914,10 @@ var findUp = quansync2({
17768
17914
  async: findUp$1
17769
17915
  });
17770
17916
  var loadPackageJSON = quansync2(function* (cwd = process4.cwd()) {
17771
- const path25 = yield findUp("package.json", { cwd });
17772
- if (!path25 || !fs5.existsSync(path25))
17917
+ const path27 = yield findUp("package.json", { cwd });
17918
+ if (!path27 || !fs7.existsSync(path27))
17773
17919
  return null;
17774
- return JSON.parse(yield readFile(path25));
17920
+ return JSON.parse(yield readFile(path27));
17775
17921
  });
17776
17922
  var loadPackageJSONSync = loadPackageJSON.sync;
17777
17923
  var isPackageListed = quansync2(function* (name, cwd) {
@@ -17782,8 +17928,8 @@ var isPackageListedSync = isPackageListed.sync;
17782
17928
 
17783
17929
  // ../../node_modules/.pnpm/package-manager-detector@1.4.0/node_modules/package-manager-detector/dist/detect.mjs
17784
17930
  init_esm_shims();
17785
- import fs6 from "fs/promises";
17786
- import path9 from "path";
17931
+ import fs8 from "fs/promises";
17932
+ import path11 from "path";
17787
17933
  import process5 from "process";
17788
17934
 
17789
17935
  // ../../node_modules/.pnpm/package-manager-detector@1.4.0/node_modules/package-manager-detector/dist/constants.mjs
@@ -17824,20 +17970,20 @@ var INSTALL_METADATA = {
17824
17970
  };
17825
17971
 
17826
17972
  // ../../node_modules/.pnpm/package-manager-detector@1.4.0/node_modules/package-manager-detector/dist/detect.mjs
17827
- async function pathExists(path25, type) {
17973
+ async function pathExists(path27, type) {
17828
17974
  try {
17829
- const stat6 = await fs6.stat(path25);
17975
+ const stat6 = await fs8.stat(path27);
17830
17976
  return type === "file" ? stat6.isFile() : stat6.isDirectory();
17831
17977
  } catch {
17832
17978
  return false;
17833
17979
  }
17834
17980
  }
17835
17981
  function* lookup(cwd = process5.cwd()) {
17836
- let directory = path9.resolve(cwd);
17837
- const { root } = path9.parse(directory);
17982
+ let directory = path11.resolve(cwd);
17983
+ const { root } = path11.parse(directory);
17838
17984
  while (directory && directory !== root) {
17839
17985
  yield directory;
17840
- directory = path9.dirname(directory);
17986
+ directory = path11.dirname(directory);
17841
17987
  }
17842
17988
  }
17843
17989
  async function parsePackageJson(filepath, onUnknown) {
@@ -17851,7 +17997,7 @@ async function detect(options = {}) {
17851
17997
  } = options;
17852
17998
  let stopDir;
17853
17999
  if (typeof options.stopDir === "string") {
17854
- const resolved = path9.resolve(options.stopDir);
18000
+ const resolved = path11.resolve(options.stopDir);
17855
18001
  stopDir = (dir) => dir === resolved;
17856
18002
  } else {
17857
18003
  stopDir = options.stopDir;
@@ -17861,9 +18007,9 @@ async function detect(options = {}) {
17861
18007
  switch (strategy) {
17862
18008
  case "lockfile": {
17863
18009
  for (const lock of Object.keys(LOCKS)) {
17864
- if (await pathExists(path9.join(directory, lock), "file")) {
18010
+ if (await pathExists(path11.join(directory, lock), "file")) {
17865
18011
  const name = LOCKS[lock];
17866
- const result = await parsePackageJson(path9.join(directory, "package.json"), onUnknown);
18012
+ const result = await parsePackageJson(path11.join(directory, "package.json"), onUnknown);
17867
18013
  if (result)
17868
18014
  return result;
17869
18015
  else
@@ -17874,7 +18020,7 @@ async function detect(options = {}) {
17874
18020
  }
17875
18021
  case "packageManager-field":
17876
18022
  case "devEngines-field": {
17877
- const result = await parsePackageJson(path9.join(directory, "package.json"), onUnknown);
18023
+ const result = await parsePackageJson(path11.join(directory, "package.json"), onUnknown);
17878
18024
  if (result)
17879
18025
  return result;
17880
18026
  break;
@@ -17882,7 +18028,7 @@ async function detect(options = {}) {
17882
18028
  case "install-metadata": {
17883
18029
  for (const metadata of Object.keys(INSTALL_METADATA)) {
17884
18030
  const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
17885
- if (await pathExists(path9.join(directory, metadata), fileOrDir)) {
18031
+ if (await pathExists(path11.join(directory, metadata), fileOrDir)) {
17886
18032
  const name = INSTALL_METADATA[metadata];
17887
18033
  const agent = name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
17888
18034
  return { name, agent };
@@ -17913,7 +18059,7 @@ function getNameAndVer(pkg) {
17913
18059
  }
17914
18060
  async function handlePackageManager(filepath, onUnknown) {
17915
18061
  try {
17916
- const pkg = JSON.parse(await fs6.readFile(filepath, "utf8"));
18062
+ const pkg = JSON.parse(await fs8.readFile(filepath, "utf8"));
17917
18063
  let agent;
17918
18064
  const nameAndVer = getNameAndVer(pkg);
17919
18065
  if (nameAndVer) {
@@ -17943,7 +18089,7 @@ function isMetadataYarnClassic(metadataPath) {
17943
18089
  }
17944
18090
 
17945
18091
  // src/runtime/configPlugin.ts
17946
- import path21 from "pathe";
18092
+ import path23 from "pathe";
17947
18093
  import { loadConfigFromFile } from "vite";
17948
18094
  import tsconfigPaths from "vite-tsconfig-paths";
17949
18095
 
@@ -18032,8 +18178,8 @@ import { wrapPlugin } from "vite-plugin-performance";
18032
18178
  // src/plugins/asset.ts
18033
18179
  init_esm_shims();
18034
18180
  import { fdir as Fdir } from "fdir";
18035
- import fs7 from "fs-extra";
18036
- import path10 from "pathe";
18181
+ import fs9 from "fs-extra";
18182
+ import path12 from "pathe";
18037
18183
  function asset(ctx) {
18038
18184
  const state = { ctx };
18039
18185
  return [createAssetCollector(state)];
@@ -18076,7 +18222,7 @@ function scanAssetFiles(configService, config) {
18076
18222
  const filter3 = weappViteConfig?.copy?.filter ?? (() => true);
18077
18223
  const ignore = [
18078
18224
  ...defaultExcluded,
18079
- path10.resolve(configService.cwd, `${config.build.outDir}/**/*`),
18225
+ path12.resolve(configService.cwd, `${config.build.outDir}/**/*`),
18080
18226
  ...exclude
18081
18227
  ];
18082
18228
  const fdir = new Fdir({
@@ -18095,7 +18241,7 @@ function scanAssetFiles(configService, config) {
18095
18241
  files.filter(filter3).map(async (file) => {
18096
18242
  return {
18097
18243
  file,
18098
- buffer: await fs7.readFile(file)
18244
+ buffer: await fs9.readFile(file)
18099
18245
  };
18100
18246
  })
18101
18247
  );
@@ -18108,7 +18254,7 @@ function normalizeCopyGlobs(globs) {
18108
18254
  // src/plugins/autoImport.ts
18109
18255
  init_esm_shims();
18110
18256
  import { fdir as Fdir2 } from "fdir";
18111
- import path11 from "pathe";
18257
+ import path13 from "pathe";
18112
18258
  function autoImport(ctx) {
18113
18259
  const state = { ctx };
18114
18260
  return [createAutoImportPlugin(state)];
@@ -18185,7 +18331,7 @@ async function findTemplateCandidates(state, globs) {
18185
18331
  ],
18186
18332
  pathSeparator: "/"
18187
18333
  });
18188
- return await fdir.withFullPaths().globWithOptions(globs.map((pattern) => path11.resolve(configService.absoluteSrcRoot, pattern)), {
18334
+ return await fdir.withFullPaths().globWithOptions(globs.map((pattern) => path13.resolve(configService.absoluteSrcRoot, pattern)), {
18189
18335
  ignore
18190
18336
  }).crawl(configService.absoluteSrcRoot).withPromise();
18191
18337
  }
@@ -18201,14 +18347,14 @@ function resolveAbsolutePath(ctx, candidate) {
18201
18347
  if (!configService) {
18202
18348
  return void 0;
18203
18349
  }
18204
- if (path11.isAbsolute(candidate)) {
18350
+ if (path13.isAbsolute(candidate)) {
18205
18351
  return candidate;
18206
18352
  }
18207
- const resolvedFromSrc = path11.resolve(configService.absoluteSrcRoot, candidate);
18353
+ const resolvedFromSrc = path13.resolve(configService.absoluteSrcRoot, candidate);
18208
18354
  if (resolvedFromSrc.startsWith(configService.absoluteSrcRoot)) {
18209
18355
  return resolvedFromSrc;
18210
18356
  }
18211
- return path11.resolve(configService.cwd, candidate);
18357
+ return path13.resolve(configService.cwd, candidate);
18212
18358
  }
18213
18359
  function matchesAutoImportGlobs(ctx, candidate) {
18214
18360
  const { autoImportService, configService } = ctx;
@@ -18236,8 +18382,8 @@ function matchesAutoImportGlobs(ctx, candidate) {
18236
18382
  // src/plugins/core.ts
18237
18383
  init_esm_shims();
18238
18384
  import { isEmptyObject as isEmptyObject2, isObject as isObject6, removeExtensionDeep as removeExtensionDeep4 } from "@weapp-core/shared";
18239
- import fs10 from "fs-extra";
18240
- import path16 from "pathe";
18385
+ import fs12 from "fs-extra";
18386
+ import path18 from "pathe";
18241
18387
  import { build as build2 } from "vite";
18242
18388
 
18243
18389
  // src/wxml/handle.ts
@@ -19443,11 +19589,51 @@ function transformWxsCode(code, options) {
19443
19589
  }
19444
19590
 
19445
19591
  // src/wxml/handle.ts
19592
+ var handleCache = /* @__PURE__ */ new WeakMap();
19593
+ var inlineWxsTransformCache = /* @__PURE__ */ new Map();
19594
+ var INLINE_WXS_CACHE_LIMIT = 256;
19595
+ function createCacheKey(options) {
19596
+ return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}`;
19597
+ }
19598
+ function getCachedResult(data2, cacheKey) {
19599
+ return handleCache.get(data2)?.get(cacheKey);
19600
+ }
19601
+ function setCachedResult(data2, cacheKey, result) {
19602
+ let cacheForToken = handleCache.get(data2);
19603
+ if (!cacheForToken) {
19604
+ cacheForToken = /* @__PURE__ */ new Map();
19605
+ handleCache.set(data2, cacheForToken);
19606
+ }
19607
+ cacheForToken.set(cacheKey, result);
19608
+ return result;
19609
+ }
19610
+ function getCachedInlineWxsTransform(code) {
19611
+ const cached = inlineWxsTransformCache.get(code);
19612
+ if (cached) {
19613
+ inlineWxsTransformCache.delete(code);
19614
+ inlineWxsTransformCache.set(code, cached);
19615
+ return cached;
19616
+ }
19617
+ const transformed = transformWxsCode(code);
19618
+ inlineWxsTransformCache.set(code, transformed);
19619
+ if (inlineWxsTransformCache.size > INLINE_WXS_CACHE_LIMIT) {
19620
+ const firstKey = inlineWxsTransformCache.keys().next().value;
19621
+ if (firstKey) {
19622
+ inlineWxsTransformCache.delete(firstKey);
19623
+ }
19624
+ }
19625
+ return transformed;
19626
+ }
19446
19627
  function handleWxml(data2, options) {
19447
19628
  const opts = defu2(options, {
19448
19629
  removeComment: true,
19449
19630
  transformEvent: true
19450
19631
  });
19632
+ const cacheKey = createCacheKey(opts);
19633
+ const cached = getCachedResult(data2, cacheKey);
19634
+ if (cached) {
19635
+ return cached;
19636
+ }
19451
19637
  const {
19452
19638
  code,
19453
19639
  removalRanges,
@@ -19466,11 +19652,11 @@ function handleWxml(data2, options) {
19466
19652
  const shouldRemoveConditionals = removalRanges.length > 0;
19467
19653
  const shouldRemoveComments = opts.removeComment && commentTokens.length > 0;
19468
19654
  if (!shouldNormalizeImports && !shouldRemoveLang && !shouldTransformInlineWxs && !shouldTransformEvents && !shouldRemoveConditionals && !shouldRemoveComments) {
19469
- return {
19655
+ return setCachedResult(data2, cacheKey, {
19470
19656
  code,
19471
19657
  components: components2,
19472
19658
  deps
19473
- };
19659
+ });
19474
19660
  }
19475
19661
  const ms = new MagicString(code);
19476
19662
  if (shouldNormalizeImports) {
@@ -19485,7 +19671,7 @@ function handleWxml(data2, options) {
19485
19671
  }
19486
19672
  if (shouldTransformInlineWxs) {
19487
19673
  for (const { end, start, value } of inlineWxsTokens) {
19488
- const { result } = transformWxsCode(value);
19674
+ const { result } = getCachedInlineWxsTransform(value);
19489
19675
  if (result?.code) {
19490
19676
  ms.update(start, end, `
19491
19677
  ${result.code}`);
@@ -19498,7 +19684,7 @@ ${result.code}`);
19498
19684
  }
19499
19685
  }
19500
19686
  if (shouldRemoveConditionals) {
19501
- for (const { start, end } of [...removalRanges].sort((a, b) => b.start - a.start)) {
19687
+ for (const { start, end } of removalRanges) {
19502
19688
  if (end > start) {
19503
19689
  ms.remove(start, end);
19504
19690
  }
@@ -19509,11 +19695,11 @@ ${result.code}`);
19509
19695
  ms.remove(start, end);
19510
19696
  }
19511
19697
  }
19512
- return {
19698
+ return setCachedResult(data2, cacheKey, {
19513
19699
  code: ms.toString(),
19514
19700
  components: components2,
19515
19701
  deps
19516
- };
19702
+ });
19517
19703
  }
19518
19704
 
19519
19705
  // src/plugins/hooks/useLoadEntry/index.ts
@@ -19597,13 +19783,13 @@ function createJsonEmitManager(configService) {
19597
19783
  init_esm_shims();
19598
19784
  import { performance as performance3 } from "perf_hooks";
19599
19785
  import { removeExtensionDeep as removeExtensionDeep3 } from "@weapp-core/shared";
19600
- import fs8 from "fs-extra";
19601
- import path13 from "pathe";
19786
+ import fs10 from "fs-extra";
19787
+ import path15 from "pathe";
19602
19788
 
19603
19789
  // src/plugins/utils/analyze.ts
19604
19790
  init_esm_shims();
19605
19791
  import { get as get3, isObject as isObject4, removeExtension } from "@weapp-core/shared";
19606
- import path12 from "pathe";
19792
+ import path14 from "pathe";
19607
19793
  function collectPluginExportEntries(plugins, root) {
19608
19794
  if (!isObject4(plugins)) {
19609
19795
  return [];
@@ -19618,7 +19804,7 @@ function collectPluginExportEntries(plugins, root) {
19618
19804
  continue;
19619
19805
  }
19620
19806
  const normalized = removeExtension(exportPath);
19621
- entries.push(root ? path12.join(root, normalized) : normalized);
19807
+ entries.push(root ? path14.join(root, normalized) : normalized);
19622
19808
  }
19623
19809
  return entries;
19624
19810
  }
@@ -19659,6 +19845,86 @@ function analyzeCommonJson(json) {
19659
19845
  }
19660
19846
 
19661
19847
  // src/plugins/hooks/useLoadEntry/loadEntry.ts
19848
+ function createStopwatch() {
19849
+ const start = performance3.now();
19850
+ return () => `${(performance3.now() - start).toFixed(2)}ms`;
19851
+ }
19852
+ async function addWatchTarget(pluginCtx, target, existsCache) {
19853
+ if (!target || typeof pluginCtx.addWatchFile !== "function") {
19854
+ return false;
19855
+ }
19856
+ if (existsCache.has(target)) {
19857
+ const cached = existsCache.get(target);
19858
+ if (cached) {
19859
+ pluginCtx.addWatchFile(target);
19860
+ }
19861
+ return cached;
19862
+ }
19863
+ const exists = await fs10.exists(target);
19864
+ if (exists) {
19865
+ pluginCtx.addWatchFile(target);
19866
+ }
19867
+ existsCache.set(target, exists);
19868
+ return exists;
19869
+ }
19870
+ async function collectStyleImports(pluginCtx, id, existsCache) {
19871
+ const styleImports = [];
19872
+ for (const ext2 of supportedCssLangs) {
19873
+ const mayBeCssPath = changeFileExtension(id, ext2);
19874
+ const exists = await addWatchTarget(pluginCtx, mayBeCssPath, existsCache);
19875
+ if (exists) {
19876
+ styleImports.push(mayBeCssPath);
19877
+ }
19878
+ }
19879
+ return styleImports;
19880
+ }
19881
+ async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJsonAsset, existsCache) {
19882
+ const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = json;
19883
+ const processSideJson = async (location) => {
19884
+ if (!location) {
19885
+ return;
19886
+ }
19887
+ const { path: jsonPath, predictions } = await findJsonEntry(
19888
+ path15.resolve(path15.dirname(id), location)
19889
+ );
19890
+ for (const prediction of predictions) {
19891
+ await addWatchTarget(pluginCtx, prediction, existsCache);
19892
+ }
19893
+ if (!jsonPath) {
19894
+ return;
19895
+ }
19896
+ const content = await jsonService.read(jsonPath);
19897
+ registerJsonAsset({
19898
+ json: content,
19899
+ jsonPath,
19900
+ type: "app"
19901
+ });
19902
+ };
19903
+ await processSideJson(sitemapLocation);
19904
+ await processSideJson(themeLocation);
19905
+ }
19906
+ async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry, existsCache) {
19907
+ const { path: templateEntry, predictions } = await findTemplateEntry(id);
19908
+ for (const prediction of predictions) {
19909
+ await addWatchTarget(pluginCtx, prediction, existsCache);
19910
+ }
19911
+ if (!templateEntry) {
19912
+ return "";
19913
+ }
19914
+ await scanTemplateEntry(templateEntry);
19915
+ return templateEntry;
19916
+ }
19917
+ async function resolveEntries(entries, absoluteSrcRoot) {
19918
+ return Promise.all(
19919
+ entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
19920
+ const absPath = path15.resolve(absoluteSrcRoot, entry);
19921
+ return {
19922
+ entry,
19923
+ resolvedId: await this.resolve(absPath)
19924
+ };
19925
+ })
19926
+ );
19927
+ }
19662
19928
  function createEntryLoader(options) {
19663
19929
  const {
19664
19930
  ctx,
@@ -19672,16 +19938,18 @@ function createEntryLoader(options) {
19672
19938
  debug: debug4
19673
19939
  } = options;
19674
19940
  const { jsonService, configService } = ctx;
19941
+ const existsCache = /* @__PURE__ */ new Map();
19675
19942
  return async function loadEntry(id, type) {
19676
- const start = performance3.now();
19677
- const getTime = () => `${(performance3.now() - start).toFixed(2)}ms`;
19943
+ existsCache.clear();
19944
+ const stopwatch = debug4 ? createStopwatch() : void 0;
19945
+ const getTime = () => stopwatch ? stopwatch() : "0.00ms";
19678
19946
  const relativeCwdId = configService.relativeCwd(id);
19679
19947
  this.addWatchFile(id);
19680
19948
  const baseName = removeExtensionDeep3(id);
19681
19949
  const jsonEntry = await findJsonEntry(id);
19682
19950
  let jsonPath = jsonEntry.path;
19683
19951
  for (const prediction of jsonEntry.predictions) {
19684
- await addWatchTarget(this, prediction);
19952
+ await addWatchTarget(this, prediction, existsCache);
19685
19953
  }
19686
19954
  let json = {};
19687
19955
  if (jsonPath) {
@@ -19698,10 +19966,11 @@ function createEntryLoader(options) {
19698
19966
  id,
19699
19967
  json,
19700
19968
  jsonService,
19701
- registerJsonAsset
19969
+ registerJsonAsset,
19970
+ existsCache
19702
19971
  );
19703
19972
  } else {
19704
- templatePath = await ensureTemplateScanned(this, id, scanTemplateEntry);
19973
+ templatePath = await ensureTemplateScanned(this, id, scanTemplateEntry, existsCache);
19705
19974
  applyAutoImports(baseName, json);
19706
19975
  entries.push(...analyzeCommonJson(json));
19707
19976
  }
@@ -19721,108 +19990,49 @@ function createEntryLoader(options) {
19721
19990
  configService.absoluteSrcRoot
19722
19991
  );
19723
19992
  debug4?.(`resolvedIds ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
19724
- await Promise.all(
19725
- emitEntriesChunks.call(
19726
- this,
19727
- resolvedIds.filter(({ entry, resolvedId }) => {
19728
- if (!resolvedId) {
19729
- logger_default.warn(`\u6CA1\u6709\u627E\u5230 \`${entry}\` \u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
19730
- return false;
19731
- }
19732
- if (loadedEntrySet.has(resolvedId.id)) {
19733
- return false;
19734
- }
19735
- return true;
19736
- }).map((item) => item.resolvedId)
19737
- )
19738
- );
19993
+ const pendingResolvedIds = [];
19994
+ for (const { entry, resolvedId } of resolvedIds) {
19995
+ if (!resolvedId) {
19996
+ logger_default.warn(`\u6CA1\u6709\u627E\u5230 \`${entry}\` \u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
19997
+ continue;
19998
+ }
19999
+ if (loadedEntrySet.has(resolvedId.id)) {
20000
+ continue;
20001
+ }
20002
+ pendingResolvedIds.push(resolvedId);
20003
+ }
20004
+ if (pendingResolvedIds.length) {
20005
+ await Promise.all(emitEntriesChunks.call(this, pendingResolvedIds));
20006
+ }
19739
20007
  debug4?.(`emitEntriesChunks ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
19740
20008
  registerJsonAsset({
19741
20009
  jsonPath,
19742
20010
  json,
19743
20011
  type
19744
20012
  });
19745
- const code = await fs8.readFile(id, "utf8");
19746
- const ms = new MagicString(code);
19747
- await prependStyleImports.call(this, id, ms);
20013
+ const code = await fs10.readFile(id, "utf8");
20014
+ const styleImports = await collectStyleImports(this, id, existsCache);
19748
20015
  debug4?.(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
19749
- return {
19750
- code: ms.toString()
19751
- };
19752
- };
19753
- }
19754
- async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJsonAsset) {
19755
- const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = json;
19756
- const processSideJson = async (location) => {
19757
- if (!location) {
19758
- return;
19759
- }
19760
- const { path: jsonPath, predictions } = await findJsonEntry(
19761
- path13.resolve(path13.dirname(id), location)
19762
- );
19763
- for (const prediction of predictions) {
19764
- await addWatchTarget(pluginCtx, prediction);
19765
- }
19766
- if (!jsonPath) {
19767
- return;
19768
- }
19769
- const content = await jsonService.read(jsonPath);
19770
- registerJsonAsset({
19771
- json: content,
19772
- jsonPath,
19773
- type: "app"
19774
- });
19775
- };
19776
- await processSideJson(sitemapLocation);
19777
- await processSideJson(themeLocation);
19778
- }
19779
- async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry) {
19780
- const { path: templateEntry, predictions } = await findTemplateEntry(id);
19781
- for (const prediction of predictions) {
19782
- await addWatchTarget(pluginCtx, prediction);
19783
- }
19784
- if (!templateEntry) {
19785
- return "";
19786
- }
19787
- await scanTemplateEntry(templateEntry);
19788
- return templateEntry;
19789
- }
19790
- async function resolveEntries(entries, absoluteSrcRoot) {
19791
- return Promise.all(
19792
- entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
19793
- const absPath = path13.resolve(absoluteSrcRoot, entry);
20016
+ if (styleImports.length === 0) {
19794
20017
  return {
19795
- entry,
19796
- resolvedId: await this.resolve(absPath)
20018
+ code
19797
20019
  };
19798
- })
19799
- );
19800
- }
19801
- async function prependStyleImports(id, ms) {
19802
- for (const ext2 of supportedCssLangs) {
19803
- const mayBeCssPath = changeFileExtension(id, ext2);
19804
- const exists = await addWatchTarget(this, mayBeCssPath);
19805
- if (exists) {
19806
- ms.prepend(`import '${mayBeCssPath}';
20020
+ }
20021
+ const ms = new MagicString(code);
20022
+ for (const styleImport of styleImports) {
20023
+ ms.prepend(`import '${styleImport}';
19807
20024
  `);
19808
20025
  }
19809
- }
19810
- }
19811
- async function addWatchTarget(pluginCtx, target) {
19812
- if (!target || typeof pluginCtx.addWatchFile !== "function") {
19813
- return false;
19814
- }
19815
- const exists = await fs8.exists(target);
19816
- if (exists) {
19817
- pluginCtx.addWatchFile(target);
19818
- }
19819
- return exists;
20026
+ return {
20027
+ code: ms.toString()
20028
+ };
20029
+ };
19820
20030
  }
19821
20031
 
19822
20032
  // src/plugins/hooks/useLoadEntry/normalizer.ts
19823
20033
  init_esm_shims();
19824
20034
  import { isObject as isObject5 } from "@weapp-core/shared";
19825
- import path14 from "pathe";
20035
+ import path16 from "pathe";
19826
20036
  function createEntryNormalizer(configService) {
19827
20037
  return function normalizeEntry(entry, jsonPath) {
19828
20038
  if (/plugin:\/\//.test(entry)) {
@@ -19847,8 +20057,8 @@ function resolveImportee2(importee, jsonPath, configService) {
19847
20057
  updated = importee.replace(matchedEntry.find, matchedEntry.replacement);
19848
20058
  }
19849
20059
  }
19850
- const baseDir = jsonPath ? path14.dirname(jsonPath) : configService.absoluteSrcRoot;
19851
- return path14.resolve(baseDir, updated);
20060
+ const baseDir = jsonPath ? path16.dirname(jsonPath) : configService.absoluteSrcRoot;
20061
+ return path16.resolve(baseDir, updated);
19852
20062
  }
19853
20063
  function hasDependencyPrefix(dependencies, tokens) {
19854
20064
  return Object.keys(dependencies).some((dep) => {
@@ -19937,16 +20147,16 @@ function collectRequireTokens(ast) {
19937
20147
 
19938
20148
  // src/plugins/utils/invalidateEntry.ts
19939
20149
  init_esm_shims();
19940
- import fs9 from "fs";
20150
+ import fs11 from "fs";
19941
20151
  import process6 from "process";
19942
- import path15 from "pathe";
20152
+ import path17 from "pathe";
19943
20153
  var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
19944
20154
  var configSuffixes = configExtensions.map((ext2) => `.${ext2}`);
19945
20155
  var sidecarSuffixes = [...configSuffixes, ...watchedCssExts];
19946
20156
  var supportsRecursiveWatch = process6.platform === "darwin" || process6.platform === "win32";
19947
20157
  async function invalidateEntryForSidecar(filePath) {
19948
20158
  const configSuffix = configSuffixes.find((suffix) => filePath.endsWith(suffix));
19949
- const ext2 = path15.extname(filePath);
20159
+ const ext2 = path17.extname(filePath);
19950
20160
  let scriptBasePath;
19951
20161
  if (configSuffix) {
19952
20162
  scriptBasePath = filePath.slice(0, -configSuffix.length);
@@ -19967,8 +20177,8 @@ function ensureSidecarWatcher(ctx, rootDir) {
19967
20177
  return;
19968
20178
  }
19969
20179
  const { sidecarWatcherMap } = ctx.runtimeState.watcher;
19970
- const absRoot = path15.normalize(rootDir);
19971
- if (!fs9.existsSync(absRoot)) {
20180
+ const absRoot = path17.normalize(rootDir);
20181
+ if (!fs11.existsSync(absRoot)) {
19972
20182
  return;
19973
20183
  }
19974
20184
  if (sidecarWatcherMap.has(absRoot)) {
@@ -19981,11 +20191,11 @@ function ensureSidecarWatcher(ctx, rootDir) {
19981
20191
  void invalidateEntryForSidecar(filePath);
19982
20192
  };
19983
20193
  if (supportsRecursiveWatch) {
19984
- const watcher2 = fs9.watch(absRoot, { recursive: true }, (_event, filename) => {
20194
+ const watcher2 = fs11.watch(absRoot, { recursive: true }, (_event, filename) => {
19985
20195
  if (!filename) {
19986
20196
  return;
19987
20197
  }
19988
- const resolved = path15.join(absRoot, filename.toString());
20198
+ const resolved = path17.join(absRoot, filename.toString());
19989
20199
  handleSidecarChange(resolved);
19990
20200
  });
19991
20201
  sidecarWatcherMap.set(absRoot, {
@@ -19996,8 +20206,8 @@ function ensureSidecarWatcher(ctx, rootDir) {
19996
20206
  return;
19997
20207
  }
19998
20208
  const patterns = [
19999
- ...configExtensions.map((ext2) => path15.join(absRoot, `**/*.${ext2}`)),
20000
- ...supportedCssLangs.map((ext2) => path15.join(absRoot, `**/*.${ext2}`))
20209
+ ...configExtensions.map((ext2) => path17.join(absRoot, `**/*.${ext2}`)),
20210
+ ...supportedCssLangs.map((ext2) => path17.join(absRoot, `**/*.${ext2}`))
20001
20211
  ];
20002
20212
  const watcher = esm_default.watch(patterns, {
20003
20213
  ignoreInitial: true,
@@ -20080,7 +20290,7 @@ function createCoreLifecyclePlugin(state) {
20080
20290
  buildStart() {
20081
20291
  loadedEntrySet.clear();
20082
20292
  if (configService.isDev) {
20083
- const rootDir = subPackageMeta ? path16.resolve(configService.absoluteSrcRoot, subPackageMeta.subPackage.root) : configService.absoluteSrcRoot;
20293
+ const rootDir = subPackageMeta ? path18.resolve(configService.absoluteSrcRoot, subPackageMeta.subPackage.root) : configService.absoluteSrcRoot;
20084
20294
  ensureSidecarWatcher(ctx, rootDir);
20085
20295
  }
20086
20296
  },
@@ -20112,7 +20322,7 @@ function createCoreLifecyclePlugin(state) {
20112
20322
  let scannedInput;
20113
20323
  if (subPackageMeta) {
20114
20324
  scannedInput = subPackageMeta.entries.reduce((acc, entry) => {
20115
- acc[entry] = path16.resolve(configService.absoluteSrcRoot, entry);
20325
+ acc[entry] = path18.resolve(configService.absoluteSrcRoot, entry);
20116
20326
  return acc;
20117
20327
  }, {});
20118
20328
  } else {
@@ -20163,8 +20373,8 @@ function createCoreLifecyclePlugin(state) {
20163
20373
  if (parsed.query.wxss) {
20164
20374
  const realPath = getCssRealPath(parsed);
20165
20375
  this.addWatchFile(realPath);
20166
- if (await fs10.exists(realPath)) {
20167
- const css2 = await fs10.readFile(realPath, "utf8");
20376
+ if (await fs12.exists(realPath)) {
20377
+ const css2 = await fs12.readFile(realPath, "utf8");
20168
20378
  return { code: css2 };
20169
20379
  }
20170
20380
  }
@@ -20235,7 +20445,7 @@ function createRequireAnalysisPlugin(state) {
20235
20445
  return;
20236
20446
  }
20237
20447
  for (const requireModule of requireTokens) {
20238
- const absPath = path16.resolve(path16.dirname(moduleInfo.id), requireModule.value);
20448
+ const absPath = path18.resolve(path18.dirname(moduleInfo.id), requireModule.value);
20239
20449
  const resolved = await this.resolve(absPath, moduleInfo.id);
20240
20450
  if (!resolved) {
20241
20451
  continue;
@@ -20588,8 +20798,8 @@ function createEnvSynchronizer({ configService }) {
20588
20798
  init_esm_shims();
20589
20799
  import { createHash } from "crypto";
20590
20800
  import { removeExtension as removeExtension2 } from "@weapp-core/shared";
20591
- import fs11 from "fs-extra";
20592
- import path17 from "pathe";
20801
+ import fs13 from "fs-extra";
20802
+ import path19 from "pathe";
20593
20803
  function workers(ctx) {
20594
20804
  if (!ctx.scanService.workersDir) {
20595
20805
  return [];
@@ -20617,23 +20827,23 @@ function createWorkerBuildPlugin(ctx) {
20617
20827
  options.chunkFileNames = (chunkInfo) => {
20618
20828
  const workersDir = scanService.workersDir ?? "";
20619
20829
  if (chunkInfo.isDynamicEntry) {
20620
- return path17.join(workersDir, "[name].js");
20830
+ return path19.join(workersDir, "[name].js");
20621
20831
  }
20622
20832
  const sourceId = chunkInfo.facadeModuleId ?? chunkInfo.moduleIds[0];
20623
20833
  const hashBase = typeof sourceId === "string" ? configService.relativeCwd(sourceId) : chunkInfo.name;
20624
20834
  const stableHash = createHash("sha256").update(hashBase).digest("base64url").slice(0, 8);
20625
- return path17.join(workersDir, `${chunkInfo.name}-${stableHash}.js`);
20835
+ return path19.join(workersDir, `${chunkInfo.name}-${stableHash}.js`);
20626
20836
  };
20627
20837
  }
20628
20838
  };
20629
20839
  }
20630
20840
  async function resolveWorkerEntry(ctx, entry) {
20631
20841
  const { configService, scanService } = ctx;
20632
- const relativeEntryPath = path17.join(scanService.workersDir, entry);
20842
+ const relativeEntryPath = path19.join(scanService.workersDir, entry);
20633
20843
  const key = removeExtension2(relativeEntryPath);
20634
- const absoluteEntry = path17.resolve(configService.absoluteSrcRoot, relativeEntryPath);
20844
+ const absoluteEntry = path19.resolve(configService.absoluteSrcRoot, relativeEntryPath);
20635
20845
  if (isJsOrTs(entry)) {
20636
- const exists = await fs11.exists(absoluteEntry);
20846
+ const exists = await fs13.exists(absoluteEntry);
20637
20847
  if (!exists) {
20638
20848
  logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
20639
20849
  return { key };
@@ -20651,8 +20861,8 @@ async function resolveWorkerEntry(ctx, entry) {
20651
20861
  // src/plugins/wxs.ts
20652
20862
  init_esm_shims();
20653
20863
  import { removeExtension as removeExtension3 } from "@weapp-core/shared";
20654
- import fs12 from "fs-extra";
20655
- import path18 from "pathe";
20864
+ import fs14 from "fs-extra";
20865
+ import path20 from "pathe";
20656
20866
  var wxsCodeCache = new LRUCache({
20657
20867
  max: 512
20658
20868
  });
@@ -20697,7 +20907,7 @@ async function handleWxsDeps(state, deps, absPath) {
20697
20907
  if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
20698
20908
  return;
20699
20909
  }
20700
- const wxsPath = path18.resolve(path18.dirname(absPath), dep.value);
20910
+ const wxsPath = path20.resolve(path20.dirname(absPath), dep.value);
20701
20911
  await transformWxsFile.call(this, state, wxsPath);
20702
20912
  })
20703
20913
  );
@@ -20706,7 +20916,7 @@ async function transformWxsFile(state, wxsPath) {
20706
20916
  const { ctx } = state;
20707
20917
  const { configService } = ctx;
20708
20918
  this.addWatchFile(wxsPath);
20709
- if (!await fs12.exists(wxsPath)) {
20919
+ if (!await fs14.exists(wxsPath)) {
20710
20920
  return;
20711
20921
  }
20712
20922
  const suffixMatch = wxsPath.match(/\.wxs(\.[jt]s)?$/);
@@ -20714,7 +20924,7 @@ async function transformWxsFile(state, wxsPath) {
20714
20924
  if (suffixMatch) {
20715
20925
  isRaw = !suffixMatch[1];
20716
20926
  }
20717
- const rawCode = await fs12.readFile(wxsPath, "utf8");
20927
+ const rawCode = await fs14.readFile(wxsPath, "utf8");
20718
20928
  let code = wxsCodeCache.get(rawCode);
20719
20929
  if (code === void 0) {
20720
20930
  const { result, importees } = transformWxsCode(rawCode, {
@@ -20723,13 +20933,13 @@ async function transformWxsFile(state, wxsPath) {
20723
20933
  if (typeof result?.code === "string") {
20724
20934
  code = result.code;
20725
20935
  }
20726
- const dirname5 = path18.dirname(wxsPath);
20936
+ const dirname5 = path20.dirname(wxsPath);
20727
20937
  await Promise.all(
20728
20938
  importees.map(({ source }) => {
20729
20939
  return transformWxsFile.call(
20730
20940
  this,
20731
20941
  state,
20732
- path18.resolve(dirname5, source)
20942
+ path20.resolve(dirname5, source)
20733
20943
  );
20734
20944
  })
20735
20945
  );
@@ -20791,8 +21001,8 @@ function flatten(groups) {
20791
21001
 
20792
21002
  // src/runtime/oxcRuntime.ts
20793
21003
  init_esm_shims();
20794
- import fs13 from "fs-extra";
20795
- import path19 from "pathe";
21004
+ import fs15 from "fs-extra";
21005
+ import path21 from "pathe";
20796
21006
  var NULL_BYTE = "\0";
20797
21007
  var OXC_RUNTIME_HELPER_ALIAS = new RegExp(`^(?:${NULL_BYTE})?@oxc-project(?:/|\\+)runtime(?:@[^/]+)?/helpers/(.+)\\.js$`);
20798
21008
  var FALLBACK_HELPER_PREFIX = `${NULL_BYTE}weapp-vite:oxc-helper:`;
@@ -20860,7 +21070,7 @@ function getOxcHelperName(id) {
20860
21070
  }
20861
21071
  function createOxcRuntimeSupport() {
20862
21072
  const oxcRuntimeInfo = getPackageInfoSync("@oxc-project/runtime");
20863
- const oxcRuntimeHelpersRoot = oxcRuntimeInfo ? path19.resolve(oxcRuntimeInfo.rootPath, "src/helpers/esm") : void 0;
21073
+ const oxcRuntimeHelpersRoot = oxcRuntimeInfo ? path21.resolve(oxcRuntimeInfo.rootPath, "src/helpers/esm") : void 0;
20864
21074
  const alias = {
20865
21075
  find: OXC_RUNTIME_HELPER_ALIAS,
20866
21076
  replacement: "@oxc-project/runtime/src/helpers/esm/$1.js"
@@ -20887,7 +21097,7 @@ function createOxcRuntimeSupport() {
20887
21097
  }
20888
21098
  return null;
20889
21099
  }
20890
- return path19.resolve(helpersRoot, `${helperName}.js`);
21100
+ return path21.resolve(helpersRoot, `${helperName}.js`);
20891
21101
  },
20892
21102
  async load(id) {
20893
21103
  if (id.startsWith(FALLBACK_HELPER_PREFIX)) {
@@ -20900,10 +21110,10 @@ function createOxcRuntimeSupport() {
20900
21110
  }
20901
21111
  const helperName = getOxcHelperName(id);
20902
21112
  if (helperName) {
20903
- const helperPath = id.startsWith(NULL_BYTE) ? path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
20904
- if (await fs13.pathExists(helperPath)) {
21113
+ const helperPath = id.startsWith(NULL_BYTE) ? path21.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
21114
+ if (await fs15.pathExists(helperPath)) {
20905
21115
  console.warn("[weapp-vite] resolving oxc helper via Rolldown plugin:", helperName);
20906
- return fs13.readFile(helperPath, "utf8");
21116
+ return fs15.readFile(helperPath, "utf8");
20907
21117
  }
20908
21118
  const fallback = fallbackHelpers[helperName];
20909
21119
  if (fallback) {
@@ -20925,7 +21135,7 @@ function createOxcRuntimeSupport() {
20925
21135
  }
20926
21136
  const helperName = getOxcHelperName(source);
20927
21137
  if (helperName) {
20928
- return path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
21138
+ return path21.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20929
21139
  }
20930
21140
  return null;
20931
21141
  },
@@ -20937,9 +21147,9 @@ function createOxcRuntimeSupport() {
20937
21147
  if (!helperName) {
20938
21148
  return null;
20939
21149
  }
20940
- const helperPath = path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
21150
+ const helperPath = path21.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20941
21151
  console.warn("[weapp-vite] resolving oxc helper via Vite plugin:", helperName);
20942
- return fs13.readFile(helperPath, "utf8");
21152
+ return fs15.readFile(helperPath, "utf8");
20943
21153
  }
20944
21154
  };
20945
21155
  return {
@@ -20952,7 +21162,7 @@ function createOxcRuntimeSupport() {
20952
21162
  // src/runtime/packageAliases.ts
20953
21163
  init_esm_shims();
20954
21164
  import { existsSync } from "fs";
20955
- import path20 from "pathe";
21165
+ import path22 from "pathe";
20956
21166
  var SPECIAL_PACKAGE_ALIASES = [
20957
21167
  {
20958
21168
  packageName: "class-variance-authority",
@@ -20966,7 +21176,7 @@ function resolveBuiltinPackageAliases() {
20966
21176
  if (!info) {
20967
21177
  continue;
20968
21178
  }
20969
- const resolvedEntry = path20.resolve(info.rootPath, distEntry);
21179
+ const resolvedEntry = path22.resolve(info.rootPath, distEntry);
20970
21180
  if (!existsSync(resolvedEntry)) {
20971
21181
  continue;
20972
21182
  }
@@ -21040,29 +21250,39 @@ function createConfigService(ctx) {
21040
21250
  if (!mpDistRoot) {
21041
21251
  throw new Error("\u8BF7\u5728 `project.config.json` \u91CC\u8BBE\u7F6E `miniprogramRoot`, \u6BD4\u5982\u53EF\u4EE5\u8BBE\u7F6E\u4E3A `dist/` ");
21042
21252
  }
21043
- const packageJsonPath = path21.resolve(cwd, "package.json");
21253
+ const packageJsonPath = path23.resolve(cwd, "package.json");
21044
21254
  let packageJson = {};
21045
- if (await fs14.exists(packageJsonPath)) {
21046
- const localPackageJson = await fs14.readJson(packageJsonPath, {
21255
+ if (await fs16.exists(packageJsonPath)) {
21256
+ const localPackageJson = await fs16.readJson(packageJsonPath, {
21047
21257
  throws: false
21048
21258
  }) || {};
21049
21259
  packageJson = localPackageJson;
21050
21260
  }
21051
21261
  let resolvedConfigFile = configFile;
21052
- if (resolvedConfigFile && !path21.isAbsolute(resolvedConfigFile)) {
21053
- resolvedConfigFile = path21.resolve(cwd, resolvedConfigFile);
21262
+ if (resolvedConfigFile && !path23.isAbsolute(resolvedConfigFile)) {
21263
+ resolvedConfigFile = path23.resolve(cwd, resolvedConfigFile);
21054
21264
  }
21265
+ const weappConfigFilePath = await resolveWeappConfigFile({
21266
+ root: cwd,
21267
+ specified: resolvedConfigFile
21268
+ });
21055
21269
  const loaded = await loadConfigFromFile({
21056
21270
  command: isDev ? "serve" : "build",
21057
21271
  mode
21058
21272
  }, resolvedConfigFile, cwd);
21059
21273
  const loadedConfig = loaded?.config;
21060
- const srcRoot = loadedConfig?.weapp?.srcRoot ?? "";
21061
- function relativeSrcRoot(p) {
21062
- if (srcRoot) {
21063
- return path21.relative(srcRoot, p);
21274
+ let weappLoaded;
21275
+ if (weappConfigFilePath) {
21276
+ const normalizedWeappPath = path23.resolve(weappConfigFilePath);
21277
+ const normalizedLoadedPath = loaded?.path ? path23.resolve(loaded.path) : void 0;
21278
+ if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
21279
+ weappLoaded = loaded;
21280
+ } else {
21281
+ weappLoaded = await loadConfigFromFile({
21282
+ command: isDev ? "serve" : "build",
21283
+ mode
21284
+ }, weappConfigFilePath, cwd);
21064
21285
  }
21065
- return p;
21066
21286
  }
21067
21287
  const config = defu3(
21068
21288
  inlineConfig,
@@ -21088,6 +21308,19 @@ function createConfigService(ctx) {
21088
21308
  weapp: getWeappViteConfig()
21089
21309
  }
21090
21310
  );
21311
+ if (weappLoaded?.config?.weapp) {
21312
+ config.weapp = defu3(
21313
+ weappLoaded.config.weapp,
21314
+ config.weapp ?? {}
21315
+ );
21316
+ }
21317
+ const srcRoot = config.weapp?.srcRoot ?? "";
21318
+ function relativeSrcRoot(p) {
21319
+ if (srcRoot) {
21320
+ return path23.relative(srcRoot, p);
21321
+ }
21322
+ return p;
21323
+ }
21091
21324
  const rolldownPlugin = oxcRuntimeSupport.rolldownPlugin;
21092
21325
  if (rolldownPlugin) {
21093
21326
  const build3 = config.build ?? (config.build = {});
@@ -21111,6 +21344,7 @@ function createConfigService(ctx) {
21111
21344
  config.plugins ??= [];
21112
21345
  config.plugins?.push(tsconfigPaths(config.weapp?.tsconfigPaths));
21113
21346
  const aliasEntries = getAliasEntries(config.weapp?.jsonAlias);
21347
+ const configFilePath = weappLoaded?.path ?? loaded?.path ?? resolvedConfigFile;
21114
21348
  return {
21115
21349
  config,
21116
21350
  aliasEntries,
@@ -21125,6 +21359,7 @@ function createConfigService(ctx) {
21125
21359
  packageJsonPath,
21126
21360
  platform,
21127
21361
  srcRoot,
21362
+ configFilePath,
21128
21363
  currentSubPackageRoot: void 0
21129
21364
  };
21130
21365
  }
@@ -21143,6 +21378,7 @@ function createConfigService(ctx) {
21143
21378
  config: {},
21144
21379
  packageJson: {},
21145
21380
  platform: "weapp",
21381
+ configFilePath: void 0,
21146
21382
  currentSubPackageRoot: void 0
21147
21383
  });
21148
21384
  options = resolvedConfig;
@@ -21226,9 +21462,9 @@ function createConfigService(ctx) {
21226
21462
  watch: {
21227
21463
  exclude: [
21228
21464
  ...defaultExcluded,
21229
- options.mpDistRoot ? path21.join(options.cwd, options.mpDistRoot, "**") : path21.join(options.cwd, "dist", "**")
21465
+ options.mpDistRoot ? path23.join(options.cwd, options.mpDistRoot, "**") : path23.join(options.cwd, "dist", "**")
21230
21466
  ],
21231
- include: [path21.join(options.cwd, options.srcRoot, "**")]
21467
+ include: [path23.join(options.cwd, options.srcRoot, "**")]
21232
21468
  },
21233
21469
  minify: false,
21234
21470
  emptyOutDir: false,
@@ -21315,7 +21551,7 @@ function createConfigService(ctx) {
21315
21551
  return options.mpDistRoot;
21316
21552
  },
21317
21553
  get outDir() {
21318
- return path21.resolve(options.cwd, options.mpDistRoot ?? "");
21554
+ return path23.resolve(options.cwd, options.mpDistRoot ?? "");
21319
21555
  },
21320
21556
  get currentSubPackageRoot() {
21321
21557
  return options.currentSubPackageRoot;
@@ -21340,11 +21576,11 @@ function createConfigService(ctx) {
21340
21576
  },
21341
21577
  get absolutePluginRoot() {
21342
21578
  if (options.config.weapp?.pluginRoot) {
21343
- return path21.resolve(options.cwd, options.config.weapp.pluginRoot);
21579
+ return path23.resolve(options.cwd, options.config.weapp.pluginRoot);
21344
21580
  }
21345
21581
  },
21346
21582
  get absoluteSrcRoot() {
21347
- return path21.resolve(options.cwd, options.srcRoot);
21583
+ return path23.resolve(options.cwd, options.srcRoot);
21348
21584
  },
21349
21585
  get mode() {
21350
21586
  return options.mode;
@@ -21355,14 +21591,17 @@ function createConfigService(ctx) {
21355
21591
  get platform() {
21356
21592
  return options.platform;
21357
21593
  },
21594
+ get configFilePath() {
21595
+ return options.configFilePath;
21596
+ },
21358
21597
  relativeCwd(p) {
21359
- return path21.relative(options.cwd, p);
21598
+ return path23.relative(options.cwd, p);
21360
21599
  },
21361
21600
  relativeSrcRoot(p) {
21362
21601
  return options.relativeSrcRoot(p);
21363
21602
  },
21364
21603
  relativeAbsoluteSrcRoot(p) {
21365
- return path21.relative(path21.resolve(options.cwd, options.srcRoot), p);
21604
+ return path23.relative(path23.resolve(options.cwd, options.srcRoot), p);
21366
21605
  }
21367
21606
  };
21368
21607
  }
@@ -21377,7 +21616,7 @@ function createConfigServicePlugin(ctx) {
21377
21616
  // src/runtime/jsonPlugin.ts
21378
21617
  init_esm_shims();
21379
21618
  import { parse as parseJson2 } from "comment-json";
21380
- import fs15 from "fs-extra";
21619
+ import fs17 from "fs-extra";
21381
21620
  import { bundleRequire } from "rolldown-require";
21382
21621
  function parseCommentJson(json) {
21383
21622
  return parseJson2(json, void 0, true);
@@ -21409,7 +21648,7 @@ function createJsonService(ctx) {
21409
21648
  });
21410
21649
  resultJson = typeof mod.default === "function" ? await mod.default(ctx) : mod.default;
21411
21650
  } else {
21412
- resultJson = parseCommentJson(await fs15.readFile(filepath, "utf8"));
21651
+ resultJson = parseCommentJson(await fs17.readFile(filepath, "utf8"));
21413
21652
  }
21414
21653
  cache2.set(filepath, resultJson);
21415
21654
  return resultJson;
@@ -21442,14 +21681,14 @@ function createJsonServicePlugin(ctx) {
21442
21681
  init_esm_shims();
21443
21682
  import { isBuiltin } from "module";
21444
21683
  import { defu as defu4, isObject as isObject8, objectHash as objectHash2 } from "@weapp-core/shared";
21445
- import fs16 from "fs-extra";
21446
- import path22 from "pathe";
21684
+ import fs18 from "fs-extra";
21685
+ import path24 from "pathe";
21447
21686
  function createNpmService(ctx) {
21448
21687
  function getDependenciesCacheFilePath(key = "/") {
21449
21688
  if (!ctx.configService) {
21450
21689
  throw new Error("configService must be initialized before generating npm cache path");
21451
21690
  }
21452
- return path22.resolve(ctx.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
21691
+ return path24.resolve(ctx.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
21453
21692
  }
21454
21693
  function dependenciesCacheHash() {
21455
21694
  if (!ctx.configService) {
@@ -21461,22 +21700,22 @@ function createNpmService(ctx) {
21461
21700
  return Reflect.has(pkg, "miniprogram") && typeof pkg.miniprogram === "string";
21462
21701
  }
21463
21702
  async function shouldSkipBuild(outDir, isOutdated) {
21464
- return !isOutdated && await fs16.exists(outDir);
21703
+ return !isOutdated && await fs18.exists(outDir);
21465
21704
  }
21466
21705
  async function writeDependenciesCache(root) {
21467
21706
  if (!ctx.configService) {
21468
21707
  throw new Error("configService must be initialized before writing npm cache");
21469
21708
  }
21470
21709
  if (ctx.configService.weappViteConfig?.npm?.cache) {
21471
- await fs16.outputJSON(getDependenciesCacheFilePath(root), {
21710
+ await fs18.outputJSON(getDependenciesCacheFilePath(root), {
21472
21711
  hash: dependenciesCacheHash()
21473
21712
  });
21474
21713
  }
21475
21714
  }
21476
21715
  async function readDependenciesCache(root) {
21477
21716
  const cachePath = getDependenciesCacheFilePath(root);
21478
- if (await fs16.exists(cachePath)) {
21479
- return await fs16.readJson(cachePath, { throws: false });
21717
+ if (await fs18.exists(cachePath)) {
21718
+ return await fs18.readJson(cachePath, { throws: false });
21480
21719
  }
21481
21720
  }
21482
21721
  async function checkDependenciesCacheOutdate(root) {
@@ -21529,7 +21768,7 @@ function createNpmService(ctx) {
21529
21768
  }
21530
21769
  }
21531
21770
  async function copyBuild({ from, to }) {
21532
- await fs16.copy(
21771
+ await fs18.copy(
21533
21772
  from,
21534
21773
  to
21535
21774
  );
@@ -21542,14 +21781,14 @@ function createNpmService(ctx) {
21542
21781
  const { packageJson: targetJson, rootPath } = packageInfo;
21543
21782
  const dependencies = targetJson.dependencies ?? {};
21544
21783
  const keys = Object.keys(dependencies);
21545
- const destOutDir = path22.resolve(outDir, dep);
21784
+ const destOutDir = path24.resolve(outDir, dep);
21546
21785
  if (await shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
21547
21786
  logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
21548
21787
  return;
21549
21788
  }
21550
21789
  if (isMiniprogramPackage(targetJson)) {
21551
21790
  await copyBuild({
21552
- from: path22.resolve(
21791
+ from: path24.resolve(
21553
21792
  rootPath,
21554
21793
  targetJson.miniprogram
21555
21794
  ),
@@ -21621,10 +21860,10 @@ function createNpmService(ctx) {
21621
21860
  debug?.("buildNpm start");
21622
21861
  const packNpmRelationList = getPackNpmRelationList();
21623
21862
  const [mainRelation, ...subRelations] = packNpmRelationList;
21624
- const packageJsonPath = path22.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
21625
- if (await fs16.exists(packageJsonPath)) {
21626
- const pkgJson = await fs16.readJson(packageJsonPath);
21627
- const outDir = path22.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
21863
+ const packageJsonPath = path24.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
21864
+ if (await fs18.exists(packageJsonPath)) {
21865
+ const pkgJson = await fs18.readJson(packageJsonPath);
21866
+ const outDir = path24.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
21628
21867
  if (pkgJson.dependencies) {
21629
21868
  const dependencies = Object.keys(pkgJson.dependencies);
21630
21869
  if (dependencies.length > 0) {
@@ -21643,7 +21882,7 @@ function createNpmService(ctx) {
21643
21882
  const targetDirs = [
21644
21883
  ...subRelations.map((x) => {
21645
21884
  return {
21646
- npmDistDir: path22.resolve(ctx.configService.cwd, x.miniprogramNpmDistDir, "miniprogram_npm")
21885
+ npmDistDir: path24.resolve(ctx.configService.cwd, x.miniprogramNpmDistDir, "miniprogram_npm")
21647
21886
  };
21648
21887
  }),
21649
21888
  ...[...ctx.scanService.independentSubPackageMap.values()].map((x) => {
@@ -21651,19 +21890,19 @@ function createNpmService(ctx) {
21651
21890
  return {
21652
21891
  root: x.subPackage.root,
21653
21892
  dependencies: dependencies2,
21654
- npmDistDir: path22.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, x.subPackage.root, "miniprogram_npm")
21893
+ npmDistDir: path24.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, x.subPackage.root, "miniprogram_npm")
21655
21894
  };
21656
21895
  })
21657
21896
  ];
21658
21897
  await Promise.all(targetDirs.map(async (x) => {
21659
21898
  if (x.root) {
21660
21899
  const isDependenciesCacheOutdate2 = await checkDependenciesCacheOutdate(x.root);
21661
- if (isDependenciesCacheOutdate2 || !await fs16.exists(x.npmDistDir)) {
21662
- await fs16.copy(outDir, x.npmDistDir, {
21900
+ if (isDependenciesCacheOutdate2 || !await fs18.exists(x.npmDistDir)) {
21901
+ await fs18.copy(outDir, x.npmDistDir, {
21663
21902
  overwrite: true,
21664
21903
  filter: (src) => {
21665
21904
  if (Array.isArray(x.dependencies)) {
21666
- const relPath = path22.relative(outDir, src);
21905
+ const relPath = path24.relative(outDir, src);
21667
21906
  if (relPath === "") {
21668
21907
  return true;
21669
21908
  }
@@ -21675,11 +21914,11 @@ function createNpmService(ctx) {
21675
21914
  }
21676
21915
  await writeDependenciesCache(x.root);
21677
21916
  } else {
21678
- await fs16.copy(outDir, x.npmDistDir, {
21917
+ await fs18.copy(outDir, x.npmDistDir, {
21679
21918
  overwrite: true,
21680
21919
  filter: (src) => {
21681
21920
  if (Array.isArray(x.dependencies)) {
21682
- const relPath = path22.relative(outDir, src);
21921
+ const relPath = path24.relative(outDir, src);
21683
21922
  if (relPath === "") {
21684
21923
  return true;
21685
21924
  }
@@ -22432,10 +22671,31 @@ init_esm_shims();
22432
22671
 
22433
22672
  // src/cache/file.ts
22434
22673
  init_esm_shims();
22435
- import { createHash as createHash2 } from "crypto";
22436
- import fs17 from "fs-extra";
22674
+ import fs19 from "fs-extra";
22675
+ var FNV_OFFSET_BASIS = 0xCBF29CE484222325n;
22676
+ var FNV_PRIME = 0x100000001B3n;
22677
+ var FNV_MASK = 0xFFFFFFFFFFFFFFFFn;
22678
+ function fnv1aStep(hash, byte) {
22679
+ hash ^= BigInt(byte & 255);
22680
+ return hash * FNV_PRIME & FNV_MASK;
22681
+ }
22437
22682
  function createSignature(content) {
22438
- return createHash2("sha1").update(content).digest("hex");
22683
+ let hash = FNV_OFFSET_BASIS;
22684
+ if (typeof content === "string") {
22685
+ for (let i = 0; i < content.length; i++) {
22686
+ const code = content.charCodeAt(i);
22687
+ hash = fnv1aStep(hash, code & 255);
22688
+ const high = code >>> 8;
22689
+ if (high > 0) {
22690
+ hash = fnv1aStep(hash, high);
22691
+ }
22692
+ }
22693
+ } else {
22694
+ for (const byte of content) {
22695
+ hash = fnv1aStep(hash, byte);
22696
+ }
22697
+ }
22698
+ return hash.toString(36);
22439
22699
  }
22440
22700
  var FileCache = class {
22441
22701
  cache;
@@ -22461,7 +22721,7 @@ var FileCache = class {
22461
22721
  async isInvalidate(id, options) {
22462
22722
  let mtimeMs;
22463
22723
  try {
22464
- const stat6 = await fs17.stat(id);
22724
+ const stat6 = await fs19.stat(id);
22465
22725
  mtimeMs = stat6.mtimeMs;
22466
22726
  } catch (error) {
22467
22727
  if (error && error.code === "ENOENT") {
@@ -22522,7 +22782,8 @@ function createDefaultLoadConfigResult() {
22522
22782
  mpDistRoot: "",
22523
22783
  packageJsonPath: "",
22524
22784
  platform: "weapp",
22525
- srcRoot: ""
22785
+ srcRoot: "",
22786
+ configFilePath: void 0
22526
22787
  };
22527
22788
  }
22528
22789
  function createDefaultPackageInfo() {
@@ -22581,7 +22842,7 @@ function createRuntimeState() {
22581
22842
  // src/runtime/scanPlugin.ts
22582
22843
  init_esm_shims();
22583
22844
  import { isObject as isObject9, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
22584
- import path23 from "pathe";
22845
+ import path25 from "pathe";
22585
22846
  function resolveSubPackageEntries(subPackage) {
22586
22847
  const entries = [];
22587
22848
  const root = subPackage.root ?? "";
@@ -22605,11 +22866,11 @@ function createScanService(ctx) {
22605
22866
  return scanState.appEntry;
22606
22867
  }
22607
22868
  const appDirname = ctx.configService.absoluteSrcRoot;
22608
- const appBasename = path23.resolve(appDirname, "app");
22869
+ const appBasename = path25.resolve(appDirname, "app");
22609
22870
  const { path: appConfigFile } = await findJsonEntry(appBasename);
22610
22871
  const { path: appEntryPath } = await findJsEntry(appBasename);
22611
22872
  if (ctx.configService.absolutePluginRoot) {
22612
- const pluginBasename = path23.resolve(ctx.configService.absolutePluginRoot, "plugin");
22873
+ const pluginBasename = path25.resolve(ctx.configService.absolutePluginRoot, "plugin");
22613
22874
  const { path: pluginConfigFile } = await findJsonEntry(pluginBasename);
22614
22875
  if (pluginConfigFile) {
22615
22876
  const pluginConfig = await ctx.jsonService.read(pluginConfigFile);
@@ -22628,14 +22889,14 @@ function createScanService(ctx) {
22628
22889
  scanState.appEntry = resolvedAppEntry;
22629
22890
  const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
22630
22891
  if (sitemapLocation) {
22631
- const { path: sitemapJsonPath } = await findJsonEntry(path23.resolve(appDirname, sitemapLocation));
22892
+ const { path: sitemapJsonPath } = await findJsonEntry(path25.resolve(appDirname, sitemapLocation));
22632
22893
  if (sitemapJsonPath) {
22633
22894
  resolvedAppEntry.sitemapJsonPath = sitemapJsonPath;
22634
22895
  resolvedAppEntry.sitemapJson = await ctx.jsonService.read(sitemapJsonPath);
22635
22896
  }
22636
22897
  }
22637
22898
  if (themeLocation) {
22638
- const { path: themeJsonPath } = await findJsonEntry(path23.resolve(appDirname, themeLocation));
22899
+ const { path: themeJsonPath } = await findJsonEntry(path25.resolve(appDirname, themeLocation));
22639
22900
  if (themeJsonPath) {
22640
22901
  resolvedAppEntry.themeJsonPath = themeJsonPath;
22641
22902
  resolvedAppEntry.themeJson = await ctx.jsonService.read(themeJsonPath);
@@ -22819,8 +23080,8 @@ function createWatcherServicePlugin(ctx) {
22819
23080
  // src/runtime/wxmlPlugin.ts
22820
23081
  init_esm_shims();
22821
23082
  import { removeExtensionDeep as removeExtensionDeep6 } from "@weapp-core/shared";
22822
- import fs18 from "fs-extra";
22823
- import path24 from "pathe";
23083
+ import fs20 from "fs-extra";
23084
+ import path26 from "pathe";
22824
23085
 
22825
23086
  // src/wxml/index.ts
22826
23087
  init_esm_shims();
@@ -25202,7 +25463,7 @@ function fnv1aHash(input) {
25202
25463
  }
25203
25464
  return (hash >>> 0).toString(36);
25204
25465
  }
25205
- function createCacheKey(source, platform) {
25466
+ function createCacheKey2(source, platform) {
25206
25467
  return `${platform}:${source.length.toString(36)}:${fnv1aHash(source)}`;
25207
25468
  }
25208
25469
  function resolveEventDirective(raw) {
@@ -25265,7 +25526,7 @@ function scanWxml(wxml, options) {
25265
25526
  platform: "weapp"
25266
25527
  });
25267
25528
  const canUseCache = opts.excludeComponent === defaultExcludeComponent;
25268
- const cacheKey = canUseCache ? createCacheKey(source, opts.platform) : void 0;
25529
+ const cacheKey = canUseCache ? createCacheKey2(source, opts.platform) : void 0;
25269
25530
  if (cacheKey) {
25270
25531
  const cached = scanWxmlCache.get(cacheKey);
25271
25532
  if (cached) {
@@ -25407,6 +25668,9 @@ function scanWxml(wxml, options) {
25407
25668
  source
25408
25669
  );
25409
25670
  parser.end();
25671
+ if (removalRanges.length > 1) {
25672
+ removalRanges.sort((a, b) => b.start - a.start);
25673
+ }
25410
25674
  const token = {
25411
25675
  components: components2,
25412
25676
  deps,
@@ -25517,9 +25781,9 @@ function createWxmlService(ctx) {
25517
25781
  if (!ctx.configService) {
25518
25782
  throw new Error("configService must be initialized before scanning wxml");
25519
25783
  }
25520
- if (await fs18.exists(filepath)) {
25521
- const dirname5 = path24.dirname(filepath);
25522
- const wxml = await fs18.readFile(filepath, "utf8");
25784
+ if (await fs20.exists(filepath)) {
25785
+ const dirname5 = path26.dirname(filepath);
25786
+ const wxml = await fs20.readFile(filepath, "utf8");
25523
25787
  const shouldRescan = await cache2.isInvalidate(filepath, { content: wxml });
25524
25788
  if (!shouldRescan) {
25525
25789
  const cached = cache2.get(filepath);
@@ -25535,9 +25799,9 @@ function createWxmlService(ctx) {
25535
25799
  filepath,
25536
25800
  res.deps.filter((x) => isImportTag(x.tagName) && isTemplate(x.value)).map((x) => {
25537
25801
  if (x.value.startsWith("/")) {
25538
- return path24.resolve(ctx.configService.absoluteSrcRoot, x.value.slice(1));
25802
+ return path26.resolve(ctx.configService.absoluteSrcRoot, x.value.slice(1));
25539
25803
  } else {
25540
- return path24.resolve(dirname5, x.value);
25804
+ return path26.resolve(dirname5, x.value);
25541
25805
  }
25542
25806
  })
25543
25807
  );
@@ -25637,6 +25901,7 @@ export {
25637
25901
  logger_default,
25638
25902
  VERSION,
25639
25903
  checkRuntime,
25904
+ resolveWeappConfigFile,
25640
25905
  createCompilerContext
25641
25906
  };
25642
25907
  /*! Bundled license information: