vite 8.0.9 → 8.0.10

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.
@@ -1,5 +1,14 @@
1
1
  import "@vite/env";
2
- //#region \0@oxc-project+runtime@0.126.0/helpers/typeof.js
2
+ //#region ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/non-secure/index.js
3
+ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
4
+ let nanoid = (size = 21) => {
5
+ let id = "";
6
+ let i = size | 0;
7
+ while (i--) id += urlAlphabet[Math.random() * 64 | 0];
8
+ return id;
9
+ };
10
+ //#endregion
11
+ //#region \0@oxc-project+runtime@0.127.0/helpers/typeof.js
3
12
  function _typeof(o) {
4
13
  "@babel/helpers - typeof";
5
14
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -9,7 +18,7 @@ function _typeof(o) {
9
18
  }, _typeof(o);
10
19
  }
11
20
  //#endregion
12
- //#region \0@oxc-project+runtime@0.126.0/helpers/toPrimitive.js
21
+ //#region \0@oxc-project+runtime@0.127.0/helpers/toPrimitive.js
13
22
  function toPrimitive(t, r) {
14
23
  if ("object" != _typeof(t) || !t) return t;
15
24
  var e = t[Symbol.toPrimitive];
@@ -21,13 +30,13 @@ function toPrimitive(t, r) {
21
30
  return ("string" === r ? String : Number)(t);
22
31
  }
23
32
  //#endregion
24
- //#region \0@oxc-project+runtime@0.126.0/helpers/toPropertyKey.js
33
+ //#region \0@oxc-project+runtime@0.127.0/helpers/toPropertyKey.js
25
34
  function toPropertyKey(t) {
26
35
  var i = toPrimitive(t, "string");
27
36
  return "symbol" == _typeof(i) ? i : i + "";
28
37
  }
29
38
  //#endregion
30
- //#region \0@oxc-project+runtime@0.126.0/helpers/defineProperty.js
39
+ //#region \0@oxc-project+runtime@0.127.0/helpers/defineProperty.js
31
40
  function _defineProperty(e, r, t) {
32
41
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
42
  value: t,
@@ -220,15 +229,6 @@ var HMRClient = class {
220
229
  }
221
230
  };
222
231
  //#endregion
223
- //#region ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/non-secure/index.js
224
- let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
225
- let nanoid = (size = 21) => {
226
- let id = "";
227
- let i = size | 0;
228
- while (i--) id += urlAlphabet[Math.random() * 64 | 0];
229
- return id;
230
- };
231
- //#endregion
232
232
  //#region src/shared/constants.ts
233
233
  let SOURCEMAPPING_URL = "sourceMa";
234
234
  SOURCEMAPPING_URL += "ppingURL";
@@ -1218,7 +1218,7 @@ if (isBundleMode && typeof DevRuntime !== "undefined") {
1218
1218
  }
1219
1219
  applyUpdates(_boundaries) {}
1220
1220
  }
