vite 6.0.0-alpha.16 → 6.0.0-alpha.17
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/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-C1KLoAiP.js → dep-CNsiFGD3.js} +1 -1
- package/dist/node/chunks/{dep-C0ketC3j.js → dep-DJVII9WQ.js} +1 -1
- package/dist/node/chunks/{dep-5iBxKK6m.js → dep-DVlS5vGL.js} +4364 -4374
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +39 -59
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +2 -2
- package/dist/node/module-runner.js +2 -2
- package/package.json +1 -1
- package/types/customEvent.d.ts +1 -1
- package/types/{hmrPayload.d.ts → hotPayload.d.ts} +3 -1
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import { I as colors, A as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { I as colors, A as createLogger, r as resolveConfig } from './chunks/dep-DVlS5vGL.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -766,7 +766,7 @@ cli
|
|
766
766
|
filterDuplicateOptions(options);
|
767
767
|
// output structure is preserved even after bundling so require()
|
768
768
|
// is ok here
|
769
|
-
const { createServer } = await import('./chunks/dep-
|
769
|
+
const { createServer } = await import('./chunks/dep-DVlS5vGL.js').then(function (n) { return n.M; });
|
770
770
|
try {
|
771
771
|
const server = await createServer({
|
772
772
|
root,
|
@@ -847,7 +847,7 @@ cli
|
|
847
847
|
.option('--app', `[boolean] same as builder.entireApp`)
|
848
848
|
.action(async (root, options) => {
|
849
849
|
filterDuplicateOptions(options);
|
850
|
-
const { createBuilder, buildEnvironment } = await import('./chunks/dep-
|
850
|
+
const { createBuilder, buildEnvironment } = await import('./chunks/dep-DVlS5vGL.js').then(function (n) { return n.N; });
|
851
851
|
const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
|
852
852
|
const config = {
|
853
853
|
root,
|
@@ -888,7 +888,7 @@ cli
|
|
888
888
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
889
889
|
.action(async (root, options) => {
|
890
890
|
filterDuplicateOptions(options);
|
891
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
891
|
+
const { optimizeDeps } = await import('./chunks/dep-DVlS5vGL.js').then(function (n) { return n.L; });
|
892
892
|
try {
|
893
893
|
const config = await resolveConfig({
|
894
894
|
root,
|
@@ -914,7 +914,7 @@ cli
|
|
914
914
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
915
915
|
.action(async (root, options) => {
|
916
916
|
filterDuplicateOptions(options);
|
917
|
-
const { preview } = await import('./chunks/dep-
|
917
|
+
const { preview } = await import('./chunks/dep-DVlS5vGL.js').then(function (n) { return n.O; });
|
918
918
|
try {
|
919
919
|
const server = await preview({
|
920
920
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -19,8 +19,8 @@ import { FetchResult, ModuleRunnerOptions, ModuleRunnerHMRConnection, ModuleRunn
|
|
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';
|
22
|
-
import {
|
23
|
-
export { ConnectedPayload, CustomPayload, ErrorPayload, FullReloadPayload,
|
22
|
+
import { HotPayload, CustomPayload } from '../../types/hotPayload.js';
|
23
|
+
export { ConnectedPayload, CustomPayload, ErrorPayload, FullReloadPayload, HotPayload, PrunePayload, Update, UpdatePayload } from '../../types/hotPayload.js';
|
24
24
|
import { InferCustomEventPayload } from '../../types/customEvent.js';
|
25
25
|
export { CustomEventMap, InferCustomEventPayload, InvalidatePayload } from '../../types/customEvent.js';
|
26
26
|
import { SecureContextOptions } from 'node:tls';
|
@@ -896,7 +896,7 @@ interface DepOptimizationConfig {
|
|
896
896
|
* When enabled, it will hold the first optimized deps results until all static
|
897
897
|
* imports are crawled on cold start. This avoids the need for full-page reloads
|
898
898
|
* when new dependencies are discovered and they trigger the generation of new
|
899
|
-
* common chunks. If all dependencies are found by the scanner plus the
|
899
|
+
* common chunks. If all dependencies are found by the scanner plus the explicitly
|
900
900
|
* defined ones in `include`, it is better to disable this option to let the
|
901
901
|
* browser process more requests in parallel.
|
902
902
|
* @default true
|
@@ -1184,25 +1184,21 @@ interface HmrContext {
|
|
1184
1184
|
read: () => string | Promise<string>;
|
1185
1185
|
server: ViteDevServer;
|
1186
1186
|
}
|
1187
|
-
interface
|
1187
|
+
interface HotChannelClient {
|
1188
1188
|
/**
|
1189
1189
|
* Send event to the client
|
1190
1190
|
*/
|
1191
|
-
send(payload:
|
1191
|
+
send(payload: HotPayload): void;
|
1192
1192
|
/**
|
1193
1193
|
* Send custom event
|
1194
1194
|
*/
|
1195
1195
|
send(event: string, payload?: CustomPayload['data']): void;
|
1196
1196
|
}
|
1197
|
-
interface
|
1198
|
-
/**
|
1199
|
-
* Unique channel name
|
1200
|
-
*/
|
1201
|
-
name: string;
|
1197
|
+
interface HotChannel {
|
1202
1198
|
/**
|
1203
1199
|
* Broadcast events to all clients
|
1204
1200
|
*/
|
1205
|
-
send(payload:
|
1201
|
+
send(payload: HotPayload): void;
|
1206
1202
|
/**
|
1207
1203
|
* Send custom event
|
1208
1204
|
*/
|
@@ -1210,7 +1206,7 @@ interface HMRChannel {
|
|
1210
1206
|
/**
|
1211
1207
|
* Handle custom event emitted by `import.meta.hot.send`
|
1212
1208
|
*/
|
1213
|
-
on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client:
|
1209
|
+
on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: HotChannelClient, ...args: any[]) => void): void;
|
1214
1210
|
on(event: 'connection', listener: () => void): void;
|
1215
1211
|
/**
|
1216
1212
|
* Unregister event listener
|
@@ -1225,18 +1221,7 @@ interface HMRChannel {
|
|
1225
1221
|
*/
|
1226
1222
|
close(): void;
|
1227
1223
|
}
|
1228
|
-
interface
|
1229
|
-
/**
|
1230
|
-
* All registered channels. Always has websocket channel.
|
1231
|
-
*/
|
1232
|
-
readonly channels: HMRChannel[];
|
1233
|
-
/**
|
1234
|
-
* Add a new third-party channel.
|
1235
|
-
*/
|
1236
|
-
addChannel(connection: HMRChannel): HMRBroadcaster;
|
1237
|
-
close(): Promise<unknown[]>;
|
1238
|
-
}
|
1239
|
-
interface ServerHMRChannel extends HMRChannel {
|
1224
|
+
interface ServerHotChannel extends HotChannel {
|
1240
1225
|
api: {
|
1241
1226
|
innerEmitter: EventEmitter;
|
1242
1227
|
outsideEmitter: EventEmitter;
|
@@ -1253,7 +1238,7 @@ declare class RemoteEnvironmentTransport {
|
|
1253
1238
|
}
|
1254
1239
|
|
1255
1240
|
interface DevEnvironmentSetup {
|
1256
|
-
hot
|
1241
|
+
hot: false | HotChannel;
|
1257
1242
|
watcher?: FSWatcher;
|
1258
1243
|
options?: EnvironmentOptions;
|
1259
1244
|
runner?: FetchModuleOptions & {
|
@@ -1268,14 +1253,14 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
1268
1253
|
depsOptimizer?: DepsOptimizer;
|
1269
1254
|
get pluginContainer(): EnvironmentPluginContainer;
|
1270
1255
|
/**
|
1271
|
-
*
|
1256
|
+
* Hot channel for this environment. If not provided or disabled,
|
1272
1257
|
* it will be a noop channel that does nothing.
|
1273
1258
|
*
|
1274
1259
|
* @example
|
1275
1260
|
* environment.hot.send({ type: 'full-reload' })
|
1276
1261
|
*/
|
1277
|
-
hot:
|
1278
|
-
constructor(name: string, config: ResolvedConfig, setup
|
1262
|
+
hot: HotChannel;
|
1263
|
+
constructor(name: string, config: ResolvedConfig, setup: DevEnvironmentSetup);
|
1279
1264
|
init(): Promise<void>;
|
1280
1265
|
fetchModule(id: string, importer?: string): Promise<FetchResult>;
|
1281
1266
|
transformRequest(url: string): Promise<TransformResult | null>;
|
@@ -2667,7 +2652,7 @@ declare namespace WebSocket {
|
|
2667
2652
|
}
|
2668
2653
|
|
2669
2654
|
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
2670
|
-
interface WebSocketServer extends
|
2655
|
+
interface WebSocketServer extends HotChannel {
|
2671
2656
|
/**
|
2672
2657
|
* Listen on port and host
|
2673
2658
|
*/
|
@@ -2693,15 +2678,7 @@ interface WebSocketServer extends HMRChannel {
|
|
2693
2678
|
(event: string, listener: Function): void;
|
2694
2679
|
};
|
2695
2680
|
}
|
2696
|
-
interface WebSocketClient {
|
2697
|
-
/**
|
2698
|
-
* Send event to the client
|
2699
|
-
*/
|
2700
|
-
send(payload: HMRPayload): void;
|
2701
|
-
/**
|
2702
|
-
* Send custom event
|
2703
|
-
*/
|
2704
|
-
send(event: string, payload?: CustomPayload['data']): void;
|
2681
|
+
interface WebSocketClient extends HotChannelClient {
|
2705
2682
|
/**
|
2706
2683
|
* The raw WebSocket instance
|
2707
2684
|
* @advanced
|
@@ -2844,17 +2821,9 @@ interface ViteDevServer {
|
|
2844
2821
|
watcher: FSWatcher;
|
2845
2822
|
/**
|
2846
2823
|
* web socket server with `send(payload)` method
|
2847
|
-
* @deprecated use `hot` instead
|
2848
|
-
*/
|
2849
|
-
ws: WebSocketServer;
|
2850
|
-
/**
|
2851
|
-
* HMR broadcaster that can be used to send custom HMR messages to the client
|
2852
|
-
*
|
2853
|
-
* Always sends a message to at least a WebSocket client. Any third party can
|
2854
|
-
* add a channel to the broadcaster to process messages
|
2855
2824
|
* @deprecated use `environment.hot` instead
|
2856
2825
|
*/
|
2857
|
-
|
2826
|
+
ws: WebSocketServer;
|
2858
2827
|
/**
|
2859
2828
|
* Rollup plugin container that can run plugin hooks on a given file
|
2860
2829
|
* @deprecated use `environment.pluginContainer` instead
|
@@ -3406,8 +3375,19 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
3406
3375
|
transformIndexHtml?: IndexHtmlTransform;
|
3407
3376
|
/**
|
3408
3377
|
* @deprecated
|
3409
|
-
*
|
3410
|
-
*
|
3378
|
+
* Perform custom handling of HMR updates.
|
3379
|
+
* The handler receives a context containing changed filename, timestamp, a
|
3380
|
+
* list of modules affected by the file change, and the dev server instance.
|
3381
|
+
*
|
3382
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
3383
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
3384
|
+
* the descriptors.
|
3385
|
+
*
|
3386
|
+
* - The hook can also return an empty array and then perform custom updates
|
3387
|
+
* by sending a custom hmr payload via server.ws.send().
|
3388
|
+
*
|
3389
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
3390
|
+
* normal.
|
3411
3391
|
*/
|
3412
3392
|
handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
3413
3393
|
}
|
@@ -3434,7 +3414,7 @@ interface JsonOptions {
|
|
3434
3414
|
}
|
3435
3415
|
|
3436
3416
|
type SSRTarget = 'node' | 'webworker';
|
3437
|
-
type
|
3417
|
+
type SsrDepOptimizationConfig = DepOptimizationConfig;
|
3438
3418
|
/**
|
3439
3419
|
* @deprecated use environments.ssr
|
3440
3420
|
*/
|
@@ -3470,7 +3450,7 @@ interface SSROptions {
|
|
3470
3450
|
* @experimental
|
3471
3451
|
* @deprecated
|
3472
3452
|
*/
|
3473
|
-
optimizeDeps?:
|
3453
|
+
optimizeDeps?: SsrDepOptimizationConfig;
|
3474
3454
|
/**
|
3475
3455
|
* @deprecated
|
3476
3456
|
*/
|
@@ -3495,7 +3475,7 @@ interface SSROptions {
|
|
3495
3475
|
}
|
3496
3476
|
interface ResolvedSSROptions extends SSROptions {
|
3497
3477
|
target: SSRTarget;
|
3498
|
-
optimizeDeps:
|
3478
|
+
optimizeDeps: SsrDepOptimizationConfig;
|
3499
3479
|
}
|
3500
3480
|
|
3501
3481
|
interface ConfigEnv {
|
@@ -3560,7 +3540,7 @@ interface DevEnvironmentOptions {
|
|
3560
3540
|
/**
|
3561
3541
|
* Optimize deps config
|
3562
3542
|
*/
|
3563
|
-
optimizeDeps?:
|
3543
|
+
optimizeDeps?: DepOptimizationOptions;
|
3564
3544
|
/**
|
3565
3545
|
* create the Dev Environment instance
|
3566
3546
|
*/
|
@@ -3898,7 +3878,7 @@ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, c
|
|
3898
3878
|
|
3899
3879
|
declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
3900
3880
|
|
3901
|
-
declare function createNodeDevEnvironment(name: string, config: ResolvedConfig, options
|
3881
|
+
declare function createNodeDevEnvironment(name: string, config: ResolvedConfig, options: DevEnvironmentSetup): DevEnvironment;
|
3902
3882
|
|
3903
3883
|
/**
|
3904
3884
|
* @experimental
|
@@ -3927,14 +3907,14 @@ declare function createServerModuleRunner(environment: DevEnvironment, options?:
|
|
3927
3907
|
* @experimental
|
3928
3908
|
*/
|
3929
3909
|
declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
|
3930
|
-
private
|
3910
|
+
private hotChannel;
|
3931
3911
|
private handlers;
|
3932
3912
|
private hmrClient;
|
3933
3913
|
private connected;
|
3934
|
-
constructor(
|
3914
|
+
constructor(hotChannel: ServerHotChannel);
|
3935
3915
|
isReady(): boolean;
|
3936
3916
|
send(message: string): void;
|
3937
|
-
onUpdate(handler: (payload:
|
3917
|
+
onUpdate(handler: (payload: HotPayload) => void): void;
|
3938
3918
|
}
|
3939
3919
|
|
3940
3920
|
interface ModuleRunnerTransformOptions {
|
@@ -3984,7 +3964,7 @@ declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions |
|
|
3984
3964
|
* to implement object metadata. Used by plugins to implement cross hooks per
|
3985
3965
|
* environment metadata
|
3986
3966
|
*/
|
3987
|
-
declare function createWeakData<Key extends
|
3967
|
+
declare function createWeakData<Key extends object | symbol, Data>(initial: (key: Key) => Data): (key: Key) => Data;
|
3988
3968
|
|
3989
3969
|
interface SendOptions {
|
3990
3970
|
etag?: string;
|
@@ -4024,4 +4004,4 @@ interface ManifestChunk {
|
|
4024
4004
|
dynamicImports?: string[];
|
4025
4005
|
}
|
4026
4006
|
|
4027
|
-
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, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type
|
4007
|
+
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, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, 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, 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, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, createWeakData, 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, h as buildErrorMessage, e as createBuilder, w as createFilter, A as createLogger, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, x as createWeakData, d as defineConfig, k as fetchModule, f as formatPostcssSourceMap, F as isFileLoadingAllowed, E as isFileServingAllowed, l as loadConfigFromFile, G as loadEnv, v as mergeAlias, u as mergeConfig, n as moduleRunnerTransform, q as normalizePath, o as optimizeDeps, g as preprocessCSS, p as preview, r as resolveConfig, H as resolveEnvPrefix, y as rollupVersion, C as searchForWorkspaceRoot, z as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-DVlS5vGL.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, h as buildErrorMessage, e as createBuilder, w as createFilter, A as createLogger, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, x as createWeakData, d as defineConfig, k as fetchModule, f as formatPostcssSourceMap, F as isFileLoadingAllowed, E as isFileServingAllowed, l as loadConfigFromFile, G as loadEnv, v as mergeAlias, u as mergeConfig, n as moduleRunnerTransform, q as normalizePath, o as optimizeDeps, g as preprocessCSS, p as preview, r as resolveConfig, H as resolveEnvPrefix, y as rollupVersion, C as searchForWorkspaceRoot, z as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DVlS5vGL.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import 'node:fs';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ModuleNamespace, ViteHotContext } from '../../types/hot.js';
|
2
|
-
import { Update,
|
2
|
+
import { Update, HotPayload } from '../../types/hotPayload.js';
|
3
3
|
import { InferCustomEventPayload } from '../../types/customEvent.js';
|
4
4
|
|
5
5
|
interface SourceMapLike {
|
@@ -182,7 +182,7 @@ interface ModuleRunnerHMRConnection extends HMRConnection {
|
|
182
182
|
* Configure how HMR is handled when this connection triggers an update.
|
183
183
|
* This method expects that connection will start listening for HMR updates and call this callback when it's received.
|
184
184
|
*/
|
185
|
-
onUpdate(callback: (payload:
|
185
|
+
onUpdate(callback: (payload: HotPayload) => void): void;
|
186
186
|
}
|
187
187
|
interface ModuleRunnerImportMeta extends ImportMeta {
|
188
188
|
url: string;
|
@@ -535,9 +535,9 @@ const ssrModuleExportsKey = "__vite_ssr_exports__", ssrImportKey = "__vite_ssr_i
|
|
535
535
|
};
|
536
536
|
function createHMRHandler(runner) {
|
537
537
|
const queue = new Queue();
|
538
|
-
return (payload) => queue.enqueue(() =>
|
538
|
+
return (payload) => queue.enqueue(() => handleHotPayload(runner, payload));
|
539
539
|
}
|
540
|
-
async function
|
540
|
+
async function handleHotPayload(runner, payload) {
|
541
541
|
const hmrClient = runner.hmrClient;
|
542
542
|
if (!(!hmrClient || runner.isDestroyed()))
|
543
543
|
switch (payload.type) {
|
package/package.json
CHANGED
package/types/customEvent.d.ts
CHANGED