vite 5.0.0-beta.7 → 5.0.0-beta.8

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.
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 { C as colors, x as createLogger, h as resolveConfig } from './chunks/dep-7af400e9.js';
5
+ import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-73034a1b.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -27,21 +27,21 @@ import 'node:dns';
27
27
  import 'crypto';
28
28
  import 'node:buffer';
29
29
  import 'module';
30
- import 'rollup';
31
30
  import 'node:assert';
32
31
  import 'node:process';
33
32
  import 'node:v8';
33
+ import 'rollup';
34
+ import 'querystring';
35
+ import 'node:readline';
36
+ import 'node:events';
34
37
  import 'node:http';
35
38
  import 'node:https';
36
39
  import 'zlib';
37
40
  import 'buffer';
38
41
  import 'https';
39
42
  import 'tls';
40
- import 'worker_threads';
41
- import 'querystring';
42
- import 'node:readline';
43
- import 'node:events';
44
43
  import 'node:zlib';
44
+ import 'worker_threads';
45
45
 
46
46
  function toArr(any) {
47
47
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -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-7af400e9.js').then(function (n) { return n.H; });
762
+ const { createServer } = await import('./chunks/dep-73034a1b.js').then(function (n) { return n.C; });
763
763
  try {
764
764
  const server = await createServer({
765
765
  root,
@@ -840,7 +840,7 @@ cli
840
840
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
841
841
  .action(async (root, options) => {
842
842
  filterDuplicateOptions(options);
843
- const { build } = await import('./chunks/dep-7af400e9.js').then(function (n) { return n.G; });
843
+ const { build } = await import('./chunks/dep-73034a1b.js').then(function (n) { return n.B; });
844
844
  const buildOptions = cleanOptions(options);
845
845
  try {
846
846
  await build({
@@ -868,7 +868,7 @@ cli
868
868
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
869
869
  .action(async (root, options) => {
870
870
  filterDuplicateOptions(options);
871
- const { optimizeDeps } = await import('./chunks/dep-7af400e9.js').then(function (n) { return n.F; });
871
+ const { optimizeDeps } = await import('./chunks/dep-73034a1b.js').then(function (n) { return n.A; });
872
872
  try {
873
873
  const config = await resolveConfig({
874
874
  root,
@@ -895,7 +895,7 @@ cli
895
895
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
896
896
  .action(async (root, options) => {
897
897
  filterDuplicateOptions(options);
898
- const { preview } = await import('./chunks/dep-7af400e9.js').then(function (n) { return n.I; });
898
+ const { preview } = await import('./chunks/dep-73034a1b.js').then(function (n) { return n.D; });
899
899
  try {
900
900
  const server = await preview({
901
901
  root,
@@ -1636,6 +1636,29 @@ interface ResolvedServerUrls {
1636
1636
  }
1637
1637
  declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
1638
1638
 
1639
+ /** Cache for package.json resolution and package.json contents */
1640
+ type PackageCache = Map<string, PackageData>;
1641
+ interface PackageData {
1642
+ dir: string;
1643
+ hasSideEffects: (id: string) => boolean | 'no-treeshake';
1644
+ webResolvedImports: Record<string, string | undefined>;
1645
+ nodeResolvedImports: Record<string, string | undefined>;
1646
+ setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
1647
+ getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
1648
+ data: {
1649
+ [field: string]: any;
1650
+ name: string;
1651
+ type: string;
1652
+ version: string;
1653
+ main: string;
1654
+ module: string;
1655
+ browser: string | Record<string, string | false>;
1656
+ exports: string | Record<string, any> | string[];
1657
+ imports: Record<string, any>;
1658
+ dependencies: Record<string, string>;
1659
+ };
1660
+ }
1661
+
1639
1662
  interface RollupCommonJSOptions {
1640
1663
  /**
1641
1664
  * A minimatch pattern, or array of patterns, which specifies the files in
@@ -2103,30 +2126,6 @@ interface TerserOptions extends Terser.MinifyOptions {
2103
2126
  maxWorkers?: number;
2104
2127
  }
2105
2128
 
2106
- /** Cache for package.json resolution and package.json contents */
2107
- type PackageCache = Map<string, PackageData>;
2108
- interface PackageData {
2109
- dir: string;
2110
- hasSideEffects: (id: string) => boolean | 'no-treeshake';
2111
- webResolvedImports: Record<string, string | undefined>;
2112
- nodeResolvedImports: Record<string, string | undefined>;
2113
- setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
2114
- getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
2115
- data: {
2116
- [field: string]: any;
2117
- name: string;
2118
- type: string;
2119
- version: string;
2120
- main: string;
2121
- module: string;
2122
- browser: string | Record<string, string | false>;
2123
- exports: string | Record<string, any> | string[];
2124
- imports: Record<string, any>;
2125
- dependencies: Record<string, string>;
2126
- };
2127
- }
2128
- declare function resolvePackageData(pkgName: string, basedir: string, preserveSymlinks?: boolean, packageCache?: PackageCache): PackageData | null;
2129
-
2130
2129
  interface BuildOptions {
2131
2130
  /**
2132
2131
  * Compatibility transform target. The transform is performed with esbuild
@@ -2482,20 +2481,6 @@ type DepOptimizationOptions = DepOptimizationConfig & {
2482
2481
  */
2483
2482
  force?: boolean;
2484
2483
  };
2485
- interface DepOptimizationResult {
2486
- metadata: DepOptimizationMetadata;
2487
- /**
2488
- * When doing a re-run, if there are newly discovered dependencies
2489
- * the page reload will be delayed until the next rerun so we need
2490
- * to be able to discard the result
2491
- */
2492
- commit: () => Promise<void>;
2493
- cancel: () => void;
2494
- }
2495
- interface DepOptimizationProcessing {
2496
- promise: Promise<void>;
2497
- resolve: () => void;
2498
- }
2499
2484
  interface OptimizedDepInfo {
2500
2485
  id: string;
2501
2486
  file: string;
@@ -2635,7 +2620,6 @@ interface InternalResolveOptions extends Required<ResolveOptions> {
2635
2620
  getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
2636
2621
  shouldExternalize?: (id: string, importer?: string) => boolean | undefined;
2637
2622
  }
2638
- declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
2639
2623
 
2640
2624
  interface Targets {
2641
2625
  android?: number,
@@ -3145,7 +3129,7 @@ interface ExperimentalOptions {
3145
3129
  }
3146
3130
  interface LegacyOptions {
3147
3131
  }
3148
- interface ResolveWorkerOptions extends PluginHookUtils {
3132
+ interface ResolvedWorkerOptions extends PluginHookUtils {
3149
3133
  format: 'es' | 'iife';
3150
3134
  plugins: Plugin[];
3151
3135
  rollupOptions: RollupOptions;
@@ -3182,7 +3166,7 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3182
3166
  logger: Logger;
3183
3167
  createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
3184
3168
  optimizeDeps: DepOptimizationOptions;
3185
- worker: ResolveWorkerOptions;
3169
+ worker: ResolvedWorkerOptions;
3186
3170
  appType: AppType;
3187
3171
  experimental: ExperimentalOptions;
3188
3172
  } & PluginHookUtils>;
@@ -3192,19 +3176,12 @@ interface PluginHookUtils {
3192
3176
  }
3193
3177
  type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3194
3178
  declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string): Promise<ResolvedConfig>;
3195
- /**
3196
- * Resolve base url. Note that some users use Vite to build for non-web targets like
3197
- * electron or expects to deploy
3198
- */
3199
- declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger): string;
3200
3179
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3201
3180
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
3202
3181
  path: string;
3203
3182
  config: UserConfig;
3204
3183
  dependencies: string[];
3205
3184
  } | null>;
3206
- declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
3207
- declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
3208
3185
 
3209
3186
  declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
3210
3187
 
@@ -3267,4 +3244,4 @@ interface ManifestChunk {
3267
3244
  dynamicImports?: string[];
3268
3245
  }
3269
3246
 
3270
- 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 DepOptimizationProcessing, type DepOptimizationResult, type DepsOptimizer, 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 PackageCache, type PackageData, 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 ResolveWorkerOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, 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, getDepOptimizationConfig, isCSSRequest, isDepsOptimizerEnabled, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveBaseUrl, resolveConfig, resolveEnvPrefix, resolvePackageData, resolvePackageEntry, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
3247
+ 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 };
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-7af400e9.js';
2
- export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-7af400e9.js';
1
+ import { i as isInNodeModules } from './chunks/dep-73034a1b.js';
2
+ 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-73034a1b.js';
3
3
  export { VERSION as version } from './constants.js';
4
4
  export { version as esbuildVersion } from 'esbuild';
5
5
  export { VERSION as rollupVersion } from 'rollup';
@@ -32,17 +32,17 @@ import 'module';
32
32
  import 'node:assert';
33
33
  import 'node:process';
34
34
  import 'node:v8';
35
+ import 'querystring';
36
+ import 'node:readline';
37
+ import 'node:events';
35
38
  import 'node:http';
36
39
  import 'node:https';
37
40
  import 'zlib';
38
41
  import 'buffer';
39
42
  import 'https';
40
43
  import 'tls';
41
- import 'worker_threads';
42
- import 'querystring';
43
- import 'node:readline';
44
- import 'node:events';
45
44
  import 'node:zlib';
45
+ import 'worker_threads';
46
46
 
47
47
  // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
48
48
  // copy from constants.ts
package/index.cjs CHANGED
@@ -25,16 +25,6 @@ asyncFunctions.forEach((name) => {
25
25
  import('./dist/node/index.js').then((i) => i[name](...args))
26
26
  })
27
27
 
28
- // some sync functions are marked not supported due to their complexity and uncommon usage
29
- const unsupportedCJS = ['resolvePackageEntry', 'resolvePackageData']
30
- unsupportedCJS.forEach((name) => {
31
- module.exports[name] = () => {
32
- throw new Error(
33
- `"${name}" is not supported in CJS build of Vite 4.\nPlease use ESM or dynamic imports \`const { ${name} } = await import('vite')\`.`,
34
- )
35
- }
36
- })
37
-
38
28
  function warnCjsUsage() {
39
29
  if (process.env.VITE_CJS_IGNORE_WARNING) return
40
30
  globalThis.__vite_cjs_skip_clear_screen = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.0.0-beta.7",
3
+ "version": "5.0.0-beta.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -72,8 +72,8 @@
72
72
  "@ampproject/remapping": "^2.2.1",
73
73
  "@jridgewell/trace-mapping": "^0.3.19",
74
74
  "@rollup/plugin-alias": "^5.0.1",
75
- "@rollup/plugin-commonjs": "^25.0.5",
76
- "@rollup/plugin-dynamic-import-vars": "^2.0.6",
75
+ "@rollup/plugin-commonjs": "^25.0.7",
76
+ "@rollup/plugin-dynamic-import-vars": "^2.0.7",
77
77
  "@rollup/plugin-json": "^6.0.1",
78
78
  "@rollup/plugin-node-resolve": "15.2.3",
79
79
  "@rollup/plugin-typescript": "^11.1.5",
@@ -103,7 +103,7 @@
103
103
  "json-stable-stringify": "^1.0.2",
104
104
  "launch-editor-middleware": "^2.6.1",
105
105
  "lightningcss": "^1.22.0",
106
- "magic-string": "^0.30.4",
106
+ "magic-string": "^0.30.5",
107
107
  "micromatch": "^4.0.5",
108
108
  "mlly": "^1.4.2",
109
109
  "mrmime": "^1.0.1",
@@ -118,12 +118,12 @@
118
118
  "postcss-modules": "^6.0.0",
119
119
  "resolve.exports": "^2.0.2",
120
120
  "rollup-plugin-dts": "^6.1.0",
121
- "rollup-plugin-license": "^3.1.0",
121
+ "rollup-plugin-license": "^3.2.0",
122
122
  "sirv": "^2.0.3",
123
123
  "source-map-support": "^0.5.21",
124
124
  "strip-ansi": "^7.1.0",
125
125
  "strip-literal": "^1.3.0",
126
- "tsconfck": "^3.0.0-next.9",
126
+ "tsconfck": "^3.0.0",
127
127
  "tslib": "^2.6.2",
128
128
  "types": "link:./types",
129
129
  "ufo": "^1.3.1",
@@ -0,0 +1,5 @@
1
+ /// <reference path="./importMeta.d.ts" />
2
+
3
+ // https://github.com/microsoft/TypeScript/issues/45096
4
+ // TypeScript has a bug that makes <reference types="vite/types/importMeta" />
5
+ // not possible in userland. This file provides a workaround for now.