1221
- (_ref = globalThis).__rolldown_runtime__ ?? (_ref.__rolldown_runtime__ = new ViteDevRuntime({ send(message) {
1221
+ const wrappedSocket = { send(message) {
1222
1222
  switch (message.type) {
1223
1223
  case "hmr:module-registered":
1224
1224
  transport.send({
@@ -1229,7 +1229,9 @@ if (isBundleMode && typeof DevRuntime !== "undefined") {
1229
1229
  break;
1230
1230
  default: throw new Error(`Unknown message type: ${JSON.stringify(message)}`);
1231
1231
  }
1232
- } }));
1232
+ } };
1233
+ const clientId = nanoid();
1234
+ (_ref = globalThis).__rolldown_runtime__ ?? (_ref.__rolldown_runtime__ = new ViteDevRuntime(wrappedSocket, clientId));
1233
1235
  }
1234
1236
  //#endregion
1235
1237
  export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
@@ -6781,4 +6781,4 @@ function parse(html, options) {
6781
6781
  return Parser.parse(html, options);
6782
6782
  }
6783
6783
  //#endregion
6784
- export { parse };
6784
+ export { ERR as ErrorCodes, parse };
@@ -25,10 +25,10 @@ import { dev, oxcRuntimePlugin, resolveTsconfig, scan, viteAliasPlugin, viteBuil
25
25
  import readline from "node:readline";
26
26
  import { MessageChannel, Worker } from "node:worker_threads";
27
27
  import isModuleSyncConditionEnabled from "#module-sync-enabled";
28
+ import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby";
28
29
  import assert from "node:assert";
29
30
  import process$1 from "node:process";
30
31
  import v8 from "node:v8";
31
- import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby";
32
32
  import { EventEmitter } from "node:events";
33
33
  import { STATUS_CODES, createServer, get } from "node:http";
34
34
  import { createServer as createServer$1, get as get$1 } from "node:https";
@@ -3200,405 +3200,6 @@ function f(e, r, t) {
3200
3200
  if (e.imports) return n$1(e.name, e.imports, r, t);
3201
3201
  }
3202
3202
  //#endregion
3203
- //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
3204
- const HASH_RE = /#/g;
3205
- const AMPERSAND_RE = /&/g;
3206
- const SLASH_RE = /\//g;
3207
- const EQUAL_RE = /=/g;
3208
- const PLUS_RE = /\+/g;
3209
- const ENC_CARET_RE = /%5e/gi;
3210
- const ENC_BACKTICK_RE = /%60/gi;
3211
- const ENC_PIPE_RE = /%7c/gi;
3212
- const ENC_SPACE_RE = /%20/gi;
3213
- function encode(text) {
3214
- return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
3215
- }
3216
- function encodeQueryValue(input) {
3217
- 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");
3218
- }
3219
- function encodeQueryKey(text) {
3220
- return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
3221
- }
3222
- function encodeQueryItem(key, value) {
3223
- if (typeof value === "number" || typeof value === "boolean") value = String(value);
3224
- if (!value) return encodeQueryKey(key);
3225
- if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
3226
- return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
3227
- }
3228
- function stringifyQuery(query) {
3229
- return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
3230
- }
3231
- new Set(builtinModules);
3232
- function clearImports(imports) {
3233
- return (imports || "").replace(/\/\/[^\n]*\n|\/\*.*\*\//g, "").replace(/\s+/g, " ");
3234
- }
3235
- function getImportNames(cleanedImports) {
3236
- const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
3237
- return {
3238
- namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
3239
- defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
3240
- };
3241
- }
3242
- /**
3243
- * @typedef ErrnoExceptionFields
3244
- * @property {number | undefined} [errnode]
3245
- * @property {string | undefined} [code]
3246
- * @property {string | undefined} [path]
3247
- * @property {string | undefined} [syscall]
3248
- * @property {string | undefined} [url]
3249
- *
3250
- * @typedef {Error & ErrnoExceptionFields} ErrnoException
3251
- */
3252
- const own$1 = {}.hasOwnProperty;
3253
- const classRegExp = /^([A-Z][a-z\d]*)+$/;
3254
- const kTypes = new Set([
3255
- "string",
3256
- "function",
3257
- "number",
3258
- "object",
3259
- "Function",
3260
- "Object",
3261
- "boolean",
3262
- "bigint",
3263
- "symbol"
3264
- ]);
3265
- const codes = {};
3266
- /**
3267
- * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
3268
- * We cannot use Intl.ListFormat because it's not available in
3269
- * --without-intl builds.
3270
- *
3271
- * @param {Array<string>} array
3272
- * An array of strings.
3273
- * @param {string} [type]
3274
- * The list type to be inserted before the last element.
3275
- * @returns {string}
3276
- */
3277
- function formatList(array, type = "and") {
3278
- return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array[array.length - 1]}`;
3279
- }
3280
- /** @type {Map<string, MessageFunction | string>} */
3281
- const messages = /* @__PURE__ */ new Map();
3282
- const nodeInternalPrefix = "__node_internal_";
3283
- /** @type {number} */
3284
- let userStackTraceLimit;
3285
- codes.ERR_INVALID_ARG_TYPE = createError(
3286
- "ERR_INVALID_ARG_TYPE",
3287
- /**
3288
- * @param {string} name
3289
- * @param {Array<string> | string} expected
3290
- * @param {unknown} actual
3291
- */
3292
- (name, expected, actual) => {
3293
- assert.ok(typeof name === "string", "'name' must be a string");
3294
- if (!Array.isArray(expected)) expected = [expected];
3295
- let message = "The ";
3296
- if (name.endsWith(" argument")) message += `${name} `;
3297
- else {
3298
- const type = name.includes(".") ? "property" : "argument";
3299
- message += `"${name}" ${type} `;
3300
- }
3301
- message += "must be ";
3302
- /** @type {Array<string>} */
3303
- const types = [];
3304
- /** @type {Array<string>} */
3305
- const instances = [];
3306
- /** @type {Array<string>} */
3307
- const other = [];
3308
- for (const value of expected) {
3309
- assert.ok(typeof value === "string", "All expected entries have to be of type string");
3310
- if (kTypes.has(value)) types.push(value.toLowerCase());
3311
- else if (classRegExp.exec(value) === null) {
3312
- assert.ok(value !== "object", "The value \"object\" should be written as \"Object\"");
3313
- other.push(value);
3314
- } else instances.push(value);
3315
- }
3316
- if (instances.length > 0) {
3317
- const pos = types.indexOf("object");
3318
- if (pos !== -1) {
3319
- types.slice(pos, 1);
3320
- instances.push("Object");
3321
- }
3322
- }
3323
- if (types.length > 0) {
3324
- message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
3325
- if (instances.length > 0 || other.length > 0) message += " or ";
3326
- }
3327
- if (instances.length > 0) {
3328
- message += `an instance of ${formatList(instances, "or")}`;
3329
- if (other.length > 0) message += " or ";
3330
- }
3331
- if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
3332
- else {
3333
- if (other[0].toLowerCase() !== other[0]) message += "an ";
3334
- message += `${other[0]}`;
3335
- }
3336
- message += `. Received ${determineSpecificType(actual)}`;
3337
- return message;
3338
- },
3339
- TypeError
3340
- );
3341
- codes.ERR_INVALID_MODULE_SPECIFIER = createError(
3342
- "ERR_INVALID_MODULE_SPECIFIER",
3343
- /**
3344
- * @param {string} request
3345
- * @param {string} reason
3346
- * @param {string} [base]
3347
- */
3348
- (request, reason, base = void 0) => {
3349
- return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
3350
- },
3351
- TypeError
3352
- );
3353
- codes.ERR_INVALID_PACKAGE_CONFIG = createError(
3354
- "ERR_INVALID_PACKAGE_CONFIG",
3355
- /**
3356
- * @param {string} path
3357
- * @param {string} [base]
3358
- * @param {string} [message]
3359
- */
3360
- (path, base, message) => {
3361
- return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
3362
- },
3363
- Error
3364
- );
3365
- codes.ERR_INVALID_PACKAGE_TARGET = createError(
3366
- "ERR_INVALID_PACKAGE_TARGET",
3367
- /**
3368
- * @param {string} packagePath
3369
- * @param {string} key
3370
- * @param {unknown} target
3371
- * @param {boolean} [isImport=false]
3372
- * @param {string} [base]
3373
- */
3374
- (packagePath, key, target, isImport = false, base = void 0) => {
3375
- const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
3376
- if (key === ".") {
3377
- assert.ok(isImport === false);
3378
- 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 \"./\"" : ""}`;
3379
- }
3380
- 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 \"./\"" : ""}`;
3381
- },
3382
- Error
3383
- );
3384
- codes.ERR_MODULE_NOT_FOUND = createError(
3385
- "ERR_MODULE_NOT_FOUND",
3386
- /**
3387
- * @param {string} path
3388
- * @param {string} base
3389
- * @param {boolean} [exactUrl]
3390
- */
3391
- (path, base, exactUrl = false) => {
3392
- return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
3393
- },
3394
- Error
3395
- );
3396
- codes.ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
3397
- codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
3398
- "ERR_PACKAGE_IMPORT_NOT_DEFINED",
3399
- /**
3400
- * @param {string} specifier
3401
- * @param {string} packagePath
3402
- * @param {string} base
3403
- */
3404
- (specifier, packagePath, base) => {
3405
- return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
3406
- },
3407
- TypeError
3408
- );
3409
- codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
3410
- "ERR_PACKAGE_PATH_NOT_EXPORTED",
3411
- /**
3412
- * @param {string} packagePath
3413
- * @param {string} subpath
3414
- * @param {string} [base]
3415
- */
3416
- (packagePath, subpath, base = void 0) => {
3417
- if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
3418
- return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
3419
- },
3420
- Error
3421
- );
3422
- codes.ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
3423
- 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);
3424
- codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
3425
- "ERR_UNKNOWN_FILE_EXTENSION",
3426
- /**
3427
- * @param {string} extension
3428
- * @param {string} path
3429
- */
3430
- (extension, path) => {
3431
- return `Unknown file extension "${extension}" for ${path}`;
3432
- },
3433
- TypeError
3434
- );
3435
- codes.ERR_INVALID_ARG_VALUE = createError(
3436
- "ERR_INVALID_ARG_VALUE",
3437
- /**
3438
- * @param {string} name
3439
- * @param {unknown} value
3440
- * @param {string} [reason='is invalid']
3441
- */
3442
- (name, value, reason = "is invalid") => {
3443
- let inspected = inspect(value);
3444
- if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
3445
- return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
3446
- },
3447
- TypeError
3448
- );
3449
- /**
3450
- * Utility function for registering the error codes. Only used here. Exported
3451
- * *only* to allow for testing.
3452
- * @param {string} sym
3453
- * @param {MessageFunction | string} value
3454
- * @param {ErrorConstructor} constructor
3455
- * @returns {new (...parameters: Array<any>) => Error}
3456
- */
3457
- function createError(sym, value, constructor) {
3458
- messages.set(sym, value);
3459
- return makeNodeErrorWithCode(constructor, sym);
3460
- }
3461
- /**
3462
- * @param {ErrorConstructor} Base
3463
- * @param {string} key
3464
- * @returns {ErrorConstructor}
3465
- */
3466
- function makeNodeErrorWithCode(Base, key) {
3467
- return NodeError;
3468
- /**
3469
- * @param {Array<unknown>} parameters
3470
- */
3471
- function NodeError(...parameters) {
3472
- const limit = Error.stackTraceLimit;
3473
- if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
3474
- const error = new Base();
3475
- if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
3476
- const message = getMessage(key, parameters, error);
3477
- Object.defineProperties(error, {
3478
- message: {
3479
- value: message,
3480
- enumerable: false,
3481
- writable: true,
3482
- configurable: true
3483
- },
3484
- toString: {
3485
- value() {
3486
- return `${this.name} [${key}]: ${this.message}`;
3487
- },
3488
- enumerable: false,
3489
- writable: true,
3490
- configurable: true
3491
- }
3492
- });
3493
- captureLargerStackTrace(error);
3494
- error.code = key;
3495
- return error;
3496
- }
3497
- }
3498
- /**
3499
- * @returns {boolean}
3500
- */
3501
- function isErrorStackTraceLimitWritable() {
3502
- try {
3503
- if (v8.startupSnapshot.isBuildingSnapshot()) return false;
3504
- } catch {}
3505
- const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
3506
- if (desc === void 0) return Object.isExtensible(Error);
3507
- return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
3508
- }
3509
- /**
3510
- * This function removes unnecessary frames from Node.js core errors.
3511
- * @template {(...parameters: unknown[]) => unknown} T
3512
- * @param {T} wrappedFunction
3513
- * @returns {T}
3514
- */
3515
- function hideStackFrames(wrappedFunction) {
3516
- const hidden = nodeInternalPrefix + wrappedFunction.name;
3517
- Object.defineProperty(wrappedFunction, "name", { value: hidden });
3518
- return wrappedFunction;
3519
- }
3520
- const captureLargerStackTrace = hideStackFrames(
3521
- /**
3522
- * @param {Error} error
3523
- * @returns {Error}
3524
- */
3525
- function(error) {
3526
- const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
3527
- if (stackTraceLimitIsWritable) {
3528
- userStackTraceLimit = Error.stackTraceLimit;
3529
- Error.stackTraceLimit = Number.POSITIVE_INFINITY;
3530
- }
3531
- Error.captureStackTrace(error);
3532
- if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
3533
- return error;
3534
- }
3535
- );
3536
- /**
3537
- * @param {string} key
3538
- * @param {Array<unknown>} parameters
3539
- * @param {Error} self
3540
- * @returns {string}
3541
- */
3542
- function getMessage(key, parameters, self) {
3543
- const message = messages.get(key);
3544
- assert.ok(message !== void 0, "expected `message` to be found");
3545
- if (typeof message === "function") {
3546
- assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
3547
- return Reflect.apply(message, self, parameters);
3548
- }
3549
- const regex = /%[dfijoOs]/g;
3550
- let expectedLength = 0;
3551
- while (regex.exec(message) !== null) expectedLength++;
3552
- assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
3553
- if (parameters.length === 0) return message;
3554
- parameters.unshift(message);
3555
- return Reflect.apply(format, null, parameters);
3556
- }
3557
- /**
3558
- * Determine the specific type of a value for type-mismatch errors.
3559
- * @param {unknown} value
3560
- * @returns {string}
3561
- */
3562
- function determineSpecificType(value) {
3563
- if (value === null || value === void 0) return String(value);
3564
- if (typeof value === "function" && value.name) return `function ${value.name}`;
3565
- if (typeof value === "object") {
3566
- if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
3567
- return `${inspect(value, { depth: -1 })}`;
3568
- }
3569
- let inspected = inspect(value, { colors: false });
3570
- if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
3571
- return `type ${typeof value} (${inspected})`;
3572
- }
3573
- const DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
3574
- new Set(DEFAULT_CONDITIONS);
3575
- 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;
3576
- const TYPE_RE = /^\s*?type\s/;
3577
- function parseStaticImport(matched) {
3578
- const cleanedImports = clearImports(matched.imports);
3579
- const namedImports = {};
3580
- const _matches = cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || [];
3581
- for (const namedImport of _matches) {
3582
- const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
3583
- const source = _match?.[1] || namedImport.trim();
3584
- const importName = _match?.[2] || source;
3585
- if (source && !TYPE_RE.test(source)) namedImports[source] = importName;
3586
- }
3587
- const { namespacedImport, defaultImport } = getImportNames(cleanedImports);
3588
- return {
3589
- ...matched,
3590
- defaultImport,
3591
- namespacedImport,
3592
- namedImports
3593
- };
3594
- }
3595
- 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;
3596
- const COMMENT_RE = /\/\*.+?\*\/|\/\/.*(?=[nr])/g;
3597
- function hasESMSyntax(code, opts = {}) {
3598
- if (opts.stripComments) code = code.replace(COMMENT_RE, "");
3599
- return ESM_RE.test(code);
3600
- }
3601
- //#endregion
3602
3203
  //#region ../../node_modules/.pnpm/es-module-lexer@1.7.0/node_modules/es-module-lexer/dist/lexer.js
3603
3204
  var ImportType;
3604
3205
  (function(A) {
@@ -4909,6 +4510,400 @@ function throwFileNotFoundInOptimizedDep(id) {
4909
4510
  throw err;
4910
4511
  }
4911
4512
  //#endregion
4513
+ //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
4514
+ const HASH_RE = /#/g;
4515
+ const AMPERSAND_RE = /&/g;
4516
+ const SLASH_RE = /\//g;
4517
+ const EQUAL_RE = /=/g;
4518
+ const PLUS_RE = /\+/g;
4519
+ const ENC_CARET_RE = /%5e/gi;
4520
+ const ENC_BACKTICK_RE = /%60/gi;
4521
+ const ENC_PIPE_RE = /%7c/gi;
4522
+ const ENC_SPACE_RE = /%20/gi;
4523
+ function encode(text) {
4524
+ return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
4525
+ }
4526
+ function encodeQueryValue(input) {
4527
+ 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");
4528
+ }
4529
+ function encodeQueryKey(text) {
4530
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
4531
+ }
4532
+ function encodeQueryItem(key, value) {
4533
+ if (typeof value === "number" || typeof value === "boolean") value = String(value);
4534
+ if (!value) return encodeQueryKey(key);
4535
+ if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
4536
+ return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
4537
+ }
4538
+ function stringifyQuery(query) {
4539
+ return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
4540
+ }
4541
+ new Set(builtinModules);
4542
+ function clearImports(imports) {
4543
+ return (imports || "").replace(/\/\/[^\n]*\n|\/\*.*\*\//g, "").replace(/\s+/g, " ");
4544
+ }
4545
+ function getImportNames(cleanedImports) {
4546
+ const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
4547
+ return {
4548
+ namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
4549
+ defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
4550
+ };
4551
+ }
4552
+ /**
4553
+ * @typedef ErrnoExceptionFields
4554
+ * @property {number | undefined} [errnode]
4555
+ * @property {string | undefined} [code]
4556
+ * @property {string | undefined} [path]
4557
+ * @property {string | undefined} [syscall]
4558
+ * @property {string | undefined} [url]
4559
+ *
4560
+ * @typedef {Error & ErrnoExceptionFields} ErrnoException
4561
+ */
4562
+ const own$1 = {}.hasOwnProperty;
4563
+ const classRegExp = /^([A-Z][a-z\d]*)+$/;
4564
+ const kTypes = new Set([
4565
+ "string",
4566
+ "function",
4567
+ "number",
4568
+ "object",
4569
+ "Function",
4570
+ "Object",
4571
+ "boolean",
4572
+ "bigint",
4573
+ "symbol"
4574
+ ]);
4575
+ const codes = {};
4576
+ /**
4577
+ * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
4578
+ * We cannot use Intl.ListFormat because it's not available in
4579
+ * --without-intl builds.
4580
+ *
4581
+ * @param {Array<string>} array
4582
+ * An array of strings.
4583
+ * @param {string} [type]
4584
+ * The list type to be inserted before the last element.
4585
+ * @returns {string}
4586
+ */
4587
+ function formatList(array, type = "and") {
4588
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array[array.length - 1]}`;
4589
+ }
4590
+ /** @type {Map<string, MessageFunction | string>} */
4591
+ const messages = /* @__PURE__ */ new Map();
4592
+ const nodeInternalPrefix = "__node_internal_";
4593
+ /** @type {number} */
4594
+ let userStackTraceLimit;
4595
+ codes.ERR_INVALID_ARG_TYPE = createError(
4596
+ "ERR_INVALID_ARG_TYPE",
4597
+ /**
4598
+ * @param {string} name
4599
+ * @param {Array<string> | string} expected
4600
+ * @param {unknown} actual
4601
+ */
4602
+ (name, expected, actual) => {
4603
+ assert.ok(typeof name === "string", "'name' must be a string");
4604
+ if (!Array.isArray(expected)) expected = [expected];
4605
+ let message = "The ";
4606
+ if (name.endsWith(" argument")) message += `${name} `;
4607
+ else {
4608
+ const type = name.includes(".") ? "property" : "argument";
4609
+ message += `"${name}" ${type} `;
4610
+ }
4611
+ message += "must be ";
4612
+ /** @type {Array<string>} */
4613
+ const types = [];
4614
+ /** @type {Array<string>} */
4615
+ const instances = [];
4616
+ /** @type {Array<string>} */
4617
+ const other = [];
4618
+ for (const value of expected) {
4619
+ assert.ok(typeof value === "string", "All expected entries have to be of type string");
4620
+ if (kTypes.has(value)) types.push(value.toLowerCase());
4621
+ else if (classRegExp.exec(value) === null) {
4622
+ assert.ok(value !== "object", "The value \"object\" should be written as \"Object\"");
4623
+ other.push(value);
4624
+ } else instances.push(value);
4625
+ }
4626
+ if (instances.length > 0) {
4627
+ const pos = types.indexOf("object");
4628
+ if (pos !== -1) {
4629
+ types.slice(pos, 1);
4630
+ instances.push("Object");
4631
+ }
4632
+ }
4633
+ if (types.length > 0) {
4634
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
4635
+ if (instances.length > 0 || other.length > 0) message += " or ";
4636
+ }
4637
+ if (instances.length > 0) {
4638
+ message += `an instance of ${formatList(instances, "or")}`;
4639
+ if (other.length > 0) message += " or ";
4640
+ }
4641
+ if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
4642
+ else {
4643
+ if (other[0].toLowerCase() !== other[0]) message += "an ";
4644
+ message += `${other[0]}`;
4645
+ }
4646
+ message += `. Received ${determineSpecificType(actual)}`;
4647
+ return message;
4648
+ },
4649
+ TypeError
4650
+ );
4651
+ codes.ERR_INVALID_MODULE_SPECIFIER = createError(
4652
+ "ERR_INVALID_MODULE_SPECIFIER",
4653
+ /**
4654
+ * @param {string} request
4655
+ * @param {string} reason
4656
+ * @param {string} [base]
4657
+ */
4658
+ (request, reason, base = void 0) => {
4659
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
4660
+ },
4661
+ TypeError
4662
+ );
4663
+ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
4664
+ "ERR_INVALID_PACKAGE_CONFIG",
4665
+ /**
4666
+ * @param {string} path
4667
+ * @param {string} [base]
4668
+ * @param {string} [message]
4669
+ */
4670
+ (path, base, message) => {
4671
+ return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
4672
+ },
4673
+ Error
4674
+ );
4675
+ codes.ERR_INVALID_PACKAGE_TARGET = createError(
4676
+ "ERR_INVALID_PACKAGE_TARGET",
4677
+ /**
4678
+ * @param {string} packagePath
4679
+ * @param {string} key
4680
+ * @param {unknown} target
4681
+ * @param {boolean} [isImport=false]
4682
+ * @param {string} [base]
4683
+ */
4684
+ (packagePath, key, target, isImport = false, base = void 0) => {
4685
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
4686
+ if (key === ".") {
4687
+ assert.ok(isImport === false);
4688
+ 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 \"./\"" : ""}`;
4689
+ }
4690
+ 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 \"./\"" : ""}`;
4691
+ },
4692
+ Error
4693
+ );
4694
+ codes.ERR_MODULE_NOT_FOUND = createError(
4695
+ "ERR_MODULE_NOT_FOUND",
4696
+ /**
4697
+ * @param {string} path
4698
+ * @param {string} base
4699
+ * @param {boolean} [exactUrl]
4700
+ */
4701
+ (path, base, exactUrl = false) => {
4702
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
4703
+ },
4704
+ Error
4705
+ );
4706
+ codes.ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
4707
+ codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
4708
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
4709
+ /**
4710
+ * @param {string} specifier
4711
+ * @param {string} packagePath
4712
+ * @param {string} base
4713
+ */
4714
+ (specifier, packagePath, base) => {
4715
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
4716
+ },
4717
+ TypeError
4718
+ );
4719
+ codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
4720
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
4721
+ /**
4722
+ * @param {string} packagePath
4723
+ * @param {string} subpath
4724
+ * @param {string} [base]
4725
+ */
4726
+ (packagePath, subpath, base = void 0) => {
4727
+ if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
4728
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
4729
+ },
4730
+ Error
4731
+ );
4732
+ codes.ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
4733
+ 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);
4734
+ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
4735
+ "ERR_UNKNOWN_FILE_EXTENSION",
4736
+ /**
4737
+ * @param {string} extension
4738
+ * @param {string} path
4739
+ */
4740
+ (extension, path) => {
4741
+ return `Unknown file extension "${extension}" for ${path}`;
4742
+ },
4743
+ TypeError
4744
+ );
4745
+ codes.ERR_INVALID_ARG_VALUE = createError(
4746
+ "ERR_INVALID_ARG_VALUE",
4747
+ /**
4748
+ * @param {string} name
4749
+ * @param {unknown} value
4750
+ * @param {string} [reason='is invalid']
4751
+ */
4752
+ (name, value, reason = "is invalid") => {
4753
+ let inspected = inspect(value);
4754
+ if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
4755
+ return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
4756
+ },
4757
+ TypeError
4758
+ );
4759
+ /**
4760
+ * Utility function for registering the error codes. Only used here. Exported
4761
+ * *only* to allow for testing.
4762
+ * @param {string} sym
4763
+ * @param {MessageFunction | string} value
4764
+ * @param {ErrorConstructor} constructor
4765
+ * @returns {new (...parameters: Array<any>) => Error}
4766
+ */
4767
+ function createError(sym, value, constructor) {
4768
+ messages.set(sym, value);
4769
+ return makeNodeErrorWithCode(constructor, sym);
4770
+ }
4771
+ /**
4772
+ * @param {ErrorConstructor} Base
4773
+ * @param {string} key
4774
+ * @returns {ErrorConstructor}
4775
+ */
4776
+ function makeNodeErrorWithCode(Base, key) {
4777
+ return NodeError;
4778
+ /**
4779
+ * @param {Array<unknown>} parameters
4780
+ */
4781
+ function NodeError(...parameters) {
4782
+ const limit = Error.stackTraceLimit;
4783
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
4784
+ const error = new Base();
4785
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
4786
+ const message = getMessage(key, parameters, error);
4787
+ Object.defineProperties(error, {
4788
+ message: {
4789
+ value: message,
4790
+ enumerable: false,
4791
+ writable: true,
4792
+ configurable: true
4793
+ },
4794
+ toString: {
4795
+ /** @this {Error} */
4796
+ value() {
4797
+ return `${this.name} [${key}]: ${this.message}`;
4798
+ },
4799
+ enumerable: false,
4800
+ writable: true,
4801
+ configurable: true
4802
+ }
4803
+ });
4804
+ captureLargerStackTrace(error);
4805
+ error.code = key;
4806
+ return error;
4807
+ }
4808
+ }
4809
+ /**
4810
+ * @returns {boolean}
4811
+ */
4812
+ function isErrorStackTraceLimitWritable() {
4813
+ try {
4814
+ if (v8.startupSnapshot.isBuildingSnapshot()) return false;
4815
+ } catch {}
4816
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
4817
+ if (desc === void 0) return Object.isExtensible(Error);
4818
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
4819
+ }
4820
+ /**
4821
+ * This function removes unnecessary frames from Node.js core errors.
4822
+ * @template {(...parameters: unknown[]) => unknown} T
4823
+ * @param {T} wrappedFunction
4824
+ * @returns {T}
4825
+ */
4826
+ function hideStackFrames(wrappedFunction) {
4827
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
4828
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
4829
+ return wrappedFunction;
4830
+ }
4831
+ const captureLargerStackTrace = hideStackFrames(
4832
+ /**
4833
+ * @param {Error} error
4834
+ * @returns {Error}
4835
+ */
4836
+ function(error) {
4837
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
4838
+ if (stackTraceLimitIsWritable) {
4839
+ userStackTraceLimit = Error.stackTraceLimit;
4840
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
4841
+ }
4842
+ Error.captureStackTrace(error);
4843
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
4844
+ return error;
4845
+ }
4846
+ );
4847
+ /**
4848
+ * @param {string} key
4849
+ * @param {Array<unknown>} parameters
4850
+ * @param {Error} self
4851
+ * @returns {string}
4852
+ */
4853
+ function getMessage(key, parameters, self) {
4854
+ const message = messages.get(key);
4855
+ assert.ok(message !== void 0, "expected `message` to be found");
4856
+ if (typeof message === "function") {
4857
+ assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
4858
+ return Reflect.apply(message, self, parameters);
4859
+ }
4860
+ const regex = /%[dfijoOs]/g;
4861
+ let expectedLength = 0;
4862
+ while (regex.exec(message) !== null) expectedLength++;
4863
+ assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
4864
+ if (parameters.length === 0) return message;
4865
+ parameters.unshift(message);
4866
+ return Reflect.apply(format, null, parameters);
4867
+ }
4868
+ /**
4869
+ * Determine the specific type of a value for type-mismatch errors.
4870
+ * @param {unknown} value
4871
+ * @returns {string}
4872
+ */
4873
+ function determineSpecificType(value) {
4874
+ if (value === null || value === void 0) return String(value);
4875
+ if (typeof value === "function" && value.name) return `function ${value.name}`;
4876
+ if (typeof value === "object") {
4877
+ if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
4878
+ return `${inspect(value, { depth: -1 })}`;
4879
+ }
4880
+ let inspected = inspect(value, { colors: false });
4881
+ if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
4882
+ return `type ${typeof value} (${inspected})`;
4883
+ }
4884
+ const DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
4885
+ new Set(DEFAULT_CONDITIONS);
4886
+ 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;
4887
+ const TYPE_RE = /^\s*?type\s/;
4888
+ function parseStaticImport(matched) {
4889
+ const cleanedImports = clearImports(matched.imports);
4890
+ const namedImports = {};
4891
+ const _matches = cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || [];
4892
+ for (const namedImport of _matches) {
4893
+ const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
4894
+ const source = _match?.[1] || namedImport.trim();
4895
+ const importName = _match?.[2] || source;
4896
+ if (source && !TYPE_RE.test(source)) namedImports[source] = importName;
4897
+ }
4898
+ const { namespacedImport, defaultImport } = getImportNames(cleanedImports);
4899
+ return {
4900
+ ...matched,
4901
+ defaultImport,
4902
+ namespacedImport,
4903
+ namedImports
4904
+ };
4905
+ }
4906
+ //#endregion
4912
4907
  //#region src/node/env.ts
