vite 7.1.2 → 7.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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -1,6 +1,5 @@
1
- import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { __commonJS } from "./dep-Drtntmtt.js";
3
- import { require_lib } from "./dep-f94b-k0u.js";
1
+ import { __commonJS, __require } from "./dep-lCKrEJQm.js";
2
+ import { require_lib } from "./dep-BuoK8Wda.js";
4
3
 
5
4
  //#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/fs.js
6
5
  var require_fs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/fs.js": ((exports) => {
@@ -960,8 +959,8 @@ var require_localsConvention = /* @__PURE__ */ __commonJS({ "../../node_modules/
960
959
  var require_FileSystemLoader = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/FileSystemLoader.js": ((exports) => {
961
960
  Object.defineProperty(exports, "__esModule", { value: true });
962
961
  exports.default = void 0;
963
- var _postcss$1 = _interopRequireDefault$21(require("postcss"));
964
- var _path = _interopRequireDefault$21(require("path"));
962
+ var _postcss$1 = _interopRequireDefault$21(__require("postcss"));
963
+ var _path = _interopRequireDefault$21(__require("path"));
965
964
  var _Parser$1 = _interopRequireDefault$21(require_Parser());
966
965
  var _fs$1 = require_fs();
967
966
  function _interopRequireDefault$21(obj) {
@@ -1012,7 +1011,7 @@ var require_FileSystemLoader = /* @__PURE__ */ __commonJS({ "../../node_modules/
1012
1011
  const rootRelativePath = fileResolvedPath || _path.default.resolve(relativeDir, newPath);
1013
1012
  let fileRelativePath = fileResolvedPath || _path.default.resolve(_path.default.resolve(this.root, relativeDir), newPath);
1014
1013
  if (!useFileResolve && newPath[0] !== "." && !_path.default.isAbsolute(newPath)) try {
1015
- fileRelativePath = require.resolve(newPath);
1014
+ fileRelativePath = __require.resolve(newPath);
1016
1015
  } catch (e) {}
1017
1016
  const tokens$1 = this.tokensByFile[fileRelativePath];
1018
1017
  if (tokens$1) return tokens$1;
@@ -1545,13 +1544,13 @@ var require_getHashDigest = /* @__PURE__ */ __commonJS({ "../../node_modules/.pn
1545
1544
  hash$1 = new BatchedHash(createMd4());
1546
1545
  } else if (algorithm === "native-md4") {
1547
1546
  if (typeof crypto === "undefined") {
1548
- crypto = require("crypto");
1547
+ crypto = __require("crypto");
1549
1548
  if (BulkUpdateDecorator === void 0) BulkUpdateDecorator = require_BulkUpdateDecorator();
1550
1549
  }
1551
1550
  hash$1 = new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4");
1552
1551
  } else {
1553
1552
  if (typeof crypto === "undefined") {
1554
- crypto = require("crypto");
1553
+ crypto = __require("crypto");
1555
1554
  if (BulkUpdateDecorator === void 0) BulkUpdateDecorator = require_BulkUpdateDecorator();
1556
1555
  }
1557
1556
  hash$1 = new BulkUpdateDecorator(() => crypto.createHash(algorithm), algorithm);
@@ -1566,7 +1565,7 @@ var require_getHashDigest = /* @__PURE__ */ __commonJS({ "../../node_modules/.pn
1566
1565
  //#endregion
1567
1566
  //#region ../../node_modules/.pnpm/loader-utils@3.3.1/node_modules/loader-utils/lib/interpolateName.js
1568
1567
  var require_interpolateName = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/loader-utils@3.3.1/node_modules/loader-utils/lib/interpolateName.js": ((exports, module) => {
1569
- const path$1 = require("path");
1568
+ const path$1 = __require("path");
1570
1569
  const getHashDigest = require_getHashDigest();
1571
1570
  function interpolateName$1(loaderContext, name, options = {}) {
1572
1571
  let filename;
@@ -1620,7 +1619,7 @@ var require_interpolateName = /* @__PURE__ */ __commonJS({ "../../node_modules/.
1620
1619
  //#region ../../node_modules/.pnpm/generic-names@4.0.0/node_modules/generic-names/index.js
1621
1620
  var require_generic_names = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/generic-names@4.0.0/node_modules/generic-names/index.js": ((exports, module) => {
1622
1621
  var interpolateName = require_interpolateName();
1623
- var path = require("path");
1622
+ var path = __require("path");
1624
1623
  /**
1625
1624
  * @param {string} pattern
1626
1625
  * @param {object} options
@@ -2828,7 +2827,7 @@ var require_node = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/util-d
2828
2827
  /**
2829
2828
  * For Node.js, simply re-export the core `util.deprecate` function.
2830
2829
  */
2831
- module.exports = require("util").deprecate;
2830
+ module.exports = __require("util").deprecate;
2832
2831
  }) });
2833
2832
 
2834
2833
  //#endregion
@@ -5504,7 +5503,7 @@ var require_scoping = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pos
5504
5503
  var require_pluginFactory = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/pluginFactory.js": ((exports) => {
5505
5504
  Object.defineProperty(exports, "__esModule", { value: true });
5506
5505
  exports.makePlugin = makePlugin;
5507
- var _postcss = _interopRequireDefault(require("postcss"));
5506
+ var _postcss = _interopRequireDefault(__require("postcss"));
5508
5507
  var _unquote = _interopRequireDefault(require_unquote());
5509
5508
  var _Parser = _interopRequireDefault(require_Parser());
5510
5509
  var _saveJSON = _interopRequireDefault(require_saveJSON());
@@ -5579,7 +5578,7 @@ var require_pluginFactory = /* @__PURE__ */ __commonJS({ "../../node_modules/.pn
5579
5578
  //#endregion
5580
5579
  //#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/index.js
5581
5580
  var require_build = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/index.js": ((exports, module) => {
5582
- var _fs = require("fs");
5581
+ var _fs = __require("fs");
5583
5582
  var _fs2 = require_fs();
5584
5583
  var _pluginFactory = require_pluginFactory();
5585
5584
  (0, _fs2.setFileSystem)({
@@ -1,6 +1,5 @@
1
- import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { __commonJS } from "./dep-Drtntmtt.js";
3
- import { require_lib } from "./dep-f94b-k0u.js";
1
+ import { __commonJS, __require } from "./dep-lCKrEJQm.js";
2
+ import { require_lib } from "./dep-BuoK8Wda.js";
4
3
 
5
4
  //#region ../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/format-import-prelude.js
6
5
  var require_format_import_prelude = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/format-import-prelude.js": ((exports, module) => {
@@ -292,7 +291,7 @@ var require_parse_statements = /* @__PURE__ */ __commonJS({ "../../node_modules/
292
291
  //#endregion
293
292
  //#region ../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/process-content.js
294
293
  var require_process_content = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/process-content.js": ((exports, module) => {
295
- const path$2 = require("path");
294
+ const path$2 = __require("path");
296
295
  let sugarss;
297
296
  module.exports = function processContent$1(result, content, filename, options, postcss) {
298
297
  const { plugins } = options;
@@ -302,7 +301,7 @@ var require_process_content = /* @__PURE__ */ __commonJS({ "../../node_modules/.
302
301
  if (!sugarss)
303
302
  /* c8 ignore next 3 */
304
303
  try {
305
- sugarss = require("sugarss");
304
+ sugarss = __require("sugarss");
306
305
  } catch {}
307
306
  if (sugarss) return runPostcss(postcss, content, filename, plugins, [sugarss]);
308
307
  }
@@ -327,7 +326,7 @@ var require_process_content = /* @__PURE__ */ __commonJS({ "../../node_modules/.
327
326
  //#endregion
328
327
  //#region ../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/parse-styles.js
329
328
  var require_parse_styles = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/parse-styles.js": ((exports, module) => {
330
- const path$1 = require("path");
329
+ const path$1 = __require("path");
331
330
  const dataURL = require_data_url();
332
331
  const parseStatements = require_parse_statements();
333
332
  const processContent = require_process_content();
@@ -434,7 +433,7 @@ var require_parse_styles = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
434
433
  //#endregion
435
434
  //#region ../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/index.js
436
435
  var require_postcss_import = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/index.js": ((exports, module) => {
437
- const path = require("path");
436
+ const path = __require("path");
438
437
  const applyConditions = require_apply_conditions();
439
438
  const applyRaws = require_apply_raws();
440
439
  const applyStyles = require_apply_styles();
@@ -0,0 +1,4 @@
1
+ import "./dep-SmwnYDP9.js";
2
+ import { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults } from "./dep-C6pp_iVS.js";
3
+
4
+ export { createServer };
@@ -0,0 +1,4 @@
1
+ import "./dep-SmwnYDP9.js";
2
+ import { preview, resolvePreviewOptions } from "./dep-C6pp_iVS.js";
3
+
4
+ export { preview };
@@ -0,0 +1,320 @@
1
+ import { __commonJS, __toESM } from "./dep-lCKrEJQm.js";
2
+ import { readFileSync } from "node:fs";
3
+ import path, { resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import readline from "node:readline";
6
+
7
+ //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
8
+ var require_picocolors = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": ((exports, module) => {
9
+ let p = process || {}, argv = p.argv || [], env = p.env || {};
10
+ 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);
11
+ let formatter = (open, close, replace = open) => (input) => {
12
+ let string = "" + input, index = string.indexOf(close, open.length);
13
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
14
+ };
15
+ let replaceClose = (string, close, replace, index) => {
16
+ let result = "", cursor = 0;
17
+ do {
18
+ result += string.substring(cursor, index) + replace;
19
+ cursor = index + close.length;
20
+ index = string.indexOf(close, cursor);
21
+ } while (~index);
22
+ return result + string.substring(cursor);
23
+ };
24
+ let createColors = (enabled = isColorSupported) => {
25
+ let f = enabled ? formatter : () => String;
26
+ return {
27
+ isColorSupported: enabled,
28
+ reset: f("\x1B[0m", "\x1B[0m"),
29
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
30
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
31
+ italic: f("\x1B[3m", "\x1B[23m"),
32
+ underline: f("\x1B[4m", "\x1B[24m"),
33
+ inverse: f("\x1B[7m", "\x1B[27m"),
34
+ hidden: f("\x1B[8m", "\x1B[28m"),
35
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
36
+ black: f("\x1B[30m", "\x1B[39m"),
37
+ red: f("\x1B[31m", "\x1B[39m"),
38
+ green: f("\x1B[32m", "\x1B[39m"),
39
+ yellow: f("\x1B[33m", "\x1B[39m"),
40
+ blue: f("\x1B[34m", "\x1B[39m"),
41
+ magenta: f("\x1B[35m", "\x1B[39m"),
42
+ cyan: f("\x1B[36m", "\x1B[39m"),
43
+ white: f("\x1B[37m", "\x1B[39m"),
44
+ gray: f("\x1B[90m", "\x1B[39m"),
45
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
46
+ bgRed: f("\x1B[41m", "\x1B[49m"),
47
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
48
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
49
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
50
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
51
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
52
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
53
+ blackBright: f("\x1B[90m", "\x1B[39m"),
54
+ redBright: f("\x1B[91m", "\x1B[39m"),
55
+ greenBright: f("\x1B[92m", "\x1B[39m"),
56
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
57
+ blueBright: f("\x1B[94m", "\x1B[39m"),
58
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
59
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
60
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
61
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
62
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
63
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
64
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
65
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
66
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
67
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
68
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
69
+ };
70
+ };
71
+ module.exports = createColors();
72
+ module.exports.createColors = createColors;
73
+ }) });
74
+
75
+ //#endregion
76
+ //#region src/node/constants.ts
77
+ const { version } = JSON.parse(readFileSync(new URL("../../package.json", new URL("../../../src/node/constants.ts", import.meta.url))).toString());
78
+ const ROLLUP_HOOKS = [
79
+ "options",
80
+ "buildStart",
81
+ "buildEnd",
82
+ "renderStart",
83
+ "renderError",
84
+ "renderChunk",
85
+ "writeBundle",
86
+ "generateBundle",
87
+ "banner",
88
+ "footer",
89
+ "augmentChunkHash",
90
+ "outputOptions",
91
+ "renderDynamicImport",
92
+ "resolveFileUrl",
93
+ "resolveImportMeta",
94
+ "intro",
95
+ "outro",
96
+ "closeBundle",
97
+ "closeWatcher",
98
+ "load",
99
+ "moduleParsed",
100
+ "watchChange",
101
+ "resolveDynamicImport",
102
+ "resolveId",
103
+ "shouldTransformCachedModule",
104
+ "transform",
105
+ "onLog"
106
+ ];
107
+ const VERSION = version;
108
+ const DEFAULT_MAIN_FIELDS = [
109
+ "browser",
110
+ "module",
111
+ "jsnext:main",
112
+ "jsnext"
113
+ ];
114
+ const DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
115
+ const DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser"));
116
+ /**
117
+ * A special condition that would be replaced with production or development
118
+ * depending on NODE_ENV env variable
119
+ */
120
+ const DEV_PROD_CONDITION = `development|production`;
121
+ const DEFAULT_CONDITIONS = [
122
+ "module",
123
+ "browser",
124
+ "node",
125
+ DEV_PROD_CONDITION
126
+ ];
127
+ const DEFAULT_CLIENT_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS.filter((c) => c !== "node"));
128
+ const DEFAULT_SERVER_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS.filter((c) => c !== "browser"));
129
+ const DEFAULT_EXTERNAL_CONDITIONS = Object.freeze(["node", "module-sync"]);
130
+ /**
131
+ * The browser versions that are included in the Baseline Widely Available on 2025-05-01.
132
+ *
133
+ * This value would be bumped on each major release of Vite.
134
+ *
135
+ * The value is generated by `pnpm generate-target` script.
136
+ */
137
+ const ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET = [
138
+ "chrome107",
139
+ "edge107",
140
+ "firefox104",
141
+ "safari16"
142
+ ];
143
+ const DEFAULT_CONFIG_FILES = [
144
+ "vite.config.js",
145
+ "vite.config.mjs",
146
+ "vite.config.ts",
147
+ "vite.config.cjs",
148
+ "vite.config.mts",
149
+ "vite.config.cts"
150
+ ];
151
+ const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
152
+ const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
153
+ const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
154
+ const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
155
+ /**
156
+ * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
157
+ */
158
+ const FS_PREFIX = `/@fs/`;
159
+ const CLIENT_PUBLIC_PATH = `/@vite/client`;
160
+ const ENV_PUBLIC_PATH = `/@vite/env`;
161
+ const VITE_PACKAGE_DIR = resolve(fileURLToPath(new URL("../../../src/node/constants.ts", import.meta.url)), "../../..");
162
+ const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
163
+ const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
164
+ const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
165
+ const KNOWN_ASSET_TYPES = [
166
+ "apng",
167
+ "bmp",
168
+ "png",
169
+ "jpe?g",
170
+ "jfif",
171
+ "pjpeg",
172
+ "pjp",
173
+ "gif",
174
+ "svg",
175
+ "ico",
176
+ "webp",
177
+ "avif",
178
+ "cur",
179
+ "jxl",
180
+ "mp4",
181
+ "webm",
182
+ "ogg",
183
+ "mp3",
184
+ "wav",
185
+ "flac",
186
+ "aac",
187
+ "opus",
188
+ "mov",
189
+ "m4a",
190
+ "vtt",
191
+ "woff2?",
192
+ "eot",
193
+ "ttf",
194
+ "otf",
195
+ "webmanifest",
196
+ "pdf",
197
+ "txt"
198
+ ];
199
+ const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`, "i");
200
+ const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
201
+ const loopbackHosts = new Set([
202
+ "localhost",
203
+ "127.0.0.1",
204
+ "::1",
205
+ "0000:0000:0000:0000:0000:0000:0000:0001"
206
+ ]);
207
+ const wildcardHosts = new Set([
208
+ "0.0.0.0",
209
+ "::",
210
+ "0000:0000:0000:0000:0000:0000:0000:0000"
211
+ ]);
212
+ const DEFAULT_DEV_PORT = 5173;
213
+ const DEFAULT_PREVIEW_PORT = 4173;
214
+ const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
215
+ const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
216
+ const METADATA_FILENAME = "_metadata.json";
217
+ const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
218
+ const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
219
+
220
+ //#endregion
221
+ //#region src/node/logger.ts
222
+ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
223
+ const LogLevels = {
224
+ silent: 0,
225
+ error: 1,
226
+ warn: 2,
227
+ info: 3
228
+ };
229
+ let lastType;
230
+ let lastMsg;
231
+ let sameCount = 0;
232
+ function clearScreen() {
233
+ const repeatCount = process.stdout.rows - 2;
234
+ const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
235
+ console.log(blank);
236
+ readline.cursorTo(process.stdout, 0, 0);
237
+ readline.clearScreenDown(process.stdout);
238
+ }
239
+ let timeFormatter;
240
+ function getTimeFormatter() {
241
+ timeFormatter ??= new Intl.DateTimeFormat(void 0, {
242
+ hour: "numeric",
243
+ minute: "numeric",
244
+ second: "numeric"
245
+ });
246
+ return timeFormatter;
247
+ }
248
+ function createLogger(level = "info", options = {}) {
249
+ if (options.customLogger) return options.customLogger;
250
+ const loggedErrors = /* @__PURE__ */ new WeakSet();
251
+ const { prefix = "[vite]", allowClearScreen = true, console: console$1 = globalThis.console } = options;
252
+ const thresh = LogLevels[level];
253
+ const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
254
+ const clear = canClearScreen ? clearScreen : () => {};
255
+ function format(type, msg, options$1 = {}) {
256
+ if (options$1.timestamp) {
257
+ let tag = "";
258
+ if (type === "info") tag = import_picocolors.default.cyan(import_picocolors.default.bold(prefix));
259
+ else if (type === "warn") tag = import_picocolors.default.yellow(import_picocolors.default.bold(prefix));
260
+ else tag = import_picocolors.default.red(import_picocolors.default.bold(prefix));
261
+ const environment = options$1.environment ? options$1.environment + " " : "";
262
+ return `${import_picocolors.default.dim(getTimeFormatter().format(/* @__PURE__ */ new Date()))} ${tag} ${environment}${msg}`;
263
+ } else return msg;
264
+ }
265
+ function output(type, msg, options$1 = {}) {
266
+ if (thresh >= LogLevels[type]) {
267
+ const method = type === "info" ? "log" : type;
268
+ if (options$1.error) loggedErrors.add(options$1.error);
269
+ if (canClearScreen) if (type === lastType && msg === lastMsg) {
270
+ sameCount++;
271
+ clear();
272
+ console$1[method](format(type, msg, options$1), import_picocolors.default.yellow(`(x${sameCount + 1})`));
273
+ } else {
274
+ sameCount = 0;
275
+ lastMsg = msg;
276
+ lastType = type;
277
+ if (options$1.clear) clear();
278
+ console$1[method](format(type, msg, options$1));
279
+ }
280
+ else console$1[method](format(type, msg, options$1));
281
+ }
282
+ }
283
+ const warnedMessages = /* @__PURE__ */ new Set();
284
+ const logger = {
285
+ hasWarned: false,
286
+ info(msg, opts) {
287
+ output("info", msg, opts);
288
+ },
289
+ warn(msg, opts) {
290
+ logger.hasWarned = true;
291
+ output("warn", msg, opts);
292
+ },
293
+ warnOnce(msg, opts) {
294
+ if (warnedMessages.has(msg)) return;
295
+ logger.hasWarned = true;
296
+ output("warn", msg, opts);
297
+ warnedMessages.add(msg);
298
+ },
299
+ error(msg, opts) {
300
+ logger.hasWarned = true;
301
+ output("error", msg, opts);
302
+ },
303
+ clearScreen(type) {
304
+ if (thresh >= LogLevels[type]) clear();
305
+ },
306
+ hasErrorLogged(error) {
307
+ return loggedErrors.has(error);
308
+ }
309
+ };
310
+ return logger;
311
+ }
312
+ function printServerUrls(urls, optionsHost, info) {
313
+ const colorUrl = (url) => import_picocolors.default.cyan(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
314
+ for (const url of urls.local) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Local")}: ${colorUrl(url)}`);
315
+ for (const url of urls.network) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: ${colorUrl(url)}`);
316
+ 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"));
317
+ }
318
+
319
+ //#endregion
320
+ export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, LogLevels, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, createLogger, defaultAllowedOrigins, loopbackHosts, printServerUrls, require_picocolors, wildcardHosts };
@@ -1,4 +1,3 @@
1
- import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
1
  import { createRequire } from "node:module";
3
2
 
4
3
  //#region rolldown:runtime
@@ -26,6 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
25
  enumerable: true
27
26
  }) : target, mod));
28
27
  var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
28
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
29
29
 
30
30
  //#endregion
31
- export { __commonJS, __toDynamicImportESM, __toESM };
31
+ export { __commonJS, __require, __toDynamicImportESM, __toESM };
@@ -1,4 +1,3 @@
1
- import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
1
  //#region ../../node_modules/.pnpm/parse5@8.0.0/node_modules/parse5/dist/common/unicode.js
3
2
  const UNDEFINED_CODE_POINTS = new Set([
4
3
  65534,
@@ -0,0 +1,4 @@
1
+ import "./dep-SmwnYDP9.js";
2
+ import { configDefaults, defineConfig, getDefaultEnvironmentOptions, isResolvedConfig, loadConfigFromFile, resolveBaseUrl, resolveConfig, resolveDevEnvironmentOptions, sortUserPlugins } from "./dep-C6pp_iVS.js";
3
+
4
+ export { resolveConfig };
package/dist/node/cli.js CHANGED
@@ -1,7 +1,5 @@
1
- import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
- import { __toESM } from "./chunks/dep-Drtntmtt.js";
3
- import { createLogger, require_picocolors, resolveConfig } from "./chunks/dep-CMEinpL-.js";
4
- import { VERSION } from "./chunks/dep-BDCsDwBr.js";
1
+ import { __toESM } from "./chunks/dep-lCKrEJQm.js";
2
+ import { VERSION, createLogger, require_picocolors } from "./chunks/dep-SmwnYDP9.js";
5
3
  import fs from "node:fs";
6
4
  import path from "node:path";
7
5
  import { performance } from "node:perf_hooks";
@@ -492,6 +490,14 @@ const cac = (name = "") => new CAC(name);
492
490
  //#endregion
493
491
  //#region src/node/cli.ts
494
492
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
493
+ function checkNodeVersion(nodeVersion) {
494
+ const currentVersion = nodeVersion.split(".");
495
+ const major = parseInt(currentVersion[0], 10);
496
+ const minor = parseInt(currentVersion[1], 10);
497
+ const isSupported = major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
498
+ return isSupported;
499
+ }
500
+ if (!checkNodeVersion(process.versions.node)) console.warn(import_picocolors.default.yellow(`You are using Node.js ${process.versions.node}. Vite requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`));
495
501
  const cli = cac("vite");
496
502
  let profileSession = global.__vite_profile_session;
497
503
  let profileCount = 0;
@@ -568,7 +574,7 @@ const convertBase = (v) => {
568
574
  cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with esbuild, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
569
575
  cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
570
576
  filterDuplicateOptions(options);
571
- const { createServer } = await import("./chunks/dep-CtUaBn5f.js");
577
+ const { createServer } = await import("./chunks/dep-DMXKBGET.js");
572
578
  try {
573
579
  const server = await createServer({
574
580
  root,
@@ -618,13 +624,13 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
618
624
  } catch (e) {
619
625
  const logger = createLogger(options.logLevel);
620
626
  logger.error(import_picocolors.default.red(`error when starting dev server:\n${e.stack}`), { error: e });
621
- stopProfiler(logger.info);
627
+ await stopProfiler(logger.info);
622
628
  process.exit(1);
623
629
  }
624
630
  });
625
631
  cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'baseline-widely-available')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("--assetsDir <dir>", `[string] directory under outDir to place assets in (default: assets)`).option("--assetsInlineLimit <number>", `[number] static asset base64 inline threshold in bytes (default: 4096)`).option("--ssr [entry]", `[string] build specified entry for server-side rendering`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: esbuild)").option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(async (root, options) => {
626
632
  filterDuplicateOptions(options);
627
- const { createBuilder } = await import("./chunks/dep-BDbL9e7d.js");
633
+ const { createBuilder } = await import("./chunks/dep-BHlaQtHS.js");
628
634
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
629
635
  try {
630
636
  const inlineConfig = {
@@ -644,12 +650,13 @@ cli.command("build [root]", "build for production").option("--target <target>",
644
650
  createLogger(options.logLevel).error(import_picocolors.default.red(`error during build:\n${e.stack}`), { error: e });
645
651
  process.exit(1);
646
652
  } finally {
647
- stopProfiler((message) => createLogger(options.logLevel).info(message));
653
+ await stopProfiler((message) => createLogger(options.logLevel).info(message));
648
654
  }
649
655
  });
650
656
  cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
651
657
  filterDuplicateOptions(options);
652
- const { optimizeDeps } = await import("./chunks/dep-CTf3zVuV.js");
658
+ const { resolveConfig } = await import("./chunks/dep-t6m959kc.js");
659
+ const { optimizeDeps } = await import("./chunks/dep-BkmSwcUW.js");
653
660
  try {
654
661
  const config = await resolveConfig({
655
662
  root,
@@ -667,7 +674,7 @@ cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bun
667
674
  });
668
675
  cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(async (root, options) => {
669
676
  filterDuplicateOptions(options);
670
- const { preview } = await import("./chunks/dep-DZ4iRZu_.js");
677
+ const { preview } = await import("./chunks/dep-DPV9_aqi.js");
671
678
  try {
672
679
  const server = await preview({
673
680
  root,
@@ -690,7 +697,7 @@ cli.command("preview [root]", "locally preview production build").option("--host
690
697
  createLogger(options.logLevel).error(import_picocolors.default.red(`error when starting preview server:\n${e.stack}`), { error: e });
691
698
  process.exit(1);
692
699
  } finally {
693
- stopProfiler((message) => createLogger(options.logLevel).info(message));
700
+ await stopProfiler((message) => createLogger(options.logLevel).info(message));
694
701
  }
695
702
  });
696
703
  cli.help();