vite 5.1.0-beta.2 → 5.1.0-beta.4

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 getDefaultExportFromCjs } from './dep-BzxBS-ea.js';
1
+ import { A as getDefaultExportFromCjs } from './dep-2l_yqaZo.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 { y as colors, q as createLogger, r as resolveConfig } from './chunks/dep-BzxBS-ea.js';
5
+ import { z as colors, u as createLogger, r as resolveConfig } from './chunks/dep-2l_yqaZo.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -30,8 +30,8 @@ import 'crypto';
30
30
  import 'module';
31
31
  import 'node:assert';
32
32
  import 'node:v8';
33
+ import 'node:worker_threads';
33
34
  import 'node:buffer';
34
- import 'rollup';
35
35
  import 'rollup/parseAst';
36
36
  import 'querystring';
37
37
  import 'node:readline';
@@ -41,7 +41,6 @@ import 'buffer';
41
41
  import 'https';
42
42
  import 'tls';
43
43
  import 'node:zlib';
44
- import 'worker_threads';
45
44
 
46
45
  function toArr(any) {
47
46
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -758,7 +757,7 @@ cli
758
757
  filterDuplicateOptions(options);
759
758
  // output structure is preserved even after bundling so require()
760
759
  // is ok here
761
- const { createServer } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.C; });
760
+ const { createServer } = await import('./chunks/dep-2l_yqaZo.js').then(function (n) { return n.D; });
762
761
  try {
763
762
  const server = await createServer({
764
763
  root,
@@ -838,7 +837,7 @@ cli
838
837
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
839
838
  .action(async (root, options) => {
840
839
  filterDuplicateOptions(options);
841
- const { build } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.D; });
840
+ const { build } = await import('./chunks/dep-2l_yqaZo.js').then(function (n) { return n.E; });
842
841
  const buildOptions = cleanOptions(options);
843
842
  try {
844
843
  await build({
@@ -866,7 +865,7 @@ cli
866
865
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
867
866
  .action(async (root, options) => {
868
867
  filterDuplicateOptions(options);
869
- const { optimizeDeps } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.B; });
868
+ const { optimizeDeps } = await import('./chunks/dep-2l_yqaZo.js').then(function (n) { return n.C; });
870
869
  try {
871
870
  const config = await resolveConfig({
872
871
  root,
@@ -892,7 +891,7 @@ cli
892
891
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
893
892
  .action(async (root, options) => {
894
893
  filterDuplicateOptions(options);
895
- const { preview } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.E; });
894
+ const { preview } = await import('./chunks/dep-2l_yqaZo.js').then(function (n) { return n.F; });
896
895
  try {
897
896
  const server = await preview({
898
897
  root,
@@ -2,7 +2,6 @@
2
2
  import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, InputOptions, CustomPluginOptions, SourceDescription, LoadResult, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, PluginContext, ResolveIdResult, TransformPluginContext, GetManualChunk } from 'rollup';
3
3
  import * as rollup from 'rollup';
4
4
  export { rollup as Rollup };
5
- export { VERSION as rollupVersion } from 'rollup';
6
5
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
7
6
  import * as http from 'node:http';
8
7
  import { OutgoingHttpHeaders, ClientRequestArgs, IncomingMessage, ClientRequest, Agent, Server, ServerResponse } from 'node:http';
@@ -823,6 +822,7 @@ declare class ModuleGraph {
823
822
  private resolveId;
824
823
  urlToModuleMap: Map<string, ModuleNode>;
825
824
  idToModuleMap: Map<string, ModuleNode>;
825
+ etagToModuleMap: Map<string, ModuleNode>;
826
826
  fileToModulesMap: Map<string, Set<ModuleNode>>;
827
827
  safeModulesPath: Set<string>;
828
828
  constructor(resolveId: (url: string, ssr: boolean) => Promise<PartialResolvedId | null>);
@@ -846,6 +846,8 @@ declare class ModuleGraph {
846
846
  ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
847
847
  createFileOnlyEntry(file: string): ModuleNode;
848
848
  resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
849
+ updateModuleTransformResult(mod: ModuleNode, result: TransformResult | null, ssr: boolean): void;
850
+ getModuleByEtag(etag: string): ModuleNode | undefined;
849
851
  }
850
852
 
851
853
  /**
@@ -1624,7 +1626,7 @@ interface FileSystemServeOptions {
1624
1626
  * Enable caching of fs calls.
1625
1627
  *
1626
1628
  * @experimental
1627
- * @default false
1629
+ * @default true
1628
1630
  */
1629
1631
  cachedChecks?: boolean;
1630
1632
  }
@@ -1757,7 +1759,7 @@ declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServe
1757
1759
  type PackageCache = Map<string, PackageData>;
1758
1760
  interface PackageData {
1759
1761
  dir: string;
1760
- hasSideEffects: (id: string) => boolean | 'no-treeshake';
1762
+ hasSideEffects: (id: string) => boolean | 'no-treeshake' | null;
1761
1763
  webResolvedImports: Record<string, string | undefined>;
1762
1764
  nodeResolvedImports: Record<string, string | undefined>;
1763
1765
  setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
@@ -2582,6 +2584,17 @@ interface DepOptimizationConfig {
2582
2584
  * @experimental
2583
2585
  */
2584
2586
  noDiscovery?: boolean;
2587
+ /**
2588
+ * When enabled, it will hold the first optimized deps results until all static
2589
+ * imports are crawled on cold start. This avoids the need for full-page reloads
2590
+ * when new dependencies are discovered and they trigger the generation of new
2591
+ * common chunks. If all dependencies are found by the scanner plus the explicitely
2592
+ * defined ones in `include`, it is better to disable this option to let the
2593
+ * browser process more requests in parallel.
2594
+ * @default true
2595
+ * @experimental
2596
+ */
2597
+ holdUntilCrawlEnd?: boolean;
2585
2598
  }
2586
2599
  type DepOptimizationOptions = DepOptimizationConfig & {
2587
2600
  /**
@@ -2827,7 +2840,21 @@ interface CSSOptions {
2827
2840
  * https://github.com/css-modules/postcss-modules
2828
2841
  */
2829
2842
  modules?: CSSModulesOptions | false;
2843
+ /**
2844
+ * Options for preprocessors.
2845
+ *
2846
+ * In addition to options specific to each processors, Vite supports `additionalData` option.
2847
+ * The `additionalData` option can be used to inject extra code for each style content.
2848
+ */
2830
2849
  preprocessorOptions?: Record<string, any>;
2850
+ /**
2851
+ * If this option is set, preprocessors will run in workers when possible.
2852
+ * `true` means the number of CPUs minus 1.
2853
+ *
2854
+ * @default 0
2855
+ * @experimental
2856
+ */
2857
+ preprocessorMaxWorkers?: number | true;
2831
2858
  postcss?: string | (PostCSS.ProcessOptions & {
2832
2859
  plugins?: PostCSS.AcceptedPlugin[];
2833
2860
  });
@@ -3360,6 +3387,7 @@ type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
3360
3387
  declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
3361
3388
  resolve?: string | false | null;
3362
3389
  }) => (id: string | unknown) => boolean;
3390
+ declare const rollupVersion: string;
3363
3391
  declare function normalizePath(id: string): string;
3364
3392
  declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
3365
3393
  declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
@@ -3399,4 +3427,4 @@ interface ManifestChunk {
3399
3427
  dynamicImports?: string[];
3400
3428
  }
3401
3429
 
3402
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FileSystemServeOptions, type FilterPattern, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, defineConfig, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
3430
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FileSystemServeOptions, type FilterPattern, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, defineConfig, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
@@ -1,9 +1,8 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-BzxBS-ea.js';
3
- export { b as build, g as buildErrorMessage, j as createFilter, q as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, v as isFileServingAllowed, l as loadConfigFromFile, w as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, x as resolveEnvPrefix, u as searchForWorkspaceRoot, k as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-BzxBS-ea.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-2l_yqaZo.js';
3
+ export { b as build, g as buildErrorMessage, j as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, w as isFileServingAllowed, l as loadConfigFromFile, x as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, y as resolveEnvPrefix, k as rollupVersion, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-2l_yqaZo.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
- export { VERSION as rollupVersion } from 'rollup';
7
6
  import 'node:fs';
8
7
  import 'node:fs/promises';
9
8
  import 'node:path';
@@ -33,6 +32,7 @@ import 'crypto';
33
32
  import 'module';
34
33
  import 'node:assert';
35
34
  import 'node:v8';
35
+ import 'node:worker_threads';
36
36
  import 'node:buffer';
37
37
  import 'querystring';
38
38
  import 'node:readline';
@@ -42,7 +42,6 @@ import 'buffer';
42
42
  import 'https';
43
43
  import 'tls';
44
44
  import 'node:zlib';
45
- import 'worker_threads';
46
45
 
47
46
  // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
48
47
  // copy from constants.ts
@@ -4,7 +4,6 @@ var path$3 = require('node:path');
4
4
  var node_url = require('node:url');
5
5
  var fs$1 = require('node:fs');
6
6
  var esbuild = require('esbuild');
7
- var rollup = require('rollup');
8
7
  var os$1 = require('node:os');
9
8
  var node_module = require('node:module');
10
9
  var require$$0 = require('tty');
@@ -3374,7 +3373,12 @@ function isInNodeModules(id) {
3374
3373
  return id.includes('node_modules');
3375
3374
  }
3376
3375
  // TODO: use import()
3377
- node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
3376
+ const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
3377
+ function resolveDependencyVersion(dep, pkgRelativePath = '../../package.json') {
3378
+ const pkgPath = path$3.resolve(_require.resolve(dep), pkgRelativePath);
3379
+ return JSON.parse(fs$1.readFileSync(pkgPath, 'utf-8')).version;
3380
+ }
3381
+ const rollupVersion = resolveDependencyVersion('rollup');
3378
3382
  // set in bin/vite.js
3379
3383
  const filter = process.env.VITE_DEBUG_FILTER;
3380
3384
  const DEBUG = process.env.DEBUG;
@@ -6073,7 +6077,6 @@ function resolveEnvPrefix({ envPrefix = 'VITE_', }) {
6073
6077
  }
6074
6078
 
6075
6079
  exports.esbuildVersion = esbuild.version;
6076
- exports.rollupVersion = rollup.VERSION;
6077
6080
  exports.createFilter = createFilter;
6078
6081
  exports.createLogger = createLogger;
6079
6082
  exports.isCSSRequest = isCSSRequest;
@@ -6083,6 +6086,7 @@ exports.mergeAlias = mergeAlias;
6083
6086
  exports.mergeConfig = mergeConfig;
6084
6087
  exports.normalizePath = normalizePath;
6085
6088
  exports.resolveEnvPrefix = resolveEnvPrefix;
6089
+ exports.rollupVersion = rollupVersion;
6086
6090
  exports.searchForWorkspaceRoot = searchForWorkspaceRoot;
6087
6091
  exports.send = send;
6088
6092
  exports.splitVendorChunk = splitVendorChunk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.1.0-beta.2",
3
+ "version": "5.1.0-beta.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -83,6 +83,7 @@
83
83
  "@types/pnpapi": "^0.0.5",
84
84
  "acorn": "^8.11.3",
85
85
  "acorn-walk": "^8.3.2",
86
+ "artichokie": "^0.2.0",
86
87
  "cac": "^6.7.14",
87
88
  "chokidar": "^3.5.3",
88
89
  "connect": "^3.7.0",
@@ -105,7 +106,6 @@
105
106
  "micromatch": "^4.0.5",
106
107
  "mlly": "^1.5.0",
107
108
  "mrmime": "^2.0.0",
108
- "okie": "^1.0.1",
109
109
  "open": "^8.4.2",
110
110
  "parse5": "^7.1.2",
111
111
  "periscopic": "^4.0.2",