vite 8.2.1 → 8.2.2

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.2";
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
  }
@@ -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
  };
@@ -10960,16 +10984,17 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10960
10984
  if (esc) {
10961
10985
  out += c;
10962
10986
  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;
10987
+ } else if (quote) {
10988
+ if (c === quote) quote = false;
10989
+ else if (quote == SQ) out += c;
10990
+ else if (c === BS) {
10991
+ i += 1;
10992
+ c = s.charAt(i);
10993
+ if (c === DQ || c === BS || c === DS) out += c;
10994
+ else out += BS + c;
10995
+ } else if (c === DS) out += parseEnvVar();
10996
+ else out += c;
10997
+ } else if (c === DQ || c === SQ) quote = c;
10973
10998
  else if (controlRE.test(c)) return { op: s };
10974
10999
  else if (hash.test(c)) {
10975
11000
  commented = true;
@@ -11403,7 +11428,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
11403
11428
  };
11404
11429
  }));
11405
11430
  //#endregion
11406
- //#region ../../node_modules/.pnpm/@vercel+detect-agent@1.2.3/node_modules/@vercel/detect-agent/dist/index.js
11431
+ //#region ../../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js
11407
11432
  var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11408
11433
  var __defProp = Object.defineProperty;
11409
11434
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -11896,25 +11921,27 @@ function walk$2(node, state, visitors) {
11896
11921
  for (const key in node) {
11897
11922
  if (key === "type") continue;
11898
11923
  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;
11924
+ if (child_node && typeof child_node === "object") {
11925
+ if (Array.isArray(child_node)) {
11926
+ /** @type {Record<number, T>} */
11927
+ const array_mutations = {};
11928
+ const len = child_node.length;
11929
+ let mutated = false;
11930
+ for (let i = 0; i < len; i++) {
11931
+ const node = child_node[i];
11932
+ if (node && typeof node === "object") {
11933
+ const result = visit(node, path, next_state);
11934
+ if (result) {
11935
+ array_mutations[i] = result;
11936
+ mutated = true;
11937
+ }
11911
11938
  }
11912
11939
  }
11940
+ if (mutated) mutations[key] = child_node.map((node, i) => array_mutations[i] ?? node);
11941
+ } else {
11942
+ const result = visit(child_node, path, next_state);
11943
+ if (result) mutations[key] = result;
11913
11944
  }
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
11945
  }
11919
11946
  }
11920
11947
  path.pop();
@@ -12104,12 +12131,13 @@ var Scope = class {
12104
12131
  * @param {import('estree').VariableDeclaration | import('estree').ClassDeclaration} node
12105
12132
  */
12106
12133
  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);
12134
+ if (node.type === "VariableDeclaration") {
12135
+ if (node.kind === "var" && this.block && this.parent) this.parent.add_declaration(node);
12136
+ else for (const declarator of node.declarations) for (const name of extract_names(declarator.id)) {
12137
+ this.declarations.set(name, node);
12138
+ if (declarator.init) this.initialised_declarations.add(name);
12139
+ }
12140
+ } else if (node.id) this.declarations.set(node.id.name, node);
12113
12141
  }
12114
12142
  /**
12115
12143
  * @param {string} name
@@ -12196,10 +12224,12 @@ var WalkerBase = class {
12196
12224
  * @param {Node} node
12197
12225
  */
12198
12226
  replace(parent, prop, index, node) {
12199
- if (parent && prop) if (index != null)
12227
+ if (parent && prop) {
12228
+ if (index != null)
12200
12229
  /** @type {Array<Node>} */ parent[prop][index] = node;
12201
- else
12230
+ else
12202
12231
  /** @type {Node} */ parent[prop] = node;
12232
+ }
12203
12233
  }
12204
12234
  /**
12205
12235
  * @template {Node} Parent
@@ -12208,9 +12238,11 @@ var WalkerBase = class {
12208
12238
  * @param {number | null | undefined} index
12209
12239
  */
12210
12240
  remove(parent, prop, index) {
12211
- if (parent && prop) if (index !== null && index !== void 0)
12241
+ if (parent && prop) {
12242
+ if (index !== null && index !== void 0)
12212
12243
  /** @type {Array<Node>} */ parent[prop].splice(index, 1);
12213
- else delete parent[prop];
12244
+ else delete parent[prop];
12245
+ }
12214
12246
  }
12215
12247
  };
12216
12248
  //#endregion
@@ -12438,45 +12470,50 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
12438
12470
  if (s.type === "ImportSpecifier") return getIdentifierNameOrLiteralValue$1(s.imported);
12439
12471
  else if (s.type === "ImportDefaultSpecifier") return "default";
