vite 7.1.3 → 7.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,7 @@
1
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";
2
5
  import readline from "node:readline";
3
6
 
4
7
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
@@ -69,6 +72,151 @@ var require_picocolors = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
69
72
  module.exports.createColors = createColors;
70
73
  }) });
71
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
+
72
220
  //#endregion
73
221
  //#region src/node/logger.ts
74
222
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
@@ -169,4 +317,4 @@ function printServerUrls(urls, optionsHost, info) {
169
317
  }
170
318
 
171
319
  //#endregion
172
- export { LogLevels, createLogger, printServerUrls, require_picocolors };
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,5 +1,4 @@
1
- import "./dep-D5MCzjWT.js";
2
- import { addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depsFromOptimizedDepInfo, depsLogString, discoverProjectDependencies, extractExportsData, getDepsCacheDir, getOptimizedDepPath, initDepsOptimizerMetadata, isDepOptimizationDisabled, loadCachedDepOptimizationMetadata, optimizeDeps, optimizeExplicitEnvironmentDeps, optimizedDepInfoFromFile, optimizedDepInfoFromId, optimizedDepNeedsInterop, runOptimizeDeps, toDiscoveredDependencies } from "./dep-Bj7gA1-0.js";
3
- import "./dep-CcFMbzqu.js";
1
+ import "./dep-SmwnYDP9.js";
2
+ import { addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depsFromOptimizedDepInfo, depsLogString, discoverProjectDependencies, extractExportsData, getDepsCacheDir, getOptimizedDepPath, initDepsOptimizerMetadata, isDepOptimizationDisabled, loadCachedDepOptimizationMetadata, optimizeDeps, optimizeExplicitEnvironmentDeps, optimizedDepInfoFromFile, optimizedDepInfoFromId, optimizedDepNeedsInterop, runOptimizeDeps, toDiscoveredDependencies } from "./dep-M_KD0XSK.js";
4
3
 
5
4
  export { optimizeDeps };
@@ -0,0 +1,4 @@
1
+ import "./dep-SmwnYDP9.js";
2
+ import { preview, resolvePreviewOptions } from "./dep-M_KD0XSK.js";
3
+
4
+ export { preview };
package/dist/node/cli.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { __toESM } from "./chunks/dep-lCKrEJQm.js";
2
- import { createLogger, require_picocolors } from "./chunks/dep-D5MCzjWT.js";
3
- import { VERSION } from "./chunks/dep-CcFMbzqu.js";
2
+ import { VERSION, createLogger, require_picocolors } from "./chunks/dep-SmwnYDP9.js";
4
3
  import fs from "node:fs";
5
4
  import path from "node:path";
6
5
  import { performance } from "node:perf_hooks";
