vite 5.0.0-beta.15 → 5.0.0-beta.17

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,4 @@
1
- import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-Kf16Z54K.js';
1
+ import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-3p9Yqpeo.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1,4 +1,4 @@
1
- import { y as getDefaultExportFromCjs } from './dep-Kf16Z54K.js';
1
+ import { y as getDefaultExportFromCjs } from './dep-3p9Yqpeo.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-8a-6Quh6.js';
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-Kf16Z54K.js';
5
+ import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-3p9Yqpeo.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -759,7 +759,7 @@ cli
759
759
  filterDuplicateOptions(options);
760
760
  // output structure is preserved even after bundling so require()
761
761
  // is ok here
762
- const { createServer } = await import('./chunks/dep-Kf16Z54K.js').then(function (n) { return n.A; });
762
+ const { createServer } = await import('./chunks/dep-3p9Yqpeo.js').then(function (n) { return n.A; });
763
763
  try {
764
764
  const server = await createServer({
765
765
  root,
@@ -839,7 +839,7 @@ cli
839
839
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
840
840
  .action(async (root, options) => {
841
841
  filterDuplicateOptions(options);
842
- const { build } = await import('./chunks/dep-Kf16Z54K.js').then(function (n) { return n.C; });
842
+ const { build } = await import('./chunks/dep-3p9Yqpeo.js').then(function (n) { return n.C; });
843
843
  const buildOptions = cleanOptions(options);
844
844
  try {
845
845
  await build({
@@ -867,7 +867,7 @@ cli
867
867
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
868
868
  .action(async (root, options) => {
869
869
  filterDuplicateOptions(options);
870
- const { optimizeDeps } = await import('./chunks/dep-Kf16Z54K.js').then(function (n) { return n.B; });
870
+ const { optimizeDeps } = await import('./chunks/dep-3p9Yqpeo.js').then(function (n) { return n.B; });
871
871
  try {
872
872
  const config = await resolveConfig({
873
873
  root,
@@ -893,7 +893,7 @@ cli
893
893
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
894
894
  .action(async (root, options) => {
895
895
  filterDuplicateOptions(options);
896
- const { preview } = await import('./chunks/dep-Kf16Z54K.js').then(function (n) { return n.D; });
896
+ const { preview } = await import('./chunks/dep-3p9Yqpeo.js').then(function (n) { return n.D; });
897
897
  try {
898
898
  const server = await preview({
899
899
  root,
@@ -122,5 +122,6 @@ const wildcardHosts = new Set([
122
122
  ]);
123
123
  const DEFAULT_DEV_PORT = 5173;
124
124
  const DEFAULT_PREVIEW_PORT = 4173;
125
+ const ASYNC_DISPOSE = Symbol.asyncDispose || Symbol.for('Symbol.asyncDispose');
125
126
 
126
- export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
127
+ export { ASYNC_DISPOSE, CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
@@ -6,6 +6,7 @@ export { VERSION as rollupVersion } from 'rollup';
6
6
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
7
7
  import * as http from 'node:http';
8
8
  import { OutgoingHttpHeaders, ClientRequestArgs, IncomingMessage, ClientRequest, Agent, Server, ServerResponse } from 'node:http';
9
+ import { Http2SecureServer } from 'node:http2';
9
10
  import * as fs from 'node:fs';
10
11
  import * as events from 'node:events';
11
12
  import { EventEmitter } from 'node:events';
@@ -716,7 +717,7 @@ interface PreviewServer {
716
717
  /**
717
718
  * native Node http server instance
718
719
  */
719
- httpServer: http.Server;
720
+ httpServer: HttpServer;
720
721
  /**
721
722
  * The resolved urls Vite prints on the CLI.
722
723
  * null before server is listening.
@@ -816,7 +817,9 @@ declare class ModuleGraph {
816
817
  getModuleById(id: string): ModuleNode | undefined;
817
818
  getModulesByFile(file: string): Set<ModuleNode> | undefined;
818
819
  onFileChange(file: string): void;
819
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean, hmrBoundaries?: ModuleNode[], softInvalidate?: boolean): void;
820
+ invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean,
821
+
822
+ ): void;
820
823
  invalidateAll(): void;
821
824
  /**
822
825
  * Update the module graph based on a module's updated imports information
@@ -826,7 +829,8 @@ declare class ModuleGraph {
826
829
  * @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
827
830
  * This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
828
831
  */
829
- updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean, staticImportedUrls?: Set<string>): Promise<Set<ModuleNode> | undefined>;
832
+ updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean,
833
+ ): Promise<Set<ModuleNode> | undefined>;
830
834
  ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
831
835
  createFileOnlyEntry(file: string): ModuleNode;
832
836
  resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
@@ -837,7 +841,7 @@ declare class ModuleGraph {
837
841
  * https:
838
842
  */
839
843
 
840
- interface PluginContainer {
844
+ interface PluginContainer extends AsyncDisposable {
841
845
  options: InputOptions;
842
846
  getModuleInfo(id: string): ModuleInfo | null;
843
847
  buildStart(options: InputOptions): Promise<void>;
@@ -1398,7 +1402,7 @@ declare namespace WebSocket {
1398
1402
  }
1399
1403
 
1400
1404
  type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
1401
- interface WebSocketServer {
1405
+ interface WebSocketServer extends AsyncDisposable {
1402
1406
  /**
1403
1407
  * Listen on port and host
1404
1408
  */
@@ -1552,7 +1556,8 @@ interface FileSystemServeOptions {
1552
1556
  deny?: string[];
1553
1557
  }
1554
1558
  type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
1555
- interface ViteDevServer {
1559
+ type HttpServer = http.Server | Http2SecureServer;
1560
+ interface ViteDevServer extends AsyncDisposable {
1556
1561
  /**
1557
1562
  * The resolved vite config object
1558
1563
  */
@@ -1570,7 +1575,7 @@ interface ViteDevServer {
1570
1575
  * native Node http server instance
1571
1576
  * will be null in middleware mode
1572
1577
  */
1573
- httpServer: http.Server | null;
1578
+ httpServer: HttpServer | null;
1574
1579
  /**
1575
1580
  * chokidar watcher instance
1576
1581
  * https:
@@ -2423,7 +2428,7 @@ type ExportsData = {
2423
2428
  exports: readonly string[];
2424
2429
  jsxLoader?: boolean;
2425
2430
  };
2426
- interface DepsOptimizer {
2431
+ interface DepsOptimizer extends AsyncDisposable {
2427
2432
  metadata: DepOptimizationMetadata;
2428
2433
  scanProcessing?: Promise<void>;
2429
2434
  registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
@@ -2924,6 +2929,9 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
2924
2929
  }) => Promise<rollup.TransformResult> | rollup.TransformResult>;
2925
2930
  }
2926
2931
  type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
2932
+ type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & {
2933
+ [P in K]: NonNullable<Plugin[P]>;
2934
+ };
2927
2935
 
2928
2936
  interface JsonOptions {
2929
2937
  /**
@@ -2942,10 +2950,8 @@ interface JsonOptions {
2942
2950
  interface ConfigEnv {
2943
2951
  command: 'build' | 'serve';
2944
2952
  mode: string;
2945
- /**
2946
- * @experimental
2947
- */
2948
- ssrBuild?: boolean;
2953
+ isSsrBuild?: boolean;
2954
+ isPreview?: boolean;
2949
2955
  }
2950
2956
  /**
2951
2957
  * spa: include SPA fallback middleware and configure sirv with `single: true` in preview
@@ -3195,7 +3201,7 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3195
3201
  alias: Alias[];
3196
3202
  };
3197
3203
  plugins: readonly Plugin[];
3198
- css: ResolvedCSSOptions | undefined;
3204
+ css: ResolvedCSSOptions;
3199
3205
  esbuild: ESBuildOptions | false;
3200
3206
  server: ResolvedServerOptions;
3201
3207
  build: ResolvedBuildOptions;
@@ -3210,11 +3216,11 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3210
3216
  experimental: ExperimentalOptions;
3211
3217
  } & PluginHookUtils>;
3212
3218
  interface PluginHookUtils {
3213
- getSortedPlugins: (hookName: keyof Plugin) => Plugin[];
3219
+ getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
3214
3220
  getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3215
3221
  }
3216
3222
  type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3217
- declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string): Promise<ResolvedConfig>;
3223
+ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean): Promise<ResolvedConfig>;
3218
3224
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3219
3225
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
3220
3226
  path: string;
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules } from './chunks/dep-Kf16Z54K.js';
3
- export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Kf16Z54K.js';
2
+ import { i as isInNodeModules } from './chunks/dep-3p9Yqpeo.js';
3
+ export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-3p9Yqpeo.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  export { VERSION as rollupVersion } from 'rollup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.0.0-beta.15",
3
+ "version": "5.0.0-beta.17",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -70,6 +70,7 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@ampproject/remapping": "^2.2.1",
73
+ "@babel/parser": "^7.23.0",
73
74
  "@jridgewell/trace-mapping": "^0.3.20",
74
75
  "@rollup/plugin-alias": "^5.0.1",
75
76
  "@rollup/plugin-commonjs": "^25.0.7",