12440
12472
  }).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`);
12473
+ for (const spec of node.specifiers) if (spec.type === "ImportSpecifier") {
12474
+ if (spec.imported.type === "Identifier") idToImportMap.set(spec.local.name, `${importId}.${spec.imported.name}`);
12475
+ else idToImportMap.set(spec.local.name, `${importId}[${JSON.stringify(spec.imported.value)}]`);
12476
+ } else if (spec.type === "ImportDefaultSpecifier") idToImportMap.set(spec.local.name, `${importId}.default`);
12444
12477
  else idToImportMap.set(spec.local.name, importId);
12445
12478
  }
12446
12479
  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);
12480
+ if (node.type === "ExportNamedDeclaration") {
12481
+ if (node.declaration) {
12482
+ if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") defineExport(node.declaration.id.name);
12483
+ else {
12484
+ const declaration = node.declaration;
12485
+ for (const decl of declaration.declarations) {
12486
+ const names = extract_names(decl.id);
12487
+ for (const name of names) defineExport(name);
12488
+ }
12489
+ }
12490
+ s.remove(node.start, node.declaration.start);
12491
+ } else if (node.source) {
12492
+ const importId = reExportImportIdMap.get(node);
12493
+ for (const spec of node.specifiers) {
12494
+ const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
12495
+ if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
12496
+ else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
12497
+ }
12498
+ } else {
12499
+ s.remove(node.start, node.end);
12500
+ for (const spec of node.specifiers) {
12501
+ const local = spec.local.name;
12502
+ const binding = idToImportMap.get(local);
12503
+ defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
12454
12504
  }
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
12505
  }
12471
12506
  }
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);
12507
+ if (node.type === "ExportDefaultDeclaration") {
12508
+ if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
12509
+ const { name } = node.declaration.id;
12510
+ s.remove(node.start, node.start + 15);
12511
+ defineExport("default", name);
12512
+ } else {
12513
+ const name = `__vite_ssr_export_default__`;
12514
+ s.update(node.start, node.start + 14, `const ${name} =`);
12515
+ defineExport("default", name);
12516
+ }
12480
12517
  }
12481
12518
  if (node.type === "ExportAllDeclaration") {
12482
12519
  const importId = reExportImportIdMap.get(node);
@@ -12502,15 +12539,16 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
12502
12539
  const topNode = parentStack[parentStack.length - 2];
12503
12540
  s.prependRight(topNode.start, `const ${id.name} = ${binding};\n`);
12504
12541
  }
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);
12542
+ } else if (parent.type === "CallExpression") {
12543
+ if (id === parent.callee && !parent.optional) {
12544
+ const argsStart = parent.arguments.length ? parent.arguments[0].start : parent.end;
12545
+ s.update(id.start, argsStart, `(0,${binding})${code.slice(id.end, argsStart)}`);
12546
+ } else {
12547
+ s.update(id.start, id.end, binding);
12548
+ s.prependRight(id.start, `(0,`);
12549
+ s.appendLeft(id.end, `)`);
12550
+ }
12551
+ } else if (!(parent.type === "ClassExpression" && id === parent.id)) s.update(id.start, id.end, binding);
12514
12552
  },
12515
12553
  onImportMeta(node) {
12516
12554
  s.update(node.start, node.end, ssrImportMetaKey);
@@ -12593,19 +12631,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport, onStatements
12593
12631
  if (parentScope) setScope(parentScope, node.id.name);
12594
12632
  }
12595
12633
  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
- });
12634
+ node.params.forEach((p) => handlePattern(p, node));
12609
12635
  } else if (node.type === "ClassDeclaration") {
12610
12636
  const parentScope = findParentScope(parentStack);
12611
12637
  if (parentScope) setScope(parentScope, node.id.name);
@@ -13271,8 +13297,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13271
13297
  if (ii === pathExt.length) return resolve(step(i + 1));
13272
13298
  const ext = pathExt[ii];
13273
13299
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
13274
- if (!er && is) if (opt.all) found.push(p + ext);
13275
- else return resolve(p + ext);
13300
+ if (!er && is) {
13301
+ if (opt.all) found.push(p + ext);
13302
+ else return resolve(p + ext);
13303
+ }
13276
13304
  return resolve(subStep(p, i, ii + 1));
13277
13305
  });
13278
13306
  });
@@ -13290,8 +13318,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13290
13318
  for (let j = 0; j < pathExt.length; j++) {
13291
13319
  const cur = p + pathExt[j];
13292
13320
  try {
13293
- if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur);
13294
- else return cur;
13321
+ if (isexe.sync(cur, { pathExt: pathExtExe })) {
13322
+ if (opt.all) found.push(cur);
13323
+ else return cur;
13324
+ }
13295
13325
  } catch (ex) {}
13296
13326
  }
13297
13327
  }
@@ -13802,7 +13832,7 @@ function checkPublicFile(url, config) {
13802
13832
  return tryStatSync(publicFile)?.isFile() ? publicFile : void 0;
13803
13833
  }
13804
13834
  //#endregion
13805
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js
13835
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js
13806
13836
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13807
13837
  const BINARY_TYPES = [
13808
13838
  "nodebuffer",
@@ -13825,7 +13855,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13825
13855
  };
13826
13856
  }));
13827
13857
  //#endregion
13828
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js
13858
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js
13829
13859
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13830
13860
  const { EMPTY_BUFFER } = require_constants();
13831
13861
  const FastBuffer = Buffer[Symbol.species];
@@ -13925,7 +13955,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13925
13955
  } catch (e) {}
13926
13956
  }));
13927
13957
  //#endregion
13928
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/limiter.js
13958
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js
13929
13959
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13930
13960
  const kDone = Symbol("kDone");
13931
13961
  const kRun = Symbol("kRun");
@@ -13976,7 +14006,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13976
14006
  module.exports = Limiter;
13977
14007
  }));
13978
14008
  //#endregion
13979
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js
14009
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
13980
14010
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13981
14011
  const zlib$1 = __require("zlib");
13982
14012
  const bufferUtil = require_buffer_util();
@@ -14096,7 +14126,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14096
14126
  acceptAsServer(offers) {
14097
14127
  const opts = this._options;
14098
14128
  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;
14129
+ 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
14130
  return true;
14101
14131
  });
14102
14132
  if (!accepted) throw new Error("None of the extension offers can be accepted");
@@ -14312,7 +14342,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14312
14342
  }
14313
14343
  }));
14314
14344
  //#endregion
14315
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js
14345
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js
14316
14346
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14317
14347
  const { isUtf8 } = __require("buffer");
14318
14348
  const { hasBlob } = require_constants();
@@ -14508,7 +14538,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14508
14538
  } catch (e) {}
14509
14539
  }));
14510
14540
  //#endregion
14511
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js
14541
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js
14512
14542
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14513
14543
  const { Writable: Writable$1 } = __require("stream");
14514
14544
  const PerMessageDeflate = require_permessage_deflate();
@@ -14971,7 +15001,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14971
15001
  module.exports = Receiver;
14972
15002
  }));
14973
15003
  //#endregion
14974
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js
15004
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js
14975
15005
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14976
15006
  const { Duplex: Duplex$3 } = __require("stream");
14977
15007
  const { randomFillSync } = __require("crypto");
@@ -15057,12 +15087,13 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15057
15087
  offset = 6;
15058
15088
  }
15059
15089
  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 {
15090
+ if (typeof data === "string") {
15091
+ if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
15092
+ else {
15093
+ data = Buffer.from(data);
15094
+ dataLength = data.length;
15095
+ }
15096
+ } else {
15066
15097
  dataLength = data.length;
15067
15098
  merge = options.mask && options.readOnly && !skipMasking;
15068
15099
  }
@@ -15174,15 +15205,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15174
15205
  readOnly,
15175
15206
  rsv1: false
15176
15207
  };
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([
15208
+ if (isBlob(data)) {
15209
+ if (this._state !== DEFAULT) this.enqueue([
15210
+ this.getBlobData,
15211
+ data,
15212
+ false,
15213
+ options,
15214
+ cb
15215
+ ]);
15216
+ else this.getBlobData(data, false, options, cb);
15217
+ } else if (this._state !== DEFAULT) this.enqueue([
15186
15218
  this.dispatch,
15187
15219
  data,
15188
15220
  false,
@@ -15224,15 +15256,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15224
15256
  readOnly,
15225
15257
  rsv1: false
15226
15258
  };
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([
15259
+ if (isBlob(data)) {
15260
+ if (this._state !== DEFAULT) this.enqueue([
15261
+ this.getBlobData,
15262
+ data,
15263
+ false,
15264
+ options,
15265
+ cb
15266
+ ]);
15267
+ else this.getBlobData(data, false, options, cb);
15268
+ } else if (this._state !== DEFAULT) this.enqueue([
15236
15269
  this.dispatch,
15237
15270
  data,
15238
15271
  false,
@@ -15293,15 +15326,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15293
15326
  readOnly,
15294
15327
  rsv1
15295
15328
  };
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([
15329
+ if (isBlob(data)) {
15330
+ if (this._state !== DEFAULT) this.enqueue([
15331
+ this.getBlobData,
15332
+ data,
15333
+ this._compress,
15334
+ opts,
15335
+ cb
15336
+ ]);
15337
+ else this.getBlobData(data, this._compress, opts, cb);
15338
+ } else if (this._state !== DEFAULT) this.enqueue([
15305
15339
  this.dispatch,
15306
15340
  data,
15307
15341
  this._compress,
@@ -15465,7 +15499,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15465
15499
  }
15466
15500
  }));
15467
15501
  //#endregion
15468
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/event-target.js
15502
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js
15469
15503
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15470
15504
  const { kForOnEventAttribute, kListener } = require_constants();
15471
15505
  const kCode = Symbol("kCode");
@@ -15696,7 +15730,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15696
15730
  }
15697
15731
  }));
15698
15732
  //#endregion
15699
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js
15733
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js
15700
15734
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15701
15735
  const { tokenChars } = require_validation();
15702
15736
  /**
@@ -15734,51 +15768,54 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15734
15768
  let i = 0;
15735
15769
  for (; i < header.length; i++) {
15736
15770
  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) {
15771
+ if (extensionName === void 0) {
15772
+ if (end === -1 && tokenChars[code] === 1) {
15773
+ if (start === -1) start = i;
15774
+ } else if (i !== 0 && (code === 32 || code === 9)) {
15775
+ if (end === -1 && start !== -1) end = i;
15776
+ } else if (code === 59 || code === 44) {
15777
+ if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
15778
+ if (end === -1) end = i;
15779
+ const name = header.slice(start, end);
15780
+ if (code === 44) {
15781
+ push(offers, name, params);
15782
+ params = Object.create(null);
15783
+ } else extensionName = name;
15784
+ start = end = -1;
15785
+ } else throw new SyntaxError(`Unexpected character at index ${i}`);
15786
+ } else if (paramName === void 0) {
15787
+ if (end === -1 && tokenChars[code] === 1) {
15788
+ if (start === -1) start = i;
15789
+ } else if (code === 32 || code === 9) {
15790
+ if (end === -1 && start !== -1) end = i;
15791
+ } else if (code === 59 || code === 44) {
15792
+ if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
15793
+ if (end === -1) end = i;
15794
+ push(params, header.slice(start, end), true);
15795
+ if (code === 44) {
15796
+ push(offers, extensionName, params);
15797
+ params = Object.create(null);
15798
+ extensionName = void 0;
15799
+ }
15800
+ start = end = -1;
15801
+ } else if (code === 61 && start !== -1 && end === -1) {
15802
+ paramName = header.slice(start, i);
15803
+ start = end = -1;
15804
+ } else throw new SyntaxError(`Unexpected character at index ${i}`);
15805
+ } else if (isEscaping) {
15770
15806
  if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
15771
15807
  if (start === -1) start = i;
15772
15808
  else if (!mustUnescape) mustUnescape = true;
15773
15809
  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;
15810
+ } else if (inQuotes) {
15811
+ if (tokenChars[code] === 1) {
15812
+ if (start === -1) start = i;
15813
+ } else if (code === 34 && start !== -1) {
15814
+ inQuotes = false;
15815
+ end = i;
15816
+ } else if (code === 92) isEscaping = true;
15817
+ else throw new SyntaxError(`Unexpected character at index ${i}`);
15818
+ } else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
15782
15819
  else if (end === -1 && tokenChars[code] === 1) {
15783
15820
  if (start === -1) start = i;
15784
15821
  } else if (start !== -1 && (code === 32 || code === 9)) {
@@ -15839,7 +15876,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15839
15876
  };
15840
15877
  }));
15841
15878
  //#endregion
15842
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js
15879
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js
15843
15880
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15844
15881
  const EventEmitter$2 = __require("events");
15845
15882
  const https$3 = __require("https");
@@ -15900,10 +15937,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15900
15937
  this._isServer = false;
15901
15938
  this._redirects = 0;
15902
15939
  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];
15940
+ else if (!Array.isArray(protocols)) {
15941
+ if (typeof protocols === "object" && protocols !== null) {
15942
+ options = protocols;
15943
+ protocols = [];
15944
+ } else protocols = [protocols];
15945
+ }
15907
15946
  initAsClient(this, address, protocols, options);
15908
15947
  } else {
15909
15948
  this._autoPong = options.autoPong;
@@ -16445,8 +16484,10 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16445
16484
  }
16446
16485
  opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
16447
16486
  }
16448
- if (opts.origin) if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
16449
- else opts.headers.Origin = opts.origin;
16487
+ if (opts.origin) {
16488
+ if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
16489
+ else opts.headers.Origin = opts.origin;
16490
+ }
16450
16491
  if (parsedUrl.username || parsedUrl.password) opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
16451
16492
  if (isIpcUrl) {
16452
16493
  const parts = opts.path.split(":");
@@ -16828,7 +16869,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16828
16869
  }
16829
16870
  }));
16830
16871
  //#endregion
16831
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/stream.js
16872
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js
16832
16873
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16833
16874
  require_websocket();
16834
16875
  const { Duplex: Duplex$1 } = __require("stream");
@@ -16944,7 +16985,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16944
16985
  module.exports = createWebSocketStream;
16945
16986
  }));
16946
16987
  //#endregion
16947
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js
16988
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js
16948
16989
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16949
16990
  const { tokenChars } = require_validation();
16950
16991
  /**
@@ -16983,7 +17024,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16983
17024
  module.exports = { parse };
16984
17025
  }));
16985
17026
  //#endregion
16986
- //#region ../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket-server.js
17027
+ //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js
16987
17028
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16988
17029
  const EventEmitter$1 = __require("events");
16989
17030
  const http$4 = __require("http");
@@ -17132,9 +17173,10 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
17132
17173
  this._removeListeners();
17133
17174
  this._removeListeners = this._server = null;
17134
17175
  }
17135
- if (this.clients) if (!this.clients.size) process.nextTick(emitClose, this);
17136
- else this._shouldEmitClose = true;
17137
- else process.nextTick(emitClose, this);
17176
+ if (this.clients) {
17177
+ if (!this.clients.size) process.nextTick(emitClose, this);
17178
+ else this._shouldEmitClose = true;
17179
+ } else process.nextTick(emitClose, this);
17138
17180
  } else {
17139
17181
  const server = this._server;
17140
17182
  this._removeListeners();
@@ -18264,9 +18306,10 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
18264
18306
  let retSegs = "";
18265
18307
  for (const seg of args) {
18266
18308
  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;
18309
+ if (retSegs.endsWith("/")) {
18310
+ if (seg.startsWith("/")) retSegs += seg.slice(1);
18311
+ else retSegs += seg;
18312
+ } else if (seg.startsWith("/")) retSegs += seg;
18270
18313
  else retSegs += "/" + seg;
18271
18314
  }
18272
18315
  return queryParamRaw ? retSegs + "?" + queryParamRaw : retSegs;
@@ -19307,9 +19350,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
19307
19350
  return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/gm;
19308
19351
  } });
19309
19352
  var decodeBase64;
19310
- if (typeof Buffer !== "undefined") if (typeof Buffer.from === "function") decodeBase64 = decodeBase64WithBufferFrom;
19311
- else decodeBase64 = decodeBase64WithNewBuffer;
19312
- else decodeBase64 = decodeBase64WithAtob;
19353
+ if (typeof Buffer !== "undefined") {
19354
+ if (typeof Buffer.from === "function") decodeBase64 = decodeBase64WithBufferFrom;
19355
+ else decodeBase64 = decodeBase64WithNewBuffer;
19356
+ } else decodeBase64 = decodeBase64WithAtob;
19313
19357
  function decodeBase64WithBufferFrom(base64) {
19314
19358
  return Buffer.from(base64, "base64").toString();
19315
19359
  }
@@ -19348,9 +19392,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
19348
19392
  Converter.prototype.toJSON = function(space) {
19349
19393
  return JSON.stringify(this.sourcemap, null, space);
19350
19394
  };
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;
19395
+ if (typeof Buffer !== "undefined") {
19396
+ if (typeof Buffer.from === "function") Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
19397
+ else Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
19398
+ } else Converter.prototype.toBase64 = encodeBase64WithBtoa;
19354
19399
  function encodeBase64WithBufferFrom() {
19355
19400
  var json = this.toJSON();
19356
19401
  return Buffer.from(json, "utf8").toString("base64");
@@ -20443,13 +20488,20 @@ function isFileInTargetPath(targetPath, filePath) {
20443
20488
  return isSameFilePath(targetPath, filePath) || isParentDirectory(targetPath, filePath);
20444
20489
  }
20445
20490
  const windowsDriveRE = /^[A-Z]:/i;
20491
+ const windowsShortNameSegmentRE = /^[^~.]{1,6}~\d+(?:\.[^~.]{0,3})?$/;
20492
+ /**
20493
+ * Warning: parameters are not validated, only works with normalized absolute paths
20494
+ */
20495
+ function looksLikeWindowsShortNamePath(filePath) {
20496
+ return filePath.includes("~") && filePath.split("/").some((segment) => windowsShortNameSegmentRE.test(segment));
20497
+ }
20446
20498
  /**
20447
20499
  * Warning: parameters are not validated, only works with normalized absolute paths
20448
20500
  */
20449
20501
  function isFileLoadingAllowed(config, filePath) {
20450
20502
  const { fs } = config.server;
20451
20503
  if (!fs.strict) return true;
20452
- if (isWindows && filePath.includes("~")) return false;
20504
+ if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
20453
20505
  if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
20454
20506
  const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
20455
20507
  if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
@@ -21475,8 +21527,10 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
21475
21527
  const topLevelConfig = environment.getTopLevelConfig();
21476
21528
  if (!skipPublicCheck) {
21477
21529
  const publicFile = checkPublicFile(id, topLevelConfig);
21478
- if (publicFile) if (inlineRE$3.test(id)) id = publicFile;
21479
- else return publicFileToBuiltUrl(id, topLevelConfig);
21530
+ if (publicFile) {
21531
+ if (inlineRE$3.test(id)) id = publicFile;
21532
+ else return publicFileToBuiltUrl(id, topLevelConfig);
21533
+ }
21480
21534
  }
21481
21535
  const cache = assetCache.get(environment);
21482
21536
  const cached = cache.get(id);
@@ -21889,7 +21943,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21889
21943
  };
21890
21944
  }));
21891
21945
  //#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
21946
+ //#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
21947
  var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21894
21948
  const { createRequire: createRequire$1 } = __require("node:module");
21895
21949
  const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
@@ -21931,7 +21985,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21931
21985
  module.exports = req;
21932
21986
  }));
21933
21987
  //#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
21988
+ //#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
21989
  var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21936
21990
  const req = require_req();
21937
21991
  /**
@@ -21965,7 +22019,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21965
22019
  module.exports = options;
21966
22020
  }));
21967
22021
  //#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
22022
+ //#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
22023
  var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21970
22024
  const req = require_req();
21971
22025
  /**
@@ -22019,7 +22073,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22019
22073
  module.exports = plugins;
22020
22074
  }));
22021
22075
  //#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
22076
+ //#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
22077
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22024
22078
  const { resolve: resolve$3 } = __require("node:path");
22025
22079
  const config = require_src$1();
@@ -22535,8 +22589,10 @@ function cssPlugin(config) {
22535
22589
  const resolveUrl = (url, importer) => idResolver(environment, url, importer);
22536
22590
  const urlResolver = async (url, importer) => {
22537
22591
  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];
22592
+ if (checkPublicFile(decodedUrl, config)) {
22593
+ if (encodePublicUrlsInCSS(config)) return [publicFileToBuiltUrl(decodedUrl, config), void 0];
22594
+ else return [joinUrlSegments(joinUrlSegments(config.server.origin ?? "", config.base), decodedUrl), void 0];
22595
+ }
22540
22596
  const [id, fragment] = decodedUrl.split("#");
22541
22597
  let resolved = await resolveUrl(id, importer);
22542
22598
  if (resolved) {
@@ -22801,11 +22857,13 @@ function cssPostPlugin(config) {
22801
22857
  chunkCSSMap.set(chunk.fileName, chunkCSS);
22802
22858
  }
22803
22859
  }
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() };
22860
+ if (s) {
22861
+ if (config.build.sourcemap) return {
22862
+ code: s.toString(),
22863
+ map: s.generateMap({ hires: "boundary" })
22864
+ };
22865
+ else return { code: s.toString() };
22866
+ }
22809
22867
  return null;
22810
22868
  },
22811
22869
  augmentChunkHash(chunk) {
@@ -22911,16 +22969,17 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
22911
22969
  const m = (format === "iife" ? IIFE_BEGIN_RE : UMD_BEGIN_RE).exec(code);
22912
22970
  if (!m) ctx.error("Injection point for inlined CSS not found");
22913
22971
  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");
22972
+ } else if (format === "es") {
22973
+ if (code.startsWith("#!")) {
22974
+ const fileStartIndex = getFileStartIndex(code);
22975
+ const hashbang = code.slice(0, fileStartIndex);
22976
+ if (!lineTerminatorRE.test(hashbang)) {
22977
+ s.append(`\n${injectCode}`);
22978
+ return;
22979
+ }
22980
+ injectionPoint = fileStartIndex;
22981
+ } else injectionPoint = 0;
22982
+ } else ctx.error("Non supported format");
22924
22983
  s.appendRight(injectionPoint, injectCode);
22925
22984
  }
22926
22985
  function cssAnalysisPlugin(config) {
@@ -23283,13 +23342,15 @@ async function resolvePostcssConfig(config) {
23283
23342
  const searchPath = typeof inlineOptions === "string" ? inlineOptions : config.root;
23284
23343
  const stopDir = searchForWorkspaceRoot(config.root);
23285
23344
  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}`);
