vite 8.0.9 → 8.0.11
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.
- package/dist/client/client.mjs +19 -17
- package/dist/node/chunks/build.js +19 -19
- package/dist/node/chunks/dist.js +1 -1
- package/dist/node/chunks/node.js +526 -485
- package/dist/node/chunks/postcss-import.js +10 -10
- package/dist/node/index.d.ts +7 -3
- package/dist/node/module-runner.d.ts +1 -1
- package/dist/node/module-runner.js +5 -5
- package/package.json +14 -14
package/dist/node/chunks/node.js
CHANGED
|
@@ -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";
|
|
@@ -757,8 +757,6 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|
|
757
757
|
if (skipable && skipSourceless(line, index)) return;
|
|
758
758
|
return insert(line, index, [genColumn]);
|
|
759
759
|
}
|
|
760
|
-
assert$2(sourceLine);
|
|
761
|
-
assert$2(sourceColumn);
|
|
762
760
|
const sourcesIndex = put(sources, source);
|
|
763
761
|
const namesIndex = name ? put(names, name) : NO_NAME;
|
|
764
762
|
if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
|
|
@@ -776,7 +774,6 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|
|
776
774
|
sourceColumn
|
|
777
775
|
]);
|
|
778
776
|
}
|
|
779
|
-
function assert$2(_val) {}
|
|
780
777
|
function getIndex(arr, index) {
|
|
781
778
|
for (let i = arr.length; i <= index; i++) arr[i] = [];
|
|
782
779
|
return arr[index];
|
|
@@ -1088,11 +1085,11 @@ function getDate() {
|
|
|
1088
1085
|
function init$1(debug) {
|
|
1089
1086
|
debug.inspectOpts = Object.assign({}, inspectOpts);
|
|
1090
1087
|
}
|
|
1091
|
-
var require$1, colors$
|
|
1088
|
+
var require$1, colors$38, inspectOpts, humanize$1, createDebug, node_default;
|
|
1092
1089
|
var init_node = __esmMin((() => {
|
|
1093
1090
|
init_core();
|
|
1094
1091
|
require$1 = createRequire(import.meta.url);
|
|
1095
|
-
colors$
|
|
1092
|
+
colors$38 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
|
|
1096
1093
|
20,
|
|
1097
1094
|
21,
|
|
1098
1095
|
26,
|
|
@@ -1194,7 +1191,7 @@ var init_node = __esmMin((() => {
|
|
|
1194
1191
|
} catch (_unused) {
|
|
1195
1192
|
humanize$1 = humanize;
|
|
1196
1193
|
}
|
|
1197
|
-
createDebug = setup(useColors(), colors$
|
|
1194
|
+
createDebug = setup(useColors(), colors$38, log, load, save, formatArgs, init$1);
|
|
1198
1195
|
createDebug.inspectOpts = inspectOpts;
|
|
1199
1196
|
createDebug.formatters.o = function(v) {
|
|
1200
1197
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -2799,7 +2796,7 @@ function getTSConfigResolutionCache(config) {
|
|
|
2799
2796
|
}
|
|
2800
2797
|
return cache;
|
|
2801
2798
|
}
|
|
2802
|
-
|
|
2799
|
+
function reloadOnTsconfigChange(server, changedFile) {
|
|
2803
2800
|
if (changedFile.endsWith(".json")) {
|
|
2804
2801
|
const cache = getTSConfigResolutionCache(server.config);
|
|
2805
2802
|
if (changedFile.endsWith("/tsconfig.json")) {
|
|
@@ -3200,405 +3197,6 @@ function f(e, r, t) {
|
|
|
3200
3197
|
if (e.imports) return n$1(e.name, e.imports, r, t);
|
|
3201
3198
|
}
|
|
3202
3199
|
//#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
3200
|
//#region ../../node_modules/.pnpm/es-module-lexer@1.7.0/node_modules/es-module-lexer/dist/lexer.js
|
|
3603
3201
|
var ImportType;
|
|
3604
3202
|
(function(A) {
|
|
@@ -4909,6 +4507,400 @@ function throwFileNotFoundInOptimizedDep(id) {
|
|
|
4909
4507
|
throw err;
|
|
4910
4508
|
}
|
|
4911
4509
|
//#endregion
|
|
4510
|
+
//#region ../../node_modules/.pnpm/ufo@1.6.4/node_modules/ufo/dist/index.mjs
|
|
4511
|
+
const HASH_RE = /#/g;
|
|
4512
|
+
const AMPERSAND_RE = /&/g;
|
|
4513
|
+
const SLASH_RE = /\//g;
|
|
4514
|
+
const EQUAL_RE = /=/g;
|
|
4515
|
+
const PLUS_RE = /\+/g;
|
|
4516
|
+
const ENC_CARET_RE = /%5e/gi;
|
|
4517
|
+
const ENC_BACKTICK_RE = /%60/gi;
|
|
4518
|
+
const ENC_PIPE_RE = /%7c/gi;
|
|
4519
|
+
const ENC_SPACE_RE = /%20/gi;
|
|
4520
|
+
function encode(text) {
|
|
4521
|
+
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
|
4522
|
+
}
|
|
4523
|
+
function encodeQueryValue(input) {
|
|
4524
|
+
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");
|
|
4525
|
+
}
|
|
4526
|
+
function encodeQueryKey(text) {
|
|
4527
|
+
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
4528
|
+
}
|
|
4529
|
+
function encodeQueryItem(key, value) {
|
|
4530
|
+
if (typeof value === "number" || typeof value === "boolean") value = String(value);
|
|
4531
|
+
if (!value) return encodeQueryKey(key);
|
|
4532
|
+
if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
|
|
4533
|
+
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
|
4534
|
+
}
|
|
4535
|
+
function stringifyQuery(query) {
|
|
4536
|
+
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
|
4537
|
+
}
|
|
4538
|
+
new Set(builtinModules);
|
|
4539
|
+
function clearImports(imports) {
|
|
4540
|
+
return (imports || "").replace(/\/\/[^\n]*\n|\/\*.*\*\//g, "").replace(/\s+/g, " ");
|
|
4541
|
+
}
|
|
4542
|
+
function getImportNames(cleanedImports) {
|
|
4543
|
+
const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
|
|
4544
|
+
return {
|
|
4545
|
+
namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
|
|
4546
|
+
defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
|
|
4547
|
+
};
|
|
4548
|
+
}
|
|
4549
|
+
/**
|
|
4550
|
+
* @typedef ErrnoExceptionFields
|
|
4551
|
+
* @property {number | undefined} [errnode]
|
|
4552
|
+
* @property {string | undefined} [code]
|
|
4553
|
+
* @property {string | undefined} [path]
|
|
4554
|
+
* @property {string | undefined} [syscall]
|
|
4555
|
+
* @property {string | undefined} [url]
|
|
4556
|
+
*
|
|
4557
|
+
* @typedef {Error & ErrnoExceptionFields} ErrnoException
|
|
4558
|
+
*/
|
|
4559
|
+
const own$1 = {}.hasOwnProperty;
|
|
4560
|
+
const classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
4561
|
+
const kTypes = new Set([
|
|
4562
|
+
"string",
|
|
4563
|
+
"function",
|
|
4564
|
+
"number",
|
|
4565
|
+
"object",
|
|
4566
|
+
"Function",
|
|
4567
|
+
"Object",
|
|
4568
|
+
"boolean",
|
|
4569
|
+
"bigint",
|
|
4570
|
+
"symbol"
|
|
4571
|
+
]);
|
|
4572
|
+
const codes = {};
|
|
4573
|
+
/**
|
|
4574
|
+
* Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
|
|
4575
|
+
* We cannot use Intl.ListFormat because it's not available in
|
|
4576
|
+
* --without-intl builds.
|
|
4577
|
+
*
|
|
4578
|
+
* @param {Array<string>} array
|
|
4579
|
+
* An array of strings.
|
|
4580
|
+
* @param {string} [type]
|
|
4581
|
+
* The list type to be inserted before the last element.
|
|
4582
|
+
* @returns {string}
|
|
4583
|
+
*/
|
|
4584
|
+
function formatList(array, type = "and") {
|
|
4585
|
+
return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array[array.length - 1]}`;
|
|
4586
|
+
}
|
|
4587
|
+
/** @type {Map<string, MessageFunction | string>} */
|
|
4588
|
+
const messages = /* @__PURE__ */ new Map();
|
|
4589
|
+
const nodeInternalPrefix = "__node_internal_";
|
|
4590
|
+
/** @type {number} */
|
|
4591
|
+
let userStackTraceLimit;
|
|
4592
|
+
codes.ERR_INVALID_ARG_TYPE = createError(
|
|
4593
|
+
"ERR_INVALID_ARG_TYPE",
|
|
4594
|
+
/**
|
|
4595
|
+
* @param {string} name
|
|
4596
|
+
* @param {Array<string> | string} expected
|
|
4597
|
+
* @param {unknown} actual
|
|
4598
|
+
*/
|
|
4599
|
+
(name, expected, actual) => {
|
|
4600
|
+
assert.ok(typeof name === "string", "'name' must be a string");
|
|
4601
|
+
if (!Array.isArray(expected)) expected = [expected];
|
|
4602
|
+
let message = "The ";
|
|
4603
|
+
if (name.endsWith(" argument")) message += `${name} `;
|
|
4604
|
+
else {
|
|
4605
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
4606
|
+
message += `"${name}" ${type} `;
|
|
4607
|
+
}
|
|
4608
|
+
message += "must be ";
|
|
4609
|
+
/** @type {Array<string>} */
|
|
4610
|
+
const types = [];
|
|
4611
|
+
/** @type {Array<string>} */
|
|
4612
|
+
const instances = [];
|
|
4613
|
+
/** @type {Array<string>} */
|
|
4614
|
+
const other = [];
|
|
4615
|
+
for (const value of expected) {
|
|
4616
|
+
assert.ok(typeof value === "string", "All expected entries have to be of type string");
|
|
4617
|
+
if (kTypes.has(value)) types.push(value.toLowerCase());
|
|
4618
|
+
else if (classRegExp.exec(value) === null) {
|
|
4619
|
+
assert.ok(value !== "object", "The value \"object\" should be written as \"Object\"");
|
|
4620
|
+
other.push(value);
|
|
4621
|
+
} else instances.push(value);
|
|
4622
|
+
}
|
|
4623
|
+
if (instances.length > 0) {
|
|
4624
|
+
const pos = types.indexOf("object");
|
|
4625
|
+
if (pos !== -1) {
|
|
4626
|
+
types.slice(pos, 1);
|
|
4627
|
+
instances.push("Object");
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
if (types.length > 0) {
|
|
4631
|
+
message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
|
|
4632
|
+
if (instances.length > 0 || other.length > 0) message += " or ";
|
|
4633
|
+
}
|
|
4634
|
+
if (instances.length > 0) {
|
|
4635
|
+
message += `an instance of ${formatList(instances, "or")}`;
|
|
4636
|
+
if (other.length > 0) message += " or ";
|
|
4637
|
+
}
|
|
4638
|
+
if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
|
|
4639
|
+
else {
|
|
4640
|
+
if (other[0].toLowerCase() !== other[0]) message += "an ";
|
|
4641
|
+
message += `${other[0]}`;
|
|
4642
|
+
}
|
|
4643
|
+
message += `. Received ${determineSpecificType(actual)}`;
|
|
4644
|
+
return message;
|
|
4645
|
+
},
|
|
4646
|
+
TypeError
|
|
4647
|
+
);
|
|
4648
|
+
codes.ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
4649
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
4650
|
+
/**
|
|
4651
|
+
* @param {string} request
|
|
4652
|
+
* @param {string} reason
|
|
4653
|
+
* @param {string} [base]
|
|
4654
|
+
*/
|
|
4655
|
+
(request, reason, base = void 0) => {
|
|
4656
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
4657
|
+
},
|
|
4658
|
+
TypeError
|
|
4659
|
+
);
|
|
4660
|
+
codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
4661
|
+
"ERR_INVALID_PACKAGE_CONFIG",
|
|
4662
|
+
/**
|
|
4663
|
+
* @param {string} path
|
|
4664
|
+
* @param {string} [base]
|
|
4665
|
+
* @param {string} [message]
|
|
4666
|
+
*/
|
|
4667
|
+
(path, base, message) => {
|
|
4668
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
4669
|
+
},
|
|
4670
|
+
Error
|
|
4671
|
+
);
|
|
4672
|
+
codes.ERR_INVALID_PACKAGE_TARGET = createError(
|
|
4673
|
+
"ERR_INVALID_PACKAGE_TARGET",
|
|
4674
|
+
/**
|
|
4675
|
+
* @param {string} packagePath
|
|
4676
|
+
* @param {string} key
|
|
4677
|
+
* @param {unknown} target
|
|
4678
|
+
* @param {boolean} [isImport=false]
|
|
4679
|
+
* @param {string} [base]
|
|
4680
|
+
*/
|
|
4681
|
+
(packagePath, key, target, isImport = false, base = void 0) => {
|
|
4682
|
+
const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
4683
|
+
if (key === ".") {
|
|
4684
|
+
assert.ok(isImport === false);
|
|
4685
|
+
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 \"./\"" : ""}`;
|
|
4686
|
+
}
|
|
4687
|
+
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 \"./\"" : ""}`;
|
|
4688
|
+
},
|
|
4689
|
+
Error
|
|
4690
|
+
);
|
|
4691
|
+
codes.ERR_MODULE_NOT_FOUND = createError(
|
|
4692
|
+
"ERR_MODULE_NOT_FOUND",
|
|
4693
|
+
/**
|
|
4694
|
+
* @param {string} path
|
|
4695
|
+
* @param {string} base
|
|
4696
|
+
* @param {boolean} [exactUrl]
|
|
4697
|
+
*/
|
|
4698
|
+
(path, base, exactUrl = false) => {
|
|
4699
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
|
|
4700
|
+
},
|
|
4701
|
+
Error
|
|
4702
|
+
);
|
|
4703
|
+
codes.ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
|
|
4704
|
+
codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
|
|
4705
|
+
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
4706
|
+
/**
|
|
4707
|
+
* @param {string} specifier
|
|
4708
|
+
* @param {string} packagePath
|
|
4709
|
+
* @param {string} base
|
|
4710
|
+
*/
|
|
4711
|
+
(specifier, packagePath, base) => {
|
|
4712
|
+
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
|
4713
|
+
},
|
|
4714
|
+
TypeError
|
|
4715
|
+
);
|
|
4716
|
+
codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
4717
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
4718
|
+
/**
|
|
4719
|
+
* @param {string} packagePath
|
|
4720
|
+
* @param {string} subpath
|
|
4721
|
+
* @param {string} [base]
|
|
4722
|
+
*/
|
|
4723
|
+
(packagePath, subpath, base = void 0) => {
|
|
4724
|
+
if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
4725
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
4726
|
+
},
|
|
4727
|
+
Error
|
|
4728
|
+
);
|
|
4729
|
+
codes.ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
|
|
4730
|
+
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);
|
|
4731
|
+
codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
4732
|
+
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
4733
|
+
/**
|
|
4734
|
+
* @param {string} extension
|
|
4735
|
+
* @param {string} path
|
|
4736
|
+
*/
|
|
4737
|
+
(extension, path) => {
|
|
4738
|
+
return `Unknown file extension "${extension}" for ${path}`;
|
|
4739
|
+
},
|
|
4740
|
+
TypeError
|
|
4741
|
+
);
|
|
4742
|
+
codes.ERR_INVALID_ARG_VALUE = createError(
|
|
4743
|
+
"ERR_INVALID_ARG_VALUE",
|
|
4744
|
+
/**
|
|
4745
|
+
* @param {string} name
|
|
4746
|
+
* @param {unknown} value
|
|
4747
|
+
* @param {string} [reason='is invalid']
|
|
4748
|
+
*/
|
|
4749
|
+
(name, value, reason = "is invalid") => {
|
|
4750
|
+
let inspected = inspect(value);
|
|
4751
|
+
if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
|
|
4752
|
+
return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
4753
|
+
},
|
|
4754
|
+
TypeError
|
|
4755
|
+
);
|
|
4756
|
+
/**
|
|
4757
|
+
* Utility function for registering the error codes. Only used here. Exported
|
|
4758
|
+
* *only* to allow for testing.
|
|
4759
|
+
* @param {string} sym
|
|
4760
|
+
* @param {MessageFunction | string} value
|
|
4761
|
+
* @param {ErrorConstructor} constructor
|
|
4762
|
+
* @returns {new (...parameters: Array<any>) => Error}
|
|
4763
|
+
*/
|
|
4764
|
+
function createError(sym, value, constructor) {
|
|
4765
|
+
messages.set(sym, value);
|
|
4766
|
+
return makeNodeErrorWithCode(constructor, sym);
|
|
4767
|
+
}
|
|
4768
|
+
/**
|
|
4769
|
+
* @param {ErrorConstructor} Base
|
|
4770
|
+
* @param {string} key
|
|
4771
|
+
* @returns {ErrorConstructor}
|
|
4772
|
+
*/
|
|
4773
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
4774
|
+
return NodeError;
|
|
4775
|
+
/**
|
|
4776
|
+
* @param {Array<unknown>} parameters
|
|
4777
|
+
*/
|
|
4778
|
+
function NodeError(...parameters) {
|
|
4779
|
+
const limit = Error.stackTraceLimit;
|
|
4780
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
|
|
4781
|
+
const error = new Base();
|
|
4782
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
|
|
4783
|
+
const message = getMessage(key, parameters, error);
|
|
4784
|
+
Object.defineProperties(error, {
|
|
4785
|
+
message: {
|
|
4786
|
+
value: message,
|
|
4787
|
+
enumerable: false,
|
|
4788
|
+
writable: true,
|
|
4789
|
+
configurable: true
|
|
4790
|
+
},
|
|
4791
|
+
toString: {
|
|
4792
|
+
/** @this {Error} */
|
|
4793
|
+
value() {
|
|
4794
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
4795
|
+
},
|
|
4796
|
+
enumerable: false,
|
|
4797
|
+
writable: true,
|
|
4798
|
+
configurable: true
|
|
4799
|
+
}
|
|
4800
|
+
});
|
|
4801
|
+
captureLargerStackTrace(error);
|
|
4802
|
+
error.code = key;
|
|
4803
|
+
return error;
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
/**
|
|
4807
|
+
* @returns {boolean}
|
|
4808
|
+
*/
|
|
4809
|
+
function isErrorStackTraceLimitWritable() {
|
|
4810
|
+
try {
|
|
4811
|
+
if (v8.startupSnapshot.isBuildingSnapshot()) return false;
|
|
4812
|
+
} catch {}
|
|
4813
|
+
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
4814
|
+
if (desc === void 0) return Object.isExtensible(Error);
|
|
4815
|
+
return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
|
4816
|
+
}
|
|
4817
|
+
/**
|
|
4818
|
+
* This function removes unnecessary frames from Node.js core errors.
|
|
4819
|
+
* @template {(...parameters: unknown[]) => unknown} T
|
|
4820
|
+
* @param {T} wrappedFunction
|
|
4821
|
+
* @returns {T}
|
|
4822
|
+
*/
|
|
4823
|
+
function hideStackFrames(wrappedFunction) {
|
|
4824
|
+
const hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
4825
|
+
Object.defineProperty(wrappedFunction, "name", { value: hidden });
|
|
4826
|
+
return wrappedFunction;
|
|
4827
|
+
}
|
|
4828
|
+
const captureLargerStackTrace = hideStackFrames(
|
|
4829
|
+
/**
|
|
4830
|
+
* @param {Error} error
|
|
4831
|
+
* @returns {Error}
|
|
4832
|
+
*/
|
|
4833
|
+
function(error) {
|
|
4834
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
4835
|
+
if (stackTraceLimitIsWritable) {
|
|
4836
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
4837
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
4838
|
+
}
|
|
4839
|
+
Error.captureStackTrace(error);
|
|
4840
|
+
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
|
4841
|
+
return error;
|
|
4842
|
+
}
|
|
4843
|
+
);
|
|
4844
|
+
/**
|
|
4845
|
+
* @param {string} key
|
|
4846
|
+
* @param {Array<unknown>} parameters
|
|
4847
|
+
* @param {Error} self
|
|
4848
|
+
* @returns {string}
|
|
4849
|
+
*/
|
|
4850
|
+
function getMessage(key, parameters, self) {
|
|
4851
|
+
const message = messages.get(key);
|
|
4852
|
+
assert.ok(message !== void 0, "expected `message` to be found");
|
|
4853
|
+
if (typeof message === "function") {
|
|
4854
|
+
assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
|
|
4855
|
+
return Reflect.apply(message, self, parameters);
|
|
4856
|
+
}
|
|
4857
|
+
const regex = /%[dfijoOs]/g;
|
|
4858
|
+
let expectedLength = 0;
|
|
4859
|
+
while (regex.exec(message) !== null) expectedLength++;
|
|
4860
|
+
assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
|
|
4861
|
+
if (parameters.length === 0) return message;
|
|
4862
|
+
parameters.unshift(message);
|
|
4863
|
+
return Reflect.apply(format, null, parameters);
|
|
4864
|
+
}
|
|
4865
|
+
/**
|
|
4866
|
+
* Determine the specific type of a value for type-mismatch errors.
|
|
4867
|
+
* @param {unknown} value
|
|
4868
|
+
* @returns {string}
|
|
4869
|
+
*/
|
|
4870
|
+
function determineSpecificType(value) {
|
|
4871
|
+
if (value === null || value === void 0) return String(value);
|
|
4872
|
+
if (typeof value === "function" && value.name) return `function ${value.name}`;
|
|
4873
|
+
if (typeof value === "object") {
|
|
4874
|
+
if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
|
|
4875
|
+
return `${inspect(value, { depth: -1 })}`;
|
|
4876
|
+
}
|
|
4877
|
+
let inspected = inspect(value, { colors: false });
|
|
4878
|
+
if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
|
|
4879
|
+
return `type ${typeof value} (${inspected})`;
|
|
4880
|
+
}
|
|
4881
|
+
const DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
|
|
4882
|
+
new Set(DEFAULT_CONDITIONS);
|
|
4883
|
+
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;
|
|
4884
|
+
const TYPE_RE = /^\s*?type\s/;
|
|
4885
|
+
function parseStaticImport(matched) {
|
|
4886
|
+
const cleanedImports = clearImports(matched.imports);
|
|
4887
|
+
const namedImports = {};
|
|
4888
|
+
const _matches = cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || [];
|
|
4889
|
+
for (const namedImport of _matches) {
|
|
4890
|
+
const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
|
|
4891
|
+
const source = _match?.[1] || namedImport.trim();
|
|
4892
|
+
const importName = _match?.[2] || source;
|
|
4893
|
+
if (source && !TYPE_RE.test(source)) namedImports[source] = importName;
|
|
4894
|
+
}
|
|
4895
|
+
const { namespacedImport, defaultImport } = getImportNames(cleanedImports);
|
|
4896
|
+
return {
|
|
4897
|
+
...matched,
|
|
4898
|
+
defaultImport,
|
|
4899
|
+
namespacedImport,
|
|
4900
|
+
namedImports
|
|
4901
|
+
};
|
|
4902
|
+
}
|
|
4903
|
+
//#endregion
|
|
4912
4904
|
//#region src/node/env.ts
|
|
4913
4905
|
var import_main = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4914
4906
|
function _resolveEscapeSequences(value) {
|
|
@@ -10752,7 +10744,10 @@ function ssrFixStacktrace(e, moduleGraph) {
|
|
|
10752
10744
|
function createHMROptions(environment, options) {
|
|
10753
10745
|
if (environment.config.server.hmr === false || options.hmr === false) return false;
|
|
10754
10746
|
if (!("api" in environment.hot)) return false;
|
|
10755
|
-
return { logger: options.hmr?.logger
|
|
10747
|
+
return { logger: options.hmr?.logger ?? {
|
|
10748
|
+
debug: (...msg) => environment.logger.info(msg.join(" "), { timestamp: true }),
|
|
10749
|
+
error: (err) => environment.logger.error(err instanceof Error ? err.message : String(err), { timestamp: true })
|
|
10750
|
+
} };
|
|
10756
10751
|
}
|
|
10757
10752
|
const prepareStackTrace = { retrieveFile(id) {
|
|
10758
10753
|
if (existsSync(id)) return readFileSync(id, "utf-8");
|
|
@@ -10856,7 +10851,7 @@ var SSRCompatModuleRunner = class extends ModuleRunner {
|
|
|
10856
10851
|
}
|
|
10857
10852
|
};
|
|
10858
10853
|
//#endregion
|
|
10859
|
-
//#region ../../node_modules/.pnpm/periscopic@4.0.
|
|
10854
|
+
//#region ../../node_modules/.pnpm/periscopic@4.0.3/node_modules/periscopic/src/index.js
|
|
10860
10855
|
/**
|
|
10861
10856
|
* @param {import('estree').Node} param
|
|
10862
10857
|
* @returns {string[]}
|
|
@@ -11094,7 +11089,7 @@ async function ssrTransform(code, inMap, url, originalCode, options) {
|
|
|
11094
11089
|
if (options?.json?.stringify && isJSONRequest(url)) return ssrTransformJSON(code, inMap);
|
|
11095
11090
|
return ssrTransformScript(code, inMap, url, originalCode);
|
|
11096
11091
|
}
|
|
11097
|
-
|
|
11092
|
+
function ssrTransformJSON(code, inMap) {
|
|
11098
11093
|
return {
|
|
11099
11094
|
code: code.replace("export default", `${ssrModuleExportsKey}.default =`),
|
|
11100
11095
|
map: inMap,
|
|
@@ -14310,6 +14305,18 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14310
14305
|
ErrorEvent,
|
|
14311
14306
|
Event,
|
|
14312
14307
|
EventTarget: {
|
|
14308
|
+
/**
|
|
14309
|
+
* Register an event listener.
|
|
14310
|
+
*
|
|
14311
|
+
* @param {String} type A string representing the event type to listen for
|
|
14312
|
+
* @param {(Function|Object)} handler The listener to add
|
|
14313
|
+
* @param {Object} [options] An options object specifies characteristics about
|
|
14314
|
+
* the event listener
|
|
14315
|
+
* @param {Boolean} [options.once=false] A `Boolean` indicating that the
|
|
14316
|
+
* listener should be invoked at most once after being added. If `true`,
|
|
14317
|
+
* the listener would be automatically removed when invoked.
|
|
14318
|
+
* @public
|
|
14319
|
+
*/
|
|
14313
14320
|
addEventListener(type, handler, options = {}) {
|
|
14314
14321
|
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
|
|
14315
14322
|
let wrapper;
|
|
@@ -14346,6 +14353,13 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14346
14353
|
if (options.once) this.once(type, wrapper);
|
|
14347
14354
|
else this.on(type, wrapper);
|
|
14348
14355
|
},
|
|
14356
|
+
/**
|
|
14357
|
+
* Remove an event listener.
|
|
14358
|
+
*
|
|
14359
|
+
* @param {String} type A string representing the event type to remove
|
|
14360
|
+
* @param {(Function|Object)} handler The listener to remove
|
|
14361
|
+
* @public
|
|
14362
|
+
*/
|
|
14349
14363
|
removeEventListener(type, handler) {
|
|
14350
14364
|
for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
|
|
14351
14365
|
this.removeListener(type, listener);
|
|
@@ -19249,7 +19263,10 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19249
19263
|
/** @type {import('./index').Loader} */
|
|
19250
19264
|
const dynamicImport = async (id) => {
|
|
19251
19265
|
try {
|
|
19252
|
-
return (await import(
|
|
19266
|
+
return (await import(
|
|
19267
|
+
/* webpackIgnore: true */
|
|
19268
|
+
url.pathToFileURL(id).href
|
|
19269
|
+
)).default;
|
|
19253
19270
|
} catch (e) {
|
|
19254
19271
|
try {
|
|
19255
19272
|
return requireFunc(id);
|
|
@@ -19533,7 +19550,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19533
19550
|
};
|
|
19534
19551
|
}));
|
|
19535
19552
|
//#endregion
|
|
19536
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19553
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/req.js
|
|
19537
19554
|
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19538
19555
|
const { createRequire: createRequire$1 } = __require("node:module");
|
|
19539
19556
|
const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
|
|
@@ -19575,7 +19592,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19575
19592
|
module.exports = req;
|
|
19576
19593
|
}));
|
|
19577
19594
|
//#endregion
|
|
19578
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19595
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/options.js
|
|
19579
19596
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19580
19597
|
const req = require_req();
|
|
19581
19598
|
/**
|
|
@@ -19609,7 +19626,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19609
19626
|
module.exports = options;
|
|
19610
19627
|
}));
|
|
19611
19628
|
//#endregion
|
|
19612
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19629
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js
|
|
19613
19630
|
var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19614
19631
|
const req = require_req();
|
|
19615
19632
|
/**
|
|
@@ -19663,7 +19680,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19663
19680
|
module.exports = plugins;
|
|
19664
19681
|
}));
|
|
19665
19682
|
//#endregion
|
|
19666
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19683
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/index.js
|
|
19667
19684
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19668
19685
|
const { resolve: resolve$3 } = __require("node:path");
|
|
19669
19686
|
const config = require_src$1();
|
|
@@ -20347,8 +20364,10 @@ function getChunkOriginalFileName(chunk, root, isLegacy) {
|
|
|
20347
20364
|
var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
|
|
20348
20365
|
const decoder = new TextDecoder();
|
|
20349
20366
|
const _cssConfigDefaults = Object.freeze({
|
|
20367
|
+
/** @experimental */
|
|
20350
20368
|
transformer: "postcss",
|
|
20351
20369
|
preprocessorMaxWorkers: true,
|
|
20370
|
+
/** @experimental */
|
|
20352
20371
|
devSourcemap: false
|
|
20353
20372
|
});
|
|
20354
20373
|
const cssConfigDefaults = _cssConfigDefaults;
|
|
@@ -20410,7 +20429,7 @@ function cssPlugin(config) {
|
|
|
20410
20429
|
},
|
|
20411
20430
|
load: {
|
|
20412
20431
|
filter: { id: CSS_LANGS_RE },
|
|
20413
|
-
|
|
20432
|
+
handler(id) {
|
|
20414
20433
|
if (urlRE$1.test(id)) {
|
|
20415
20434
|
if (isModuleCSSRequest(id)) throw new Error(`?url is not supported with CSS modules. (tried to import ${JSON.stringify(id)})`);
|
|
20416
20435
|
if (isBuild) {
|
|
@@ -20550,7 +20569,7 @@ function cssPostPlugin(config) {
|
|
|
20550
20569
|
if (modulesCode) code = modulesCode;
|
|
20551
20570
|
else if (inlined) {
|
|
20552
20571
|
let content = css;
|
|
20553
|
-
if (config.build.cssMinify) content = await minifyCSS(content, config, true);
|
|
20572
|
+
if (config.build.cssMinify) content = await minifyCSS(content, config, true, id);
|
|
20554
20573
|
code = `export default ${JSON.stringify(content)}`;
|
|
20555
20574
|
} else code = "";
|
|
20556
20575
|
return {
|
|
@@ -20794,7 +20813,7 @@ function cssAnalysisPlugin(config) {
|
|
|
20794
20813
|
include: CSS_LANGS_RE,
|
|
20795
20814
|
exclude: [commonjsProxyRE, SPECIAL_QUERY_RE]
|
|
20796
20815
|
} },
|
|
20797
|
-
|
|
20816
|
+
handler(_, id) {
|
|
20798
20817
|
const { moduleGraph } = this.environment;
|
|
20799
20818
|
const thisModule = moduleGraph.getModuleById(id);
|
|
20800
20819
|
if (thisModule) {
|
|
@@ -21123,7 +21142,7 @@ function combineSourcemapsIfExists(filename, map1, map2) {
|
|
|
21123
21142
|
const viteHashUpdateMarker = "/*$vite$:1*/";
|
|
21124
21143
|
const viteHashUpdateMarkerRE = /\/\*\$vite\$:\d+\*\//;
|
|
21125
21144
|
async function finalizeCss(css, config) {
|
|
21126
|
-
if (css.includes("@import") || css.includes("@charset")) css =
|
|
21145
|
+
if (css.includes("@import") || css.includes("@charset")) css = hoistAtRules(css);
|
|
21127
21146
|
if (config.build.cssMinify) css = await minifyCSS(css, config, false);
|
|
21128
21147
|
css += viteHashUpdateMarker;
|
|
21129
21148
|
return css;
|
|
@@ -21254,13 +21273,14 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
|
|
|
21254
21273
|
if (newUrl === false) return matched;
|
|
21255
21274
|
return `@import ${matched.includes("url(") ? "url(" : ""}${wrap}${newUrl}${wrap}`;
|
|
21256
21275
|
}
|
|
21257
|
-
async function minifyCSS(css, config, inlined) {
|
|
21276
|
+
async function minifyCSS(css, config, inlined, filename = defaultCssBundleName) {
|
|
21258
21277
|
if (config.build.cssMinify === "esbuild") {
|
|
21259
21278
|
const { transform, formatMessages } = await importEsbuild();
|
|
21260
21279
|
try {
|
|
21261
21280
|
const { code, warnings } = await transform(css, {
|
|
21262
21281
|
loader: "css",
|
|
21263
21282
|
target: config.build.cssTarget || void 0,
|
|
21283
|
+
sourcefile: filename,
|
|
21264
21284
|
...resolveMinifyCssEsbuildOptions(config.esbuild || {})
|
|
21265
21285
|
});
|
|
21266
21286
|
if (warnings.length) {
|
|
@@ -21282,7 +21302,7 @@ async function minifyCSS(css, config, inlined) {
|
|
|
21282
21302
|
...config.css.lightningcss,
|
|
21283
21303
|
targets: convertTargets(config.build.cssTarget),
|
|
21284
21304
|
cssModules: void 0,
|
|
21285
|
-
filename
|
|
21305
|
+
filename,
|
|
21286
21306
|
code: Buffer.from(css),
|
|
21287
21307
|
minify: true
|
|
21288
21308
|
});
|
|
@@ -21330,7 +21350,7 @@ function resolveMinifyCssEsbuildOptions(options) {
|
|
|
21330
21350
|
}
|
|
21331
21351
|
const atImportRE = /@import(?:\s*(?:url\([^)]*\)|"(?:[^"]|(?<=\\)")*"|'(?:[^']|(?<=\\)')*').*?|[^;]*);/g;
|
|
21332
21352
|
const atCharsetRE = /@charset(?:\s*(?:"(?:[^"]|(?<=\\)")*"|'(?:[^']|(?<=\\)')*').*?|[^;]*);/g;
|
|
21333
|
-
|
|
21353
|
+
function hoistAtRules(css) {
|
|
21334
21354
|
const s = new MagicString(css);
|
|
21335
21355
|
const cleanCss = emptyCssComments(css);
|
|
21336
21356
|
let match;
|
|
@@ -22132,13 +22152,13 @@ function traverseNodes(node, visitor) {
|
|
|
22132
22152
|
if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
|
|
22133
22153
|
}
|
|
22134
22154
|
async function traverseHtml(html, filePath, warn, visitor) {
|
|
22135
|
-
const { parse } = await import("./dist.js");
|
|
22155
|
+
const { parse, ErrorCodes } = await import("./dist.js");
|
|
22136
22156
|
const warnings = {};
|
|
22137
22157
|
traverseNodes(parse(html, {
|
|
22138
22158
|
scriptingEnabled: false,
|
|
22139
22159
|
sourceCodeLocationInfo: true,
|
|
22140
22160
|
onParseError: (e) => {
|
|
22141
|
-
handleParseError(e, html, filePath, warnings);
|
|
22161
|
+
handleParseError(e, ErrorCodes, html, filePath, warnings);
|
|
22142
22162
|
}
|
|
22143
22163
|
}), visitor);
|
|
22144
22164
|
for (const message of Object.values(warnings)) warn(import_picocolors.default.yellow(`\n${message}`));
|
|
@@ -22154,7 +22174,7 @@ function getScriptInfo(node) {
|
|
|
22154
22174
|
if (p.name === "src") {
|
|
22155
22175
|
if (!src) {
|
|
22156
22176
|
src = p;
|
|
22157
|
-
srcSourceCodeLocation = node.sourceCodeLocation?.attrs
|
|
22177
|
+
srcSourceCodeLocation = node.sourceCodeLocation?.attrs.src;
|
|
22158
22178
|
}
|
|
22159
22179
|
} else if (p.name === "type" && p.value === "module") isModule = true;
|
|
22160
22180
|
else if (p.name === "async") isAsync = true;
|
|
@@ -22198,13 +22218,13 @@ function formatParseError(parserError, id, html) {
|
|
|
22198
22218
|
}
|
|
22199
22219
|
};
|
|
22200
22220
|
}
|
|
22201
|
-
function handleParseError(parserError, html, filePath, warnings) {
|
|
22221
|
+
function handleParseError(parserError, errorCodes, html, filePath, warnings) {
|
|
22202
22222
|
switch (parserError.code) {
|
|
22203
|
-
case
|
|
22204
|
-
case
|
|
22205
|
-
case
|
|
22206
|
-
case
|
|
22207
|
-
case
|
|
22223
|
+
case errorCodes.missingDoctype: return;
|
|
22224
|
+
case errorCodes.abandonedHeadElementChild: return;
|
|
22225
|
+
case errorCodes.duplicateAttribute: return;
|
|
22226
|
+
case errorCodes.nonVoidHtmlElementStartTagWithTrailingSolidus: return;
|
|
22227
|
+
case errorCodes.unexpectedQuestionMarkInsteadOfTagName: return;
|
|
22208
22228
|
}
|
|
22209
22229
|
const parseError = formatParseError(parserError, filePath, html);
|
|
22210
22230
|
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 +22574,7 @@ function findNeedTransformStyleAttribute(node) {
|
|
|
22554
22574
|
if (!attr) return void 0;
|
|
22555
22575
|
return {
|
|
22556
22576
|
attr,
|
|
22557
|
-
location: node.sourceCodeLocation?.attrs?.
|
|
22577
|
+
location: node.sourceCodeLocation?.attrs?.style
|
|
22558
22578
|
};
|
|
22559
22579
|
}
|
|
22560
22580
|
function extractImportExpressionFromClassicScript(scriptTextNode) {
|
|
@@ -22897,18 +22917,18 @@ function definePlugin(config) {
|
|
|
22897
22917
|
};
|
|
22898
22918
|
return {
|
|
22899
22919
|
name: "vite:define",
|
|
22900
|
-
transform: {
|
|
22920
|
+
transform: { handler(code, id) {
|
|
22901
22921
|
if (this.environment.config.consumer === "client") return;
|
|
22902
22922
|
if (isHTMLRequest(id) || isCSSRequest(id) || isNonJsRequest(id) || config.assetsInclude(id)) return;
|
|
22903
22923
|
const [define, pattern] = getPattern(this.environment);
|
|
22904
22924
|
if (!pattern) return;
|
|
22905
22925
|
pattern.lastIndex = 0;
|
|
22906
22926
|
if (!pattern.test(code)) return;
|
|
22907
|
-
return
|
|
22927
|
+
return replaceDefine(this.environment, code, id, define);
|
|
22908
22928
|
} }
|
|
22909
22929
|
};
|
|
22910
22930
|
}
|
|
22911
|
-
|
|
22931
|
+
function replaceDefine(environment, code, id, define) {
|
|
22912
22932
|
const result = transformSync(id, code, {
|
|
22913
22933
|
lang: "js",
|
|
22914
22934
|
sourceType: "module",
|
|
@@ -22965,13 +22985,13 @@ function clientInjectionsPlugin(config) {
|
|
|
22965
22985
|
async buildStart() {
|
|
22966
22986
|
injectConfigValues = await createClientConfigValueReplacer(config);
|
|
22967
22987
|
},
|
|
22968
|
-
|
|
22988
|
+
transform(code, id) {
|
|
22969
22989
|
const ssr = this.environment.config.consumer === "server";
|
|
22970
22990
|
const cleanId = cleanUrl(id);
|
|
22971
22991
|
if (cleanId === normalizedClientEntry$1 || cleanId === normalizedEnvEntry$1) return getDefineReplacer(this)(injectConfigValues(code));
|
|
22972
22992
|
else if (!ssr && code.includes("process.env.NODE_ENV")) {
|
|
22973
22993
|
const nodeEnv = this.environment.config.define?.["process.env.NODE_ENV"] || JSON.stringify(process.env.NODE_ENV || config.mode);
|
|
22974
|
-
return
|
|
22994
|
+
return replaceDefine(this.environment, code, id, {
|
|
22975
22995
|
"process.env.NODE_ENV": nodeEnv,
|
|
22976
22996
|
"global.process.env.NODE_ENV": nodeEnv,
|
|
22977
22997
|
"globalThis.process.env.NODE_ENV": nodeEnv
|
|
@@ -23346,7 +23366,7 @@ function createDepsOptimizer(environment) {
|
|
|
23346
23366
|
path: "*"
|
|
23347
23367
|
});
|
|
23348
23368
|
}
|
|
23349
|
-
|
|
23369
|
+
function rerun() {
|
|
23350
23370
|
const depsString = depsLogString(Object.keys(metadata.discovered));
|
|
23351
23371
|
debug$9?.(import_picocolors.default.green(`new dependencies found: ${depsString}`));
|
|
23352
23372
|
runOptimizer();
|
|
@@ -24001,7 +24021,7 @@ function servePublicMiddleware(server, publicFiles) {
|
|
|
24001
24021
|
}));
|
|
24002
24022
|
const toFilePath = (url) => {
|
|
24003
24023
|
let filePath = cleanUrl(url);
|
|
24004
|
-
if (filePath.
|
|
24024
|
+
if (filePath.includes("%")) try {
|
|
24005
24025
|
filePath = decodeURI(filePath);
|
|
24006
24026
|
} catch {}
|
|
24007
24027
|
return normalizePath(filePath);
|
|
@@ -24715,7 +24735,7 @@ var DevEnvironment = class extends BaseEnvironment {
|
|
|
24715
24735
|
});
|
|
24716
24736
|
}
|
|
24717
24737
|
});
|
|
24718
|
-
this.hot.on("vite:invalidate",
|
|
24738
|
+
this.hot.on("vite:invalidate", ({ path, message, firstInvalidatedBy }, client) => {
|
|
24719
24739
|
this.invalidateModule({
|
|
24720
24740
|
path,
|
|
24721
24741
|
message,
|
|
@@ -24846,7 +24866,7 @@ function setupOnCrawlEnd() {
|
|
|
24846
24866
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
24847
24867
|
timeoutHandle = setTimeout(callOnCrawlEndWhenIdle, callCrawlEndIfIdleAfterMs);
|
|
24848
24868
|
}
|
|
24849
|
-
|
|
24869
|
+
function callOnCrawlEndWhenIdle() {
|
|
24850
24870
|
if (cancelled || registeredIds.size > 0) return;
|
|
24851
24871
|
onCrawlEndPromiseWithResolvers.resolve();
|
|
24852
24872
|
}
|
|
@@ -26256,7 +26276,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
26256
26276
|
if (config.base !== "/") middlewares.use(baseMiddleware(config.rawBase, !!middlewareMode));
|
|
26257
26277
|
middlewares.use("/__open-in-editor", (0, import_launch_editor_middleware.default)());
|
|
26258
26278
|
middlewares.use(function viteHMRPingMiddleware(req, res, next) {
|
|
26259
|
-
if (req.headers
|
|
26279
|
+
if (req.headers.accept === "text/x-vite-ping") res.writeHead(204).end();
|
|
26260
26280
|
else next();
|
|
26261
26281
|
});
|
|
26262
26282
|
if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
|
|
@@ -26570,7 +26590,7 @@ function getSortedPluginsByHotUpdateHook(plugins) {
|
|
|
26570
26590
|
const sortedPlugins = [];
|
|
26571
26591
|
let pre = 0, normal = 0, post = 0;
|
|
26572
26592
|
for (const plugin of plugins) {
|
|
26573
|
-
const hook = plugin
|
|
26593
|
+
const hook = plugin.hotUpdate ?? plugin.handleHotUpdate;
|
|
26574
26594
|
if (hook) {
|
|
26575
26595
|
if (typeof hook === "object") {
|
|
26576
26596
|
if (hook.order === "pre") {
|
|
@@ -27337,7 +27357,7 @@ function webWorkerPlugin(config) {
|
|
|
27337
27357
|
},
|
|
27338
27358
|
transform: {
|
|
27339
27359
|
filter: { id: workerFileRE },
|
|
27340
|
-
|
|
27360
|
+
handler(raw, id) {
|
|
27341
27361
|
const workerFileMatch = workerFileRE.exec(id);
|
|
27342
27362
|
if (workerFileMatch) {
|
|
27343
27363
|
const workerType = workerFileMatch[1];
|
|
@@ -27972,7 +27992,7 @@ export default ${wasmHelperCode}
|
|
|
27972
27992
|
},
|
|
27973
27993
|
renderChunk: env.config.consumer === "server" ? {
|
|
27974
27994
|
filter: { code: wasmInitUrlRE },
|
|
27975
|
-
|
|
27995
|
+
handler(code, chunk, opts, meta) {
|
|
27976
27996
|
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format, this.environment.config.isWorker);
|
|
27977
27997
|
let match;
|
|
27978
27998
|
let s;
|
|
@@ -28221,7 +28241,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28221
28241
|
return [{
|
|
28222
28242
|
name: "vite:build-import-analysis",
|
|
28223
28243
|
renderChunk(code, _, { format }) {
|
|
28224
|
-
if (code.
|
|
28244
|
+
if (code.includes(isModernFlag)) {
|
|
28225
28245
|
const re = new RegExp(isModernFlag, "g");
|
|
28226
28246
|
const isModern = String(format === "es");
|
|
28227
28247
|
const isModernWithPadding = isModern + " ".repeat(isModernFlag.length - isModern.length);
|
|
@@ -28278,7 +28298,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28278
28298
|
const { modulePreload } = this.environment.config.build;
|
|
28279
28299
|
for (const file in bundle) {
|
|
28280
28300
|
const chunk = bundle[file];
|
|
28281
|
-
if (chunk.type === "chunk" && chunk.code.
|
|
28301
|
+
if (chunk.type === "chunk" && chunk.code.includes(preloadMarker)) {
|
|
28282
28302
|
const code = chunk.code;
|
|
28283
28303
|
let imports;
|
|
28284
28304
|
try {
|
|
@@ -28755,15 +28775,22 @@ function importGlobPlugin(config) {
|
|
|
28755
28775
|
async handler(code, id) {
|
|
28756
28776
|
const result = await transformGlobImport(code, id, config.root, (im, _, options) => this.resolve(im, id, options).then((i) => i?.id || im), config.experimental.importGlobRestoreExtension, config.logger);
|
|
28757
28777
|
if (result) {
|
|
28758
|
-
const allGlobs = result.matches.map((i) => i.globsResolved);
|
|
28759
28778
|
if (!importGlobMaps.has(this.environment)) importGlobMaps.set(this.environment, /* @__PURE__ */ new Map());
|
|
28760
|
-
const globMatchers =
|
|
28779
|
+
const globMatchers = result.matches.map((i) => {
|
|
28761
28780
|
const affirmed = [];
|
|
28762
28781
|
const negated = [];
|
|
28763
|
-
for (const glob of
|
|
28782
|
+
for (const glob of i.globsResolved) if (glob[0] === "!") negated.push(glob.slice(1));
|
|
28764
28783
|
else affirmed.push(glob);
|
|
28765
|
-
const affirmedMatcher = picomatch(affirmed
|
|
28766
|
-
|
|
28784
|
+
const affirmedMatcher = picomatch(affirmed, {
|
|
28785
|
+
noextglob: true,
|
|
28786
|
+
dot: !!i.options.exhaustive,
|
|
28787
|
+
ignore: i.options.exhaustive ? [] : ["**/node_modules/**"]
|
|
28788
|
+
});
|
|
28789
|
+
const negatedMatcher = picomatch(negated, {
|
|
28790
|
+
noextglob: true,
|
|
28791
|
+
dot: !!i.options.exhaustive,
|
|
28792
|
+
ignore: i.options.exhaustive ? [] : ["**/node_modules/**"]
|
|
28793
|
+
});
|
|
28767
28794
|
return (file) => {
|
|
28768
28795
|
return (affirmed.length === 0 || affirmedMatcher(file)) && !(negated.length > 0 && negatedMatcher(file));
|
|
28769
28796
|
};
|
|
@@ -29149,7 +29176,7 @@ function createFilterForTransform(idFilter, codeFilter, moduleTypeFilter, cwd) {
|
|
|
29149
29176
|
};
|
|
29150
29177
|
}
|
|
29151
29178
|
//#endregion
|
|
29152
|
-
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
29179
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/helpers.js
|
|
29153
29180
|
function notNullish(v) {
|
|
29154
29181
|
return v != null;
|
|
29155
29182
|
}
|
|
@@ -29157,7 +29184,7 @@ function isPrimitive(value) {
|
|
|
29157
29184
|
return value === null || typeof value !== "function" && typeof value !== "object";
|
|
29158
29185
|
}
|
|
29159
29186
|
//#endregion
|
|
29160
|
-
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
29187
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
|
|
29161
29188
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
29162
29189
|
function normalizeWindowsPath(input = "") {
|
|
29163
29190
|
if (!input) return input;
|
|
@@ -29236,7 +29263,7 @@ const isAbsolute$2 = function(p) {
|
|
|
29236
29263
|
return _IS_ABSOLUTE_RE.test(p);
|
|
29237
29264
|
};
|
|
29238
29265
|
//#endregion
|
|
29239
|
-
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
29266
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/source-map.js
|
|
29240
29267
|
var comma = ",".charCodeAt(0);
|
|
29241
29268
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
29242
29269
|
var intToChar = new Uint8Array(64);
|
|
@@ -29523,7 +29550,7 @@ function parseSingleV8Stack(raw) {
|
|
|
29523
29550
|
function parseStacktrace(stack, options = {}) {
|
|
29524
29551
|
const { ignoreStackEntries = stackIgnorePatterns } = options;
|
|
29525
29552
|
let stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
|
|
29526
|
-
const helperIndex = stacks.findLastIndex((s) => s.method
|
|
29553
|
+
const helperIndex = stacks.findLastIndex((s) => s.method.includes("__VITEST_HELPER__"));
|
|
29527
29554
|
if (helperIndex >= 0) stacks = stacks.slice(helperIndex + 1);
|
|
29528
29555
|
return stacks.map((stack) => {
|
|
29529
29556
|
if (options.getUrlId) stack.file = options.getUrlId(stack.file);
|
|
@@ -29709,10 +29736,11 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
29709
29736
|
const isBuild = config.command === "build";
|
|
29710
29737
|
const isBundled = config.isBundled;
|
|
29711
29738
|
const isWorker = config.isWorker;
|
|
29712
|
-
const buildPlugins = isBundled ?
|
|
29739
|
+
const buildPlugins = isBundled ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
|
|
29713
29740
|
pre: [],
|
|
29714
29741
|
post: []
|
|
29715
29742
|
};
|
|
29743
|
+
const devtoolsIntegrationPlugin = config.devtools.enabled && !isWorker ? await loadDevToolsIntegrationPlugin(config) : null;
|
|
29716
29744
|
const { modulePreload } = config.build;
|
|
29717
29745
|
return [
|
|
29718
29746
|
!isBundled ? optimizedDepsPlugin() : null,
|
|
@@ -29768,6 +29796,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
29768
29796
|
importGlobPlugin(config),
|
|
29769
29797
|
...postPlugins,
|
|
29770
29798
|
...buildPlugins.post,
|
|
29799
|
+
devtoolsIntegrationPlugin,
|
|
29771
29800
|
...isBundled ? [] : [
|
|
29772
29801
|
clientInjectionsPlugin(config),
|
|
29773
29802
|
cssAnalysisPlugin(config),
|
|
@@ -29775,6 +29804,15 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
29775
29804
|
]
|
|
29776
29805
|
].filter(Boolean);
|
|
29777
29806
|
}
|
|
29807
|
+
async function loadDevToolsIntegrationPlugin(config) {
|
|
29808
|
+
try {
|
|
29809
|
+
const { DevToolsIntegration } = await import("@vitejs/devtools/integration");
|
|
29810
|
+
return DevToolsIntegration({ config });
|
|
29811
|
+
} catch (error) {
|
|
29812
|
+
config.logger.error(import_picocolors.default.red(`Failed to load Vite DevTools integration: ${error?.message || error?.stack}`), { error });
|
|
29813
|
+
return null;
|
|
29814
|
+
}
|
|
29815
|
+
}
|
|
29778
29816
|
function createPluginHookUtils(plugins) {
|
|
29779
29817
|
const sortedPluginsCache = /* @__PURE__ */ new Map();
|
|
29780
29818
|
function getSortedPlugins(hookName) {
|
|
@@ -31195,7 +31233,7 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
31195
31233
|
},
|
|
31196
31234
|
transform: {
|
|
31197
31235
|
filter: { code: assetImportMetaUrlRE },
|
|
31198
|
-
|
|
31236
|
+
handler(code, id) {
|
|
31199
31237
|
let s;
|
|
31200
31238
|
const re = new RegExp(assetImportMetaUrlRE);
|
|
31201
31239
|
const cleanString = stripLiteral(code);
|
|
@@ -31566,8 +31604,8 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
|
|
|
31566
31604
|
plugins,
|
|
31567
31605
|
platform,
|
|
31568
31606
|
transform: {
|
|
31569
|
-
...rolldownOptions.transform,
|
|
31570
31607
|
target: ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
|
|
31608
|
+
...rolldownOptions.transform,
|
|
31571
31609
|
define
|
|
31572
31610
|
},
|
|
31573
31611
|
resolve: {
|
|
@@ -32299,12 +32337,15 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
32299
32337
|
let entryPoint;
|
|
32300
32338
|
if (data.exports) entryPoint = resolveExportsOrImports(data, ".", options, "exports", externalize);
|
|
32301
32339
|
if (!entryPoint) {
|
|
32302
|
-
for (const field of options.mainFields) if (field === "
|
|
32303
|
-
entryPoint = tryResolveBrowserEntry(dir, data, options);
|
|
32304
|
-
if (entryPoint) break;
|
|
32305
|
-
} else if (typeof data[field] === "string") {
|
|
32340
|
+
for (const field of options.mainFields) if (typeof data[field] === "string") {
|
|
32306
32341
|
entryPoint = data[field];
|
|
32307
32342
|
break;
|
|
32343
|
+
} else if (field === "browser") {
|
|
32344
|
+
const browser = data[field];
|
|
32345
|
+
if (isObject$1(browser) && browser["."]) {
|
|
32346
|
+
entryPoint = browser["."];
|
|
32347
|
+
break;
|
|
32348
|
+
}
|
|
32308
32349
|
}
|
|
32309
32350
|
}
|
|
32310
32351
|
entryPoint ||= data.main;
|
|
@@ -32387,14 +32428,6 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
|
|
|
32387
32428
|
}
|
|
32388
32429
|
}
|
|
32389
32430
|
}
|
|
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
32431
|
/**
|
|
32399
32432
|
* given a relative path in pkg dir,
|
|
32400
32433
|
* return a relative path in pkg dir,
|
|
@@ -32632,7 +32665,7 @@ const licenseFiles = [
|
|
|
32632
32665
|
function licensePlugin() {
|
|
32633
32666
|
return {
|
|
32634
32667
|
name: "vite:license",
|
|
32635
|
-
|
|
32668
|
+
generateBundle(_, bundle) {
|
|
32636
32669
|
const licenseOption = this.environment.config.build.license;
|
|
32637
32670
|
if (licenseOption === false) return;
|
|
32638
32671
|
const packageCache = /* @__PURE__ */ new Map();
|
|
@@ -32771,6 +32804,7 @@ var build_exports = /* @__PURE__ */ __exportAll({
|
|
|
32771
32804
|
});
|
|
32772
32805
|
const _buildEnvironmentOptionsDefaults = Object.freeze({
|
|
32773
32806
|
target: "baseline-widely-available",
|
|
32807
|
+
/** @deprecated */
|
|
32774
32808
|
polyfillModulePreload: true,
|
|
32775
32809
|
modulePreload: true,
|
|
32776
32810
|
outDir: "dist",
|
|
@@ -32833,7 +32867,7 @@ function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev, isS
|
|
|
32833
32867
|
}
|
|
32834
32868
|
};
|
|
32835
32869
|
}
|
|
32836
|
-
|
|
32870
|
+
function resolveBuildPlugins(config) {
|
|
32837
32871
|
const isBuild = config.command === "build";
|
|
32838
32872
|
return {
|
|
32839
32873
|
pre: [
|
|
@@ -33423,12 +33457,11 @@ async function createBuilder(inlineConfig = {}, useLegacyBuilder = false) {
|
|
|
33423
33457
|
return output;
|
|
33424
33458
|
},
|
|
33425
33459
|
async runDevTools() {
|
|
33426
|
-
|
|
33427
|
-
|
|
33428
|
-
|
|
33429
|
-
await start(devtoolsConfig.config);
|
|
33460
|
+
if (config.devtools.enabled) try {
|
|
33461
|
+
const { runDevTools } = await import("@vitejs/devtools/integration");
|
|
33462
|
+
await runDevTools(builder);
|
|
33430
33463
|
} catch (e) {
|
|
33431
|
-
config.logger.error(import_picocolors.default.red(`Failed to run Vite DevTools: ${e
|
|
33464
|
+
config.logger.error(import_picocolors.default.red(`Failed to run Vite DevTools: ${e?.message || e?.stack}`), { error: e });
|
|
33432
33465
|
}
|
|
33433
33466
|
}
|
|
33434
33467
|
};
|
|
@@ -33948,6 +33981,7 @@ const configDefaults = Object.freeze({
|
|
|
33948
33981
|
define: {},
|
|
33949
33982
|
dev: {
|
|
33950
33983
|
warmup: [],
|
|
33984
|
+
/** @experimental */
|
|
33951
33985
|
sourcemap: { js: true },
|
|
33952
33986
|
sourcemapIgnoreList: void 0
|
|
33953
33987
|
},
|
|
@@ -33956,6 +33990,7 @@ const configDefaults = Object.freeze({
|
|
|
33956
33990
|
externalConditions: [...DEFAULT_EXTERNAL_CONDITIONS],
|
|
33957
33991
|
extensions: DEFAULT_EXTENSIONS,
|
|
33958
33992
|
dedupe: [],
|
|
33993
|
+
/** @experimental */
|
|
33959
33994
|
noExternal: [],
|
|
33960
33995
|
external: [],
|
|
33961
33996
|
preserveSymlinks: false,
|
|
@@ -33972,9 +34007,11 @@ const configDefaults = Object.freeze({
|
|
|
33972
34007
|
stringify: "auto"
|
|
33973
34008
|
},
|
|
33974
34009
|
assetsInclude: void 0,
|
|
34010
|
+
/** @experimental */
|
|
33975
34011
|
builder: builderOptionsDefaults,
|
|
33976
34012
|
server: serverConfigDefaults,
|
|
33977
34013
|
preview: { port: DEFAULT_PREVIEW_PORT },
|
|
34014
|
+
/** @experimental */
|
|
33978
34015
|
experimental: {
|
|
33979
34016
|
importGlobRestoreExtension: false,
|
|
33980
34017
|
renderBuiltUrl: void 0,
|
|
@@ -34005,10 +34042,15 @@ const configDefaults = Object.freeze({
|
|
|
34005
34042
|
exclude: [],
|
|
34006
34043
|
needsInterop: [],
|
|
34007
34044
|
rolldownOptions: {},
|
|
34045
|
+
/** @experimental */
|
|
34008
34046
|
extensions: [],
|
|
34047
|
+
/** @deprecated @experimental */
|
|
34009
34048
|
disabled: "build",
|
|
34049
|
+
/** @experimental */
|
|
34010
34050
|
holdUntilCrawlEnd: true,
|
|
34051
|
+
/** @experimental */
|
|
34011
34052
|
force: false,
|
|
34053
|
+
/** @experimental */
|
|
34012
34054
|
ignoreOutdatedRequests: false
|
|
34013
34055
|
},
|
|
34014
34056
|
ssr: ssrConfigDefaults,
|
|
@@ -34068,14 +34110,14 @@ function getDefaultEnvironmentOptions(config) {
|
|
|
34068
34110
|
* Check and warn if `path` includes characters that don't work well in Vite,
|
|
34069
34111
|
* such as `#` and `?` and `*`.
|
|
34070
34112
|
*/
|
|
34071
|
-
function checkBadCharactersInPath(name, path, logger) {
|
|
34113
|
+
function checkBadCharactersInPath(name, type, path, logger) {
|
|
34072
34114
|
const badChars = [];
|
|
34073
34115
|
if (path.includes("#")) badChars.push("#");
|
|
34074
34116
|
if (path.includes("?")) badChars.push("?");
|
|
34075
34117
|
if (path.includes("*")) badChars.push("*");
|
|
34076
34118
|
if (badChars.length > 0) {
|
|
34077
34119
|
const charString = badChars.map((c) => `"${c}"`).join(" and ");
|
|
34078
|
-
logger.warn(import_picocolors.default.yellow(`${name} contains the ${charString} ${badChars.length > 1 ? "characters" : "character"} (${import_picocolors.default.cyan(path)}), which may not work when running Vite. Consider renaming the
|
|
34120
|
+
logger.warn(import_picocolors.default.yellow(`${name} contains the ${charString} ${badChars.length > 1 ? "characters" : "character"} (${import_picocolors.default.cyan(path)}), which may not work when running Vite. Consider renaming the ${type} without the characters.`));
|
|
34079
34121
|
}
|
|
34080
34122
|
}
|
|
34081
34123
|
const clientAlias = [{
|
|
@@ -34234,7 +34276,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
34234
34276
|
const tsconfigPathsPlugin = userPlugins.find((p) => p.name === "vite-tsconfig-paths" || p.name === "vite-plugin-tsconfig-paths");
|
|
34235
34277
|
if (tsconfigPathsPlugin) logger.warnOnce(import_picocolors.default.yellow(`The plugin ${JSON.stringify(tsconfigPathsPlugin.name)} is detected. Vite now supports tsconfig paths resolution natively via the ${import_picocolors.default.bold("resolve.tsconfigPaths")} option. You can remove the plugin and set ${import_picocolors.default.bold("resolve.tsconfigPaths: true")} in your Vite config instead.`));
|
|
34236
34278
|
const resolvedRoot = normalizePath(config.root ? path.resolve(config.root) : process.cwd());
|
|
34237
|
-
checkBadCharactersInPath("The project root", resolvedRoot, logger);
|
|
34279
|
+
checkBadCharactersInPath("The project root", "directory", resolvedRoot, logger);
|
|
34238
34280
|
const configEnvironmentsClient = config.environments.client;
|
|
34239
34281
|
configEnvironmentsClient.dev ??= {};
|
|
34240
34282
|
const deprecatedSsrOptimizeDepsConfig = config.ssr?.optimizeDeps ?? {};
|
|
@@ -34280,7 +34322,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
34280
34322
|
createEnvironment: void 0
|
|
34281
34323
|
}
|
|
34282
34324
|
};
|
|
34283
|
-
for (const name of Object.keys(config.environments)) config.environments[name] = mergeConfig(name === "client" ? defaultClientEnvironmentOptions : defaultNonClientEnvironmentOptions, config.environments[name]);
|
|
34325
|
+
for (const name of Object.keys(config.environments)) config.environments[name] = mergeConfig(name === "client" ? defaultClientEnvironmentOptions : deepClone(defaultNonClientEnvironmentOptions), config.environments[name]);
|
|
34284
34326
|
await runConfigEnvironmentHook(config.environments, userPlugins, logger, configEnv, config.ssr?.target === "webworker");
|
|
34285
34327
|
const isBundledDev = command === "serve" && !!config.experimental?.bundledDev;
|
|
34286
34328
|
config.resolve ??= {};
|
|
@@ -34481,7 +34523,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
34481
34523
|
optimizeDepsDisabledBackwardCompatibility(resolved, resolved.optimizeDeps);
|
|
34482
34524
|
optimizeDepsDisabledBackwardCompatibility(resolved, resolved.ssr.optimizeDeps, "ssr.");
|
|
34483
34525
|
if (!resolved.builder?.sharedConfigBuild && resolved.environments.ssr) resolved.environments.ssr.build.emitAssets = resolved.build.ssrEmitAssets || resolved.build.emitAssets;
|
|
34484
|
-
if (resolved.devtools.enabled) resolved.build.rolldownOptions.devtools ??= {};
|
|
34485
34526
|
applyDepOptimizationOptionCompat(resolved);
|
|
34486
34527
|
await setOptimizeDepsPluginNames(resolved);
|
|
34487
34528
|
debug?.(`using resolved config: %O`, {
|
|
@@ -34579,7 +34620,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
34579
34620
|
};
|
|
34580
34621
|
} catch (e) {
|
|
34581
34622
|
const logger = createLogger(logLevel, { customLogger });
|
|
34582
|
-
checkBadCharactersInPath("The config path", resolvedPath, logger);
|
|
34623
|
+
checkBadCharactersInPath("The config path", "file", resolvedPath, logger);
|
|
34583
34624
|
logger.error(import_picocolors.default.red(`failed to load config from ${resolvedPath}`), { error: e });
|
|
34584
34625
|
throw e;
|
|
34585
34626
|
}
|
|
@@ -34632,7 +34673,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
34632
34673
|
name: "externalize-deps",
|
|
34633
34674
|
resolveId: {
|
|
34634
34675
|
filter: { id: /^[^.#].*/ },
|
|
34635
|
-
|
|
34676
|
+
handler(id, importer, { kind }) {
|
|
34636
34677
|
if (!importer || path.isAbsolute(id) || isNodeBuiltin(id)) return;
|
|
34637
34678
|
if (isNodeLikeBuiltin(id) || id.startsWith("npm:")) return {
|
|
34638
34679
|
id,
|