vite 6.0.0 → 6.0.2

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.

@@ -7,7 +7,7 @@ import { promisify as promisify$4, format as format$2, inspect, stripVTControlCh
7
7
  import { performance } from 'node:perf_hooks';
8
8
  import require$$0$5, { createRequire as createRequire$1, builtinModules } from 'node:module';
9
9
  import esbuild, { transform as transform$1, formatMessages, build as build$b } from 'esbuild';
10
- import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, SPECIAL_QUERY_RE, DEP_VERSION_RE, DEV_PROD_CONDITION, JS_TYPES_RE, KNOWN_ASSET_TYPES, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, VERSION, ROLLUP_HOOKS, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_PREVIEW_PORT, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_MAIN_FIELDS, DEFAULT_CLIENT_CONDITIONS, DEFAULT_SERVER_CONDITIONS } from '../constants.js';
10
+ import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, SPECIAL_QUERY_RE, DEP_VERSION_RE, DEV_PROD_CONDITION, JS_TYPES_RE, KNOWN_ASSET_TYPES, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_MAIN_FIELDS, DEFAULT_CLIENT_CONDITIONS, DEFAULT_SERVER_CONDITIONS } from '../constants.js';
11
11
  import require$$0$2, { posix, win32, isAbsolute, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join, sep } from 'path';
12
12
  import require$$0$3, { existsSync, readFileSync, statSync, readdirSync } from 'fs';
13
13
  import childProcess$2, { exec, execFile, execSync } from 'node:child_process';
@@ -13583,7 +13583,10 @@ function manifestPlugin() {
13583
13583
  fileNameToAsset.set(chunk.fileName, asset);
13584
13584
  }
13585
13585
  for (const originalFileName of chunk.originalFileNames.slice(1)) {
13586
- manifest[originalFileName] = asset;
13586
+ const file3 = manifest[originalFileName]?.file;
13587
+ if (!(file3 && endsWithJSRE.test(file3))) {
13588
+ manifest[originalFileName] = asset;
13589
+ }
13587
13590
  }
13588
13591
  }
13589
13592
  }
@@ -15933,7 +15936,7 @@ function resolvePlugin(resolveOptions) {
15933
15936
  }
15934
15937
  if (isBuiltin(id)) {
15935
15938
  if (currentEnvironmentOptions.consumer === "server") {
15936
- if (options.noExternal === true && // if both noExternal and external are true, noExternal will take the higher priority and bundle it.
15939
+ if (options.enableBuiltinNoExternalCheck && options.noExternal === true && // if both noExternal and external are true, noExternal will take the higher priority and bundle it.
15937
15940
  // only if the id is explicitly listed in external, we will externalize it and skip this error.
15938
15941
  (options.external === true || !options.external.includes(id))) {
15939
15942
  let message = `Cannot bundle Node.js built-in "${id}"`;
@@ -37616,7 +37619,17 @@ ${e.stack || e.message}`),
37616
37619
  function getSocketClient(socket) {
37617
37620
  if (!clientsMap.has(socket)) {
37618
37621
  clientsMap.set(socket, {
37619
- send: (payload) => {
37622
+ send: (...args) => {
37623
+ let payload;
37624
+ if (typeof args[0] === "string") {
37625
+ payload = {
37626
+ type: "custom",
37627
+ event: args[0],
37628
+ data: args[1]
37629
+ };
37630
+ } else {
37631
+ payload = args[0];
37632
+ }
37620
37633
  socket.send(JSON.stringify(payload));
37621
37634
  },
37622
37635
  socket
@@ -37679,7 +37692,9 @@ ${e.stack || e.message}`),
37679
37692
  });
37680
37693
  }
37681
37694
  },
37682
- config.server.hmr !== false
37695
+ config.server.hmr !== false,
37696
+ // Don't normalize client as we already handles the send, and to keep `.socket`
37697
+ false
37683
37698
  );
37684
37699
  return {
37685
37700
  ...normalizedHotChannel,
@@ -43503,7 +43518,8 @@ async function _createServer(inlineConfig = {}, options) {
43503
43518
  (environment) => environment.close()
43504
43519
  )
43505
43520
  ),
43506
- closeHttpServer()
43521
+ closeHttpServer(),
43522
+ server._ssrCompatModuleRunner?.close()
43507
43523
  ]);
43508
43524
  server.resolvedUrls = null;
43509
43525
  },