23345
+ if (!e.message.includes("No PostCSS Config found")) {
23346
+ if (e instanceof Error) {
23347
+ const { name, message, stack } = e;
23348
+ e.name = "Failed to load PostCSS config";
23349
+ e.message = `Failed to load PostCSS config (searchPath: ${searchPath}): [${name}] ${message}\n${stack}`;
23350
+ e.stack = "";
23351
+ throw e;
23352
+ } else throw new Error(`Failed to load PostCSS config: ${e}`);
23353
+ }
23293
23354
  return null;
23294
23355
  });
23295
23356
  result.then((resolved) => {
@@ -24166,9 +24227,8 @@ const esRE = /es(6|\d{4})/;
24166
24227
  const versionRE = /\d/;
24167
24228
  const convertTargetsCache = /* @__PURE__ */ new Map();
24168
24229
  const convertTargets = (esbuildTarget) => {
24169
- if (!esbuildTarget) return {};
24170
- const cached = convertTargetsCache.get(esbuildTarget);
24171
- if (cached) return cached;
24230
+ if (!esbuildTarget) return void 0;
24231
+ if (convertTargetsCache.has(esbuildTarget)) return convertTargetsCache.get(esbuildTarget);
24172
24232
  const targets = {};
24173
24233
  const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => {
24174
24234
  const match = esRE.exec(e);
@@ -24194,8 +24254,9 @@ const convertTargets = (esbuildTarget) => {
24194
24254
  }
24195
24255
  throw new Error(`Unsupported target "${entry}"`);
24196
24256
  }
24197
- convertTargetsCache.set(esbuildTarget, targets);
24198
- return targets;
24257
+ const result = Object.keys(targets).length > 0 ? targets : void 0;
24258
+ convertTargetsCache.set(esbuildTarget, result);
24259
+ return result;
24199
24260
  };
24200
24261
  function resolveLibCssFilename(libOptions, root, packageCache) {
24201
24262
  if (typeof libOptions.cssFileName === "string") return `${libOptions.cssFileName}.css`;
@@ -24526,20 +24587,22 @@ function buildHtmlPlugin(config) {
24526
24587
  else if (attr.type === "src") {
24527
24588
  const url = decodeURIIfPossible(attr.value);
24528
24589
  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
- })());
24590
+ else if (!isExcludedUrl(url)) {
24591
+ if (node.nodeName === "link" && isCSSRequest(url) && !("media" in attr.attributes || "disabled" in attr.attributes)) {
24592
+ const importExpression = `\nimport ${JSON.stringify(url)}`;
24593
+ styleUrls.push({
24594
+ url,
24595
+ start: nodeStartWithLeadingWhitespace(node),
24596
+ end: node.sourceCodeLocation.endOffset
24597
+ });
24598
+ js += importExpression;
24599
+ } else {
24600
+ const shouldInline = node.nodeName === "link" && attr.attributes.rel && parseRelAttr(attr.attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
24601
+ assetUrlsPromises.push((async () => {
24602
+ const processedUrl = await processAssetUrl(url, shouldInline);
24603
+ if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
24604
+ })());
24605
+ }
24543
24606
  }
24544
24607
  }
24545
24608
  const inlineStyle = findNeedTransformStyleAttribute(node);
@@ -25220,7 +25283,7 @@ If you intend to import that asset, put the file in the src directory, and use $
25220
25283
  //#region src/node/plugins/define.ts
25221
25284
  const nonJsRe = /\.json(?:$|\?)/;
25222
25285
  const isNonJsRequest = (request) => nonJsRe.test(request);
25223
- const escapedDotRE = /(?<!\\)\\./g;
25286
+ const escapedDotRE = /(?<!\\)\\\./g;
25224
25287
  function definePlugin(config) {
25225
25288
  const isBuild = config.command === "build";
25226
25289
  const isBuildLib = isBuild && config.build.lib;
@@ -26267,7 +26330,13 @@ function triggerLazyBundlingMiddleware(server) {
26267
26330
  }
26268
26331
  const moduleId = params.get("id");
26269
26332
  const clientId = params.get("clientId");
26270
- const result = await bundledDev.triggerLazyBundling(moduleId, clientId);
26333
+ let result;
26334
+ try {
26335
+ result = await bundledDev.triggerLazyBundling(moduleId, clientId);
26336
+ } catch (e) {
26337
+ server.config.logger.error(`Failed to trigger lazy bundling for ${moduleId} (clientId: ${clientId}):` + e, { error: e });
26338
+ return next(/* @__PURE__ */ new Error(`Failed to trigger lazy bundling`));
26339
+ }
26271
26340
  if (result == null) return next();
26272
26341
  res.setHeader("Content-Type", "application/javascript");
26273
26342
  res.on("finish", () => bundledDev.markPayloadDelivered(result.filename));
@@ -27251,9 +27320,10 @@ function lexAcceptedHmrDeps(code, start, urls) {
27251
27320
  prevState = state;
27252
27321
  state = 3;
27253
27322
  } 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;
27323
+ else if (state === 0) {
27324
+ if (char === `[`) state = 4;
27325
+ else return true;
27326
+ } else if (char === `]`) return false;
27257
27327
  else if (char === ",") continue;
27258
27328
  else error(i);
27259
27329
  break;
@@ -27595,16 +27665,18 @@ function webWorkerPostPlugin(_config) {
27595
27665
  }
27596
27666
  let injectedImportMeta = false;
27597
27667
  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;
27668
+ for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2) {
27669
+ if (code.slice(end, end + 4) === ".url") {
27670
+ s ||= new MagicString(code);
27671
+ s.overwrite(start, end + 4, "self.location.href");
27672
+ } else {
27673
+ s ||= new MagicString(code);
27674
+ if (!injectedImportMeta) {
27675
+ s.prepend("const _vite_importMeta = { url: self.location.href };\n");
27676
+ injectedImportMeta = true;
27677
+ }
27678
+ s.overwrite(start, end, "_vite_importMeta");
27606
27679
  }
27607
- s.overwrite(start, end, "_vite_importMeta");
27608
27680
  }
27609
27681
  if (!s) return;
27610
27682
  return {
@@ -27644,13 +27716,14 @@ function webWorkerPlugin(config) {
27644
27716
  name: options?.name
27645
27717
  }`;
27646
27718
  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}
27719
+ if (isBundled) {
27720
+ if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
27721
+ else if (inlineRE.test(id)) {
27722
+ const result = await bundleWorkerEntry(config, id);
27723
+ for (const file of result.watchedFiles) this.addWatchFile(file);
27724
+ const jsContent = `const jsContent = ${JSON.stringify(result.entryCode)};`;
27725
+ return {
27726
+ code: workerConstructor === "Worker" ? `${jsContent}
27654
27727
  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
27728
  export default function WorkerWrapper(options) {
27656
27729
  let objURL;
@@ -27676,19 +27749,19 @@ function webWorkerPlugin(config) {
27676
27749
  );
27677
27750
  }
27678
27751
  `,
27679
- map: { mappings: "" }
27680
- };
27752
+ map: { mappings: "" }
27753
+ };
27754
+ } else {
27755
+ const result = await workerFileToUrl(config, id);
27756
+ let url;
27757
+ if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
27758
+ emitWorkerAssetsForBundledDev(this, config);
27759
+ url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
27760
+ } else url = result.entryUrlPlaceholder;
27761
+ urlCode = JSON.stringify(url);
27762
+ for (const file of result.watchedFiles) this.addWatchFile(file);
27763
+ }
27681
27764
  } 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
27765
  let url = await fileToUrl$1(this, cleanUrl(id));
27693
27766
  url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
27694
27767
  urlCode = JSON.stringify(url);
@@ -27717,10 +27790,12 @@ function webWorkerPlugin(config) {
27717
27790
  let injectEnv = "";
27718
27791
  if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
27719
27792
  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 || "";
27793
+ else if (workerType === "ignore") {
27794
+ if (this.environment.config.isBundled) injectEnv = "";
27795
+ else {
27796
+ const environment = this.environment;
27797
+ injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
27798
+ }
27724
27799
  }
27725
27800
  if (injectEnv) {
27726
27801
  const s = new MagicString(raw);
@@ -28050,13 +28125,15 @@ function importAnalysisPlugin(config) {
28050
28125
  if (prop === ".hot") {
28051
28126
  hasHMR = true;
28052
28127
  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;
28128
+ if (source.slice(endHot, endHot + 7) === ".accept") {
28129
+ if (source.slice(endHot, endHot + 14) === ".acceptExports") {
28130
+ const importAcceptedExports = orderedAcceptedExports[index] = /* @__PURE__ */ new Set();
28131
+ lexAcceptedHmrExports(source, source.indexOf("(", endHot + 14) + 1, importAcceptedExports);
28132
+ isPartiallySelfAccepting = true;
28133
+ } else {
28134
+ const importAcceptedUrls = orderedAcceptedUrls[index] = /* @__PURE__ */ new Set();
28135
+ if (lexAcceptedHmrDeps(source, source.indexOf("(", endHot + 7) + 1, importAcceptedUrls)) isSelfAccepting = true;
28136
+ }
28060
28137
  }
28061
28138
  } else if (prop === ".env") hasEnv = true;
28062
28139
  return;
@@ -28131,8 +28208,10 @@ function importAnalysisPlugin(config) {
28131
28208
  debugHmr?.(`${isSelfAccepting ? `[self-accepts]` : isPartiallySelfAccepting ? `[accepts-exports]` : acceptedUrls.size ? `[accepts-deps]` : `[detected api usage]`} ${prettifyUrl(importer, root)}`);
28132
28209
  str().prepend(`import { createHotContext as __vite__createHotContext } from "${clientPublicPath}";import.meta.hot = __vite__createHotContext(${JSON.stringify(normalizeHmrUrl(importerModule.url))});`);
28133
28210
  }
28134
- if (needQueryInjectHelper) if (isClassicWorker) str().append("\n" + __vite__injectQuery.toString());
28135
- else str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
28211
+ if (needQueryInjectHelper) {
28212
+ if (isClassicWorker) str().append("\n" + __vite__injectQuery.toString());
28213
+ else str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
28214
+ }
28136
28215
  const normalizedAcceptedUrls = /* @__PURE__ */ new Set();
28137
28216
  for (const { url, start, end } of acceptedUrls) {
28138
28217
  let [normalized, resolvedId] = await normalizeUrl(url, start).catch(() => []);
@@ -28262,9 +28341,10 @@ function transformCjsImport(importExp, url, rawUrl, importIndex, importer, isNod
28262
28341
  const lines = [];
28263
28342
  importNames.forEach(({ importedName, localName }) => {
28264
28343
  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}"]`);
28344
+ else if (importedName === "default") {
28345
+ if (isNodeMode) lines.push(`const ${localName} = ${cjsModuleName}`);
28346
+ else lines.push(`const ${localName} = !${cjsModuleName}.__esModule ? ${cjsModuleName} : ${cjsModuleName}.default`);
28347
+ } else lines.push(`const ${localName} = ${cjsModuleName}["${importedName}"]`);
28268
28348
  });
