vite 6.0.1 → 6.0.3

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.

package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { M as colors, G as createLogger, r as resolveConfig } from './chunks/dep-BcnkIxro.js';
5
+ import { M as colors, G as createLogger, r as resolveConfig } from './chunks/dep-yUJfKD1i.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -740,7 +740,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
740
740
  `[boolean] force the optimizer to ignore the cache and re-bundle`
741
741
  ).action(async (root, options) => {
742
742
  filterDuplicateOptions(options);
743
- const { createServer } = await import('./chunks/dep-BcnkIxro.js').then(function (n) { return n.Q; });
743
+ const { createServer } = await import('./chunks/dep-yUJfKD1i.js').then(function (n) { return n.Q; });
744
744
  try {
745
745
  const server = await createServer({
746
746
  root,
@@ -833,7 +833,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
833
833
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
834
834
  async (root, options) => {
835
835
  filterDuplicateOptions(options);
836
- const { createBuilder } = await import('./chunks/dep-BcnkIxro.js').then(function (n) { return n.R; });
836
+ const { createBuilder } = await import('./chunks/dep-yUJfKD1i.js').then(function (n) { return n.R; });
837
837
  const buildOptions = cleanGlobalCLIOptions(
838
838
  cleanBuilderCLIOptions(options)
839
839
  );
@@ -868,7 +868,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
868
868
  ).action(
869
869
  async (root, options) => {
870
870
  filterDuplicateOptions(options);
871
- const { optimizeDeps } = await import('./chunks/dep-BcnkIxro.js').then(function (n) { return n.P; });
871
+ const { optimizeDeps } = await import('./chunks/dep-yUJfKD1i.js').then(function (n) { return n.P; });
872
872
  try {
873
873
  const config = await resolveConfig(
874
874
  {
@@ -894,7 +894,7 @@ ${e.stack}`),
894
894
  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(
895
895
  async (root, options) => {
896
896
  filterDuplicateOptions(options);
897
- const { preview } = await import('./chunks/dep-BcnkIxro.js').then(function (n) { return n.S; });
897
+ const { preview } = await import('./chunks/dep-yUJfKD1i.js').then(function (n) { return n.S; });
898
898
  try {
899
899
  const server = await preview({
900
900
  root,
@@ -733,9 +733,11 @@ interface CorsOptions {
733
733
  }
734
734
  type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
735
735
 
736
+ type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
737
+
736
738
  interface PreviewOptions extends CommonServerOptions {
737
739
  }
738
- interface ResolvedPreviewOptions extends PreviewOptions {
740
+ interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, 'host' | 'https' | 'proxy'> {
739
741
  }
740
742
  interface PreviewServer {
741
743
  /**
@@ -1249,9 +1251,9 @@ interface NormalizedHotChannel<Api = any> {
1249
1251
  */
1250
1252
  off(event: string, listener: Function): void;
1251
1253
  handleInvoke(payload: HotPayload): Promise<{
1252
- r: any;
1254
+ result: any;
1253
1255
  } | {
1254
- e: any;
1256
+ error: any;
1255
1257
  }>;
1256
1258
  /**
1257
1259
  * Start listening for messages
@@ -2439,7 +2441,7 @@ interface ResolvePluginOptions {
2439
2441
  */
2440
2442
  ssrConfig?: SSROptions;
2441
2443
  }
2442
- interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {
2444
+ interface InternalResolveOptions extends Required<Omit<ResolveOptions, 'enableBuiltinNoExternalCheck'>>, ResolvePluginOptions {
2443
2445
  }
2444
2446
 
2445
2447
  /** Cache for package.json resolution and package.json contents */
@@ -2936,7 +2938,7 @@ interface ServerOptions extends CommonServerOptions {
2936
2938
  */
2937
2939
  hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
2938
2940
  }
2939
- interface ResolvedServerOptions extends Omit<ServerOptions, 'fs' | 'middlewareMode' | 'sourcemapIgnoreList'> {
2941
+ interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions, 'host' | 'https' | 'proxy' | 'hmr' | 'ws' | 'watch' | 'origin' | 'hotUpdateEnvironments'>, 'fs' | 'middlewareMode' | 'sourcemapIgnoreList'> {
2940
2942
  fs: Required<FileSystemServeOptions>;
2941
2943
  middlewareMode: NonNullable<ServerOptions['middlewareMode']>;
2942
2944
  sourcemapIgnoreList: Exclude<ServerOptions['sourcemapIgnoreList'], false | undefined>;
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-BcnkIxro.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, C as createFilter, h as createIdResolver, G as createLogger, n as createRunnableDevEnvironment, c as createServer, w as createServerHotChannel, v as createServerModuleRunner, d as defineConfig, u as fetchModule, j as formatPostcssSourceMap, J as isFileLoadingAllowed, I as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, K as loadEnv, A as mergeAlias, z as mergeConfig, x as moduleRunnerTransform, y as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, L as resolveEnvPrefix, E as rollupVersion, H as searchForWorkspaceRoot, F as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-BcnkIxro.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-yUJfKD1i.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, f as build, m as buildErrorMessage, g as createBuilder, C as createFilter, h as createIdResolver, G as createLogger, n as createRunnableDevEnvironment, c as createServer, w as createServerHotChannel, v as createServerModuleRunner, d as defineConfig, u as fetchModule, j as formatPostcssSourceMap, J as isFileLoadingAllowed, I as isFileServingAllowed, q as isRunnableDevEnvironment, l as loadConfigFromFile, K as loadEnv, A as mergeAlias, z as mergeConfig, x as moduleRunnerTransform, y as normalizePath, o as optimizeDeps, p as perEnvironmentPlugin, b as perEnvironmentState, k as preprocessCSS, e as preview, r as resolveConfig, L as resolveEnvPrefix, E as rollupVersion, H as searchForWorkspaceRoot, F as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-yUJfKD1i.js';
4
4
  export { DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
@@ -101,7 +101,7 @@ function splitVendorChunkPlugin() {
101
101
  const cache = new SplitVendorChunkCache();
102
102
  caches.push(cache);
103
103
  const build = config.build ?? {};
104
- const format = output?.format;
104
+ const format = output.format;
105
105
  if (!build.ssr && !build.lib && format !== "umd" && format !== "iife") {
106
106
  return splitVendorChunk({ cache });
107
107
  }
@@ -109,7 +109,7 @@ function splitVendorChunkPlugin() {
109
109
  return {
110
110
  name: "vite:split-vendor-chunk",
111
111
  config(config) {
112
- let outputs = config?.build?.rollupOptions?.output;
112
+ let outputs = config.build?.rollupOptions?.output;
113
113
  if (outputs) {
114
114
  outputs = arraify(outputs);
115
115
  for (const output of outputs) {
@@ -68,9 +68,9 @@ interface ModuleRunnerTransport {
68
68
  disconnect?(): Promise<void> | void;
69
69
  send?(data: HotPayload): Promise<void> | void;
70
70
  invoke?(data: HotPayload): Promise<{
71
- r: any;
71
+ result: any;
72
72
  } | {
73
- e: any;
73
+ error: any;
74
74
  }>;
75
75
  timeout?: number;
76
76
  }
@@ -87,7 +87,7 @@ const isAbsolute = function(p) {
87
87
  return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
88
88
  };
89
89
  function normalizeAbsoluteUrl(url, root) {
90
- return url = slash(url), url.startsWith("file://") && (url = url.slice(isWindows ? 8 : 7)), url.startsWith(root) && (url = url.slice(root.length - 1)), url;
90
+ return url = slash(url), url.startsWith("file://") && (url = decodeURI(url.slice(isWindows ? 8 : 7))), url.startsWith(root) && (url = url.slice(root.length - 1)), url;
91
91
  }
92
92
  const decodeBase64 = typeof atob < "u" ? atob : (str) => Buffer.from(str, "base64").toString("utf-8"), CHAR_FORWARD_SLASH = 47, CHAR_BACKWARD_SLASH = 92, percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, questionRegex = /\?/g, hashRegex = /#/g;
93
93
  function encodePathChars(filepath) {
@@ -532,7 +532,7 @@ const {${missingBindings.join(", ")}} = pkg;
532
532
  }
533
533
  }
534
534
  let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", nanoid = (size = 21) => {
535
- let id = "", i = size;
535
+ let id = "", i = size | 0;
536
536
  for (; i--; )
537
537
  id += urlAlphabet[Math.random() * 64 | 0];
538
538
  return id;
@@ -559,9 +559,9 @@ const createInvokeableTransport = (transport) => {
559
559
  data
560
560
  }
561
561
  });
562
- if ("e" in result)
563
- throw reviveInvokeError(result.e);
564
- return result.r;
562
+ if ("error" in result)
563
+ throw reviveInvokeError(result.error);
564
+ return result.result;
565
565
  }
566
566
  };
567
567
  if (!transport.send || !transport.connect)
@@ -819,11 +819,11 @@ function getModulesEntrypoints(runner, modules, visited = /* @__PURE__ */ new Se
819
819
  visited.add(moduleId);
820
820
  const module = runner.evaluatedModules.getModuleById(moduleId);
821
821
  if (module) {
822
- if (module.importers && !module.importers.size) {
822
+ if (!module.importers.size) {
823
823
  entrypoints.add(module.url);
824
824
  continue;
825
825
  }
826
- for (const importer of module.importers || [])
826
+ for (const importer of module.importers)
827
827
  getModulesEntrypoints(runner, [importer], visited, entrypoints);
828
828
  }
829
829
  }
@@ -831,7 +831,7 @@ function getModulesEntrypoints(runner, modules, visited = /* @__PURE__ */ new Se
831
831
  }
832
832
  function findAllEntrypoints(runner, entrypoints = /* @__PURE__ */ new Set()) {
833
833
  for (const mod of runner.evaluatedModules.idToModuleMap.values())
834
- mod.importers && !mod.importers.size && entrypoints.add(mod.url);
834
+ mod.importers.size || entrypoints.add(mod.url);
835
835
  return entrypoints;
836
836
  }
837
837
  const sourceMapCache = {}, fileContentsCache = {}, evaluatedModulesCache = /* @__PURE__ */ new Set(), retrieveFileHandlers = /* @__PURE__ */ new Set(), retrieveSourceMapHandlers = /* @__PURE__ */ new Set(), createExecHandlers = (handlers) => (...args) => {
@@ -928,7 +928,7 @@ function mapSourcePosition(position) {
928
928
  map: null
929
929
  };
930
930
  }
931
- if (sourceMap && sourceMap.map && sourceMap.url) {
931
+ if (sourceMap.map && sourceMap.url) {
932
932
  const originalPosition = getOriginalPosition(sourceMap.map, position);
933
933
  if (originalPosition && originalPosition.source != null)
934
934
  return originalPosition.source = supportRelativeURL(
@@ -3798,7 +3798,7 @@ function splitVendorChunkPlugin() {
3798
3798
  const cache = new SplitVendorChunkCache();
3799
3799
  caches.push(cache);
3800
3800
  const build = config.build ?? {};
3801
- const format = output?.format;
3801
+ const format = output.format;
3802
3802
  if (!build.ssr && !build.lib && format !== "umd" && format !== "iife") {
3803
3803
  return splitVendorChunk({ cache });
3804
3804
  }
@@ -3806,7 +3806,7 @@ function splitVendorChunkPlugin() {
3806
3806
  return {
3807
3807
  name: "vite:split-vendor-chunk",
3808
3808
  config(config) {
3809
- let outputs = config?.build?.rollupOptions?.output;
3809
+ let outputs = config.build?.rollupOptions?.output;
3810
3810
  if (outputs) {
3811
3811
  outputs = arraify(outputs);
3812
3812
  for (const output of outputs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -109,11 +109,11 @@
109
109
  "etag": "^1.8.1",
110
110
  "http-proxy": "^1.18.1",
111
111
  "launch-editor-middleware": "^2.9.1",
112
- "lightningcss": "^1.28.1",
113
- "magic-string": "^0.30.13",
112
+ "lightningcss": "^1.28.2",
113
+ "magic-string": "^0.30.14",
114
114
  "mlly": "^1.7.3",
115
115
  "mrmime": "^2.0.0",
116
- "nanoid": "^5.0.8",
116
+ "nanoid": "^5.0.9",
117
117
  "open": "^10.1.0",
118
118
  "parse5": "^7.2.1",
119
119
  "pathe": "^1.1.2",
@@ -192,7 +192,7 @@
192
192
  "build": "premove dist && pnpm build-bundle && pnpm build-types",
193
193
  "build-bundle": "rollup --config rollup.config.ts --configPlugin esbuild",
194
194
  "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
195
- "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
195
+ "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node/tsconfig.build.json",
196
196
  "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && premove temp",
197
197
  "build-types-check": "tsc --project tsconfig.check.json",
198
198
  "typecheck": "tsc --noEmit && tsc --noEmit -p src/node",