weapp-vite 5.2.0 → 5.2.1

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.
@@ -4,9 +4,9 @@ import {
4
4
  init_esm_shims
5
5
  } from "./chunk-7MAZ2JUY.mjs";
6
6
 
7
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js
7
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
8
8
  var require_debug = __commonJS({
9
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js"(exports, module) {
9
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js"(exports, module) {
10
10
  "use strict";
11
11
  init_esm_shims();
12
12
  var debug4 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
@@ -15,9 +15,9 @@ var require_debug = __commonJS({
15
15
  }
16
16
  });
17
17
 
18
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
18
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
19
19
  var require_constants = __commonJS({
20
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js"(exports, module) {
20
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js"(exports, module) {
21
21
  "use strict";
22
22
  init_esm_shims();
23
23
  var SEMVER_SPEC_VERSION = "2.0.0";
@@ -48,9 +48,9 @@ var require_constants = __commonJS({
48
48
  }
49
49
  });
50
50
 
51
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js
51
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js
52
52
  var require_re = __commonJS({
53
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js"(exports, module) {
53
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js"(exports, module) {
54
54
  "use strict";
55
55
  init_esm_shims();
56
56
  var {
@@ -137,9 +137,9 @@ var require_re = __commonJS({
137
137
  }
138
138
  });
139
139
 
140
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js
140
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js
141
141
  var require_parse_options = __commonJS({
142
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js"(exports, module) {
142
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js"(exports, module) {
143
143
  "use strict";
144
144
  init_esm_shims();
145
145
  var looseOption = Object.freeze({ loose: true });
@@ -157,13 +157,16 @@ var require_parse_options = __commonJS({
157
157
  }
158
158
  });
159
159
 
160
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js
160
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js
161
161
  var require_identifiers = __commonJS({
162
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js"(exports, module) {
162
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js"(exports, module) {
163
163
  "use strict";
164
164
  init_esm_shims();
165
165
  var numeric = /^[0-9]+$/;
166
166
  var compareIdentifiers = (a, b) => {
167
+ if (typeof a === "number" && typeof b === "number") {
168
+ return a === b ? 0 : a < b ? -1 : 1;
169
+ }
167
170
  const anum = numeric.test(a);
168
171
  const bnum = numeric.test(b);
169
172
  if (anum && bnum) {
@@ -180,9 +183,9 @@ var require_identifiers = __commonJS({
180
183
  }
181
184
  });
182
185
 
183
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js
186
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js
184
187
  var require_semver = __commonJS({
185
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js"(exports, module) {
188
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js"(exports, module) {
186
189
  "use strict";
187
190
  init_esm_shims();
188
191
  var debug4 = require_debug();
@@ -271,7 +274,25 @@ var require_semver = __commonJS({
271
274
  if (!(other instanceof _SemVer)) {
272
275
  other = new _SemVer(other, this.options);
273
276
  }
274
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
277
+ if (this.major < other.major) {
278
+ return -1;
279
+ }
280
+ if (this.major > other.major) {
281
+ return 1;
282
+ }
283
+ if (this.minor < other.minor) {
284
+ return -1;
285
+ }
286
+ if (this.minor > other.minor) {
287
+ return 1;
288
+ }
289
+ if (this.patch < other.patch) {
290
+ return -1;
291
+ }
292
+ if (this.patch > other.patch) {
293
+ return 1;
294
+ }
295
+ return 0;
275
296
  }
276
297
  comparePre(other) {
277
298
  if (!(other instanceof _SemVer)) {
@@ -442,9 +463,9 @@ var require_semver = __commonJS({
442
463
  }
443
464
  });
444
465
 
445
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js
466
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js
446
467
  var require_compare = __commonJS({
447
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js"(exports, module) {
468
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js"(exports, module) {
448
469
  "use strict";
449
470
  init_esm_shims();
450
471
  var SemVer = require_semver();
@@ -453,9 +474,9 @@ var require_compare = __commonJS({
453
474
  }
454
475
  });
455
476
 
456
- // ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js
477
+ // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js
457
478
  var require_gte = __commonJS({
458
- "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js"(exports, module) {
479
+ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js"(exports, module) {
459
480
  "use strict";
460
481
  init_esm_shims();
461
482
  var compare = require_compare();
@@ -975,6 +996,14 @@ async function findTemplateEntry(filepath) {
975
996
  function isTemplate(filepath) {
976
997
  return templateExtensions.some((ext2) => filepath.endsWith(`.${ext2}`));
977
998
  }
999
+ async function touch(filename) {
1000
+ const time = /* @__PURE__ */ new Date();
1001
+ try {
1002
+ await fs.utimes(filename, time, time);
1003
+ } catch {
1004
+ await fs.close(await fs.open(filename, "w"));
1005
+ }
1006
+ }
978
1007
 
979
1008
  // src/utils/json.ts
980
1009
  init_esm_shims();
@@ -2833,7 +2862,7 @@ var ReaddirpStream = class extends Readable {
2833
2862
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
2834
2863
  const statMethod = opts.lstat ? lstat : stat;
2835
2864
  if (wantBigintFsStats) {
2836
- this._stat = (path22) => statMethod(path22, { bigint: true });
2865
+ this._stat = (path23) => statMethod(path23, { bigint: true });
2837
2866
  } else {
2838
2867
  this._stat = statMethod;
2839
2868
  }
@@ -2858,8 +2887,8 @@ var ReaddirpStream = class extends Readable {
2858
2887
  const par = this.parent;
2859
2888
  const fil = par && par.files;
2860
2889
  if (fil && fil.length > 0) {
2861
- const { path: path22, depth } = par;
2862
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path22));
2890
+ const { path: path23, depth } = par;
2891
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path23));
2863
2892
  const awaited = await Promise.all(slice);
2864
2893
  for (const entry of awaited) {
2865
2894
  if (!entry)
@@ -2899,20 +2928,20 @@ var ReaddirpStream = class extends Readable {
2899
2928
  this.reading = false;
2900
2929
  }
2901
2930
  }
2902
- async _exploreDir(path22, depth) {
2931
+ async _exploreDir(path23, depth) {
2903
2932
  let files;
2904
2933
  try {
2905
- files = await readdir(path22, this._rdOptions);
2934
+ files = await readdir(path23, this._rdOptions);
2906
2935
  } catch (error) {
2907
2936
  this._onError(error);
2908
2937
  }
2909
- return { files, depth, path: path22 };
2938
+ return { files, depth, path: path23 };
2910
2939
  }
2911
- async _formatEntry(dirent, path22) {
2940
+ async _formatEntry(dirent, path23) {
2912
2941
  let entry;
2913
2942
  const basename4 = this._isDirent ? dirent.name : dirent;
2914
2943
  try {
2915
- const fullPath = presolve(pjoin(path22, basename4));
2944
+ const fullPath = presolve(pjoin(path23, basename4));
2916
2945
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
2917
2946
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
2918
2947
  } catch (err) {
@@ -3313,16 +3342,16 @@ var delFromSet = (main, prop, item) => {
3313
3342
  };
3314
3343
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
3315
3344
  var FsWatchInstances = /* @__PURE__ */ new Map();
3316
- function createFsWatchInstance(path22, options, listener, errHandler, emitRaw) {
3345
+ function createFsWatchInstance(path23, options, listener, errHandler, emitRaw) {
3317
3346
  const handleEvent = (rawEvent, evPath) => {
3318
- listener(path22);
3319
- emitRaw(rawEvent, evPath, { watchedPath: path22 });
3320
- if (evPath && path22 !== evPath) {
3321
- fsWatchBroadcast(sysPath.resolve(path22, evPath), KEY_LISTENERS, sysPath.join(path22, evPath));
3347
+ listener(path23);
3348
+ emitRaw(rawEvent, evPath, { watchedPath: path23 });
3349
+ if (evPath && path23 !== evPath) {
3350
+ fsWatchBroadcast(sysPath.resolve(path23, evPath), KEY_LISTENERS, sysPath.join(path23, evPath));
3322
3351
  }
3323
3352
  };
3324
3353
  try {
3325
- return fs_watch(path22, {
3354
+ return fs_watch(path23, {
3326
3355
  persistent: options.persistent
3327
3356
  }, handleEvent);
3328
3357
  } catch (error) {
@@ -3338,12 +3367,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
3338
3367
  listener(val1, val2, val3);
3339
3368
  });
3340
3369
  };
3341
- var setFsWatchListener = (path22, fullPath, options, handlers) => {
3370
+ var setFsWatchListener = (path23, fullPath, options, handlers) => {
3342
3371
  const { listener, errHandler, rawEmitter } = handlers;
3343
3372
  let cont = FsWatchInstances.get(fullPath);
3344
3373
  let watcher;
3345
3374
  if (!options.persistent) {
3346
- watcher = createFsWatchInstance(path22, options, listener, errHandler, rawEmitter);
3375
+ watcher = createFsWatchInstance(path23, options, listener, errHandler, rawEmitter);
3347
3376
  if (!watcher)
3348
3377
  return;
3349
3378
  return watcher.close.bind(watcher);
@@ -3354,7 +3383,7 @@ var setFsWatchListener = (path22, fullPath, options, handlers) => {
3354
3383
  addAndConvert(cont, KEY_RAW, rawEmitter);
3355
3384
  } else {
3356
3385
  watcher = createFsWatchInstance(
3357
- path22,
3386
+ path23,
3358
3387
  options,
3359
3388
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
3360
3389
  errHandler,
@@ -3369,7 +3398,7 @@ var setFsWatchListener = (path22, fullPath, options, handlers) => {
3369
3398
  cont.watcherUnusable = true;
3370
3399
  if (isWindows && error.code === "EPERM") {
3371
3400
  try {
3372
- const fd = await open(path22, "r");
3401
+ const fd = await open(path23, "r");
3373
3402
  await fd.close();
3374
3403
  broadcastErr(error);
3375
3404
  } catch (err) {
@@ -3400,7 +3429,7 @@ var setFsWatchListener = (path22, fullPath, options, handlers) => {
3400
3429
  };
3401
3430
  };
3402
3431
  var FsWatchFileInstances = /* @__PURE__ */ new Map();
3403
- var setFsWatchFileListener = (path22, fullPath, options, handlers) => {
3432
+ var setFsWatchFileListener = (path23, fullPath, options, handlers) => {
3404
3433
  const { listener, rawEmitter } = handlers;
3405
3434
  let cont = FsWatchFileInstances.get(fullPath);
3406
3435
  const copts = cont && cont.options;
@@ -3422,7 +3451,7 @@ var setFsWatchFileListener = (path22, fullPath, options, handlers) => {
3422
3451
  });
3423
3452
  const currmtime = curr.mtimeMs;
3424
3453
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
3425
- foreach(cont.listeners, (listener2) => listener2(path22, curr));
3454
+ foreach(cont.listeners, (listener2) => listener2(path23, curr));
3426
3455
  }
3427
3456
  })
3428
3457
  };
@@ -3450,13 +3479,13 @@ var NodeFsHandler = class {
3450
3479
  * @param listener on fs change
3451
3480
  * @returns closer for the watcher instance
3452
3481
  */
3453
- _watchWithNodeFs(path22, listener) {
3482
+ _watchWithNodeFs(path23, listener) {
3454
3483
  const opts = this.fsw.options;
3455
- const directory = sysPath.dirname(path22);
3456
- const basename4 = sysPath.basename(path22);
3484
+ const directory = sysPath.dirname(path23);
3485
+ const basename4 = sysPath.basename(path23);
3457
3486
  const parent = this.fsw._getWatchedDir(directory);
3458
3487
  parent.add(basename4);
3459
- const absolutePath = sysPath.resolve(path22);
3488
+ const absolutePath = sysPath.resolve(path23);
3460
3489
  const options = {
3461
3490
  persistent: opts.persistent
3462
3491
  };
@@ -3466,12 +3495,12 @@ var NodeFsHandler = class {
3466
3495
  if (opts.usePolling) {
3467
3496
  const enableBin = opts.interval !== opts.binaryInterval;
3468
3497
  options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
3469
- closer = setFsWatchFileListener(path22, absolutePath, options, {
3498
+ closer = setFsWatchFileListener(path23, absolutePath, options, {
3470
3499
  listener,
3471
3500
  rawEmitter: this.fsw._emitRaw
3472
3501
  });
3473
3502
  } else {
3474
- closer = setFsWatchListener(path22, absolutePath, options, {
3503
+ closer = setFsWatchListener(path23, absolutePath, options, {
3475
3504
  listener,
3476
3505
  errHandler: this._boundHandleError,
3477
3506
  rawEmitter: this.fsw._emitRaw
@@ -3493,7 +3522,7 @@ var NodeFsHandler = class {
3493
3522
  let prevStats = stats;
3494
3523
  if (parent.has(basename4))
3495
3524
  return;
3496
- const listener = async (path22, newStats) => {
3525
+ const listener = async (path23, newStats) => {
3497
3526
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
3498
3527
  return;
3499
3528
  if (!newStats || newStats.mtimeMs === 0) {
@@ -3507,11 +3536,11 @@ var NodeFsHandler = class {
3507
3536
  this.fsw._emit(EV.CHANGE, file, newStats2);
3508
3537
  }
3509
3538
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
3510
- this.fsw._closeFile(path22);
3539
+ this.fsw._closeFile(path23);
3511
3540
  prevStats = newStats2;
3512
3541
  const closer2 = this._watchWithNodeFs(file, listener);
3513
3542
  if (closer2)
3514
- this.fsw._addPathCloser(path22, closer2);
3543
+ this.fsw._addPathCloser(path23, closer2);
3515
3544
  } else {
3516
3545
  prevStats = newStats2;
3517
3546
  }
@@ -3543,7 +3572,7 @@ var NodeFsHandler = class {
3543
3572
  * @param item basename of this item
3544
3573
  * @returns true if no more processing is needed for this entry.
3545
3574
  */
3546
- async _handleSymlink(entry, directory, path22, item) {
3575
+ async _handleSymlink(entry, directory, path23, item) {
3547
3576
  if (this.fsw.closed) {
3548
3577
  return;
3549
3578
  }
@@ -3553,7 +3582,7 @@ var NodeFsHandler = class {
3553
3582
  this.fsw._incrReadyCount();
3554
3583
  let linkPath;
3555
3584
  try {
3556
- linkPath = await fsrealpath(path22);
3585
+ linkPath = await fsrealpath(path23);
3557
3586
  } catch (e) {
3558
3587
  this.fsw._emitReady();
3559
3588
  return true;
@@ -3563,12 +3592,12 @@ var NodeFsHandler = class {
3563
3592
  if (dir.has(item)) {
3564
3593
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
3565
3594
  this.fsw._symlinkPaths.set(full, linkPath);
3566
- this.fsw._emit(EV.CHANGE, path22, entry.stats);
3595
+ this.fsw._emit(EV.CHANGE, path23, entry.stats);
3567
3596
  }
3568
3597
  } else {
3569
3598
  dir.add(item);
3570
3599
  this.fsw._symlinkPaths.set(full, linkPath);
3571
- this.fsw._emit(EV.ADD, path22, entry.stats);
3600
+ this.fsw._emit(EV.ADD, path23, entry.stats);
3572
3601
  }
3573
3602
  this.fsw._emitReady();
3574
3603
  return true;
@@ -3597,9 +3626,9 @@ var NodeFsHandler = class {
3597
3626
  return;
3598
3627
  }
3599
3628
  const item = entry.path;
3600
- let path22 = sysPath.join(directory, item);
3629
+ let path23 = sysPath.join(directory, item);
3601
3630
  current2.add(item);
3602
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path22, item)) {
3631
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path23, item)) {
3603
3632
  return;
3604
3633
  }
3605
3634
  if (this.fsw.closed) {
@@ -3608,8 +3637,8 @@ var NodeFsHandler = class {
3608
3637
  }
3609
3638
  if (item === target || !target && !previous.has(item)) {
3610
3639
  this.fsw._incrReadyCount();
3611
- path22 = sysPath.join(dir, sysPath.relative(dir, path22));
3612
- this._addToNodeFs(path22, initialAdd, wh, depth + 1);
3640
+ path23 = sysPath.join(dir, sysPath.relative(dir, path23));
3641
+ this._addToNodeFs(path23, initialAdd, wh, depth + 1);
3613
3642
  }
3614
3643
  }).on(EV.ERROR, this._boundHandleError);
3615
3644
  return new Promise((resolve8, reject) => {
@@ -3678,13 +3707,13 @@ var NodeFsHandler = class {
3678
3707
  * @param depth Child path actually targeted for watch
3679
3708
  * @param target Child path actually targeted for watch
3680
3709
  */
3681
- async _addToNodeFs(path22, initialAdd, priorWh, depth, target) {
3710
+ async _addToNodeFs(path23, initialAdd, priorWh, depth, target) {
3682
3711
  const ready = this.fsw._emitReady;
3683
- if (this.fsw._isIgnored(path22) || this.fsw.closed) {
3712
+ if (this.fsw._isIgnored(path23) || this.fsw.closed) {
3684
3713
  ready();
3685
3714
  return false;
3686
3715
  }
3687
- const wh = this.fsw._getWatchHelpers(path22);
3716
+ const wh = this.fsw._getWatchHelpers(path23);
3688
3717
  if (priorWh) {
3689
3718
  wh.filterPath = (entry) => priorWh.filterPath(entry);
3690
3719
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -3700,8 +3729,8 @@ var NodeFsHandler = class {
3700
3729
  const follow = this.fsw.options.followSymlinks;
3701
3730
  let closer;
3702
3731
  if (stats.isDirectory()) {
3703
- const absPath = sysPath.resolve(path22);
3704
- const targetPath = follow ? await fsrealpath(path22) : path22;
3732
+ const absPath = sysPath.resolve(path23);
3733
+ const targetPath = follow ? await fsrealpath(path23) : path23;
3705
3734
  if (this.fsw.closed)
3706
3735
  return;
3707
3736
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -3711,29 +3740,29 @@ var NodeFsHandler = class {
3711
3740
  this.fsw._symlinkPaths.set(absPath, targetPath);
3712
3741
  }
3713
3742
  } else if (stats.isSymbolicLink()) {
3714
- const targetPath = follow ? await fsrealpath(path22) : path22;
3743
+ const targetPath = follow ? await fsrealpath(path23) : path23;
3715
3744
  if (this.fsw.closed)
3716
3745
  return;
3717
3746
  const parent = sysPath.dirname(wh.watchPath);
3718
3747
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
3719
3748
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
3720
- closer = await this._handleDir(parent, stats, initialAdd, depth, path22, wh, targetPath);
3749
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path23, wh, targetPath);
3721
3750
  if (this.fsw.closed)
3722
3751
  return;
3723
3752
  if (targetPath !== void 0) {
3724
- this.fsw._symlinkPaths.set(sysPath.resolve(path22), targetPath);
3753
+ this.fsw._symlinkPaths.set(sysPath.resolve(path23), targetPath);
3725
3754
  }
3726
3755
  } else {
3727
3756
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
3728
3757
  }
3729
3758
  ready();
3730
3759
  if (closer)
3731
- this.fsw._addPathCloser(path22, closer);
3760
+ this.fsw._addPathCloser(path23, closer);
3732
3761
  return false;
3733
3762
  } catch (error) {
3734
3763
  if (this.fsw._handleError(error)) {
3735
3764
  ready();
3736
- return path22;
3765
+ return path23;
3737
3766
  }
3738
3767
  }
3739
3768
  }
@@ -3776,26 +3805,26 @@ function createPattern(matcher) {
3776
3805
  }
3777
3806
  return () => false;
3778
3807
  }
3779
- function normalizePath(path22) {
3780
- if (typeof path22 !== "string")
3808
+ function normalizePath(path23) {
3809
+ if (typeof path23 !== "string")
3781
3810
  throw new Error("string expected");
3782
- path22 = sysPath2.normalize(path22);
3783
- path22 = path22.replace(/\\/g, "/");
3811
+ path23 = sysPath2.normalize(path23);
3812
+ path23 = path23.replace(/\\/g, "/");
3784
3813
  let prepend = false;
3785
- if (path22.startsWith("//"))
3814
+ if (path23.startsWith("//"))
3786
3815
  prepend = true;
3787
3816
  const DOUBLE_SLASH_RE2 = /\/\//;
3788
- while (path22.match(DOUBLE_SLASH_RE2))
3789
- path22 = path22.replace(DOUBLE_SLASH_RE2, "/");
3817
+ while (path23.match(DOUBLE_SLASH_RE2))
3818
+ path23 = path23.replace(DOUBLE_SLASH_RE2, "/");
3790
3819
  if (prepend)
3791
- path22 = "/" + path22;
3792
- return path22;
3820
+ path23 = "/" + path23;
3821
+ return path23;
3793
3822
  }
3794
3823
  function matchPatterns(patterns, testString, stats) {
3795
- const path22 = normalizePath(testString);
3824
+ const path23 = normalizePath(testString);
3796
3825
  for (let index = 0; index < patterns.length; index++) {
3797
3826
  const pattern = patterns[index];
3798
- if (pattern(path22, stats)) {
3827
+ if (pattern(path23, stats)) {
3799
3828
  return true;
3800
3829
  }
3801
3830
  }
@@ -3835,19 +3864,19 @@ var toUnix = (string) => {
3835
3864
  }
3836
3865
  return str;
3837
3866
  };
3838
- var normalizePathToUnix = (path22) => toUnix(sysPath2.normalize(toUnix(path22)));
3839
- var normalizeIgnored = (cwd = "") => (path22) => {
3840
- if (typeof path22 === "string") {
3841
- return normalizePathToUnix(sysPath2.isAbsolute(path22) ? path22 : sysPath2.join(cwd, path22));
3867
+ var normalizePathToUnix = (path23) => toUnix(sysPath2.normalize(toUnix(path23)));
3868
+ var normalizeIgnored = (cwd = "") => (path23) => {
3869
+ if (typeof path23 === "string") {
3870
+ return normalizePathToUnix(sysPath2.isAbsolute(path23) ? path23 : sysPath2.join(cwd, path23));
3842
3871
  } else {
3843
- return path22;
3872
+ return path23;
3844
3873
  }
3845
3874
  };
3846
- var getAbsolutePath = (path22, cwd) => {
3847
- if (sysPath2.isAbsolute(path22)) {
3848
- return path22;
3875
+ var getAbsolutePath = (path23, cwd) => {
3876
+ if (sysPath2.isAbsolute(path23)) {
3877
+ return path23;
3849
3878
  }
3850
- return sysPath2.join(cwd, path22);
3879
+ return sysPath2.join(cwd, path23);
3851
3880
  };
3852
3881
  var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
3853
3882
  var DirEntry = class {
@@ -3902,10 +3931,10 @@ var DirEntry = class {
3902
3931
  var STAT_METHOD_F = "stat";
3903
3932
  var STAT_METHOD_L = "lstat";
3904
3933
  var WatchHelper = class {
3905
- constructor(path22, follow, fsw) {
3934
+ constructor(path23, follow, fsw) {
3906
3935
  this.fsw = fsw;
3907
- const watchPath = path22;
3908
- this.path = path22 = path22.replace(REPLACER_RE, "");
3936
+ const watchPath = path23;
3937
+ this.path = path23 = path23.replace(REPLACER_RE, "");
3909
3938
  this.watchPath = watchPath;
3910
3939
  this.fullWatchPath = sysPath2.resolve(watchPath);
3911
3940
  this.dirParts = [];
@@ -4027,20 +4056,20 @@ var FSWatcher = class extends EventEmitter {
4027
4056
  this._closePromise = void 0;
4028
4057
  let paths = unifyPaths(paths_);
4029
4058
  if (cwd) {
4030
- paths = paths.map((path22) => {
4031
- const absPath = getAbsolutePath(path22, cwd);
4059
+ paths = paths.map((path23) => {
4060
+ const absPath = getAbsolutePath(path23, cwd);
4032
4061
  return absPath;
4033
4062
  });
4034
4063
  }
4035
- paths.forEach((path22) => {
4036
- this._removeIgnoredPath(path22);
4064
+ paths.forEach((path23) => {
4065
+ this._removeIgnoredPath(path23);
4037
4066
  });
4038
4067
  this._userIgnored = void 0;
4039
4068
  if (!this._readyCount)
4040
4069
  this._readyCount = 0;
4041
4070
  this._readyCount += paths.length;
4042
- Promise.all(paths.map(async (path22) => {
4043
- const res = await this._nodeFsHandler._addToNodeFs(path22, !_internal, void 0, 0, _origAdd);
4071
+ Promise.all(paths.map(async (path23) => {
4072
+ const res = await this._nodeFsHandler._addToNodeFs(path23, !_internal, void 0, 0, _origAdd);
4044
4073
  if (res)
4045
4074
  this._emitReady();
4046
4075
  return res;
@@ -4062,17 +4091,17 @@ var FSWatcher = class extends EventEmitter {
4062
4091
  return this;
4063
4092
  const paths = unifyPaths(paths_);
4064
4093
  const { cwd } = this.options;
4065
- paths.forEach((path22) => {
4066
- if (!sysPath2.isAbsolute(path22) && !this._closers.has(path22)) {
4094
+ paths.forEach((path23) => {
4095
+ if (!sysPath2.isAbsolute(path23) && !this._closers.has(path23)) {
4067
4096
  if (cwd)
4068
- path22 = sysPath2.join(cwd, path22);
4069
- path22 = sysPath2.resolve(path22);
4097
+ path23 = sysPath2.join(cwd, path23);
4098
+ path23 = sysPath2.resolve(path23);
4070
4099
  }
4071
- this._closePath(path22);
4072
- this._addIgnoredPath(path22);
4073
- if (this._watched.has(path22)) {
4100
+ this._closePath(path23);
4101
+ this._addIgnoredPath(path23);
4102
+ if (this._watched.has(path23)) {
4074
4103
  this._addIgnoredPath({
4075
- path: path22,
4104
+ path: path23,
4076
4105
  recursive: true
4077
4106
  });
4078
4107
  }
@@ -4136,38 +4165,38 @@ var FSWatcher = class extends EventEmitter {
4136
4165
  * @param stats arguments to be passed with event
4137
4166
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
4138
4167
  */
4139
- async _emit(event, path22, stats) {
4168
+ async _emit(event, path23, stats) {
4140
4169
  if (this.closed)
4141
4170
  return;
4142
4171
  const opts = this.options;
4143
4172
  if (isWindows)
4144
- path22 = sysPath2.normalize(path22);
4173
+ path23 = sysPath2.normalize(path23);
4145
4174
  if (opts.cwd)
4146
- path22 = sysPath2.relative(opts.cwd, path22);
4147
- const args = [path22];
4175
+ path23 = sysPath2.relative(opts.cwd, path23);
4176
+ const args = [path23];
4148
4177
  if (stats != null)
4149
4178
  args.push(stats);
4150
4179
  const awf = opts.awaitWriteFinish;
4151
4180
  let pw;
4152
- if (awf && (pw = this._pendingWrites.get(path22))) {
4181
+ if (awf && (pw = this._pendingWrites.get(path23))) {
4153
4182
  pw.lastChange = /* @__PURE__ */ new Date();
4154
4183
  return this;
4155
4184
  }
4156
4185
  if (opts.atomic) {
4157
4186
  if (event === EVENTS.UNLINK) {
4158
- this._pendingUnlinks.set(path22, [event, ...args]);
4187
+ this._pendingUnlinks.set(path23, [event, ...args]);
4159
4188
  setTimeout(() => {
4160
- this._pendingUnlinks.forEach((entry, path23) => {
4189
+ this._pendingUnlinks.forEach((entry, path24) => {
4161
4190
  this.emit(...entry);
4162
4191
  this.emit(EVENTS.ALL, ...entry);
4163
- this._pendingUnlinks.delete(path23);
4192
+ this._pendingUnlinks.delete(path24);
4164
4193
  });
4165
4194
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
4166
4195
  return this;
4167
4196
  }
4168
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path22)) {
4197
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path23)) {
4169
4198
  event = EVENTS.CHANGE;
4170
- this._pendingUnlinks.delete(path22);
4199
+ this._pendingUnlinks.delete(path23);
4171
4200
  }
4172
4201
  }
4173
4202
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -4185,16 +4214,16 @@ var FSWatcher = class extends EventEmitter {
4185
4214
  this.emitWithAll(event, args);
4186
4215
  }
4187
4216
  };
4188
- this._awaitWriteFinish(path22, awf.stabilityThreshold, event, awfEmit);
4217
+ this._awaitWriteFinish(path23, awf.stabilityThreshold, event, awfEmit);
4189
4218
  return this;
4190
4219
  }
4191
4220
  if (event === EVENTS.CHANGE) {
4192
- const isThrottled = !this._throttle(EVENTS.CHANGE, path22, 50);
4221
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path23, 50);
4193
4222
  if (isThrottled)
4194
4223
  return this;
4195
4224
  }
4196
4225
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
4197
- const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path22) : path22;
4226
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path23) : path23;
4198
4227
  let stats2;
4199
4228
  try {
4200
4229
  stats2 = await stat3(fullPath);
@@ -4225,23 +4254,23 @@ var FSWatcher = class extends EventEmitter {
4225
4254
  * @param timeout duration of time to suppress duplicate actions
4226
4255
  * @returns tracking object or false if action should be suppressed
4227
4256
  */
4228
- _throttle(actionType, path22, timeout) {
4257
+ _throttle(actionType, path23, timeout) {
4229
4258
  if (!this._throttled.has(actionType)) {
4230
4259
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
4231
4260
  }
4232
4261
  const action = this._throttled.get(actionType);
4233
4262
  if (!action)
4234
4263
  throw new Error("invalid throttle");
4235
- const actionPath = action.get(path22);
4264
+ const actionPath = action.get(path23);
4236
4265
  if (actionPath) {
4237
4266
  actionPath.count++;
4238
4267
  return false;
4239
4268
  }
4240
4269
  let timeoutObject;
4241
4270
  const clear = () => {
4242
- const item = action.get(path22);
4271
+ const item = action.get(path23);
4243
4272
  const count = item ? item.count : 0;
4244
- action.delete(path22);
4273
+ action.delete(path23);
4245
4274
  clearTimeout(timeoutObject);
4246
4275
  if (item)
4247
4276
  clearTimeout(item.timeoutObject);
@@ -4249,7 +4278,7 @@ var FSWatcher = class extends EventEmitter {
4249
4278
  };
4250
4279
  timeoutObject = setTimeout(clear, timeout);
4251
4280
  const thr = { timeoutObject, clear, count: 0 };
4252
- action.set(path22, thr);
4281
+ action.set(path23, thr);
4253
4282
  return thr;
4254
4283
  }
4255
4284
  _incrReadyCount() {
@@ -4263,44 +4292,44 @@ var FSWatcher = class extends EventEmitter {
4263
4292
  * @param event
4264
4293
  * @param awfEmit Callback to be called when ready for event to be emitted.
4265
4294
  */
4266
- _awaitWriteFinish(path22, threshold, event, awfEmit) {
4295
+ _awaitWriteFinish(path23, threshold, event, awfEmit) {
4267
4296
  const awf = this.options.awaitWriteFinish;
4268
4297
  if (typeof awf !== "object")
4269
4298
  return;
4270
4299
  const pollInterval = awf.pollInterval;
4271
4300
  let timeoutHandler;
4272
- let fullPath = path22;
4273
- if (this.options.cwd && !sysPath2.isAbsolute(path22)) {
4274
- fullPath = sysPath2.join(this.options.cwd, path22);
4301
+ let fullPath = path23;
4302
+ if (this.options.cwd && !sysPath2.isAbsolute(path23)) {
4303
+ fullPath = sysPath2.join(this.options.cwd, path23);
4275
4304
  }
4276
4305
  const now = /* @__PURE__ */ new Date();
4277
4306
  const writes = this._pendingWrites;
4278
4307
  function awaitWriteFinishFn(prevStat) {
4279
4308
  statcb(fullPath, (err, curStat) => {
4280
- if (err || !writes.has(path22)) {
4309
+ if (err || !writes.has(path23)) {
4281
4310
  if (err && err.code !== "ENOENT")
4282
4311
  awfEmit(err);
4283
4312
  return;
4284
4313
  }
4285
4314
  const now2 = Number(/* @__PURE__ */ new Date());
4286
4315
  if (prevStat && curStat.size !== prevStat.size) {
4287
- writes.get(path22).lastChange = now2;
4316
+ writes.get(path23).lastChange = now2;
4288
4317
  }
4289
- const pw = writes.get(path22);
4318
+ const pw = writes.get(path23);
4290
4319
  const df = now2 - pw.lastChange;
4291
4320
  if (df >= threshold) {
4292
- writes.delete(path22);
4321
+ writes.delete(path23);
4293
4322
  awfEmit(void 0, curStat);
4294
4323
  } else {
4295
4324
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
4296
4325
  }
4297
4326
  });
4298
4327
  }
4299
- if (!writes.has(path22)) {
4300
- writes.set(path22, {
4328
+ if (!writes.has(path23)) {
4329
+ writes.set(path23, {
4301
4330
  lastChange: now,
4302
4331
  cancelWait: () => {
4303
- writes.delete(path22);
4332
+ writes.delete(path23);
4304
4333
  clearTimeout(timeoutHandler);
4305
4334
  return event;
4306
4335
  }
@@ -4311,8 +4340,8 @@ var FSWatcher = class extends EventEmitter {
4311
4340
  /**
4312
4341
  * Determines whether user has asked to ignore this path.
4313
4342
  */
4314
- _isIgnored(path22, stats) {
4315
- if (this.options.atomic && DOT_RE.test(path22))
4343
+ _isIgnored(path23, stats) {
4344
+ if (this.options.atomic && DOT_RE.test(path23))
4316
4345
  return true;
4317
4346
  if (!this._userIgnored) {
4318
4347
  const { cwd } = this.options;
@@ -4322,17 +4351,17 @@ var FSWatcher = class extends EventEmitter {
4322
4351
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
4323
4352
  this._userIgnored = anymatch(list, void 0);
4324
4353
  }
4325
- return this._userIgnored(path22, stats);
4354
+ return this._userIgnored(path23, stats);
4326
4355
  }
4327
- _isntIgnored(path22, stat6) {
4328
- return !this._isIgnored(path22, stat6);
4356
+ _isntIgnored(path23, stat6) {
4357
+ return !this._isIgnored(path23, stat6);
4329
4358
  }
4330
4359
  /**
4331
4360
  * Provides a set of common helpers and properties relating to symlink handling.
4332
4361
  * @param path file or directory pattern being watched
4333
4362
  */
4334
- _getWatchHelpers(path22) {
4335
- return new WatchHelper(path22, this.options.followSymlinks, this);
4363
+ _getWatchHelpers(path23) {
4364
+ return new WatchHelper(path23, this.options.followSymlinks, this);
4336
4365
  }
4337
4366
  // Directory helpers
4338
4367
  // -----------------
@@ -4364,63 +4393,63 @@ var FSWatcher = class extends EventEmitter {
4364
4393
  * @param item base path of item/directory
4365
4394
  */
4366
4395
  _remove(directory, item, isDirectory) {
4367
- const path22 = sysPath2.join(directory, item);
4368
- const fullPath = sysPath2.resolve(path22);
4369
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path22) || this._watched.has(fullPath);
4370
- if (!this._throttle("remove", path22, 100))
4396
+ const path23 = sysPath2.join(directory, item);
4397
+ const fullPath = sysPath2.resolve(path23);
4398
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path23) || this._watched.has(fullPath);
4399
+ if (!this._throttle("remove", path23, 100))
4371
4400
  return;
4372
4401
  if (!isDirectory && this._watched.size === 1) {
4373
4402
  this.add(directory, item, true);
4374
4403
  }
4375
- const wp = this._getWatchedDir(path22);
4404
+ const wp = this._getWatchedDir(path23);
4376
4405
  const nestedDirectoryChildren = wp.getChildren();
4377
- nestedDirectoryChildren.forEach((nested) => this._remove(path22, nested));
4406
+ nestedDirectoryChildren.forEach((nested) => this._remove(path23, nested));
4378
4407
  const parent = this._getWatchedDir(directory);
4379
4408
  const wasTracked = parent.has(item);
4380
4409
  parent.remove(item);
4381
4410
  if (this._symlinkPaths.has(fullPath)) {
4382
4411
  this._symlinkPaths.delete(fullPath);
4383
4412
  }
4384
- let relPath = path22;
4413
+ let relPath = path23;
4385
4414
  if (this.options.cwd)
4386
- relPath = sysPath2.relative(this.options.cwd, path22);
4415
+ relPath = sysPath2.relative(this.options.cwd, path23);
4387
4416
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
4388
4417
  const event = this._pendingWrites.get(relPath).cancelWait();
4389
4418
  if (event === EVENTS.ADD)
4390
4419
  return;
4391
4420
  }
4392
- this._watched.delete(path22);
4421
+ this._watched.delete(path23);
4393
4422
  this._watched.delete(fullPath);
4394
4423
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
4395
- if (wasTracked && !this._isIgnored(path22))
4396
- this._emit(eventName, path22);
4397
- this._closePath(path22);
4424
+ if (wasTracked && !this._isIgnored(path23))
4425
+ this._emit(eventName, path23);
4426
+ this._closePath(path23);
4398
4427
  }
4399
4428
  /**
4400
4429
  * Closes all watchers for a path
4401
4430
  */
4402
- _closePath(path22) {
4403
- this._closeFile(path22);
4404
- const dir = sysPath2.dirname(path22);
4405
- this._getWatchedDir(dir).remove(sysPath2.basename(path22));
4431
+ _closePath(path23) {
4432
+ this._closeFile(path23);
4433
+ const dir = sysPath2.dirname(path23);
4434
+ this._getWatchedDir(dir).remove(sysPath2.basename(path23));
4406
4435
  }
4407
4436
  /**
4408
4437
  * Closes only file-specific watchers
4409
4438
  */
4410
- _closeFile(path22) {
4411
- const closers = this._closers.get(path22);
4439
+ _closeFile(path23) {
4440
+ const closers = this._closers.get(path23);
4412
4441
  if (!closers)
4413
4442
  return;
4414
4443
  closers.forEach((closer) => closer());
4415
- this._closers.delete(path22);
4444
+ this._closers.delete(path23);
4416
4445
  }
4417
- _addPathCloser(path22, closer) {
4446
+ _addPathCloser(path23, closer) {
4418
4447
  if (!closer)
4419
4448
  return;
4420
- let list = this._closers.get(path22);
4449
+ let list = this._closers.get(path23);
4421
4450
  if (!list) {
4422
4451
  list = [];
4423
- this._closers.set(path22, list);
4452
+ this._closers.set(path23, list);
4424
4453
  }
4425
4454
  list.push(closer);
4426
4455
  }
@@ -6952,12 +6981,12 @@ var PathBase = class {
6952
6981
  /**
6953
6982
  * Get the Path object referenced by the string path, resolved from this Path
6954
6983
  */
6955
- resolve(path22) {
6956
- if (!path22) {
6984
+ resolve(path23) {
6985
+ if (!path23) {
6957
6986
  return this;
6958
6987
  }
6959
- const rootPath = this.getRootString(path22);
6960
- const dir = path22.substring(rootPath.length);
6988
+ const rootPath = this.getRootString(path23);
6989
+ const dir = path23.substring(rootPath.length);
6961
6990
  const dirParts = dir.split(this.splitSep);
6962
6991
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
6963
6992
  return result;
@@ -7709,8 +7738,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
7709
7738
  /**
7710
7739
  * @internal
7711
7740
  */
7712
- getRootString(path22) {
7713
- return win32.parse(path22).root;
7741
+ getRootString(path23) {
7742
+ return win32.parse(path23).root;
7714
7743
  }
7715
7744
  /**
7716
7745
  * @internal
@@ -7756,8 +7785,8 @@ var PathPosix = class _PathPosix extends PathBase {
7756
7785
  /**
7757
7786
  * @internal
7758
7787
  */
7759
- getRootString(path22) {
7760
- return path22.startsWith("/") ? "/" : "";
7788
+ getRootString(path23) {
7789
+ return path23.startsWith("/") ? "/" : "";
7761
7790
  }
7762
7791
  /**
7763
7792
  * @internal
@@ -7806,8 +7835,8 @@ var PathScurryBase = class {
7806
7835
  *
7807
7836
  * @internal
7808
7837
  */
7809
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs17 = defaultFS } = {}) {
7810
- this.#fs = fsFromOption(fs17);
7838
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs18 = defaultFS } = {}) {
7839
+ this.#fs = fsFromOption(fs18);
7811
7840
  if (cwd instanceof URL || cwd.startsWith("file://")) {
7812
7841
  cwd = fileURLToPath(cwd);
7813
7842
  }
@@ -7846,11 +7875,11 @@ var PathScurryBase = class {
7846
7875
  /**
7847
7876
  * Get the depth of a provided path, string, or the cwd
7848
7877
  */
7849
- depth(path22 = this.cwd) {
7850
- if (typeof path22 === "string") {
7851
- path22 = this.cwd.resolve(path22);
7878
+ depth(path23 = this.cwd) {
7879
+ if (typeof path23 === "string") {
7880
+ path23 = this.cwd.resolve(path23);
7852
7881
  }
7853
- return path22.depth();
7882
+ return path23.depth();
7854
7883
  }
7855
7884
  /**
7856
7885
  * Return the cache of child entries. Exposed so subclasses can create
@@ -8229,7 +8258,7 @@ var PathScurryBase = class {
8229
8258
  const dirs = /* @__PURE__ */ new Set();
8230
8259
  const queue = [entry];
8231
8260
  let processing = 0;
8232
- const process8 = () => {
8261
+ const process9 = () => {
8233
8262
  let paused = false;
8234
8263
  while (!paused) {
8235
8264
  const dir = queue.shift();
@@ -8270,9 +8299,9 @@ var PathScurryBase = class {
8270
8299
  }
8271
8300
  }
8272
8301
  if (paused && !results.flowing) {
8273
- results.once("drain", process8);
8302
+ results.once("drain", process9);
8274
8303
  } else if (!sync2) {
8275
- process8();
8304
+ process9();
8276
8305
  }
8277
8306
  };
8278
8307
  let sync2 = true;
@@ -8280,7 +8309,7 @@ var PathScurryBase = class {
8280
8309
  sync2 = false;
8281
8310
  }
8282
8311
  };
8283
- process8();
8312
+ process9();
8284
8313
  return results;
8285
8314
  }
8286
8315
  streamSync(entry = this.cwd, opts = {}) {
@@ -8298,7 +8327,7 @@ var PathScurryBase = class {
8298
8327
  }
8299
8328
  const queue = [entry];
8300
8329
  let processing = 0;
8301
- const process8 = () => {
8330
+ const process9 = () => {
8302
8331
  let paused = false;
8303
8332
  while (!paused) {
8304
8333
  const dir = queue.shift();
@@ -8332,14 +8361,14 @@ var PathScurryBase = class {
8332
8361
  }
8333
8362
  }
8334
8363
  if (paused && !results.flowing)
8335
- results.once("drain", process8);
8364
+ results.once("drain", process9);
8336
8365
  };
8337
- process8();
8366
+ process9();
8338
8367
  return results;
8339
8368
  }
8340
- chdir(path22 = this.cwd) {
8369
+ chdir(path23 = this.cwd) {
8341
8370
  const oldCwd = this.cwd;
8342
- this.cwd = typeof path22 === "string" ? this.cwd.resolve(path22) : path22;
8371
+ this.cwd = typeof path23 === "string" ? this.cwd.resolve(path23) : path23;
8343
8372
  this.cwd[setAsCwd](oldCwd);
8344
8373
  }
8345
8374
  };
@@ -8365,8 +8394,8 @@ var PathScurryWin32 = class extends PathScurryBase {
8365
8394
  /**
8366
8395
  * @internal
8367
8396
  */
8368
- newRoot(fs17) {
8369
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs17 });
8397
+ newRoot(fs18) {
8398
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs18 });
8370
8399
  }
8371
8400
  /**
8372
8401
  * Return true if the provided path string is an absolute path
@@ -8394,8 +8423,8 @@ var PathScurryPosix = class extends PathScurryBase {
8394
8423
  /**
8395
8424
  * @internal
8396
8425
  */
8397
- newRoot(fs17) {
8398
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs17 });
8426
+ newRoot(fs18) {
8427
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs18 });
8399
8428
  }
8400
8429
  /**
8401
8430
  * Return true if the provided path string is an absolute path
@@ -8701,8 +8730,8 @@ var MatchRecord = class {
8701
8730
  }
8702
8731
  // match, absolute, ifdir
8703
8732
  entries() {
8704
- return [...this.store.entries()].map(([path22, n2]) => [
8705
- path22,
8733
+ return [...this.store.entries()].map(([path23, n2]) => [
8734
+ path23,
8706
8735
  !!(n2 & 2),
8707
8736
  !!(n2 & 1)
8708
8737
  ]);
@@ -8907,9 +8936,9 @@ var GlobUtil = class {
8907
8936
  signal;
8908
8937
  maxDepth;
8909
8938
  includeChildMatches;
8910
- constructor(patterns, path22, opts) {
8939
+ constructor(patterns, path23, opts) {
8911
8940
  this.patterns = patterns;
8912
- this.path = path22;
8941
+ this.path = path23;
8913
8942
  this.opts = opts;
8914
8943
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
8915
8944
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -8928,11 +8957,11 @@ var GlobUtil = class {
8928
8957
  });
8929
8958
  }
8930
8959
  }
8931
- #ignored(path22) {
8932
- return this.seen.has(path22) || !!this.#ignore?.ignored?.(path22);
8960
+ #ignored(path23) {
8961
+ return this.seen.has(path23) || !!this.#ignore?.ignored?.(path23);
8933
8962
  }
8934
- #childrenIgnored(path22) {
8935
- return !!this.#ignore?.childrenIgnored?.(path22);
8963
+ #childrenIgnored(path23) {
8964
+ return !!this.#ignore?.childrenIgnored?.(path23);
8936
8965
  }
8937
8966
  // backpressure mechanism
8938
8967
  pause() {
@@ -9147,8 +9176,8 @@ var GlobUtil = class {
9147
9176
  };
9148
9177
  var GlobWalker = class extends GlobUtil {
9149
9178
  matches = /* @__PURE__ */ new Set();
9150
- constructor(patterns, path22, opts) {
9151
- super(patterns, path22, opts);
9179
+ constructor(patterns, path23, opts) {
9180
+ super(patterns, path23, opts);
9152
9181
  }
9153
9182
  matchEmit(e) {
9154
9183
  this.matches.add(e);
@@ -9185,8 +9214,8 @@ var GlobWalker = class extends GlobUtil {
9185
9214
  };
9186
9215
  var GlobStream = class extends GlobUtil {
9187
9216
  results;
9188
- constructor(patterns, path22, opts) {
9189
- super(patterns, path22, opts);
9217
+ constructor(patterns, path23, opts) {
9218
+ super(patterns, path23, opts);
9190
9219
  this.results = new Minipass({
9191
9220
  signal: this.signal,
9192
9221
  objectMode: true
@@ -9523,44 +9552,44 @@ init_esm_shims();
9523
9552
  var platform_default = process.env.__TESTING_RIMRAF_PLATFORM__ || process.platform;
9524
9553
 
9525
9554
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/path-arg.js
9526
- var pathArg = (path22, opt = {}) => {
9527
- const type = typeof path22;
9555
+ var pathArg = (path23, opt = {}) => {
9556
+ const type = typeof path23;
9528
9557
  if (type !== "string") {
9529
- const ctor = path22 && type === "object" && path22.constructor;
9530
- const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path22) : `type ${type} ${path22}`;
9558
+ const ctor = path23 && type === "object" && path23.constructor;
9559
+ const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path23) : `type ${type} ${path23}`;
9531
9560
  const msg = `The "path" argument must be of type string. Received ${received}`;
9532
9561
  throw Object.assign(new TypeError(msg), {
9533
- path: path22,
9562
+ path: path23,
9534
9563
  code: "ERR_INVALID_ARG_TYPE"
9535
9564
  });
9536
9565
  }
9537
- if (/\0/.test(path22)) {
9566
+ if (/\0/.test(path23)) {
9538
9567
  const msg = "path must be a string without null bytes";
9539
9568
  throw Object.assign(new TypeError(msg), {
9540
- path: path22,
9569
+ path: path23,
9541
9570
  code: "ERR_INVALID_ARG_VALUE"
9542
9571
  });
9543
9572
  }
9544
- path22 = resolve3(path22);
9545
- const { root } = parse(path22);
9546
- if (path22 === root && opt.preserveRoot !== false) {
9573
+ path23 = resolve3(path23);
9574
+ const { root } = parse(path23);
9575
+ if (path23 === root && opt.preserveRoot !== false) {
9547
9576
  const msg = "refusing to remove root directory without preserveRoot:false";
9548
9577
  throw Object.assign(new Error(msg), {
9549
- path: path22,
9578
+ path: path23,
9550
9579
  code: "ERR_PRESERVE_ROOT"
9551
9580
  });
9552
9581
  }
9553
9582
  if (platform_default === "win32") {
9554
9583
  const badWinChars = /[*|"<>?:]/;
9555
- const { root: root2 } = parse(path22);
9556
- if (badWinChars.test(path22.substring(root2.length))) {
9584
+ const { root: root2 } = parse(path23);
9585
+ if (badWinChars.test(path23.substring(root2.length))) {
9557
9586
  throw Object.assign(new Error("Illegal characters in path."), {
9558
- path: path22,
9587
+ path: path23,
9559
9588
  code: "EINVAL"
9560
9589
  });
9561
9590
  }
9562
9591
  }
9563
- return path22;
9592
+ return path23;
9564
9593
  };
9565
9594
  var path_arg_default = pathArg;
9566
9595
 
@@ -9575,16 +9604,16 @@ init_esm_shims();
9575
9604
  import fs3 from "fs";
9576
9605
  import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync as lstatSync2, unlinkSync } from "fs";
9577
9606
  import { readdirSync as rdSync } from "fs";
9578
- var readdirSync2 = (path22) => rdSync(path22, { withFileTypes: true });
9579
- var chmod = (path22, mode) => new Promise((res, rej) => fs3.chmod(path22, mode, (er, ...d) => er ? rej(er) : res(...d)));
9580
- var mkdir = (path22, options) => new Promise((res, rej) => fs3.mkdir(path22, options, (er, made) => er ? rej(er) : res(made)));
9581
- var readdir4 = (path22) => new Promise((res, rej) => fs3.readdir(path22, { withFileTypes: true }, (er, data2) => er ? rej(er) : res(data2)));
9607
+ var readdirSync2 = (path23) => rdSync(path23, { withFileTypes: true });
9608
+ var chmod = (path23, mode) => new Promise((res, rej) => fs3.chmod(path23, mode, (er, ...d) => er ? rej(er) : res(...d)));
9609
+ var mkdir = (path23, options) => new Promise((res, rej) => fs3.mkdir(path23, options, (er, made) => er ? rej(er) : res(made)));
9610
+ var readdir4 = (path23) => new Promise((res, rej) => fs3.readdir(path23, { withFileTypes: true }, (er, data2) => er ? rej(er) : res(data2)));
9582
9611
  var rename = (oldPath, newPath) => new Promise((res, rej) => fs3.rename(oldPath, newPath, (er, ...d) => er ? rej(er) : res(...d)));
9583
- var rm = (path22, options) => new Promise((res, rej) => fs3.rm(path22, options, (er, ...d) => er ? rej(er) : res(...d)));
9584
- var rmdir = (path22) => new Promise((res, rej) => fs3.rmdir(path22, (er, ...d) => er ? rej(er) : res(...d)));
9585
- var stat4 = (path22) => new Promise((res, rej) => fs3.stat(path22, (er, data2) => er ? rej(er) : res(data2)));
9586
- var lstat4 = (path22) => new Promise((res, rej) => fs3.lstat(path22, (er, data2) => er ? rej(er) : res(data2)));
9587
- var unlink = (path22) => new Promise((res, rej) => fs3.unlink(path22, (er, ...d) => er ? rej(er) : res(...d)));
9612
+ var rm = (path23, options) => new Promise((res, rej) => fs3.rm(path23, options, (er, ...d) => er ? rej(er) : res(...d)));
9613
+ var rmdir = (path23) => new Promise((res, rej) => fs3.rmdir(path23, (er, ...d) => er ? rej(er) : res(...d)));
9614
+ var stat4 = (path23) => new Promise((res, rej) => fs3.stat(path23, (er, data2) => er ? rej(er) : res(data2)));
9615
+ var lstat4 = (path23) => new Promise((res, rej) => fs3.lstat(path23, (er, data2) => er ? rej(er) : res(data2)));
9616
+ var unlink = (path23) => new Promise((res, rej) => fs3.unlink(path23, (er, ...d) => er ? rej(er) : res(...d)));
9588
9617
  var promises = {
9589
9618
  chmod,
9590
9619
  mkdir,
@@ -9603,10 +9632,10 @@ import { parse as parse2, resolve as resolve4 } from "path";
9603
9632
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/readdir-or-error.js
9604
9633
  init_esm_shims();
9605
9634
  var { readdir: readdir5 } = promises;
9606
- var readdirOrError = (path22) => readdir5(path22).catch((er) => er);
9607
- var readdirOrErrorSync = (path22) => {
9635
+ var readdirOrError = (path23) => readdir5(path23).catch((er) => er);
9636
+ var readdirOrErrorSync = (path23) => {
9608
9637
  try {
9609
- return readdirSync2(path22);
9638
+ return readdirSync2(path23);
9610
9639
  } catch (er) {
9611
9640
  return er;
9612
9641
  }
@@ -9631,35 +9660,35 @@ var ignoreENOENTSync = (fn) => {
9631
9660
 
9632
9661
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-posix.js
9633
9662
  var { lstat: lstat5, rmdir: rmdir2, unlink: unlink2 } = promises;
9634
- var rimrafPosix = async (path22, opt) => {
9663
+ var rimrafPosix = async (path23, opt) => {
9635
9664
  if (opt?.signal?.aborted) {
9636
9665
  throw opt.signal.reason;
9637
9666
  }
9638
9667
  try {
9639
- return await rimrafPosixDir(path22, opt, await lstat5(path22));
9668
+ return await rimrafPosixDir(path23, opt, await lstat5(path23));
9640
9669
  } catch (er) {
9641
9670
  if (er?.code === "ENOENT")
9642
9671
  return true;
9643
9672
  throw er;
9644
9673
  }
9645
9674
  };
9646
- var rimrafPosixSync = (path22, opt) => {
9675
+ var rimrafPosixSync = (path23, opt) => {
9647
9676
  if (opt?.signal?.aborted) {
9648
9677
  throw opt.signal.reason;
9649
9678
  }
9650
9679
  try {
9651
- return rimrafPosixDirSync(path22, opt, lstatSync2(path22));
9680
+ return rimrafPosixDirSync(path23, opt, lstatSync2(path23));
9652
9681
  } catch (er) {
9653
9682
  if (er?.code === "ENOENT")
9654
9683
  return true;
9655
9684
  throw er;
9656
9685
  }
9657
9686
  };
9658
- var rimrafPosixDir = async (path22, opt, ent) => {
9687
+ var rimrafPosixDir = async (path23, opt, ent) => {
9659
9688
  if (opt?.signal?.aborted) {
9660
9689
  throw opt.signal.reason;
9661
9690
  }
9662
- const entries = ent.isDirectory() ? await readdirOrError(path22) : null;
9691
+ const entries = ent.isDirectory() ? await readdirOrError(path23) : null;
9663
9692
  if (!Array.isArray(entries)) {
9664
9693
  if (entries) {
9665
9694
  if (entries.code === "ENOENT") {
@@ -9669,30 +9698,30 @@ var rimrafPosixDir = async (path22, opt, ent) => {
9669
9698
  throw entries;
9670
9699
  }
9671
9700
  }
9672
- if (opt.filter && !await opt.filter(path22, ent)) {
9701
+ if (opt.filter && !await opt.filter(path23, ent)) {
9673
9702
  return false;
9674
9703
  }
9675
- await ignoreENOENT(unlink2(path22));
9704
+ await ignoreENOENT(unlink2(path23));
9676
9705
  return true;
9677
9706
  }
9678
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path22, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9707
+ const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path23, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9679
9708
  if (!removedAll) {
9680
9709
  return false;
9681
9710
  }
9682
- if (opt.preserveRoot === false && path22 === parse2(path22).root) {
9711
+ if (opt.preserveRoot === false && path23 === parse2(path23).root) {
9683
9712
  return false;
9684
9713
  }
9685
- if (opt.filter && !await opt.filter(path22, ent)) {
9714
+ if (opt.filter && !await opt.filter(path23, ent)) {
9686
9715
  return false;
9687
9716
  }
9688
- await ignoreENOENT(rmdir2(path22));
9717
+ await ignoreENOENT(rmdir2(path23));
9689
9718
  return true;
9690
9719
  };
9691
- var rimrafPosixDirSync = (path22, opt, ent) => {
9720
+ var rimrafPosixDirSync = (path23, opt, ent) => {
9692
9721
  if (opt?.signal?.aborted) {
9693
9722
  throw opt.signal.reason;
9694
9723
  }
9695
- const entries = ent.isDirectory() ? readdirOrErrorSync(path22) : null;
9724
+ const entries = ent.isDirectory() ? readdirOrErrorSync(path23) : null;
9696
9725
  if (!Array.isArray(entries)) {
9697
9726
  if (entries) {
9698
9727
  if (entries.code === "ENOENT") {
@@ -9702,27 +9731,27 @@ var rimrafPosixDirSync = (path22, opt, ent) => {
9702
9731
  throw entries;
9703
9732
  }
9704
9733
  }
9705
- if (opt.filter && !opt.filter(path22, ent)) {
9734
+ if (opt.filter && !opt.filter(path23, ent)) {
9706
9735
  return false;
9707
9736
  }
9708
- ignoreENOENTSync(() => unlinkSync(path22));
9737
+ ignoreENOENTSync(() => unlinkSync(path23));
9709
9738
  return true;
9710
9739
  }
9711
9740
  let removedAll = true;
9712
9741
  for (const ent2 of entries) {
9713
- const p = resolve4(path22, ent2.name);
9742
+ const p = resolve4(path23, ent2.name);
9714
9743
  removedAll = rimrafPosixDirSync(p, opt, ent2) && removedAll;
9715
9744
  }
9716
- if (opt.preserveRoot === false && path22 === parse2(path22).root) {
9745
+ if (opt.preserveRoot === false && path23 === parse2(path23).root) {
9717
9746
  return false;
9718
9747
  }
9719
9748
  if (!removedAll) {
9720
9749
  return false;
9721
9750
  }
9722
- if (opt.filter && !opt.filter(path22, ent)) {
9751
+ if (opt.filter && !opt.filter(path23, ent)) {
9723
9752
  return false;
9724
9753
  }
9725
- ignoreENOENTSync(() => rmdirSync(path22));
9754
+ ignoreENOENTSync(() => rmdirSync(path23));
9726
9755
  return true;
9727
9756
  };
9728
9757
 
@@ -9733,9 +9762,9 @@ import { parse as parse5, resolve as resolve7 } from "path";
9733
9762
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/fix-eperm.js
9734
9763
  init_esm_shims();
9735
9764
  var { chmod: chmod2 } = promises;
9736
- var fixEPERM = (fn) => async (path22) => {
9765
+ var fixEPERM = (fn) => async (path23) => {
9737
9766
  try {
9738
- return await fn(path22);
9767
+ return await fn(path23);
9739
9768
  } catch (er) {
9740
9769
  const fer = er;
9741
9770
  if (fer?.code === "ENOENT") {
@@ -9743,7 +9772,7 @@ var fixEPERM = (fn) => async (path22) => {
9743
9772
  }
9744
9773
  if (fer?.code === "EPERM") {
9745
9774
  try {
9746
- await chmod2(path22, 438);
9775
+ await chmod2(path23, 438);
9747
9776
  } catch (er2) {
9748
9777
  const fer2 = er2;
9749
9778
  if (fer2?.code === "ENOENT") {
@@ -9751,14 +9780,14 @@ var fixEPERM = (fn) => async (path22) => {
9751
9780
  }
9752
9781
  throw er;
9753
9782
  }
9754
- return await fn(path22);
9783
+ return await fn(path23);
9755
9784
  }
9756
9785
  throw er;
9757
9786
  }
9758
9787
  };
9759
- var fixEPERMSync = (fn) => (path22) => {
9788
+ var fixEPERMSync = (fn) => (path23) => {
9760
9789
  try {
9761
- return fn(path22);
9790
+ return fn(path23);
9762
9791
  } catch (er) {
9763
9792
  const fer = er;
9764
9793
  if (fer?.code === "ENOENT") {
@@ -9766,7 +9795,7 @@ var fixEPERMSync = (fn) => (path22) => {
9766
9795
  }
9767
9796
  if (fer?.code === "EPERM") {
9768
9797
  try {
9769
- chmodSync(path22, 438);
9798
+ chmodSync(path23, 438);
9770
9799
  } catch (er2) {
9771
9800
  const fer2 = er2;
9772
9801
  if (fer2?.code === "ENOENT") {
@@ -9774,7 +9803,7 @@ var fixEPERMSync = (fn) => (path22) => {
9774
9803
  }
9775
9804
  throw er;
9776
9805
  }
9777
- return fn(path22);
9806
+ return fn(path23);
9778
9807
  }
9779
9808
  throw er;
9780
9809
  }
@@ -9787,23 +9816,23 @@ var RATE = 1.2;
9787
9816
  var MAXRETRIES = 10;
9788
9817
  var codes = /* @__PURE__ */ new Set(["EMFILE", "ENFILE", "EBUSY"]);
9789
9818
  var retryBusy = (fn) => {
9790
- const method = async (path22, opt, backoff = 1, total = 0) => {
9819
+ const method = async (path23, opt, backoff = 1, total = 0) => {
9791
9820
  const mbo = opt.maxBackoff || MAXBACKOFF;
9792
9821
  const rate = opt.backoff || RATE;
9793
9822
  const max = opt.maxRetries || MAXRETRIES;
9794
9823
  let retries = 0;
9795
9824
  while (true) {
9796
9825
  try {
9797
- return await fn(path22);
9826
+ return await fn(path23);
9798
9827
  } catch (er) {
9799
9828
  const fer = er;
9800
- if (fer?.path === path22 && fer?.code && codes.has(fer.code)) {
9829
+ if (fer?.path === path23 && fer?.code && codes.has(fer.code)) {
9801
9830
  backoff = Math.ceil(backoff * rate);
9802
9831
  total = backoff + total;
9803
9832
  if (total < mbo) {
9804
9833
  return new Promise((res, rej) => {
9805
9834
  setTimeout(() => {
9806
- method(path22, opt, backoff, total).then(res, rej);
9835
+ method(path23, opt, backoff, total).then(res, rej);
9807
9836
  }, backoff);
9808
9837
  });
9809
9838
  }
@@ -9819,15 +9848,15 @@ var retryBusy = (fn) => {
9819
9848
  return method;
9820
9849
  };
9821
9850
  var retryBusySync = (fn) => {
9822
- const method = (path22, opt) => {
9851
+ const method = (path23, opt) => {
9823
9852
  const max = opt.maxRetries || MAXRETRIES;
9824
9853
  let retries = 0;
9825
9854
  while (true) {
9826
9855
  try {
9827
- return fn(path22);
9856
+ return fn(path23);
9828
9857
  } catch (er) {
9829
9858
  const fer = er;
9830
- if (fer?.path === path22 && fer?.code && codes.has(fer.code) && retries < max) {
9859
+ if (fer?.path === path23 && fer?.code && codes.has(fer.code) && retries < max) {
9831
9860
  retries++;
9832
9861
  continue;
9833
9862
  }
@@ -9847,16 +9876,16 @@ init_esm_shims();
9847
9876
  import { tmpdir } from "os";
9848
9877
  import { parse as parse3, resolve as resolve5 } from "path";
9849
9878
  var { stat: stat5 } = promises;
9850
- var isDirSync = (path22) => {
9879
+ var isDirSync = (path23) => {
9851
9880
  try {
9852
- return statSync(path22).isDirectory();
9881
+ return statSync(path23).isDirectory();
9853
9882
  } catch (er) {
9854
9883
  return false;
9855
9884
  }
9856
9885
  };
9857
- var isDir = (path22) => stat5(path22).then((st) => st.isDirectory(), () => false);
9858
- var win32DefaultTmp = async (path22) => {
9859
- const { root } = parse3(path22);
9886
+ var isDir = (path23) => stat5(path23).then((st) => st.isDirectory(), () => false);
9887
+ var win32DefaultTmp = async (path23) => {
9888
+ const { root } = parse3(path23);
9860
9889
  const tmp = tmpdir();
9861
9890
  const { root: tmpRoot } = parse3(tmp);
9862
9891
  if (root.toLowerCase() === tmpRoot.toLowerCase()) {
@@ -9868,8 +9897,8 @@ var win32DefaultTmp = async (path22) => {
9868
9897
  }
9869
9898
  return root;
9870
9899
  };
9871
- var win32DefaultTmpSync = (path22) => {
9872
- const { root } = parse3(path22);
9900
+ var win32DefaultTmpSync = (path23) => {
9901
+ const { root } = parse3(path23);
9873
9902
  const tmp = tmpdir();
9874
9903
  const { root: tmpRoot } = parse3(tmp);
9875
9904
  if (root.toLowerCase() === tmpRoot.toLowerCase()) {
@@ -9888,10 +9917,10 @@ var defaultTmpSync = platform_default === "win32" ? win32DefaultTmpSync : posixD
9888
9917
 
9889
9918
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-move-remove.js
9890
9919
  var { lstat: lstat6, rename: rename2, unlink: unlink3, rmdir: rmdir3, chmod: chmod3 } = promises;
9891
- var uniqueFilename = (path22) => `.${basename3(path22)}.${Math.random()}`;
9892
- var unlinkFixEPERM = async (path22) => unlink3(path22).catch((er) => {
9920
+ var uniqueFilename = (path23) => `.${basename3(path23)}.${Math.random()}`;
9921
+ var unlinkFixEPERM = async (path23) => unlink3(path23).catch((er) => {
9893
9922
  if (er.code === "EPERM") {
9894
- return chmod3(path22, 438).then(() => unlink3(path22), (er2) => {
9923
+ return chmod3(path23, 438).then(() => unlink3(path23), (er2) => {
9895
9924
  if (er2.code === "ENOENT") {
9896
9925
  return;
9897
9926
  }
@@ -9902,13 +9931,13 @@ var unlinkFixEPERM = async (path22) => unlink3(path22).catch((er) => {
9902
9931
  }
9903
9932
  throw er;
9904
9933
  });
9905
- var unlinkFixEPERMSync = (path22) => {
9934
+ var unlinkFixEPERMSync = (path23) => {
9906
9935
  try {
9907
- unlinkSync(path22);
9936
+ unlinkSync(path23);
9908
9937
  } catch (er) {
9909
9938
  if (er?.code === "EPERM") {
9910
9939
  try {
9911
- return chmodSync(path22, 438);
9940
+ return chmodSync(path23, 438);
9912
9941
  } catch (er2) {
9913
9942
  if (er2?.code === "ENOENT") {
9914
9943
  return;
@@ -9921,29 +9950,29 @@ var unlinkFixEPERMSync = (path22) => {
9921
9950
  throw er;
9922
9951
  }
9923
9952
  };
9924
- var rimrafMoveRemove = async (path22, opt) => {
9953
+ var rimrafMoveRemove = async (path23, opt) => {
9925
9954
  if (opt?.signal?.aborted) {
9926
9955
  throw opt.signal.reason;
9927
9956
  }
9928
9957
  try {
9929
- return await rimrafMoveRemoveDir(path22, opt, await lstat6(path22));
9958
+ return await rimrafMoveRemoveDir(path23, opt, await lstat6(path23));
9930
9959
  } catch (er) {
9931
9960
  if (er?.code === "ENOENT")
9932
9961
  return true;
9933
9962
  throw er;
9934
9963
  }
9935
9964
  };
9936
- var rimrafMoveRemoveDir = async (path22, opt, ent) => {
9965
+ var rimrafMoveRemoveDir = async (path23, opt, ent) => {
9937
9966
  if (opt?.signal?.aborted) {
9938
9967
  throw opt.signal.reason;
9939
9968
  }
9940
9969
  if (!opt.tmp) {
9941
- return rimrafMoveRemoveDir(path22, { ...opt, tmp: await defaultTmp(path22) }, ent);
9970
+ return rimrafMoveRemoveDir(path23, { ...opt, tmp: await defaultTmp(path23) }, ent);
9942
9971
  }
9943
- if (path22 === opt.tmp && parse4(path22).root !== path22) {
9972
+ if (path23 === opt.tmp && parse4(path23).root !== path23) {
9944
9973
  throw new Error("cannot delete temp directory used for deletion");
9945
9974
  }
9946
- const entries = ent.isDirectory() ? await readdirOrError(path22) : null;
9975
+ const entries = ent.isDirectory() ? await readdirOrError(path23) : null;
9947
9976
  if (!Array.isArray(entries)) {
9948
9977
  if (entries) {
9949
9978
  if (entries.code === "ENOENT") {
@@ -9953,54 +9982,54 @@ var rimrafMoveRemoveDir = async (path22, opt, ent) => {
9953
9982
  throw entries;
9954
9983
  }
9955
9984
  }
9956
- if (opt.filter && !await opt.filter(path22, ent)) {
9985
+ if (opt.filter && !await opt.filter(path23, ent)) {
9957
9986
  return false;
9958
9987
  }
9959
- await ignoreENOENT(tmpUnlink(path22, opt.tmp, unlinkFixEPERM));
9988
+ await ignoreENOENT(tmpUnlink(path23, opt.tmp, unlinkFixEPERM));
9960
9989
  return true;
9961
9990
  }
9962
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path22, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9991
+ const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path23, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
9963
9992
  if (!removedAll) {
9964
9993
  return false;
9965
9994
  }
9966
- if (opt.preserveRoot === false && path22 === parse4(path22).root) {
9995
+ if (opt.preserveRoot === false && path23 === parse4(path23).root) {
9967
9996
  return false;
9968
9997
  }
9969
- if (opt.filter && !await opt.filter(path22, ent)) {
9998
+ if (opt.filter && !await opt.filter(path23, ent)) {
9970
9999
  return false;
9971
10000
  }
9972
- await ignoreENOENT(tmpUnlink(path22, opt.tmp, rmdir3));
10001
+ await ignoreENOENT(tmpUnlink(path23, opt.tmp, rmdir3));
9973
10002
  return true;
9974
10003
  };
9975
- var tmpUnlink = async (path22, tmp, rm3) => {
9976
- const tmpFile = resolve6(tmp, uniqueFilename(path22));
9977
- await rename2(path22, tmpFile);
10004
+ var tmpUnlink = async (path23, tmp, rm3) => {
10005
+ const tmpFile = resolve6(tmp, uniqueFilename(path23));
10006
+ await rename2(path23, tmpFile);
9978
10007
  return await rm3(tmpFile);
9979
10008
  };
9980
- var rimrafMoveRemoveSync = (path22, opt) => {
10009
+ var rimrafMoveRemoveSync = (path23, opt) => {
9981
10010
  if (opt?.signal?.aborted) {
9982
10011
  throw opt.signal.reason;
9983
10012
  }
9984
10013
  try {
9985
- return rimrafMoveRemoveDirSync(path22, opt, lstatSync2(path22));
10014
+ return rimrafMoveRemoveDirSync(path23, opt, lstatSync2(path23));
9986
10015
  } catch (er) {
9987
10016
  if (er?.code === "ENOENT")
9988
10017
  return true;
9989
10018
  throw er;
9990
10019
  }
9991
10020
  };
9992
- var rimrafMoveRemoveDirSync = (path22, opt, ent) => {
10021
+ var rimrafMoveRemoveDirSync = (path23, opt, ent) => {
9993
10022
  if (opt?.signal?.aborted) {
9994
10023
  throw opt.signal.reason;
9995
10024
  }
9996
10025
  if (!opt.tmp) {
9997
- return rimrafMoveRemoveDirSync(path22, { ...opt, tmp: defaultTmpSync(path22) }, ent);
10026
+ return rimrafMoveRemoveDirSync(path23, { ...opt, tmp: defaultTmpSync(path23) }, ent);
9998
10027
  }
9999
10028
  const tmp = opt.tmp;
10000
- if (path22 === opt.tmp && parse4(path22).root !== path22) {
10029
+ if (path23 === opt.tmp && parse4(path23).root !== path23) {
10001
10030
  throw new Error("cannot delete temp directory used for deletion");
10002
10031
  }
10003
- const entries = ent.isDirectory() ? readdirOrErrorSync(path22) : null;
10032
+ const entries = ent.isDirectory() ? readdirOrErrorSync(path23) : null;
10004
10033
  if (!Array.isArray(entries)) {
10005
10034
  if (entries) {
10006
10035
  if (entries.code === "ENOENT") {
@@ -10010,32 +10039,32 @@ var rimrafMoveRemoveDirSync = (path22, opt, ent) => {
10010
10039
  throw entries;
10011
10040
  }
10012
10041
  }
10013
- if (opt.filter && !opt.filter(path22, ent)) {
10042
+ if (opt.filter && !opt.filter(path23, ent)) {
10014
10043
  return false;
10015
10044
  }
10016
- ignoreENOENTSync(() => tmpUnlinkSync(path22, tmp, unlinkFixEPERMSync));
10045
+ ignoreENOENTSync(() => tmpUnlinkSync(path23, tmp, unlinkFixEPERMSync));
10017
10046
  return true;
10018
10047
  }
10019
10048
  let removedAll = true;
10020
10049
  for (const ent2 of entries) {
10021
- const p = resolve6(path22, ent2.name);
10050
+ const p = resolve6(path23, ent2.name);
10022
10051
  removedAll = rimrafMoveRemoveDirSync(p, opt, ent2) && removedAll;
10023
10052
  }
10024
10053
  if (!removedAll) {
10025
10054
  return false;
10026
10055
  }
10027
- if (opt.preserveRoot === false && path22 === parse4(path22).root) {
10056
+ if (opt.preserveRoot === false && path23 === parse4(path23).root) {
10028
10057
  return false;
10029
10058
  }
10030
- if (opt.filter && !opt.filter(path22, ent)) {
10059
+ if (opt.filter && !opt.filter(path23, ent)) {
10031
10060
  return false;
10032
10061
  }
10033
- ignoreENOENTSync(() => tmpUnlinkSync(path22, tmp, rmdirSync));
10062
+ ignoreENOENTSync(() => tmpUnlinkSync(path23, tmp, rmdirSync));
10034
10063
  return true;
10035
10064
  };
10036
- var tmpUnlinkSync = (path22, tmp, rmSync2) => {
10037
- const tmpFile = resolve6(tmp, uniqueFilename(path22));
10038
- renameSync(path22, tmpFile);
10065
+ var tmpUnlinkSync = (path23, tmp, rmSync2) => {
10066
+ const tmpFile = resolve6(tmp, uniqueFilename(path23));
10067
+ renameSync(path23, tmpFile);
10039
10068
  return rmSync2(tmpFile);
10040
10069
  };
10041
10070
 
@@ -10045,31 +10074,31 @@ var rimrafWindowsFile = retryBusy(fixEPERM(unlink4));
10045
10074
  var rimrafWindowsFileSync = retryBusySync(fixEPERMSync(unlinkSync));
10046
10075
  var rimrafWindowsDirRetry = retryBusy(fixEPERM(rmdir4));
10047
10076
  var rimrafWindowsDirRetrySync = retryBusySync(fixEPERMSync(rmdirSync));
10048
- var rimrafWindowsDirMoveRemoveFallback = async (path22, opt) => {
10077
+ var rimrafWindowsDirMoveRemoveFallback = async (path23, opt) => {
10049
10078
  if (opt?.signal?.aborted) {
10050
10079
  throw opt.signal.reason;
10051
10080
  }
10052
10081
  const { filter: filter3, ...options } = opt;
10053
10082
  try {
10054
- return await rimrafWindowsDirRetry(path22, options);
10083
+ return await rimrafWindowsDirRetry(path23, options);
10055
10084
  } catch (er) {
10056
10085
  if (er?.code === "ENOTEMPTY") {
10057
- return await rimrafMoveRemove(path22, options);
10086
+ return await rimrafMoveRemove(path23, options);
10058
10087
  }
10059
10088
  throw er;
10060
10089
  }
10061
10090
  };
10062
- var rimrafWindowsDirMoveRemoveFallbackSync = (path22, opt) => {
10091
+ var rimrafWindowsDirMoveRemoveFallbackSync = (path23, opt) => {
10063
10092
  if (opt?.signal?.aborted) {
10064
10093
  throw opt.signal.reason;
10065
10094
  }
10066
10095
  const { filter: filter3, ...options } = opt;
10067
10096
  try {
10068
- return rimrafWindowsDirRetrySync(path22, options);
10097
+ return rimrafWindowsDirRetrySync(path23, options);
10069
10098
  } catch (er) {
10070
10099
  const fer = er;
10071
10100
  if (fer?.code === "ENOTEMPTY") {
10072
- return rimrafMoveRemoveSync(path22, options);
10101
+ return rimrafMoveRemoveSync(path23, options);
10073
10102
  }
10074
10103
  throw er;
10075
10104
  }
@@ -10077,35 +10106,35 @@ var rimrafWindowsDirMoveRemoveFallbackSync = (path22, opt) => {
10077
10106
  var START = Symbol("start");
10078
10107
  var CHILD = Symbol("child");
10079
10108
  var FINISH = Symbol("finish");
10080
- var rimrafWindows = async (path22, opt) => {
10109
+ var rimrafWindows = async (path23, opt) => {
10081
10110
  if (opt?.signal?.aborted) {
10082
10111
  throw opt.signal.reason;
10083
10112
  }
10084
10113
  try {
10085
- return await rimrafWindowsDir(path22, opt, await lstat7(path22), START);
10114
+ return await rimrafWindowsDir(path23, opt, await lstat7(path23), START);
10086
10115
  } catch (er) {
10087
10116
  if (er?.code === "ENOENT")
10088
10117
  return true;
10089
10118
  throw er;
10090
10119
  }
10091
10120
  };
10092
- var rimrafWindowsSync = (path22, opt) => {
10121
+ var rimrafWindowsSync = (path23, opt) => {
10093
10122
  if (opt?.signal?.aborted) {
10094
10123
  throw opt.signal.reason;
10095
10124
  }
10096
10125
  try {
10097
- return rimrafWindowsDirSync(path22, opt, lstatSync2(path22), START);
10126
+ return rimrafWindowsDirSync(path23, opt, lstatSync2(path23), START);
10098
10127
  } catch (er) {
10099
10128
  if (er?.code === "ENOENT")
10100
10129
  return true;
10101
10130
  throw er;
10102
10131
  }
10103
10132
  };
10104
- var rimrafWindowsDir = async (path22, opt, ent, state = START) => {
10133
+ var rimrafWindowsDir = async (path23, opt, ent, state = START) => {
10105
10134
  if (opt?.signal?.aborted) {
10106
10135
  throw opt.signal.reason;
10107
10136
  }
10108
- const entries = ent.isDirectory() ? await readdirOrError(path22) : null;
10137
+ const entries = ent.isDirectory() ? await readdirOrError(path23) : null;
10109
10138
  if (!Array.isArray(entries)) {
10110
10139
  if (entries) {
10111
10140
  if (entries.code === "ENOENT") {
@@ -10115,32 +10144,32 @@ var rimrafWindowsDir = async (path22, opt, ent, state = START) => {
10115
10144
  throw entries;
10116
10145
  }
10117
10146
  }
10118
- if (opt.filter && !await opt.filter(path22, ent)) {
10147
+ if (opt.filter && !await opt.filter(path23, ent)) {
10119
10148
  return false;
10120
10149
  }
10121
- await ignoreENOENT(rimrafWindowsFile(path22, opt));
10150
+ await ignoreENOENT(rimrafWindowsFile(path23, opt));
10122
10151
  return true;
10123
10152
  }
10124
10153
  const s = state === START ? CHILD : state;
10125
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path22, ent2.name), opt, ent2, s)))).reduce((a, b) => a && b, true);
10154
+ const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path23, ent2.name), opt, ent2, s)))).reduce((a, b) => a && b, true);
10126
10155
  if (state === START) {
10127
- return rimrafWindowsDir(path22, opt, ent, FINISH);
10156
+ return rimrafWindowsDir(path23, opt, ent, FINISH);
10128
10157
  } else if (state === FINISH) {
10129
- if (opt.preserveRoot === false && path22 === parse5(path22).root) {
10158
+ if (opt.preserveRoot === false && path23 === parse5(path23).root) {
10130
10159
  return false;
10131
10160
  }
10132
10161
  if (!removedAll) {
10133
10162
  return false;
10134
10163
  }
10135
- if (opt.filter && !await opt.filter(path22, ent)) {
10164
+ if (opt.filter && !await opt.filter(path23, ent)) {
10136
10165
  return false;
10137
10166
  }
10138
- await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path22, opt));
10167
+ await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path23, opt));
10139
10168
  }
10140
10169
  return true;
10141
10170
  };
10142
- var rimrafWindowsDirSync = (path22, opt, ent, state = START) => {
10143
- const entries = ent.isDirectory() ? readdirOrErrorSync(path22) : null;
10171
+ var rimrafWindowsDirSync = (path23, opt, ent, state = START) => {
10172
+ const entries = ent.isDirectory() ? readdirOrErrorSync(path23) : null;
10144
10173
  if (!Array.isArray(entries)) {
10145
10174
  if (entries) {
10146
10175
  if (entries.code === "ENOENT") {
@@ -10150,32 +10179,32 @@ var rimrafWindowsDirSync = (path22, opt, ent, state = START) => {
10150
10179
  throw entries;
10151
10180
  }
10152
10181
  }
10153
- if (opt.filter && !opt.filter(path22, ent)) {
10182
+ if (opt.filter && !opt.filter(path23, ent)) {
10154
10183
  return false;
10155
10184
  }
10156
- ignoreENOENTSync(() => rimrafWindowsFileSync(path22, opt));
10185
+ ignoreENOENTSync(() => rimrafWindowsFileSync(path23, opt));
10157
10186
  return true;
10158
10187
  }
10159
10188
  let removedAll = true;
10160
10189
  for (const ent2 of entries) {
10161
10190
  const s = state === START ? CHILD : state;
10162
- const p = resolve7(path22, ent2.name);
10191
+ const p = resolve7(path23, ent2.name);
10163
10192
  removedAll = rimrafWindowsDirSync(p, opt, ent2, s) && removedAll;
10164
10193
  }
10165
10194
  if (state === START) {
10166
- return rimrafWindowsDirSync(path22, opt, ent, FINISH);
10195
+ return rimrafWindowsDirSync(path23, opt, ent, FINISH);
10167
10196
  } else if (state === FINISH) {
10168
- if (opt.preserveRoot === false && path22 === parse5(path22).root) {
10197
+ if (opt.preserveRoot === false && path23 === parse5(path23).root) {
10169
10198
  return false;
10170
10199
  }
10171
10200
  if (!removedAll) {
10172
10201
  return false;
10173
10202
  }
10174
- if (opt.filter && !opt.filter(path22, ent)) {
10203
+ if (opt.filter && !opt.filter(path23, ent)) {
10175
10204
  return false;
10176
10205
  }
10177
10206
  ignoreENOENTSync(() => {
10178
- rimrafWindowsDirMoveRemoveFallbackSync(path22, opt);
10207
+ rimrafWindowsDirMoveRemoveFallbackSync(path23, opt);
10179
10208
  });
10180
10209
  }
10181
10210
  return true;
@@ -10188,16 +10217,16 @@ var rimrafManualSync = platform_default === "win32" ? rimrafWindowsSync : rimraf
10188
10217
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-native.js
10189
10218
  init_esm_shims();
10190
10219
  var { rm: rm2 } = promises;
10191
- var rimrafNative = async (path22, opt) => {
10192
- await rm2(path22, {
10220
+ var rimrafNative = async (path23, opt) => {
10221
+ await rm2(path23, {
10193
10222
  ...opt,
10194
10223
  force: true,
10195
10224
  recursive: true
10196
10225
  });
10197
10226
  return true;
10198
10227
  };
10199
- var rimrafNativeSync = (path22, opt) => {
10200
- rmSync(path22, {
10228
+ var rimrafNativeSync = (path23, opt) => {
10229
+ rmSync(path23, {
10201
10230
  ...opt,
10202
10231
  force: true,
10203
10232
  recursive: true
@@ -10215,26 +10244,26 @@ var useNative = !hasNative || platform_default === "win32" ? () => false : (opt)
10215
10244
  var useNativeSync = !hasNative || platform_default === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
10216
10245
 
10217
10246
  // ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/index.js
10218
- var wrap = (fn) => async (path22, opt) => {
10247
+ var wrap = (fn) => async (path23, opt) => {
10219
10248
  const options = optArg(opt);
10220
10249
  if (options.glob) {
10221
- path22 = await glob(path22, options.glob);
10250
+ path23 = await glob(path23, options.glob);
10222
10251
  }
10223
- if (Array.isArray(path22)) {
10224
- return !!(await Promise.all(path22.map((p) => fn(path_arg_default(p, options), options)))).reduce((a, b) => a && b, true);
10252
+ if (Array.isArray(path23)) {
10253
+ return !!(await Promise.all(path23.map((p) => fn(path_arg_default(p, options), options)))).reduce((a, b) => a && b, true);
10225
10254
  } else {
10226
- return !!await fn(path_arg_default(path22, options), options);
10255
+ return !!await fn(path_arg_default(path23, options), options);
10227
10256
  }
10228
10257
  };
10229
- var wrapSync = (fn) => (path22, opt) => {
10258
+ var wrapSync = (fn) => (path23, opt) => {
10230
10259
  const options = optArgSync(opt);
10231
10260
  if (options.glob) {
10232
- path22 = globSync(path22, options.glob);
10261
+ path23 = globSync(path23, options.glob);
10233
10262
  }
10234
- if (Array.isArray(path22)) {
10235
- return !!path22.map((p) => fn(path_arg_default(p, options), options)).reduce((a, b) => a && b, true);
10263
+ if (Array.isArray(path23)) {
10264
+ return !!path23.map((p) => fn(path_arg_default(p, options), options)).reduce((a, b) => a && b, true);
10236
10265
  } else {
10237
- return !!fn(path_arg_default(path22, options), options);
10266
+ return !!fn(path_arg_default(path23, options), options);
10238
10267
  }
10239
10268
  };
10240
10269
  var nativeSync = wrapSync(rimrafNativeSync);
@@ -10249,8 +10278,8 @@ var moveRemoveSync = wrapSync(rimrafMoveRemoveSync);
10249
10278
  var moveRemove = Object.assign(wrap(rimrafMoveRemove), {
10250
10279
  sync: moveRemoveSync
10251
10280
  });
10252
- var rimrafSync = wrapSync((path22, opt) => useNativeSync(opt) ? rimrafNativeSync(path22, opt) : rimrafManualSync(path22, opt));
10253
- var rimraf_ = wrap((path22, opt) => useNative(opt) ? rimrafNative(path22, opt) : rimrafManual(path22, opt));
10281
+ var rimrafSync = wrapSync((path23, opt) => useNativeSync(opt) ? rimrafNativeSync(path23, opt) : rimrafManualSync(path23, opt));
10282
+ var rimraf_ = wrap((path23, opt) => useNative(opt) ? rimrafNative(path23, opt) : rimrafManual(path23, opt));
10254
10283
  var rimraf = Object.assign(rimraf_, {
10255
10284
  rimraf: rimraf_,
10256
10285
  sync: rimrafSync,
@@ -10476,9 +10505,9 @@ function createBuildServicePlugin(ctx) {
10476
10505
 
10477
10506
  // src/runtime/configPlugin.ts
10478
10507
  init_esm_shims();
10479
- import process6 from "process";
10508
+ import process7 from "process";
10480
10509
  import { defu as defu3 } from "@weapp-core/shared";
10481
- import fs12 from "fs-extra";
10510
+ import fs13 from "fs-extra";
10482
10511
 
10483
10512
  // ../../node_modules/.pnpm/local-pkg@1.1.2/node_modules/local-pkg/dist/index.mjs
10484
10513
  init_esm_shims();
@@ -16124,17 +16153,17 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
16124
16153
  if (hasTrailingSlash(input, true)) {
16125
16154
  return input || "/";
16126
16155
  }
16127
- let path22 = input;
16156
+ let path23 = input;
16128
16157
  let fragment = "";
16129
16158
  const fragmentIndex = input.indexOf("#");
16130
16159
  if (fragmentIndex !== -1) {
16131
- path22 = input.slice(0, fragmentIndex);
16160
+ path23 = input.slice(0, fragmentIndex);
16132
16161
  fragment = input.slice(fragmentIndex);
16133
- if (!path22) {
16162
+ if (!path23) {
16134
16163
  return fragment;
16135
16164
  }
16136
16165
  }
16137
- const [s0, ...s] = path22.split("?");
16166
+ const [s0, ...s] = path23.split("?");
16138
16167
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
16139
16168
  }
16140
16169
  function isNonEmptyURL(url) {
@@ -16163,8 +16192,8 @@ import path7, { dirname as dirname3 } from "path";
16163
16192
  import v8 from "v8";
16164
16193
  import { format, inspect as inspect2 } from "util";
16165
16194
  var BUILTIN_MODULES = new Set(builtinModules);
16166
- function normalizeSlash(path22) {
16167
- return path22.replace(/\\/g, "/");
16195
+ function normalizeSlash(path23) {
16196
+ return path23.replace(/\\/g, "/");
16168
16197
  }
16169
16198
  var own$1 = {}.hasOwnProperty;
16170
16199
  var classRegExp = /^([A-Z][a-z\d]*)+$/;
@@ -16277,8 +16306,8 @@ codes2.ERR_INVALID_PACKAGE_CONFIG = createError(
16277
16306
  * @param {string} [base]
16278
16307
  * @param {string} [message]
16279
16308
  */
16280
- (path22, base, message) => {
16281
- return `Invalid package config ${path22}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
16309
+ (path23, base, message) => {
16310
+ return `Invalid package config ${path23}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
16282
16311
  },
16283
16312
  Error
16284
16313
  );
@@ -16310,8 +16339,8 @@ codes2.ERR_MODULE_NOT_FOUND = createError(
16310
16339
  * @param {string} base
16311
16340
  * @param {boolean} [exactUrl]
16312
16341
  */
16313
- (path22, base, exactUrl = false) => {
16314
- return `Cannot find ${exactUrl ? "module" : "package"} '${path22}' imported from ${base}`;
16342
+ (path23, base, exactUrl = false) => {
16343
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path23}' imported from ${base}`;
16315
16344
  },
16316
16345
  Error
16317
16346
  );
@@ -16362,8 +16391,8 @@ codes2.ERR_UNKNOWN_FILE_EXTENSION = createError(
16362
16391
  * @param {string} extension
16363
16392
  * @param {string} path
16364
16393
  */
16365
- (extension, path22) => {
16366
- return `Unknown file extension "${extension}" for ${path22}`;
16394
+ (extension, path23) => {
16395
+ return `Unknown file extension "${extension}" for ${path23}`;
16367
16396
  },
16368
16397
  TypeError
16369
16398
  );
@@ -16734,9 +16763,9 @@ Default "index" lookups for the main are deprecated for ES modules.`,
16734
16763
  );
16735
16764
  }
16736
16765
  }
16737
- function tryStatSync(path22) {
16766
+ function tryStatSync(path23) {
16738
16767
  try {
16739
- return statSync2(path22);
16768
+ return statSync2(path23);
16740
16769
  } catch {
16741
16770
  }
16742
16771
  }
@@ -17655,7 +17684,7 @@ function findUpSync(name, {
17655
17684
  directory = path8.dirname(directory);
17656
17685
  }
17657
17686
  }
17658
- function _resolve2(path22, options = {}) {
17687
+ function _resolve2(path23, options = {}) {
17659
17688
  if (options.platform === "auto" || !options.platform)
17660
17689
  options.platform = process4.platform === "win32" ? "win32" : "posix";
17661
17690
  if (process4.versions.pnp) {
@@ -17664,11 +17693,11 @@ function _resolve2(path22, options = {}) {
17664
17693
  paths.push(process4.cwd());
17665
17694
  const targetRequire = createRequire2(import.meta.url);
17666
17695
  try {
17667
- return targetRequire.resolve(path22, { paths });
17696
+ return targetRequire.resolve(path23, { paths });
17668
17697
  } catch {
17669
17698
  }
17670
17699
  }
17671
- const modulePath = resolvePathSync(path22, {
17700
+ const modulePath = resolvePathSync(path23, {
17672
17701
  url: options.paths
17673
17702
  });
17674
17703
  if (options.platform === "win32")
@@ -17739,10 +17768,10 @@ var findUp = quansync2({
17739
17768
  async: findUp$1
17740
17769
  });
17741
17770
  var loadPackageJSON = quansync2(function* (cwd = process4.cwd()) {
17742
- const path22 = yield findUp("package.json", { cwd });
17743
- if (!path22 || !fs5.existsSync(path22))
17771
+ const path23 = yield findUp("package.json", { cwd });
17772
+ if (!path23 || !fs5.existsSync(path23))
17744
17773
  return null;
17745
- return JSON.parse(yield readFile(path22));
17774
+ return JSON.parse(yield readFile(path23));
17746
17775
  });
17747
17776
  var loadPackageJSONSync = loadPackageJSON.sync;
17748
17777
  var isPackageListed = quansync2(function* (name, cwd) {
@@ -17795,9 +17824,9 @@ var INSTALL_METADATA = {
17795
17824
  };
17796
17825
 
17797
17826
  // ../../node_modules/.pnpm/package-manager-detector@1.4.0/node_modules/package-manager-detector/dist/detect.mjs
17798
- async function pathExists(path22, type) {
17827
+ async function pathExists(path23, type) {
17799
17828
  try {
17800
- const stat6 = await fs6.stat(path22);
17829
+ const stat6 = await fs6.stat(path23);
17801
17830
  return type === "file" ? stat6.isFile() : stat6.isDirectory();
17802
17831
  } catch {
17803
17832
  return false;
@@ -17914,7 +17943,7 @@ function isMetadataYarnClassic(metadataPath) {
17914
17943
  }
17915
17944
 
17916
17945
  // src/runtime/configPlugin.ts
17917
- import path18 from "pathe";
17946
+ import path19 from "pathe";
17918
17947
  import { loadConfigFromFile } from "vite";
17919
17948
  import tsconfigPaths from "vite-tsconfig-paths";
17920
17949
 
@@ -18207,8 +18236,8 @@ function matchesAutoImportGlobs(ctx, candidate) {
18207
18236
  // src/plugins/core.ts
18208
18237
  init_esm_shims();
18209
18238
  import { isEmptyObject as isEmptyObject2, isObject as isObject6, removeExtensionDeep as removeExtensionDeep4 } from "@weapp-core/shared";
18210
- import fs9 from "fs-extra";
18211
- import path15 from "pathe";
18239
+ import fs10 from "fs-extra";
18240
+ import path16 from "pathe";
18212
18241
  import { build as build2 } from "vite";
18213
18242
 
18214
18243
  // src/wxml/handle.ts
@@ -19652,7 +19681,7 @@ function createEntryLoader(options) {
19652
19681
  const jsonEntry = await findJsonEntry(id);
19653
19682
  let jsonPath = jsonEntry.path;
19654
19683
  for (const prediction of jsonEntry.predictions) {
19655
- this.addWatchFile(prediction);
19684
+ await addWatchTarget(this, prediction);
19656
19685
  }
19657
19686
  let json = {};
19658
19687
  if (jsonPath) {
@@ -19732,7 +19761,7 @@ async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJso
19732
19761
  path13.resolve(path13.dirname(id), location)
19733
19762
  );
19734
19763
  for (const prediction of predictions) {
19735
- pluginCtx.addWatchFile(prediction);
19764
+ await addWatchTarget(pluginCtx, prediction);
19736
19765
  }
19737
19766
  if (!jsonPath) {
19738
19767
  return;
@@ -19750,7 +19779,7 @@ async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJso
19750
19779
  async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry) {
19751
19780
  const { path: templateEntry, predictions } = await findTemplateEntry(id);
19752
19781
  for (const prediction of predictions) {
19753
- pluginCtx.addWatchFile(prediction);
19782
+ await addWatchTarget(pluginCtx, prediction);
19754
19783
  }
19755
19784
  if (!templateEntry) {
19756
19785
  return "";
@@ -19772,13 +19801,23 @@ async function resolveEntries(entries, absoluteSrcRoot) {
19772
19801
  async function prependStyleImports(id, ms) {
19773
19802
  for (const ext2 of supportedCssLangs) {
19774
19803
  const mayBeCssPath = changeFileExtension(id, ext2);
19775
- this.addWatchFile(mayBeCssPath);
19776
- if (await fs8.exists(mayBeCssPath)) {
19804
+ const exists = await addWatchTarget(this, mayBeCssPath);
19805
+ if (exists) {
19777
19806
  ms.prepend(`import '${mayBeCssPath}';
19778
19807
  `);
19779
19808
  }
19780
19809
  }
19781
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;
19820
+ }
19782
19821
 
19783
19822
  // src/plugins/hooks/useLoadEntry/normalizer.ts
19784
19823
  init_esm_shims();
@@ -19896,6 +19935,88 @@ function collectRequireTokens(ast) {
19896
19935
  };
19897
19936
  }
19898
19937
 
19938
+ // src/plugins/utils/invalidateEntry.ts
19939
+ init_esm_shims();
19940
+ import fs9 from "fs";
19941
+ import process6 from "process";
19942
+ import path15 from "pathe";
19943
+ var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
19944
+ var configSuffixes = configExtensions.map((ext2) => `.${ext2}`);
19945
+ var sidecarSuffixes = [...configSuffixes, ...watchedCssExts];
19946
+ var supportsRecursiveWatch = process6.platform === "darwin" || process6.platform === "win32";
19947
+ async function invalidateEntryForSidecar(filePath) {
19948
+ const configSuffix = configSuffixes.find((suffix) => filePath.endsWith(suffix));
19949
+ const ext2 = path15.extname(filePath);
19950
+ let scriptBasePath;
19951
+ if (configSuffix) {
19952
+ scriptBasePath = filePath.slice(0, -configSuffix.length);
19953
+ } else if (ext2 && watchedCssExts.has(ext2)) {
19954
+ scriptBasePath = filePath.slice(0, -ext2.length);
19955
+ }
19956
+ if (!scriptBasePath) {
19957
+ return;
19958
+ }
19959
+ const { path: scriptPath } = await findJsEntry(scriptBasePath);
19960
+ if (!scriptPath) {
19961
+ return;
19962
+ }
19963
+ await touch(scriptPath);
19964
+ }
19965
+ function ensureSidecarWatcher(ctx, rootDir) {
19966
+ if (!ctx.configService.isDev || !rootDir || process6.env.VITEST === "true" || process6.env.NODE_ENV === "test") {
19967
+ return;
19968
+ }
19969
+ const { sidecarWatcherMap } = ctx.runtimeState.watcher;
19970
+ const absRoot = path15.normalize(rootDir);
19971
+ if (!fs9.existsSync(absRoot)) {
19972
+ return;
19973
+ }
19974
+ if (sidecarWatcherMap.has(absRoot)) {
19975
+ return;
19976
+ }
19977
+ const handleSidecarChange = (filePath) => {
19978
+ if (!isSidecarFile(filePath)) {
19979
+ return;
19980
+ }
19981
+ void invalidateEntryForSidecar(filePath);
19982
+ };
19983
+ if (supportsRecursiveWatch) {
19984
+ const watcher2 = fs9.watch(absRoot, { recursive: true }, (_event, filename) => {
19985
+ if (!filename) {
19986
+ return;
19987
+ }
19988
+ const resolved = path15.join(absRoot, filename.toString());
19989
+ handleSidecarChange(resolved);
19990
+ });
19991
+ sidecarWatcherMap.set(absRoot, {
19992
+ close: async () => {
19993
+ watcher2.close();
19994
+ }
19995
+ });
19996
+ return;
19997
+ }
19998
+ const patterns = [
19999
+ ...configExtensions.map((ext2) => path15.join(absRoot, `**/*.${ext2}`)),
20000
+ ...supportedCssLangs.map((ext2) => path15.join(absRoot, `**/*.${ext2}`))
20001
+ ];
20002
+ const watcher = esm_default.watch(patterns, {
20003
+ ignoreInitial: true,
20004
+ persistent: true,
20005
+ awaitWriteFinish: {
20006
+ stabilityThreshold: 100,
20007
+ pollInterval: 20
20008
+ }
20009
+ });
20010
+ watcher.on("add", handleSidecarChange);
20011
+ watcher.on("unlink", handleSidecarChange);
20012
+ sidecarWatcherMap.set(absRoot, {
20013
+ close: () => watcher.close()
20014
+ });
20015
+ }
20016
+ function isSidecarFile(filePath) {
20017
+ return sidecarSuffixes.some((suffix) => filePath.endsWith(suffix));
20018
+ }
20019
+
19899
20020
  // src/plugins/utils/parse.ts
19900
20021
  init_esm_shims();
19901
20022
  function parseRequest(id) {
@@ -19958,10 +20079,17 @@ function createCoreLifecyclePlugin(state) {
19958
20079
  enforce: "pre",
19959
20080
  buildStart() {
19960
20081
  loadedEntrySet.clear();
20082
+ if (configService.isDev) {
20083
+ const rootDir = subPackageMeta ? path16.resolve(configService.absoluteSrcRoot, subPackageMeta.subPackage.root) : configService.absoluteSrcRoot;
20084
+ ensureSidecarWatcher(ctx, rootDir);
20085
+ }
19961
20086
  },
19962
- watchChange(id, change) {
20087
+ async watchChange(id, change) {
19963
20088
  const relativeSrc = configService.relativeAbsoluteSrcRoot(id);
19964
20089
  const relativeCwd = configService.relativeCwd(id);
20090
+ if (change.event === "create" || change.event === "delete") {
20091
+ await invalidateEntryForSidecar(id);
20092
+ }
19965
20093
  if (!subPackageMeta) {
19966
20094
  if (relativeSrc === "app.json" || relativeCwd === "project.config.json" || relativeCwd === "project.private.config.json") {
19967
20095
  scanService.markDirty();
@@ -19984,7 +20112,7 @@ function createCoreLifecyclePlugin(state) {
19984
20112
  let scannedInput;
19985
20113
  if (subPackageMeta) {
19986
20114
  scannedInput = subPackageMeta.entries.reduce((acc, entry) => {
19987
- acc[entry] = path15.resolve(configService.absoluteSrcRoot, entry);
20115
+ acc[entry] = path16.resolve(configService.absoluteSrcRoot, entry);
19988
20116
  return acc;
19989
20117
  }, {});
19990
20118
  } else {
@@ -20035,8 +20163,8 @@ function createCoreLifecyclePlugin(state) {
20035
20163
  if (parsed.query.wxss) {
20036
20164
  const realPath = getCssRealPath(parsed);
20037
20165
  this.addWatchFile(realPath);
20038
- if (await fs9.exists(realPath)) {
20039
- const css2 = await fs9.readFile(realPath, "utf8");
20166
+ if (await fs10.exists(realPath)) {
20167
+ const css2 = await fs10.readFile(realPath, "utf8");
20040
20168
  return { code: css2 };
20041
20169
  }
20042
20170
  }
@@ -20107,7 +20235,7 @@ function createRequireAnalysisPlugin(state) {
20107
20235
  return;
20108
20236
  }
20109
20237
  for (const requireModule of requireTokens) {
20110
- const absPath = path15.resolve(path15.dirname(moduleInfo.id), requireModule.value);
20238
+ const absPath = path16.resolve(path16.dirname(moduleInfo.id), requireModule.value);
20111
20239
  const resolved = await this.resolve(absPath, moduleInfo.id);
20112
20240
  if (!resolved) {
20113
20241
  continue;
@@ -20460,8 +20588,8 @@ function createEnvSynchronizer({ configService }) {
20460
20588
  init_esm_shims();
20461
20589
  import { createHash } from "crypto";
20462
20590
  import { removeExtension as removeExtension2 } from "@weapp-core/shared";
20463
- import fs10 from "fs-extra";
20464
- import path16 from "pathe";
20591
+ import fs11 from "fs-extra";
20592
+ import path17 from "pathe";
20465
20593
  function workers(ctx) {
20466
20594
  if (!ctx.scanService.workersDir) {
20467
20595
  return [];
@@ -20489,23 +20617,23 @@ function createWorkerBuildPlugin(ctx) {
20489
20617
  options.chunkFileNames = (chunkInfo) => {
20490
20618
  const workersDir = scanService.workersDir ?? "";
20491
20619
  if (chunkInfo.isDynamicEntry) {
20492
- return path16.join(workersDir, "[name].js");
20620
+ return path17.join(workersDir, "[name].js");
20493
20621
  }
20494
20622
  const sourceId = chunkInfo.facadeModuleId ?? chunkInfo.moduleIds[0];
20495
20623
  const hashBase = typeof sourceId === "string" ? configService.relativeCwd(sourceId) : chunkInfo.name;
20496
20624
  const stableHash = createHash("sha256").update(hashBase).digest("base64url").slice(0, 8);
20497
- return path16.join(workersDir, `${chunkInfo.name}-${stableHash}.js`);
20625
+ return path17.join(workersDir, `${chunkInfo.name}-${stableHash}.js`);
20498
20626
  };
20499
20627
  }
20500
20628
  };
20501
20629
  }
20502
20630
  async function resolveWorkerEntry(ctx, entry) {
20503
20631
  const { configService, scanService } = ctx;
20504
- const relativeEntryPath = path16.join(scanService.workersDir, entry);
20632
+ const relativeEntryPath = path17.join(scanService.workersDir, entry);
20505
20633
  const key = removeExtension2(relativeEntryPath);
20506
- const absoluteEntry = path16.resolve(configService.absoluteSrcRoot, relativeEntryPath);
20634
+ const absoluteEntry = path17.resolve(configService.absoluteSrcRoot, relativeEntryPath);
20507
20635
  if (isJsOrTs(entry)) {
20508
- const exists = await fs10.exists(absoluteEntry);
20636
+ const exists = await fs11.exists(absoluteEntry);
20509
20637
  if (!exists) {
20510
20638
  logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
20511
20639
  return { key };
@@ -20523,8 +20651,8 @@ async function resolveWorkerEntry(ctx, entry) {
20523
20651
  // src/plugins/wxs.ts
20524
20652
  init_esm_shims();
20525
20653
  import { removeExtension as removeExtension3 } from "@weapp-core/shared";
20526
- import fs11 from "fs-extra";
20527
- import path17 from "pathe";
20654
+ import fs12 from "fs-extra";
20655
+ import path18 from "pathe";
20528
20656
  var wxsCodeCache = new LRUCache({
20529
20657
  max: 512
20530
20658
  });
@@ -20569,7 +20697,7 @@ async function handleWxsDeps(state, deps, absPath) {
20569
20697
  if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
20570
20698
  return;
20571
20699
  }
20572
- const wxsPath = path17.resolve(path17.dirname(absPath), dep.value);
20700
+ const wxsPath = path18.resolve(path18.dirname(absPath), dep.value);
20573
20701
  await transformWxsFile.call(this, state, wxsPath);
20574
20702
  })
20575
20703
  );
@@ -20578,7 +20706,7 @@ async function transformWxsFile(state, wxsPath) {
20578
20706
  const { ctx } = state;
20579
20707
  const { configService } = ctx;
20580
20708
  this.addWatchFile(wxsPath);
20581
- if (!await fs11.exists(wxsPath)) {
20709
+ if (!await fs12.exists(wxsPath)) {
20582
20710
  return;
20583
20711
  }
20584
20712
  const suffixMatch = wxsPath.match(/\.wxs(\.[jt]s)?$/);
@@ -20586,7 +20714,7 @@ async function transformWxsFile(state, wxsPath) {
20586
20714
  if (suffixMatch) {
20587
20715
  isRaw = !suffixMatch[1];
20588
20716
  }
20589
- const rawCode = await fs11.readFile(wxsPath, "utf8");
20717
+ const rawCode = await fs12.readFile(wxsPath, "utf8");
20590
20718
  let code = wxsCodeCache.get(rawCode);
20591
20719
  if (code === void 0) {
20592
20720
  const { result, importees } = transformWxsCode(rawCode, {
@@ -20595,13 +20723,13 @@ async function transformWxsFile(state, wxsPath) {
20595
20723
  if (typeof result?.code === "string") {
20596
20724
  code = result.code;
20597
20725
  }
20598
- const dirname5 = path17.dirname(wxsPath);
20726
+ const dirname5 = path18.dirname(wxsPath);
20599
20727
  await Promise.all(
20600
20728
  importees.map(({ source }) => {
20601
20729
  return transformWxsFile.call(
20602
20730
  this,
20603
20731
  state,
20604
- path17.resolve(dirname5, source)
20732
+ path18.resolve(dirname5, source)
20605
20733
  );
20606
20734
  })
20607
20735
  );
@@ -20669,7 +20797,7 @@ function createConfigService(ctx) {
20669
20797
  let packageManager = configState.packageManager;
20670
20798
  let options = configState.options;
20671
20799
  const oxcRuntimeInfo = getPackageInfoSync("@oxc-project/runtime");
20672
- const oxcRuntimeHelpersRoot = oxcRuntimeInfo ? path18.resolve(oxcRuntimeInfo.rootPath, "src/helpers/esm") : void 0;
20800
+ const oxcRuntimeHelpersRoot = oxcRuntimeInfo ? path19.resolve(oxcRuntimeInfo.rootPath, "src/helpers/esm") : void 0;
20673
20801
  const NULL_BYTE = "\0";
20674
20802
  const OXC_RUNTIME_HELPER_ALIAS = new RegExp(`^(?:${NULL_BYTE})?@oxc-project(?:/|\\+)runtime(?:@[^/]+)?/helpers/(.+)\\.js$`);
20675
20803
  const FALLBACK_HELPER_PREFIX = `${NULL_BYTE}weapp-vite:oxc-helper:`;
@@ -20751,7 +20879,7 @@ export default _objectSpread2;`
20751
20879
  }
20752
20880
  return null;
20753
20881
  }
20754
- return path18.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20882
+ return path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20755
20883
  },
20756
20884
  async load(id) {
20757
20885
  if (id.startsWith(FALLBACK_HELPER_PREFIX)) {
@@ -20765,10 +20893,10 @@ export default _objectSpread2;`
20765
20893
  const helperName = getOxcHelperName(id);
20766
20894
  if (helperName) {
20767
20895
  if (oxcRuntimeHelpersRoot) {
20768
- const helperPath = id.startsWith(NULL_BYTE) ? path18.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
20769
- if (await fs12.pathExists(helperPath)) {
20896
+ const helperPath = id.startsWith(NULL_BYTE) ? path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
20897
+ if (await fs13.pathExists(helperPath)) {
20770
20898
  console.warn("[weapp-vite] resolving oxc helper via Rolldown plugin:", helperName);
20771
- return fs12.readFile(helperPath, "utf8");
20899
+ return fs13.readFile(helperPath, "utf8");
20772
20900
  }
20773
20901
  }
20774
20902
  const fallback = fallbackHelpers[helperName];
@@ -20837,17 +20965,17 @@ export default _objectSpread2;`
20837
20965
  if (!mpDistRoot) {
20838
20966
  throw new Error("\u8BF7\u5728 `project.config.json` \u91CC\u8BBE\u7F6E `miniprogramRoot`, \u6BD4\u5982\u53EF\u4EE5\u8BBE\u7F6E\u4E3A `dist/` ");
20839
20967
  }
20840
- const packageJsonPath = path18.resolve(cwd, "package.json");
20968
+ const packageJsonPath = path19.resolve(cwd, "package.json");
20841
20969
  let packageJson = {};
20842
- if (await fs12.exists(packageJsonPath)) {
20843
- const localPackageJson = await fs12.readJson(packageJsonPath, {
20970
+ if (await fs13.exists(packageJsonPath)) {
20971
+ const localPackageJson = await fs13.readJson(packageJsonPath, {
20844
20972
  throws: false
20845
20973
  }) || {};
20846
20974
  packageJson = localPackageJson;
20847
20975
  }
20848
20976
  let resolvedConfigFile = configFile;
20849
- if (resolvedConfigFile && !path18.isAbsolute(resolvedConfigFile)) {
20850
- resolvedConfigFile = path18.resolve(cwd, resolvedConfigFile);
20977
+ if (resolvedConfigFile && !path19.isAbsolute(resolvedConfigFile)) {
20978
+ resolvedConfigFile = path19.resolve(cwd, resolvedConfigFile);
20851
20979
  }
20852
20980
  const loaded = await loadConfigFromFile({
20853
20981
  command: isDev ? "serve" : "build",
@@ -20857,7 +20985,7 @@ export default _objectSpread2;`
20857
20985
  const srcRoot = loadedConfig?.weapp?.srcRoot ?? "";
20858
20986
  function relativeSrcRoot(p) {
20859
20987
  if (srcRoot) {
20860
- return path18.relative(srcRoot, p);
20988
+ return path19.relative(srcRoot, p);
20861
20989
  }
20862
20990
  return p;
20863
20991
  }
@@ -20917,7 +21045,7 @@ export default _objectSpread2;`
20917
21045
  }
20918
21046
  const helperName = getOxcHelperName(source);
20919
21047
  if (helperName) {
20920
- return path18.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
21048
+ return path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20921
21049
  }
20922
21050
  return null;
20923
21051
  },
@@ -20929,9 +21057,9 @@ export default _objectSpread2;`
20929
21057
  if (!helperName) {
20930
21058
  return null;
20931
21059
  }
20932
- const helperPath = path18.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
21060
+ const helperPath = path19.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
20933
21061
  console.warn("[weapp-vite] resolving oxc helper via Vite plugin:", helperName);
20934
- return fs12.readFile(helperPath, "utf8");
21062
+ return fs13.readFile(helperPath, "utf8");
20935
21063
  }
20936
21064
  });
20937
21065
  }
@@ -20958,7 +21086,7 @@ export default _objectSpread2;`
20958
21086
  };
20959
21087
  }
20960
21088
  async function load(optionsInput) {
20961
- const defaultCwd = process6.cwd();
21089
+ const defaultCwd = process7.cwd();
20962
21090
  const input = defu3(optionsInput, {
20963
21091
  cwd: defaultCwd,
20964
21092
  isDev: false,
@@ -21054,9 +21182,9 @@ export default _objectSpread2;`
21054
21182
  watch: {
21055
21183
  exclude: [
21056
21184
  ...defaultExcluded,
21057
- options.mpDistRoot ? path18.join(options.cwd, options.mpDistRoot, "**") : path18.join(options.cwd, "dist", "**")
21185
+ options.mpDistRoot ? path19.join(options.cwd, options.mpDistRoot, "**") : path19.join(options.cwd, "dist", "**")
21058
21186
  ],
21059
- include: [path18.join(options.cwd, options.srcRoot, "**")]
21187
+ include: [path19.join(options.cwd, options.srcRoot, "**")]
21060
21188
  },
21061
21189
  minify: false,
21062
21190
  emptyOutDir: false,
@@ -21143,7 +21271,7 @@ export default _objectSpread2;`
21143
21271
  return options.mpDistRoot;
21144
21272
  },
21145
21273
  get outDir() {
21146
- return path18.resolve(options.cwd, options.mpDistRoot ?? "");
21274
+ return path19.resolve(options.cwd, options.mpDistRoot ?? "");
21147
21275
  },
21148
21276
  get currentSubPackageRoot() {
21149
21277
  return options.currentSubPackageRoot;
@@ -21168,11 +21296,11 @@ export default _objectSpread2;`
21168
21296
  },
21169
21297
  get absolutePluginRoot() {
21170
21298
  if (options.config.weapp?.pluginRoot) {
21171
- return path18.resolve(options.cwd, options.config.weapp.pluginRoot);
21299
+ return path19.resolve(options.cwd, options.config.weapp.pluginRoot);
21172
21300
  }
21173
21301
  },
21174
21302
  get absoluteSrcRoot() {
21175
- return path18.resolve(options.cwd, options.srcRoot);
21303
+ return path19.resolve(options.cwd, options.srcRoot);
21176
21304
  },
21177
21305
  get mode() {
21178
21306
  return options.mode;
@@ -21184,13 +21312,13 @@ export default _objectSpread2;`
21184
21312
  return options.platform;
21185
21313
  },
21186
21314
  relativeCwd(p) {
21187
- return path18.relative(options.cwd, p);
21315
+ return path19.relative(options.cwd, p);
21188
21316
  },
21189
21317
  relativeSrcRoot(p) {
21190
21318
  return options.relativeSrcRoot(p);
21191
21319
  },
21192
21320
  relativeAbsoluteSrcRoot(p) {
21193
- return path18.relative(path18.resolve(options.cwd, options.srcRoot), p);
21321
+ return path19.relative(path19.resolve(options.cwd, options.srcRoot), p);
21194
21322
  }
21195
21323
  };
21196
21324
  }
@@ -21205,7 +21333,7 @@ function createConfigServicePlugin(ctx) {
21205
21333
  // src/runtime/jsonPlugin.ts
21206
21334
  init_esm_shims();
21207
21335
  import { parse as parseJson2 } from "comment-json";
21208
- import fs13 from "fs-extra";
21336
+ import fs14 from "fs-extra";
21209
21337
  import { bundleRequire } from "rolldown-require";
21210
21338
  function parseCommentJson(json) {
21211
21339
  return parseJson2(json, void 0, true);
@@ -21237,7 +21365,7 @@ function createJsonService(ctx) {
21237
21365
  });
21238
21366
  resultJson = typeof mod.default === "function" ? await mod.default(ctx) : mod.default;
21239
21367
  } else {
21240
- resultJson = parseCommentJson(await fs13.readFile(filepath, "utf8"));
21368
+ resultJson = parseCommentJson(await fs14.readFile(filepath, "utf8"));
21241
21369
  }
21242
21370
  cache2.set(filepath, resultJson);
21243
21371
  return resultJson;
@@ -21270,14 +21398,14 @@ function createJsonServicePlugin(ctx) {
21270
21398
  init_esm_shims();
21271
21399
  import { isBuiltin } from "module";
21272
21400
  import { defu as defu4, isObject as isObject8, objectHash as objectHash2 } from "@weapp-core/shared";
21273
- import fs14 from "fs-extra";
21274
- import path19 from "pathe";
21401
+ import fs15 from "fs-extra";
21402
+ import path20 from "pathe";
21275
21403
  function createNpmService(ctx) {
21276
21404
  function getDependenciesCacheFilePath(key = "/") {
21277
21405
  if (!ctx.configService) {
21278
21406
  throw new Error("configService must be initialized before generating npm cache path");
21279
21407
  }
21280
- return path19.resolve(ctx.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
21408
+ return path20.resolve(ctx.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
21281
21409
  }
21282
21410
  function dependenciesCacheHash() {
21283
21411
  if (!ctx.configService) {
@@ -21289,22 +21417,22 @@ function createNpmService(ctx) {
21289
21417
  return Reflect.has(pkg, "miniprogram") && typeof pkg.miniprogram === "string";
21290
21418
  }
21291
21419
  async function shouldSkipBuild(outDir, isOutdated) {
21292
- return !isOutdated && await fs14.exists(outDir);
21420
+ return !isOutdated && await fs15.exists(outDir);
21293
21421
  }
21294
21422
  async function writeDependenciesCache(root) {
21295
21423
  if (!ctx.configService) {
21296
21424
  throw new Error("configService must be initialized before writing npm cache");
21297
21425
  }
21298
21426
  if (ctx.configService.weappViteConfig?.npm?.cache) {
21299
- await fs14.outputJSON(getDependenciesCacheFilePath(root), {
21427
+ await fs15.outputJSON(getDependenciesCacheFilePath(root), {
21300
21428
  hash: dependenciesCacheHash()
21301
21429
  });
21302
21430
  }
21303
21431
  }
21304
21432
  async function readDependenciesCache(root) {
21305
21433
  const cachePath = getDependenciesCacheFilePath(root);
21306
- if (await fs14.exists(cachePath)) {
21307
- return await fs14.readJson(cachePath, { throws: false });
21434
+ if (await fs15.exists(cachePath)) {
21435
+ return await fs15.readJson(cachePath, { throws: false });
21308
21436
  }
21309
21437
  }
21310
21438
  async function checkDependenciesCacheOutdate(root) {
@@ -21357,7 +21485,7 @@ function createNpmService(ctx) {
21357
21485
  }
21358
21486
  }
21359
21487
  async function copyBuild({ from, to }) {
21360
- await fs14.copy(
21488
+ await fs15.copy(
21361
21489
  from,
21362
21490
  to
21363
21491
  );
@@ -21370,14 +21498,14 @@ function createNpmService(ctx) {
21370
21498
  const { packageJson: targetJson, rootPath } = packageInfo;
21371
21499
  const dependencies = targetJson.dependencies ?? {};
21372
21500
  const keys = Object.keys(dependencies);
21373
- const destOutDir = path19.resolve(outDir, dep);
21501
+ const destOutDir = path20.resolve(outDir, dep);
21374
21502
  if (await shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
21375
21503
  logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
21376
21504
  return;
21377
21505
  }
21378
21506
  if (isMiniprogramPackage(targetJson)) {
21379
21507
  await copyBuild({
21380
- from: path19.resolve(
21508
+ from: path20.resolve(
21381
21509
  rootPath,
21382
21510
  targetJson.miniprogram
21383
21511
  ),
@@ -21449,10 +21577,10 @@ function createNpmService(ctx) {
21449
21577
  debug?.("buildNpm start");
21450
21578
  const packNpmRelationList = getPackNpmRelationList();
21451
21579
  const [mainRelation, ...subRelations] = packNpmRelationList;
21452
- const packageJsonPath = path19.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
21453
- if (await fs14.exists(packageJsonPath)) {
21454
- const pkgJson = await fs14.readJson(packageJsonPath);
21455
- const outDir = path19.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
21580
+ const packageJsonPath = path20.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
21581
+ if (await fs15.exists(packageJsonPath)) {
21582
+ const pkgJson = await fs15.readJson(packageJsonPath);
21583
+ const outDir = path20.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
21456
21584
  if (pkgJson.dependencies) {
21457
21585
  const dependencies = Object.keys(pkgJson.dependencies);
21458
21586
  if (dependencies.length > 0) {
@@ -21471,7 +21599,7 @@ function createNpmService(ctx) {
21471
21599
  const targetDirs = [
21472
21600
  ...subRelations.map((x) => {
21473
21601
  return {
21474
- npmDistDir: path19.resolve(ctx.configService.cwd, x.miniprogramNpmDistDir, "miniprogram_npm")
21602
+ npmDistDir: path20.resolve(ctx.configService.cwd, x.miniprogramNpmDistDir, "miniprogram_npm")
21475
21603
  };
21476
21604
  }),
21477
21605
  ...[...ctx.scanService.independentSubPackageMap.values()].map((x) => {
@@ -21479,19 +21607,19 @@ function createNpmService(ctx) {
21479
21607
  return {
21480
21608
  root: x.subPackage.root,
21481
21609
  dependencies: dependencies2,
21482
- npmDistDir: path19.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, x.subPackage.root, "miniprogram_npm")
21610
+ npmDistDir: path20.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, x.subPackage.root, "miniprogram_npm")
21483
21611
  };
21484
21612
  })
21485
21613
  ];
21486
21614
  await Promise.all(targetDirs.map(async (x) => {
21487
21615
  if (x.root) {
21488
21616
  const isDependenciesCacheOutdate2 = await checkDependenciesCacheOutdate(x.root);
21489
- if (isDependenciesCacheOutdate2 || !await fs14.exists(x.npmDistDir)) {
21490
- await fs14.copy(outDir, x.npmDistDir, {
21617
+ if (isDependenciesCacheOutdate2 || !await fs15.exists(x.npmDistDir)) {
21618
+ await fs15.copy(outDir, x.npmDistDir, {
21491
21619
  overwrite: true,
21492
21620
  filter: (src) => {
21493
21621
  if (Array.isArray(x.dependencies)) {
21494
- const relPath = path19.relative(outDir, src);
21622
+ const relPath = path20.relative(outDir, src);
21495
21623
  if (relPath === "") {
21496
21624
  return true;
21497
21625
  }
@@ -21503,11 +21631,11 @@ function createNpmService(ctx) {
21503
21631
  }
21504
21632
  await writeDependenciesCache(x.root);
21505
21633
  } else {
21506
- await fs14.copy(outDir, x.npmDistDir, {
21634
+ await fs15.copy(outDir, x.npmDistDir, {
21507
21635
  overwrite: true,
21508
21636
  filter: (src) => {
21509
21637
  if (Array.isArray(x.dependencies)) {
21510
- const relPath = path19.relative(outDir, src);
21638
+ const relPath = path20.relative(outDir, src);
21511
21639
  if (relPath === "") {
21512
21640
  return true;
21513
21641
  }
@@ -21550,7 +21678,7 @@ function createNpmServicePlugin(ctx) {
21550
21678
 
21551
21679
  // src/runtime/runtimeState.ts
21552
21680
  init_esm_shims();
21553
- import process7 from "process";
21681
+ import process8 from "process";
21554
21682
 
21555
21683
  // ../../node_modules/.pnpm/p-queue@9.0.0/node_modules/p-queue/dist/index.js
21556
21684
  init_esm_shims();
@@ -22261,7 +22389,7 @@ init_esm_shims();
22261
22389
  // src/cache/file.ts
22262
22390
  init_esm_shims();
22263
22391
  import { createHash as createHash2 } from "crypto";
22264
- import fs15 from "fs-extra";
22392
+ import fs16 from "fs-extra";
22265
22393
  function createSignature(content) {
22266
22394
  return createHash2("sha1").update(content).digest("hex");
22267
22395
  }
@@ -22289,7 +22417,7 @@ var FileCache = class {
22289
22417
  async isInvalidate(id, options) {
22290
22418
  let mtimeMs;
22291
22419
  try {
22292
- const stat6 = await fs15.stat(id);
22420
+ const stat6 = await fs16.stat(id);
22293
22421
  mtimeMs = stat6.mtimeMs;
22294
22422
  } catch (error) {
22295
22423
  if (error && error.code === "ENOENT") {
@@ -22343,7 +22471,7 @@ function createDefaultLoadConfigResult() {
22343
22471
  outputExtensions: getOutputExtensions("weapp"),
22344
22472
  packageJson: {},
22345
22473
  relativeSrcRoot: (p) => p,
22346
- cwd: process7.cwd(),
22474
+ cwd: process8.cwd(),
22347
22475
  isDev: false,
22348
22476
  mode: "development",
22349
22477
  projectConfig: {},
@@ -22382,7 +22510,8 @@ function createRuntimeState() {
22382
22510
  cache: new FileCache()
22383
22511
  },
22384
22512
  watcher: {
22385
- rollupWatcherMap: /* @__PURE__ */ new Map()
22513
+ rollupWatcherMap: /* @__PURE__ */ new Map(),
22514
+ sidecarWatcherMap: /* @__PURE__ */ new Map()
22386
22515
  },
22387
22516
  wxml: {
22388
22517
  depsMap: /* @__PURE__ */ new Map(),
@@ -22408,7 +22537,7 @@ function createRuntimeState() {
22408
22537
  // src/runtime/scanPlugin.ts
22409
22538
  init_esm_shims();
22410
22539
  import { isObject as isObject9, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
22411
- import path20 from "pathe";
22540
+ import path21 from "pathe";
22412
22541
  function resolveSubPackageEntries(subPackage) {
22413
22542
  const entries = [];
22414
22543
  const root = subPackage.root ?? "";
@@ -22432,11 +22561,11 @@ function createScanService(ctx) {
22432
22561
  return scanState.appEntry;
22433
22562
  }
22434
22563
  const appDirname = ctx.configService.absoluteSrcRoot;
22435
- const appBasename = path20.resolve(appDirname, "app");
22564
+ const appBasename = path21.resolve(appDirname, "app");
22436
22565
  const { path: appConfigFile } = await findJsonEntry(appBasename);
22437
22566
  const { path: appEntryPath } = await findJsEntry(appBasename);
22438
22567
  if (ctx.configService.absolutePluginRoot) {
22439
- const pluginBasename = path20.resolve(ctx.configService.absolutePluginRoot, "plugin");
22568
+ const pluginBasename = path21.resolve(ctx.configService.absolutePluginRoot, "plugin");
22440
22569
  const { path: pluginConfigFile } = await findJsonEntry(pluginBasename);
22441
22570
  if (pluginConfigFile) {
22442
22571
  const pluginConfig = await ctx.jsonService.read(pluginConfigFile);
@@ -22455,14 +22584,14 @@ function createScanService(ctx) {
22455
22584
  scanState.appEntry = resolvedAppEntry;
22456
22585
  const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
22457
22586
  if (sitemapLocation) {
22458
- const { path: sitemapJsonPath } = await findJsonEntry(path20.resolve(appDirname, sitemapLocation));
22587
+ const { path: sitemapJsonPath } = await findJsonEntry(path21.resolve(appDirname, sitemapLocation));
22459
22588
  if (sitemapJsonPath) {
22460
22589
  resolvedAppEntry.sitemapJsonPath = sitemapJsonPath;
22461
22590
  resolvedAppEntry.sitemapJson = await ctx.jsonService.read(sitemapJsonPath);
22462
22591
  }
22463
22592
  }
22464
22593
  if (themeLocation) {
22465
- const { path: themeJsonPath } = await findJsonEntry(path20.resolve(appDirname, themeLocation));
22594
+ const { path: themeJsonPath } = await findJsonEntry(path21.resolve(appDirname, themeLocation));
22466
22595
  if (themeJsonPath) {
22467
22596
  resolvedAppEntry.themeJsonPath = themeJsonPath;
22468
22597
  resolvedAppEntry.themeJson = await ctx.jsonService.read(themeJsonPath);
@@ -22590,9 +22719,10 @@ function createScanServicePlugin(ctx) {
22590
22719
  // src/runtime/watcherPlugin.ts
22591
22720
  init_esm_shims();
22592
22721
  function createWatcherService(ctx) {
22593
- const { rollupWatcherMap } = ctx.runtimeState.watcher;
22722
+ const { rollupWatcherMap, sidecarWatcherMap } = ctx.runtimeState.watcher;
22594
22723
  return {
22595
22724
  rollupWatcherMap,
22725
+ sidecarWatcherMap,
22596
22726
  getRollupWatcher(root = "/") {
22597
22727
  return rollupWatcherMap.get(root);
22598
22728
  },
@@ -22606,6 +22736,11 @@ function createWatcherService(ctx) {
22606
22736
  watcher.close();
22607
22737
  });
22608
22738
  rollupWatcherMap.clear();
22739
+ sidecarWatcherMap.forEach((watcher) => {
22740
+ Promise.resolve(watcher.close()).catch(() => {
22741
+ });
22742
+ });
22743
+ sidecarWatcherMap.clear();
22609
22744
  },
22610
22745
  close(root = "/") {
22611
22746
  const watcher = rollupWatcherMap.get(root);
@@ -22613,6 +22748,12 @@ function createWatcherService(ctx) {
22613
22748
  watcher.close();
22614
22749
  rollupWatcherMap.delete(root);
22615
22750
  }
22751
+ const sidecarWatcher = sidecarWatcherMap.get(root);
22752
+ if (sidecarWatcher) {
22753
+ Promise.resolve(sidecarWatcher.close()).catch(() => {
22754
+ });
22755
+ sidecarWatcherMap.delete(root);
22756
+ }
22616
22757
  }
22617
22758
  };
22618
22759
  }
@@ -22634,8 +22775,8 @@ function createWatcherServicePlugin(ctx) {
22634
22775
  // src/runtime/wxmlPlugin.ts
22635
22776
  init_esm_shims();
22636
22777
  import { removeExtensionDeep as removeExtensionDeep6 } from "@weapp-core/shared";
22637
- import fs16 from "fs-extra";
22638
- import path21 from "pathe";
22778
+ import fs17 from "fs-extra";
22779
+ import path22 from "pathe";
22639
22780
 
22640
22781
  // src/wxml/index.ts
22641
22782
  init_esm_shims();
@@ -25332,9 +25473,9 @@ function createWxmlService(ctx) {
25332
25473
  if (!ctx.configService) {
25333
25474
  throw new Error("configService must be initialized before scanning wxml");
25334
25475
  }
25335
- if (await fs16.exists(filepath)) {
25336
- const dirname5 = path21.dirname(filepath);
25337
- const wxml = await fs16.readFile(filepath, "utf8");
25476
+ if (await fs17.exists(filepath)) {
25477
+ const dirname5 = path22.dirname(filepath);
25478
+ const wxml = await fs17.readFile(filepath, "utf8");
25338
25479
  const shouldRescan = await cache2.isInvalidate(filepath, { content: wxml });
25339
25480
  if (!shouldRescan) {
25340
25481
  const cached = cache2.get(filepath);
@@ -25350,9 +25491,9 @@ function createWxmlService(ctx) {
25350
25491
  filepath,
25351
25492
  res.deps.filter((x) => isImportTag(x.tagName) && isTemplate(x.value)).map((x) => {
25352
25493
  if (x.value.startsWith("/")) {
25353
- return path21.resolve(ctx.configService.absoluteSrcRoot, x.value.slice(1));
25494
+ return path22.resolve(ctx.configService.absoluteSrcRoot, x.value.slice(1));
25354
25495
  } else {
25355
- return path21.resolve(dirname5, x.value);
25496
+ return path22.resolve(dirname5, x.value);
25356
25497
  }
25357
25498
  })
25358
25499
  );