28269
28349
  if (defaultExports) lines.push(`export default ${defaultExports}`);
28270
28350
  if (exportNames.length) lines.push(`export { ${exportNames.join(", ")} }`);
@@ -29723,9 +29803,10 @@ async function toAbsoluteGlob(glob, root, importer, resolveId, base) {
29723
29803
  }
29724
29804
  root = globSafePath(root);
29725
29805
  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;
29806
+ if (base) {
29807
+ if (base[0] === "/") dir = posix.join(root, base);
29808
+ else dir = posix.resolve(importer ? globSafePath(dirname$1(importer)) : root, base);
29809
+ } else dir = importer ? globSafePath(dirname$1(importer)) : root;
29729
29810
  if (glob[0] === "/") return pre + posix.join(root, glob.slice(1));
29730
29811
  if (glob.startsWith("./")) return pre + posix.join(dir, glob.slice(2));
29731
29812
  if (glob.startsWith("../")) return pre + posix.join(dir, glob);
@@ -31712,34 +31793,36 @@ function expandGlobIds(id, config) {
31712
31793
  if (exports) {
31713
31794
  if (typeof exports === "string" || Array.isArray(exports)) return [pkgName];
31714
31795
  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;
31796
+ for (const key in exports) if (key[0] === ".") {
31797
+ if (key.includes("*")) {
31798
+ const exportsValue = getFirstExportStringValue(exports[key]);
31799
+ if (!exportsValue) continue;
31800
+ const exportValuePattern = exportsValue.replace(/\*/g, "**/*");
31801
+ const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex).join("(.*)"));
31802
+ possibleExportPaths.push(...globSync(exportValuePattern, {
31803
+ cwd: pkgData.dir,
31804
+ expandDirectories: false,
31805
+ ignore: ["node_modules"]
31806
+ }).map((filePath) => {
31807
+ if (exportsValue.startsWith("./")) filePath = "./" + filePath;
31808
+ const matched = exportsValueGlobRe.exec(slash(filePath));
31809
+ if (matched) {
31810
+ let allGlobSame = matched.length === 2;
31811
+ if (!allGlobSame) {
31812
+ allGlobSame = true;
31813
+ for (let i = 2; i < matched.length; i++) if (matched[i] !== matched[i - 1]) {
31814
+ allGlobSame = false;
31815
+ break;
31816
+ }
31734
31817
  }
31818
+ if (allGlobSame) return key.replace("*", matched[1]).slice(2);
31735
31819
  }
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));
31820
+ return "";
31821
+ }).filter(Boolean));
31822
+ } else {
31823
+ if (exports[key] == null) continue;
31824
+ possibleExportPaths.push(key.slice(2));
31825
+ }
31743
31826
  }