4913
4908
  var import_main = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
4914
4909
  function _resolveEscapeSequences(value) {
@@ -10752,7 +10747,10 @@ function ssrFixStacktrace(e, moduleGraph) {
10752
10747
  function createHMROptions(environment, options) {
10753
10748
  if (environment.config.server.hmr === false || options.hmr === false) return false;
10754
10749
  if (!("api" in environment.hot)) return false;
10755
- return { logger: options.hmr?.logger };
10750
+ return { logger: options.hmr?.logger ?? {
10751
+ debug: (...msg) => environment.logger.info(msg.join(" "), { timestamp: true }),
10752
+ error: (err) => environment.logger.error(err instanceof Error ? err.message : String(err), { timestamp: true })
10753
+ } };
10756
10754
  }
10757
10755
  const prepareStackTrace = { retrieveFile(id) {
10758
10756
  if (existsSync(id)) return readFileSync(id, "utf-8");
@@ -14310,6 +14308,18 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14310
14308
  ErrorEvent,
14311
14309
  Event,
14312
14310
  EventTarget: {
14311
+ /**
14312
+ * Register an event listener.
14313
+ *
14314
+ * @param {String} type A string representing the event type to listen for
14315
+ * @param {(Function|Object)} handler The listener to add
14316
+ * @param {Object} [options] An options object specifies characteristics about
14317
+ * the event listener
14318
+ * @param {Boolean} [options.once=false] A `Boolean` indicating that the
14319
+ * listener should be invoked at most once after being added. If `true`,
14320
+ * the listener would be automatically removed when invoked.
14321
+ * @public
14322
+ */
14313
14323
  addEventListener(type, handler, options = {}) {
14314
14324
  for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
14315
14325
  let wrapper;
@@ -14346,6 +14356,13 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14346
14356
  if (options.once) this.once(type, wrapper);
14347
14357
  else this.on(type, wrapper);
14348
14358
  },
14359
+ /**
14360
+ * Remove an event listener.
14361
+ *
14362
+ * @param {String} type A string representing the event type to remove
14363
+ * @param {(Function|Object)} handler The listener to remove
14364
+ * @public
14365
+ */
14349
14366
  removeEventListener(type, handler) {
14350
14367
  for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
14351
14368
  this.removeListener(type, listener);
@@ -19249,7 +19266,10 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19249
19266
  /** @type {import('./index').Loader} */
19250
19267
  const dynamicImport = async (id) => {
19251
19268
  try {
19252
- return (await import(url.pathToFileURL(id).href)).default;
19269
+ return (await import(
19270
+ /* webpackIgnore: true */
19271
+ url.pathToFileURL(id).href
19272
+ )).default;
19253
19273
  } catch (e) {
19254
19274
  try {
19255
19275
  return requireFunc(id);
@@ -20347,8 +20367,10 @@ function getChunkOriginalFileName(chunk, root, isLegacy) {
20347
20367
  var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
20348
20368
  const decoder = new TextDecoder();
20349
20369
  const _cssConfigDefaults = Object.freeze({
20370
+ /** @experimental */
20350
20371
  transformer: "postcss",
20351
20372
  preprocessorMaxWorkers: true,
20373
+ /** @experimental */
20352
20374
  devSourcemap: false
20353
20375
  });
20354
20376
  const cssConfigDefaults = _cssConfigDefaults;
@@ -20550,7 +20572,7 @@ function cssPostPlugin(config) {
20550
20572
  if (modulesCode) code = modulesCode;
20551
20573
  else if (inlined) {
20552
20574
  let content = css;
20553
- if (config.build.cssMinify) content = await minifyCSS(content, config, true);
20575
+ if (config.build.cssMinify) content = await minifyCSS(content, config, true, id);
20554
20576
  code = `export default ${JSON.stringify(content)}`;
20555
20577
  } else code = "";
20556
20578
  return {
@@ -21254,13 +21276,14 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
21254
21276
  if (newUrl === false) return matched;
21255
21277
  return `@import ${matched.includes("url(") ? "url(" : ""}${wrap}${newUrl}${wrap}`;
21256
21278
  }
21257
- async function minifyCSS(css, config, inlined) {
21279
+ async function minifyCSS(css, config, inlined, filename = defaultCssBundleName) {
21258
21280
  if (config.build.cssMinify === "esbuild") {
21259
21281
  const { transform, formatMessages } = await importEsbuild();
21260
21282
  try {
21261
21283
  const { code, warnings } = await transform(css, {
21262
21284
  loader: "css",
21263
21285
  target: config.build.cssTarget || void 0,
21286
+ sourcefile: filename,
21264
21287
  ...resolveMinifyCssEsbuildOptions(config.esbuild || {})
21265
21288
  });
21266
21289
  if (warnings.length) {
@@ -21282,7 +21305,7 @@ async function minifyCSS(css, config, inlined) {
21282
21305
  ...config.css.lightningcss,
21283
21306
  targets: convertTargets(config.build.cssTarget),
21284
21307
  cssModules: void 0,
21285
- filename: defaultCssBundleName,
21308
+ filename,
21286
21309
  code: Buffer.from(css),
21287
21310
  minify: true
21288
21311
  });
@@ -22132,13 +22155,13 @@ function traverseNodes(node, visitor) {
22132
22155
  if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
22133
22156
  }
22134
22157
  async function traverseHtml(html, filePath, warn, visitor) {
22135
- const { parse } = await import("./dist.js");
22158
+ const { parse, ErrorCodes } = await import("./dist.js");
22136
22159
  const warnings = {};
22137
22160
  traverseNodes(parse(html, {
22138
22161
  scriptingEnabled: false,
22139
22162
  sourceCodeLocationInfo: true,
22140
22163
  onParseError: (e) => {
22141
- handleParseError(e, html, filePath, warnings);
22164
+ handleParseError(e, ErrorCodes, html, filePath, warnings);
22142
22165
  }
22143
22166
  }), visitor);
22144
22167
  for (const message of Object.values(warnings)) warn(import_picocolors.default.yellow(`\n${message}`));
@@ -22154,7 +22177,7 @@ function getScriptInfo(node) {
22154
22177
  if (p.name === "src") {
22155
22178
  if (!src) {
22156
22179
  src = p;
22157
- srcSourceCodeLocation = node.sourceCodeLocation?.attrs["src"];
22180
+ srcSourceCodeLocation = node.sourceCodeLocation?.attrs.src;
22158
22181
  }
22159
22182
  } else if (p.name === "type" && p.value === "module") isModule = true;
22160
22183
  else if (p.name === "async") isAsync = true;
@@ -22198,13 +22221,13 @@ function formatParseError(parserError, id, html) {
22198
22221
  }
22199
22222
  };
22200
22223
  }
22201
- function handleParseError(parserError, html, filePath, warnings) {
22224
+ function handleParseError(parserError, errorCodes, html, filePath, warnings) {
22202
22225
  switch (parserError.code) {
22203
- case "missing-doctype": return;
22204
- case "abandoned-head-element-child": return;
22205
- case "duplicate-attribute": return;
22206
- case "non-void-html-element-start-tag-with-trailing-solidus": return;
22207
- case "unexpected-question-mark-instead-of-tag-name": return;
22226
+ case errorCodes.missingDoctype: return;
22227
+ case errorCodes.abandonedHeadElementChild: return;
22228
+ case errorCodes.duplicateAttribute: return;
22229
+ case errorCodes.nonVoidHtmlElementStartTagWithTrailingSolidus: return;
22230
+ case errorCodes.unexpectedQuestionMarkInsteadOfTagName: return;
22208
22231
  }
22209
22232
  const parseError = formatParseError(parserError, filePath, html);
22210
22233
  warnings[parseError.code] ??= `Unable to parse HTML; ${parseError.message}\n at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` + parseError.frame;
@@ -22554,7 +22577,7 @@ function findNeedTransformStyleAttribute(node) {
22554
22577
  if (!attr) return void 0;
22555
22578
  return {
22556
22579
  attr,
22557
- location: node.sourceCodeLocation?.attrs?.["style"]
22580
+ location: node.sourceCodeLocation?.attrs?.style
22558
22581
  };
22559
22582
  }
22560
22583
  function extractImportExpressionFromClassicScript(scriptTextNode) {
@@ -24001,7 +24024,7 @@ function servePublicMiddleware(server, publicFiles) {
24001
24024
  }));
24002
24025
  const toFilePath = (url) => {
24003
24026
  let filePath = cleanUrl(url);
24004
- if (filePath.indexOf("%") !== -1) try {
24027
+ if (filePath.includes("%")) try {
24005
24028
  filePath = decodeURI(filePath);
24006
24029
  } catch {}
24007
24030
  return normalizePath(filePath);
@@ -26256,7 +26279,7 @@ async function _createServer(inlineConfig = {}, options) {
26256
26279
  if (config.base !== "/") middlewares.use(baseMiddleware(config.rawBase, !!middlewareMode));
26257
26280
  middlewares.use("/__open-in-editor", (0, import_launch_editor_middleware.default)());
26258
26281
  middlewares.use(function viteHMRPingMiddleware(req, res, next) {
26259
- if (req.headers["accept"] === "text/x-vite-ping") res.writeHead(204).end();
26282
+ if (req.headers.accept === "text/x-vite-ping") res.writeHead(204).end();
26260
26283
  else next();
26261
26284
  });
26262
26285
  if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
@@ -26570,7 +26593,7 @@ function getSortedPluginsByHotUpdateHook(plugins) {
26570
26593
  const sortedPlugins = [];
26571
26594
  let pre = 0, normal = 0, post = 0;
26572
26595
  for (const plugin of plugins) {
26573
- const hook = plugin["hotUpdate"] ?? plugin["handleHotUpdate"];
26596
+ const hook = plugin.hotUpdate ?? plugin.handleHotUpdate;
26574
26597
  if (hook) {
26575
26598
  if (typeof hook === "object") {
26576
26599
  if (hook.order === "pre") {
@@ -28221,7 +28244,7 @@ function buildImportAnalysisPlugin(config) {
28221
28244
  return [{
28222
28245
  name: "vite:build-import-analysis",
28223
28246
  renderChunk(code, _, { format }) {
28224
- if (code.indexOf(isModernFlag) > -1) {
28247
+ if (code.includes(isModernFlag)) {
28225
28248
  const re = new RegExp(isModernFlag, "g");
28226
28249
  const isModern = String(format === "es");
28227
28250
  const isModernWithPadding = isModern + " ".repeat(isModernFlag.length - isModern.length);
@@ -28278,7 +28301,7 @@ function buildImportAnalysisPlugin(config) {
28278
28301
  const { modulePreload } = this.environment.config.build;
28279
28302
  for (const file in bundle) {
28280
28303
  const chunk = bundle[file];
28281
- if (chunk.type === "chunk" && chunk.code.indexOf(preloadMarker) > -1) {
28304
+ if (chunk.type === "chunk" && chunk.code.includes(preloadMarker)) {
28282
28305
  const code = chunk.code;
28283
28306
  let imports;
28284
28307
  try {
@@ -31566,8 +31589,8 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
31566
31589
  plugins,
31567
31590
  platform,
31568
31591
  transform: {
31569
- ...rolldownOptions.transform,
31570
31592
  target: ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
31593
+ ...rolldownOptions.transform,
31571
31594
  define
31572
31595
  },
31573
31596
  resolve: {
@@ -32299,12 +32322,15 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
32299
32322
  let entryPoint;
32300
32323
  if (data.exports) entryPoint = resolveExportsOrImports(data, ".", options, "exports", externalize);
32301
32324
  if (!entryPoint) {
32302
- for (const field of options.mainFields) if (field === "browser") {
32303
- entryPoint = tryResolveBrowserEntry(dir, data, options);
32304
- if (entryPoint) break;
32305
- } else if (typeof data[field] === "string") {
32325
+ for (const field of options.mainFields) if (typeof data[field] === "string") {
32306
32326
  entryPoint = data[field];
32307
32327
  break;
32328
+ } else if (field === "browser") {
32329
+ const browser = data[field];
32330
+ if (isObject$1(browser) && browser["."]) {
32331
+ entryPoint = browser["."];
32332
+ break;
32333
+ }
32308
32334
  }
32309
32335
  }
32310
32336
  entryPoint ||= data.main;
@@ -32387,14 +32413,6 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
32387
32413
  }
32388
32414
  }
32389
32415
  }
32390
- function tryResolveBrowserEntry(dir, data, options) {
32391
- const browserEntry = typeof data.browser === "string" ? data.browser : isObject$1(data.browser) && data.browser["."];
32392
- if (browserEntry) if (!options.isRequire && options.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
32393
- const resolvedBrowserEntry = tryFsResolve(path.join(dir, browserEntry), options);
32394
- if (resolvedBrowserEntry) if (hasESMSyntax(fs.readFileSync(resolvedBrowserEntry, "utf-8"))) return browserEntry;
32395
- else return data.module;
32396
- } else return browserEntry;
32397
- }
32398
32416
  /**
32399
32417
  * given a relative path in pkg dir,
32400
32418
  * return a relative path in pkg dir,
@@ -32771,6 +32789,7 @@ var build_exports = /* @__PURE__ */ __exportAll({
32771
32789
  });
32772
32790
  const _buildEnvironmentOptionsDefaults = Object.freeze({
32773
32791
  target: "baseline-widely-available",
32792
+ /** @deprecated */
32774
32793
  polyfillModulePreload: true,
32775
32794
  modulePreload: true,
32776
32795
  outDir: "dist",
@@ -33948,6 +33967,7 @@ const configDefaults = Object.freeze({
33948
33967
  define: {},
33949
33968
  dev: {
33950
33969
  warmup: [],
33970
+ /** @experimental */
33951
33971
  sourcemap: { js: true },
33952
33972
  sourcemapIgnoreList: void 0
33953
33973
  },
@@ -33956,6 +33976,7 @@ const configDefaults = Object.freeze({
33956
33976
  externalConditions: [...DEFAULT_EXTERNAL_CONDITIONS],
33957
33977
  extensions: DEFAULT_EXTENSIONS,
33958
33978
  dedupe: [],
33979
+ /** @experimental */
33959
33980
  noExternal: [],
33960
33981
  external: [],
33961
33982
  preserveSymlinks: false,
@@ -33972,9 +33993,11 @@ const configDefaults = Object.freeze({
33972
33993
  stringify: "auto"
33973
33994
  },
33974
33995
  assetsInclude: void 0,
33996
+ /** @experimental */
33975
33997
  builder: builderOptionsDefaults,
33976
33998
  server: serverConfigDefaults,
33977
33999
  preview: { port: DEFAULT_PREVIEW_PORT },
34000
+ /** @experimental */
33978
34001
  experimental: {
33979
34002
  importGlobRestoreExtension: false,
33980
34003
  renderBuiltUrl: void 0,
@@ -34005,10 +34028,15 @@ const configDefaults = Object.freeze({
34005
34028
  exclude: [],
34006
34029
  needsInterop: [],
34007
34030
  rolldownOptions: {},
34031
+ /** @experimental */
34008
34032
  extensions: [],
34033
+ /** @deprecated @experimental */
34009
34034
  disabled: "build",
34035
+ /** @experimental */
34010
34036
  holdUntilCrawlEnd: true,
34037
+ /** @experimental */
34011
34038
  force: false,
34039
+ /** @experimental */
34012
34040
  ignoreOutdatedRequests: false
34013
34041
  },
34014
34042
  ssr: ssrConfigDefaults,
@@ -3768,7 +3768,7 @@ declare const defaultAllowedOrigins: RegExp;
3768
3768
  type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
3769
3769
  declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
3770
3770
  resolve?: string | false | null;
3771
- }) => (id: string | unknown) => boolean;
3771
+ }) => (id: unknown) => boolean;
3772
3772
  declare const rollupVersion = "4.23.0";
3773
3773
  declare function normalizePath(id: string): string;
3774
3774
  declare const isCSSRequest: (request: string) => boolean;
@@ -249,7 +249,7 @@ declare class EvaluatedModuleNode {
249
249
  evaluated: boolean;
250
250
  meta: ResolvedResult | undefined;
251
251
  promise: Promise<any> | undefined;
252
- exports: any | undefined;
252
+ exports: any;
253
253
  file: string;
254
254
  map: DecodedMap | undefined;
255
255
  constructor(id: string, url: string);
@@ -90,12 +90,12 @@ const isAbsolute = function(p) {
90
90
  return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
91
91
  }, textDecoder = new TextDecoder(), decodeBase64 = typeof Buffer == "function" && typeof Buffer.from == "function" ? (base64) => Buffer.from(base64, "base64").toString("utf-8") : (base64) => textDecoder.decode(Uint8Array.from(atob(base64), (c) => c.charCodeAt(0))), percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, questionRegex = /\?/g, hashRegex = /#/g;
92
92
  function encodePathChars(filepath) {
93
- return filepath.indexOf("%") !== -1 && (filepath = filepath.replace(percentRegEx, "%25")), !isWindows && filepath.indexOf("\\") !== -1 && (filepath = filepath.replace(backslashRegEx, "%5C")), filepath.indexOf("\n") !== -1 && (filepath = filepath.replace(newlineRegEx, "%0A")), filepath.indexOf("\r") !== -1 && (filepath = filepath.replace(carriageReturnRegEx, "%0D")), filepath.indexOf(" ") !== -1 && (filepath = filepath.replace(tabRegEx, "%09")), filepath;
93
+ return filepath.includes("%") && (filepath = filepath.replace(percentRegEx, "%25")), !isWindows && filepath.includes("\\") && (filepath = filepath.replace(backslashRegEx, "%5C")), filepath.includes("\n") && (filepath = filepath.replace(newlineRegEx, "%0A")), filepath.includes("\r") && (filepath = filepath.replace(carriageReturnRegEx, "%0D")), filepath.includes(" ") && (filepath = filepath.replace(tabRegEx, "%09")), filepath;
94
94
  }
95
95
  const posixDirname = dirname, posixResolve = resolve;
96
96
  function posixPathToFileHref(posixPath) {
97
97
  let resolved = posixResolve(posixPath), filePathLast = posixPath.charCodeAt(posixPath.length - 1);
98
- return (filePathLast === 47 || isWindows && filePathLast === 92) && resolved[resolved.length - 1] !== "/" && (resolved += "/"), resolved = encodePathChars(resolved), resolved.indexOf("?") !== -1 && (resolved = resolved.replace(questionRegex, "%3F")), resolved.indexOf("#") !== -1 && (resolved = resolved.replace(hashRegex, "%23")), new URL(`file://${resolved}`).href;
98
+ return (filePathLast === 47 || isWindows && filePathLast === 92) && resolved[resolved.length - 1] !== "/" && (resolved += "/"), resolved = encodePathChars(resolved), resolved.includes("?") && (resolved = resolved.replace(questionRegex, "%3F")), resolved.includes("#") && (resolved = resolved.replace(hashRegex, "%23")), new URL(`file://${resolved}`).href;
99
99
  }
100
100
  function toWindowsPath(path) {
101
101
  return path.replace(/\//g, "\\");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.9",
3
+ "version": "8.0.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -63,7 +63,7 @@
63
63
  "lightningcss": "^1.32.0",
64
64
  "picomatch": "^4.0.4",
65
65
  "postcss": "^8.5.10",
66
- "rolldown": "1.0.0-rc.16",
66
+ "rolldown": "1.0.0-rc.17",
67
67
  "tinyglobby": "^0.2.16"
68
68
  },
69
69
  "optionalDependencies": {
@@ -184,7 +184,7 @@
184
184
  "build-types": "pnpm build-types-roll && pnpm build-types-check",
185
185
  "build-types-roll": "rolldown --config rolldown.dts.config.ts",
186
186
  "build-types-check": "tsc --project tsconfig.check.json",
187
- "typecheck": "tsc && tsc -p src/node && tsc -p src/module-runner && tsc -p src/shared && tsc -p src/node/__tests_dts__ && tsc -p src/module-runner/__tests_dts__",
187
+ "typecheck": "tsc && tsc -p src/node && tsc -p src/client && tsc -p src/module-runner && tsc -p src/shared && tsc -p src/node/__tests_dts__ && tsc -p src/module-runner/__tests_dts__",
188
188
  "lint": "eslint --cache --ext .ts src/**",
189
189
  "format": "oxfmt",
190
190
  "generate-target": "tsx scripts/generateTarget.ts"