vite 6.0.0-alpha.11 → 6.0.0-alpha.14

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,9 +1,9 @@
1
- import { b as commonjsGlobal, g as getDefaultExportFromCjs } from './dep-C7zR1Rh8.js';
1
+ import { f as commonjsGlobal, g as getDefaultExportFromCjs } from './dep-B2yOf3Tu.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
5
5
  import require$$3 from 'crypto';
6
- import require$$0$2 from 'util';
6
+ import require$$3$1 from 'util';
7
7
  import { l as lib } from './dep-IQS-Za7F.js';
8
8
 
9
9
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
@@ -3694,7 +3694,7 @@ var attribute$1 = {};
3694
3694
  * For Node.js, simply re-export the core `util.deprecate` function.
3695
3695
  */
3696
3696
 
3697
- var node = require$$0$2.deprecate;
3697
+ var node = require$$3$1.deprecate;
3698
3698
 
3699
3699
  (function (exports) {
3700
3700
 
package/dist/node/cli.js CHANGED
@@ -2,11 +2,19 @@ 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 { a as colors, c as createLogger } from './chunks/dep-C7zR1Rh8.js';
5
+ import { e as colors, d as createLogger } from './chunks/dep-B2yOf3Tu.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:readline';
8
8
  import 'tty';
9
+ import 'node:os';
10
+ import 'node:child_process';
11
+ import 'node:crypto';
9
12
  import 'node:url';
13
+ import 'node:module';
14
+ import 'node:dns';
15
+ import 'node:fs/promises';
16
+ import 'util';
17
+ import 'path';
10
18
 
11
19
  function toArr(any) {
12
20
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -731,7 +739,7 @@ cli
731
739
  filterDuplicateOptions(options);
732
740
  // output structure is preserved even after bundling so require()
733
741
  // is ok here
734
- const { createServer } = await import('./chunks/dep-CjFMk8-F.js').then(function (n) { return n.C; });
742
+ const { createServer } = await import('./chunks/dep-DnG211Xs.js').then(function (n) { return n.w; });
735
743
  try {
736
744
  const server = await createServer({
737
745
  root,
@@ -812,7 +820,7 @@ cli
812
820
  .option('--app', `[boolean] same as builder.entireApp`)
813
821
  .action(async (root, options) => {
814
822
  filterDuplicateOptions(options);
815
- const { createBuilder, buildEnvironment } = await import('./chunks/dep-CjFMk8-F.js').then(function (n) { return n.E; });
823
+ const { createBuilder, buildEnvironment } = await import('./chunks/dep-DnG211Xs.js').then(function (n) { return n.x; });
816
824
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
817
825
  const config = {
818
826
  root,
@@ -888,7 +896,7 @@ cli
888
896
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
889
897
  .action(async (root, options) => {
890
898
  filterDuplicateOptions(options);
891
- const { preview } = await import('./chunks/dep-CjFMk8-F.js').then(function (n) { return n.F; });
899
+ const { preview } = await import('./chunks/dep-DnG211Xs.js').then(function (n) { return n.y; });
892
900
  try {
893
901
  const server = await preview({
894
902
  root,
@@ -679,8 +679,8 @@ interface CommonServerOptions {
679
679
  * ``` js
680
680
  * module.exports = {
681
681
  * proxy: {
682
- * // string shorthand
683
- * '/foo': 'http://localhost:4567/foo',
682
+ * // string shorthand: /foo -> http://localhost:4567/foo
683
+ * '/foo': 'http://localhost:4567',
684
684
  * // with options
685
685
  * '/api': {
686
686
  * target: 'http://jsonplaceholder.typicode.com',
@@ -788,7 +788,7 @@ type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
788
788
  * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
789
789
  */
790
790
 
791
- interface IsolatedPluginContainer {
791
+ interface EnvironmentPluginContainer {
792
792
  options: InputOptions;
793
793
  buildStart(options: InputOptions): Promise<void>;
794
794
  resolveId(id: string, importer: string | undefined, options?: {
@@ -814,7 +814,7 @@ interface IsolatedPluginContainer {
814
814
  interface PluginContainer {
815
815
  options: InputOptions;
816
816
  buildStart(options: InputOptions): Promise<void>;
817
- resolveId(id: string, importer: string | undefined, options?: {
817
+ resolveId(id: string, importer?: string, options?: {
818
818
  attributes?: Record<string, string>;
819
819
  custom?: CustomPluginOptions;
820
820
  skip?: Set<Plugin>;
@@ -1381,7 +1381,7 @@ declare class Environment {
1381
1381
  name: string;
1382
1382
  config: ResolvedConfig;
1383
1383
  options: ResolvedEnvironmentOptions;
1384
- get plugins(): IsolatedPlugin[];
1384
+ get plugins(): EnvironmentPlugin[];
1385
1385
  get logger(): Logger;
1386
1386
  constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
1387
1387
  }
@@ -1398,7 +1398,7 @@ declare function fetchModule(environment: DevEnvironment, url: string, importer?
1398
1398
 
1399
1399
  declare class ScanEnvironment extends Environment {
1400
1400
  mode: "scan";
1401
- get pluginContainer(): IsolatedPluginContainer;
1401
+ get pluginContainer(): EnvironmentPluginContainer;
1402
1402
  init(): Promise<void>;
1403
1403
  }
1404
1404
 
@@ -1587,7 +1587,7 @@ declare class DevEnvironment extends Environment {
1587
1587
  moduleGraph: EnvironmentModuleGraph;
1588
1588
  watcher?: FSWatcher;
1589
1589
  depsOptimizer?: DepsOptimizer;
1590
- get pluginContainer(): IsolatedPluginContainer;
1590
+ get pluginContainer(): EnvironmentPluginContainer;
1591
1591
  /**
1592
1592
  * HMR channel for this environment. If not provided or disabled,
1593
1593
  * it will be a noop channel that does nothing.
@@ -3248,7 +3248,7 @@ interface TransformPluginContext extends rollup.TransformPluginContext {
3248
3248
  * once per each environment allowing users to have completely different plugins
3249
3249
  * for each of them. The constructor gets the resolved environment after the server
3250
3250
  * and builder has already been created simplifying config access and cache
3251
- * managementfor for environment specific plugins.
3251
+ * management for for environment specific plugins.
3252
3252
  * Environment Plugins are closer to regular rollup plugins. They can't define
3253
3253
  * app level hooks (like config, configResolved, configureServer, etc).
3254
3254
  */
@@ -3261,21 +3261,7 @@ type ModifyObjectHookContext<Handler, Object_ extends {
3261
3261
  type ModifyHookContext<Hook, NewContext> = Hook extends {
3262
3262
  handler: infer Handler;
3263
3263
  } ? ModifyObjectHookContext<Handler, Hook, NewContext> : ModifyFunctionContext<Hook, NewContext>;
3264
- interface BasePlugin<A = any> extends rollup.Plugin<A> {
3265
- /**
3266
- * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
3267
- * is still subject to the `order` property in the hook object.
3268
- *
3269
- * Plugin invocation order:
3270
- * - alias resolution
3271
- * - `enforce: 'pre'` plugins
3272
- * - vite core plugins
3273
- * - normal plugins
3274
- * - vite build plugins
3275
- * - `enforce: 'post'` plugins
3276
- * - vite build post plugins
3277
- */
3278
- enforce?: 'pre' | 'post';
3264
+ interface EnvironmentPlugin<A = any> extends rollup.Plugin<A> {
3279
3265
  /**
3280
3266
  * Perform custom handling of HMR updates.
3281
3267
  * The handler receives a context containing changed filename, timestamp, a
@@ -3320,8 +3306,7 @@ interface BasePlugin<A = any> extends rollup.Plugin<A> {
3320
3306
  generateBundle?: ModifyHookContext<rollup.Plugin<A>['generateBundle'], PluginContext>;
3321
3307
  renderChunk?: ModifyHookContext<rollup.Plugin<A>['renderChunk'], PluginContext>;
3322
3308
  }
3323
- type IsolatedPlugin<A = any> = BasePlugin<A>;
3324
- interface Plugin<A = any> extends BasePlugin<A> {
3309
+ interface Plugin<A = any> extends EnvironmentPlugin<A> {
3325
3310
  /**
3326
3311
  * Opt-in this plugin into the shared plugins pipeline.
3327
3312
  * For backward-compatibility, plugins are re-recreated for each environment
@@ -3331,6 +3316,20 @@ interface Plugin<A = any> extends BasePlugin<A> {
3331
3316
  * @experimental
3332
3317
  */
3333
3318
  sharedDuringBuild?: boolean;
3319
+ /**
3320
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
3321
+ * is still subject to the `order` property in the hook object.
3322
+ *
3323
+ * Plugin invocation order:
3324
+ * - alias resolution
3325
+ * - `enforce: 'pre'` plugins
3326
+ * - vite core plugins
3327
+ * - normal plugins
3328
+ * - vite build plugins
3329
+ * - `enforce: 'post'` plugins
3330
+ * - vite build post plugins
3331
+ */
3332
+ enforce?: 'pre' | 'post';
3334
3333
  /**
3335
3334
  * Apply the plugin only for serve or build, or on certain conditions.
3336
3335
  */
@@ -3395,6 +3394,10 @@ interface Plugin<A = any> extends BasePlugin<A> {
3395
3394
  * `{ order: 'pre', handler: hook }`
3396
3395
  */
3397
3396
  transformIndexHtml?: IndexHtmlTransform;
3397
+ /**
3398
+ * Inject per environment plugins after the shared plugin
3399
+ */
3400
+ environmentPlugins?: (environment: PluginEnvironment) => PluginOption[] | undefined;
3398
3401
  /**
3399
3402
  * @deprecated
3400
3403
  * Compat support, ctx.modules is a backward compatible ModuleNode array
@@ -3406,13 +3409,7 @@ type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
3406
3409
  type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & {
3407
3410
  [P in K]: NonNullable<Plugin[P]>;
3408
3411
  };
3409
- type IsolatedPluginConstructor = {
3410
- (environment: PluginEnvironment): IsolatedPluginOption;
3411
- sharedDuringBuild?: boolean;
3412
- };
3413
- type MaybeIsolatedPlugin = IsolatedPlugin | false | null | undefined;
3414
- type IsolatedPluginOption = MaybeIsolatedPlugin | IsolatedPluginOption[] | Promise<MaybeIsolatedPlugin | IsolatedPluginOption[]>;
3415
- type MaybePlugin = Plugin | IsolatedPluginConstructor | false | null | undefined;
3412
+ type MaybePlugin = Plugin | false | null | undefined;
3416
3413
  type PluginOption = MaybePlugin | PluginOption[] | Promise<MaybePlugin | PluginOption[]>;
3417
3414
 
3418
3415
  interface JsonOptions {
@@ -3862,7 +3859,6 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3862
3859
  alias: Alias[];
3863
3860
  };
3864
3861
  plugins: readonly Plugin[];
3865
- rawPlugins: readonly (Plugin | IsolatedPluginConstructor)[];
3866
3862
  css: ResolvedCSSOptions;
3867
3863
  esbuild: ESBuildOptions | false;
3868
3864
  server: ResolvedServerOptions;
@@ -3885,7 +3881,7 @@ interface PluginHookUtils {
3885
3881
  getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3886
3882
  }
3887
3883
  type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3888
- declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((plugins: (Plugin | IsolatedPluginConstructor)[]) => void) | undefined): Promise<ResolvedConfig>;
3884
+ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((resolvedPlugins: Plugin[]) => void) | undefined): Promise<ResolvedConfig>;
3889
3885
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3890
3886
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
3891
3887
  path: string;
@@ -3934,11 +3930,20 @@ declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
3934
3930
  onUpdate(handler: (payload: HMRPayload) => void): void;
3935
3931
  }
3936
3932
 
3933
+ interface ModuleRunnerTransformOptions {
3934
+ json?: {
3935
+ stringify?: boolean;
3936
+ };
3937
+ }
3938
+ declare function ssrTransform(code: string, inMap: SourceMap | {
3939
+ mappings: '';
3940
+ } | null, url: string, originalCode: string, options?: ModuleRunnerTransformOptions): Promise<TransformResult | null>;
3941
+
3937
3942
  declare const VERSION: string;
3938
3943
 
3939
3944
  declare const isCSSRequest: (request: string) => boolean;
3940
3945
  /**
3941
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3946
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3942
3947
  */
3943
3948
  declare class SplitVendorChunkCache {
3944
3949
  cache: Map<string, boolean>;
@@ -3946,13 +3951,13 @@ declare class SplitVendorChunkCache {
3946
3951
  reset(): void;
3947
3952
  }
3948
3953
  /**
3949
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3954
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3950
3955
  */
3951
3956
  declare function splitVendorChunk(options?: {
3952
3957
  cache?: SplitVendorChunkCache;
3953
3958
  }): GetManualChunk;
3954
3959
  /**
3955
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3960
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3956
3961
  */
3957
3962
  declare function splitVendorChunkPlugin(): Plugin;
3958
3963
 
@@ -3985,9 +3990,10 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
3985
3990
 
3986
3991
  /**
3987
3992
  * Check if the url is allowed to be served, via the `server.fs` config.
3988
- * @deprecate use isFileLoadingAllowed
3993
+ * @deprecated use isFileLoadingAllowed
3989
3994
  */
3990
3995
  declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
3996
+ declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
3991
3997
 
3992
3998
  declare function loadEnv(mode: string, envDir: string, prefixes?: string | string[]): Record<string, string>;
3993
3999
  declare function resolveEnvPrefix({ envPrefix, }: UserConfig): string[];
@@ -4005,4 +4011,4 @@ interface ManifestChunk {
4005
4011
  dynamicImports?: string[];
4006
4012
  }
4007
4013
 
4008
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentOptions, type DevEnvironmentSetup, type ESBuildOptions, type ESBuildTransformResult, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotUpdateContext, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type IsolatedPlugin, type IsolatedPluginConstructor, 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, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, 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 ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
4014
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentOptions, type DevEnvironmentSetup, type ESBuildOptions, type ESBuildTransformResult, EnvironmentModuleGraph, EnvironmentModuleNode, type EnvironmentPlugin, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotUpdateContext, 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 ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, 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 ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
@@ -1,9 +1,9 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-CjFMk8-F.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, h as buildErrorMessage, e as createBuilder, u as createFilter, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, d as defineConfig, k as fetchModule, f as formatPostcssSourceMap, y as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, q as mergeAlias, o as mergeConfig, n as normalizePath, g as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, v as rollupVersion, x as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-CjFMk8-F.js';
2
+ export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, g as buildErrorMessage, a as createBuilder, h as createNodeDevEnvironment, c as createServer, j as createServerModuleRunner, d as defineConfig, i as fetchModule, f as formatPostcssSourceMap, q as isFileLoadingAllowed, o as isFileServingAllowed, l as loadConfigFromFile, u as loadEnv, k as moduleRunnerTransform, e as preprocessCSS, p as preview, r as resolveConfig, v as resolveEnvPrefix, n as searchForWorkspaceRoot, m as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DnG211Xs.js';
4
3
  export { VERSION as version } from './constants.js';
5
4
  export { version as esbuildVersion } from 'esbuild';
6
- export { c as createLogger } from './chunks/dep-C7zR1Rh8.js';
5
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-B2yOf3Tu.js';
6
+ export { c as createFilter, d as createLogger, b as mergeAlias, m as mergeConfig, n as normalizePath, r as rollupVersion } from './chunks/dep-B2yOf3Tu.js';
7
7
  import 'node:fs';
8
8
  import 'node:fs/promises';
9
9
  import 'node:path';
@@ -26,13 +26,11 @@ import 'http';
26
26
  import 'stream';
27
27
  import 'os';
28
28
  import 'child_process';
29
- import 'node:os';
30
- import 'node:crypto';
31
- import 'node:dns';
32
29
  import 'vite/module-runner';
33
30
  import 'module';
34
31
  import 'node:assert';
35
32
  import 'node:v8';
33
+ import 'node:os';
36
34
  import 'node:worker_threads';
37
35
  import 'node:events';
38
36
  import 'crypto';
@@ -44,6 +42,8 @@ import 'buffer';
44
42
  import 'https';
45
43
  import 'tls';
46
44
  import 'node:zlib';
45
+ import 'node:crypto';
46
+ import 'node:dns';
47
47
 
48
48
  // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
49
49
  // copy from constants.ts
@@ -59,7 +59,7 @@ const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
59
59
  // The cache needs to be reset on buildStart for watch mode to work correctly
60
60
  // Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
61
61
  /**
62
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
62
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
63
63
  */
64
64
  class SplitVendorChunkCache {
65
65
  cache;
@@ -71,7 +71,7 @@ class SplitVendorChunkCache {
71
71
  }
72
72
  }
73
73
  /**
74
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
74
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
75
75
  */
76
76
  function splitVendorChunk(options = {}) {
77
77
  const cache = options.cache ?? new SplitVendorChunkCache();
@@ -106,7 +106,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
106
106
  return someImporterIs;
107
107
  }
108
108
  /**
109
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
109
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
110
110
  */
111
111
  function splitVendorChunkPlugin() {
112
112
  const caches = [];
@@ -119,17 +119,21 @@ function getDefaultExportFromCjs (x) {
119
119
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
120
120
  }
121
121
 
122
- var picocolors = {exports: {}};
122
+ function commonjsRequire(path) {
123
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
124
+ }
123
125
 
124
- let tty = require$$0;
126
+ var picocolors = {exports: {}};
125
127
 
128
+ let argv = process.argv || [],
129
+ env = process.env;
126
130
  let isColorSupported =
127
- !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
128
- ("FORCE_COLOR" in process.env ||
129
- process.argv.includes("--color") ||
131
+ !("NO_COLOR" in env || argv.includes("--no-color")) &&
132
+ ("FORCE_COLOR" in env ||
133
+ argv.includes("--color") ||
130
134
  process.platform === "win32" ||
131
- (tty.isatty(1) && process.env.TERM !== "dumb") ||
132
- "CI" in process.env);
135
+ (commonjsRequire != null && require$$0.isatty(1) && env.TERM !== "dumb") ||
136
+ "CI" in env);
133
137
 
134
138
  let formatter =
135
139
  (open, close, replace = open) =>
@@ -142,40 +146,47 @@ let formatter =
142
146
  };
143
147
 
144
148
  let replaceClose = (string, close, replace, index) => {
145
- let start = string.substring(0, index) + replace;
146
- let end = string.substring(index + close.length);
147
- let nextIndex = end.indexOf(close);
148
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
149
+ let result = "";
150
+ let cursor = 0;
151
+ do {
152
+ result += string.substring(cursor, index) + replace;
153
+ cursor = index + close.length;
154
+ index = string.indexOf(close, cursor);
155
+ } while (~index)
156
+ return result + string.substring(cursor)
149
157
  };
150
158
 
151
- let createColors = (enabled = isColorSupported) => ({
152
- isColorSupported: enabled,
153
- reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
154
- bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
155
- dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
156
- italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
157
- underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
158
- inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
159
- hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
160
- strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
161
- black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
162
- red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
163
- green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
164
- yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
165
- blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
166
- magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
167
- cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
168
- white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
169
- gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
170
- bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
171
- bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
172
- bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
173
- bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
174
- bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
175
- bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
176
- bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
177
- bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
178
- });
159
+ let createColors = (enabled = isColorSupported) => {
160
+ let init = enabled ? formatter : () => String;
161
+ return {
162
+ isColorSupported: enabled,
163
+ reset: init("\x1b[0m", "\x1b[0m"),
164
+ bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
165
+ dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
166
+ italic: init("\x1b[3m", "\x1b[23m"),
167
+ underline: init("\x1b[4m", "\x1b[24m"),
168
+ inverse: init("\x1b[7m", "\x1b[27m"),
169
+ hidden: init("\x1b[8m", "\x1b[28m"),
170
+ strikethrough: init("\x1b[9m", "\x1b[29m"),
171
+ black: init("\x1b[30m", "\x1b[39m"),
172
+ red: init("\x1b[31m", "\x1b[39m"),
173
+ green: init("\x1b[32m", "\x1b[39m"),
174
+ yellow: init("\x1b[33m", "\x1b[39m"),
175
+ blue: init("\x1b[34m", "\x1b[39m"),
176
+ magenta: init("\x1b[35m", "\x1b[39m"),
177
+ cyan: init("\x1b[36m", "\x1b[39m"),
178
+ white: init("\x1b[37m", "\x1b[39m"),
179
+ gray: init("\x1b[90m", "\x1b[39m"),
180
+ bgBlack: init("\x1b[40m", "\x1b[49m"),
181
+ bgRed: init("\x1b[41m", "\x1b[49m"),
182
+ bgGreen: init("\x1b[42m", "\x1b[49m"),
183
+ bgYellow: init("\x1b[43m", "\x1b[49m"),
184
+ bgBlue: init("\x1b[44m", "\x1b[49m"),
185
+ bgMagenta: init("\x1b[45m", "\x1b[49m"),
186
+ bgCyan: init("\x1b[46m", "\x1b[49m"),
187
+ bgWhite: init("\x1b[47m", "\x1b[49m"),
188
+ }
189
+ };
179
190
 
180
191
  picocolors.exports = createColors();
181
192
  picocolors.exports.createColors = createColors;
@@ -3463,6 +3474,7 @@ function tryStatSync(file) {
3463
3474
  // Ignore errors
3464
3475
  }
3465
3476
  }
3477
+ const splitRE = /\r?\n/g;
3466
3478
  function isFileReadable(filename) {
3467
3479
  if (!tryStatSync(filename)) {
3468
3480
  return false;
@@ -3594,7 +3606,7 @@ const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
3594
3606
  // The cache needs to be reset on buildStart for watch mode to work correctly
3595
3607
  // Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
3596
3608
  /**
3597
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3609
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3598
3610
  */
3599
3611
  class SplitVendorChunkCache {
3600
3612
  cache;
@@ -3606,7 +3618,7 @@ class SplitVendorChunkCache {
3606
3618
  }
3607
3619
  }
3608
3620
  /**
3609
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3621
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3610
3622
  */
3611
3623
  function splitVendorChunk(options = {}) {
3612
3624
  const cache = options.cache ?? new SplitVendorChunkCache();
@@ -3641,7 +3653,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
3641
3653
  return someImporterIs;
3642
3654
  }
3643
3655
  /**
3644
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3656
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3645
3657
  */
3646
3658
  function splitVendorChunkPlugin() {
3647
3659
  const caches = [];
@@ -5424,6 +5436,7 @@ function getTimeFormatter() {
5424
5436
  });
5425
5437
  return timeFormatter;
5426
5438
  }
5439
+ const MAX_LOG_CHAR = 5000;
5427
5440
  function createLogger(level = 'info', options = {}) {
5428
5441
  if (options.customLogger) {
5429
5442
  return options.customLogger;
@@ -5433,7 +5446,16 @@ function createLogger(level = 'info', options = {}) {
5433
5446
  const thresh = LogLevels[level];
5434
5447
  const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
5435
5448
  const clear = canClearScreen ? clearScreen : () => { };
5436
- function format(type, msg, options = {}) {
5449
+ function preventOverflow(msg) {
5450
+ if (msg.length > MAX_LOG_CHAR) {
5451
+ const shorten = msg.slice(0, MAX_LOG_CHAR);
5452
+ const lines = msg.slice(MAX_LOG_CHAR).match(splitRE)?.length || 0;
5453
+ return `${shorten}\n... and ${lines} lines more`;
5454
+ }
5455
+ return msg;
5456
+ }
5457
+ function format(type, rawMsg, options = {}) {
5458
+ const msg = preventOverflow(rawMsg);
5437
5459
  if (options.timestamp) {
5438
5460
  const color = type === 'info'
5439
5461
  ? colors.cyan
@@ -5598,7 +5620,7 @@ function fsDenyGlob(config, filePath) {
5598
5620
  }
5599
5621
  /**
5600
5622
  * Check if the url is allowed to be served, via the `server.fs` config.
5601
- * @deprecate use isFileLoadingAllowed
5623
+ * @deprecated use isFileLoadingAllowed
5602
5624
  */
5603
5625
  function isFileServingAllowed(url, server) {
5604
5626
  const { config } = server;
@@ -6218,6 +6240,7 @@ exports.esbuildVersion = esbuild.version;
6218
6240
  exports.createFilter = createFilter;
6219
6241
  exports.createLogger = createLogger;
6220
6242
  exports.isCSSRequest = isCSSRequest;
6243
+ exports.isFileLoadingAllowed = isFileLoadingAllowed;
6221
6244
  exports.isFileServingAllowed = isFileServingAllowed;
6222
6245
  exports.loadEnv = loadEnv;
6223
6246
  exports.mergeAlias = mergeAlias;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0-alpha.11",
3
+ "version": "6.0.0-alpha.14",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -95,7 +95,7 @@
95
95
  "@types/pnpapi": "^0.0.5",
96
96
  "acorn": "^8.11.3",
97
97
  "acorn-walk": "^8.3.2",
98
- "artichokie": "^0.2.0",
98
+ "artichokie": "^0.2.1",
99
99
  "cac": "^6.7.14",
100
100
  "chokidar": "^3.6.0",
101
101
  "connect": "^3.7.0",
@@ -106,32 +106,32 @@
106
106
  "dep-types": "link:./src/types",
107
107
  "dotenv": "^16.4.5",
108
108
  "dotenv-expand": "^11.0.6",
109
- "es-module-lexer": "^1.5.2",
109
+ "es-module-lexer": "^1.5.3",
110
110
  "escape-html": "^1.0.3",
111
111
  "estree-walker": "^3.0.3",
112
112
  "etag": "^1.8.1",
113
113
  "fast-glob": "^3.3.2",
114
114
  "http-proxy": "^1.18.1",
115
115
  "launch-editor-middleware": "^2.6.1",
116
- "lightningcss": "^1.24.1",
116
+ "lightningcss": "^1.25.0",
117
117
  "magic-string": "^0.30.10",
118
118
  "micromatch": "^4.0.5",
119
- "mlly": "^1.6.1",
119
+ "mlly": "^1.7.0",
120
120
  "mrmime": "^2.0.0",
121
121
  "open": "^8.4.2",
122
122
  "parse5": "^7.1.2",
123
123
  "pathe": "^1.1.2",
124
124
  "periscopic": "^4.0.2",
125
- "picocolors": "^1.0.0",
125
+ "picocolors": "^1.0.1",
126
126
  "picomatch": "^2.3.1",
127
127
  "postcss-import": "^16.1.0",
128
128
  "postcss-load-config": "^4.0.2",
129
129
  "postcss-modules": "^6.0.0",
130
130
  "resolve.exports": "^2.0.2",
131
- "rollup-plugin-dts": "^6.1.0",
131
+ "rollup-plugin-dts": "^6.1.1",
132
132
  "rollup-plugin-esbuild": "^6.1.1",
133
- "rollup-plugin-license": "^3.3.1",
134
- "sass": "^1.76.0",
133
+ "rollup-plugin-license": "^3.4.0",
134
+ "sass": "^1.77.2",
135
135
  "sirv": "^2.0.4",
136
136
  "source-map-support": "^0.5.21",
137
137
  "strip-ansi": "^7.1.0",