vite 8.1.3 → 8.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/client.mjs +4 -4
- package/dist/node/chunks/build.js +156 -80
- package/dist/node/chunks/lib.js +1 -1
- package/dist/node/chunks/node.js +466 -76
- package/dist/node/chunks/postcss-import.js +1 -1
- package/dist/node/cli.js +3 -4
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +1 -2
- package/package.json +6 -6
- package/dist/node/chunks/logger.js +0 -364
package/dist/node/chunks/node.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { A as OPTIMIZABLE_ENTRY_RE, B as __esmMin, C as ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, D as JS_TYPES_RE, E as FS_PREFIX, F as defaultAllowedOrigins, H as __require, I as loopbackHosts, L as wildcardHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as require_picocolors, S as ENV_PUBLIC_PATH, T as ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, U as __toCommonJS, V as __exportAll, W as __toESM, _ as DEFAULT_SERVER_CONDITIONS, a as CLIENT_ENTRY, b as DEV_PROD_CONDITION, c as DEFAULT_ASSETS_INLINE_LIMIT, d as DEFAULT_CLIENT_MAIN_FIELDS, f as DEFAULT_CONFIG_FILES, g as DEFAULT_PREVIEW_PORT, h as DEFAULT_EXTERNAL_CONDITIONS, i as CLIENT_DIR, j as ROLLUP_HOOKS, k as METADATA_FILENAME, l as DEFAULT_ASSETS_RE, m as DEFAULT_EXTENSIONS, n as createLogger, o as CLIENT_PUBLIC_PATH, p as DEFAULT_DEV_PORT, r as printServerUrls, s as CSS_LANGS_RE, t as LogLevels, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS, w as ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, x as ENV_ENTRY, y as DEP_VERSION_RE, z as __commonJSMin } from "./logger.js";
|
|
2
1
|
import { Module, builtinModules, createRequire } from "node:module";
|
|
3
2
|
import { parseAst, parseAstAsync } from "rolldown/parseAst";
|
|
4
3
|
import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequirePlugin$1 } from "rolldown/plugins";
|
|
@@ -37,6 +36,48 @@ import { Buffer as Buffer$1 } from "node:buffer";
|
|
|
37
36
|
import zlib from "zlib";
|
|
38
37
|
import * as qs from "node:querystring";
|
|
39
38
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
39
|
+
//#region \0rolldown/runtime.js
|
|
40
|
+
var __create = Object.create;
|
|
41
|
+
var __defProp = Object.defineProperty;
|
|
42
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
43
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
44
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
45
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
46
|
+
var __esmMin = (fn, res, err) => () => {
|
|
47
|
+
if (err) throw err[0];
|
|
48
|
+
try {
|
|
49
|
+
return fn && (res = fn(fn = 0)), res;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
throw err = [e], e;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
55
|
+
var __exportAll = (all, no_symbols) => {
|
|
56
|
+
let target = {};
|
|
57
|
+
for (var name in all) __defProp(target, name, {
|
|
58
|
+
get: all[name],
|
|
59
|
+
enumerable: true
|
|
60
|
+
});
|
|
61
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
62
|
+
return target;
|
|
63
|
+
};
|
|
64
|
+
var __copyProps = (to, from, except, desc) => {
|
|
65
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
66
|
+
key = keys[i];
|
|
67
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
68
|
+
get: ((k) => from[k]).bind(null, key),
|
|
69
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return to;
|
|
73
|
+
};
|
|
74
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
75
|
+
value: mod,
|
|
76
|
+
enumerable: true
|
|
77
|
+
}) : target, mod));
|
|
78
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
79
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
80
|
+
//#endregion
|
|
40
81
|
//#region ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
|
|
41
82
|
/**
|
|
42
83
|
* @typedef {{ tracked?: boolean }} GetEnvOptions
|
|
@@ -145,6 +186,74 @@ function getEnvs(query, options) {
|
|
|
145
186
|
return a.getEnvs(query, options);
|
|
146
187
|
}
|
|
147
188
|
//#endregion
|
|
189
|
+
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
190
|
+
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
191
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
192
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
193
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
194
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
195
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
196
|
+
};
|
|
197
|
+
let replaceClose = (string, close, replace, index) => {
|
|
198
|
+
let result = "", cursor = 0;
|
|
199
|
+
do {
|
|
200
|
+
result += string.substring(cursor, index) + replace;
|
|
201
|
+
cursor = index + close.length;
|
|
202
|
+
index = string.indexOf(close, cursor);
|
|
203
|
+
} while (~index);
|
|
204
|
+
return result + string.substring(cursor);
|
|
205
|
+
};
|
|
206
|
+
let createColors = (enabled = isColorSupported) => {
|
|
207
|
+
let f = enabled ? formatter : () => String;
|
|
208
|
+
return {
|
|
209
|
+
isColorSupported: enabled,
|
|
210
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
211
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
212
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
213
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
214
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
215
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
216
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
217
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
218
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
219
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
220
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
221
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
222
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
223
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
224
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
225
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
226
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
227
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
228
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
229
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
230
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
231
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
232
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
233
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
234
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
235
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
236
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
237
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
238
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
239
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
240
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
241
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
242
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
243
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
244
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
245
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
246
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
247
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
248
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
249
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
250
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
module.exports = createColors();
|
|
254
|
+
module.exports.createColors = createColors;
|
|
255
|
+
}));
|
|
256
|
+
//#endregion
|
|
148
257
|
//#region ../../node_modules/.pnpm/fresh-import@0.2.1/node_modules/fresh-import/dist/index.js
|
|
149
258
|
const instanceId = Math.random().toString(36).slice(2);
|
|
150
259
|
const relativeImportRE = /^\.{1,2}(?:\/|\\)/;
|
|
@@ -430,6 +539,156 @@ const importMetaResolveWithCustomHookString = `
|
|
|
430
539
|
|
|
431
540
|
`;
|
|
432
541
|
//#endregion
|
|
542
|
+
//#region src/node/constants.ts
|
|
543
|
+
const { version } = JSON.parse(readFileSync(new URL("../../package.json", new URL("../../../src/node/constants.ts", import.meta.url))).toString());
|
|
544
|
+
const ROLLUP_HOOKS = [
|
|
545
|
+
"options",
|
|
546
|
+
"buildStart",
|
|
547
|
+
"buildEnd",
|
|
548
|
+
"renderStart",
|
|
549
|
+
"renderError",
|
|
550
|
+
"renderChunk",
|
|
551
|
+
"writeBundle",
|
|
552
|
+
"generateBundle",
|
|
553
|
+
"banner",
|
|
554
|
+
"footer",
|
|
555
|
+
"augmentChunkHash",
|
|
556
|
+
"outputOptions",
|
|
557
|
+
"intro",
|
|
558
|
+
"outro",
|
|
559
|
+
"closeBundle",
|
|
560
|
+
"closeWatcher",
|
|
561
|
+
"load",
|
|
562
|
+
"moduleParsed",
|
|
563
|
+
"watchChange",
|
|
564
|
+
"resolveDynamicImport",
|
|
565
|
+
"resolveId",
|
|
566
|
+
"transform",
|
|
567
|
+
"onLog"
|
|
568
|
+
];
|
|
569
|
+
const VERSION = version;
|
|
570
|
+
const DEFAULT_MAIN_FIELDS = [
|
|
571
|
+
"browser",
|
|
572
|
+
"module",
|
|
573
|
+
"jsnext:main",
|
|
574
|
+
"jsnext"
|
|
575
|
+
];
|
|
576
|
+
const DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
|
|
577
|
+
const DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser"));
|
|
578
|
+
/**
|
|
579
|
+
* A special condition that would be replaced with production or development
|
|
580
|
+
* depending on NODE_ENV env variable
|
|
581
|
+
*/
|
|
582
|
+
const DEV_PROD_CONDITION = `development|production`;
|
|
583
|
+
const DEFAULT_CONDITIONS$1 = [
|
|
584
|
+
"module",
|
|
585
|
+
"browser",
|
|
586
|
+
"node",
|
|
587
|
+
DEV_PROD_CONDITION
|
|
588
|
+
];
|
|
589
|
+
const DEFAULT_CLIENT_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS$1.filter((c) => c !== "node"));
|
|
590
|
+
const DEFAULT_SERVER_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS$1.filter((c) => c !== "browser"));
|
|
591
|
+
const DEFAULT_EXTERNAL_CONDITIONS = Object.freeze(["node", "module-sync"]);
|
|
592
|
+
const DEFAULT_EXTENSIONS = [
|
|
593
|
+
".mjs",
|
|
594
|
+
".js",
|
|
595
|
+
".mts",
|
|
596
|
+
".ts",
|
|
597
|
+
".jsx",
|
|
598
|
+
".tsx",
|
|
599
|
+
".json"
|
|
600
|
+
];
|
|
601
|
+
/**
|
|
602
|
+
* The browser versions that are included in the Baseline Widely Available on 2025-05-01.
|
|
603
|
+
*
|
|
604
|
+
* This value would be bumped on each major release of Vite.
|
|
605
|
+
*
|
|
606
|
+
* The value is generated by `pnpm generate-target` script.
|
|
607
|
+
*/
|
|
608
|
+
const ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET = [
|
|
609
|
+
"chrome111",
|
|
610
|
+
"edge111",
|
|
611
|
+
"firefox114",
|
|
612
|
+
"safari16.4",
|
|
613
|
+
"ios16.4"
|
|
614
|
+
];
|
|
615
|
+
const DEFAULT_CONFIG_FILES = [
|
|
616
|
+
"vite.config.js",
|
|
617
|
+
"vite.config.mjs",
|
|
618
|
+
"vite.config.ts",
|
|
619
|
+
"vite.config.cjs",
|
|
620
|
+
"vite.config.mts",
|
|
621
|
+
"vite.config.cts"
|
|
622
|
+
];
|
|
623
|
+
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
624
|
+
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
625
|
+
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
|
626
|
+
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
627
|
+
/**
|
|
628
|
+
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
629
|
+
*/
|
|
630
|
+
const FS_PREFIX = `/@fs/`;
|
|
631
|
+
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
632
|
+
const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
633
|
+
const VITE_PACKAGE_DIR = resolve(fileURLToPath(new URL("../../../src/node/constants.ts", import.meta.url)), "../../..");
|
|
634
|
+
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
|
635
|
+
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
|
636
|
+
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
637
|
+
const KNOWN_ASSET_TYPES = [
|
|
638
|
+
"apng",
|
|
639
|
+
"bmp",
|
|
640
|
+
"png",
|
|
641
|
+
"jpe?g",
|
|
642
|
+
"jfif",
|
|
643
|
+
"pjpeg",
|
|
644
|
+
"pjp",
|
|
645
|
+
"gif",
|
|
646
|
+
"svg",
|
|
647
|
+
"ico",
|
|
648
|
+
"webp",
|
|
649
|
+
"avif",
|
|
650
|
+
"cur",
|
|
651
|
+
"jxl",
|
|
652
|
+
"mp4",
|
|
653
|
+
"webm",
|
|
654
|
+
"ogg",
|
|
655
|
+
"mp3",
|
|
656
|
+
"wav",
|
|
657
|
+
"flac",
|
|
658
|
+
"aac",
|
|
659
|
+
"opus",
|
|
660
|
+
"mov",
|
|
661
|
+
"m4a",
|
|
662
|
+
"vtt",
|
|
663
|
+
"woff2?",
|
|
664
|
+
"eot",
|
|
665
|
+
"ttf",
|
|
666
|
+
"otf",
|
|
667
|
+
"webmanifest",
|
|
668
|
+
"pdf",
|
|
669
|
+
"txt"
|
|
670
|
+
];
|
|
671
|
+
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`, "i");
|
|
672
|
+
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
|
|
673
|
+
const loopbackHosts = /* @__PURE__ */ new Set([
|
|
674
|
+
"localhost",
|
|
675
|
+
"127.0.0.1",
|
|
676
|
+
"::1",
|
|
677
|
+
"0000:0000:0000:0000:0000:0000:0000:0001"
|
|
678
|
+
]);
|
|
679
|
+
const wildcardHosts = /* @__PURE__ */ new Set([
|
|
680
|
+
"0.0.0.0",
|
|
681
|
+
"::",
|
|
682
|
+
"0000:0000:0000:0000:0000:0000:0000:0000"
|
|
683
|
+
]);
|
|
684
|
+
const DEFAULT_DEV_PORT = 5173;
|
|
685
|
+
const DEFAULT_PREVIEW_PORT = 4173;
|
|
686
|
+
const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
|
|
687
|
+
const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
|
|
688
|
+
const METADATA_FILENAME = "_metadata.json";
|
|
689
|
+
const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
|
|
690
|
+
const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
|
|
691
|
+
//#endregion
|
|
433
692
|
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
434
693
|
var comma$1 = ",".charCodeAt(0);
|
|
435
694
|
var semicolon = ";".charCodeAt(0);
|
|
@@ -1342,11 +1601,11 @@ function getDate() {
|
|
|
1342
1601
|
function init$1(debug) {
|
|
1343
1602
|
debug.inspectOpts = Object.assign({}, inspectOpts);
|
|
1344
1603
|
}
|
|
1345
|
-
var require$1, colors$
|
|
1604
|
+
var require$1, colors$39, inspectOpts, humanize$1, createDebug, node_default;
|
|
1346
1605
|
var init_node = __esmMin((() => {
|
|
1347
1606
|
init_core();
|
|
1348
1607
|
require$1 = createRequire(import.meta.url);
|
|
1349
|
-
colors$
|
|
1608
|
+
colors$39 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
|
|
1350
1609
|
20,
|
|
1351
1610
|
21,
|
|
1352
1611
|
26,
|
|
@@ -1448,7 +1707,7 @@ var init_node = __esmMin((() => {
|
|
|
1448
1707
|
} catch (_unused) {
|
|
1449
1708
|
humanize$1 = humanize;
|
|
1450
1709
|
}
|
|
1451
|
-
createDebug = setup(useColors(), colors$
|
|
1710
|
+
createDebug = setup(useColors(), colors$39, log, load, save, formatArgs, init$1);
|
|
1452
1711
|
createDebug.inspectOpts = inspectOpts;
|
|
1453
1712
|
createDebug.formatters.o = function(v) {
|
|
1454
1713
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -2872,6 +3131,103 @@ function perEnvironmentPlugin(name, applyToEnvironment) {
|
|
|
2872
3131
|
};
|
|
2873
3132
|
}
|
|
2874
3133
|
//#endregion
|
|
3134
|
+
//#region src/node/logger.ts
|
|
3135
|
+
const LogLevels = {
|
|
3136
|
+
silent: 0,
|
|
3137
|
+
error: 1,
|
|
3138
|
+
warn: 2,
|
|
3139
|
+
info: 3
|
|
3140
|
+
};
|
|
3141
|
+
let lastType;
|
|
3142
|
+
let lastMsg;
|
|
3143
|
+
let sameCount = 0;
|
|
3144
|
+
function clearScreen() {
|
|
3145
|
+
const repeatCount = process.stdout.rows - 2;
|
|
3146
|
+
const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
|
|
3147
|
+
console.log(blank);
|
|
3148
|
+
readline.cursorTo(process.stdout, 0, 0);
|
|
3149
|
+
readline.clearScreenDown(process.stdout);
|
|
3150
|
+
}
|
|
3151
|
+
let timeFormatter;
|
|
3152
|
+
function getTimeFormatter() {
|
|
3153
|
+
timeFormatter ??= new Intl.DateTimeFormat(void 0, {
|
|
3154
|
+
hour: "numeric",
|
|
3155
|
+
minute: "numeric",
|
|
3156
|
+
second: "numeric"
|
|
3157
|
+
});
|
|
3158
|
+
return timeFormatter;
|
|
3159
|
+
}
|
|
3160
|
+
function createLogger(level = "info", options = {}) {
|
|
3161
|
+
if (options.customLogger) return options.customLogger;
|
|
3162
|
+
const loggedErrors = /* @__PURE__ */ new WeakSet();
|
|
3163
|
+
const { prefix = "[vite]", allowClearScreen = true, console = globalThis.console } = options;
|
|
3164
|
+
const thresh = LogLevels[level];
|
|
3165
|
+
const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
|
|
3166
|
+
const clear = canClearScreen ? clearScreen : () => {};
|
|
3167
|
+
function format(type, msg, options = {}) {
|
|
3168
|
+
if (options.timestamp) {
|
|
3169
|
+
let tag = "";
|
|
3170
|
+
if (type === "info") tag = import_picocolors.default.cyan(import_picocolors.default.bold(prefix));
|
|
3171
|
+
else if (type === "warn") tag = import_picocolors.default.yellow(import_picocolors.default.bold(prefix));
|
|
3172
|
+
else tag = import_picocolors.default.red(import_picocolors.default.bold(prefix));
|
|
3173
|
+
const environment = options.environment ? options.environment + " " : "";
|
|
3174
|
+
return `${import_picocolors.default.dim(getTimeFormatter().format(/* @__PURE__ */ new Date()))} ${tag} ${environment}${msg}`;
|
|
3175
|
+
} else return msg;
|
|
3176
|
+
}
|
|
3177
|
+
function output(type, msg, options = {}) {
|
|
3178
|
+
if (thresh >= LogLevels[type]) {
|
|
3179
|
+
const method = type === "info" ? "log" : type;
|
|
3180
|
+
if (options.error) loggedErrors.add(options.error);
|
|
3181
|
+
if (canClearScreen) if (type === lastType && msg === lastMsg) {
|
|
3182
|
+
sameCount++;
|
|
3183
|
+
clear();
|
|
3184
|
+
console[method](format(type, msg, options), import_picocolors.default.yellow(`(x${sameCount + 1})`));
|
|
3185
|
+
} else {
|
|
3186
|
+
sameCount = 0;
|
|
3187
|
+
lastMsg = msg;
|
|
3188
|
+
lastType = type;
|
|
3189
|
+
if (options.clear) clear();
|
|
3190
|
+
console[method](format(type, msg, options));
|
|
3191
|
+
}
|
|
3192
|
+
else console[method](format(type, msg, options));
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
const warnedMessages = /* @__PURE__ */ new Set();
|
|
3196
|
+
const logger = {
|
|
3197
|
+
hasWarned: false,
|
|
3198
|
+
info(msg, opts) {
|
|
3199
|
+
output("info", msg, opts);
|
|
3200
|
+
},
|
|
3201
|
+
warn(msg, opts) {
|
|
3202
|
+
logger.hasWarned = true;
|
|
3203
|
+
output("warn", msg, opts);
|
|
3204
|
+
},
|
|
3205
|
+
warnOnce(msg, opts) {
|
|
3206
|
+
if (warnedMessages.has(msg)) return;
|
|
3207
|
+
logger.hasWarned = true;
|
|
3208
|
+
output("warn", msg, opts);
|
|
3209
|
+
warnedMessages.add(msg);
|
|
3210
|
+
},
|
|
3211
|
+
error(msg, opts) {
|
|
3212
|
+
logger.hasWarned = true;
|
|
3213
|
+
output("error", msg, opts);
|
|
3214
|
+
},
|
|
3215
|
+
clearScreen(type) {
|
|
3216
|
+
if (thresh >= LogLevels[type]) clear();
|
|
3217
|
+
},
|
|
3218
|
+
hasErrorLogged(error) {
|
|
3219
|
+
return loggedErrors.has(error);
|
|
3220
|
+
}
|
|
3221
|
+
};
|
|
3222
|
+
return logger;
|
|
3223
|
+
}
|
|
3224
|
+
function printServerUrls(urls, optionsHost, info) {
|
|
3225
|
+
const colorUrl = (url) => import_picocolors.default.cyan(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
|
|
3226
|
+
for (const url of urls.local) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Local")}: ${colorUrl(url)}`);
|
|
3227
|
+
for (const url of urls.network) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: ${colorUrl(url)}`);
|
|
3228
|
+
if (urls.network.length === 0 && optionsHost === void 0) info(import_picocolors.default.dim(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: use `) + import_picocolors.default.bold("--host") + import_picocolors.default.dim(" to expose"));
|
|
3229
|
+
}
|
|
3230
|
+
//#endregion
|
|
2875
3231
|
//#region src/node/plugins/reporter.ts
|
|
2876
3232
|
function buildReporterPlugin(config) {
|
|
2877
3233
|
return perEnvironmentPlugin("native:reporter", (env) => {
|
|
@@ -8694,7 +9050,7 @@ var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
8694
9050
|
module.exports = (filePath) => extensions.has(path$10.extname(filePath).slice(1).toLowerCase());
|
|
8695
9051
|
}));
|
|
8696
9052
|
//#endregion
|
|
8697
|
-
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=
|
|
9053
|
+
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
|
|
8698
9054
|
var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8699
9055
|
const { sep: sep$1 } = __require("path");
|
|
8700
9056
|
const { platform } = process;
|
|
@@ -8758,7 +9114,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8758
9114
|
exports.isIBMi = os$3.type() === "OS400";
|
|
8759
9115
|
}));
|
|
8760
9116
|
//#endregion
|
|
8761
|
-
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=
|
|
9117
|
+
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/nodefs-handler.js
|
|
8762
9118
|
var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8763
9119
|
const fs$9 = __require("fs");
|
|
8764
9120
|
const sysPath$2 = __require("path");
|
|
@@ -8874,7 +9230,8 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
8874
9230
|
const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
|
|
8875
9231
|
cont.watcherUnusable = true;
|
|
8876
9232
|
if (isWindows && error.code === "EPERM") try {
|
|
8877
|
-
|
|
9233
|
+
const fd = await open(path, "r");
|
|
9234
|
+
await close(fd);
|
|
8878
9235
|
broadcastErr(error);
|
|
8879
9236
|
} catch (err) {}
|
|
8880
9237
|
else broadcastErr(error);
|
|
@@ -9215,7 +9572,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
9215
9572
|
module.exports = NodeFsHandler;
|
|
9216
9573
|
}));
|
|
9217
9574
|
//#endregion
|
|
9218
|
-
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=
|
|
9575
|
+
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/fsevents-handler.js
|
|
9219
9576
|
var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9220
9577
|
const fs$8 = __require("fs");
|
|
9221
9578
|
const sysPath$1 = __require("path");
|
|
@@ -9550,7 +9907,7 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
9550
9907
|
module.exports.canUse = canUse;
|
|
9551
9908
|
}));
|
|
9552
9909
|
//#endregion
|
|
9553
|
-
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=
|
|
9910
|
+
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/index.js
|
|
9554
9911
|
var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
9555
9912
|
const { EventEmitter: EventEmitter$3 } = __require("events");
|
|
9556
9913
|
const fs$7 = __require("fs");
|
|
@@ -10181,6 +10538,7 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10181
10538
|
* @param {Path} path
|
|
10182
10539
|
*/
|
|
10183
10540
|
_closeFile(path) {
|
|
10541
|
+
path = sysPath.normalize(path);
|
|
10184
10542
|
const closers = this._closers.get(path);
|
|
10185
10543
|
if (!closers) return;
|
|
10186
10544
|
closers.forEach((closer) => closer());
|
|
@@ -10193,6 +10551,7 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10193
10551
|
*/
|
|
10194
10552
|
_addPathCloser(path, closer) {
|
|
10195
10553
|
if (!closer) return;
|
|
10554
|
+
path = sysPath.normalize(path);
|
|
10196
10555
|
let list = this._closers.get(path);
|
|
10197
10556
|
if (!list) {
|
|
10198
10557
|
list = [];
|
|
@@ -10813,7 +11172,8 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
|
|
|
10813
11172
|
res.statusCode = 500;
|
|
10814
11173
|
res.end(`launch-editor-middleware: required query param "file" is missing.`);
|
|
10815
11174
|
} else {
|
|
10816
|
-
|
|
11175
|
+
const resolved = file.startsWith("file://") ? file : path$6.resolve(srcRoot, file);
|
|
11176
|
+
launch(resolved, specifiedEditor, onErrorCallback);
|
|
10817
11177
|
res.end();
|
|
10818
11178
|
}
|
|
10819
11179
|
};
|
|
@@ -11630,11 +11990,15 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
11630
11990
|
const topNode = parentStack[parentStack.length - 2];
|
|
11631
11991
|
s.prependRight(topNode.start, `const ${id.name} = ${binding};\n`);
|
|
11632
11992
|
}
|
|
11633
|
-
} else if (parent.type === "CallExpression") {
|
|
11993
|
+
} else if (parent.type === "CallExpression") if (id === parent.callee && !parent.optional) {
|
|
11994
|
+
const argsStart = parent.arguments.length ? parent.arguments[0].start : parent.end;
|
|
11995
|
+
s.update(id.start, argsStart, `(0,${binding})${code.slice(id.end, argsStart)}`);
|
|
11996
|
+
} else {
|
|
11634
11997
|
s.update(id.start, id.end, binding);
|
|
11635
11998
|
s.prependRight(id.start, `(0,`);
|
|
11636
11999
|
s.appendLeft(id.end, `)`);
|
|
11637
|
-
}
|
|
12000
|
+
}
|
|
12001
|
+
else if (!(parent.type === "ClassExpression" && id === parent.id)) s.update(id.start, id.end, binding);
|
|
11638
12002
|
},
|
|
11639
12003
|
onImportMeta(node) {
|
|
11640
12004
|
s.update(node.start, node.end, ssrImportMetaKey);
|
|
@@ -12052,13 +12416,14 @@ Get the default browser name in Windows from WSL.
|
|
|
12052
12416
|
async function getWindowsDefaultBrowserFromWsl() {
|
|
12053
12417
|
const powershellPath = await powerShellPath();
|
|
12054
12418
|
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
12419
|
+
const encodedCommand = Buffer$1.from(rawCommand, "utf16le").toString("base64");
|
|
12055
12420
|
const { stdout } = await execFile$1(powershellPath, [
|
|
12056
12421
|
"-NoProfile",
|
|
12057
12422
|
"-NonInteractive",
|
|
12058
12423
|
"-ExecutionPolicy",
|
|
12059
12424
|
"Bypass",
|
|
12060
12425
|
"-EncodedCommand",
|
|
12061
|
-
|
|
12426
|
+
encodedCommand
|
|
12062
12427
|
], { encoding: "utf8" });
|
|
12063
12428
|
const progId = stdout.trim();
|
|
12064
12429
|
const browserMap = {
|
|
@@ -12376,7 +12741,8 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12376
12741
|
const ppRaw = pathEnv[i];
|
|
12377
12742
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12378
12743
|
const pCmd = path$5.join(pathPart, cmd);
|
|
12379
|
-
|
|
12744
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12745
|
+
resolve(subStep(p, i, 0));
|
|
12380
12746
|
});
|
|
12381
12747
|
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
12382
12748
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
@@ -13142,7 +13508,10 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
13142
13508
|
this._deflate = null;
|
|
13143
13509
|
this._inflate = null;
|
|
13144
13510
|
this.params = null;
|
|
13145
|
-
if (!zlibLimiter)
|
|
13511
|
+
if (!zlibLimiter) {
|
|
13512
|
+
const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10;
|
|
13513
|
+
zlibLimiter = new Limiter(concurrency);
|
|
13514
|
+
}
|
|
13146
13515
|
}
|
|
13147
13516
|
/**
|
|
13148
13517
|
* @type {String}
|
|
@@ -19832,7 +20201,8 @@ const defaultModuleTypes = {
|
|
|
19832
20201
|
function getModuleTypeFromId(id) {
|
|
19833
20202
|
let pos = -1;
|
|
19834
20203
|
while ((pos = id.indexOf(".", pos + 1)) >= 0) {
|
|
19835
|
-
const
|
|
20204
|
+
const ext = id.slice(pos + 1);
|
|
20205
|
+
const moduleType = defaultModuleTypes[ext];
|
|
19836
20206
|
if (moduleType) return moduleType;
|
|
19837
20207
|
}
|
|
19838
20208
|
}
|
|
@@ -20784,7 +21154,8 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20784
21154
|
const loaderKey = path$2.extname(searchPlace) || "noExt";
|
|
20785
21155
|
const loader = loaders[loaderKey];
|
|
20786
21156
|
if (searchPlace === "package.json") {
|
|
20787
|
-
const
|
|
21157
|
+
const pkg = await loader(filepath, content);
|
|
21158
|
+
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
20788
21159
|
if (maybeConfig != null) {
|
|
20789
21160
|
result.config = maybeConfig;
|
|
20790
21161
|
result.filepath = filepath;
|
|
@@ -20820,10 +21191,13 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20820
21191
|
const loader = loaders[loaderKey];
|
|
20821
21192
|
validateLoader(loader, loaderKey);
|
|
20822
21193
|
const content = String(await fsReadFileAsync(absPath));
|
|
20823
|
-
if (base === "package.json")
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
21194
|
+
if (base === "package.json") {
|
|
21195
|
+
const pkg = await loader(absPath, content);
|
|
21196
|
+
return emplace(loadCache, absPath, transform({
|
|
21197
|
+
config: getPackageProp(packageProp, pkg),
|
|
21198
|
+
filepath: absPath
|
|
21199
|
+
}));
|
|
21200
|
+
}
|
|
20827
21201
|
/** @type {import('./index').LilconfigResult} */
|
|
20828
21202
|
const result = {
|
|
20829
21203
|
config: null,
|
|
@@ -20892,7 +21266,8 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20892
21266
|
const loader = loaders[loaderKey];
|
|
20893
21267
|
const content = String(fs$1.readFileSync(filepath));
|
|
20894
21268
|
if (searchPlace === "package.json") {
|
|
20895
|
-
const
|
|
21269
|
+
const pkg = loader(filepath, content);
|
|
21270
|
+
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
20896
21271
|
if (maybeConfig != null) {
|
|
20897
21272
|
result.config = maybeConfig;
|
|
20898
21273
|
result.filepath = filepath;
|
|
@@ -20928,10 +21303,13 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20928
21303
|
const loader = loaders[loaderKey];
|
|
20929
21304
|
validateLoader(loader, loaderKey);
|
|
20930
21305
|
const content = String(fs$1.readFileSync(absPath));
|
|
20931
|
-
if (base === "package.json")
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
21306
|
+
if (base === "package.json") {
|
|
21307
|
+
const pkg = loader(absPath, content);
|
|
21308
|
+
return transform({
|
|
21309
|
+
config: getPackageProp(packageProp, pkg),
|
|
21310
|
+
filepath: absPath
|
|
21311
|
+
});
|
|
21312
|
+
}
|
|
20935
21313
|
const result = {
|
|
20936
21314
|
config: null,
|
|
20937
21315
|
filepath: absPath
|
|
@@ -20965,7 +21343,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20965
21343
|
};
|
|
20966
21344
|
}));
|
|
20967
21345
|
//#endregion
|
|
20968
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.
|
|
21346
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.23.0_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
|
|
20969
21347
|
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20970
21348
|
const { createRequire: createRequire$1 } = __require("node:module");
|
|
20971
21349
|
const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
|
|
@@ -21007,7 +21385,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21007
21385
|
module.exports = req;
|
|
21008
21386
|
}));
|
|
21009
21387
|
//#endregion
|
|
21010
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.
|
|
21388
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.23.0_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
|
|
21011
21389
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21012
21390
|
const req = require_req();
|
|
21013
21391
|
/**
|
|
@@ -21041,7 +21419,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21041
21419
|
module.exports = options;
|
|
21042
21420
|
}));
|
|
21043
21421
|
//#endregion
|
|
21044
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.
|
|
21422
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.23.0_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
|
|
21045
21423
|
var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21046
21424
|
const req = require_req();
|
|
21047
21425
|
/**
|
|
@@ -21095,7 +21473,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21095
21473
|
module.exports = plugins;
|
|
21096
21474
|
}));
|
|
21097
21475
|
//#endregion
|
|
21098
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.
|
|
21476
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.16_tsx@4.23.0_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
|
|
21099
21477
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21100
21478
|
const { resolve: resolve$3 } = __require("node:path");
|
|
21101
21479
|
const config = require_src$1();
|
|
@@ -21324,7 +21702,8 @@ var PartialEnvironment = class {
|
|
|
21324
21702
|
return this._topLevelConfig[prop];
|
|
21325
21703
|
} });
|
|
21326
21704
|
const environment = import_picocolors.default.dim(`(${this.name})`);
|
|
21327
|
-
const
|
|
21705
|
+
const colorIndex = [...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length;
|
|
21706
|
+
const infoColor = environmentColors[colorIndex || 0];
|
|
21328
21707
|
this.logger = {
|
|
21329
21708
|
get hasWarned() {
|
|
21330
21709
|
return topLevelConfig.logger.hasWarned;
|
|
@@ -21917,7 +22296,12 @@ function cssPostPlugin(config) {
|
|
|
21917
22296
|
if (pureCssChunks.size) {
|
|
21918
22297
|
const prelimaryNameToChunkMap = Object.fromEntries(Object.values(bundle).filter((chunk) => chunk.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk.fileName]));
|
|
21919
22298
|
const pureCssChunkNames = [...pureCssChunks].map((pureCssChunk) => prelimaryNameToChunkMap[pureCssChunk.fileName]).filter(Boolean);
|
|
21920
|
-
|
|
22299
|
+
let importMapReverseMapping;
|
|
22300
|
+
if (config.build.chunkImportMap) {
|
|
22301
|
+
const importMap = getImportMap(bundle, config);
|
|
22302
|
+
importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
22303
|
+
}
|
|
22304
|
+
const replaceEmptyChunk = getEmptyChunkReplacer(importMapReverseMapping ? pureCssChunkNames.map((name) => importMapReverseMapping[name] ?? name) : pureCssChunkNames, opts.format);
|
|
21921
22305
|
for (const file in bundle) {
|
|
21922
22306
|
const chunk = bundle[file];
|
|
21923
22307
|
if (chunk.type === "chunk") {
|
|
@@ -23980,9 +24364,11 @@ async function applyHtmlTransforms(html, hooks, pluginContext, ctx) {
|
|
|
23980
24364
|
}
|
|
23981
24365
|
return html;
|
|
23982
24366
|
}
|
|
23983
|
-
const
|
|
24367
|
+
const importOrCommentRE = /\s+|\/\*[\s\S]*?\*\/|\/\/[^\n]*(?:\n|$)|import\s*(?:"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*')\s*;*/y;
|
|
23984
24368
|
function isEntirelyImport(code) {
|
|
23985
|
-
|
|
24369
|
+
importOrCommentRE.lastIndex = 0;
|
|
24370
|
+
while (importOrCommentRE.lastIndex < code.length) if (!importOrCommentRE.test(code)) return false;
|
|
24371
|
+
return true;
|
|
23986
24372
|
}
|
|
23987
24373
|
function getBaseInHTML(urlRelativePath, config) {
|
|
23988
24374
|
return config.base === "./" || config.base === "" ? path.posix.join(path.posix.relative(urlRelativePath, "").slice(0, -2), "./") : config.base;
|
|
@@ -24049,6 +24435,19 @@ function getImportMapFilename(config) {
|
|
|
24049
24435
|
if (typeof chunkImportMap === "object" && chunkImportMap.fileName) return chunkImportMap.fileName;
|
|
24050
24436
|
return "importmap.json";
|
|
24051
24437
|
}
|
|
24438
|
+
/**
|
|
24439
|
+
* Read and parse the chunk import map asset from the bundle.
|
|
24440
|
+
* Returns `undefined` when the import map is not present in the bundle.
|
|
24441
|
+
*/
|
|
24442
|
+
function getImportMap(bundle, config) {
|
|
24443
|
+
const asset = bundle[getImportMapFilename(config)];
|
|
24444
|
+
if (!asset) return void 0;
|
|
24445
|
+
const content = JSON.parse(typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source));
|
|
24446
|
+
return {
|
|
24447
|
+
asset,
|
|
24448
|
+
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(config.base.length), v.slice(config.base.length)]))
|
|
24449
|
+
};
|
|
24450
|
+
}
|
|
24052
24451
|
//#endregion
|
|
24053
24452
|
//#region src/node/server/middlewares/transform.ts
|
|
24054
24453
|
const debugCache = createDebugger("vite:cache");
|
|
@@ -24623,7 +25022,8 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
24623
25022
|
ensureWatchedFile(watcher, mod.file, config.root);
|
|
24624
25023
|
await server?.environments.client.pluginContainer.transform(code, mod.id);
|
|
24625
25024
|
const hash = getHash(cleanUrl(mod.id));
|
|
24626
|
-
|
|
25025
|
+
const result = htmlProxyResult.get(`${hash}_${index}`);
|
|
25026
|
+
overwriteAttrValue(s, location, result ?? "");
|
|
24627
25027
|
})]);
|
|
24628
25028
|
html = s.toString();
|
|
24629
25029
|
return {
|
|
@@ -27712,7 +28112,11 @@ function preload(baseModule, deps, importerUrl) {
|
|
|
27712
28112
|
}
|
|
27713
28113
|
function importMetaResolve(specifier) {
|
|
27714
28114
|
if (import.meta.resolve) return import.meta.resolve(specifier);
|
|
27715
|
-
return new URL(
|
|
28115
|
+
return new URL(
|
|
28116
|
+
specifier,
|
|
28117
|
+
/** #__KEEP__ */
|
|
28118
|
+
import.meta.url
|
|
28119
|
+
).href;
|
|
27716
28120
|
}
|
|
27717
28121
|
promise = allSettled(deps.map((dep) => {
|
|
27718
28122
|
dep = assetsURL(dep, importerUrl);
|
|
@@ -27753,7 +28157,10 @@ function preload(baseModule, deps, importerUrl) {
|
|
|
27753
28157
|
}
|
|
27754
28158
|
function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
|
|
27755
28159
|
const { modulePreload } = environment.config.build;
|
|
27756
|
-
|
|
28160
|
+
const scriptRel = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
|
|
28161
|
+
const assetsURL = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
|
|
28162
|
+
const preloadMethodCode = preload.toString().replaceAll("𝐢𝐦𝐩𝐨𝐫𝐭", "import");
|
|
28163
|
+
return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preloadMethodCode}`;
|
|
27757
28164
|
}
|
|
27758
28165
|
/**
|
|
27759
28166
|
* Build only. During serve this is performed as part of ./importAnalysis.
|
|
@@ -27824,16 +28231,14 @@ function buildImportAnalysisPlugin(config) {
|
|
|
27824
28231
|
let importMapMapping;
|
|
27825
28232
|
let importMapReverseMapping;
|
|
27826
28233
|
if (config.build.chunkImportMap) {
|
|
27827
|
-
const
|
|
27828
|
-
|
|
27829
|
-
const importMapContent = JSON.parse(typeof importMap.source === "string" ? importMap.source : decoder.decode(importMap.source));
|
|
27830
|
-
importMapMapping = Object.fromEntries(Object.entries(importMapContent.imports).map(([k, v]) => [k.slice(config.base.length), v.slice(config.base.length)]));
|
|
28234
|
+
const importMap = getImportMap(bundle, config);
|
|
28235
|
+
importMapMapping = importMap.mapping;
|
|
27831
28236
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMapMapping).map(([k, v]) => [v, k]));
|
|
27832
28237
|
if (config.isOutputOptionsForLegacyChunks?.(opts)) {
|
|
27833
28238
|
this.emitFile({
|
|
27834
28239
|
type: "asset",
|
|
27835
28240
|
fileName: "importmap.legacy.json",
|
|
27836
|
-
source: importMap.source
|
|
28241
|
+
source: importMap.asset.source
|
|
27837
28242
|
});
|
|
27838
28243
|
delete bundle[getImportMapFilename(config)];
|
|
27839
28244
|
}
|
|
@@ -28670,7 +29075,8 @@ function patternToIdFilter(pattern, cwd) {
|
|
|
28670
29075
|
};
|
|
28671
29076
|
const matcher = pm(getMatcherString(pattern, cwd), { dot: true });
|
|
28672
29077
|
return (id) => {
|
|
28673
|
-
|
|
29078
|
+
const normalizedId = slash(id);
|
|
29079
|
+
return matcher(normalizedId);
|
|
28674
29080
|
};
|
|
28675
29081
|
}
|
|
28676
29082
|
function patternToCodeFilter(pattern) {
|
|
@@ -29290,7 +29696,7 @@ function esbuildBannerFooterCompatPlugin(config) {
|
|
|
29290
29696
|
async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
29291
29697
|
const isBuild = config.command === "build";
|
|
29292
29698
|
const isWorker = config.isWorker;
|
|
29293
|
-
const buildPlugins = isBuild || Object.values(config.environments).some((env) => env.isBundled) ?
|
|
29699
|
+
const buildPlugins = isBuild || Object.values(config.environments).some((env) => env.isBundled) ? resolveBuildPlugins(config) : {
|
|
29294
29700
|
pre: [],
|
|
29295
29701
|
post: []
|
|
29296
29702
|
};
|
|
@@ -30256,7 +30662,11 @@ function scanImports(environment) {
|
|
|
30256
30662
|
`) + e.message;
|
|
30257
30663
|
throw e;
|
|
30258
30664
|
} finally {
|
|
30259
|
-
if (debug$5)
|
|
30665
|
+
if (debug$5) {
|
|
30666
|
+
const duration = (performance$1.now() - start).toFixed(2);
|
|
30667
|
+
const depsStr = Object.keys(orderedDependencies(deps)).sort().map((id) => `\n ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(deps[id])}`).join("") || import_picocolors.default.dim("no dependencies found");
|
|
30668
|
+
debug$5(`Scan completed in ${duration}ms: ${depsStr}`);
|
|
30669
|
+
}
|
|
30260
30670
|
}
|
|
30261
30671
|
}
|
|
30262
30672
|
return {
|
|
@@ -31676,7 +32086,8 @@ function oxcResolvePlugin(resolveOptions, overrideEnvConfig, isJsPluginContainer
|
|
|
31676
32086
|
return newId;
|
|
31677
32087
|
},
|
|
31678
32088
|
finalizeOtherSpecifiers: !depsOptimizerEnabled ? void 0 : (resolvedId, rawId) => {
|
|
31679
|
-
const
|
|
32089
|
+
const depsOptimizer = getDepsOptimizer();
|
|
32090
|
+
const newResolvedId = ensureVersionQuery(resolvedId, rawId, options, depsOptimizer);
|
|
31680
32091
|
return newResolvedId === resolvedId ? void 0 : newResolvedId;
|
|
31681
32092
|
},
|
|
31682
32093
|
resolveSubpathImports(id, importer, isRequire, scan) {
|
|
@@ -32117,7 +32528,9 @@ function terserPlugin(config) {
|
|
|
32117
32528
|
return !!environment.config.build.minify;
|
|
32118
32529
|
},
|
|
32119
32530
|
async renderChunk(code, chunk, outputOptions) {
|
|
32120
|
-
|
|
32531
|
+
const usesOxcMinifier = (config.build.minify === true || config.build.minify === "oxc") && outputOptions.minify !== false;
|
|
32532
|
+
const minifyLegacyWithTerser = this.environment.config.isOutputOptionsForLegacyChunks?.(outputOptions) && !usesOxcMinifier;
|
|
32533
|
+
if (config.build.minify !== "terser" && !minifyLegacyWithTerser) return null;
|
|
32121
32534
|
worker ||= makeWorker();
|
|
32122
32535
|
const terserPath = pathToFileURL(loadTerserPath(config.root)).href;
|
|
32123
32536
|
try {
|
|
@@ -32360,30 +32773,6 @@ function areSeparateFolders(a, b) {
|
|
|
32360
32773
|
}
|
|
32361
32774
|
//#endregion
|
|
32362
32775
|
//#region src/node/build.ts
|
|
32363
|
-
var build_exports = /* @__PURE__ */ __exportAll({
|
|
32364
|
-
BuildEnvironment: () => BuildEnvironment,
|
|
32365
|
-
ChunkMetadataMap: () => ChunkMetadataMap,
|
|
32366
|
-
build: () => build,
|
|
32367
|
-
buildEnvironmentOptionsDefaults: () => buildEnvironmentOptionsDefaults,
|
|
32368
|
-
builderOptionsDefaults: () => builderOptionsDefaults,
|
|
32369
|
-
clearLine: () => clearLine,
|
|
32370
|
-
createBuilder: () => createBuilder,
|
|
32371
|
-
createToImportMetaURLBasedRelativeRuntime: () => createToImportMetaURLBasedRelativeRuntime,
|
|
32372
|
-
enhanceRollupError: () => enhanceRollupError,
|
|
32373
|
-
injectEnvironmentToHooks: () => injectEnvironmentToHooks,
|
|
32374
|
-
onRollupLog: () => onRollupLog,
|
|
32375
|
-
resolveBuildEnvironmentOptions: () => resolveBuildEnvironmentOptions,
|
|
32376
|
-
resolveBuildOutputs: () => resolveBuildOutputs,
|
|
32377
|
-
resolveBuildPlugins: () => resolveBuildPlugins,
|
|
32378
|
-
resolveBuilderOptions: () => resolveBuilderOptions,
|
|
32379
|
-
resolveLibFilename: () => resolveLibFilename,
|
|
32380
|
-
resolveRolldownOptions: () => resolveRolldownOptions,
|
|
32381
|
-
resolveUserExternal: () => resolveUserExternal,
|
|
32382
|
-
toOutputFilePathInCss: () => toOutputFilePathInCss,
|
|
32383
|
-
toOutputFilePathInHtml: () => toOutputFilePathInHtml,
|
|
32384
|
-
toOutputFilePathInJS: () => toOutputFilePathInJS,
|
|
32385
|
-
toOutputFilePathWithoutRuntime: () => toOutputFilePathWithoutRuntime
|
|
32386
|
-
});
|
|
32387
32776
|
const _buildEnvironmentOptionsDefaults = Object.freeze({
|
|
32388
32777
|
target: "baseline-widely-available",
|
|
32389
32778
|
/** @deprecated */
|
|
@@ -33229,10 +33618,10 @@ function createDepsOptimizer(environment) {
|
|
|
33229
33618
|
optimizationResult?.cancel()
|
|
33230
33619
|
]);
|
|
33231
33620
|
}
|
|
33232
|
-
let
|
|
33621
|
+
let initState = "idle";
|
|
33233
33622
|
async function init() {
|
|
33234
|
-
if (
|
|
33235
|
-
|
|
33623
|
+
if (initState !== "idle") return;
|
|
33624
|
+
initState = "initializing";
|
|
33236
33625
|
const cachedMetadata = await loadCachedDepOptimizationMetadata(environment);
|
|
33237
33626
|
firstRunCalled = !!cachedMetadata;
|
|
33238
33627
|
metadata = depsOptimizer.metadata = cachedMetadata || initDepsOptimizerMetadata(environment, sessionTimestamp);
|
|
@@ -33289,6 +33678,7 @@ function createDepsOptimizer(environment) {
|
|
|
33289
33678
|
})();
|
|
33290
33679
|
});
|
|
33291
33680
|
}
|
|
33681
|
+
initState = "initialized";
|
|
33292
33682
|
}
|
|
33293
33683
|
function startNextDiscoveredBatch() {
|
|
33294
33684
|
newDepsDiscovered = false;
|
|
@@ -33425,7 +33815,7 @@ function createDepsOptimizer(environment) {
|
|
|
33425
33815
|
let missing = metadata.discovered[id];
|
|
33426
33816
|
if (missing) return missing;
|
|
33427
33817
|
missing = addMissingDep(id, resolved);
|
|
33428
|
-
if (!waitingForCrawlEnd) debouncedProcessing();
|
|
33818
|
+
if (initState === "initialized" && !waitingForCrawlEnd) debouncedProcessing();
|
|
33429
33819
|
return missing;
|
|
33430
33820
|
}
|
|
33431
33821
|
function addMissingDep(id, resolved) {
|
|
@@ -35833,4 +36223,4 @@ const parseAst$1 = parseAst;
|
|
|
35833
36223
|
const parseAstAsync$1 = parseAstAsync;
|
|
35834
36224
|
const esbuildVersion = "0.25.0";
|
|
35835
36225
|
//#endregion
|
|
35836
|
-
export { mergeConfig as $,
|
|
36226
|
+
export { mergeConfig as $, createServer$2 as A, ssrTransform as B, fetchModule as C, optimizeDeps as D, createBuilder as E, createIdResolver as F, resolveEnvPrefix as G, createServerModuleRunnerTransport as H, perEnvironmentState as I, createLogger as J, transformWithOxc as K, isFileLoadingAllowed as L, formatPostcssSourceMap as M, preprocessCSS as N, optimizer_exports as O, searchForWorkspaceRoot as P, mergeAlias as Q, isFileServingAllowed as R, DevEnvironment as S, build as T, buildErrorMessage as U, createServerModuleRunner as V, loadEnv as W, createFilter$1 as X, perEnvironmentPlugin as Y, isCSSRequest as Z, runnerImport as _, minifySync as a, DEFAULT_CLIENT_MAIN_FIELDS as at, createRunnableDevEnvironment as b, parseAstAsync$1 as c, DEFAULT_SERVER_MAIN_FIELDS as ct, isFetchableDevEnvironment as d, require_picocolors as dt, normalizePath as et, config_exports as f, __commonJSMin as ft, sortUserPlugins as g, resolveConfig as h, minify as i, DEFAULT_CLIENT_CONDITIONS as it, server_exports as j, createServerHotChannel as k, parseSync as l, VERSION as lt, loadConfigFromFile as m, __toESM as mt, esbuildVersion as n, rollupVersion as nt, parse as o, DEFAULT_EXTERNAL_CONDITIONS as ot, defineConfig as p, __require as pt, transformWithEsbuild as q, esmExternalRequirePlugin$1 as r, withFilter as rt, parseAst$1 as s, DEFAULT_SERVER_CONDITIONS as st, Visitor as t, rolldownVersion as tt, createFetchableDevEnvironment as u, defaultAllowedOrigins as ut, preview as v, BuildEnvironment as w, isRunnableDevEnvironment as x, preview_exports as y, send$1 as z };
|