@voidzero-dev/vite-plus-core 0.1.20-alpha.0 → 0.1.20-alpha.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.
Files changed (48) hide show
  1. package/LICENSE +23 -538
  2. package/dist/rolldown/cli.mjs +6 -6
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +2 -2
  6. package/dist/rolldown/experimental-index.mjs +8 -8
  7. package/dist/rolldown/filter-index.d.mts +1 -1
  8. package/dist/rolldown/index.d.mts +1 -1
  9. package/dist/rolldown/index.mjs +4 -4
  10. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  11. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  12. package/dist/rolldown/parse-ast-index.mjs +1 -1
  13. package/dist/rolldown/plugins-index.d.mts +2 -2
  14. package/dist/rolldown/plugins-index.mjs +2 -2
  15. package/dist/rolldown/shared/{bindingify-input-options-CQLSwbb0.mjs → bindingify-input-options-CwT4BXgL.mjs} +4 -4
  16. package/dist/rolldown/shared/{constructors-Dzji6NUq.mjs → constructors-C2EWPKW3.mjs} +1 -1
  17. package/dist/rolldown/shared/{constructors-C29s6i8O.d.mts → constructors-D0W3rNfA.d.mts} +1 -1
  18. package/dist/rolldown/shared/{define-config-DmrIgjVV.d.mts → define-config-5HJ1b9vG.d.mts} +14 -1
  19. package/dist/rolldown/shared/{error-DAA7ncC5.mjs → error-DL-e8-oE.mjs} +1 -1
  20. package/dist/rolldown/shared/{load-config-DKK5aKL7.mjs → load-config-DJUKhe3_.mjs} +1 -1
  21. package/dist/rolldown/shared/{normalize-string-or-regex-E9GT23QI.mjs → normalize-string-or-regex-CbQQ69gT.mjs} +1 -1
  22. package/dist/rolldown/shared/{parse-C4SGmMNT.mjs → parse-BG8jtBbb.mjs} +1 -1
  23. package/dist/rolldown/shared/{resolve-tsconfig-BVTabsge.mjs → resolve-tsconfig-CfYpGzid.mjs} +2 -2
  24. package/dist/rolldown/shared/{rolldown-DN-NFVZl.mjs → rolldown-DLFt25hZ.mjs} +1 -1
  25. package/dist/rolldown/shared/{rolldown-build-B-H35squ.mjs → rolldown-build-DrXmg2RO.mjs} +4 -4
  26. package/dist/rolldown/shared/{watch-DKEzXLor.mjs → watch-MZrSsVh8.mjs} +4 -4
  27. package/dist/rolldown/utils-index.mjs +2 -2
  28. package/dist/tsdown/{build-OX8uszs6-4hNTeOrB.js → build-CgGnBlCD-Cyywno42.js} +59 -53
  29. package/dist/tsdown/{debug-CLlnG64L-CuCVzZmG.js → debug-CLlnG64L-Dn9UYJ-T.js} +2 -2
  30. package/dist/tsdown/{detect-DN3DXXYt-DtgPLlRO.js → detect-DN3DXXYt-VBvyr4oU.js} +1 -1
  31. package/dist/tsdown/{dist-CrrE8ZBn.js → dist-CaWgsVeS.js} +13 -13
  32. package/dist/tsdown/{dist-D_AJtdxQ.js → dist-CbhZqEsp.js} +3 -3
  33. package/dist/tsdown/{dist-DSi2MWPQ.js → dist-DL4hnQY2.js} +1 -1
  34. package/dist/tsdown/index-types.d.ts +277 -20353
  35. package/dist/tsdown/index.js +4 -4
  36. package/dist/tsdown/{main-BsfiKQP8.js → main-DZy5NlsL.js} +4 -4
  37. package/dist/tsdown/npm_entry_picomatch.cjs +6 -0
  38. package/dist/tsdown/run.js +3 -3
  39. package/dist/vite/client/client.mjs +17 -15
  40. package/dist/vite/node/chunks/dist.js +1 -1
  41. package/dist/vite/node/chunks/dist2.js +13 -0
  42. package/dist/vite/node/chunks/logger.js +1 -1
  43. package/dist/vite/node/chunks/node.js +475 -435
  44. package/dist/vite/node/index.d.ts +3 -3
  45. package/dist/vite/node/module-runner.d.ts +1 -1
  46. package/dist/vite/node/module-runner.js +2 -2
  47. package/package.json +10 -10
  48. /package/dist/rolldown/shared/{binding-DI_PGVIh.mjs → binding-BeU_1iEk.mjs} +0 -0