31744
31827
  const isMatch = pm(pattern);
31745
31828
  const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path.posix.join(pkgName, match));
@@ -32076,11 +32159,13 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
32076
32159
  const cachedMetadataPath = path.join(depsCacheDir, METADATA_FILENAME);
32077
32160
  cachedMetadata = parseDepsOptimizerMetadata(await fsp.readFile(cachedMetadataPath, "utf-8"), depsCacheDir);
32078
32161
  } 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;
32162
+ if (cachedMetadata) {
32163
+ if (cachedMetadata.lockfileHash !== getLockfileHash(environment)) environment.logger.info("Re-optimizing dependencies because lockfile has changed", { timestamp: true });
32164
+ else if (cachedMetadata.configHash !== getConfigHash(environment)) environment.logger.info("Re-optimizing dependencies because vite config has changed", { timestamp: true });
32165
+ else {
32166
+ log?.(`(${environment.name}) Hash is consistent. Skipping. Use --force to override.`);
32167
+ return cachedMetadata;
32168
+ }
32084
32169
  }
32085
32170
  } else environment.logger.info("Forced re-optimization of dependencies", { timestamp: true });
32086
32171
  debug$4?.(`(${environment.name}) ${import_picocolors.default.green(`removing old cache dir ${depsCacheDir}`)}`);
