vite 6.0.0-alpha.22 → 6.0.0-alpha.24
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/chunks/{dep-1C5gbBiU.js → dep-ByEd0NXO.js} +329 -353
- package/dist/node/chunks/{dep-BzHfSPcV.js → dep-hyosMzMD.js} +1 -1
- package/dist/node/chunks/{dep-DGaPvi2R.js → dep-yUJ1DpJ5.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +46 -47
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +2 -3
- package/dist/node/module-runner.js +12 -20
- package/dist/node-cjs/publicUtils.cjs +3 -2
- package/index.cjs +27 -2
- package/package.json +4 -4
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { L as commonjsGlobal, K as getDefaultExportFromCjs } from './dep-ByEd0NXO.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
package/dist/node/cli.js
CHANGED
@@ -2,15 +2,15 @@ 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 {
|
5
|
+
import { J as colors, C as createLogger, r as resolveConfig } from './chunks/dep-ByEd0NXO.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
9
9
|
import 'node:util';
|
10
10
|
import 'node:module';
|
11
11
|
import 'tty';
|
12
|
-
import 'path';
|
13
12
|
import 'esbuild';
|
13
|
+
import 'path';
|
14
14
|
import 'fs';
|
15
15
|
import 'node:events';
|
16
16
|
import 'node:stream';
|
@@ -736,7 +736,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
736
736
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
737
737
|
).action(async (root, options) => {
|
738
738
|
filterDuplicateOptions(options);
|
739
|
-
const { createServer } = await import('./chunks/dep-
|
739
|
+
const { createServer } = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.N; });
|
740
740
|
try {
|
741
741
|
const server = await createServer({
|
742
742
|
root,
|
@@ -829,7 +829,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
829
829
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as builder.entireApp`).action(
|
830
830
|
async (root, options) => {
|
831
831
|
filterDuplicateOptions(options);
|
832
|
-
const build = await import('./chunks/dep-
|
832
|
+
const build = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.O; });
|
833
833
|
const buildOptions = cleanGlobalCLIOptions(
|
834
834
|
cleanBuilderCLIOptions(options)
|
835
835
|
);
|
@@ -884,7 +884,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
|
|
884
884
|
).action(
|
885
885
|
async (root, options) => {
|
886
886
|
filterDuplicateOptions(options);
|
887
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
887
|
+
const { optimizeDeps } = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.M; });
|
888
888
|
try {
|
889
889
|
const config = await resolveConfig(
|
890
890
|
{
|
@@ -910,7 +910,7 @@ ${e.stack}`),
|
|
910
910
|
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(
|
911
911
|
async (root, options) => {
|
912
912
|
filterDuplicateOptions(options);
|
913
|
-
const { preview } = await import('./chunks/dep-
|
913
|
+
const { preview } = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.P; });
|
914
914
|
try {
|
915
915
|
const server = await preview({
|
916
916
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -807,11 +807,19 @@ declare class BaseEnvironment extends PartialEnvironment {
|
|
807
807
|
constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
808
808
|
}
|
809
809
|
/**
|
810
|
-
* This
|
811
|
-
*
|
810
|
+
* This class discourages users from inversely checking the `mode`
|
811
|
+
* to determine the type of environment, e.g.
|
812
|
+
*
|
813
|
+
* ```js
|
814
|
+
* const isDev = environment.mode !== 'build' // bad
|
815
|
+
* const isDev = environment.mode === 'dev' // good
|
816
|
+
* ```
|
817
|
+
*
|
818
|
+
* You should also not check against `"unknown"` specfically. It's
|
819
|
+
* a placeholder for more possible environment types.
|
812
820
|
*/
|
813
|
-
declare class
|
814
|
-
mode: "
|
821
|
+
declare class UnknownEnvironment extends BaseEnvironment {
|
822
|
+
mode: "unknown";
|
815
823
|
}
|
816
824
|
|
817
825
|
interface FetchModuleOptions {
|
@@ -1233,6 +1241,7 @@ interface ServerHotChannel extends HotChannel {
|
|
1233
1241
|
}
|
1234
1242
|
/** @deprecated use `ServerHotChannel` instead */
|
1235
1243
|
type ServerHMRChannel = ServerHotChannel;
|
1244
|
+
declare function createServerHotChannel(): ServerHotChannel;
|
1236
1245
|
/** @deprecated use `environment.hot` instead */
|
1237
1246
|
interface HotBroadcaster extends HotChannel {
|
1238
1247
|
readonly channels: HotChannel[];
|
@@ -1281,6 +1290,7 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
1281
1290
|
watcher?: FSWatcher;
|
1282
1291
|
}): Promise<void>;
|
1283
1292
|
fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<FetchResult>;
|
1293
|
+
reloadModule(module: EnvironmentModuleNode): Promise<void>;
|
1284
1294
|
transformRequest(url: string): Promise<TransformResult | null>;
|
1285
1295
|
warmupRequest(url: string): Promise<void>;
|
1286
1296
|
close(): Promise<void>;
|
@@ -2078,7 +2088,7 @@ type ResolvedBuilderOptions = Required<BuilderOptions>;
|
|
2078
2088
|
*/
|
2079
2089
|
declare function createBuilder(inlineConfig?: InlineConfig): Promise<ViteBuilder>;
|
2080
2090
|
|
2081
|
-
type Environment = DevEnvironment | BuildEnvironment |
|
2091
|
+
type Environment = DevEnvironment | BuildEnvironment | UnknownEnvironment;
|
2082
2092
|
|
2083
2093
|
declare class EnvironmentPluginContainer {
|
2084
2094
|
environment: Environment;
|
@@ -2095,9 +2105,11 @@ declare class EnvironmentPluginContainer {
|
|
2095
2105
|
watchFiles: Set<string>;
|
2096
2106
|
minimalContext: MinimalPluginContext;
|
2097
2107
|
private _started;
|
2108
|
+
private _buildStartPromise;
|
2098
2109
|
private _closed;
|
2099
2110
|
private _updateModuleLoadAddedImports;
|
2100
2111
|
private _getAddedImports;
|
2112
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
2101
2113
|
private handleHookPromise;
|
2102
2114
|
get options(): InputOptions;
|
2103
2115
|
resolveRollupOptions(): Promise<InputOptions>;
|
@@ -2129,6 +2141,7 @@ declare class PluginContainer {
|
|
2129
2141
|
constructor(environments: Record<string, Environment>);
|
2130
2142
|
private _getEnvironment;
|
2131
2143
|
private _getPluginContainer;
|
2144
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
2132
2145
|
get options(): InputOptions;
|
2133
2146
|
buildStart(_options?: InputOptions): Promise<void>;
|
2134
2147
|
watchChange(id: string, change: {
|
@@ -2886,7 +2899,7 @@ interface ViteDevServer {
|
|
2886
2899
|
/**
|
2887
2900
|
* Module execution environments attached to the Vite server.
|
2888
2901
|
*/
|
2889
|
-
environments: Record<'client' | 'ssr' | (string &
|
2902
|
+
environments: Record<'client' | 'ssr' | (string & {}), DevEnvironment>;
|
2890
2903
|
/**
|
2891
2904
|
* Module graph that tracks the import relationships, url to file mapping
|
2892
2905
|
* and hmr state.
|
@@ -2937,11 +2950,6 @@ interface ViteDevServer {
|
|
2937
2950
|
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
|
2938
2951
|
*/
|
2939
2952
|
reloadModule(module: ModuleNode): Promise<void>;
|
2940
|
-
/**
|
2941
|
-
* Triggers HMR for an environment module in the module graph.
|
2942
|
-
* If `hmr` is false, this is a no-op.
|
2943
|
-
*/
|
2944
|
-
reloadEnvironmentModule(module: EnvironmentModuleNode): Promise<void>;
|
2945
2953
|
/**
|
2946
2954
|
* Start the server.
|
2947
2955
|
*/
|
@@ -3008,7 +3016,7 @@ interface FsUtils {
|
|
3008
3016
|
initWatcher?: (watcher: FSWatcher) => void;
|
3009
3017
|
}
|
3010
3018
|
|
3011
|
-
interface
|
3019
|
+
interface EnvironmentResolveOptions {
|
3012
3020
|
/**
|
3013
3021
|
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
3014
3022
|
*/
|
@@ -3020,10 +3028,6 @@ interface ResolveOptions {
|
|
3020
3028
|
*/
|
3021
3029
|
extensions?: string[];
|
3022
3030
|
dedupe?: string[];
|
3023
|
-
/**
|
3024
|
-
* @default false
|
3025
|
-
*/
|
3026
|
-
preserveSymlinks?: boolean;
|
3027
3031
|
/**
|
3028
3032
|
* external/noExternal logic, this only works for certain environments
|
3029
3033
|
* Previously this was ssr.external/ssr.noExternal
|
@@ -3032,6 +3036,12 @@ interface ResolveOptions {
|
|
3032
3036
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
3033
3037
|
external?: string[] | true;
|
3034
3038
|
}
|
3039
|
+
interface ResolveOptions extends EnvironmentResolveOptions {
|
3040
|
+
/**
|
3041
|
+
* @default false
|
3042
|
+
*/
|
3043
|
+
preserveSymlinks?: boolean;
|
3044
|
+
}
|
3035
3045
|
interface ResolvePluginOptions {
|
3036
3046
|
root: string;
|
3037
3047
|
isBuild: boolean;
|
@@ -3504,15 +3514,6 @@ interface ResolvedSSROptions extends SSROptions {
|
|
3504
3514
|
optimizeDeps: SsrDepOptimizationConfig;
|
3505
3515
|
}
|
3506
3516
|
|
3507
|
-
interface FutureDeprecationWarningsOptions {
|
3508
|
-
pluginHookHandleHotUpdate?: boolean;
|
3509
|
-
pluginHookSsrArgument?: boolean;
|
3510
|
-
serverModuleGraph?: boolean;
|
3511
|
-
serverHot?: boolean;
|
3512
|
-
serverTransformRequest?: boolean;
|
3513
|
-
ssrLoadModule?: boolean;
|
3514
|
-
}
|
3515
|
-
|
3516
3517
|
interface ConfigEnv {
|
3517
3518
|
/**
|
3518
3519
|
* 'serve': during dev (`vite` command)
|
@@ -3598,7 +3599,7 @@ interface DevEnvironmentOptions {
|
|
3598
3599
|
moduleRunnerTransform?: boolean;
|
3599
3600
|
}
|
3600
3601
|
type ResolvedDevEnvironmentOptions = Required<DevEnvironmentOptions>;
|
3601
|
-
type
|
3602
|
+
type AllResolveOptions = ResolveOptions & {
|
3602
3603
|
alias?: AliasOptions;
|
3603
3604
|
};
|
3604
3605
|
interface SharedEnvironmentOptions {
|
@@ -3621,13 +3622,6 @@ interface SharedEnvironmentOptions {
|
|
3621
3622
|
* Temporal options, we should remove these in favor of fine-grained control
|
3622
3623
|
*/
|
3623
3624
|
webCompatible?: boolean;
|
3624
|
-
/**
|
3625
|
-
* Should Vite inject timestamp if module is invalidated
|
3626
|
-
* Disabling this will break built-in HMR support
|
3627
|
-
* @experimental
|
3628
|
-
* @default true
|
3629
|
-
*/
|
3630
|
-
injectInvalidationTimestamp?: boolean;
|
3631
3625
|
}
|
3632
3626
|
interface EnvironmentOptions extends SharedEnvironmentOptions {
|
3633
3627
|
/**
|
@@ -3639,18 +3633,17 @@ interface EnvironmentOptions extends SharedEnvironmentOptions {
|
|
3639
3633
|
*/
|
3640
3634
|
build?: BuildEnvironmentOptions;
|
3641
3635
|
}
|
3642
|
-
type
|
3636
|
+
type ResolvedResolveOptions = Required<ResolveOptions>;
|
3643
3637
|
type ResolvedEnvironmentOptions = {
|
3644
3638
|
define?: Record<string, any>;
|
3645
|
-
resolve:
|
3639
|
+
resolve: ResolvedResolveOptions;
|
3646
3640
|
consumer: 'client' | 'server';
|
3647
3641
|
webCompatible: boolean;
|
3648
|
-
injectInvalidationTimestamp: boolean;
|
3649
3642
|
dev: ResolvedDevEnvironmentOptions;
|
3650
3643
|
build: ResolvedBuildEnvironmentOptions;
|
3651
3644
|
};
|
3652
|
-
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, '
|
3653
|
-
|
3645
|
+
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'consumer' | 'webCompatible' | 'resolve'> & {
|
3646
|
+
resolve?: AllResolveOptions;
|
3654
3647
|
};
|
3655
3648
|
interface UserConfig extends DefaultEnvironmentOptions {
|
3656
3649
|
/**
|
@@ -3819,12 +3812,12 @@ interface HTMLOptions {
|
|
3819
3812
|
cspNonce?: string;
|
3820
3813
|
}
|
3821
3814
|
interface FutureOptions {
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3815
|
+
removePluginHookHandleHotUpdate?: 'warn';
|
3816
|
+
removePluginHookSsrArgument?: 'warn';
|
3817
|
+
removeServerModuleGraph?: 'warn';
|
3818
|
+
removeServerHot?: 'warn';
|
3819
|
+
removeServerTransformRequest?: 'warn';
|
3820
|
+
removeSsrLoadModule?: 'warn';
|
3828
3821
|
}
|
3829
3822
|
interface ExperimentalOptions {
|
3830
3823
|
/**
|
@@ -3921,7 +3914,9 @@ interface PluginHookUtils {
|
|
3921
3914
|
getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
|
3922
3915
|
}
|
3923
3916
|
type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
3924
|
-
declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean,
|
3917
|
+
declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean,
|
3918
|
+
|
3919
|
+
): Promise<ResolvedConfig>;
|
3925
3920
|
declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
3926
3921
|
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
|
3927
3922
|
path: string;
|
@@ -3934,7 +3929,7 @@ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: stri
|
|
3934
3929
|
* Create an internal resolver to be used in special scenarios, e.g.
|
3935
3930
|
* optimizer and handling css @imports
|
3936
3931
|
*/
|
3937
|
-
declare function createIdResolver(config: ResolvedConfig, options
|
3932
|
+
declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
|
3938
3933
|
|
3939
3934
|
declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
3940
3935
|
|
@@ -4038,6 +4033,10 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
4038
4033
|
/**
|
4039
4034
|
* Check if the url is allowed to be served, via the `server.fs` config.
|
4040
4035
|
*/
|
4036
|
+
declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
|
4037
|
+
/**
|
4038
|
+
* @deprecated Use the `isFileServingAllowed(config, url)` signature instead.
|
4039
|
+
*/
|
4041
4040
|
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
4042
4041
|
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
4043
4042
|
|
@@ -4057,4 +4056,4 @@ interface ManifestChunk {
|
|
4057
4056
|
dynamicImports?: string[];
|
4058
4057
|
}
|
4059
4058
|
|
4060
|
-
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 DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, 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 HotChannel, type HotChannelClient, type HotUpdateOptions, type HtmlTagDescriptor, HttpProxy, type HttpServer, 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, 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 ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, 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, createIdResolver, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
4059
|
+
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 DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, 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 HotChannel, type HotChannelClient, type HotUpdateOptions, type HtmlTagDescriptor, HttpProxy, type HttpServer, 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, 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 ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, 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, createIdResolver, createLogger, createNodeDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, a as arraify } from './chunks/dep-
|
3
|
-
export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder,
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-ByEd0NXO.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, y as createFilter, f as createIdResolver, C as createLogger, k as createNodeDevEnvironment, c as createServer, q as createServerHotChannel, n as createServerModuleRunner, d as defineConfig, m as fetchModule, g as formatPostcssSourceMap, G as isFileLoadingAllowed, F as isFileServingAllowed, l as loadConfigFromFile, H as loadEnv, x as mergeAlias, w as mergeConfig, u as moduleRunnerTransform, v as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, I as resolveEnvPrefix, z as rollupVersion, E as searchForWorkspaceRoot, A as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ByEd0NXO.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import 'node:fs';
|
@@ -94,7 +94,7 @@ interface DefineImportMetadata {
|
|
94
94
|
*/
|
95
95
|
importedNames?: string[];
|
96
96
|
}
|
97
|
-
interface
|
97
|
+
interface SSRImportMetadata extends DefineImportMetadata {
|
98
98
|
isDynamicImport?: boolean;
|
99
99
|
}
|
100
100
|
|
@@ -143,7 +143,6 @@ declare class ModuleRunner {
|
|
143
143
|
* Returns `true` if the runtime has been destroyed by calling `destroy()` method.
|
144
144
|
*/
|
145
145
|
isDestroyed(): boolean;
|
146
|
-
private normalizeEntryUrl;
|
147
146
|
private processImport;
|
148
147
|
private isCircularModule;
|
149
148
|
private isCircularImport;
|
@@ -348,4 +347,4 @@ declare class ESModulesEvaluator implements ModuleEvaluator {
|
|
348
347
|
runExternalModule(filepath: string): Promise<any>;
|
349
348
|
}
|
350
349
|
|
351
|
-
export { ESModulesEvaluator, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRConnection, type HMRLogger, type ModuleCache, ModuleCacheMap, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHMRConnection, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, RemoteRunnerTransport, type ResolvedResult, type RunnerTransport, type
|
350
|
+
export { ESModulesEvaluator, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRConnection, type HMRLogger, type ModuleCache, ModuleCacheMap, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHMRConnection, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, RemoteRunnerTransport, type ResolvedResult, type RunnerTransport, type SSRImportMetadata, ssrDynamicImportKey, ssrExportAllKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
|
@@ -2,9 +2,6 @@ const VALID_ID_PREFIX = "/@id/", NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
2
2
|
let SOURCEMAPPING_URL = "sourceMa";
|
3
3
|
SOURCEMAPPING_URL += "ppingURL";
|
4
4
|
const isWindows = typeof process < "u" && process.platform === "win32";
|
5
|
-
function wrapId(id) {
|
6
|
-
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
7
|
-
}
|
8
5
|
function unwrapId(id) {
|
9
6
|
return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
|
10
7
|
}
|
@@ -881,7 +878,6 @@ class ModuleRunner {
|
|
881
878
|
* URL to execute. Accepts file path, server path or id relative to the root.
|
882
879
|
*/
|
883
880
|
async import(url) {
|
884
|
-
url = this.normalizeEntryUrl(url);
|
885
881
|
const fetchedModule = await this.cachedModule(url);
|
886
882
|
return await this.cachedRequest(url, fetchedModule);
|
887
883
|
}
|
@@ -904,12 +900,6 @@ class ModuleRunner {
|
|
904
900
|
isDestroyed() {
|
905
901
|
return this.destroyed;
|
906
902
|
}
|
907
|
-
// we don't use moduleCache.normalize because this URL doesn't have to follow the same rules
|
908
|
-
// this URL is something that user passes down manually, and is later resolved by fetchModule
|
909
|
-
// moduleCache.normalize is used on resolved "file" property
|
910
|
-
normalizeEntryUrl(url) {
|
911
|
-
return url[0] === "." ? url : (url = normalizeAbsoluteUrl(url, this.root), url[0] === "/" ? url : wrapId(url));
|
912
|
-
}
|
913
903
|
processImport(exports, fetchResult, metadata) {
|
914
904
|
if (!("externalize" in fetchResult))
|
915
905
|
return exports;
|
@@ -960,19 +950,21 @@ ${getStack()}`
|
|
960
950
|
}
|
961
951
|
}
|
962
952
|
async cachedModule(url, importer) {
|
963
|
-
|
964
|
-
let cached = this.moduleInfoCache.get(cacheKey);
|
965
|
-
return cached || (cached = this.getModuleInformation(url, importer).finally(() => {
|
966
|
-
this.moduleInfoCache.delete(cacheKey);
|
967
|
-
}), this.moduleInfoCache.set(cacheKey, cached)), cached;
|
968
|
-
}
|
969
|
-
async getModuleInformation(url, importer) {
|
970
|
-
if (this.destroyed)
|
971
|
-
throw new Error("Vite module runner has been destroyed.");
|
972
|
-
this.debug?.("[module runner] fetching", url), url = normalizeAbsoluteUrl(url, this.root);
|
953
|
+
url = normalizeAbsoluteUrl(url, this.root);
|
973
954
|
const normalized = this.urlToIdMap.get(url);
|
974
955
|
let cachedModule = normalized && this.moduleCache.getByModuleId(normalized);
|
975
956
|
cachedModule || (cachedModule = this.moduleCache.getByModuleId(url));
|
957
|
+
let cached = this.moduleInfoCache.get(url);
|
958
|
+
return cached ? this.debug?.("[module runner] using cached module info for", url) : (cached = this.getModuleInformation(url, importer, cachedModule).finally(
|
959
|
+
() => {
|
960
|
+
this.moduleInfoCache.delete(url);
|
961
|
+
}
|
962
|
+
), this.moduleInfoCache.set(url, cached)), cached;
|
963
|
+
}
|
964
|
+
async getModuleInformation(url, importer, cachedModule) {
|
965
|
+
if (this.destroyed)
|
966
|
+
throw new Error("Vite module runner has been destroyed.");
|
967
|
+
this.debug?.("[module runner] fetching", url);
|
976
968
|
const isCached = !!(typeof cachedModule == "object" && cachedModule.meta), fetchedModule = (
|
977
969
|
// fast return for established externalized pattern
|
978
970
|
url.startsWith("data:") ? { externalize: url, type: "builtin" } : await this.transport.fetchModule(url, importer, {
|
@@ -5542,8 +5542,9 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
5542
5542
|
return searchForWorkspaceRoot(dir, root);
|
5543
5543
|
}
|
5544
5544
|
|
5545
|
-
function isFileServingAllowed(
|
5546
|
-
const
|
5545
|
+
function isFileServingAllowed(configOrUrl, urlOrServer) {
|
5546
|
+
const config = typeof urlOrServer === "string" ? configOrUrl : urlOrServer.config;
|
5547
|
+
const url = typeof urlOrServer === "string" ? urlOrServer : configOrUrl;
|
5547
5548
|
if (!config.server.fs.strict) return true;
|
5548
5549
|
const filePath = fsPathFromUrl(url);
|
5549
5550
|
return isFileLoadingAllowed(config, filePath);
|
package/index.cjs
CHANGED
@@ -25,11 +25,36 @@ asyncFunctions.forEach((name) => {
|
|
25
25
|
|
26
26
|
function warnCjsUsage() {
|
27
27
|
if (process.env.VITE_CJS_IGNORE_WARNING) return
|
28
|
+
const logLevelIndex = process.argv.findIndex((arg) =>
|
29
|
+
/^(?:-l|--logLevel)/.test(arg),
|
30
|
+
)
|
31
|
+
if (logLevelIndex > 0) {
|
32
|
+
const logLevelValue = process.argv[logLevelIndex + 1]
|
33
|
+
if (logLevelValue === 'silent' || logLevelValue === 'error') {
|
34
|
+
return
|
35
|
+
}
|
36
|
+
if (/silent|error/.test(process.argv[logLevelIndex])) {
|
37
|
+
return
|
38
|
+
}
|
39
|
+
}
|
28
40
|
const yellow = (str) => `\u001b[33m${str}\u001b[39m`
|
29
|
-
|
30
|
-
log(
|
41
|
+
console.warn(
|
31
42
|
yellow(
|
32
43
|
`The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
|
33
44
|
),
|
34
45
|
)
|
46
|
+
if (process.env.VITE_CJS_TRACE) {
|
47
|
+
const e = {}
|
48
|
+
const stackTraceLimit = Error.stackTraceLimit
|
49
|
+
Error.stackTraceLimit = 100
|
50
|
+
Error.captureStackTrace(e)
|
51
|
+
Error.stackTraceLimit = stackTraceLimit
|
52
|
+
console.log(
|
53
|
+
e.stack
|
54
|
+
.split('\n')
|
55
|
+
.slice(1)
|
56
|
+
.filter((line) => !line.includes('(node:'))
|
57
|
+
.join('\n'),
|
58
|
+
)
|
59
|
+
}
|
35
60
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "6.0.0-alpha.
|
3
|
+
"version": "6.0.0-alpha.24",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -73,7 +73,7 @@
|
|
73
73
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
74
74
|
"dependencies": {
|
75
75
|
"esbuild": "^0.21.3",
|
76
|
-
"postcss": "^8.4.
|
76
|
+
"postcss": "^8.4.43",
|
77
77
|
"rollup": "^4.20.0"
|
78
78
|
},
|
79
79
|
"optionalDependencies": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
},
|
82
82
|
"devDependencies": {
|
83
83
|
"@ampproject/remapping": "^2.3.0",
|
84
|
-
"@babel/parser": "^7.25.
|
84
|
+
"@babel/parser": "^7.25.6",
|
85
85
|
"@jridgewell/trace-mapping": "^0.3.25",
|
86
86
|
"@polka/compression": "^1.0.0-next.25",
|
87
87
|
"@rollup/plugin-alias": "^5.1.0",
|
@@ -135,7 +135,7 @@
|
|
135
135
|
"source-map-support": "^0.5.21",
|
136
136
|
"strip-ansi": "^7.1.0",
|
137
137
|
"strip-literal": "^2.1.0",
|
138
|
-
"tsconfck": "^3.1.
|
138
|
+
"tsconfck": "^3.1.3",
|
139
139
|
"tslib": "^2.7.0",
|
140
140
|
"types": "link:./types",
|
141
141
|
"ufo": "^1.5.4",
|