@@ -24,13 +24,13 @@ import { dev, oxcRuntimePlugin, resolveTsconfig, scan, viteAliasPlugin, viteBuil
24
24
  import readline from "node:readline";
25
25
  import { MessageChannel, Worker } from "node:worker_threads";
26
26
  import isModuleSyncConditionEnabled from "#module-sync-enabled";
27
- import assert from "node:assert";
28
- import process$1 from "node:process";
29
- import v8 from "node:v8";
30
27
  import * as nativeFs from "fs";
31
28
  import { readdir, readdirSync, realpath, realpathSync, stat, statSync } from "fs";
32
29
  import { fileURLToPath as fileURLToPath$1 } from "url";
33
30
  import { createRequire as createRequire$1 } from "module";
31
+ import assert from "node:assert";
32
+ import process$1 from "node:process";
33
+ import v8 from "node:v8";
34
34
  import { EventEmitter } from "node:events";
35
35
  import { STATUS_CODES, createServer, get } from "node:http";
36
36
  import { createServer as createServer$1, get as get$1 } from "node:https";
@@ -167,6 +167,9 @@ var require_constants$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
167
167
  CHAR_UNDERSCORE: 95,
168
168
  CHAR_VERTICAL_LINE: 124,
169
169
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
170
+ /**
171
+ * Create EXTGLOB_CHARS
172
+ */
170
173
  extglobChars(chars) {
171
174
  return {
172
175
  "!": {
@@ -196,6 +199,9 @@ var require_constants$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
196
199
  }
197
200
  };
198
201
  },
202
+ /**
203
+ * Create GLOB_CHARS
204
+ */
199
205
  globChars(win32) {
200
206
  return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
201
207
  }
@@ -5053,405 +5059,6 @@ function f(e, r, t) {
5053
5059
  if (e.imports) return n$1(e.name, e.imports, r, t);
5054
5060
  }
5055
5061
  //#endregion
5056
- //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
5057
- const HASH_RE = /#/g;
5058
- const AMPERSAND_RE = /&/g;
5059
- const SLASH_RE = /\//g;
5060
- const EQUAL_RE = /=/g;
5061
- const PLUS_RE = /\+/g;
5062
- const ENC_CARET_RE = /%5e/gi;
5063
- const ENC_BACKTICK_RE = /%60/gi;
5064
- const ENC_PIPE_RE = /%7c/gi;
5065
- const ENC_SPACE_RE = /%20/gi;
5066
- function encode(text) {
5067
- return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
5068
- }
5069
- function encodeQueryValue(input) {
5070
- return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
5071
- }
5072
- function encodeQueryKey(text) {
5073
- return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
5074
- }
5075
- function encodeQueryItem(key, value) {
5076
- if (typeof value === "number" || typeof value === "boolean") value = String(value);
5077
- if (!value) return encodeQueryKey(key);
5078
- if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
5079
- return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
5080
- }
5081
- function stringifyQuery(query) {
5082
- return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
5083
- }
5084
- new Set(builtinModules);
5085
- function clearImports(imports) {
5086
- return (imports || "").replace(/\/\/[^\n]*\n|\/\*.*\*\//g, "").replace(/\s+/g, " ");
5087
- }
5088
- function getImportNames(cleanedImports) {
5089
- const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
5090
- return {
5091
- namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
5092
- defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
5093
- };
5094
- }
5095
- /**
5096
- * @typedef ErrnoExceptionFields
5097
- * @property {number | undefined} [errnode]
5098
- * @property {string | undefined} [code]
5099
- * @property {string | undefined} [path]
5100
- * @property {string | undefined} [syscall]
5101
- * @property {string | undefined} [url]
5102
- *
5103
- * @typedef {Error & ErrnoExceptionFields} ErrnoException
5104
- */
5105
- const own$1 = {}.hasOwnProperty;
5106
- const classRegExp = /^([A-Z][a-z\d]*)+$/;
5107
- const kTypes = new Set([
5108
- "string",
5109
- "function",
5110
- "number",
5111
- "object",
5112
- "Function",
5113
- "Object",
5114
- "boolean",
5115
- "bigint",
5116
- "symbol"
5117
- ]);
5118
- const codes = {};
5119
- /**
5120
- * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
5121
- * We cannot use Intl.ListFormat because it's not available in
5122
- * --without-intl builds.
5123
- *
5124
- * @param {Array<string>} array
5125
- * An array of strings.
5126
- * @param {string} [type]
5127
- * The list type to be inserted before the last element.
5128
- * @returns {string}
5129
- */
5130
- function formatList(array, type = "and") {
5131
- return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array[array.length - 1]}`;
5132
- }
5133
- /** @type {Map<string, MessageFunction | string>} */
5134
- const messages = /* @__PURE__ */ new Map();
5135
- const nodeInternalPrefix = "__node_internal_";
5136
- /** @type {number} */
5137
- let userStackTraceLimit;
5138
- codes.ERR_INVALID_ARG_TYPE = createError(
5139
- "ERR_INVALID_ARG_TYPE",
5140
- /**
5141
- * @param {string} name
5142
- * @param {Array<string> | string} expected
5143
- * @param {unknown} actual
5144
- */
5145
- (name, expected, actual) => {
5146
- assert.ok(typeof name === "string", "'name' must be a string");
5147
- if (!Array.isArray(expected)) expected = [expected];
5148
- let message = "The ";
5149
- if (name.endsWith(" argument")) message += `${name} `;
5150
- else {
5151
- const type = name.includes(".") ? "property" : "argument";
5152
- message += `"${name}" ${type} `;
5153
- }
5154
- message += "must be ";
5155
- /** @type {Array<string>} */
5156
- const types = [];
5157
- /** @type {Array<string>} */
5158
- const instances = [];
5159
- /** @type {Array<string>} */
5160
- const other = [];
5161
- for (const value of expected) {
5162
- assert.ok(typeof value === "string", "All expected entries have to be of type string");
5163
- if (kTypes.has(value)) types.push(value.toLowerCase());
5164
- else if (classRegExp.exec(value) === null) {
5165
- assert.ok(value !== "object", "The value \"object\" should be written as \"Object\"");
5166
- other.push(value);
5167
- } else instances.push(value);
5168
- }
5169
- if (instances.length > 0) {
5170
- const pos = types.indexOf("object");
5171
- if (pos !== -1) {
5172
- types.slice(pos, 1);
5173
- instances.push("Object");
5174
- }
5175
- }
5176
- if (types.length > 0) {
5177
- message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
5178
- if (instances.length > 0 || other.length > 0) message += " or ";
5179
- }
5180
- if (instances.length > 0) {
5181
- message += `an instance of ${formatList(instances, "or")}`;
5182
- if (other.length > 0) message += " or ";
5183
- }
5184
- if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
5185
- else {
5186
- if (other[0].toLowerCase() !== other[0]) message += "an ";
5187
- message += `${other[0]}`;
5188
- }
5189
- message += `. Received ${determineSpecificType(actual)}`;
5190
- return message;
5191
- },
5192
- TypeError
5193
- );
5194
- codes.ERR_INVALID_MODULE_SPECIFIER = createError(
5195
- "ERR_INVALID_MODULE_SPECIFIER",
5196
- /**
5197
- * @param {string} request
5198
- * @param {string} reason
5199
- * @param {string} [base]
5200
- */
5201
- (request, reason, base = void 0) => {
5202
- return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
5203
- },
5204
- TypeError
5205
- );
5206
- codes.ERR_INVALID_PACKAGE_CONFIG = createError(
5207
- "ERR_INVALID_PACKAGE_CONFIG",
5208
- /**
5209
- * @param {string} path
5210
- * @param {string} [base]
5211
- * @param {string} [message]
5212
- */
5213
- (path, base, message) => {
5214
- return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
5215
- },
5216
- Error
5217
- );
5218
- codes.ERR_INVALID_PACKAGE_TARGET = createError(
5219
- "ERR_INVALID_PACKAGE_TARGET",
5220
- /**
5221
- * @param {string} packagePath
5222
- * @param {string} key
5223
- * @param {unknown} target
5224
- * @param {boolean} [isImport=false]
5225
- * @param {string} [base]
5226
- */
5227
- (packagePath, key, target, isImport = false, base = void 0) => {
5228
- const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
5229
- if (key === ".") {
5230
- assert.ok(isImport === false);
5231
- return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
5232
- }
5233
- return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
5234
- },
5235
- Error
5236
- );
5237
- codes.ERR_MODULE_NOT_FOUND = createError(
5238
- "ERR_MODULE_NOT_FOUND",
5239
- /**
5240
- * @param {string} path
5241
- * @param {string} base
5242
- * @param {boolean} [exactUrl]
5243
- */
5244
- (path, base, exactUrl = false) => {
5245
- return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
5246
- },
5247
- Error
5248
- );
5249
- codes.ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
5250
- codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
5251
- "ERR_PACKAGE_IMPORT_NOT_DEFINED",
5252
- /**
5253
- * @param {string} specifier
5254
- * @param {string} packagePath
5255
- * @param {string} base
5256
- */
5257
- (specifier, packagePath, base) => {
5258
- return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
5259
- },
5260
- TypeError
5261
- );
5262
- codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
5263
- "ERR_PACKAGE_PATH_NOT_EXPORTED",
5264
- /**
5265
- * @param {string} packagePath
5266
- * @param {string} subpath
5267
- * @param {string} [base]
5268
- */
5269
- (packagePath, subpath, base = void 0) => {
5270
- if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
5271
- return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
5272
- },
5273
- Error
5274
- );
5275
- codes.ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
5276
- codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError);
5277
- codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
5278
- "ERR_UNKNOWN_FILE_EXTENSION",
5279
- /**
5280
- * @param {string} extension
5281
- * @param {string} path
5282
- */
5283
- (extension, path) => {
5284
- return `Unknown file extension "${extension}" for ${path}`;
5285
- },
5286
- TypeError
5287
- );
5288
- codes.ERR_INVALID_ARG_VALUE = createError(
5289
- "ERR_INVALID_ARG_VALUE",
5290
- /**
5291
- * @param {string} name
5292
- * @param {unknown} value
5293
- * @param {string} [reason='is invalid']
5294
- */
5295
- (name, value, reason = "is invalid") => {
5296
- let inspected = inspect(value);
5297
- if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
5298
- return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
5299
- },
5300
- TypeError
5301
- );
5302
- /**
5303
- * Utility function for registering the error codes. Only used here. Exported
5304
- * *only* to allow for testing.
5305
- * @param {string} sym
5306
- * @param {MessageFunction | string} value
5307
- * @param {ErrorConstructor} constructor
5308
- * @returns {new (...parameters: Array<any>) => Error}
5309
- */
5310
- function createError(sym, value, constructor) {
5311
- messages.set(sym, value);
5312
- return makeNodeErrorWithCode(constructor, sym);
5313
- }
5314
- /**
5315
- * @param {ErrorConstructor} Base
5316
- * @param {string} key
5317
- * @returns {ErrorConstructor}
5318
- */
5319
- function makeNodeErrorWithCode(Base, key) {
5320
- return NodeError;
5321
- /**
5322
- * @param {Array<unknown>} parameters
5323
- */
5324
- function NodeError(...parameters) {
5325
- const limit = Error.stackTraceLimit;
5326
- if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
5327
- const error = new Base();
5328
- if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
5329
- const message = getMessage(key, parameters, error);
5330
- Object.defineProperties(error, {
5331
- message: {
5332
- value: message,
5333
- enumerable: false,
5334
- writable: true,
5335
- configurable: true
5336
- },
5337
- toString: {
5338
- value() {
5339
- return `${this.name} [${key}]: ${this.message}`;
5340
- },
5341
- enumerable: false,
5342
- writable: true,
5343
- configurable: true
5344
- }
5345
- });
5346
- captureLargerStackTrace(error);
5347
- error.code = key;
5348
- return error;
5349
- }
5350
- }
5351
- /**
5352
- * @returns {boolean}
5353
- */
5354
- function isErrorStackTraceLimitWritable() {
5355
- try {
5356
- if (v8.startupSnapshot.isBuildingSnapshot()) return false;
5357
- } catch {}
5358
- const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
5359
- if (desc === void 0) return Object.isExtensible(Error);
5360
- return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
5361
- }
5362
- /**
5363
- * This function removes unnecessary frames from Node.js core errors.
5364
- * @template {(...parameters: unknown[]) => unknown} T
5365
- * @param {T} wrappedFunction
5366
- * @returns {T}
5367
- */
5368
- function hideStackFrames(wrappedFunction) {
5369
- const hidden = nodeInternalPrefix + wrappedFunction.name;
5370
- Object.defineProperty(wrappedFunction, "name", { value: hidden });
5371
- return wrappedFunction;
5372
- }
5373
- const captureLargerStackTrace = hideStackFrames(
5374
- /**
5375
- * @param {Error} error
5376
- * @returns {Error}
5377
- */
5378
- function(error) {
5379
- const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
5380
- if (stackTraceLimitIsWritable) {
5381
- userStackTraceLimit = Error.stackTraceLimit;
5382
- Error.stackTraceLimit = Number.POSITIVE_INFINITY;
5383
- }
5384
- Error.captureStackTrace(error);
5385
- if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
5386
- return error;
5387
- }
5388
- );
5389
- /**
5390
- * @param {string} key
5391
- * @param {Array<unknown>} parameters
5392
- * @param {Error} self
5393
- * @returns {string}
5394
- */
5395
- function getMessage(key, parameters, self) {
5396
- const message = messages.get(key);
5397
- assert.ok(message !== void 0, "expected `message` to be found");
5398
- if (typeof message === "function") {
5399
- assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
5400
- return Reflect.apply(message, self, parameters);
5401
- }
5402
- const regex = /%[dfijoOs]/g;
5403
- let expectedLength = 0;
5404
- while (regex.exec(message) !== null) expectedLength++;
5405
- assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
5406
- if (parameters.length === 0) return message;
5407
- parameters.unshift(message);
5408
- return Reflect.apply(format, null, parameters);
5409
- }
5410
- /**
5411
- * Determine the specific type of a value for type-mismatch errors.
5412
- * @param {unknown} value
5413
- * @returns {string}
5414
- */
5415
- function determineSpecificType(value) {
5416
- if (value === null || value === void 0) return String(value);
5417
- if (typeof value === "function" && value.name) return `function ${value.name}`;
5418
- if (typeof value === "object") {
5419
- if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
5420
- return `${inspect(value, { depth: -1 })}`;
5421
- }
5422
- let inspected = inspect(value, { colors: false });
5423
- if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
5424
- return `type ${typeof value} (${inspected})`;
5425
- }
5426
- const DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
5427
- new Set(DEFAULT_CONDITIONS);
5428
- const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;|\})import\s*(?:[\s"']*(?<imports>[\p{L}\p{M}\w\t\n\r $*,/{}@.]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][\s;]*/gmu;
5429
- const TYPE_RE = /^\s*?type\s/;
5430
- function parseStaticImport(matched) {
5431
- const cleanedImports = clearImports(matched.imports);
5432
- const namedImports = {};
5433
- const _matches = cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || [];
5434
- for (const namedImport of _matches) {
5435
- const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
5436
- const source = _match?.[1] || namedImport.trim();
5437
- const importName = _match?.[2] || source;
5438
- if (source && !TYPE_RE.test(source)) namedImports[source] = importName;
5439
- }
5440
- const { namespacedImport, defaultImport } = getImportNames(cleanedImports);
5441
- return {
5442
- ...matched,
5443
- defaultImport,
5444
- namespacedImport,
5445
- namedImports
5446
- };
5447
- }
5448
- const ESM_RE = /(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
5449
- const COMMENT_RE = /\/\*.+?\*\/|\/\/.*(?=[nr])/g;
5450
- function hasESMSyntax(code, opts = {}) {
5451
- if (opts.stripComments) code = code.replace(COMMENT_RE, "");
5452
- return ESM_RE.test(code);
5453
- }
5454
- //#endregion
5455
5062
  //#region ../../node_modules/.pnpm/es-module-lexer@1.7.0/node_modules/es-module-lexer/dist/lexer.js
5456
5063
  var ImportType;
5457
5064
  (function(A) {
@@ -7550,6 +7157,400 @@ function throwFileNotFoundInOptimizedDep(id) {
7550
7157
  throw err;
7551
7158
  }
7552
7159
  //#endregion
7160
+ //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
7161
+ const HASH_RE = /#/g;
7162
+ const AMPERSAND_RE = /&/g;
7163
+ const SLASH_RE = /\//g;
7164
+ const EQUAL_RE = /=/g;
7165
+ const PLUS_RE = /\+/g;
7166
+ const ENC_CARET_RE = /%5e/gi;
7167
+ const ENC_BACKTICK_RE = /%60/gi;
7168
+ const ENC_PIPE_RE = /%7c/gi;
7169
+ const ENC_SPACE_RE = /%20/gi;
7170
+ function encode(text) {
7171
+ return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
7172
+ }
7173
+ function encodeQueryValue(input) {
7174
+ return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
7175
+ }
7176
+ function encodeQueryKey(text) {
7177
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
7178
+ }
7179
+ function encodeQueryItem(key, value) {
7180
+ if (typeof value === "number" || typeof value === "boolean") value = String(value);
7181
+ if (!value) return encodeQueryKey(key);
7182
+ if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
7183
+ return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
7184
+ }
7185
+ function stringifyQuery(query) {
7186
+ return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
7187
+ }
7188
+ new Set(builtinModules);
7189
+ function clearImports(imports) {
7190
+ return (imports || "").replace(/\/\/[^\n]*\n|\/\*.*\*\//g, "").replace(/\s+/g, " ");
7191
+ }
7192
+ function getImportNames(cleanedImports) {
7193
+ const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
7194
+ return {
7195
+ namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
7196
+ defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
7197
+ };
7198
+ }
7199
+ /**
7200
+ * @typedef ErrnoExceptionFields
7201
+ * @property {number | undefined} [errnode]
7202
+ * @property {string | undefined} [code]
7203
+ * @property {string | undefined} [path]
7204
+ * @property {string | undefined} [syscall]
7205
+ * @property {string | undefined} [url]
7206
+ *
7207
+ * @typedef {Error & ErrnoExceptionFields} ErrnoException
7208
+ */
7209
+ const own$1 = {}.hasOwnProperty;
7210
+ const classRegExp = /^([A-Z][a-z\d]*)+$/;
7211
+ const kTypes = new Set([
7212
+ "string",
7213
+ "function",
7214
+ "number",
7215
+ "object",
7216
+ "Function",
7217
+ "Object",
7218
+ "boolean",
7219
+ "bigint",
7220
+ "symbol"
7221
+ ]);
7222
+ const codes = {};
7223
+ /**
7224
+ * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
7225
+ * We cannot use Intl.ListFormat because it's not available in
7226
+ * --without-intl builds.
7227
+ *
7228
+ * @param {Array<string>} array
7229
+ * An array of strings.
7230
+ * @param {string} [type]
7231
+ * The list type to be inserted before the last element.
7232
+ * @returns {string}
7233
+ */
7234
+ function formatList(array, type = "and") {
7235
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array[array.length - 1]}`;
7236
+ }
7237
+ /** @type {Map<string, MessageFunction | string>} */
7238
+ const messages = /* @__PURE__ */ new Map();
7239
+ const nodeInternalPrefix = "__node_internal_";
7240
+ /** @type {number} */
7241
+ let userStackTraceLimit;
7242
+ codes.ERR_INVALID_ARG_TYPE = createError(
7243
+ "ERR_INVALID_ARG_TYPE",
7244
+ /**
7245
+ * @param {string} name
7246
+ * @param {Array<string> | string} expected
7247
+ * @param {unknown} actual
7248
+ */
7249
+ (name, expected, actual) => {
7250
+ assert.ok(typeof name === "string", "'name' must be a string");
7251
+ if (!Array.isArray(expected)) expected = [expected];
7252
+ let message = "The ";
7253
+ if (name.endsWith(" argument")) message += `${name} `;
7254
+ else {
7255
+ const type = name.includes(".") ? "property" : "argument";
7256
+ message += `"${name}" ${type} `;
7257
+ }
7258
+ message += "must be ";
7259
+ /** @type {Array<string>} */
7260
+ const types = [];
7261
+ /** @type {Array<string>} */
7262
+ const instances = [];
7263
+ /** @type {Array<string>} */
7264
+ const other = [];
7265
+ for (const value of expected) {
7266
+ assert.ok(typeof value === "string", "All expected entries have to be of type string");
7267
+ if (kTypes.has(value)) types.push(value.toLowerCase());
7268
+ else if (classRegExp.exec(value) === null) {
7269
+ assert.ok(value !== "object", "The value \"object\" should be written as \"Object\"");
7270
+ other.push(value);
7271
+ } else instances.push(value);
7272
+ }
7273
+ if (instances.length > 0) {
7274
+ const pos = types.indexOf("object");
7275
+ if (pos !== -1) {
7276
+ types.slice(pos, 1);
7277
+ instances.push("Object");
7278
+ }
7279
+ }
7280
+ if (types.length > 0) {
7281
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
7282
+ if (instances.length > 0 || other.length > 0) message += " or ";
7283
+ }
7284
+ if (instances.length > 0) {
7285
+ message += `an instance of ${formatList(instances, "or")}`;
7286
+ if (other.length > 0) message += " or ";
7287
+ }
7288
+ if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
7289
+ else {
7290
+ if (other[0].toLowerCase() !== other[0]) message += "an ";
7291
+ message += `${other[0]}`;
7292
+ }
7293
+ message += `. Received ${determineSpecificType(actual)}`;
7294
+ return message;
7295
+ },
7296
+ TypeError
7297
+ );
7298
+ codes.ERR_INVALID_MODULE_SPECIFIER = createError(
7299
+ "ERR_INVALID_MODULE_SPECIFIER",
7300
+ /**
7301
+ * @param {string} request
7302
+ * @param {string} reason
7303
+ * @param {string} [base]
7304
+ */
7305
+ (request, reason, base = void 0) => {
7306
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
7307
+ },
7308
+ TypeError
7309
+ );
7310
+ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
7311
+ "ERR_INVALID_PACKAGE_CONFIG",
7312
+ /**
7313
+ * @param {string} path
7314
+ * @param {string} [base]
7315
+ * @param {string} [message]
7316
+ */
7317
+ (path, base, message) => {
7318
+ return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
7319
+ },
7320
+ Error
7321
+ );
7322
+ codes.ERR_INVALID_PACKAGE_TARGET = createError(
7323
+ "ERR_INVALID_PACKAGE_TARGET",
7324
+ /**
7325
+ * @param {string} packagePath
7326
+ * @param {string} key
7327
+ * @param {unknown} target
7328
+ * @param {boolean} [isImport=false]
7329
+ * @param {string} [base]
7330
+ */
7331
+ (packagePath, key, target, isImport = false, base = void 0) => {
7332
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
7333
+ if (key === ".") {
7334
+ assert.ok(isImport === false);
7335
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
7336
+ }
7337
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
7338
+ },
7339
+ Error
7340
+ );
7341
+ codes.ERR_MODULE_NOT_FOUND = createError(
7342
+ "ERR_MODULE_NOT_FOUND",
7343
+ /**
7344
+ * @param {string} path
7345
+ * @param {string} base
7346
+ * @param {boolean} [exactUrl]
7347
+ */
7348
+ (path, base, exactUrl = false) => {
7349
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
7350
+ },
7351
+ Error
7352
+ );
7353
+ codes.ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
7354
+ codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
7355
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
7356
+ /**
7357
+ * @param {string} specifier
7358
+ * @param {string} packagePath
7359
+ * @param {string} base
7360
+ */
7361
+ (specifier, packagePath, base) => {
7362
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
7363
+ },
7364
+ TypeError
7365
+ );
7366
+ codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
7367
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
7368
+ /**
7369
+ * @param {string} packagePath
7370
+ * @param {string} subpath
7371
+ * @param {string} [base]
7372
+ */
7373
+ (packagePath, subpath, base = void 0) => {
7374
+ if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
7375
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
7376
+ },
7377
+ Error
7378
+ );
7379
+ codes.ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
7380
+ codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError);
7381
+ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
7382
+ "ERR_UNKNOWN_FILE_EXTENSION",
7383
+ /**
7384
+ * @param {string} extension
7385
+ * @param {string} path
7386
+ */
7387
+ (extension, path) => {
7388
+ return `Unknown file extension "${extension}" for ${path}`;
7389
+ },
7390
+ TypeError
7391
+ );
7392
+ codes.ERR_INVALID_ARG_VALUE = createError(
7393
+ "ERR_INVALID_ARG_VALUE",
7394
+ /**
7395
+ * @param {string} name
7396
+ * @param {unknown} value
7397
+ * @param {string} [reason='is invalid']
7398
+ */
7399
+ (name, value, reason = "is invalid") => {
7400
+ let inspected = inspect(value);
7401
+ if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
7402
+ return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
7403
+ },
7404
+ TypeError
7405
+ );
7406
+ /**
7407
+ * Utility function for registering the error codes. Only used here. Exported
7408
+ * *only* to allow for testing.
7409
+ * @param {string} sym
7410
+ * @param {MessageFunction | string} value
7411
+ * @param {ErrorConstructor} constructor
7412
+ * @returns {new (...parameters: Array<any>) => Error}
7413
+ */
7414
+ function createError(sym, value, constructor) {
7415
+ messages.set(sym, value);
7416
+ return makeNodeErrorWithCode(constructor, sym);
7417
+ }
7418
+ /**
7419
+ * @param {ErrorConstructor} Base
7420
+ * @param {string} key
7421
+ * @returns {ErrorConstructor}
7422
+ */
7423
+ function makeNodeErrorWithCode(Base, key) {
7424
+ return NodeError;
7425
+ /**
7426
+ * @param {Array<unknown>} parameters
7427
+ */
7428
+ function NodeError(...parameters) {
7429
+ const limit = Error.stackTraceLimit;
7430
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
7431
+ const error = new Base();
7432
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
7433
+ const message = getMessage(key, parameters, error);
7434
+ Object.defineProperties(error, {
7435
+ message: {
7436
+ value: message,
7437
+ enumerable: false,
7438
+ writable: true,
7439
+ configurable: true
7440
+ },
7441
+ toString: {
7442
+ /** @this {Error} */
7443
+ value() {
7444
+ return `${this.name} [${key}]: ${this.message}`;
7445
+ },
7446
+ enumerable: false,
7447
+ writable: true,
7448
+ configurable: true
7449
+ }
7450
+ });
7451
+ captureLargerStackTrace(error);
7452
+ error.code = key;
7453
+ return error;
7454
+ }
7455
+ }
7456
+ /**
7457
+ * @returns {boolean}
7458
+ */
7459
+ function isErrorStackTraceLimitWritable() {
7460
+ try {
7461
+ if (v8.startupSnapshot.isBuildingSnapshot()) return false;
7462
+ } catch {}
7463
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
7464
+ if (desc === void 0) return Object.isExtensible(Error);
7465
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
7466
+ }
7467
+ /**
7468
+ * This function removes unnecessary frames from Node.js core errors.
7469
+ * @template {(...parameters: unknown[]) => unknown} T
7470
+ * @param {T} wrappedFunction
7471
+ * @returns {T}
7472
+ */
7473
+ function hideStackFrames(wrappedFunction) {
7474
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
7475
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
7476
+ return wrappedFunction;
7477
+ }
7478
+ const captureLargerStackTrace = hideStackFrames(
7479
+ /**
7480
+ * @param {Error} error
7481
+ * @returns {Error}
7482
+ */
7483
+ function(error) {
7484
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
7485
+ if (stackTraceLimitIsWritable) {
7486
+ userStackTraceLimit = Error.stackTraceLimit;
7487
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
7488
+ }
7489
+ Error.captureStackTrace(error);
7490
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
7491
+ return error;
7492
+ }
7493
+ );
7494
+ /**
7495
+ * @param {string} key
7496
+ * @param {Array<unknown>} parameters
7497
+ * @param {Error} self
7498
+ * @returns {string}
7499
+ */
7500
+ function getMessage(key, parameters, self) {
7501
+ const message = messages.get(key);
7502
+ assert.ok(message !== void 0, "expected `message` to be found");
7503
+ if (typeof message === "function") {
7504
+ assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
7505
+ return Reflect.apply(message, self, parameters);
7506
+ }
7507
+ const regex = /%[dfijoOs]/g;
7508
+ let expectedLength = 0;
7509
+ while (regex.exec(message) !== null) expectedLength++;
7510
+ assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
7511
+ if (parameters.length === 0) return message;
7512
+ parameters.unshift(message);
7513
+ return Reflect.apply(format, null, parameters);
7514
+ }
7515
+ /**
7516
+ * Determine the specific type of a value for type-mismatch errors.
7517
+ * @param {unknown} value
7518
+ * @returns {string}
7519
+ */
7520
+ function determineSpecificType(value) {
7521
+ if (value === null || value === void 0) return String(value);
7522
+ if (typeof value === "function" && value.name) return `function ${value.name}`;
7523
+ if (typeof value === "object") {
7524
+ if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
7525
+ return `${inspect(value, { depth: -1 })}`;
7526
+ }
7527
+ let inspected = inspect(value, { colors: false });
7528
+ if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
7529
+ return `type ${typeof value} (${inspected})`;
7530
+ }
7531
+ const DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
7532
+ new Set(DEFAULT_CONDITIONS);
7533
+ const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;|\})import\s*(?:[\s"']*(?<imports>[\p{L}\p{M}\w\t\n\r $*,/{}@.]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][\s;]*/gmu;
7534
+ const TYPE_RE = /^\s*?type\s/;
7535
+ function parseStaticImport(matched) {
7536
+ const cleanedImports = clearImports(matched.imports);
7537
+ const namedImports = {};
7538
+ const _matches = cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || [];
7539
+ for (const namedImport of _matches) {
7540
+ const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
7541
+ const source = _match?.[1] || namedImport.trim();
7542
+ const importName = _match?.[2] || source;
7543
+ if (source && !TYPE_RE.test(source)) namedImports[source] = importName;
7544
+ }
7545
+ const { namespacedImport, defaultImport } = getImportNames(cleanedImports);
7546
+ return {
7547
+ ...matched,
7548
+ defaultImport,
7549
+ namespacedImport,
7550
+ namedImports
7551
+ };
7552
+ }
7553
+ //#endregion
7553
7554
  //#region ../../vite/packages/vite/src/node/env.ts
7554
7555
  var import_main = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
7555
7556
  function _resolveEscapeSequences(value) {
@@ -9838,6 +9839,9 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9838
9839
  CHAR_VERTICAL_LINE: 124,
9839
9840
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
9840
9841
  SEP: path$13.sep,
9842
+ /**
9843
+ * Create EXTGLOB_CHARS
9844
+ */
9841
9845
  extglobChars(chars) {
9842
9846
  return {
9843
9847
  "!": {
@@ -9867,6 +9871,9 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9867
9871
  }
9868
9872
  };
9869
9873
  },
9874
+ /**
9875
+ * Create GLOB_CHARS
9876
+ */
9870
9877
  globChars(win32) {
9871
9878
  return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
9872
9879
  }
@@ -15586,7 +15593,10 @@ function ssrFixStacktrace(e, moduleGraph) {
15586
15593
  function createHMROptions(environment, options) {
15587
15594
  if (environment.config.server.hmr === false || options.hmr === false) return false;
15588
15595
  if (!("api" in environment.hot)) return false;
15589
- return { logger: options.hmr?.logger };
15596
+ return { logger: options.hmr?.logger ?? {
15597
+ debug: (...msg) => environment.logger.info(msg.join(" "), { timestamp: true }),
15598
+ error: (err) => environment.logger.error(err instanceof Error ? err.message : String(err), { timestamp: true })
15599
+ } };
15590
15600
  }
15591
15601
  const prepareStackTrace = { retrieveFile(id) {
15592
15602
  if (existsSync(id)) return readFileSync(id, "utf-8");
@@ -19139,6 +19149,18 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19139
19149
  ErrorEvent,
19140
19150
  Event,
19141
19151
  EventTarget: {
19152
+ /**
19153
+ * Register an event listener.
19154
+ *
19155
+ * @param {String} type A string representing the event type to listen for
19156
+ * @param {(Function|Object)} handler The listener to add
19157
+ * @param {Object} [options] An options object specifies characteristics about
19158
+ * the event listener
19159
+ * @param {Boolean} [options.once=false] A `Boolean` indicating that the
19160
+ * listener should be invoked at most once after being added. If `true`,
19161
+ * the listener would be automatically removed when invoked.
19162
+ * @public
19163
+ */
19142
19164
  addEventListener(type, handler, options = {}) {
19143
19165
  for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
19144
19166
  let wrapper;
@@ -19175,6 +19197,13 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19175
19197
  if (options.once) this.once(type, wrapper);
19176
19198
  else this.on(type, wrapper);
19177
19199
  },
19200
+ /**
19201
+ * Remove an event listener.
19202
+ *
19203
+ * @param {String} type A string representing the event type to remove
19204
+ * @param {(Function|Object)} handler The listener to remove
19205
+ * @public
19206
+ */
19178
19207
  removeEventListener(type, handler) {
19179
19208
  for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
19180
19209
  this.removeListener(type, listener);
@@ -24810,7 +24839,10 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
24810
24839
  /** @type {import('./index').Loader} */
24811
24840
  const dynamicImport = async (id) => {
24812
24841
  try {
24813
- return (await import(url.pathToFileURL(id).href)).default;
24842
+ return (await import(
24843
+ /* webpackIgnore: true */
24844
+ url.pathToFileURL(id).href
24845
+ )).default;
24814
24846
  } catch (e) {
24815
24847
  try {
24816
24848
  return requireFunc(id);
@@ -25908,8 +25940,10 @@ function getChunkOriginalFileName(chunk, root, isLegacy) {
25908
25940
  var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
25909
25941
  const decoder = new TextDecoder();
25910
25942
  const _cssConfigDefaults = Object.freeze({
25943
+ /** @experimental */
25911
25944
  transformer: "postcss",
25912
25945
  preprocessorMaxWorkers: true,
25946
+ /** @experimental */
25913
25947
  devSourcemap: false
25914
25948
  });
25915
25949
  const cssConfigDefaults = _cssConfigDefaults;
@@ -26111,7 +26145,7 @@ function cssPostPlugin(config) {
26111
26145
  if (modulesCode) code = modulesCode;
26112
26146
  else if (inlined) {
26113
26147
  let content = css;
26114
- if (config.build.cssMinify) content = await minifyCSS(content, config, true);
26148
+ if (config.build.cssMinify) content = await minifyCSS(content, config, true, id);
26115
26149
  code = `export default ${JSON.stringify(content)}`;
26116
26150
  } else code = "";
26117
26151
  return {
@@ -26815,13 +26849,14 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
26815
26849
  if (newUrl === false) return matched;
26816
26850
  return `@import ${matched.includes("url(") ? "url(" : ""}${wrap}${newUrl}${wrap}`;
26817
26851
  }
26818
- async function minifyCSS(css, config, inlined) {
26852
+ async function minifyCSS(css, config, inlined, filename = defaultCssBundleName) {
26819
26853
  if (config.build.cssMinify === "esbuild") {
26820
26854
  const { transform, formatMessages } = await importEsbuild();
26821
26855
  try {
26822
26856
  const { code, warnings } = await transform(css, {
26823
26857
  loader: "css",
26824
26858
  target: config.build.cssTarget || void 0,
26859
+ sourcefile: filename,
26825
26860
  ...resolveMinifyCssEsbuildOptions(config.esbuild || {})
26826
26861
  });
26827
26862
  if (warnings.length) {
@@ -26843,7 +26878,7 @@ async function minifyCSS(css, config, inlined) {
26843
26878
  ...config.css.lightningcss,
26844
26879
  targets: convertTargets(config.build.cssTarget),
26845
26880
  cssModules: void 0,
26846
- filename: defaultCssBundleName,
26881
+ filename,
26847
26882
  code: Buffer.from(css),
26848
26883
  minify: true
26849
26884
  });
@@ -27693,13 +27728,13 @@ function traverseNodes(node, visitor) {
27693
27728
  if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
27694
27729
  }
27695
27730
  async function traverseHtml(html, filePath, warn, visitor) {
27696
- const { parse } = await import("./dist.js");
27731
+ const { parse, ErrorCodes } = await import("./dist.js");
27697
27732
  const warnings = {};
27698
27733
  traverseNodes(parse(html, {
27699
27734
  scriptingEnabled: false,
27700
27735
  sourceCodeLocationInfo: true,
27701
27736
  onParseError: (e) => {
27702
- handleParseError(e, html, filePath, warnings);
27737
+ handleParseError(e, ErrorCodes, html, filePath, warnings);
27703
27738
  }
27704
27739
  }), visitor);
27705
27740
  for (const message of Object.values(warnings)) warn(import_picocolors.default.yellow(`\n${message}`));
@@ -27715,7 +27750,7 @@ function getScriptInfo(node) {
27715
27750
  if (p.name === "src") {
27716
27751
  if (!src) {
27717
27752
  src = p;
27718
- srcSourceCodeLocation = node.sourceCodeLocation?.attrs["src"];
27753
+ srcSourceCodeLocation = node.sourceCodeLocation?.attrs.src;
27719
27754
  }
27720
27755
  } else if (p.name === "type" && p.value === "module") isModule = true;
27721
27756
  else if (p.name === "async") isAsync = true;
@@ -27759,13 +27794,13 @@ function formatParseError(parserError, id, html) {
27759
27794
  }
27760
27795
  };
27761
27796
  }
27762
- function handleParseError(parserError, html, filePath, warnings) {
27797
+ function handleParseError(parserError, errorCodes, html, filePath, warnings) {
27763
27798
  switch (parserError.code) {
27764
- case "missing-doctype": return;
27765
- case "abandoned-head-element-child": return;
27766
- case "duplicate-attribute": return;
27767
- case "non-void-html-element-start-tag-with-trailing-solidus": return;
27768
- case "unexpected-question-mark-instead-of-tag-name": return;
27799
+ case errorCodes.missingDoctype: return;
27800
+ case errorCodes.abandonedHeadElementChild: return;
27801
+ case errorCodes.duplicateAttribute: return;
27802
+ case errorCodes.nonVoidHtmlElementStartTagWithTrailingSolidus: return;
27803
+ case errorCodes.unexpectedQuestionMarkInsteadOfTagName: return;
27769
27804
  }
27770
27805
  const parseError = formatParseError(parserError, filePath, html);
27771
27806
  warnings[parseError.code] ??= `Unable to parse HTML; ${parseError.message}\n at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` + parseError.frame;
@@ -28115,7 +28150,7 @@ function findNeedTransformStyleAttribute(node) {
28115
28150
  if (!attr) return void 0;
28116
28151
  return {
28117
28152
  attr,
28118
- location: node.sourceCodeLocation?.attrs?.["style"]
28153
+ location: node.sourceCodeLocation?.attrs?.style
28119
28154
  };
28120
28155
  }
28121
28156
  function extractImportExpressionFromClassicScript(scriptTextNode) {
@@ -29562,7 +29597,7 @@ function servePublicMiddleware(server, publicFiles) {
29562
29597
  }));
29563
29598
  const toFilePath = (url) => {
29564
29599
  let filePath = cleanUrl(url);
29565
- if (filePath.indexOf("%") !== -1) try {
29600
+ if (filePath.includes("%")) try {
29566
29601
  filePath = decodeURI(filePath);
29567
29602
  } catch {}
29568
29603
  return normalizePath$1(filePath);
@@ -31817,7 +31852,7 @@ async function _createServer(inlineConfig = {}, options) {
31817
31852
  if (config.base !== "/") middlewares.use(baseMiddleware(config.rawBase, !!middlewareMode));
31818
31853
  middlewares.use("/__open-in-editor", (0, import_launch_editor_middleware.default)());
31819
31854
  middlewares.use(function viteHMRPingMiddleware(req, res, next) {
31820
- if (req.headers["accept"] === "text/x-vite-ping") res.writeHead(204).end();
31855
+ if (req.headers.accept === "text/x-vite-ping") res.writeHead(204).end();
31821
31856
  else next();
31822
31857
  });
31823
31858
  if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
@@ -32131,7 +32166,7 @@ function getSortedPluginsByHotUpdateHook(plugins) {
32131
32166
  const sortedPlugins = [];
32132
32167
  let pre = 0, normal = 0, post = 0;
32133
32168
  for (const plugin of plugins) {
32134
- const hook = plugin["hotUpdate"] ?? plugin["handleHotUpdate"];
32169
+ const hook = plugin.hotUpdate ?? plugin.handleHotUpdate;
32135
32170
  if (hook) {
32136
32171
  if (typeof hook === "object") {
32137
32172
  if (hook.order === "pre") {
@@ -33782,7 +33817,7 @@ function buildImportAnalysisPlugin(config) {
33782
33817
  return [{
33783
33818
  name: "vite:build-import-analysis",
33784
33819
  renderChunk(code, _, { format }) {
33785
- if (code.indexOf(isModernFlag) > -1) {
33820
+ if (code.includes(isModernFlag)) {
33786
33821
  const re = new RegExp(isModernFlag, "g");
33787
33822
  const isModern = String(format === "es");
33788
33823
  const isModernWithPadding = isModern + " ".repeat(isModernFlag.length - isModern.length);
@@ -33839,7 +33874,7 @@ function buildImportAnalysisPlugin(config) {
33839
33874
  const { modulePreload } = this.environment.config.build;
33840
33875
  for (const file in bundle) {
33841
33876
  const chunk = bundle[file];
33842
- if (chunk.type === "chunk" && chunk.code.indexOf(preloadMarker) > -1) {
33877
+ if (chunk.type === "chunk" && chunk.code.includes(preloadMarker)) {
33843
33878
  const code = chunk.code;
33844
33879
  let imports;
33845
33880
  try {
@@ -37127,8 +37162,8 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
37127
37162
  plugins,
37128
37163
  platform,
37129
37164
  transform: {
37130
- ...rolldownOptions.transform,
37131
37165
  target: ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
37166
+ ...rolldownOptions.transform,
37132
37167
  define
37133
37168
  },
37134
37169
  resolve: {
@@ -37860,12 +37895,15 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
37860
37895
  let entryPoint;
37861
37896
  if (data.exports) entryPoint = resolveExportsOrImports(data, ".", options, "exports", externalize);
37862
37897
  if (!entryPoint) {
37863
- for (const field of options.mainFields) if (field === "browser") {
37864
- entryPoint = tryResolveBrowserEntry(dir, data, options);
37865
- if (entryPoint) break;
37866
- } else if (typeof data[field] === "string") {
37898
+ for (const field of options.mainFields) if (typeof data[field] === "string") {
37867
37899
  entryPoint = data[field];
37868
37900
  break;
37901
+ } else if (field === "browser") {
37902
+ const browser = data[field];
37903
+ if (isObject$1(browser) && browser["."]) {
37904
+ entryPoint = browser["."];
37905
+ break;
37906
+ }
37869
37907
  }
37870
37908
  }
37871
37909
  entryPoint ||= data.main;
@@ -37948,14 +37986,6 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
37948
37986
  }
37949
37987
  }
37950
37988
  }
37951
- function tryResolveBrowserEntry(dir, data, options) {
37952
- const browserEntry = typeof data.browser === "string" ? data.browser : isObject$1(data.browser) && data.browser["."];
37953
- if (browserEntry) if (!options.isRequire && options.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
37954
- const resolvedBrowserEntry = tryFsResolve(path.join(dir, browserEntry), options);
37955
- if (resolvedBrowserEntry) if (hasESMSyntax(fs.readFileSync(resolvedBrowserEntry, "utf-8"))) return browserEntry;
37956
- else return data.module;
37957
- } else return browserEntry;
37958
- }
37959
37989
  /**
37960
37990
  * given a relative path in pkg dir,
37961
37991
  * return a relative path in pkg dir,
@@ -38332,6 +38362,7 @@ var build_exports = /* @__PURE__ */ __exportAll({
38332
38362
  });
38333
38363
  const _buildEnvironmentOptionsDefaults = Object.freeze({
38334
38364
  target: "baseline-widely-available",
38365
+ /** @deprecated */
38335
38366
  polyfillModulePreload: true,
38336
38367
  modulePreload: true,
38337
38368
  outDir: "dist",
@@ -39509,6 +39540,7 @@ const configDefaults = Object.freeze({
39509
39540
  define: {},
39510
39541
  dev: {
39511
39542
  warmup: [],
39543
+ /** @experimental */
39512
39544
  sourcemap: { js: true },
39513
39545
  sourcemapIgnoreList: void 0
39514
39546
  },
@@ -39517,6 +39549,7 @@ const configDefaults = Object.freeze({
39517
39549
  externalConditions: [...DEFAULT_EXTERNAL_CONDITIONS],
39518
39550
  extensions: DEFAULT_EXTENSIONS,
39519
39551
  dedupe: [],
39552
+ /** @experimental */
39520
39553
  noExternal: [],
39521
39554
  external: [],
39522
39555
  preserveSymlinks: false,
@@ -39533,9 +39566,11 @@ const configDefaults = Object.freeze({
39533
39566
  stringify: "auto"
39534
39567
  },
39535
39568
  assetsInclude: void 0,
39569
+ /** @experimental */
39536
39570
  builder: builderOptionsDefaults,
39537
39571
  server: serverConfigDefaults,
39538
39572
  preview: { port: DEFAULT_PREVIEW_PORT },
39573
+ /** @experimental */
39539
39574
  experimental: {
39540
39575
  importGlobRestoreExtension: false,
39541
39576
  renderBuiltUrl: void 0,
@@ -39566,10 +39601,15 @@ const configDefaults = Object.freeze({
39566
39601
  exclude: [],
39567
39602
  needsInterop: [],
39568
39603
  rolldownOptions: {},
39604
+ /** @experimental */
39569
39605
  extensions: [],
39606
+ /** @deprecated @experimental */
39570
39607
  disabled: "build",
39608
+ /** @experimental */
39571
39609
  holdUntilCrawlEnd: true,
39610
+ /** @experimental */
39572
39611
  force: false,
39612
+ /** @experimental */
39573
39613
  ignoreOutdatedRequests: false
39574
39614
  },
39575
39615
  ssr: ssrConfigDefaults,