@@ -32363,9 +32448,10 @@ async function addManuallyIncludedOptimizeDeps(environment, deps) {
32363
32448
  const normalizedId = normalizeId(id);
32364
32449
  if (!deps[normalizedId]) {
32365
32450
  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");
32451
+ if (entry) {
32452
+ if (isOptimizable(entry, optimizeDeps)) deps[normalizedId] = entry;
32453
+ else unableToOptimize(id, "Cannot optimize dependency");
32454
+ } else unableToOptimize(id, "Failed to resolve dependency");
32369
32455
  }
32370
32456
  }
32371
32457
  }
@@ -32480,7 +32566,7 @@ async function extractExportsData(environment, filePath) {
32480
32566
  };
32481
32567
  }
32482
32568
  });
32483
- const [, exports, , hasModuleSyntax] = parse$2((await (await rolldown({
32569
+ const build = await rolldown({
32484
32570
  ...remainingRolldownOptions,
32485
32571
  plugins,
32486
32572
  input: [filePath],
@@ -32488,15 +32574,20 @@ async function extractExportsData(environment, filePath) {
32488
32574
  ".css": "js",
32489
32575
  ...remainingRolldownOptions.moduleTypes
32490
32576
  }
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
- };
32577
+ });
32578
+ try {
32579
+ const [, exports, , hasModuleSyntax] = parse$2((await build.generate({
32580
+ ...rolldownOptions.output,
32581
+ format: "esm",
32582
+ sourcemap: false
32583
+ })).output[0].code);
32584
+ return {
32585
+ hasModuleSyntax,
32586
+ exports: exports.map((e) => e.n)
32587
+ };
32588
+ } finally {
32589
+ await build.close();
32590
+ }
32500
32591
  }
32501
32592
  let parseResult;
32502
32593
  let usedJsxLoader = false;
@@ -33849,9 +33940,10 @@ function onRollupLog(level, log, environment) {
33849
33940
  clearLine();
33850
33941
  const userOnLog = environment.config.build.rolldownOptions?.onLog;
33851
33942
  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);
33943
+ if (userOnLog) {
33944
+ if (userOnWarn) userOnLog(level, log, normalizeUserOnWarn(userOnWarn, viteLog));
33945
+ else userOnLog(level, log, viteLog);
33946
+ } else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log);
33855
33947
  else viteLog(level, log);
33856
33948
  }
33857
33949
  function normalizeUserOnWarn(userOnWarn, defaultHandler) {
@@ -35926,7 +36018,7 @@ function createNativeConfigCompatPlugin(collector) {
35926
36018
  name: "vite:native-config-compat-check",
35927
36019
  transform: {
35928
36020
  filter: { id: {
35929
- include: /\.[cm]?[jt]sx?$/,
36021
+ include: jsTsExtRE,
35930
36022
  exclude: /^\0/
35931
36023
  } },
35932
36024
  async handler(code, id) {
@@ -36165,6 +36257,7 @@ function idToPathAndNamespace(id) {
36165
36257
  //#endregion
36166
36258
  //#region src/node/config.ts
36167
36259
  var config_exports = /* @__PURE__ */ __exportAll({
36260
+ bundleConfigFile: () => bundleConfigFile,
36168
36261
  defineConfig: () => defineConfig,
36169
36262
  getDefaultEnvironmentOptions: () => getDefaultEnvironmentOptions,
36170
36263
  isResolvedConfig: () => isResolvedConfig,
@@ -36528,7 +36621,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36528
36621
  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
36622
  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
36623
  let nonNormalizedResolvedRoot = config.root ? path.resolve(config.root) : process.cwd();
36531
- try {
36624
+ if (!config.resolve?.preserveSymlinks) try {
36532
36625
  nonNormalizedResolvedRoot = safeRealpathSync(nonNormalizedResolvedRoot);
36533
36626
  } catch {}
36534
36627
  const resolvedRoot = normalizePath(nonNormalizedResolvedRoot);
@@ -36607,8 +36700,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36607
36700
  if (envDir !== false) envDir = config.envDir ? normalizePath(path.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
36608
36701
  const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config));
36609
36702
  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.`);
36703
+ if (!isNodeEnvSet && userNodeEnv) {
36704
+ if (userNodeEnv === "development") process.env.NODE_ENV = "development";
36705
+ 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.`);
36706
+ }
36612
36707
  const isProduction = process.env.NODE_ENV === "production";
36613
36708
  const resolvedBase = config.base === "" || config.base === "./" ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
36614
36709
  const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
@@ -36678,9 +36773,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36678
36773
  if (Array.isArray(server.allowedHosts)) server.allowedHosts.push(...additionalAllowedHosts);
36679
36774
  if (Array.isArray(preview.allowedHosts)) preview.allowedHosts.push(...additionalAllowedHosts);
36680
36775
  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."));
36776
+ if (config.esbuild) {
36777
+ 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)}\``);
36778
+ else oxc = convertEsbuildConfigToOxcConfig(config.esbuild, logger);
36779
+ } 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
36780
  const experimental = mergeWithDefaults(configDefaults.experimental, config.experimental ?? {});
36685
36781
  if (command === "serve" && experimental.bundledDev) experimental.renderBuiltUrl = void 0;
36686
36782
  const resolvedDevToolsConfig = await resolveDevToolsConfig(config.devtools, server.host, logger);
@@ -36931,6 +37027,7 @@ async function bundleConfigFile(fileName, isESM) {
36931
37027
  const importMetaUrlVarName = "__vite_injected_original_import_meta_url";
36932
37028
  const importMetaResolveVarName = "__vite_injected_original_import_meta_resolve";
36933
37029
  const importMetaResolveRegex = /import\.meta\s*\.\s*resolve/;
37030
+ const configFileRegex = /\.[cm]?[jt]s$/;
36934
37031
  const nativeIncompatibilities = [];
36935
37032
  const bundle = await rolldown({
36936
37033
  input: fileName,
@@ -36989,16 +37086,18 @@ async function bundleConfigFile(fileName, isESM) {
36989
37086
  {
36990
37087
  name: "inject-file-scope-variables",
36991
37088
  transform: {
36992
- filter: { id: /\.[cm]?[jt]s$/ },
37089
+ filter: { id: configFileRegex },
36993
37090
  handler(code, id) {
36994
37091
  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') };`;
37092
+ if (importMetaResolveRegex.test(code)) {
37093
+ if (isESM) {
37094
+ if (!importMetaResolverRegistered) {
37095
+ importMetaResolverRegistered = true;
37096
+ createImportMetaResolver();
37097
+ }
37098
+ injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => (${importMetaResolveWithCustomHookString})(specifier, importer);`;
37099
+ } else injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => { throw new Error('import.meta.resolve is not supported in CJS config files') };`;
37100
+ }
37002
37101
  let injectedContents;
37003
37102
  if (code.startsWith("#!")) {
37004
37103
  const fileStartIndex = getFileStartIndex(code);
@@ -37017,8 +37116,8 @@ async function bundleConfigFile(fileName, isESM) {
37017
37116
  const result = await bundle.generate({
37018
37117
  format: isESM ? "esm" : "cjs",
37019
37118
  sourcemap: "inline",
37020
- sourcemapPathTransform(relative) {
37021
- return path.resolve(fileName, relative);
37119
+ sourcemapPathTransform(relative, sourcemapPath) {
37120
+ return path.resolve(path.dirname(sourcemapPath), relative);
37022
37121
  },
37023
37122
  codeSplitting: false
37024
37123
  });