vite 8.2.1 → 8.2.4

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.
@@ -541,8 +541,10 @@ const importMetaResolveWithCustomHookString = `
541
541
 
542
542
  `;
543
543
  //#endregion
544
+ //#region package.json
545
+ var version = "8.2.4";
546
+ //#endregion
544
547
  //#region src/node/constants.ts
545
- const { version } = JSON.parse(readFileSync(new URL("../../package.json", new URL("../../../src/node/constants.ts", import.meta.url))).toString());
546
548
  const ROLLUP_HOOKS = [
547
549
  "options",
548
550
  "buildStart",
@@ -1950,15 +1952,16 @@ function loadPackageData(pkgPath) {
1950
1952
  const { sideEffects } = data;
1951
1953
  let hasSideEffects;
1952
1954
  if (typeof sideEffects === "boolean") hasSideEffects = () => sideEffects;
1953
- else if (Array.isArray(sideEffects)) if (sideEffects.length <= 0) hasSideEffects = () => false;
1954
- else {
1955
- const finalPackageSideEffects = sideEffects.map((sideEffect) => {
1956
- if (sideEffect.includes("/")) return sideEffect;
1957
- return `**/${sideEffect}`;
1958
- });
1959
- hasSideEffects = createFilter$1(finalPackageSideEffects, null, { resolve: pkgDir });
1960
- }
1961
- else hasSideEffects = () => null;
1955
+ else if (Array.isArray(sideEffects)) {
1956
+ if (sideEffects.length <= 0) hasSideEffects = () => false;
1957
+ else {
1958
+ const finalPackageSideEffects = sideEffects.map((sideEffect) => {
1959
+ if (sideEffect.includes("/")) return sideEffect;
1960
+ return `**/${sideEffect}`;
1961
+ });
1962
+ hasSideEffects = createFilter$1(finalPackageSideEffects, null, { resolve: pkgDir });
1963
+ }
1964
+ } else hasSideEffects = () => null;
1962
1965
  const resolvedCache = {};
1963
1966
  return {
1964
1967
  dir: pkgDir,
@@ -3248,18 +3251,19 @@ function createLogger(level = "info", options = {}) {
3248
3251
  if (thresh >= LogLevels[type]) {
3249
3252
  const method = type === "info" ? "log" : type;
3250
3253
  if (options.error) loggedErrors.add(options.error);
3251
- if (canClearScreen) if (type === lastType && msg === lastMsg) {
3252
- sameCount++;
3253
- clear();
3254
- console[method](format(type, msg, options), import_picocolors.default.yellow(`(x${sameCount + 1})`));
3255
- } else {
3256
- sameCount = 0;
3257
- lastMsg = msg;
3258
- lastType = type;
3259
- if (options.clear) clear();
3260
- console[method](format(type, msg, options));
3261
- }
3262
- else console[method](format(type, msg, options));
3254
+ if (canClearScreen) {
3255
+ if (type === lastType && msg === lastMsg) {
3256
+ sameCount++;
3257
+ clear();
3258
+ console[method](format(type, msg, options), import_picocolors.default.yellow(`(x${sameCount + 1})`));
3259
+ } else {
3260
+ sameCount = 0;
3261
+ lastMsg = msg;
3262
+ lastType = type;
3263
+ if (options.clear) clear();
3264
+ console[method](format(type, msg, options));
3265
+ }
3266
+ } else console[method](format(type, msg, options));
3263
3267
  }
3264
3268
  }
3265
3269
  const warnedMessages = /* @__PURE__ */ new Set();
@@ -3491,22 +3495,24 @@ function resolveEsbuildTranspileOptions(config, format) {
3491
3495
  minifyWhitespace: false,
3492
3496
  treeShaking: false
3493
3497
  };
3494
- if (options.minifyIdentifiers != null || options.minifySyntax != null || options.minifyWhitespace != null) if (isEsLibBuild) return {
3495
- ...options,
3496
- minify: false,
3497
- minifyIdentifiers: options.minifyIdentifiers ?? true,
3498
- minifySyntax: options.minifySyntax ?? true,
3499
- minifyWhitespace: false,
3500
- treeShaking: true
3501
- };
3502
- else return {
3503
- ...options,
3504
- minify: false,
3505
- minifyIdentifiers: options.minifyIdentifiers ?? true,
3506
- minifySyntax: options.minifySyntax ?? true,
3507
- minifyWhitespace: options.minifyWhitespace ?? true,
3508
- treeShaking: true
3509
- };
3498
+ if (options.minifyIdentifiers != null || options.minifySyntax != null || options.minifyWhitespace != null) {
3499
+ if (isEsLibBuild) return {
3500
+ ...options,
3501
+ minify: false,
3502
+ minifyIdentifiers: options.minifyIdentifiers ?? true,
3503
+ minifySyntax: options.minifySyntax ?? true,
3504
+ minifyWhitespace: false,
3505
+ treeShaking: true
3506
+ };
3507
+ else return {
3508
+ ...options,
3509
+ minify: false,
3510
+ minifyIdentifiers: options.minifyIdentifiers ?? true,
3511
+ minifySyntax: options.minifySyntax ?? true,
3512
+ minifyWhitespace: options.minifyWhitespace ?? true,
3513
+ treeShaking: true
3514
+ };
3515
+ }
3510
3516
  if (isEsLibBuild) return {
3511
3517
  ...options,
3512
3518
  minify: false,
@@ -4210,7 +4216,7 @@ function warnDeprecatedShouldBeConvertedToPluginOptions(logger, name) {
4210
4216
  logger.warn(import_picocolors.default.yellow(`\`esbuild.${name}\` option was specified. But this option is deprecated and will be removed in future versions. This option can be achieved by using a plugin with transform hook, please use that instead.`));
4211
4217
  }
4212
4218
  //#endregion
4213
- //#region ../../node_modules/.pnpm/magic-string@1.1.0/node_modules/magic-string/dist/index.mjs
4219
+ //#region ../../node_modules/.pnpm/magic-string@1.2.0/node_modules/magic-string/dist/index.mjs
4214
4220
  var BitSet = class BitSet {
4215
4221
  constructor(arg) {
4216
4222
  this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
@@ -4348,12 +4354,24 @@ var Chunk = class Chunk {
4348
4354
  }
4349
4355
  }
4350
4356
  };
4357
+ /**
4358
+ * The single error type thrown by MagicString.
4359
+ *
4360
+ * Every message is prefixed with `[MagicString]` so its source is obvious at a
4361
+ * glance, and is kept short and consistent in tone.
4362
+ */
4363
+ var MagicStringError = class extends Error {
4364
+ name = "MagicStringError";
4365
+ constructor(message, options) {
4366
+ super(`[MagicString] ${message}`, options);
4367
+ }
4368
+ };
4351
4369
  function getBtoa() {
4352
4370
  if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
4353
4371
  const buffer = globalThis["Buffer"];
4354
4372
  if (buffer) return (str) => buffer.from(str, "utf-8").toString("base64");
4355
4373
  return () => {
4356
- throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
4374
+ throw new MagicStringError("unsupported environment: `btoa` or `Buffer` is required");
4357
4375
  };
4358
4376
  }
4359
4377
  const btoa$1 = /* #__PURE__ */ getBtoa();
@@ -4570,11 +4588,11 @@ var MagicString = class MagicString {
4570
4588
  },
4571
4589
  byStart: {
4572
4590
  writable: true,
4573
- value: {}
4591
+ value: /* @__PURE__ */ new Map([[0, chunk]])
4574
4592
  },
4575
4593
  byEnd: {
4576
4594
  writable: true,
4577
- value: {}
4595
+ value: /* @__PURE__ */ new Map([[string.length, chunk]])
4578
4596
  },
4579
4597
  filename: {
4580
4598
  writable: true,
@@ -4605,8 +4623,6 @@ var MagicString = class MagicString {
4605
4623
  value: options.offset || 0
4606
4624
  }
4607
4625
  });
4608
- this.byStart = /* @__PURE__ */ new Map([[0, chunk]]);
4609
- this.byEnd = /* @__PURE__ */ new Map([[string.length, chunk]]);
4610
4626
  }
4611
4627
  /**
4612
4628
  * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
@@ -4618,7 +4634,7 @@ var MagicString = class MagicString {
4618
4634
  * Appends the specified content to the end of the string.
4619
4635
  */
4620
4636
  append(content) {
4621
- if (typeof content !== "string") throw new TypeError("outro content must be a string");
4637
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4622
4638
  this.outro += content;
4623
4639
  return this;
4624
4640
  }
@@ -4629,7 +4645,7 @@ var MagicString = class MagicString {
4629
4645
  */
4630
4646
  appendLeft(index, content) {
4631
4647
  index = index + this.offset;
4632
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
4648
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4633
4649
  this._split(index);
4634
4650
  const chunk = this.byEnd.get(index);
4635
4651
  if (chunk) chunk.appendLeft(content);
@@ -4643,7 +4659,7 @@ var MagicString = class MagicString {
4643
4659
  */
4644
4660
  appendRight(index, content) {
4645
4661
  index = index + this.offset;
4646
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
4662
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4647
4663
  this._split(index);
4648
4664
  const chunk = this.byStart.get(index);
4649
4665
  if (chunk) chunk.appendRight(content);
@@ -4805,7 +4821,7 @@ var MagicString = class MagicString {
4805
4821
  }
4806
4822
  /** @internal */
4807
4823
  insert() {
4808
- throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)");
4824
+ throw new MagicStringError("insert() is deprecated, use appendLeft() or prependRight()");
4809
4825
  }
4810
4826
  /** @internal */
4811
4827
  insertLeft(index, content) {
@@ -4831,7 +4847,7 @@ var MagicString = class MagicString {
4831
4847
  end = end + this.offset;
4832
4848
  index = index + this.offset;
4833
4849
  if (start === end) return this;
4834
- if (index >= start && index <= end) throw new Error("Cannot move a selection inside itself");
4850
+ if (index >= start && index <= end) throw new MagicStringError("cannot move a selection inside itself");
4835
4851
  this._split(start);
4836
4852
  this._split(end);
4837
4853
  this._split(index);
@@ -4884,13 +4900,15 @@ var MagicString = class MagicString {
4884
4900
  update(start, end, content, options) {
4885
4901
  start = start + this.offset;
4886
4902
  end = end + this.offset;
4887
- if (typeof content !== "string") throw new TypeError("replacement content must be a string");
4903
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4888
4904
  if (this.original.length !== 0) {
4889
4905
  while (start < 0) start += this.original.length;
4890
4906
  while (end < 0) end += this.original.length;
4891
4907
  }
4892
- if (end > this.original.length) throw new Error("end is out of bounds");
4893
- if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
4908
+ if (start < 0) throw new MagicStringError(`start ${start} is out of bounds`);
4909
+ if (end > this.original.length) throw new MagicStringError(`end ${end} is out of bounds`);
4910
+ if (start === end) throw new MagicStringError(`cannot overwrite a zero-length range at ${start}, use appendLeft() or prependRight()`);
4911
+ if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
4894
4912
  this._split(start);
4895
4913
  this._split(end);
4896
4914
  if (options === true) {
@@ -4916,7 +4934,7 @@ var MagicString = class MagicString {
4916
4934
  if (first) {
4917
4935
  let chunk = first;
4918
4936
  while (chunk !== last) {
4919
- if (chunk.next !== this.byStart.get(chunk.end)) throw new Error("Cannot overwrite across a split point");
4937
+ if (chunk.next !== this.byStart.get(chunk.end)) throw new MagicStringError("cannot overwrite across a split point");
4920
4938
  chunk = chunk.next;
4921
4939
  chunk.edit("", false);
4922
4940
  }
@@ -4932,7 +4950,7 @@ var MagicString = class MagicString {
4932
4950
  * Prepends the string with the specified content.
4933
4951
  */
4934
4952
  prepend(content) {
4935
- if (typeof content !== "string") throw new TypeError("outro content must be a string");
4953
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4936
4954
  this.intro = content + this.intro;
4937
4955
  return this;
4938
4956
  }
@@ -4941,7 +4959,7 @@ var MagicString = class MagicString {
4941
4959
  */
4942
4960
  prependLeft(index, content) {
4943
4961
  index = index + this.offset;
4944
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
4962
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4945
4963
  this._split(index);
4946
4964
  const chunk = this.byEnd.get(index);
4947
4965
  if (chunk) chunk.prependLeft(content);
@@ -4953,7 +4971,7 @@ var MagicString = class MagicString {
4953
4971
  */
4954
4972
  prependRight(index, content) {
4955
4973
  index = index + this.offset;
4956
- if (typeof content !== "string") throw new TypeError("inserted content must be a string");
4974
+ if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
4957
4975
  this._split(index);
4958
4976
  const chunk = this.byStart.get(index);
4959
4977
  if (chunk) chunk.prependRight(content);
@@ -4972,8 +4990,8 @@ var MagicString = class MagicString {
4972
4990
  while (end < 0) end += this.original.length;
4973
4991
  }
4974
4992
  if (start === end) return this;
4975
- if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
4976
- if (start > end) throw new Error("end must be greater than start");
4993
+ if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
4994
+ if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
4977
4995
  this._split(start);
4978
4996
  this._split(end);
4979
4997
  let chunk = this.byStart.get(start);
@@ -4996,8 +5014,8 @@ var MagicString = class MagicString {
4996
5014
  while (end < 0) end += this.original.length;
4997
5015
  }
4998
5016
  if (start === end) return this;
4999
- if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
5000
- if (start > end) throw new Error("end must be greater than start");
5017
+ if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
5018
+ if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
5001
5019
  this._split(start);
5002
5020
  this._split(end);
5003
5021
  let chunk = this.byStart.get(start);
@@ -5063,12 +5081,12 @@ var MagicString = class MagicString {
5063
5081
  if (chunk.start < end && chunk.end >= end) return result;
5064
5082
  chunk = chunk.next;
5065
5083
  }
5066
- if (chunk && chunk.edited && chunk.start !== start) throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
5084
+ if (chunk && chunk.edited && chunk.start !== start) throw new MagicStringError(`cannot use edited character ${start} as slice start anchor`);
5067
5085
  const startChunk = chunk;
5068
5086
  while (chunk) {
5069
5087
  if (chunk.intro && (startChunk !== chunk || chunk.start === start)) result += chunk.intro;
5070
5088
  const containsEnd = chunk.start < end && chunk.end >= end;
5071
- if (containsEnd && chunk.edited && chunk.end !== end) throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
5089
+ if (containsEnd && chunk.edited && chunk.end !== end) throw new MagicStringError(`cannot use edited character ${end} as slice end anchor`);
5072
5090
  const sliceStart = startChunk === chunk ? start - chunk.start : 0;
5073
5091
  const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
5074
5092
  result += chunk.content.slice(sliceStart, sliceEnd);
@@ -5104,7 +5122,7 @@ var MagicString = class MagicString {
5104
5122
  _splitChunk(chunk, index) {
5105
5123
  if (chunk.edited && chunk.content.length) {
5106
5124
  const loc = getLocator(this.original)(index);
5107
- throw new Error(`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`);
5125
+ throw new MagicStringError(`cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`);
5108
5126
  }
5109
5127
  const newChunk = chunk.split(index);
5110
5128
  this.byEnd.set(index, chunk);
@@ -5286,7 +5304,7 @@ var MagicString = class MagicString {
5286
5304
  */
5287
5305
  replaceAll(searchValue, replacement) {
5288
5306
  if (typeof searchValue === "string") return this._replaceAllString(searchValue, replacement);
5289
- if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
5307
+ if (!searchValue.global) throw new MagicStringError("replaceAll() requires a global RegExp");
5290
5308
  return this._replaceRegexp(searchValue, replacement);
5291
5309
  }
5292
5310
  };
@@ -5545,10 +5563,12 @@ codes.ERR_INVALID_ARG_TYPE = createError(
5545
5563
  message += `an instance of ${formatList(instances, "or")}`;
5546
5564
  if (other.length > 0) message += " or ";
5547
5565
  }
5548
- if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
5549
- else {
5550
- if (other[0].toLowerCase() !== other[0]) message += "an ";
5551
- message += `${other[0]}`;
5566
+ if (other.length > 0) {
5567
+ if (other.length > 1) message += `one of ${formatList(other, "or")}`;
5568
+ else {
5569
+ if (other[0].toLowerCase() !== other[0]) message += "an ";
5570
+ message += `${other[0]}`;
5571
+ }
5552
5572
  }
5553
5573
  message += `. Received ${determineSpecificType(actual)}`;
5554
5574
  return message;
@@ -5842,9 +5862,10 @@ var import_main = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
5842
5862
  defaultValue = r.join(splitter);
5843
5863
  value = env[key];
5844
5864
  }
5845
- if (value) if (seen.has(value)) result = result.replace(template, defaultValue);
5846
- else result = result.replace(template, value);
5847
- else result = result.replace(template, defaultValue);
5865
+ if (value) {
5866
+ if (seen.has(value)) result = result.replace(template, defaultValue);
5867
+ else result = result.replace(template, value);
5868
+ } else result = result.replace(template, defaultValue);
5848
5869
  if (result === runningParsed[key]) break;
5849
5870
  regex.lastIndex = 0;
5850
5871
  }
@@ -9267,10 +9288,10 @@ var require_binary_extensions = /* @__PURE__ */ __commonJSMin(((exports, module)
9267
9288
  //#endregion
9268
9289
  //#region ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
9269
9290
  var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9270
- const path$10 = __require("path");
9291
+ const path$11 = __require("path");
9271
9292
  const binaryExtensions = require_binary_extensions();
9272
9293
  const extensions = new Set(binaryExtensions);
9273
- module.exports = (filePath) => extensions.has(path$10.extname(filePath).slice(1).toLowerCase());
9294
+ module.exports = (filePath) => extensions.has(path$11.extname(filePath).slice(1).toLowerCase());
9274
9295
  }));
9275
9296
  //#endregion
9276
9297
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
@@ -10002,17 +10023,18 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
10002
10023
  const parent = sysPath$1.dirname(path);
10003
10024
  const item = sysPath$1.basename(path);
10004
10025
  const watchedDir = this.fsw._getWatchedDir(info.type === FSEVENT_TYPE_DIRECTORY ? path : parent);
10005
- if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) if (typeof opts.ignored === FUNCTION_TYPE) {
10006
- let stats;
10007
- try {
10008
- stats = await stat(path);
10009
- } catch (error) {}
10010
- if (this.fsw.closed) return;
10011
- if (this.checkIgnored(path, stats)) return;
10012
- if (sameTypes(info, stats)) this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
10013
- else this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
10014
- } else this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
10015
- else switch (info.event) {
10026
+ if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
10027
+ if (typeof opts.ignored === FUNCTION_TYPE) {
10028
+ let stats;
10029
+ try {
10030
+ stats = await stat(path);
10031
+ } catch (error) {}
10032
+ if (this.fsw.closed) return;
10033
+ if (this.checkIgnored(path, stats)) return;
10034
+ if (sameTypes(info, stats)) this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
10035
+ else this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
10036
+ } else this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
10037
+ } else switch (info.event) {
10016
10038
  case FSEVENT_CREATED:
10017
10039
  case FSEVENT_MODIFIED: return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
10018
10040
  case FSEVENT_DELETED:
@@ -10116,13 +10138,15 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
10116
10138
  this.fsw._emitReady();
10117
10139
  }
10118
10140
  }
10119
- if (opts.persistent && forceAdd !== true) if (typeof transform === FUNCTION_TYPE) this.initWatch(void 0, path, wh, processPath);
10120
- else {
10121
- let realPath;
10122
- try {
10123
- realPath = await realpath(wh.watchPath);
10124
- } catch (e) {}
10125
- this.initWatch(realPath, path, wh, processPath);
10141
+ if (opts.persistent && forceAdd !== true) {
10142
+ if (typeof transform === FUNCTION_TYPE) this.initWatch(void 0, path, wh, processPath);
10143
+ else {
10144
+ let realPath;
10145
+ try {
10146
+ realPath = await realpath(wh.watchPath);
10147
+ } catch (e) {}
10148
+ this.initWatch(realPath, path, wh, processPath);
10149
+ }
10126
10150
  }
10127
10151
  }
10128
10152
  };
@@ -10817,18 +10841,29 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
10817
10841
  exports.watch = watch;
10818
10842
  }));
10819
10843
  //#endregion
10820
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/quote.js
10844
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/quote.js
10821
10845
  var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10846
+ /** @import { ControlOperator } from './parse' */
10847
+ /** @type {ControlOperator['op'][]} */
10822
10848
  var OPS = [
10823
10849
  "||",
10824
10850
  "&&",
10851
+ ";;&",
10825
10852
  ";;",
10853
+ ";&",
10826
10854
  "|&",
10827
10855
  "<(",
10856
+ ">(",
10828
10857
  "<<<",
10858
+ "<<-",
10859
+ "<<",
10829
10860
  ">>",
10830
10861
  ">&",
10862
+ ">|",
10863
+ "&>>",
10864
+ "&>",
10831
10865
  "<&",
10866
+ "<>",
10832
10867
  "&",
10833
10868
  ";",
10834
10869
  "(",
@@ -10838,51 +10873,70 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10838
10873
  ">"
10839
10874
  ];
10840
10875
  var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
10841
- var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
10876
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
10877
+ /** @type {typeof import('./quote')} */
10842
10878
  module.exports = function quote(xs) {
10879
+ var sawComment = false;
10843
10880
  return xs.map(function(s) {
10881
+ if (sawComment && typeof s === "string" && LINE_TERMINATORS.test(s)) throw new TypeError("a token after a `comment` must not contain line terminators");
10844
10882
  if (s === "") return "''";
10845
10883
  if (s && typeof s === "object") {
10846
- if (s.op === "glob") {
10884
+ if ("op" in s && s.op === "glob") {
10847
10885
  if (typeof s.pattern !== "string") throw new TypeError("glob token requires a string `pattern`");
10848
10886
  if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError("glob `pattern` must not contain line terminators");
10887
+ if (s.pattern === "") return "''";
10849
10888
  return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
10850
10889
  }
10851
- if (typeof s.op === "string") {
10890
+ if ("op" in s && typeof s.op === "string") {
10852
10891
  if (OPS.indexOf(s.op) < 0) throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
10853
10892
  return s.op.replace(/[\s\S]/g, "\\$&");
10854
10893
  }
10855
- if (typeof s.comment === "string") {
10894
+ if ("comment" in s && typeof s.comment === "string") {
10856
10895
  if (LINE_TERMINATORS.test(s.comment)) throw new TypeError("`comment` must not contain line terminators");
10896
+ sawComment = true;
10857
10897
  return "#" + s.comment;
10858
10898
  }
10859
10899
  throw new TypeError("unrecognized object token shape");
10860
10900
  }
10861
- if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
10862
- if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
10863
- return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
10901
+ if (/'/.test(s) && /!/.test(s)) return "'" + s.replace(/'/g, "'\"'\"'") + "'";
10902
+ if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s + "'";
10903
+ if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`])/g, "\\$1") + "\"";
10904
+ return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, "$1\\$2");
10864
10905
  }).join(" ");
10865
10906
  };
10866
10907
  }));
10867
10908
  //#endregion
10868
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
10909
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/parse.js
10869
10910
  var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10911
+ /**
10912
+ * @import {
10913
+ * ControlOperator,
10914
+ * Env,
10915
+ * GlobPattern,
10916
+ * ParseEntry,
10917
+ * } from './parse' */
10870
10918
  var CONTROL = "(?:" + [
10871
10919
  "\\|\\|",
10872
- "\\&\\&",
10873
- ";;",
10874
- "\\|\\&",
10920
+ "\\&(?:\\&|>>?)",
10921
+ ";;\\&?",
10922
+ "[;|]\\&",
10875
10923
  "\\<\\(",
10876
10924
  "\\<\\<\\<",
10925
+ "\\<\\<-",
10926
+ "\\<\\<(?!\\()",
10877
10927
  ">>",
10878
- ">\\&",
10879
- "<\\&",
10928
+ ">[&|(]",
10929
+ "<[&>]",
10880
10930
  "[&;()|<>]"
10881
10931
  ].join("|") + ")";
10882
10932
  var controlRE = new RegExp("^" + CONTROL + "$");
10883
10933
  var META = "|&;()<> \\t";
10884
- var SINGLE_QUOTE = "\"((\\\\\"|[^\"])*?)\"";
10885
- var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
10934
+ var SINGLE_QUOTE = "'([^']*?)'";
10935
+ var ANSI_C_BODY = "(?:\\\\[\\s\\S]|[^\\\\'])*?";
10936
+ var ANSI_C_QUOTE = "\\$'" + ANSI_C_BODY + "'";
10937
+ var ansiCAt = new RegExp("\\$'" + ANSI_C_BODY + "(?:(')|\\\\?$)", "g");
10938
+ var ANSI_C_LETTERS = "abeEfnrtv";
10939
+ var ANSI_C_CHARS = "\x07\b\x1B\x1B\f\n\r \v";
10886
10940
  var hash = /^#$/;
10887
10941
  var SQ = "'";
10888
10942
  var DQ = "\"";
@@ -10891,17 +10945,26 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10891
10945
  var mult = 4294967296;
10892
10946
  for (var i = 0; i < 4; i++) TOKEN += (mult * Math.random()).toString(16);
10893
10947
  var startsWithToken = new RegExp("^" + TOKEN);
10948
+ /**
10949
+ * @param {string} s
10950
+ * @param {RegExp} r
10951
+ */
10894
10952
  function matchAll(s, r) {
10895
10953
  var origIndex = r.lastIndex;
10896
10954
  var matches = [];
10897
10955
  var matchObj;
10898
10956
  while (matchObj = r.exec(s)) {
10899
- matches.push(matchObj);
10957
+ matches[matches.length] = matchObj;
10900
10958
  if (r.lastIndex === matchObj.index) r.lastIndex += 1;
10901
10959
  }
10902
10960
  r.lastIndex = origIndex;
10903
10961
  return matches;
10904
10962
  }
10963
+ /**
10964
+ * @param {Env} env
10965
+ * @param {string} pre
10966
+ * @param {string} key
10967
+ */
10905
10968
  function getVar(env, pre, key) {
10906
10969
  var r = typeof env === "function" ? env(key) : env[key];
10907
10970
  if (typeof r === "undefined" && key != "") r = "";
@@ -10909,11 +10972,51 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10909
10972
  if (typeof r === "object") return pre + TOKEN + JSON.stringify(r) + TOKEN;
10910
10973
  return pre + r;
10911
10974
  }
10975
+ var ansiCEscape = /\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;
10976
+ /**
10977
+ * @param {string} m
10978
+ * @param {string} escape
10979
+ */
10980
+ function expandAnsiCEscape(m, escape) {
10981
+ var kind = escape.charAt(0);
10982
+ if (kind === "c") {
10983
+ var ctrl = escape.charAt(1);
10984
+ return ctrl === "?" ? "" : String.fromCharCode(ctrl.charCodeAt(0) & 31);
10985
+ }
10986
+ if (kind === "x" || kind === "u" || kind === "U") {
10987
+ var cp = parseInt(escape.slice(1), 16);
10988
+ if (cp > 1114111) return m;
10989
+ return String.fromCharCode.apply(null, cp > 65535 ? [55232 + (cp >> 10), 56320 + (cp & 1023)] : [cp]);
10990
+ }
10991
+ if (kind >= "0" && kind <= "7") return String.fromCharCode(parseInt(escape, 8) & 255);
10992
+ var letter = ANSI_C_LETTERS.indexOf(escape);
10993
+ return letter < 0 ? escape : ANSI_C_CHARS.charAt(letter);
10994
+ }
10995
+ /** @param {string} body */
10996
+ function expandAnsiC(body) {
10997
+ return body.replace(ansiCEscape, expandAnsiCEscape).split("\0")[0];
10998
+ }
10999
+ /**
11000
+ * @param {string} s
11001
+ * @param {number} i
11002
+ */
11003
+ function closesAnsiC(s, i) {
11004
+ ansiCAt.lastIndex = i;
11005
+ return !!ansiCAt.exec(s)[1];
11006
+ }
11007
+ /**
11008
+ * @param {string} string
11009
+ * @param {Env} [env]
11010
+ * @param {{ escape?: string, splitUnquoted?: boolean | string }} [opts]
11011
+ * @returns {ParseEntry[]}
11012
+ */
10912
11013
  function parseInternal(string, env, opts) {
10913
11014
  if (!opts) opts = {};
10914
11015
  var BS = opts.escape || "\\";
10915
- var BAREWORD = "(\\" + BS + "['\"" + META + "]|[^\\s'\"" + META + "])+";
10916
- var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g"));
11016
+ var ifs = opts.splitUnquoted === true ? " \n" : typeof opts.splitUnquoted === "string" ? opts.splitUnquoted : "";
11017
+ var BAREWORD = "(\\" + BS + "['\"$\\" + BS + META + "]|\\$\\$|\\$(?!" + ANSI_C_QUOTE.slice(2) + ")|[^\\s'\"$" + META + "])+";
11018
+ var DOUBLE_QUOTE = "\"(?:\\" + BS + "[\\s\\S]|[^\"\\" + BS + "])*\"";
11019
+ var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + ANSI_C_QUOTE + "|" + BAREWORD + "|" + DOUBLE_QUOTE + "|" + SINGLE_QUOTE + ")+"].join("|"), "g"));
10917
11020
  if (matches.length === 0) return [];
10918
11021
  if (!env) env = {};
10919
11022
  var commented = false;
@@ -10921,27 +11024,41 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10921
11024
  var s = match[0];
10922
11025
  if (!s || commented) return;
10923
11026
  if (controlRE.test(s)) return { op: s };
11027
+ /** @type {string | boolean} */
10924
11028
  var quote = false;
10925
11029
  var esc = false;
10926
11030
  var out = "";
11031
+ /** @type {string[]} */
11032
+ var words = [];
11033
+ var sawQuote = false;
11034
+ /** @type {number | null} */
11035
+ var pendingNw = null;
10927
11036
  var isGlob = false;
11037
+ /** @type {number} */
10928
11038
  var i;
10929
11039
  function parseEnvVar() {
10930
11040
  i += 1;
11041
+ /** @type {number | RegExpMatchArray | null} */
10931
11042
  var varend;
11043
+ /** @type {string} */
10932
11044
  var varname;
10933
11045
  var char = s.charAt(i);
10934
11046
  if (char === "{") {
10935
11047
  i += 1;
10936
11048
  if (s.charAt(i) === "}") throw new Error("Bad substitution: " + s.slice(i - 2, i + 1));
10937
- varend = s.indexOf("}", i);
10938
- if (varend < 0) throw new Error("Bad substitution: " + s.slice(i));
11049
+ var depth = 1;
11050
+ varend = i;
11051
+ while (depth > 0 && varend < s.length) {
11052
+ if (s.charAt(varend) === "{" && s.charAt(varend - 1) === "$") depth += 1;
11053
+ else if (s.charAt(varend) === "}") depth -= 1;
11054
+ varend += 1;
11055
+ }
11056
+ if (depth !== 0) throw new Error("Bad substitution: " + s.slice(i));
11057
+ varend -= 1;
10939
11058
  varname = s.slice(i, varend);
10940
11059
  i = varend;
10941
- } else if (/[*@#?$!_-]/.test(char)) {
10942
- varname = char;
10943
- i += 1;
10944
- } else {
11060
+ } else if (/[*@#?$!-]/.test(char)) varname = char;
11061
+ else {
10945
11062
  var slicedFromI = s.slice(i);
10946
11063
  varend = slicedFromI.match(/[^\w\d_]/);
10947
11064
  if (!varend) {
@@ -10954,63 +11071,116 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10954
11071
  }
10955
11072
  return getVar(env, "", varname);
10956
11073
  }
11074
+ function flushRun() {
11075
+ if (pendingNw === null) return;
11076
+ if (pendingNw === 0) {
11077
+ if (out !== "") {
11078
+ words[words.length] = out;
11079
+ out = "";
11080
+ }
11081
+ } else {
11082
+ words[words.length] = out;
11083
+ out = "";
11084
+ for (var fe = 1; fe < pendingNw; fe += 1) words[words.length] = "";
11085
+ }
11086
+ pendingNw = null;
11087
+ }
10957
11088
  for (i = 0; i < s.length; i++) {
10958
11089
  var c = s.charAt(i);
11090
+ if (ifs && c !== DS) flushRun();
10959
11091
  isGlob = isGlob || !quote && (c === "*" || c === "?");
10960
11092
  if (esc) {
10961
11093
  out += c;
10962
11094
  esc = false;
10963
- } else if (quote) if (c === quote) quote = false;
10964
- else if (quote == SQ) out += c;
10965
- else if (c === BS) {
10966
- i += 1;
10967
- c = s.charAt(i);
10968
- if (c === DQ || c === BS || c === DS) out += c;
10969
- else out += BS + c;
10970
- } else if (c === DS) out += parseEnvVar();
10971
- else out += c;
10972
- else if (c === DQ || c === SQ) quote = c;
10973
- else if (controlRE.test(c)) return { op: s };
11095
+ } else if (quote) {
11096
+ if (c === quote) quote = false;
11097
+ else if (quote == SQ) out += c;
11098
+ else if (c === BS) {
11099
+ i += 1;
11100
+ c = s.charAt(i);
11101
+ if (c === DQ || c === BS || c === DS) out += c;
11102
+ else out += BS + c;
11103
+ } else if (c === DS) out += parseEnvVar();
11104
+ else out += c;
11105
+ } else if (c === DQ || c === SQ) {
11106
+ quote = c;
11107
+ sawQuote = true;
11108
+ } else if (controlRE.test(c)) return { op: s };
10974
11109
  else if (hash.test(c)) {
10975
11110
  commented = true;
10976
11111
  var commentObj = { comment: string.slice(match.index + i + 1) };
10977
11112
  if (out.length) return [out, commentObj];
10978
11113
  return [commentObj];
10979
11114
  } else if (c === BS) esc = true;
10980
- else if (c === DS) out += parseEnvVar();
10981
- else out += c;
11115
+ else if (c === DS && s.charAt(i + 1) === SQ && closesAnsiC(s, i)) {
11116
+ flushRun();
11117
+ sawQuote = true;
11118
+ out += expandAnsiC(s.slice(i + 2, ansiCAt.lastIndex - 1));
11119
+ i = ansiCAt.lastIndex - 1;
11120
+ } else if (c === DS) {
11121
+ var value = parseEnvVar();
11122
+ if (!ifs) out += value;
11123
+ else for (var vi = 0; vi < value.length; vi += 1) {
11124
+ var vc = value.charAt(vi);
11125
+ if (ifs.indexOf(vc) < 0) {
11126
+ flushRun();
11127
+ out += vc;
11128
+ } else if (pendingNw === null) pendingNw = vc === " " || vc === " " || vc === "\n" ? 0 : 1;
11129
+ else if (vc !== " " && vc !== " " && vc !== "\n") pendingNw += 1;
11130
+ }
11131
+ } else out += c;
10982
11132
  }
10983
11133
  if (isGlob) return {
10984
11134
  op: "glob",
10985
11135
  pattern: out
10986
11136
  };
11137
+ if (ifs) {
11138
+ if (pendingNw !== null && pendingNw > 0) {
11139
+ words[words.length] = out;
11140
+ out = "";
11141
+ for (var te = 1; te < pendingNw; te += 1) words[words.length] = "";
11142
+ }
11143
+ if (out !== "" || sawQuote && words.length === 0) words[words.length] = out;
11144
+ return words;
11145
+ }
10987
11146
  return out;
10988
11147
  }).reduce(function(prev, arg) {
10989
- return typeof arg === "undefined" ? prev : prev.concat(arg);
11148
+ if (typeof arg === "undefined") return prev;
11149
+ /** @type {ParseEntry[]} */ [].concat(arg).forEach(function(entry) {
11150
+ prev[prev.length] = entry;
11151
+ });
11152
+ return prev;
10990
11153
  }, []);
10991
11154
  }
11155
+ /** @type {typeof import('./parse')} */
10992
11156
  module.exports = function parse(s, env, opts) {
10993
11157
  var mapped = parseInternal(s, env, opts);
10994
11158
  if (typeof env !== "function") return mapped;
10995
11159
  return mapped.reduce(function(acc, s) {
10996
- if (typeof s === "object") return acc.concat(s);
11160
+ if (typeof s === "object") {
11161
+ acc[acc.length] = s;
11162
+ return acc;
11163
+ }
10997
11164
  var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
10998
- if (xs.length === 1) return acc.concat(xs[0]);
10999
- return acc.concat(xs.filter(Boolean).map(function(x) {
11000
- if (startsWithToken.test(x)) return JSON.parse(x.split(TOKEN)[1]);
11001
- return x;
11002
- }));
11165
+ if (xs.length === 1) {
11166
+ acc[acc.length] = xs[0];
11167
+ return acc;
11168
+ }
11169
+ xs.filter(Boolean).forEach(function(x) {
11170
+ acc[acc.length] = startsWithToken.test(x) ? JSON.parse(x.split(TOKEN)[1]) : x;
11171
+ });
11172
+ return acc;
11003
11173
  }, []);
11004
11174
  };
11005
11175
  }));
11006
11176
  //#endregion
11007
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js
11177
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/index.js
11008
11178
  var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
11009
11179
  exports.quote = require_quote();
11010
11180
  exports.parse = require_parse$1();
11011
11181
  }));
11012
11182
  //#endregion
11013
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
11183
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/macos.js
11014
11184
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11015
11185
  module.exports = {
11016
11186
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -11045,7 +11215,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11045
11215
  };
11046
11216
  }));
11047
11217
  //#endregion
11048
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js
11218
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/linux.js
11049
11219
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11050
11220
  module.exports = {
11051
11221
  atom: "atom",
@@ -11079,7 +11249,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11079
11249
  };
11080
11250
  }));
11081
11251
  //#endregion
11082
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
11252
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/windows.js
11083
11253
  var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11084
11254
  module.exports = [
11085
11255
  "Brackets.exe",
@@ -11112,9 +11282,9 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11112
11282
  ];
11113
11283
  }));
11114
11284
  //#endregion
11115
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
11285
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/guess.js
11116
11286
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11117
- const path$9 = __require("path");
11287
+ const path$10 = __require("path");
11118
11288
  const shellQuote = require_shell_quote();
11119
11289
  const childProcess$2 = __require("child_process");
11120
11290
  const COMMON_EDITORS_MACOS = require_macos();
@@ -11138,7 +11308,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11138
11308
  const runningProcesses = output.split("\r\n");
11139
11309
  for (let i = 0; i < runningProcesses.length; i++) {
11140
11310
  const fullProcessPath = runningProcesses[i].trim();
11141
- const shortProcessName = path$9.win32.basename(fullProcessPath);
11311
+ const shortProcessName = path$10.win32.basename(fullProcessPath);
11142
11312
  if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
11143
11313
  }
11144
11314
  }
@@ -11187,11 +11357,15 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11187
11357
  module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
11188
11358
  }));
11189
11359
  //#endregion
11190
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
11360
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/get-args.js
11191
11361
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11192
- const path$8 = __require("path");
11193
- module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
11194
- switch (path$8.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
11362
+ const os$2 = __require("os");
11363
+ const path$9 = __require("path");
11364
+ module.exports = function getArgumentsForFile(editor, fileName, lineNumber, columnNumber = 1) {
11365
+ fileName = path$9.resolve(fileName);
11366
+ if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$2.release())) fileName = `./${path$9.relative("", fileName)}`;
11367
+ if (!lineNumber) return [fileName];
11368
+ switch (path$9.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
11195
11369
  case "atom":
11196
11370
  case "Atom":
11197
11371
  case "Atom Beta":
@@ -11266,7 +11440,42 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11266
11440
  };
11267
11441
  }));
11268
11442
  //#endregion
11269
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js
11443
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/construct-windows-launch-command.js
11444
+ var require_construct_windows_launch_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11445
+ function escapeCmdArgs(cmdArgs) {
11446
+ return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
11447
+ }
11448
+ function doubleQuoteIfNeeded(str) {
11449
+ if (str.includes("^")) return `^"${str}^"`;
11450
+ else if (str.includes(" ")) return `"${str}"`;
11451
+ return str;
11452
+ }
11453
+ function constructWindowsLaunchCommand(editor, args) {
11454
+ if (args.some((arg) => /[\r\n]/.test(arg))) throw new Error("Cannot launch an editor with an argument containing a line break");
11455
+ if (args.some((arg) => arg.includes("%"))) throw new Error("Cannot launch an editor with an argument containing \"%\"");
11456
+ return [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
11457
+ }
11458
+ module.exports = constructWindowsLaunchCommand;
11459
+ }));
11460
+ //#endregion
11461
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/parse-file.js
11462
+ var require_parse_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11463
+ const path$8 = __require("path");
11464
+ const positionRE = /:(\d+)(:(\d+))?$/;
11465
+ module.exports = function parseFile(file) {
11466
+ if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
11467
+ const unresolvedFileName = file.replace(positionRE, "");
11468
+ const fileName = unresolvedFileName ? path$8.resolve(unresolvedFileName) : "";
11469
+ const match = file.match(positionRE);
11470
+ return {
11471
+ fileName,
11472
+ lineNumber: match && match[1],
11473
+ columnNumber: match && match[3]
11474
+ };
11475
+ };
11476
+ }));
11477
+ //#endregion
11478
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/index.js
11270
11479
  var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11271
11480
  /**
11272
11481
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -11278,12 +11487,13 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11278
11487
  * Modified by Yuxi Evan You
11279
11488
  */
11280
11489
  const fs$6 = __require("fs");
11281
- const os$2 = __require("os");
11282
11490
  const path$7 = __require("path");
11283
11491
  const colors = require_picocolors();
11284
11492
  const childProcess$1 = __require("child_process");
11285
11493
  const guessEditor = require_guess();
11286
- const getArgumentsForPosition = require_get_args();
11494
+ const getArgumentsForFile = require_get_args();
11495
+ const constructWindowsLaunchCommand = require_construct_windows_launch_command();
11496
+ const parseFile = require_parse_file();
11287
11497
  function wrapErrorCallback(cb) {
11288
11498
  return (fileName, errorMessage) => {
11289
11499
  console.log();
@@ -11304,55 +11514,36 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11304
11514
  }
11305
11515
  return false;
11306
11516
  }
11307
- const positionRE = /:(\d+)(:(\d+))?$/;
11308
- function parseFile(file) {
11309
- if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
11310
- const fileName = file.replace(positionRE, "");
11311
- const match = file.match(positionRE);
11312
- return {
11313
- fileName,
11314
- lineNumber: match && match[1],
11315
- columnNumber: match && match[3]
11316
- };
11317
- }
11318
11517
  let currentChildProcess = null;
11319
11518
  function launchEditor(file, specifiedEditor, onErrorCallback) {
11320
- const parsed = parseFile(file);
11321
- let { fileName } = parsed;
11322
- const { lineNumber, columnNumber } = parsed;
11323
- if (process.platform === "win32" && path$7.resolve(fileName).startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
11324
- if (!fs$6.existsSync(fileName)) return;
11519
+ const { fileName, lineNumber, columnNumber } = parseFile(file);
11325
11520
  if (typeof specifiedEditor === "function") {
11326
11521
  onErrorCallback = specifiedEditor;
11327
11522
  specifiedEditor = void 0;
11328
11523
  }
11329
11524
  onErrorCallback = wrapErrorCallback(onErrorCallback);
11525
+ if (process.platform === "win32" && fileName.startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
11526
+ if (!fs$6.existsSync(fileName)) return;
11330
11527
  const [editor, ...args] = guessEditor(specifiedEditor);
11331
11528
  if (!editor) {
11332
11529
  onErrorCallback(fileName, null);
11333
11530
  return;
11334
11531
  }
11335
- if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$2.release())) fileName = path$7.relative("", fileName);
11336
- if (lineNumber) {
11337
- const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
11338
- args.push.apply(args, extraArgs);
11339
- } else args.push(fileName);
11532
+ const extraArgs = getArgumentsForFile(editor, fileName, lineNumber, columnNumber);
11533
+ args.push.apply(args, extraArgs);
11534
+ let launchCommand;
11535
+ if (process.platform === "win32") try {
11536
+ launchCommand = constructWindowsLaunchCommand(editor, args);
11537
+ } catch (error) {
11538
+ onErrorCallback(fileName, error.message);
11539
+ return;
11540
+ }
11340
11541
  if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill("SIGKILL");
11341
- if (process.platform === "win32") {
11342
- function escapeCmdArgs(cmdArgs) {
11343
- return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
11344
- }
11345
- function doubleQuoteIfNeeded(str) {
11346
- if (str.includes("^")) return `^"${str}^"`;
11347
- else if (str.includes(" ")) return `"${str}"`;
11348
- return str;
11349
- }
11350
- const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
11351
- currentChildProcess = childProcess$1.exec(launchCommand, {
11352
- stdio: "inherit",
11353
- shell: true
11354
- });
11355
- } else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
11542
+ if (process.platform === "win32") currentChildProcess = childProcess$1.exec(launchCommand, {
11543
+ stdio: "inherit",
11544
+ shell: true
11545
+ });
11546
+ else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
11356
11547
  currentChildProcess.on("exit", function(errorCode) {
11357
11548
  currentChildProcess = null;
11358
11549
  if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
@@ -11366,7 +11557,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11366
11557
  module.exports = launchEditor;
11367
11558
  }));
11368
11559
  //#endregion
11369
- //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
11560
+ //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.2/node_modules/launch-editor-middleware/index.js
11370
11561
  var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11371
11562
  const path$6 = __require("path");
11372
11563
  const launch = require_launch_editor();
@@ -11403,7 +11594,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
11403
11594
  };
11404
11595
  }));
11405
11596
  //#endregion
11406
- //#region ../../node_modules/.pnpm/@vercel+detect-agent@1.2.3/node_modules/@vercel/detect-agent/dist/index.js
11597
+ //#region ../../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js
11407
11598
  var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11408
11599
  var __defProp = Object.defineProperty;
11409
11600
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -11896,25 +12087,27 @@ function walk$2(node, state, visitors) {
11896
12087
  for (const key in node) {
11897
12088
  if (key === "type") continue;
11898
12089
  const child_node = node[key];
11899
- if (child_node && typeof child_node === "object") if (Array.isArray(child_node)) {
11900
- /** @type {Record<number, T>} */
11901
- const array_mutations = {};
11902
- const len = child_node.length;
11903
- let mutated = false;
11904
- for (let i = 0; i < len; i++) {
11905
- const node = child_node[i];
11906
- if (node && typeof node === "object") {
11907
- const result = visit(node, path, next_state);
11908
- if (result) {
11909
- array_mutations[i] = result;
11910
- mutated = true;
12090
+ if (child_node && typeof child_node === "object") {
12091
+ if (Array.isArray(child_node)) {
12092
+ /** @type {Record<number, T>} */
12093
+ const array_mutations = {};
12094
+ const len = child_node.length;
12095
+ let mutated = false;
12096
+ for (let i = 0; i < len; i++) {
12097
+ const node = child_node[i];
12098
+ if (node && typeof node === "object") {
12099
+ const result = visit(node, path, next_state);
12100
+ if (result) {
12101
+ array_mutations[i] = result;
12102
+ mutated = true;
12103
+ }
11911
12104
  }
11912
12105
  }
12106
+ if (mutated) mutations[key] = child_node.map((node, i) => array_mutations[i] ?? node);
12107
+ } else {
12108
+ const result = visit(child_node, path, next_state);
12109
+ if (result) mutations[key] = result;
11913
12110
  }
11914
- if (mutated) mutations[key] = child_node.map((node, i) => array_mutations[i] ?? node);
11915
- } else {
11916
- const result = visit(child_node, path, next_state);
11917
- if (result) mutations[key] = result;
11918
12111
  }
11919
12112
  }
11920
12113
  path.pop();
@@ -12104,12 +12297,13 @@ var Scope = class {
12104
12297
  * @param {import('estree').VariableDeclaration | import('estree').ClassDeclaration} node
12105
12298
  */
12106
12299
  add_declaration(node) {
12107
- if (node.type === "VariableDeclaration") if (node.kind === "var" && this.block && this.parent) this.parent.add_declaration(node);
12108
- else for (const declarator of node.declarations) for (const name of extract_names(declarator.id)) {
12109
- this.declarations.set(name, node);
12110
- if (declarator.init) this.initialised_declarations.add(name);
12111
- }
12112
- else if (node.id) this.declarations.set(node.id.name, node);
12300
+ if (node.type === "VariableDeclaration") {
12301
+ if (node.kind === "var" && this.block && this.parent) this.parent.add_declaration(node);
12302
+ else for (const declarator of node.declarations) for (const name of extract_names(declarator.id)) {
12303
+ this.declarations.set(name, node);
12304
+ if (declarator.init) this.initialised_declarations.add(name);
12305
+ }
12306
+ } else if (node.id) this.declarations.set(node.id.name, node);
12113
12307
  }
12114
12308
  /**
12115
12309
  * @param {string} name
@@ -12196,10 +12390,12 @@ var WalkerBase = class {
12196
12390
  * @param {Node} node
12197
12391
  */
12198
12392
  replace(parent, prop, index, node) {
12199
- if (parent && prop) if (index != null)
12393
+ if (parent && prop) {
12394
+ if (index != null)
12200
12395
  /** @type {Array<Node>} */ parent[prop][index] = node;
12201
- else
12396
+ else
12202
12397
  /** @type {Node} */ parent[prop] = node;
12398
+ }
12203
12399
  }
12204
12400
  /**
12205
12401
  * @template {Node} Parent
@@ -12208,9 +12404,11 @@ var WalkerBase = class {
12208
12404
  * @param {number | null | undefined} index
12209
12405
  */
12210
12406
  remove(parent, prop, index) {
12211
- if (parent && prop) if (index !== null && index !== void 0)
12407
+ if (parent && prop) {
12408
+ if (index !== null && index !== void 0)
12212
12409
  /** @type {Array<Node>} */ parent[prop].splice(index, 1);
12213
- else delete parent[prop];
12410
+ else delete parent[prop];
12411
+ }
12214
12412
  }
12215
12413
  };
12216
12414
  //#endregion
@@ -12438,45 +12636,50 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
12438
12636
  if (s.type === "ImportSpecifier") return getIdentifierNameOrLiteralValue$1(s.imported);
12439
12637
  else if (s.type === "ImportDefaultSpecifier") return "default";
12440
12638
  }).filter(isDefined) });
12441
- for (const spec of node.specifiers) if (spec.type === "ImportSpecifier") if (spec.imported.type === "Identifier") idToImportMap.set(spec.local.name, `${importId}.${spec.imported.name}`);
12442
- else idToImportMap.set(spec.local.name, `${importId}[${JSON.stringify(spec.imported.value)}]`);
12443
- else if (spec.type === "ImportDefaultSpecifier") idToImportMap.set(spec.local.name, `${importId}.default`);
12639
+ for (const spec of node.specifiers) if (spec.type === "ImportSpecifier") {
12640
+ if (spec.imported.type === "Identifier") idToImportMap.set(spec.local.name, `${importId}.${spec.imported.name}`);
12641
+ else idToImportMap.set(spec.local.name, `${importId}[${JSON.stringify(spec.imported.value)}]`);
12642
+ } else if (spec.type === "ImportDefaultSpecifier") idToImportMap.set(spec.local.name, `${importId}.default`);
12444
12643
  else idToImportMap.set(spec.local.name, importId);
12445
12644
  }
12446
12645
  for (const node of exports) {
12447
- if (node.type === "ExportNamedDeclaration") if (node.declaration) {
12448
- if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") defineExport(node.declaration.id.name);
12449
- else {
12450
- const declaration = node.declaration;
12451
- for (const decl of declaration.declarations) {
12452
- const names = extract_names(decl.id);
12453
- for (const name of names) defineExport(name);
12646
+ if (node.type === "ExportNamedDeclaration") {
12647
+ if (node.declaration) {
12648
+ if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") defineExport(node.declaration.id.name);
12649
+ else {
12650
+ const declaration = node.declaration;
12651
+ for (const decl of declaration.declarations) {
12652
+ const names = extract_names(decl.id);
12653
+ for (const name of names) defineExport(name);
12654
+ }
12655
+ }
12656
+ s.remove(node.start, node.declaration.start);
12657
+ } else if (node.source) {
12658
+ const importId = reExportImportIdMap.get(node);
12659
+ for (const spec of node.specifiers) {
12660
+ const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
12661
+ if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
12662
+ else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
12663
+ }
12664
+ } else {
12665
+ s.remove(node.start, node.end);
12666
+ for (const spec of node.specifiers) {
12667
+ const local = spec.local.name;
12668
+ const binding = idToImportMap.get(local);
12669
+ defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
12454
12670
  }
12455
- }
12456
- s.remove(node.start, node.declaration.start);
12457
- } else if (node.source) {
12458
- const importId = reExportImportIdMap.get(node);
12459
- for (const spec of node.specifiers) {
12460
- const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
12461
- if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
12462
- else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
12463
- }
12464
- } else {
12465
- s.remove(node.start, node.end);
12466
- for (const spec of node.specifiers) {
12467
- const local = spec.local.name;
12468
- const binding = idToImportMap.get(local);
12469
- defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
12470
12671
  }
12471
12672
  }
12472
- if (node.type === "ExportDefaultDeclaration") if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
12473
- const { name } = node.declaration.id;
12474
- s.remove(node.start, node.start + 15);
12475
- defineExport("default", name);
12476
- } else {
12477
- const name = `__vite_ssr_export_default__`;
12478
- s.update(node.start, node.start + 14, `const ${name} =`);
12479
- defineExport("default", name);
12673
+ if (node.type === "ExportDefaultDeclaration") {
12674
+ if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
12675
+ const { name } = node.declaration.id;
12676
+ s.remove(node.start, node.start + 15);
12677
+ defineExport("default", name);
12678
+ } else {
12679
+ const name = `__vite_ssr_export_default__`;
12680
+ s.update(node.start, node.start + 14, `const ${name} =`);
12681
+ defineExport("default", name);
12682
+ }
12480
12683
  }
12481
12684
  if (node.type === "ExportAllDeclaration") {
12482
12685
  const importId = reExportImportIdMap.get(node);
@@ -12502,15 +12705,16 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
12502
12705
  const topNode = parentStack[parentStack.length - 2];
12503
12706
  s.prependRight(topNode.start, `const ${id.name} = ${binding};\n`);
12504
12707
  }
12505
- } else if (parent.type === "CallExpression") if (id === parent.callee && !parent.optional) {
12506
- const argsStart = parent.arguments.length ? parent.arguments[0].start : parent.end;
12507
- s.update(id.start, argsStart, `(0,${binding})${code.slice(id.end, argsStart)}`);
12508
- } else {
12509
- s.update(id.start, id.end, binding);
12510
- s.prependRight(id.start, `(0,`);
12511
- s.appendLeft(id.end, `)`);
12512
- }
12513
- else if (!(parent.type === "ClassExpression" && id === parent.id)) s.update(id.start, id.end, binding);
12708
+ } else if (parent.type === "CallExpression") {
12709
+ if (id === parent.callee && !parent.optional) {
12710
+ const argsStart = parent.arguments.length ? parent.arguments[0].start : parent.end;
12711
+ s.update(id.start, argsStart, `(0,${binding})${code.slice(id.end, argsStart)}`);
12712
+ } else {
12713
+ s.update(id.start, id.end, binding);
12714
+ s.prependRight(id.start, `(0,`);
12715
+ s.appendLeft(id.end, `)`);
12716
+ }
12717
+ } else if (!(parent.type === "ClassExpression" && id === parent.id)) s.update(id.start, id.end, binding);
12514
12718
  },
12515
12719
  onImportMeta(node) {
12516
12720
  s.update(node.start, node.end, ssrImportMetaKey);
@@ -12593,19 +12797,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport, onStatements
12593
12797
  if (parentScope) setScope(parentScope, node.id.name);
12594
12798
  }
12595
12799
  if (node.type === "FunctionExpression" && node.id) setScope(node, node.id.name);
12596
- node.params.forEach((p) => {
12597
- if (p.type === "ObjectPattern" || p.type === "ArrayPattern") {
12598
- handlePattern(p, node);
12599
- return;
12600
- }
12601
- walk$1(p.type === "AssignmentPattern" ? p.left : p, { enter(child, parent) {
12602
- if (parent?.type === "AssignmentPattern" && parent.right === child) return this.skip();
12603
- if (child.type !== "Identifier") return;
12604
- if (isStaticPropertyKey(child, parent)) return;
12605
- if (parent?.type === "TemplateLiteral" && parent.expressions.includes(child) || parent?.type === "CallExpression" && parent.callee === child) return;
12606
- setScope(node, child.name);
12607
- } });
12608
- });
12800
+ node.params.forEach((p) => handlePattern(p, node));
12609
12801
  } else if (node.type === "ClassDeclaration") {
12610
12802
  const parentScope = findParentScope(parentStack);
12611
12803
  if (parentScope) setScope(parentScope, node.id.name);
@@ -13271,8 +13463,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13271
13463
  if (ii === pathExt.length) return resolve(step(i + 1));
13272
13464
  const ext = pathExt[ii];
13273
13465
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
13274
- if (!er && is) if (opt.all) found.push(p + ext);
13275
- else return resolve(p + ext);
13466
+ if (!er && is) {
13467
+ if (opt.all) found.push(p + ext);
13468
+ else return resolve(p + ext);
13469
+ }
13276
13470
  return resolve(subStep(p, i, ii + 1));
13277
13471
  });
13278
13472
  });
@@ -13290,8 +13484,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13290
13484
  for (let j = 0; j < pathExt.length; j++) {
13291
13485
  const cur = p + pathExt[j];
13292
13486
  try {
13293
- if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur);
13294
- else return cur;
13487
+ if (isexe.sync(cur, { pathExt: pathExtExe })) {
13488
+ if (opt.all) found.push(cur);
13489
+ else return cur;
13490
+ }
13295
13491
  } catch (ex) {}
13296
13492
  }
13297
13493
  }
@@ -13802,7 +13998,7 @@ function checkPublicFile(url, config) {
13802
13998
  return tryStatSync(publicFile)?.isFile() ? publicFile : void 0;
13803
13999
  }
13804
14000
  //#endregion
13805
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js
14001
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js
13806
14002
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13807
14003
  const BINARY_TYPES = [
13808
14004
  "nodebuffer",
@@ -13825,7 +14021,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13825
14021
  };
13826
14022
  }));
13827
14023
  //#endregion
13828
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js
14024
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js
13829
14025
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13830
14026
  const { EMPTY_BUFFER } = require_constants();
13831
14027
  const FastBuffer = Buffer[Symbol.species];
@@ -13925,7 +14121,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13925
14121
  } catch (e) {}
13926
14122
  }));
13927
14123
  //#endregion
13928
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/limiter.js
14124
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js
13929
14125
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13930
14126
  const kDone = Symbol("kDone");
13931
14127
  const kRun = Symbol("kRun");
@@ -13976,7 +14172,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13976
14172
  module.exports = Limiter;
13977
14173
  }));
13978
14174
  //#endregion
13979
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js
14175
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
13980
14176
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13981
14177
  const zlib$1 = __require("zlib");
13982
14178
  const bufferUtil = require_buffer_util();
@@ -14096,7 +14292,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14096
14292
  acceptAsServer(offers) {
14097
14293
  const opts = this._options;
14098
14294
  const accepted = offers.find((params) => {
14099
- if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) return false;
14295
+ if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) return false;
14100
14296
  return true;
14101
14297
  });
14102
14298
  if (!accepted) throw new Error("None of the extension offers can be accepted");
@@ -14312,7 +14508,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14312
14508
  }
14313
14509
  }));
14314
14510
  //#endregion
14315
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js
14511
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js
14316
14512
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14317
14513
  const { isUtf8 } = __require("buffer");
14318
14514
  const { hasBlob } = require_constants();
@@ -14508,7 +14704,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14508
14704
  } catch (e) {}
14509
14705
  }));
14510
14706
  //#endregion
14511
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js
14707
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js
14512
14708
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14513
14709
  const { Writable: Writable$1 } = __require("stream");
14514
14710
  const PerMessageDeflate = require_permessage_deflate();
@@ -14971,7 +15167,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14971
15167
  module.exports = Receiver;
14972
15168
  }));
14973
15169
  //#endregion
14974
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js
15170
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js
14975
15171
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14976
15172
  const { Duplex: Duplex$3 } = __require("stream");
14977
15173
  const { randomFillSync } = __require("crypto");
@@ -15057,12 +15253,13 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15057
15253
  offset = 6;
15058
15254
  }
15059
15255
  let dataLength;
15060
- if (typeof data === "string") if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
15061
- else {
15062
- data = Buffer.from(data);
15063
- dataLength = data.length;
15064
- }
15065
- else {
15256
+ if (typeof data === "string") {
15257
+ if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
15258
+ else {
15259
+ data = Buffer.from(data);
15260
+ dataLength = data.length;
15261
+ }
15262
+ } else {
15066
15263
  dataLength = data.length;
15067
15264
  merge = options.mask && options.readOnly && !skipMasking;
15068
15265
  }
@@ -15174,15 +15371,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15174
15371
  readOnly,
15175
15372
  rsv1: false
15176
15373
  };
15177
- if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
15178
- this.getBlobData,
15179
- data,
15180
- false,
15181
- options,
15182
- cb
15183
- ]);
15184
- else this.getBlobData(data, false, options, cb);
15185
- else if (this._state !== DEFAULT) this.enqueue([
15374
+ if (isBlob(data)) {
15375
+ if (this._state !== DEFAULT) this.enqueue([
15376
+ this.getBlobData,
15377
+ data,
15378
+ false,
15379
+ options,
15380
+ cb
15381
+ ]);
15382
+ else this.getBlobData(data, false, options, cb);
15383
+ } else if (this._state !== DEFAULT) this.enqueue([
15186
15384
  this.dispatch,
15187
15385
  data,
15188
15386
  false,
@@ -15224,15 +15422,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15224
15422
  readOnly,
15225
15423
  rsv1: false
15226
15424
  };
15227
- if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
15228
- this.getBlobData,
15229
- data,
15230
- false,
15231
- options,
15232
- cb
15233
- ]);
15234
- else this.getBlobData(data, false, options, cb);
15235
- else if (this._state !== DEFAULT) this.enqueue([
15425
+ if (isBlob(data)) {
15426
+ if (this._state !== DEFAULT) this.enqueue([
15427
+ this.getBlobData,
15428
+ data,
15429
+ false,
15430
+ options,
15431
+ cb
15432
+ ]);
15433
+ else this.getBlobData(data, false, options, cb);
15434
+ } else if (this._state !== DEFAULT) this.enqueue([
15236
15435
  this.dispatch,
15237
15436
  data,
15238
15437
  false,
@@ -15293,15 +15492,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15293
15492
  readOnly,
15294
15493
  rsv1
15295
15494
  };
15296
- if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
15297
- this.getBlobData,
15298
- data,
15299
- this._compress,
15300
- opts,
15301
- cb
15302
- ]);
15303
- else this.getBlobData(data, this._compress, opts, cb);
15304
- else if (this._state !== DEFAULT) this.enqueue([
15495
+ if (isBlob(data)) {
15496
+ if (this._state !== DEFAULT) this.enqueue([
15497
+ this.getBlobData,
15498
+ data,
15499
+ this._compress,
15500
+ opts,
15501
+ cb
15502
+ ]);
15503
+ else this.getBlobData(data, this._compress, opts, cb);
15504
+ } else if (this._state !== DEFAULT) this.enqueue([
15305
15505
  this.dispatch,
15306
15506
  data,
15307
15507
  this._compress,
@@ -15465,7 +15665,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15465
15665
  }
15466
15666
  }));
15467
15667
  //#endregion
15468
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/event-target.js
15668
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js
15469
15669
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15470
15670
  const { kForOnEventAttribute, kListener } = require_constants();
15471
15671
  const kCode = Symbol("kCode");
@@ -15696,7 +15896,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15696
15896
  }
15697
15897
  }));
15698
15898
  //#endregion
15699
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js
15899
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js
15700
15900
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15701
15901
  const { tokenChars } = require_validation();
15702
15902
  /**
@@ -15734,51 +15934,54 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15734
15934
  let i = 0;
15735
15935
  for (; i < header.length; i++) {
15736
15936
  code = header.charCodeAt(i);
15737
- if (extensionName === void 0) if (end === -1 && tokenChars[code] === 1) {
15738
- if (start === -1) start = i;
15739
- } else if (i !== 0 && (code === 32 || code === 9)) {
15740
- if (end === -1 && start !== -1) end = i;
15741
- } else if (code === 59 || code === 44) {
15742
- if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
15743
- if (end === -1) end = i;
15744
- const name = header.slice(start, end);
15745
- if (code === 44) {
15746
- push(offers, name, params);
15747
- params = Object.create(null);
15748
- } else extensionName = name;
15749
- start = end = -1;
15750
- } else throw new SyntaxError(`Unexpected character at index ${i}`);
15751
- else if (paramName === void 0) if (end === -1 && tokenChars[code] === 1) {
15752
- if (start === -1) start = i;
15753
- } else if (code === 32 || code === 9) {
15754
- if (end === -1 && start !== -1) end = i;
15755
- } else if (code === 59 || code === 44) {
15756
- if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
15757
- if (end === -1) end = i;
15758
- push(params, header.slice(start, end), true);
15759
- if (code === 44) {
15760
- push(offers, extensionName, params);
15761
- params = Object.create(null);
15762
- extensionName = void 0;
15763
- }
15764
- start = end = -1;
15765
- } else if (code === 61 && start !== -1 && end === -1) {
15766
- paramName = header.slice(start, i);
15767
- start = end = -1;
15768
- } else throw new SyntaxError(`Unexpected character at index ${i}`);
15769
- else if (isEscaping) {
15937
+ if (extensionName === void 0) {
15938
+ if (end === -1 && tokenChars[code] === 1) {
15939
+ if (start === -1) start = i;
15940
+ } else if (i !== 0 && (code === 32 || code === 9)) {
15941
+ if (end === -1 && start !== -1) end = i;
15942
+ } else if (code === 59 || code === 44) {
15943
+ if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
15944
+ if (end === -1) end = i;
15945
+ const name = header.slice(start, end);
15946
+ if (code === 44) {
15947
+ push(offers, name, params);
15948
+ params = Object.create(null);
15949
+ } else extensionName = name;
15950
+ start = end = -1;
15951
+ } else throw new SyntaxError(`Unexpected character at index ${i}`);
15952
+ } else if (paramName === void 0) {
15953
+ if (end === -1 && tokenChars[code] === 1) {
15954
+ if (start === -1) start = i;
15955
+ } else if (code === 32 || code === 9) {
15956
+ if (end === -1 && start !== -1) end = i;
15957
+ } else if (code === 59 || code === 44) {
15958
+ if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
15959
+ if (end === -1) end = i;
15960
+ push(params, header.slice(start, end), true);
15961
+ if (code === 44) {
15962
+ push(offers, extensionName, params);
15963
+ params = Object.create(null);
15964
+ extensionName = void 0;
15965
+ }
15966
+ start = end = -1;
15967
+ } else if (code === 61 && start !== -1 && end === -1) {
15968
+ paramName = header.slice(start, i);
15969
+ start = end = -1;
15970
+ } else throw new SyntaxError(`Unexpected character at index ${i}`);
15971
+ } else if (isEscaping) {
15770
15972
  if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
15771
15973
  if (start === -1) start = i;
15772
15974
  else if (!mustUnescape) mustUnescape = true;
15773
15975
  isEscaping = false;
15774
- } else if (inQuotes) if (tokenChars[code] === 1) {
15775
- if (start === -1) start = i;
15776
- } else if (code === 34 && start !== -1) {
15777
- inQuotes = false;
15778
- end = i;
15779
- } else if (code === 92) isEscaping = true;
15780
- else throw new SyntaxError(`Unexpected character at index ${i}`);
15781
- else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
15976
+ } else if (inQuotes) {
15977
+ if (tokenChars[code] === 1) {
15978
+ if (start === -1) start = i;
15979
+ } else if (code === 34 && start !== -1) {
15980
+ inQuotes = false;
15981
+ end = i;
15982
+ } else if (code === 92) isEscaping = true;
15983
+ else throw new SyntaxError(`Unexpected character at index ${i}`);
15984
+ } else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
15782
15985
  else if (end === -1 && tokenChars[code] === 1) {
15783
15986
  if (start === -1) start = i;
15784
15987
  } else if (start !== -1 && (code === 32 || code === 9)) {
@@ -15839,7 +16042,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15839
16042
  };
15840
16043
  }));
15841
16044
  //#endregion
15842
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js
16045
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js
15843
16046
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15844
16047
  const EventEmitter$2 = __require("events");
15845
16048
  const https$3 = __require("https");
@@ -15900,10 +16103,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15900
16103
  this._isServer = false;
15901
16104
  this._redirects = 0;
15902
16105
  if (protocols === void 0) protocols = [];
15903
- else if (!Array.isArray(protocols)) if (typeof protocols === "object" && protocols !== null) {
15904
- options = protocols;
15905
- protocols = [];
15906
- } else protocols = [protocols];
16106
+ else if (!Array.isArray(protocols)) {
16107
+ if (typeof protocols === "object" && protocols !== null) {
16108
+ options = protocols;
16109
+ protocols = [];
16110
+ } else protocols = [protocols];
16111
+ }
15907
16112
  initAsClient(this, address, protocols, options);
15908
16113
  } else {
15909
16114
  this._autoPong = options.autoPong;
@@ -16445,8 +16650,10 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16445
16650
  }
16446
16651
  opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
16447
16652
  }
16448
- if (opts.origin) if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
16449
- else opts.headers.Origin = opts.origin;
16653
+ if (opts.origin) {
16654
+ if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
16655
+ else opts.headers.Origin = opts.origin;
16656
+ }
16450
16657
  if (parsedUrl.username || parsedUrl.password) opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
16451
16658
  if (isIpcUrl) {
16452
16659
  const parts = opts.path.split(":");
@@ -16828,7 +17035,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16828
17035
  }
16829
17036
  }));
16830
17037
  //#endregion
16831
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/stream.js
17038
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js
16832
17039
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16833
17040
  require_websocket();
16834
17041
  const { Duplex: Duplex$1 } = __require("stream");
@@ -16944,7 +17151,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16944
17151
  module.exports = createWebSocketStream;
16945
17152
  }));
16946
17153
  //#endregion
16947
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js
17154
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js
16948
17155
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16949
17156
  const { tokenChars } = require_validation();
16950
17157
  /**
@@ -16983,7 +17190,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16983
17190
  module.exports = { parse };
16984
17191
  }));
16985
17192
  //#endregion
16986
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket-server.js
17193
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js
16987
17194
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16988
17195
  const EventEmitter$1 = __require("events");
16989
17196
  const http$4 = __require("http");
@@ -17132,9 +17339,10 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
17132
17339
  this._removeListeners();
17133
17340
  this._removeListeners = this._server = null;
17134
17341
  }
17135
- if (this.clients) if (!this.clients.size) process.nextTick(emitClose, this);
17136
- else this._shouldEmitClose = true;
17137
- else process.nextTick(emitClose, this);
17342
+ if (this.clients) {
17343
+ if (!this.clients.size) process.nextTick(emitClose, this);
17344
+ else this._shouldEmitClose = true;
17345
+ } else process.nextTick(emitClose, this);
17138
17346
  } else {
17139
17347
  const server = this._server;
17140
17348
  this._removeListeners();
@@ -18264,9 +18472,10 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
18264
18472
  let retSegs = "";
18265
18473
  for (const seg of args) {
18266
18474
  if (!seg) continue;
18267
- if (retSegs.endsWith("/")) if (seg.startsWith("/")) retSegs += seg.slice(1);
18268
- else retSegs += seg;
18269
- else if (seg.startsWith("/")) retSegs += seg;
18475
+ if (retSegs.endsWith("/")) {
18476
+ if (seg.startsWith("/")) retSegs += seg.slice(1);
18477
+ else retSegs += seg;
18478
+ } else if (seg.startsWith("/")) retSegs += seg;
18270
18479
  else retSegs += "/" + seg;
18271
18480
  }
18272
18481
  return queryParamRaw ? retSegs + "?" + queryParamRaw : retSegs;
@@ -19307,9 +19516,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
19307
19516
  return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/gm;
19308
19517
  } });
19309
19518
  var decodeBase64;
19310
- if (typeof Buffer !== "undefined") if (typeof Buffer.from === "function") decodeBase64 = decodeBase64WithBufferFrom;
19311
- else decodeBase64 = decodeBase64WithNewBuffer;
19312
- else decodeBase64 = decodeBase64WithAtob;
19519
+ if (typeof Buffer !== "undefined") {
19520
+ if (typeof Buffer.from === "function") decodeBase64 = decodeBase64WithBufferFrom;
19521
+ else decodeBase64 = decodeBase64WithNewBuffer;
19522
+ } else decodeBase64 = decodeBase64WithAtob;
19313
19523
  function decodeBase64WithBufferFrom(base64) {
19314
19524
  return Buffer.from(base64, "base64").toString();
19315
19525
  }
@@ -19348,9 +19558,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
19348
19558
  Converter.prototype.toJSON = function(space) {
19349
19559
  return JSON.stringify(this.sourcemap, null, space);
19350
19560
  };
19351
- if (typeof Buffer !== "undefined") if (typeof Buffer.from === "function") Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
19352
- else Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
19353
- else Converter.prototype.toBase64 = encodeBase64WithBtoa;
19561
+ if (typeof Buffer !== "undefined") {
19562
+ if (typeof Buffer.from === "function") Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
19563
+ else Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
19564
+ } else Converter.prototype.toBase64 = encodeBase64WithBtoa;
19354
19565
  function encodeBase64WithBufferFrom() {
19355
19566
  var json = this.toJSON();
19356
19567
  return Buffer.from(json, "utf8").toString("base64");
@@ -20443,13 +20654,20 @@ function isFileInTargetPath(targetPath, filePath) {
20443
20654
  return isSameFilePath(targetPath, filePath) || isParentDirectory(targetPath, filePath);
20444
20655
  }
20445
20656
  const windowsDriveRE = /^[A-Z]:/i;
20657
+ const windowsShortNameSegmentRE = /^[^~.]{1,6}~\d+(?:\.[^~.]{0,3})?$/;
20658
+ /**
20659
+ * Warning: parameters are not validated, only works with normalized absolute paths
20660
+ */
20661
+ function looksLikeWindowsShortNamePath(filePath) {
20662
+ return filePath.includes("~") && filePath.split("/").some((segment) => windowsShortNameSegmentRE.test(segment));
20663
+ }
20446
20664
  /**
20447
20665
  * Warning: parameters are not validated, only works with normalized absolute paths
20448
20666
  */
20449
20667
  function isFileLoadingAllowed(config, filePath) {
20450
20668
  const { fs } = config.server;
20451
20669
  if (!fs.strict) return true;
20452
- if (isWindows && filePath.includes("~")) return false;
20670
+ if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
20453
20671
  if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
20454
20672
  const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
20455
20673
  if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
@@ -21475,8 +21693,10 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
21475
21693
  const topLevelConfig = environment.getTopLevelConfig();
21476
21694
  if (!skipPublicCheck) {
21477
21695
  const publicFile = checkPublicFile(id, topLevelConfig);
21478
- if (publicFile) if (inlineRE$3.test(id)) id = publicFile;
21479
- else return publicFileToBuiltUrl(id, topLevelConfig);
21696
+ if (publicFile) {
21697
+ if (inlineRE$3.test(id)) id = publicFile;
21698
+ else return publicFileToBuiltUrl(id, topLevelConfig);
21699
+ }
21480
21700
  }
21481
21701
  const cache = assetCache.get(environment);
21482
21702
  const cached = cache.get(id);
@@ -21889,7 +22109,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21889
22109
  };
21890
22110
  }));
21891
22111
  //#endregion
21892
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
22112
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
21893
22113
  var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21894
22114
  const { createRequire: createRequire$1 } = __require("node:module");
21895
22115
  const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
@@ -21931,7 +22151,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21931
22151
  module.exports = req;
21932
22152
  }));
21933
22153
  //#endregion
21934
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
22154
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
21935
22155
  var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21936
22156
  const req = require_req();
21937
22157
  /**
@@ -21965,7 +22185,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21965
22185
  module.exports = options;
21966
22186
  }));
21967
22187
  //#endregion
21968
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
22188
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
21969
22189
  var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21970
22190
  const req = require_req();
21971
22191
  /**
@@ -22019,7 +22239,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22019
22239
  module.exports = plugins;
22020
22240
  }));
22021
22241
  //#endregion
22022
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
22242
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
22023
22243
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22024
22244
  const { resolve: resolve$3 } = __require("node:path");
22025
22245
  const config = require_src$1();
@@ -22535,8 +22755,10 @@ function cssPlugin(config) {
22535
22755
  const resolveUrl = (url, importer) => idResolver(environment, url, importer);
22536
22756
  const urlResolver = async (url, importer) => {
22537
22757
  const decodedUrl = decodeURI(url);
22538
- if (checkPublicFile(decodedUrl, config)) if (encodePublicUrlsInCSS(config)) return [publicFileToBuiltUrl(decodedUrl, config), void 0];
22539
- else return [joinUrlSegments(joinUrlSegments(config.server.origin ?? "", config.base), decodedUrl), void 0];
22758
+ if (checkPublicFile(decodedUrl, config)) {
22759
+ if (encodePublicUrlsInCSS(config)) return [publicFileToBuiltUrl(decodedUrl, config), void 0];
22760
+ else return [joinUrlSegments(joinUrlSegments(config.server.origin ?? "", config.base), decodedUrl), void 0];
22761
+ }
22540
22762
  const [id, fragment] = decodedUrl.split("#");
22541
22763
  let resolved = await resolveUrl(id, importer);
22542
22764
  if (resolved) {
@@ -22801,11 +23023,13 @@ function cssPostPlugin(config) {
22801
23023
  chunkCSSMap.set(chunk.fileName, chunkCSS);
22802
23024
  }
22803
23025
  }
22804
- if (s) if (config.build.sourcemap) return {
22805
- code: s.toString(),
22806
- map: s.generateMap({ hires: "boundary" })
22807
- };
22808
- else return { code: s.toString() };
23026
+ if (s) {
23027
+ if (config.build.sourcemap) return {
23028
+ code: s.toString(),
23029
+ map: s.generateMap({ hires: "boundary" })
23030
+ };
23031
+ else return { code: s.toString() };
23032
+ }
22809
23033
  return null;
22810
23034
  },
22811
23035
  augmentChunkHash(chunk) {
@@ -22911,16 +23135,17 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
22911
23135
  const m = (format === "iife" ? IIFE_BEGIN_RE : UMD_BEGIN_RE).exec(code);
22912
23136
  if (!m) ctx.error("Injection point for inlined CSS not found");
22913
23137
  injectionPoint = m.index + m[0].length;
22914
- } else if (format === "es") if (code.startsWith("#!")) {
22915
- const fileStartIndex = getFileStartIndex(code);
22916
- const hashbang = code.slice(0, fileStartIndex);
22917
- if (!lineTerminatorRE.test(hashbang)) {
22918
- s.append(`\n${injectCode}`);
22919
- return;
22920
- }
22921
- injectionPoint = fileStartIndex;
22922
- } else injectionPoint = 0;
22923
- else ctx.error("Non supported format");
23138
+ } else if (format === "es") {
23139
+ if (code.startsWith("#!")) {
23140
+ const fileStartIndex = getFileStartIndex(code);
23141
+ const hashbang = code.slice(0, fileStartIndex);
23142
+ if (!lineTerminatorRE.test(hashbang)) {
23143
+ s.append(`\n${injectCode}`);
23144
+ return;
23145
+ }
23146
+ injectionPoint = fileStartIndex;
23147
+ } else injectionPoint = 0;
23148
+ } else ctx.error("Non supported format");
22924
23149
  s.appendRight(injectionPoint, injectCode);
22925
23150
  }
22926
23151
  function cssAnalysisPlugin(config) {
@@ -23283,13 +23508,15 @@ async function resolvePostcssConfig(config) {
23283
23508
  const searchPath = typeof inlineOptions === "string" ? inlineOptions : config.root;
23284
23509
  const stopDir = searchForWorkspaceRoot(config.root);
23285
23510
  result = (0, import_src.default)({}, searchPath, { stopDir }).catch((e) => {
23286
- if (!e.message.includes("No PostCSS Config found")) if (e instanceof Error) {
23287
- const { name, message, stack } = e;
23288
- e.name = "Failed to load PostCSS config";
23289
- e.message = `Failed to load PostCSS config (searchPath: ${searchPath}): [${name}] ${message}\n${stack}`;
23290
- e.stack = "";
23291
- throw e;
23292
- } else throw new Error(`Failed to load PostCSS config: ${e}`);
23511
+ if (!e.message.includes("No PostCSS Config found")) {
23512
+ if (e instanceof Error) {
23513
+ const { name, message, stack } = e;
23514
+ e.name = "Failed to load PostCSS config";
23515
+ e.message = `Failed to load PostCSS config (searchPath: ${searchPath}): [${name}] ${message}\n${stack}`;
23516
+ e.stack = "";
23517
+ throw e;
23518
+ } else throw new Error(`Failed to load PostCSS config: ${e}`);
23519
+ }
23293
23520
  return null;
23294
23521
  });
23295
23522
  result.then((resolved) => {
@@ -24166,9 +24393,8 @@ const esRE = /es(6|\d{4})/;
24166
24393
  const versionRE = /\d/;
24167
24394
  const convertTargetsCache = /* @__PURE__ */ new Map();
24168
24395
  const convertTargets = (esbuildTarget) => {
24169
- if (!esbuildTarget) return {};
24170
- const cached = convertTargetsCache.get(esbuildTarget);
24171
- if (cached) return cached;
24396
+ if (!esbuildTarget) return void 0;
24397
+ if (convertTargetsCache.has(esbuildTarget)) return convertTargetsCache.get(esbuildTarget);
24172
24398
  const targets = {};
24173
24399
  const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => {
24174
24400
  const match = esRE.exec(e);
@@ -24194,8 +24420,9 @@ const convertTargets = (esbuildTarget) => {
24194
24420
  }
24195
24421
  throw new Error(`Unsupported target "${entry}"`);
24196
24422
  }
24197
- convertTargetsCache.set(esbuildTarget, targets);
24198
- return targets;
24423
+ const result = Object.keys(targets).length > 0 ? targets : void 0;
24424
+ convertTargetsCache.set(esbuildTarget, result);
24425
+ return result;
24199
24426
  };
24200
24427
  function resolveLibCssFilename(libOptions, root, packageCache) {
24201
24428
  if (typeof libOptions.cssFileName === "string") return `${libOptions.cssFileName}.css`;
@@ -24526,20 +24753,22 @@ function buildHtmlPlugin(config) {
24526
24753
  else if (attr.type === "src") {
24527
24754
  const url = decodeURIIfPossible(attr.value);
24528
24755
  if (url === void 0) {} else if (checkPublicFile(url, config)) overwriteAttrValue(s, attr.location, partialEncodeURIPath(toOutputPublicFilePath(url)));
24529
- else if (!isExcludedUrl(url)) if (node.nodeName === "link" && isCSSRequest(url) && !("media" in attr.attributes || "disabled" in attr.attributes)) {
24530
- const importExpression = `\nimport ${JSON.stringify(url)}`;
24531
- styleUrls.push({
24532
- url,
24533
- start: nodeStartWithLeadingWhitespace(node),
24534
- end: node.sourceCodeLocation.endOffset
24535
- });
24536
- js += importExpression;
24537
- } else {
24538
- const shouldInline = node.nodeName === "link" && attr.attributes.rel && parseRelAttr(attr.attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
24539
- assetUrlsPromises.push((async () => {
24540
- const processedUrl = await processAssetUrl(url, shouldInline);
24541
- if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
24542
- })());
24756
+ else if (!isExcludedUrl(url)) {
24757
+ if (node.nodeName === "link" && isCSSRequest(url) && !("media" in attr.attributes || "disabled" in attr.attributes)) {
24758
+ const importExpression = `\nimport ${JSON.stringify(url)}`;
24759
+ styleUrls.push({
24760
+ url,
24761
+ start: nodeStartWithLeadingWhitespace(node),
24762
+ end: node.sourceCodeLocation.endOffset
24763
+ });
24764
+ js += importExpression;
24765
+ } else {
24766
+ const shouldInline = node.nodeName === "link" && attr.attributes.rel && parseRelAttr(attr.attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
24767
+ assetUrlsPromises.push((async () => {
24768
+ const processedUrl = await processAssetUrl(url, shouldInline);
24769
+ if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
24770
+ })());
24771
+ }
24543
24772
  }
24544
24773
  }
24545
24774
  const inlineStyle = findNeedTransformStyleAttribute(node);
@@ -25049,8 +25278,9 @@ const urlRE = /[?&]url\b/;
25049
25278
  const rawRE = /[?&]raw\b/;
25050
25279
  const inlineRE$1 = /[?&]inline\b/;
25051
25280
  const svgRE = /\.svg\b/;
25281
+ const wasmInstanceRE$1 = /[?&]vite-wasm-instance(?:&|$)/;
25052
25282
  function isServerAccessDeniedForTransform(config, id) {
25053
- if (rawRE.test(id) || urlRE.test(id) || inlineRE$1.test(id) || svgRE.test(id)) return checkLoadingAccess(config, cleanUrl(id)) !== "allowed" || checkLoadingAccess(config, id) !== "allowed";
25283
+ if (rawRE.test(id) || urlRE.test(id) || inlineRE$1.test(id) || svgRE.test(id) || wasmInstanceRE$1.test(id)) return checkLoadingAccess(config, cleanUrl(id)) !== "allowed" || checkLoadingAccess(config, id) !== "allowed";
25054
25284
  return false;
25055
25285
  }
25056
25286
  /**
@@ -25220,7 +25450,7 @@ If you intend to import that asset, put the file in the src directory, and use $
25220
25450
  //#region src/node/plugins/define.ts
25221
25451
  const nonJsRe = /\.json(?:$|\?)/;
25222
25452
  const isNonJsRequest = (request) => nonJsRe.test(request);
25223
- const escapedDotRE = /(?<!\\)\\./g;
25453
+ const escapedDotRE = /(?<!\\)\\\./g;
25224
25454
  function definePlugin(config) {
25225
25455
  const isBuild = config.command === "build";
25226
25456
  const isBuildLib = isBuild && config.build.lib;
@@ -25465,8 +25695,9 @@ function createDevHtmlTransformFn(config) {
25465
25695
  };
25466
25696
  }
25467
25697
  function getHtmlFilename(url, server) {
25468
- if (url.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(url));
25469
- else return decodeURIComponent(normalizePath(path.join(server.config.root, url.slice(1))));
25698
+ const urlPath = cleanUrl(url);
25699
+ if (urlPath.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(urlPath));
25700
+ else return decodeURIComponent(normalizePath(path.join(server.config.root, urlPath.slice(1))));
25470
25701
  }
25471
25702
  function shouldPreTransform(url, config) {
25472
25703
  return !checkPublicFile(url, config) && (isJSRequest(url) || isCSSRequest(url));
@@ -25478,6 +25709,7 @@ function isBareRelative(url) {
25478
25709
  function getHtmlDirnameForRelativeUrl(htmlPath) {
25479
25710
  return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
25480
25711
  }
25712
+ const multipleLeadingSlashesRE = /^\/{2,}/g;
25481
25713
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
25482
25714
  const replacer = (url) => {
25483
25715
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
@@ -25503,6 +25735,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
25503
25735
  return useSrcSetReplacer ? processSrcSetSync(url, ({ url }) => replacer(url)) : replacer(url);
25504
25736
  };
25505
25737
  const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
25738
+ if (htmlPath.startsWith("//")) htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
25506
25739
  const { config, watcher } = server;
25507
25740
  const base = config.base || "/";
25508
25741
  const decodedBase = config.decodedBase || "/";
@@ -26267,7 +26500,13 @@ function triggerLazyBundlingMiddleware(server) {
26267
26500
  }
26268
26501
  const moduleId = params.get("id");
26269
26502
  const clientId = params.get("clientId");
26270
- const result = await bundledDev.triggerLazyBundling(moduleId, clientId);
26503
+ let result;
26504
+ try {
26505
+ result = await bundledDev.triggerLazyBundling(moduleId, clientId);
26506
+ } catch (e) {
26507
+ server.config.logger.error(`Failed to trigger lazy bundling for ${moduleId} (clientId: ${clientId}):` + e, { error: e });
26508
+ return next(/* @__PURE__ */ new Error(`Failed to trigger lazy bundling`));
26509
+ }
26271
26510
  if (result == null) return next();
26272
26511
  res.setHeader("Content-Type", "application/javascript");
26273
26512
  res.on("finish", () => bundledDev.markPayloadDelivered(result.filename));
@@ -27251,9 +27490,10 @@ function lexAcceptedHmrDeps(code, start, urls) {
27251
27490
  prevState = state;
27252
27491
  state = 3;
27253
27492
  } else if (whitespaceRE.test(char)) continue;
27254
- else if (state === 0) if (char === `[`) state = 4;
27255
- else return true;
27256
- else if (char === `]`) return false;
27493
+ else if (state === 0) {
27494
+ if (char === `[`) state = 4;
27495
+ else return true;
27496
+ } else if (char === `]`) return false;
27257
27497
  else if (char === ",") continue;
27258
27498
  else error(i);
27259
27499
  break;
@@ -27595,16 +27835,18 @@ function webWorkerPostPlugin(_config) {
27595
27835
  }
27596
27836
  let injectedImportMeta = false;
27597
27837
  let s;
27598
- for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2) if (code.slice(end, end + 4) === ".url") {
27599
- s ||= new MagicString(code);
27600
- s.overwrite(start, end + 4, "self.location.href");
27601
- } else {
27602
- s ||= new MagicString(code);
27603
- if (!injectedImportMeta) {
27604
- s.prepend("const _vite_importMeta = { url: self.location.href };\n");
27605
- injectedImportMeta = true;
27838
+ for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2) {
27839
+ if (code.slice(end, end + 4) === ".url") {
27840
+ s ||= new MagicString(code);
27841
+ s.overwrite(start, end + 4, "self.location.href");
27842
+ } else {
27843
+ s ||= new MagicString(code);
27844
+ if (!injectedImportMeta) {
27845
+ s.prepend("const _vite_importMeta = { url: self.location.href };\n");
27846
+ injectedImportMeta = true;
27847
+ }
27848
+ s.overwrite(start, end, "_vite_importMeta");
27606
27849
  }
27607
- s.overwrite(start, end, "_vite_importMeta");
27608
27850
  }
27609
27851
  if (!s) return;
27610
27852
  return {
@@ -27644,13 +27886,14 @@ function webWorkerPlugin(config) {
27644
27886
  name: options?.name
27645
27887
  }`;
27646
27888
  let urlCode;
27647
- if (isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
27648
- else if (inlineRE.test(id)) {
27649
- const result = await bundleWorkerEntry(config, id);
27650
- for (const file of result.watchedFiles) this.addWatchFile(file);
27651
- const jsContent = `const jsContent = ${JSON.stringify(result.entryCode)};`;
27652
- return {
27653
- code: workerConstructor === "Worker" ? `${jsContent}
27889
+ if (isBundled) {
27890
+ if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
27891
+ else if (inlineRE.test(id)) {
27892
+ const result = await bundleWorkerEntry(config, id);
27893
+ for (const file of result.watchedFiles) this.addWatchFile(file);
27894
+ const jsContent = `const jsContent = ${JSON.stringify(result.entryCode)};`;
27895
+ return {
27896
+ code: workerConstructor === "Worker" ? `${jsContent}
27654
27897
  const blob = typeof self !== "undefined" && self.Blob && new Blob([${workerType === "classic" ? `'(self.URL || self.webkitURL).revokeObjectURL(self.location.href);',` : `'URL.revokeObjectURL(import.meta.url);',`}jsContent], { type: "text/javascript;charset=utf-8" });
27655
27898
  export default function WorkerWrapper(options) {
27656
27899
  let objURL;
@@ -27676,19 +27919,19 @@ function webWorkerPlugin(config) {
27676
27919
  );
27677
27920
  }
27678
27921
  `,
27679
- map: { mappings: "" }
27680
- };
27922
+ map: { mappings: "" }
27923
+ };
27924
+ } else {
27925
+ const result = await workerFileToUrl(config, id);
27926
+ let url;
27927
+ if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
27928
+ emitWorkerAssetsForBundledDev(this, config);
27929
+ url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
27930
+ } else url = result.entryUrlPlaceholder;
27931
+ urlCode = JSON.stringify(url);
27932
+ for (const file of result.watchedFiles) this.addWatchFile(file);
27933
+ }
27681
27934
  } else {
27682
- const result = await workerFileToUrl(config, id);
27683
- let url;
27684
- if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
27685
- emitWorkerAssetsForBundledDev(this, config);
27686
- url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
27687
- } else url = result.entryUrlPlaceholder;
27688
- urlCode = JSON.stringify(url);
27689
- for (const file of result.watchedFiles) this.addWatchFile(file);
27690
- }
27691
- else {
27692
27935
  let url = await fileToUrl$1(this, cleanUrl(id));
27693
27936
  url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
27694
27937
  urlCode = JSON.stringify(url);
@@ -27717,10 +27960,12 @@ function webWorkerPlugin(config) {
27717
27960
  let injectEnv = "";
27718
27961
  if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
27719
27962
  else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
27720
- else if (workerType === "ignore") if (this.environment.config.isBundled) injectEnv = "";
27721
- else {
27722
- const environment = this.environment;
27723
- injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
27963
+ else if (workerType === "ignore") {
27964
+ if (this.environment.config.isBundled) injectEnv = "";
27965
+ else {
27966
+ const environment = this.environment;
27967
+ injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
27968
+ }
27724
27969
  }
27725
27970
  if (injectEnv) {
27726
27971
  const s = new MagicString(raw);
@@ -28050,13 +28295,15 @@ function importAnalysisPlugin(config) {
28050
28295
  if (prop === ".hot") {
28051
28296
  hasHMR = true;
28052
28297
  const endHot = end + 4 + (source[end + 4] === "?" ? 1 : 0);
28053
- if (source.slice(endHot, endHot + 7) === ".accept") if (source.slice(endHot, endHot + 14) === ".acceptExports") {
28054
- const importAcceptedExports = orderedAcceptedExports[index] = /* @__PURE__ */ new Set();
28055
- lexAcceptedHmrExports(source, source.indexOf("(", endHot + 14) + 1, importAcceptedExports);
28056
- isPartiallySelfAccepting = true;
28057
- } else {
28058
- const importAcceptedUrls = orderedAcceptedUrls[index] = /* @__PURE__ */ new Set();
28059
- if (lexAcceptedHmrDeps(source, source.indexOf("(", endHot + 7) + 1, importAcceptedUrls)) isSelfAccepting = true;
28298
+ if (source.slice(endHot, endHot + 7) === ".accept") {
28299
+ if (source.slice(endHot, endHot + 14) === ".acceptExports") {
28300
+ const importAcceptedExports = orderedAcceptedExports[index] = /* @__PURE__ */ new Set();
28301
+ lexAcceptedHmrExports(source, source.indexOf("(", endHot + 14) + 1, importAcceptedExports);
28302
+ isPartiallySelfAccepting = true;
28303
+ } else {
28304
+ const importAcceptedUrls = orderedAcceptedUrls[index] = /* @__PURE__ */ new Set();
28305
+ if (lexAcceptedHmrDeps(source, source.indexOf("(", endHot + 7) + 1, importAcceptedUrls)) isSelfAccepting = true;
28306
+ }
28060
28307
  }
28061
28308
  } else if (prop === ".env") hasEnv = true;
28062
28309
  return;
@@ -28074,8 +28321,8 @@ function importAnalysisPlugin(config) {
28074
28321
  if (specifier === clientPublicPath) return;
28075
28322
  if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE$1.test(specifier)) && checkPublicFile(specifier, config)) throw new Error(`Cannot import non-asset file ${specifier} which is inside /public. JS/CSS files inside /public are copied as-is on build and can only be referenced via <script src> or <link href> in html. If you want to get the URL of that file, use ${injectQuery(specifier, "url")} instead.`);
28076
28323
  let [url, resolvedId] = await normalizeUrl(specifier, start);
28324
+ if (resolvedId) config.safeModulePaths.add(cleanUrl(resolvedId));
28077
28325
  resolvedId = resolvedId || url;
28078
- config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
28079
28326
  if (url !== specifier) {
28080
28327
  let rewriteDone = false;
28081
28328
  if (!(depsOptimizer?.isOptimizedDepFile(importer) && specifier[0] === ".") && depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
@@ -28131,8 +28378,10 @@ function importAnalysisPlugin(config) {
28131
28378
  debugHmr?.(`${isSelfAccepting ? `[self-accepts]` : isPartiallySelfAccepting ? `[accepts-exports]` : acceptedUrls.size ? `[accepts-deps]` : `[detected api usage]`} ${prettifyUrl(importer, root)}`);
28132
28379
  str().prepend(`import { createHotContext as __vite__createHotContext } from "${clientPublicPath}";import.meta.hot = __vite__createHotContext(${JSON.stringify(normalizeHmrUrl(importerModule.url))});`);
28133
28380
  }
28134
- if (needQueryInjectHelper) if (isClassicWorker) str().append("\n" + __vite__injectQuery.toString());
28135
- else str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
28381
+ if (needQueryInjectHelper) {
28382
+ if (isClassicWorker) str().append("\n" + __vite__injectQuery.toString());
28383
+ else str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
28384
+ }
28136
28385
  const normalizedAcceptedUrls = /* @__PURE__ */ new Set();
28137
28386
  for (const { url, start, end } of acceptedUrls) {
28138
28387
  let [normalized, resolvedId] = await normalizeUrl(url, start).catch(() => []);
@@ -28262,9 +28511,10 @@ function transformCjsImport(importExp, url, rawUrl, importIndex, importer, isNod
28262
28511
  const lines = [];
28263
28512
  importNames.forEach(({ importedName, localName }) => {
28264
28513
  if (importedName === "*") lines.push(`const ${localName} = (${interopHelperStr})(${cjsModuleName}, ${+isNodeMode})`);
28265
- else if (importedName === "default") if (isNodeMode) lines.push(`const ${localName} = ${cjsModuleName}`);
28266
- else lines.push(`const ${localName} = !${cjsModuleName}.__esModule ? ${cjsModuleName} : ${cjsModuleName}.default`);
28267
- else lines.push(`const ${localName} = ${cjsModuleName}["${importedName}"]`);
28514
+ else if (importedName === "default") {
28515
+ if (isNodeMode) lines.push(`const ${localName} = ${cjsModuleName}`);
28516
+ else lines.push(`const ${localName} = !${cjsModuleName}.__esModule ? ${cjsModuleName} : ${cjsModuleName}.default`);
28517
+ } else lines.push(`const ${localName} = ${cjsModuleName}["${importedName}"]`);
28268
28518
  });
28269
28519
  if (defaultExports) lines.push(`export default ${defaultExports}`);
28270
28520
  if (exportNames.length) lines.push(`export { ${exportNames.join(", ")} }`);
@@ -29723,9 +29973,10 @@ async function toAbsoluteGlob(glob, root, importer, resolveId, base) {
29723
29973
  }
29724
29974
  root = globSafePath(root);
29725
29975
  let dir;
29726
- if (base) if (base[0] === "/") dir = posix.join(root, base);
29727
- else dir = posix.resolve(importer ? globSafePath(dirname$1(importer)) : root, base);
29728
- else dir = importer ? globSafePath(dirname$1(importer)) : root;
29976
+ if (base) {
29977
+ if (base[0] === "/") dir = posix.join(root, base);
29978
+ else dir = posix.resolve(importer ? globSafePath(dirname$1(importer)) : root, base);
29979
+ } else dir = importer ? globSafePath(dirname$1(importer)) : root;
29729
29980
  if (glob[0] === "/") return pre + posix.join(root, glob.slice(1));
29730
29981
  if (glob.startsWith("./")) return pre + posix.join(dir, glob.slice(2));
29731
29982
  if (glob.startsWith("../")) return pre + posix.join(dir, glob);
@@ -31712,34 +31963,36 @@ function expandGlobIds(id, config) {
31712
31963
  if (exports) {
31713
31964
  if (typeof exports === "string" || Array.isArray(exports)) return [pkgName];
31714
31965
  const possibleExportPaths = [];
31715
- for (const key in exports) if (key[0] === ".") if (key.includes("*")) {
31716
- const exportsValue = getFirstExportStringValue(exports[key]);
31717
- if (!exportsValue) continue;
31718
- const exportValuePattern = exportsValue.replace(/\*/g, "**/*");
31719
- const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex).join("(.*)"));
31720
- possibleExportPaths.push(...globSync(exportValuePattern, {
31721
- cwd: pkgData.dir,
31722
- expandDirectories: false,
31723
- ignore: ["node_modules"]
31724
- }).map((filePath) => {
31725
- if (exportsValue.startsWith("./")) filePath = "./" + filePath;
31726
- const matched = exportsValueGlobRe.exec(slash(filePath));
31727
- if (matched) {
31728
- let allGlobSame = matched.length === 2;
31729
- if (!allGlobSame) {
31730
- allGlobSame = true;
31731
- for (let i = 2; i < matched.length; i++) if (matched[i] !== matched[i - 1]) {
31732
- allGlobSame = false;
31733
- break;
31966
+ for (const key in exports) if (key[0] === ".") {
31967
+ if (key.includes("*")) {
31968
+ const exportsValue = getFirstExportStringValue(exports[key]);
31969
+ if (!exportsValue) continue;
31970
+ const exportValuePattern = exportsValue.replace(/\*/g, "**/*");
31971
+ const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex).join("(.*)"));
31972
+ possibleExportPaths.push(...globSync(exportValuePattern, {
31973
+ cwd: pkgData.dir,
31974
+ expandDirectories: false,
31975
+ ignore: ["node_modules"]
31976
+ }).map((filePath) => {
31977
+ if (exportsValue.startsWith("./")) filePath = "./" + filePath;
31978
+ const matched = exportsValueGlobRe.exec(slash(filePath));
31979
+ if (matched) {
31980
+ let allGlobSame = matched.length === 2;
31981
+ if (!allGlobSame) {
31982
+ allGlobSame = true;
31983
+ for (let i = 2; i < matched.length; i++) if (matched[i] !== matched[i - 1]) {
31984
+ allGlobSame = false;
31985
+ break;
31986
+ }
31734
31987
  }
31988
+ if (allGlobSame) return key.replace("*", matched[1]).slice(2);
31735
31989
  }
31736
- if (allGlobSame) return key.replace("*", matched[1]).slice(2);
31737
- }
31738
- return "";
31739
- }).filter(Boolean));
31740
- } else {
31741
- if (exports[key] == null) continue;
31742
- possibleExportPaths.push(key.slice(2));
31990
+ return "";
31991
+ }).filter(Boolean));
31992
+ } else {
31993
+ if (exports[key] == null) continue;
31994
+ possibleExportPaths.push(key.slice(2));
31995
+ }
31743
31996
  }
31744
31997
  const isMatch = pm(pattern);
31745
31998
  const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path.posix.join(pkgName, match));
@@ -32076,11 +32329,13 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
32076
32329
  const cachedMetadataPath = path.join(depsCacheDir, METADATA_FILENAME);
32077
32330
  cachedMetadata = parseDepsOptimizerMetadata(await fsp.readFile(cachedMetadataPath, "utf-8"), depsCacheDir);
32078
32331
  } catch {}
32079
- if (cachedMetadata) if (cachedMetadata.lockfileHash !== getLockfileHash(environment)) environment.logger.info("Re-optimizing dependencies because lockfile has changed", { timestamp: true });
32080
- else if (cachedMetadata.configHash !== getConfigHash(environment)) environment.logger.info("Re-optimizing dependencies because vite config has changed", { timestamp: true });
32081
- else {
32082
- log?.(`(${environment.name}) Hash is consistent. Skipping. Use --force to override.`);
32083
- return cachedMetadata;
32332
+ if (cachedMetadata) {
32333
+ if (cachedMetadata.lockfileHash !== getLockfileHash(environment)) environment.logger.info("Re-optimizing dependencies because lockfile has changed", { timestamp: true });
32334
+ else if (cachedMetadata.configHash !== getConfigHash(environment)) environment.logger.info("Re-optimizing dependencies because vite config has changed", { timestamp: true });
32335
+ else {
32336
+ log?.(`(${environment.name}) Hash is consistent. Skipping. Use --force to override.`);
32337
+ return cachedMetadata;
32338
+ }
32084
32339
  }
32085
32340
  } else environment.logger.info("Forced re-optimization of dependencies", { timestamp: true });
32086
32341
  debug$4?.(`(${environment.name}) ${import_picocolors.default.green(`removing old cache dir ${depsCacheDir}`)}`);
@@ -32363,9 +32618,10 @@ async function addManuallyIncludedOptimizeDeps(environment, deps) {
32363
32618
  const normalizedId = normalizeId(id);
32364
32619
  if (!deps[normalizedId]) {
32365
32620
  const entry = await resolve(id);
32366
- if (entry) if (isOptimizable(entry, optimizeDeps)) deps[normalizedId] = entry;
32367
- else unableToOptimize(id, "Cannot optimize dependency");
32368
- else unableToOptimize(id, "Failed to resolve dependency");
32621
+ if (entry) {
32622
+ if (isOptimizable(entry, optimizeDeps)) deps[normalizedId] = entry;
32623
+ else unableToOptimize(id, "Cannot optimize dependency");
32624
+ } else unableToOptimize(id, "Failed to resolve dependency");
32369
32625
  }
32370
32626
  }
32371
32627
  }
@@ -32480,7 +32736,7 @@ async function extractExportsData(environment, filePath) {
32480
32736
  };
32481
32737
  }
32482
32738
  });
32483
- const [, exports, , hasModuleSyntax] = parse$2((await (await rolldown({
32739
+ const build = await rolldown({
32484
32740
  ...remainingRolldownOptions,
32485
32741
  plugins,
32486
32742
  input: [filePath],
@@ -32488,15 +32744,20 @@ async function extractExportsData(environment, filePath) {
32488
32744
  ".css": "js",
32489
32745
  ...remainingRolldownOptions.moduleTypes
32490
32746
  }
32491
- })).generate({
32492
- ...rolldownOptions.output,
32493
- format: "esm",
32494
- sourcemap: false
32495
- })).output[0].code);
32496
- return {
32497
- hasModuleSyntax,
32498
- exports: exports.map((e) => e.n)
32499
- };
32747
+ });
32748
+ try {
32749
+ const [, exports, , hasModuleSyntax] = parse$2((await build.generate({
32750
+ ...rolldownOptions.output,
32751
+ format: "esm",
32752
+ sourcemap: false
32753
+ })).output[0].code);
32754
+ return {
32755
+ hasModuleSyntax,
32756
+ exports: exports.map((e) => e.n)
32757
+ };
32758
+ } finally {
32759
+ await build.close();
32760
+ }
32500
32761
  }
32501
32762
  let parseResult;
32502
32763
  let usedJsxLoader = false;
@@ -33849,9 +34110,10 @@ function onRollupLog(level, log, environment) {
33849
34110
  clearLine();
33850
34111
  const userOnLog = environment.config.build.rolldownOptions?.onLog;
33851
34112
  const userOnWarn = environment.config.build.rolldownOptions?.onwarn;
33852
- if (userOnLog) if (userOnWarn) userOnLog(level, log, normalizeUserOnWarn(userOnWarn, viteLog));
33853
- else userOnLog(level, log, viteLog);
33854
- else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log);
34113
+ if (userOnLog) {
34114
+ if (userOnWarn) userOnLog(level, log, normalizeUserOnWarn(userOnWarn, viteLog));
34115
+ else userOnLog(level, log, viteLog);
34116
+ } else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log);
33855
34117
  else viteLog(level, log);
33856
34118
  }
33857
34119
  function normalizeUserOnWarn(userOnWarn, defaultHandler) {
@@ -35926,7 +36188,7 @@ function createNativeConfigCompatPlugin(collector) {
35926
36188
  name: "vite:native-config-compat-check",
35927
36189
  transform: {
35928
36190
  filter: { id: {
35929
- include: /\.[cm]?[jt]sx?$/,
36191
+ include: jsTsExtRE,
35930
36192
  exclude: /^\0/
35931
36193
  } },
35932
36194
  async handler(code, id) {
@@ -36165,6 +36427,7 @@ function idToPathAndNamespace(id) {
36165
36427
  //#endregion
36166
36428
  //#region src/node/config.ts
36167
36429
  var config_exports = /* @__PURE__ */ __exportAll({
36430
+ bundleConfigFile: () => bundleConfigFile,
36168
36431
  defineConfig: () => defineConfig,
36169
36432
  getDefaultEnvironmentOptions: () => getDefaultEnvironmentOptions,
36170
36433
  isResolvedConfig: () => isResolvedConfig,
@@ -36528,7 +36791,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36528
36791
  if (tsconfigPathsPlugin) logger.warnOnce(import_picocolors.default.yellow(`The plugin ${JSON.stringify(tsconfigPathsPlugin.name)} is detected. Vite now supports tsconfig paths resolution natively via the ${import_picocolors.default.bold("resolve.tsconfigPaths")} option. You can remove the plugin and set ${import_picocolors.default.bold("resolve.tsconfigPaths: true")} in your Vite config instead.`));
36529
36792
  if (process.versions.pnp) logger.warnOnce(import_picocolors.default.yellow(`Using Yarn PnP with Vite is discouraged and PnP-specific bugs will no longer be actively worked on. Please switch to a different ${import_picocolors.default.bold("nodeLinker")} mode or to a different package manager.`));
36530
36793
  let nonNormalizedResolvedRoot = config.root ? path.resolve(config.root) : process.cwd();
36531
- try {
36794
+ if (!config.resolve?.preserveSymlinks) try {
36532
36795
  nonNormalizedResolvedRoot = safeRealpathSync(nonNormalizedResolvedRoot);
36533
36796
  } catch {}
36534
36797
  const resolvedRoot = normalizePath(nonNormalizedResolvedRoot);
@@ -36607,8 +36870,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36607
36870
  if (envDir !== false) envDir = config.envDir ? normalizePath(path.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
36608
36871
  const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config));
36609
36872
  const userNodeEnv = process.env.VITE_USER_NODE_ENV;
36610
- if (!isNodeEnvSet && userNodeEnv) if (userNodeEnv === "development") process.env.NODE_ENV = "development";
36611
- else logger.warn(`NODE_ENV=${userNodeEnv} is not supported in the .env file. Only NODE_ENV=development is supported to create a development build of your project. If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.`);
36873
+ if (!isNodeEnvSet && userNodeEnv) {
36874
+ if (userNodeEnv === "development") process.env.NODE_ENV = "development";
36875
+ else logger.warn(`NODE_ENV=${userNodeEnv} is not supported in the .env file. Only NODE_ENV=development is supported to create a development build of your project. If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.`);
36876
+ }
36612
36877
  const isProduction = process.env.NODE_ENV === "production";
36613
36878
  const resolvedBase = config.base === "" || config.base === "./" ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
36614
36879
  const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
@@ -36678,9 +36943,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36678
36943
  if (Array.isArray(server.allowedHosts)) server.allowedHosts.push(...additionalAllowedHosts);
36679
36944
  if (Array.isArray(preview.allowedHosts)) preview.allowedHosts.push(...additionalAllowedHosts);
36680
36945
  let oxc = config.oxc;
36681
- if (config.esbuild) if (config.oxc) logger.warn(import_picocolors.default.yellow(`Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.`) + ` The following esbuild options were set: \`${inspect(config.esbuild)}\``);
36682
- else oxc = convertEsbuildConfigToOxcConfig(config.esbuild, logger);
36683
- else if (config.esbuild === false && config.oxc !== false) logger.warn(import_picocolors.default.yellow("`esbuild` option is set to false, but `oxc` option was not set to false. `esbuild: false` does not have effect any more. If you want to disable the default transformation, which is now handled by Oxc, please set `oxc: false` instead."));
36946
+ if (config.esbuild) {
36947
+ if (config.oxc) logger.warn(import_picocolors.default.yellow(`Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.`) + ` The following esbuild options were set: \`${inspect(config.esbuild)}\``);
36948
+ else oxc = convertEsbuildConfigToOxcConfig(config.esbuild, logger);
36949
+ } else if (config.esbuild === false && config.oxc !== false) logger.warn(import_picocolors.default.yellow("`esbuild` option is set to false, but `oxc` option was not set to false. `esbuild: false` does not have effect any more. If you want to disable the default transformation, which is now handled by Oxc, please set `oxc: false` instead."));
36684
36950
  const experimental = mergeWithDefaults(configDefaults.experimental, config.experimental ?? {});
36685
36951
  if (command === "serve" && experimental.bundledDev) experimental.renderBuiltUrl = void 0;
36686
36952
  const resolvedDevToolsConfig = await resolveDevToolsConfig(config.devtools, server.host, logger);
@@ -36931,6 +37197,7 @@ async function bundleConfigFile(fileName, isESM) {
36931
37197
  const importMetaUrlVarName = "__vite_injected_original_import_meta_url";
36932
37198
  const importMetaResolveVarName = "__vite_injected_original_import_meta_resolve";
36933
37199
  const importMetaResolveRegex = /import\.meta\s*\.\s*resolve/;
37200
+ const configFileRegex = /\.[cm]?[jt]s$/;
36934
37201
  const nativeIncompatibilities = [];
36935
37202
  const bundle = await rolldown({
36936
37203
  input: fileName,
@@ -36989,16 +37256,18 @@ async function bundleConfigFile(fileName, isESM) {
36989
37256
  {
36990
37257
  name: "inject-file-scope-variables",
36991
37258
  transform: {
36992
- filter: { id: /\.[cm]?[jt]s$/ },
37259
+ filter: { id: configFileRegex },
36993
37260
  handler(code, id) {
36994
37261
  let injectValues = `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};`;
36995
- if (importMetaResolveRegex.test(code)) if (isESM) {
36996
- if (!importMetaResolverRegistered) {
36997
- importMetaResolverRegistered = true;
36998
- createImportMetaResolver();
36999
- }
37000
- injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => (${importMetaResolveWithCustomHookString})(specifier, importer);`;
37001
- } else injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => { throw new Error('import.meta.resolve is not supported in CJS config files') };`;
37262
+ if (importMetaResolveRegex.test(code)) {
37263
+ if (isESM) {
37264
+ if (!importMetaResolverRegistered) {
37265
+ importMetaResolverRegistered = true;
37266
+ createImportMetaResolver();
37267
+ }
37268
+ injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => (${importMetaResolveWithCustomHookString})(specifier, importer);`;
37269
+ } else injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => { throw new Error('import.meta.resolve is not supported in CJS config files') };`;
37270
+ }
37002
37271
  let injectedContents;
37003
37272
  if (code.startsWith("#!")) {
37004
37273
  const fileStartIndex = getFileStartIndex(code);
@@ -37017,8 +37286,8 @@ async function bundleConfigFile(fileName, isESM) {
37017
37286
  const result = await bundle.generate({
37018
37287
  format: isESM ? "esm" : "cjs",
37019
37288
  sourcemap: "inline",
37020
- sourcemapPathTransform(relative) {
37021
- return path.resolve(fileName, relative);
37289
+ sourcemapPathTransform(relative, sourcemapPath) {
37290
+ return path.resolve(path.dirname(sourcemapPath), relative);
37022
37291
  },
37023
37292
  codeSplitting: false
37024
37293
  });