@@ -575,7 +574,7 @@ const convertBase = (v) => {
575
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`);
576
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) => {
577
576
  filterDuplicateOptions(options);
578
- const { createServer } = await import("./chunks/dep-CPnzVSwg.js");
577
+ const { createServer } = await import("./chunks/dep-D_YDhiNx.js");
579
578
  try {
580
579
  const server = await createServer({
581
580
  root,
@@ -625,13 +624,13 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
625
624
  } catch (e) {
626
625
  const logger = createLogger(options.logLevel);
627
626
  logger.error(import_picocolors.default.red(`error when starting dev server:\n${e.stack}`), { error: e });
628
- stopProfiler(logger.info);
627
+ await stopProfiler(logger.info);
629
628
  process.exit(1);
630
629
  }
631
630
  });
632
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) => {
633
632
  filterDuplicateOptions(options);
634
- const { createBuilder } = await import("./chunks/dep-TDFDwW_9.js");
633
+ const { createBuilder } = await import("./chunks/dep-BvyJBvVx.js");
635
634
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
636
635
  try {
637
636
  const inlineConfig = {
@@ -651,13 +650,13 @@ cli.command("build [root]", "build for production").option("--target <target>",
651
650
  createLogger(options.logLevel).error(import_picocolors.default.red(`error during build:\n${e.stack}`), { error: e });
652
651
  process.exit(1);
653
652
  } finally {
654
- stopProfiler((message) => createLogger(options.logLevel).info(message));
653
+ await stopProfiler((message) => createLogger(options.logLevel).info(message));
655
654
  }
656
655
  });
657
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) => {
658
657
  filterDuplicateOptions(options);
659
- const { resolveConfig } = await import("./chunks/dep-6-jTB_1O.js");
660
- const { optimizeDeps } = await import("./chunks/dep-03SfmTdk.js");
658
+ const { resolveConfig } = await import("./chunks/dep-Cs9lwdKu.js");
659
+ const { optimizeDeps } = await import("./chunks/dep-cWFO4sv4.js");
661
660
  try {
662
661
  const config = await resolveConfig({
663
662
  root,
@@ -675,7 +674,7 @@ cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bun
675
674
  });
676
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) => {
677
676
  filterDuplicateOptions(options);
678
- const { preview } = await import("./chunks/dep-SeJl6gzM.js");
677
+ const { preview } = await import("./chunks/dep-yxQqhtZq.js");
679
678
  try {
680
679
  const server = await preview({
681
680
  root,
@@ -698,7 +697,7 @@ cli.command("preview [root]", "locally preview production build").option("--host
698
697
  createLogger(options.logLevel).error(import_picocolors.default.red(`error when starting preview server:\n${e.stack}`), { error: e });
699
698
  process.exit(1);
700
699
  } finally {
701
- stopProfiler((message) => createLogger(options.logLevel).info(message));
700
+ await stopProfiler((message) => createLogger(options.logLevel).info(message));
702
701
  }
703
702
  });
704
703
  cli.help();
@@ -322,7 +322,7 @@ declare namespace Connect {
322
322
  }
323
323
  }
324
324
  //#endregion
325
- //#region ../../node_modules/.pnpm/http-proxy-3@1.20.10/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
325
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.21.0/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
326
326
  interface ProxyTargetDetailed {
327
327
  host: string;
328
328
  port: number;
@@ -414,27 +414,27 @@ interface NormalizedServerOptions extends ServerOptions$3 {
414
414
  target?: NormalizeProxyTarget<ProxyTarget>;
415
415
  forward?: NormalizeProxyTarget<ProxyTargetUrl>;
416
416
  }
417
- type ErrorCallback = (err: Error, req: http.IncomingMessage, res: http.ServerResponse | net.Socket, target?: ProxyTargetUrl) => void;
418
- type ProxyServerEventMap = {
419
- error: Parameters<ErrorCallback>;
420
- start: [req: http.IncomingMessage, res: http.ServerResponse, target: ProxyTargetUrl];
417
+ type ErrorCallback<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = (err: TError, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse> | net.Socket, target?: ProxyTargetUrl) => void;
418
+ type ProxyServerEventMap<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = {
419
+ error: Parameters<ErrorCallback<TIncomingMessage, TServerResponse, TError>>;
420
+ start: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, target: ProxyTargetUrl];
421
421
  open: [socket: net.Socket];
422
- proxyReq: [proxyReq: http.ClientRequest, req: http.IncomingMessage, res: http.ServerResponse, options: ServerOptions$3, socket: net.Socket];
423
- proxyRes: [proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse];
424
- proxyReqWs: [proxyReq: http.ClientRequest, req: http.IncomingMessage, socket: net.Socket, options: ServerOptions$3, head: any];
425
- econnreset: [err: Error, req: http.IncomingMessage, res: http.ServerResponse, target: ProxyTargetUrl];
426
- end: [req: http.IncomingMessage, res: http.ServerResponse, proxyRes: http.IncomingMessage];
427
- close: [proxyRes: http.IncomingMessage, proxySocket: net.Socket, proxyHead: any];
422
+ proxyReq: [proxyReq: http.ClientRequest, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, options: ServerOptions$3, socket: net.Socket];
423
+ proxyRes: [proxyRes: InstanceType<TIncomingMessage>, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>];
424
+ proxyReqWs: [proxyReq: http.ClientRequest, req: InstanceType<TIncomingMessage>, socket: net.Socket, options: ServerOptions$3, head: any];
425
+ econnreset: [err: Error, req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, target: ProxyTargetUrl];
426
+ end: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, proxyRes: InstanceType<TIncomingMessage>];
427
+ close: [proxyRes: InstanceType<TIncomingMessage>, proxySocket: net.Socket, proxyHead: any];
428
428
  };
429
- type ProxyMethodArgs = {
430
- ws: [req: http.IncomingMessage, socket: any, head: any, ...args: [options?: ServerOptions$3, callback?: ErrorCallback] | [callback?: ErrorCallback]];
431
- web: [req: http.IncomingMessage, res: http.ServerResponse, ...args: [options: ServerOptions$3, callback?: ErrorCallback] | [callback?: ErrorCallback]];
429
+ type ProxyMethodArgs<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = {
430
+ ws: [req: InstanceType<TIncomingMessage>, socket: any, head: any, ...args: [options?: ServerOptions$3, callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>] | [callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>]];
431
+ web: [req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, ...args: [options: ServerOptions$3, callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>] | [callback?: ErrorCallback<TIncomingMessage, TServerResponse, TError>]];
432
432
  };
433
- type PassFunctions = {
434
- ws: (req: http.IncomingMessage, socket: net.Socket, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer, cb?: ErrorCallback) => unknown;
435
- web: (req: http.IncomingMessage, res: http.ServerResponse, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer, cb?: ErrorCallback) => unknown;
433
+ type PassFunctions<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> = {
434
+ ws: (req: InstanceType<TIncomingMessage>, socket: net.Socket, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer<TIncomingMessage, TServerResponse, TError>, cb?: ErrorCallback<TIncomingMessage, TServerResponse, TError>) => unknown;
435
+ web: (req: InstanceType<TIncomingMessage>, res: InstanceType<TServerResponse>, options: NormalizedServerOptions, head: Buffer | undefined, server: ProxyServer<TIncomingMessage, TServerResponse, TError>, cb?: ErrorCallback<TIncomingMessage, TServerResponse, TError>) => unknown;
436
436
  };
437
- declare class ProxyServer extends EventEmitter<ProxyServerEventMap> {
437
+ declare class ProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> extends EventEmitter<ProxyServerEventMap<TIncomingMessage, TServerResponse, TError>> {
438
438
  /**
439
439
  * Used for proxying WS(S) requests
440
440
  * @param req - Client request.
@@ -442,14 +442,14 @@ declare class ProxyServer extends EventEmitter<ProxyServerEventMap> {
442
442
  * @param head - Client head.
443
443
  * @param options - Additional options.
444
444
  */
445
- readonly ws: (...args: ProxyMethodArgs["ws"]) => void;
445
+ readonly ws: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["ws"]) => void;
446
446
  /**
447
447
  * Used for proxying regular HTTP(S) requests
448
448
  * @param req - Client request.
449
449
  * @param res - Client response.
450
450
  * @param options - Additional options.
451
451
  */
452
- readonly web: (...args: ProxyMethodArgs["web"]) => void;
452
+ readonly web: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["web"]) => void;
453
453
  private options;
454
454
  private webPasses;
455
455
  private wsPasses;
@@ -464,21 +464,21 @@ declare class ProxyServer extends EventEmitter<ProxyServerEventMap> {
464
464
  * @param options Config object passed to the proxy
465
465
  * @returns Proxy object with handlers for `ws` and `web` requests
466
466
  */
467
- static createProxyServer(options?: ServerOptions$3): ProxyServer;
467
+ static createProxyServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
468
468
  /**
469
469
  * Creates the proxy server with specified options.
470
470
  * @param options Config object passed to the proxy
471
471
  * @returns Proxy object with handlers for `ws` and `web` requests
472
472
  */
473
- static createServer(options?: ServerOptions$3): ProxyServer;
473
+ static createServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
474
474
  /**
475
475
  * Creates the proxy server with specified options.
476
476
  * @param options Config object passed to the proxy
477
477
  * @returns Proxy object with handlers for `ws` and `web` requests
478
478
  */
479
- static createProxy(options?: ServerOptions$3): ProxyServer;
479
+ static createProxy<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
480
480
  createRightProxy: <PT extends ProxyType>(type: PT) => Function;
481
- onError: (err: Error) => void;
481
+ onError: (err: TError) => void;
482
482
  /**
483
483
  * A function that wraps the object in a webserver, for your convenience
484
484
  * @param port - Port to listen on
@@ -490,11 +490,11 @@ declare class ProxyServer extends EventEmitter<ProxyServerEventMap> {
490
490
  * A function that closes the inner webserver and stops listening on given port
491
491
  */
492
492
  close: (cb?: Function) => void;
493
- before: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions[PT]) => void;
494
- after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions[PT]) => void;
493
+ before: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
494
+ after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
495
495
  }
496
496
  //#endregion
497
- //#region ../../node_modules/.pnpm/http-proxy-3@1.20.10/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.d.ts
497
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.21.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.d.ts
498
498
  declare function numOpenSockets(): number;
499
499
  declare namespace index_d_exports {
500
500
  export { ErrorCallback, ProxyServer, ProxyTarget, ProxyTargetUrl, ServerOptions$3 as ServerOptions, createProxyServer as createProxy, createProxyServer, createProxyServer as createServer, ProxyServer as default, numOpenSockets };
@@ -513,7 +513,7 @@ declare namespace index_d_exports {
513
513
  *
514
514
  * @api public
515
515
  */
516
- declare function createProxyServer(options?: ServerOptions$3): ProxyServer;
516
+ declare function createProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
517
517
  //#endregion
518
518
  //#region src/node/server/middlewares/proxy.d.ts
519
519
  interface ProxyOptions extends ServerOptions$3 {
@@ -3632,6 +3632,13 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
3632
3632
  */
3633
3633
  declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
3634
3634
  declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
3635
+ /**
3636
+ * Warning: parameters are not validated, only works with normalized absolute paths
3637
+ *
3638
+ * @param targetPath - normalized absolute path
3639
+ * @param filePath - normalized absolute path
3640
+ */
3641
+
3635
3642
  /**
3636
3643
  * Warning: parameters are not validated, only works with normalized absolute paths
3637
3644
  */
@@ -1,6 +1,5 @@
1
- import { createLogger } from "./chunks/dep-D5MCzjWT.js";
2
- import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-Bj7gA1-0.js";
3
- import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, defaultAllowedOrigins } from "./chunks/dep-CcFMbzqu.js";
1
+ import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, createLogger, defaultAllowedOrigins } from "./chunks/dep-SmwnYDP9.js";
2
+ import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-M_KD0XSK.js";
4
3
  import { parseAst, parseAstAsync } from "rollup/parseAst";
5
4
  import { version as esbuildVersion } from "esbuild";
6
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "7.1.3",
3
+ "version": "7.1.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -73,26 +73,26 @@
73
73
  "picomatch": "^4.0.3",
74
74
  "postcss": "^8.5.6",
75
75
  "rollup": "^4.43.0",
76
- "tinyglobby": "^0.2.14"
76
+ "tinyglobby": "^0.2.15"
77
77
  },
78
78
  "optionalDependencies": {
79
79
  "fsevents": "~2.3.3"
80
80
  },
81
81
  "devDependencies": {
82
- "@babel/parser": "^7.28.3",
82
+ "@babel/parser": "^7.28.4",
83
83
  "@jridgewell/remapping": "^2.3.5",
84
84
  "@jridgewell/trace-mapping": "^0.3.30",
85
85
  "@oxc-project/types": "0.81.0",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
- "@rolldown/pluginutils": "^1.0.0-beta.32",
87
+ "@rolldown/pluginutils": "^1.0.0-beta.35",
88
88
  "@rollup/plugin-alias": "^5.1.1",
89
89
  "@rollup/plugin-commonjs": "^28.0.6",
90
90
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
91
- "@rollup/pluginutils": "^5.2.0",
91
+ "@rollup/pluginutils": "^5.3.0",
92
92
  "@types/escape-html": "^1.0.4",
93
93
  "@types/pnpapi": "^0.0.5",
94
- "artichokie": "^0.3.2",
95
- "baseline-browser-mapping": "^2.6.3",
94
+ "artichokie": "^0.4.0",
95
+ "baseline-browser-mapping": "^2.7.4",
96
96
  "cac": "^6.7.14",
97
97
  "chokidar": "^3.6.0",
98
98
  "connect": "^3.7.0",
@@ -101,18 +101,18 @@
101
101
  "cross-spawn": "^7.0.6",
102
102
  "debug": "^4.4.1",
103
103
  "dep-types": "link:./src/types",
104
- "dotenv": "^17.2.1",
105
- "dotenv-expand": "^12.0.2",
104
+ "dotenv": "^17.2.2",
105
+ "dotenv-expand": "^12.0.3",
106
106
  "es-module-lexer": "^1.7.0",
107
107
  "escape-html": "^1.0.3",
108
108
  "estree-walker": "^3.0.3",
109
109
  "etag": "^1.8.1",
110
110
  "host-validation-middleware": "^0.1.1",
111
- "http-proxy-3": "^1.20.10",
111
+ "http-proxy-3": "^1.21.0",
112
112
  "launch-editor-middleware": "^2.11.1",
113
113
  "lightningcss": "^1.30.1",
114
- "magic-string": "^0.30.17",
115
- "mlly": "^1.7.4",
114
+ "magic-string": "^0.30.18",
115
+ "mlly": "^1.8.0",
116
116
  "mrmime": "^2.0.1",
117
117
  "nanoid": "^5.1.5",
118
118
  "open": "^10.2.0",
@@ -128,11 +128,11 @@
128
128
  "rolldown": "^1.0.0-beta.32",
129
129
  "rolldown-plugin-dts": "^0.15.6",
130
130
  "rollup-plugin-license": "^3.6.0",
131
- "sass": "^1.90.0",
132
- "sass-embedded": "^1.90.0",
133
- "sirv": "^3.0.1",
131
+ "sass": "^1.92.1",
132
+ "sass-embedded": "^1.92.1",
133
+ "sirv": "^3.0.2",
134
134
  "strip-literal": "^3.0.0",
135
- "terser": "^5.43.1",
135
+ "terser": "^5.44.0",
136
136
  "tsconfck": "^3.1.6",
137
137
  "types": "link:./types",
138
138
  "ufo": "^1.6.1",
@@ -1,150 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import path, { resolve } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- //#region src/node/constants.ts
6
- const { version } = JSON.parse(readFileSync(new URL("../../package.json", new URL("../../../src/node/constants.ts", import.meta.url))).toString());
7
- const ROLLUP_HOOKS = [
8
- "options",
9
- "buildStart",
10
- "buildEnd",
11
- "renderStart",
12
- "renderError",
13
- "renderChunk",
14
- "writeBundle",
15
- "generateBundle",
16
- "banner",
17
- "footer",
18
- "augmentChunkHash",
19
- "outputOptions",
20
- "renderDynamicImport",
21
- "resolveFileUrl",
22
- "resolveImportMeta",
23
- "intro",
24
- "outro",
25
- "closeBundle",
26
- "closeWatcher",
27
- "load",
28
- "moduleParsed",
29
- "watchChange",
30
- "resolveDynamicImport",
31
- "resolveId",
32
- "shouldTransformCachedModule",
33
- "transform",
34
- "onLog"
35
- ];
36
- const VERSION = version;
37
- const DEFAULT_MAIN_FIELDS = [
38
- "browser",
39
- "module",
40
- "jsnext:main",
41
- "jsnext"
42
- ];
43
- const DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
44
- const DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser"));
45
- /**
46
- * A special condition that would be replaced with production or development
47
- * depending on NODE_ENV env variable
48
- */
49
- const DEV_PROD_CONDITION = `development|production`;
50
- const DEFAULT_CONDITIONS = [
51
- "module",
52
- "browser",
53
- "node",
54
- DEV_PROD_CONDITION
55
- ];
56
- const DEFAULT_CLIENT_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS.filter((c) => c !== "node"));
57
- const DEFAULT_SERVER_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS.filter((c) => c !== "browser"));
58
- const DEFAULT_EXTERNAL_CONDITIONS = Object.freeze(["node", "module-sync"]);
59
- /**
60
- * The browser versions that are included in the Baseline Widely Available on 2025-05-01.
61
- *
62
- * This value would be bumped on each major release of Vite.
63
- *
64
- * The value is generated by `pnpm generate-target` script.
65
- */
66
- const ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET = [
67
- "chrome107",
68
- "edge107",
69
- "firefox104",
70
- "safari16"
71
- ];
72
- const DEFAULT_CONFIG_FILES = [
73
- "vite.config.js",
74
- "vite.config.mjs",
75
- "vite.config.ts",
76
- "vite.config.cjs",
77
- "vite.config.mts",
78
- "vite.config.cts"
79
- ];
80
- const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
81
- const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
82
- const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
83
- const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
84
- /**
85
- * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
86
- */
87
- const FS_PREFIX = `/@fs/`;
88
- const CLIENT_PUBLIC_PATH = `/@vite/client`;
89
- const ENV_PUBLIC_PATH = `/@vite/env`;
90
- const VITE_PACKAGE_DIR = resolve(fileURLToPath(new URL("../../../src/node/constants.ts", import.meta.url)), "../../..");
91
- const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
92
- const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
93
- const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
94
- const KNOWN_ASSET_TYPES = [
95
- "apng",
96
- "bmp",
97
- "png",
98
- "jpe?g",
99
- "jfif",
100
- "pjpeg",
101
- "pjp",
102
- "gif",
103
- "svg",
104
- "ico",
105
- "webp",
106
- "avif",
107
- "cur",
108
- "jxl",
109
- "mp4",
110
- "webm",
111
- "ogg",
112
- "mp3",
113
- "wav",
114
- "flac",
115
- "aac",
116
- "opus",
117
- "mov",
118
- "m4a",
119
- "vtt",
120
- "woff2?",
121
- "eot",
122
- "ttf",
123
- "otf",
124
- "webmanifest",
125
- "pdf",
126
- "txt"
127
- ];
128
- const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`, "i");
129
- const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
130
- const loopbackHosts = new Set([
131
- "localhost",
132
- "127.0.0.1",
133
- "::1",
134
- "0000:0000:0000:0000:0000:0000:0000:0001"
135
- ]);
136
- const wildcardHosts = new Set([
137
- "0.0.0.0",
138
- "::",
139
- "0000:0000:0000:0000:0000:0000:0000:0000"
140
- ]);
141
- const DEFAULT_DEV_PORT = 5173;
142
- const DEFAULT_PREVIEW_PORT = 4173;
143
- const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
144
- const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
145
- const METADATA_FILENAME = "_metadata.json";
146
- const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
147
- const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
148
-
149
- //#endregion
150
- 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, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, defaultAllowedOrigins, loopbackHosts, wildcardHosts };
@@ -1,5 +0,0 @@
1
- import "./dep-D5MCzjWT.js";
2
- import { preview, resolvePreviewOptions } from "./dep-Bj7gA1-0.js";
3
- import "./dep-CcFMbzqu.js";
4
-
5
- export { preview };
@@ -1,3 +0,0 @@
1
- import { 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, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, defaultAllowedOrigins, loopbackHosts, wildcardHosts } from "./chunks/dep-CcFMbzqu.js";
2
-
3
- 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, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, defaultAllowedOrigins, loopbackHosts, wildcardHosts };