vite 6.0.0 → 6.0.1

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.

@@ -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
  }
@@ -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) {
@@ -48412,8 +48429,8 @@ function createCachedImport(imp) {
48412
48429
  return cached;
48413
48430
  };
48414
48431
  }
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; }));
48432
+ const importPostcssImport = createCachedImport(() => import('./dep-BnwAUvl5.js').then(function (n) { return n.i; }));
48433
+ const importPostcssModules = createCachedImport(() => import('./dep-ab_8SKHY.js').then(function (n) { return n.i; }));
48417
48434
  const importPostcss = createCachedImport(() => import('postcss'));
48418
48435
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
48419
48436
  let alwaysFakeWorkerWorkerControllerCache;
@@ -53145,7 +53162,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
53145
53162
  await Promise.all(
53146
53163
  createPluginHookUtils(resolvedWorkerPlugins).getSortedPluginHooks("configResolved").map((hook) => hook(workerResolved))
53147
53164
  );
53148
- return { plugins: resolvedWorkerPlugins, config: workerResolved };
53165
+ return {
53166
+ ...workerResolved,
53167
+ plugins: resolvedWorkerPlugins
53168
+ };
53149
53169
  };
53150
53170
  const resolvedWorkerOptions = {
53151
53171
  format: config.worker?.format || "iife",
@@ -1,4 +1,4 @@
1
- import { N as getDefaultExportFromCjs } from './dep-C6qYk3zB.js';
1
+ import { N as getDefaultExportFromCjs } from './dep-BcnkIxro.js';
2
2
  import require$$0 from 'path';
3
3
  import { l as lib } from './dep-3RmXg9uo.js';
4
4
 
@@ -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-BcnkIxro.js';
2
2
  import require$$0$2 from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
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-BcnkIxro.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-BcnkIxro.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-BcnkIxro.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-BcnkIxro.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-BcnkIxro.js').then(function (n) { return n.S; });
898
898
  try {
899
899
  const server = await preview({
900
900
  root,
@@ -1847,7 +1847,7 @@ interface WebSocketServer extends NormalizedHotChannel {
1847
1847
  */
1848
1848
  clients: Set<WebSocketClient>;
1849
1849
  }
1850
- interface WebSocketClient extends HotChannelClient {
1850
+ interface WebSocketClient extends NormalizedHotChannelClient {
1851
1851
  /**
1852
1852
  * The raw WebSocket instance
1853
1853
  * @advanced
@@ -3896,10 +3896,7 @@ interface LegacyOptions {
3896
3896
  }
3897
3897
  interface ResolvedWorkerOptions {
3898
3898
  format: 'es' | 'iife';
3899
- plugins: (bundleChain: string[]) => Promise<{
3900
- plugins: Plugin[];
3901
- config: ResolvedConfig;
3902
- }>;
3899
+ plugins: (bundleChain: string[]) => Promise<ResolvedConfig>;
3903
3900
  rollupOptions: RollupOptions;
3904
3901
  }
3905
3902
  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-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';
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.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",