@@ -43751,7 +43767,7 @@ const serverConfigDefaults = Object.freeze({
43751
43767
  host: "localhost",
43752
43768
  https: void 0,
43753
43769
  open: false,
43754
- proxy: {},
43770
+ proxy: void 0,
43755
43771
  cors: true,
43756
43772
  headers: {},
43757
43773
  // hmr
@@ -43909,7 +43925,7 @@ const normalizedClientDir = normalizePath$3(CLIENT_DIR);
43909
43925
  function getShortName(file, root) {
43910
43926
  return file.startsWith(withTrailingSlash(root)) ? path$d.posix.relative(root, file) : file;
43911
43927
  }
43912
- const normalizeHotChannel = (channel, enableHmr) => {
43928
+ const normalizeHotChannel = (channel, enableHmr, normalizeClient = true) => {
43913
43929
  const normalizedListenerMap = /* @__PURE__ */ new WeakMap();
43914
43930
  const listenersForEvents = /* @__PURE__ */ new Map();
43915
43931
  let invokeHandlers;
@@ -43945,7 +43961,7 @@ const normalizeHotChannel = (channel, enableHmr) => {
43945
43961
  return {
43946
43962
  ...channel,
43947
43963
  on: (event, fn) => {
43948
- if (event === "connection") {
43964
+ if (event === "connection" || !normalizeClient) {
43949
43965
  channel.on?.(event, fn);
43950
43966
  return;
43951
43967
  }
@@ -43975,7 +43991,7 @@ const normalizeHotChannel = (channel, enableHmr) => {
43975
43991
  listenersForEvents.get(event).add(listenerWithNormalizedClient);
43976
43992
  },
43977
43993
  off: (event, fn) => {
43978
- if (event === "connection") {
43994
+ if (event === "connection" || !normalizeClient) {
43979
43995
  channel.off?.(event, fn);
43980
43996
  return;
43981
43997
  }
@@ -44832,12 +44848,13 @@ async function bundleWorkerEntry(config, id) {
44832
44848
  }
44833
44849
  const { rollup } = await import('rollup');
44834
44850
  const { plugins, rollupOptions, format } = config.worker;
44835
- const { plugins: resolvedPlugins, config: workerConfig } = await plugins(newBundleChain);
44851
+ const workerConfig = await plugins(newBundleChain);
44836
44852
  const workerEnvironment = new BuildEnvironment("client", workerConfig);
44853
+ await workerEnvironment.init();
44837
44854
  const bundle = await rollup({
44838
44855
  ...rollupOptions,
44839
44856
  input,
44840
- plugins: resolvedPlugins.map(
44857
+ plugins: workerEnvironment.plugins.map(
44841
44858
  (p) => injectEnvironmentToHooks(workerEnvironment, p)
44842
44859
  ),
44843
44860
  onwarn(warning, warn) {
@@ -47974,7 +47991,10 @@ function cssPostPlugin(config) {
47974
47991
  this.emitFile({
47975
47992
  name: getCssBundleName(),
47976
47993
  type: "asset",
47977
- source: extractedCss
47994
+ source: extractedCss,
47995
+ // this file is an implicit entry point, use `style.css` as the original file name
47996
+ // this name is also used as a key in the manifest
47997
+ originalFileName: "style.css"
47978
47998
  });
47979
47999
  }
47980
48000
  }
@@ -48412,8 +48432,8 @@ function createCachedImport(imp) {
48412
48432
  return cached;
48413
48433
  };
48414
48434
  }
48415
- const importPostcssImport = createCachedImport(() => import('./dep-0q9rEWat.js').then(function (n) { return n.i; }));
48416
- const importPostcssModules = createCachedImport(() => import('./dep-C1dfssTZ.js').then(function (n) { return n.i; }));
48435
+ const importPostcssImport = createCachedImport(() => import('./dep-DFNV1bxH.js').then(function (n) { return n.i; }));
48436
+ const importPostcssModules = createCachedImport(() => import('./dep-CoVxupJ6.js').then(function (n) { return n.i; }));
48417
48437
  const importPostcss = createCachedImport(() => import('postcss'));
48418
48438
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
48419
48439
  let alwaysFakeWorkerWorkerControllerCache;
@@ -49430,48 +49450,60 @@ async function compileLightningCSS(id, src, environment, urlReplacer) {
49430
49450
  const deps = /* @__PURE__ */ new Set();
49431
49451
  const filename = cleanUrl(path$d.relative(config.root, id));
49432
49452
  const toAbsolute = (filePath) => path$d.isAbsolute(filePath) ? filePath : path$d.join(config.root, filePath);
49433
- const res = styleAttrRE.test(id) ? (await importLightningCSS()).transformStyleAttribute({
49434
- filename,
49435
- code: Buffer.from(src),
49436
- targets: config.css?.lightningcss?.targets,
49437
- minify: config.isProduction && !!config.build.cssMinify,
49438
- analyzeDependencies: true
49439
- }) : await (await importLightningCSS()).bundleAsync({
49440
- ...config.css?.lightningcss,
49441
- filename,
49442
- resolver: {
49443
- read(filePath) {
49444
- if (filePath === filename) {
49445
- return src;
49446
- }
49447
- if (!filePath.endsWith(".css")) {
49448
- return src;
49449
- }
49450
- return fs__default.readFileSync(toAbsolute(filePath), "utf-8");
49451
- },
49452
- async resolve(id2, from) {
49453
- const publicFile = checkPublicFile(
49454
- id2,
49455
- environment.getTopLevelConfig()
49456
- );
49457
- if (publicFile) {
49458
- return publicFile;
49459
- }
49460
- const resolved = await getAtImportResolvers(
49461
- environment.getTopLevelConfig()
49462
- ).css(environment, id2, toAbsolute(from));
49463
- if (resolved) {
49464
- deps.add(resolved);
49465
- return resolved;
49453
+ let res;
49454
+ try {
49455
+ res = styleAttrRE.test(id) ? (await importLightningCSS()).transformStyleAttribute({
49456
+ filename,
49457
+ code: Buffer.from(src),
49458
+ targets: config.css?.lightningcss?.targets,
49459
+ minify: config.isProduction && !!config.build.cssMinify,
49460
+ analyzeDependencies: true
49461
+ }) : await (await importLightningCSS()).bundleAsync({
49462
+ ...config.css?.lightningcss,
49463
+ filename,
49464
+ resolver: {
49465
+ read(filePath) {
49466
+ if (filePath === filename) {
49467
+ return src;
49468
+ }
49469
+ if (!filePath.endsWith(".css")) {
49470
+ return src;
49471
+ }
49472
+ return fs__default.readFileSync(toAbsolute(filePath), "utf-8");
49473
+ },
49474
+ async resolve(id2, from) {
49475
+ const publicFile = checkPublicFile(
49476
+ id2,
49477
+ environment.getTopLevelConfig()
49478
+ );
49479
+ if (publicFile) {
49480
+ return publicFile;
49481
+ }
49482
+ const resolved = await getAtImportResolvers(
49483
+ environment.getTopLevelConfig()
49484
+ ).css(environment, id2, toAbsolute(from));
49485
+ if (resolved) {
49486
+ deps.add(resolved);
49487
+ return resolved;
49488
+ }
49489
+ return id2;
49466
49490
  }
49467
- return id2;
49468
- }
49469
- },
49470
- minify: config.isProduction && !!config.build.cssMinify,
49471
- sourceMap: config.command === "build" ? !!config.build.sourcemap : config.css?.devSourcemap,
49472
- analyzeDependencies: true,
49473
- cssModules: cssModuleRE.test(id) ? config.css?.lightningcss?.cssModules ?? true : void 0
49474
- });
49491
+ },
49492
+ minify: config.isProduction && !!config.build.cssMinify,
49493
+ sourceMap: config.command === "build" ? !!config.build.sourcemap : config.css?.devSourcemap,
49494
+ analyzeDependencies: true,
49495
+ cssModules: cssModuleRE.test(id) ? config.css?.lightningcss?.cssModules ?? true : void 0
49496
+ });
49497
+ } catch (e) {
49498
+ e.message = `[lightningcss] ${e.message}`;
49499
+ e.loc = {
49500
+ file: toAbsolute(e.fileName),
49501
+ line: e.loc.line,
49502
+ column: e.loc.column - 1
49503
+ // 1-based
49504
+ };
49505
+ throw e;
49506
+ }
49475
49507
  let css = decoder.decode(res.code);
49476
49508
  for (const dep of res.dependencies) {
49477
49509
  switch (dep.type) {
@@ -49480,7 +49512,6 @@ async function compileLightningCSS(id, src, environment, urlReplacer) {
49480
49512
  css = css.replace(dep.placeholder, () => dep.url);
49481
49513
  break;
49482
49514
  }
49483
- deps.add(dep.url);
49484
49515
  if (urlReplacer) {
49485
49516
  const replaceUrl = await urlReplacer(
49486
49517
  dep.url,
@@ -50246,7 +50277,7 @@ const buildEnvironmentOptionsDefaults = Object.freeze({
50246
50277
  watch: null
50247
50278
  // createEnvironment
50248
50279
  });
50249
- function resolveBuildEnvironmentOptions(raw, logger, consumer, isSsrTargetWebworkerEnvironment) {
50280
+ function resolveBuildEnvironmentOptions(raw, logger, consumer) {
50250
50281
  const deprecatedPolyfillModulePreload = raw?.polyfillModulePreload;
50251
50282
  const { polyfillModulePreload, ...rest } = raw;
50252
50283
  raw = rest;
@@ -50290,17 +50321,6 @@ function resolveBuildEnvironmentOptions(raw, logger, consumer, isSsrTargetWebwor
50290
50321
  ...merged.modulePreload
50291
50322
  }
50292
50323
  };
50293
- if (isSsrTargetWebworkerEnvironment) {
50294
- resolved.rollupOptions ??= {};
50295
- resolved.rollupOptions.output ??= {};
50296
- const output = resolved.rollupOptions.output;
50297
- for (const out of arraify(output)) {
50298
- out.entryFileNames ??= `[name].js`;
50299
- out.chunkFileNames ??= `[name]-[hash].js`;
50300
- const input = resolved.rollupOptions.input;
50301
- out.inlineDynamicImports ??= !input || typeof input === "string" || Object.keys(input).length === 1;
50302
- }
50303
- }
50304
50324
  return resolved;
50305
50325
  }
50306
50326
  async function resolveBuildPlugins(config) {
@@ -50438,6 +50458,7 @@ ${stackOnly}`;
50438
50458
  clearLine();
50439
50459
  logger.error(e.message, { error: e });
50440
50460
  };
50461
+ const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
50441
50462
  let bundle;
50442
50463
  let startTime;
50443
50464
  try {
@@ -50460,7 +50481,7 @@ ${stackOnly}`;
50460
50481
  );
50461
50482
  }
50462
50483
  const format = output.format || "es";
50463
- const jsExt = environment.config.consumer === "server" || libOptions ? resolveOutputJsExtension(
50484
+ const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(
50464
50485
  format,
50465
50486
  findNearestPackageData(root, packageCache)?.data.type
50466
50487
  ) : "js";
@@ -50486,7 +50507,7 @@ ${stackOnly}`;
50486
50507
  ) : path$d.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
50487
50508
  chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$d.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
50488
50509
  assetFileNames: libOptions ? `[name].[ext]` : path$d.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
50489
- inlineDynamicImports: output.format === "umd" || output.format === "iife",
50510
+ inlineDynamicImports: output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1),
50490
50511
  ...output
50491
50512
  };
50492
50513
  };
@@ -51357,6 +51378,8 @@ function createDepsOptimizer(environment) {
51357
51378
  if (debounceProcessingHandle) clearTimeout(debounceProcessingHandle);
51358
51379
  if (closed) {
51359
51380
  currentlyProcessing = false;
51381
+ depOptimizationProcessing.resolve();
51382
+ resolveEnqueuedProcessingPromises();
51360
51383
  return;
51361
51384
  }
51362
51385
  currentlyProcessing = true;
@@ -52482,7 +52505,7 @@ function compression ({ threshold = 1024, level = -1, brotli = false, gzip = tru
52482
52505
 
52483
52506
  function resolvePreviewOptions(preview2, server) {
52484
52507
  return {
52485
- port: preview2?.port,
52508
+ port: preview2?.port ?? DEFAULT_PREVIEW_PORT,
52486
52509
  strictPort: preview2?.strictPort ?? server.strictPort,
52487
52510
  host: preview2?.host ?? server.host,
52488
52511
  https: preview2?.https ?? server.https,
@@ -52593,9 +52616,8 @@ async function preview(inlineConfig = {}) {
52593
52616
  app.use(notFoundMiddleware());
52594
52617
  }
52595
52618
  const hostname = await resolveHostname(options.host);
52596
- const port = options.port ?? configDefaults.preview.port;
52597
52619
  await httpServerStart(httpServer, {
52598
- port,
52620
+ port: options.port,
52599
52621
  strictPort: options.strictPort,
52600
52622
  host: hostname.host,
52601
52623
  logger
@@ -52670,7 +52692,7 @@ const configDefaults = Object.freeze({
52670
52692
  dedupe: [],
52671
52693
  /** @experimental */
52672
52694
  noExternal: [],
52673
- // external
52695
+ external: [],
52674
52696
  preserveSymlinks: false,
52675
52697
  alias: []
52676
52698
  },
@@ -52799,8 +52821,7 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, logger, env
52799
52821
  build: resolveBuildEnvironmentOptions(
52800
52822
  options.build ?? {},
52801
52823
  logger,
52802
- consumer,
52803
- isSsrTargetWebworkerEnvironment
52824
+ consumer
52804
52825
  )
52805
52826
  };
52806
52827
  }
@@ -52853,7 +52874,7 @@ function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logg
52853
52874
  ...configDefaults.resolve,
52854
52875
  mainFields: consumer === "client" || isSsrTargetWebworkerEnvironment ? DEFAULT_CLIENT_MAIN_FIELDS : DEFAULT_SERVER_MAIN_FIELDS,
52855
52876
  conditions: consumer === "client" || isSsrTargetWebworkerEnvironment ? DEFAULT_CLIENT_CONDITIONS : DEFAULT_SERVER_CONDITIONS.filter((c) => c !== "browser"),
52856
- external: consumer === "server" && !isSsrTargetWebworkerEnvironment ? builtinModules : []
52877
+ enableBuiltinNoExternalCheck: !!isSsrTargetWebworkerEnvironment
52857
52878
  },
52858
52879
  resolve ?? {}
52859
52880
  );
@@ -53145,7 +53166,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
53145
53166
  await Promise.all(
53146
53167
  createPluginHookUtils(resolvedWorkerPlugins).getSortedPluginHooks("configResolved").map((hook) => hook(workerResolved))
53147
53168
  );
53148
- return { plugins: resolvedWorkerPlugins, config: workerResolved };
53169
+ return {
53170
+ ...workerResolved,
53171
+ plugins: resolvedWorkerPlugins
53172
+ };
53149
53173
  };
53150
53174
  const resolvedWorkerOptions = {
53151
53175
  format: config.worker?.format || "iife",
@@ -53535,7 +53559,7 @@ async function bundleConfigFile(fileName, isESM) {
53535
53559
  const _require = createRequire$1(import.meta.url);
53536
53560
  async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
53537
53561
  if (isESM) {
53538
- const nodeModulesDir = findNearestNodeModules(path$d.dirname(fileName));
53562
+ const nodeModulesDir = typeof process.versions.deno === "string" ? void 0 : findNearestNodeModules(path$d.dirname(fileName));
53539
53563
  if (nodeModulesDir) {
53540
53564
  await fsp.mkdir(path$d.resolve(nodeModulesDir, ".vite-temp/"), {
53541
53565
  recursive: true
@@ -1,4 +1,4 @@
1
- import { O as commonjsGlobal, N as getDefaultExportFromCjs } from './dep-C6qYk3zB.js';
1
+ import { O as commonjsGlobal, N as getDefaultExportFromCjs } from './dep-A4nAWF7x.js';
2
2
  import require$$0$2 from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1,4 +1,4 @@
1
- import { N as getDefaultExportFromCjs } from './dep-C6qYk3zB.js';
1
+ import { N as getDefaultExportFromCjs } from './dep-A4nAWF7x.js';
2
2
  import require$$0 from 'path';
3
3
  import { l as lib } from './dep-3RmXg9uo.js';
4
4
 
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-C6qYk3zB.js';
5
+ import { M as colors, G as createLogger, r as resolveConfig } from './chunks/dep-A4nAWF7x.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-C6qYk3zB.js').then(function (n) { return n.Q; });
743
+ const { createServer } = await import('./chunks/dep-A4nAWF7x.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-C6qYk3zB.js').then(function (n) { return n.R; });
836
+ const { createBuilder } = await import('./chunks/dep-A4nAWF7x.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-C6qYk3zB.js').then(function (n) { return n.P; });
871
+ const { optimizeDeps } = await import('./chunks/dep-A4nAWF7x.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-C6qYk3zB.js').then(function (n) { return n.S; });
897
+ const { preview } = await import('./chunks/dep-A4nAWF7x.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
  /**
@@ -1847,7 +1849,7 @@ interface WebSocketServer extends NormalizedHotChannel {
1847
1849
  */
1848
1850
  clients: Set<WebSocketClient>;
1849
1851
  }
1850
- interface WebSocketClient extends HotChannelClient {
1852
+ interface WebSocketClient extends NormalizedHotChannelClient {
1851
1853
  /**
1852
1854
  * The raw WebSocket instance
1853
1855
  * @advanced
@@ -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>;
@@ -3896,10 +3898,7 @@ interface LegacyOptions {
3896
3898
  }
3897
3899
  interface ResolvedWorkerOptions {
3898
3900
  format: 'es' | 'iife';
3899
- plugins: (bundleChain: string[]) => Promise<{
3900
- plugins: Plugin[];
3901
- config: ResolvedConfig;
3902
- }>;
3901
+ plugins: (bundleChain: string[]) => Promise<ResolvedConfig>;
3903
3902
  rollupOptions: RollupOptions;
3904
3903
  }
3905
3904
  interface InlineConfig extends UserConfig {
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-C6qYk3zB.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-C6qYk3zB.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-A4nAWF7x.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-A4nAWF7x.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -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",