vite 6.0.0-beta.1 → 6.0.0-beta.3
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/LICENSE.md +17 -215
- package/README.md +4 -4
- package/bin/vite.js +4 -0
- package/dist/client/client.mjs +8 -10
- package/dist/node/chunks/dep-CBTZ9M2V.js +7220 -0
- package/dist/node/chunks/{dep-BZ_CwQkz.js → dep-ChZnDG_O.js} +22174 -27804
- package/dist/node/chunks/dep-DHwgfHPT.js +1103 -0
- package/dist/node/chunks/dep-wWOLM6NS.js +593 -0
- package/dist/node/cli.js +10 -12
- package/dist/node/constants.js +7 -2
- package/dist/node/index.d.ts +118 -92
- package/dist/node/index.js +8 -118
- package/dist/node/module-runner.d.ts +75 -53
- package/dist/node/module-runner.js +151 -159
- package/dist/node-cjs/publicUtils.cjs +2869 -2636
- package/index.cjs +1 -1
- package/index.d.cts +1 -1
- package/package.json +17 -17
- package/dist/node/chunks/dep-BZeeNeMJ.js +0 -6843
- package/dist/node/chunks/dep-DiM5uMHt.js +0 -993
- package/dist/node/chunks/dep-IQS-Za7F.js +0 -561
package/dist/node/index.d.ts
CHANGED
@@ -15,7 +15,7 @@ import * as url from 'node:url';
|
|
15
15
|
import { URL } from 'node:url';
|
16
16
|
import * as stream from 'node:stream';
|
17
17
|
import { Duplex, DuplexOptions } from 'node:stream';
|
18
|
-
import {
|
18
|
+
import { FetchFunctionOptions, FetchResult, ModuleRunnerOptions, ModuleRunnerHMRConnection, ModuleRunnerHmr, ModuleEvaluator, ModuleRunner } from 'vite/module-runner';
|
19
19
|
export { FetchFunction, FetchResult } from 'vite/module-runner';
|
20
20
|
import { BuildOptions as esbuild_BuildOptions, TransformOptions as esbuild_TransformOptions, TransformResult as esbuild_TransformResult } from 'esbuild';
|
21
21
|
export { TransformOptions as EsbuildTransformOptions, version as esbuildVersion } from 'esbuild';
|
@@ -619,7 +619,7 @@ interface ProxyOptions extends HttpProxy.ServerOptions {
|
|
619
619
|
*/
|
620
620
|
bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
|
621
621
|
/**
|
622
|
-
* rewrite the Origin header of a WebSocket request to match the
|
622
|
+
* rewrite the Origin header of a WebSocket request to match the target
|
623
623
|
*
|
624
624
|
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
|
625
625
|
*/
|
@@ -822,17 +822,6 @@ declare class UnknownEnvironment extends BaseEnvironment {
|
|
822
822
|
mode: "unknown";
|
823
823
|
}
|
824
824
|
|
825
|
-
interface FetchModuleOptions {
|
826
|
-
cached?: boolean;
|
827
|
-
inlineSourceMap?: boolean;
|
828
|
-
processSourceMap?<T extends NonNullable<TransformResult['map']>>(map: T): T;
|
829
|
-
}
|
830
|
-
/**
|
831
|
-
* Fetch module information for Vite runner.
|
832
|
-
* @experimental
|
833
|
-
*/
|
834
|
-
declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<FetchResult>;
|
835
|
-
|
836
825
|
declare class ScanEnvironment extends BaseEnvironment {
|
837
826
|
mode: "scan";
|
838
827
|
get pluginContainer(): EnvironmentPluginContainer;
|
@@ -1229,7 +1218,7 @@ interface HotChannel {
|
|
1229
1218
|
/**
|
1230
1219
|
* Disconnect all clients, called when server is closed or restarted.
|
1231
1220
|
*/
|
1232
|
-
close(): void;
|
1221
|
+
close(): Promise<unknown> | void;
|
1233
1222
|
}
|
1234
1223
|
/** @deprecated use `HotChannel` instead */
|
1235
1224
|
type HMRChannel = HotChannel;
|
@@ -1267,7 +1256,8 @@ declare class RemoteEnvironmentTransport {
|
|
1267
1256
|
interface DevEnvironmentContext {
|
1268
1257
|
hot: false | HotChannel;
|
1269
1258
|
options?: EnvironmentOptions;
|
1270
|
-
|
1259
|
+
remoteRunner?: {
|
1260
|
+
inlineSourceMap?: boolean;
|
1271
1261
|
transport?: RemoteEnvironmentTransport;
|
1272
1262
|
};
|
1273
1263
|
depsOptimizer?: DepsOptimizer;
|
@@ -1781,15 +1771,81 @@ interface TerserOptions extends Terser.MinifyOptions {
|
|
1781
1771
|
maxWorkers?: number;
|
1782
1772
|
}
|
1783
1773
|
|
1774
|
+
interface FsUtils {
|
1775
|
+
existsSync: (path: string) => boolean;
|
1776
|
+
isDirectory: (path: string) => boolean;
|
1777
|
+
tryResolveRealFile: (path: string, preserveSymlinks?: boolean) => string | undefined;
|
1778
|
+
tryResolveRealFileWithExtensions: (path: string, extensions: string[], preserveSymlinks?: boolean) => string | undefined;
|
1779
|
+
tryResolveRealFileOrType: (path: string, preserveSymlinks?: boolean) => {
|
1780
|
+
path?: string;
|
1781
|
+
type: 'directory' | 'file';
|
1782
|
+
} | undefined;
|
1783
|
+
initWatcher?: (watcher: FSWatcher) => void;
|
1784
|
+
}
|
1785
|
+
|
1786
|
+
interface EnvironmentResolveOptions {
|
1787
|
+
/**
|
1788
|
+
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
1789
|
+
*/
|
1790
|
+
mainFields?: string[];
|
1791
|
+
conditions?: string[];
|
1792
|
+
externalConditions?: string[];
|
1793
|
+
/**
|
1794
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
1795
|
+
*/
|
1796
|
+
extensions?: string[];
|
1797
|
+
dedupe?: string[];
|
1798
|
+
/**
|
1799
|
+
* external/noExternal logic, this only works for certain environments
|
1800
|
+
* Previously this was ssr.external/ssr.noExternal
|
1801
|
+
* TODO: better abstraction that works for the client environment too?
|
1802
|
+
*/
|
1803
|
+
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
1804
|
+
external?: string[] | true;
|
1805
|
+
}
|
1806
|
+
interface ResolveOptions extends EnvironmentResolveOptions {
|
1807
|
+
/**
|
1808
|
+
* @default false
|
1809
|
+
*/
|
1810
|
+
preserveSymlinks?: boolean;
|
1811
|
+
}
|
1812
|
+
interface ResolvePluginOptions {
|
1813
|
+
root: string;
|
1814
|
+
isBuild: boolean;
|
1815
|
+
isProduction: boolean;
|
1816
|
+
packageCache?: PackageCache;
|
1817
|
+
fsUtils?: FsUtils;
|
1818
|
+
/**
|
1819
|
+
* src code mode also attempts the following:
|
1820
|
+
* - resolving /xxx as URLs
|
1821
|
+
* - resolving bare imports from optimized deps
|
1822
|
+
*/
|
1823
|
+
asSrc?: boolean;
|
1824
|
+
tryIndex?: boolean;
|
1825
|
+
tryPrefix?: string;
|
1826
|
+
preferRelative?: boolean;
|
1827
|
+
isRequire?: boolean;
|
1828
|
+
webCompatible?: boolean;
|
1829
|
+
isFromTsImporter?: boolean;
|
1830
|
+
tryEsmOnly?: boolean;
|
1831
|
+
scan?: boolean;
|
1832
|
+
ssrOptimizeCheck?: boolean;
|
1833
|
+
/**
|
1834
|
+
* @deprecated environment.config are used instead
|
1835
|
+
*/
|
1836
|
+
ssrConfig?: SSROptions;
|
1837
|
+
}
|
1838
|
+
interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {
|
1839
|
+
}
|
1840
|
+
type InternalResolveOptionsWithOverrideConditions = InternalResolveOptions & {};
|
1841
|
+
|
1784
1842
|
/** Cache for package.json resolution and package.json contents */
|
1785
1843
|
type PackageCache = Map<string, PackageData>;
|
1786
1844
|
interface PackageData {
|
1787
1845
|
dir: string;
|
1788
1846
|
hasSideEffects: (id: string) => boolean | 'no-treeshake' | null;
|
1789
|
-
|
1790
|
-
|
1791
|
-
setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
|
1792
|
-
getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
|
1847
|
+
setResolvedCache: (key: string, entry: string, options: InternalResolveOptionsWithOverrideConditions) => void;
|
1848
|
+
getResolvedCache: (key: string, options: InternalResolveOptionsWithOverrideConditions) => string | undefined;
|
1793
1849
|
data: {
|
1794
1850
|
[field: string]: any;
|
1795
1851
|
name: string;
|
@@ -2705,7 +2761,9 @@ declare namespace WebSocket {
|
|
2705
2761
|
}
|
2706
2762
|
|
2707
2763
|
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
2764
|
+
declare const isWebSocketServer: unique symbol;
|
2708
2765
|
interface WebSocketServer extends HotChannel {
|
2766
|
+
[isWebSocketServer]: true;
|
2709
2767
|
/**
|
2710
2768
|
* Listen on port and host
|
2711
2769
|
*/
|
@@ -3004,73 +3062,6 @@ type ESBuildTransformResult = Omit<esbuild_TransformResult, 'map'> & {
|
|
3004
3062
|
};
|
3005
3063
|
declare function transformWithEsbuild(code: string, filename: string, options?: esbuild_TransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
|
3006
3064
|
|
3007
|
-
interface FsUtils {
|
3008
|
-
existsSync: (path: string) => boolean;
|
3009
|
-
isDirectory: (path: string) => boolean;
|
3010
|
-
tryResolveRealFile: (path: string, preserveSymlinks?: boolean) => string | undefined;
|
3011
|
-
tryResolveRealFileWithExtensions: (path: string, extensions: string[], preserveSymlinks?: boolean) => string | undefined;
|
3012
|
-
tryResolveRealFileOrType: (path: string, preserveSymlinks?: boolean) => {
|
3013
|
-
path?: string;
|
3014
|
-
type: 'directory' | 'file';
|
3015
|
-
} | undefined;
|
3016
|
-
initWatcher?: (watcher: FSWatcher) => void;
|
3017
|
-
}
|
3018
|
-
|
3019
|
-
interface EnvironmentResolveOptions {
|
3020
|
-
/**
|
3021
|
-
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
3022
|
-
*/
|
3023
|
-
mainFields?: string[];
|
3024
|
-
conditions?: string[];
|
3025
|
-
externalConditions?: string[];
|
3026
|
-
/**
|
3027
|
-
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
3028
|
-
*/
|
3029
|
-
extensions?: string[];
|
3030
|
-
dedupe?: string[];
|
3031
|
-
/**
|
3032
|
-
* external/noExternal logic, this only works for certain environments
|
3033
|
-
* Previously this was ssr.external/ssr.noExternal
|
3034
|
-
* TODO: better abstraction that works for the client environment too?
|
3035
|
-
*/
|
3036
|
-
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
3037
|
-
external?: string[] | true;
|
3038
|
-
}
|
3039
|
-
interface ResolveOptions extends EnvironmentResolveOptions {
|
3040
|
-
/**
|
3041
|
-
* @default false
|
3042
|
-
*/
|
3043
|
-
preserveSymlinks?: boolean;
|
3044
|
-
}
|
3045
|
-
interface ResolvePluginOptions {
|
3046
|
-
root: string;
|
3047
|
-
isBuild: boolean;
|
3048
|
-
isProduction: boolean;
|
3049
|
-
packageCache?: PackageCache;
|
3050
|
-
fsUtils?: FsUtils;
|
3051
|
-
/**
|
3052
|
-
* src code mode also attempts the following:
|
3053
|
-
* - resolving /xxx as URLs
|
3054
|
-
* - resolving bare imports from optimized deps
|
3055
|
-
*/
|
3056
|
-
asSrc?: boolean;
|
3057
|
-
tryIndex?: boolean;
|
3058
|
-
tryPrefix?: string;
|
3059
|
-
preferRelative?: boolean;
|
3060
|
-
isRequire?: boolean;
|
3061
|
-
webCompatible?: boolean;
|
3062
|
-
isFromTsImporter?: boolean;
|
3063
|
-
tryEsmOnly?: boolean;
|
3064
|
-
scan?: boolean;
|
3065
|
-
ssrOptimizeCheck?: boolean;
|
3066
|
-
/**
|
3067
|
-
* @deprecated environment.config are used instead
|
3068
|
-
*/
|
3069
|
-
ssrConfig?: SSROptions;
|
3070
|
-
}
|
3071
|
-
interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {
|
3072
|
-
}
|
3073
|
-
|
3074
3065
|
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
|
3075
3066
|
|
3076
3067
|
interface Targets {
|
@@ -3107,7 +3098,15 @@ interface CSSModulesConfig {
|
|
3107
3098
|
/** The pattern to use when renaming class names and other identifiers. Default is `[hash]_[local]`. */
|
3108
3099
|
pattern?: string,
|
3109
3100
|
/** Whether to rename dashed identifiers, e.g. custom properties. */
|
3110
|
-
dashedIdents?: boolean
|
3101
|
+
dashedIdents?: boolean,
|
3102
|
+
/** Whether to enable hashing for `@keyframes`. */
|
3103
|
+
animation?: boolean,
|
3104
|
+
/** Whether to enable hashing for CSS grid identifiers. */
|
3105
|
+
grid?: boolean,
|
3106
|
+
/** Whether to enable hashing for custom identifiers. */
|
3107
|
+
customIdents?: boolean,
|
3108
|
+
/** Whether to require at least one class or id selector in each rule. */
|
3109
|
+
pure?: boolean
|
3111
3110
|
}
|
3112
3111
|
|
3113
3112
|
/**
|
@@ -3287,7 +3286,7 @@ interface ResolveIdPluginContext extends rollup.PluginContext, PluginContextExte
|
|
3287
3286
|
interface TransformPluginContext extends rollup.TransformPluginContext, PluginContextExtension {
|
3288
3287
|
}
|
3289
3288
|
declare module 'rollup' {
|
3290
|
-
interface
|
3289
|
+
interface MinimalPluginContext extends PluginContextExtension {
|
3291
3290
|
}
|
3292
3291
|
}
|
3293
3292
|
/**
|
@@ -3544,6 +3543,8 @@ type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFnObject |
|
|
3544
3543
|
declare function defineConfig(config: UserConfig): UserConfig;
|
3545
3544
|
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
3546
3545
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
3546
|
+
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
3547
|
+
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
3547
3548
|
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
3548
3549
|
interface CreateDevEnvironmentContext {
|
3549
3550
|
ws: WebSocketServer;
|
@@ -3933,8 +3934,6 @@ declare function createIdResolver(config: ResolvedConfig, options?: Partial<Inte
|
|
3933
3934
|
|
3934
3935
|
declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
3935
3936
|
|
3936
|
-
declare function createNodeDevEnvironment(name: string, config: ResolvedConfig, context: DevEnvironmentContext): DevEnvironment;
|
3937
|
-
|
3938
3937
|
/**
|
3939
3938
|
* @experimental
|
3940
3939
|
*/
|
@@ -3957,6 +3956,33 @@ interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, 'root' | '
|
|
3957
3956
|
*/
|
3958
3957
|
declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
|
3959
3958
|
|
3959
|
+
declare function createRunnableDevEnvironment(name: string, config: ResolvedConfig, context?: RunnableDevEnvironmentContext): DevEnvironment;
|
3960
|
+
interface RunnableDevEnvironmentContext extends Omit<DevEnvironmentContext, 'hot'> {
|
3961
|
+
runner?: (environment: RunnableDevEnvironment, options?: ServerModuleRunnerOptions) => ModuleRunner;
|
3962
|
+
runnerOptions?: ServerModuleRunnerOptions;
|
3963
|
+
hot?: false | HotChannel;
|
3964
|
+
}
|
3965
|
+
declare function isRunnableDevEnvironment(environment: Environment): environment is RunnableDevEnvironment;
|
3966
|
+
declare class RunnableDevEnvironment extends DevEnvironment {
|
3967
|
+
private _runner;
|
3968
|
+
private _runnerFactory;
|
3969
|
+
private _runnerOptions;
|
3970
|
+
constructor(name: string, config: ResolvedConfig, context: RunnableDevEnvironmentContext);
|
3971
|
+
get runner(): ModuleRunner;
|
3972
|
+
close(): Promise<void>;
|
3973
|
+
}
|
3974
|
+
|
3975
|
+
interface FetchModuleOptions {
|
3976
|
+
cached?: boolean;
|
3977
|
+
inlineSourceMap?: boolean;
|
3978
|
+
startOffset?: number;
|
3979
|
+
}
|
3980
|
+
/**
|
3981
|
+
* Fetch module information for Vite runner.
|
3982
|
+
* @experimental
|
3983
|
+
*/
|
3984
|
+
declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<FetchResult>;
|
3985
|
+
|
3960
3986
|
/**
|
3961
3987
|
* The connector class to establish HMR communication between the server and the Vite runtime.
|
3962
3988
|
* @experimental
|
@@ -3968,7 +3994,7 @@ declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
|
|
3968
3994
|
private connected;
|
3969
3995
|
constructor(hotChannel: ServerHotChannel);
|
3970
3996
|
isReady(): boolean;
|
3971
|
-
send(
|
3997
|
+
send(payload_: HotPayload): void;
|
3972
3998
|
onUpdate(handler: (payload: HotPayload) => void): void;
|
3973
3999
|
}
|
3974
4000
|
|
@@ -4056,4 +4082,4 @@ interface ManifestChunk {
|
|
4056
4082
|
dynamicImports?: string[];
|
4057
4083
|
}
|
4058
4084
|
|
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 EnvironmentOptions, 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,
|
4085
|
+
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 EnvironmentOptions, 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, RunnableDevEnvironment, type RunnableDevEnvironmentContext, 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, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, 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,10 +1,9 @@
|
|
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, b as build, j as buildErrorMessage, e as createBuilder,
|
4
|
-
import { existsSync, readFileSync } from 'node:fs';
|
5
|
-
import { ModuleRunner, ESModulesEvaluator } from 'vite/module-runner';
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-ChZnDG_O.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, z as createFilter, f as createIdResolver, E as createLogger, k as createRunnableDevEnvironment, c as createServer, u as createServerHotChannel, q as createServerModuleRunner, d as defineConfig, n as fetchModule, g as formatPostcssSourceMap, H as isFileLoadingAllowed, G as isFileServingAllowed, m as isRunnableDevEnvironment, l as loadConfigFromFile, I as loadEnv, y as mergeAlias, x as mergeConfig, v as moduleRunnerTransform, w as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, J as resolveEnvPrefix, A as rollupVersion, F as searchForWorkspaceRoot, C as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ChZnDG_O.js';
|
6
4
|
export { VERSION as version } from './constants.js';
|
7
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
|
+
import 'node:fs';
|
8
7
|
import 'node:fs/promises';
|
9
8
|
import 'node:path';
|
10
9
|
import 'node:url';
|
@@ -14,9 +13,6 @@ import 'node:module';
|
|
14
13
|
import 'tty';
|
15
14
|
import 'path';
|
16
15
|
import 'fs';
|
17
|
-
import 'node:events';
|
18
|
-
import 'node:stream';
|
19
|
-
import 'node:string_decoder';
|
20
16
|
import 'node:child_process';
|
21
17
|
import 'node:http';
|
22
18
|
import 'node:https';
|
@@ -31,13 +27,15 @@ import 'child_process';
|
|
31
27
|
import 'node:os';
|
32
28
|
import 'node:crypto';
|
33
29
|
import 'node:dns';
|
30
|
+
import 'vite/module-runner';
|
31
|
+
import 'node:readline';
|
32
|
+
import 'node:events';
|
33
|
+
import 'crypto';
|
34
34
|
import 'module';
|
35
35
|
import 'node:assert';
|
36
36
|
import 'node:v8';
|
37
37
|
import 'node:worker_threads';
|
38
|
-
import 'crypto';
|
39
38
|
import 'node:buffer';
|
40
|
-
import 'node:readline';
|
41
39
|
import 'zlib';
|
42
40
|
import 'buffer';
|
43
41
|
import 'https';
|
@@ -181,112 +179,4 @@ class RemoteEnvironmentTransport {
|
|
181
179
|
}
|
182
180
|
}
|
183
181
|
|
184
|
-
|
185
|
-
constructor(hotChannel) {
|
186
|
-
this.hotChannel = hotChannel;
|
187
|
-
}
|
188
|
-
send(...args) {
|
189
|
-
let payload;
|
190
|
-
if (typeof args[0] === "string") {
|
191
|
-
payload = {
|
192
|
-
type: "custom",
|
193
|
-
event: args[0],
|
194
|
-
data: args[1]
|
195
|
-
};
|
196
|
-
} else {
|
197
|
-
payload = args[0];
|
198
|
-
}
|
199
|
-
if (payload.type !== "custom") {
|
200
|
-
throw new Error(
|
201
|
-
"Cannot send non-custom events from the client to the server."
|
202
|
-
);
|
203
|
-
}
|
204
|
-
this.hotChannel.send(payload);
|
205
|
-
}
|
206
|
-
}
|
207
|
-
class ServerHMRConnector {
|
208
|
-
constructor(hotChannel) {
|
209
|
-
this.hotChannel = hotChannel;
|
210
|
-
this.hmrClient = new ServerHMRBroadcasterClient(hotChannel);
|
211
|
-
hotChannel.api.outsideEmitter.on("send", (payload) => {
|
212
|
-
this.handlers.forEach((listener) => listener(payload));
|
213
|
-
});
|
214
|
-
this.hotChannel = hotChannel;
|
215
|
-
}
|
216
|
-
handlers = [];
|
217
|
-
hmrClient;
|
218
|
-
connected = false;
|
219
|
-
isReady() {
|
220
|
-
return this.connected;
|
221
|
-
}
|
222
|
-
send(message) {
|
223
|
-
const payload = JSON.parse(message);
|
224
|
-
this.hotChannel.api.innerEmitter.emit(
|
225
|
-
payload.event,
|
226
|
-
payload.data,
|
227
|
-
this.hmrClient
|
228
|
-
);
|
229
|
-
}
|
230
|
-
onUpdate(handler) {
|
231
|
-
this.handlers.push(handler);
|
232
|
-
handler({ type: "connected" });
|
233
|
-
this.connected = true;
|
234
|
-
}
|
235
|
-
}
|
236
|
-
|
237
|
-
function createHMROptions(environment, options) {
|
238
|
-
if (environment.config.server.hmr === false || options.hmr === false) {
|
239
|
-
return false;
|
240
|
-
}
|
241
|
-
if (options.hmr?.connection) {
|
242
|
-
return {
|
243
|
-
connection: options.hmr.connection,
|
244
|
-
logger: options.hmr.logger
|
245
|
-
};
|
246
|
-
}
|
247
|
-
if (!("api" in environment.hot)) return false;
|
248
|
-
const connection = new ServerHMRConnector(environment.hot);
|
249
|
-
return {
|
250
|
-
connection,
|
251
|
-
logger: options.hmr?.logger
|
252
|
-
};
|
253
|
-
}
|
254
|
-
const prepareStackTrace = {
|
255
|
-
retrieveFile(id) {
|
256
|
-
if (existsSync(id)) {
|
257
|
-
return readFileSync(id, "utf-8");
|
258
|
-
}
|
259
|
-
}
|
260
|
-
};
|
261
|
-
function resolveSourceMapOptions(options) {
|
262
|
-
if (options.sourcemapInterceptor != null) {
|
263
|
-
if (options.sourcemapInterceptor === "prepareStackTrace") {
|
264
|
-
return prepareStackTrace;
|
265
|
-
}
|
266
|
-
if (typeof options.sourcemapInterceptor === "object") {
|
267
|
-
return { ...prepareStackTrace, ...options.sourcemapInterceptor };
|
268
|
-
}
|
269
|
-
return options.sourcemapInterceptor;
|
270
|
-
}
|
271
|
-
if (typeof process !== "undefined" && "setSourceMapsEnabled" in process) {
|
272
|
-
return "node";
|
273
|
-
}
|
274
|
-
return prepareStackTrace;
|
275
|
-
}
|
276
|
-
function createServerModuleRunner(environment, options = {}) {
|
277
|
-
const hmr = createHMROptions(environment, options);
|
278
|
-
return new ModuleRunner(
|
279
|
-
{
|
280
|
-
...options,
|
281
|
-
root: environment.config.root,
|
282
|
-
transport: {
|
283
|
-
fetchModule: (id, importer, options2) => environment.fetchModule(id, importer, options2)
|
284
|
-
},
|
285
|
-
hmr,
|
286
|
-
sourcemapInterceptor: resolveSourceMapOptions(options)
|
287
|
-
},
|
288
|
-
options.evaluator || new ESModulesEvaluator()
|
289
|
-
);
|
290
|
-
}
|
291
|
-
|
292
|
-
export { RemoteEnvironmentTransport, ServerHMRConnector, createServerModuleRunner, isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };
|
182
|
+
export { RemoteEnvironmentTransport, isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };
|