vite 2.8.6 → 2.9.0-beta.10

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -10,7 +10,9 @@ import type { DuplexOptions } from 'stream';
10
10
  import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
11
11
  import { EventEmitter } from 'events';
12
12
  import * as events from 'events';
13
+ import type { ExistingRawSourceMap } from 'rollup';
13
14
  import type * as fs from 'fs';
15
+ import type { GetManualChunk } from 'rollup';
14
16
  import * as http from 'http';
15
17
  import type { IncomingMessage } from 'http';
16
18
  import type { InputOptions } from 'rollup';
@@ -33,8 +35,8 @@ import type { RollupOutput } from 'rollup';
33
35
  import type { RollupWatcher } from 'rollup';
34
36
  import type { SecureContextOptions } from 'tls';
35
37
  import type { Server } from 'http';
36
- import type { Server as Server_2 } from 'https';
37
- import type { Server as Server_3 } from 'net';
38
+ import type { Server as Server_2 } from 'net';
39
+ import type { Server as Server_3 } from 'https';
38
40
  import type { ServerOptions as ServerOptions_2 } from 'https';
39
41
  import type { ServerResponse } from 'http';
40
42
  import type { SourceDescription } from 'rollup';
@@ -46,6 +48,8 @@ import type { TransformResult as TransformResult_3 } from 'rollup';
46
48
  import type * as url from 'url';
47
49
  import type { URL as URL_2 } from 'url';
48
50
  import type { WatcherOptions } from 'rollup';
51
+ import type { WebSocket as WebSocket_2 } from 'ws';
52
+ import { WebSocketServer as WebSocketServer_2 } from 'ws';
49
53
  import type { ZlibOptions } from 'zlib';
50
54
 
51
55
  export declare interface Alias {
@@ -267,6 +271,11 @@ export declare interface BuildOptions {
267
271
  watch?: WatcherOptions | null;
268
272
  }
269
273
 
274
+ export declare interface ChunkMetadata {
275
+ importedAssets: Set<string>;
276
+ importedCss: Set<string>;
277
+ }
278
+
270
279
  export declare interface CommonServerOptions {
271
280
  /**
272
281
  * Specify server port. Note if the port is already being used, Vite will
@@ -478,6 +487,19 @@ export declare interface CSSOptions {
478
487
  postcss?: string | (Postcss.ProcessOptions & {
479
488
  plugins?: Postcss.Plugin[];
480
489
  });
490
+ /**
491
+ * Enables css sourcemaps during dev
492
+ * @default false
493
+ * @experimental
494
+ */
495
+ devSourcemap?: boolean;
496
+ }
497
+
498
+ export declare interface CustomEventMap {
499
+ 'vite:beforeUpdate': UpdatePayload
500
+ 'vite:beforePrune': PrunePayload
501
+ 'vite:beforeFullReload': FullReloadPayload
502
+ 'vite:error': ErrorPayload
481
503
  }
482
504
 
483
505
  export declare interface CustomPayload {
@@ -506,11 +528,22 @@ export declare interface DepOptimizationMetadata {
506
528
  * optimized deps.
507
529
  */
508
530
  browserHash: string;
509
- optimized: Record<string, {
510
- file: string;
511
- src: string;
512
- needsInterop: boolean;
513
- }>;
531
+ /**
532
+ * Metadata for each already optimized dependency
533
+ */
534
+ optimized: Record<string, OptimizedDepInfo>;
535
+ /**
536
+ * Metadata for non-entry optimized chunks and dynamic imports
537
+ */
538
+ chunks: Record<string, OptimizedDepInfo>;
539
+ /**
540
+ * Metadata for each newly discovered dependency after processing
541
+ */
542
+ discovered: Record<string, OptimizedDepInfo>;
543
+ /**
544
+ * OptimizedDepInfo list
545
+ */
546
+ depInfoList: OptimizedDepInfo[];
514
547
  }
515
548
 
516
549
  export declare interface DepOptimizationOptions {
@@ -552,6 +585,32 @@ export declare interface DepOptimizationOptions {
552
585
  * @deprecated use `esbuildOptions.keepNames`
553
586
  */
554
587
  keepNames?: boolean;
588
+ /**
589
+ * List of file extensions that can be optimized. A corresponding esbuild
590
+ * plugin must exist to handle the specific extension.
591
+ *
592
+ * By default, Vite can optimize `.mjs`, `.js`, and `.ts` files. This option
593
+ * allows specifying additional extensions.
594
+ *
595
+ * @experimental
596
+ */
597
+ extensions?: string[];
598
+ }
599
+
600
+ export declare interface DepOptimizationProcessing {
601
+ promise: Promise<void>;
602
+ resolve: () => void;
603
+ }
604
+
605
+ export declare interface DepOptimizationResult {
606
+ metadata: DepOptimizationMetadata;
607
+ /**
608
+ * When doing a re-run, if there are newly discovered dependendencies
609
+ * the page reload will be delayed until the next rerun so we need
610
+ * to be able to discard the result
611
+ */
612
+ commit: () => void;
613
+ cancel: () => void;
555
614
  }
556
615
 
557
616
  export declare interface ErrorPayload {
@@ -613,6 +672,8 @@ export declare interface FileSystemServeOptions {
613
672
  deny?: string[];
614
673
  }
615
674
 
675
+ export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): ExistingRawSourceMap;
676
+
616
677
  export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
617
678
  options: WatchOptions
618
679
 
@@ -701,7 +762,7 @@ export declare interface HmrContext {
701
762
  export declare interface HmrOptions {
702
763
  protocol?: string;
703
764
  host?: string;
704
- port?: number;
765
+ port?: number | false;
705
766
  clientPort?: number;
706
767
  path?: string;
707
768
  timeout?: number;
@@ -976,6 +1037,9 @@ export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
976
1037
  tags: HtmlTagDescriptor[];
977
1038
  };
978
1039
 
1040
+ export declare type InferCustomEventPayload<T extends string> =
1041
+ T extends keyof CustomEventMap ? CustomEventMap[T] : any
1042
+
979
1043
  export declare interface InlineConfig extends UserConfig {
980
1044
  configFile?: string | false;
981
1045
  envFile?: false;
@@ -1001,6 +1065,7 @@ export declare interface InternalResolveOptions extends ResolveOptions {
1001
1065
  isRequire?: boolean;
1002
1066
  isFromTsImporter?: boolean;
1003
1067
  tryEsmOnly?: boolean;
1068
+ scan?: boolean;
1004
1069
  }
1005
1070
 
1006
1071
  export declare interface JsonOptions {
@@ -1091,7 +1156,7 @@ export declare class ModuleGraph {
1091
1156
  getModuleById(id: string): ModuleNode | undefined;
1092
1157
  getModulesByFile(file: string): Set<ModuleNode> | undefined;
1093
1158
  onFileChange(file: string): void;
1094
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>): void;
1159
+ invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number): void;
1095
1160
  invalidateAll(): void;
1096
1161
  /**
1097
1162
  * Update the module graph based on a module's updated imports information
@@ -1125,13 +1190,36 @@ export declare class ModuleNode {
1125
1190
  ssrTransformResult: TransformResult | null;
1126
1191
  ssrModule: Record<string, any> | null;
1127
1192
  lastHMRTimestamp: number;
1193
+ lastInvalidationTimestamp: number;
1128
1194
  constructor(url: string);
1129
1195
  }
1130
1196
 
1131
1197
  export declare function normalizePath(id: string): string;
1132
1198
 
1133
- export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean, newDeps?: Record<string, string>, // missing imports encountered after server has started
1134
- ssr?: boolean): Promise<DepOptimizationMetadata | null>;
1199
+ export declare interface OptimizedDepInfo {
1200
+ id: string;
1201
+ file: string;
1202
+ src?: string;
1203
+ needsInterop?: boolean;
1204
+ browserHash?: string;
1205
+ fileHash?: string;
1206
+ /**
1207
+ * During optimization, ids can still be resolved to their final location
1208
+ * but the bundles may not yet be saved to disk
1209
+ */
1210
+ processing?: Promise<void>;
1211
+ }
1212
+
1213
+ export declare interface OptimizedDeps {
1214
+ metadata: DepOptimizationMetadata;
1215
+ scanProcessing?: Promise<void>;
1216
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
1217
+ }
1218
+
1219
+ /**
1220
+ * Used by Vite CLI when running `vite optimize`
1221
+ */
1222
+ export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
1135
1223
 
1136
1224
  /** Cache for package.json resolution and package.json contents */
1137
1225
  export declare type PackageCache = Map<string, PackageData>;
@@ -1254,6 +1342,7 @@ export declare interface Plugin extends Plugin_2 {
1254
1342
  resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
1255
1343
  custom?: CustomPluginOptions;
1256
1344
  ssr?: boolean;
1345
+ /* Excluded from this release type: scan */
1257
1346
  }): Promise<ResolveIdResult> | ResolveIdResult;
1258
1347
  load?(this: PluginContext, id: string, options?: {
1259
1348
  ssr?: boolean;
@@ -1270,6 +1359,7 @@ export declare interface PluginContainer {
1270
1359
  resolveId(id: string, importer?: string, options?: {
1271
1360
  skip?: Set<Plugin>;
1272
1361
  ssr?: boolean;
1362
+ /* Excluded from this release type: scan */
1273
1363
  }): Promise<PartialResolvedId | null>;
1274
1364
  transform(code: string, id: string, options?: {
1275
1365
  inMap?: SourceDescription['map'];
@@ -1312,7 +1402,7 @@ export declare interface PreviewServer {
1312
1402
  /**
1313
1403
  * @deprecated Use `server.printUrls()` instead
1314
1404
  */
1315
- export declare function printHttpServerUrls(server: Server_3, config: ResolvedConfig): void;
1405
+ export declare function printHttpServerUrls(server: Server_2, config: ResolvedConfig): void;
1316
1406
 
1317
1407
  export declare interface ProxyOptions extends HttpProxy.ServerOptions {
1318
1408
  /**
@@ -1348,6 +1438,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'alia
1348
1438
  cacheDir: string;
1349
1439
  command: 'build' | 'serve';
1350
1440
  mode: string;
1441
+ isWorker: boolean;
1351
1442
  isProduction: boolean;
1352
1443
  env: Record<string, any>;
1353
1444
  resolve: ResolveOptions & {
@@ -1666,6 +1757,18 @@ export declare interface ServerOptions extends CommonServerOptions {
1666
1757
 
1667
1758
  export declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
1668
1759
 
1760
+ export declare function splitVendorChunk(options?: {
1761
+ cache?: SplitVendorChunkCache;
1762
+ }): GetManualChunk;
1763
+
1764
+ export declare class SplitVendorChunkCache {
1765
+ cache: Map<string, boolean>;
1766
+ constructor();
1767
+ reset(): void;
1768
+ }
1769
+
1770
+ export declare function splitVendorChunkPlugin(): Plugin;
1771
+
1669
1772
  export declare interface SSROptions {
1670
1773
  external?: string[];
1671
1774
  noExternal?: string | RegExp | (string | RegExp)[] | true;
@@ -2093,7 +2196,11 @@ export declare interface ViteDevServer {
2093
2196
  fixStacktrace?: boolean;
2094
2197
  }): Promise<Record<string, any>>;
2095
2198
  /**
2096
- * Fix ssr error stacktrace
2199
+ * Returns a fixed version of the given stack
2200
+ */
2201
+ ssrRewriteStacktrace(stack: string): string;
2202
+ /**
2203
+ * Mutates the given SSR error by rewriting the stacktrace
2097
2204
  */
2098
2205
  ssrFixStacktrace(e: Error): void;
2099
2206
  /**
@@ -2114,14 +2221,11 @@ export declare interface ViteDevServer {
2114
2221
  * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
2115
2222
  */
2116
2223
  restart(forceOptimize?: boolean): Promise<void>;
2117
- /* Excluded from this release type: _optimizeDepsMetadata */
2224
+ /* Excluded from this release type: _optimizedDeps */
2118
2225
  /* Excluded from this release type: _ssrExternals */
2119
2226
  /* Excluded from this release type: _globImporters */
2120
2227
  /* Excluded from this release type: _restartPromise */
2121
2228
  /* Excluded from this release type: _forceOptimizeOnRestart */
2122
- /* Excluded from this release type: _isRunningOptimizer */
2123
- /* Excluded from this release type: _registerMissingImport */
2124
- /* Excluded from this release type: _pendingReload */
2125
2229
  /* Excluded from this release type: _pendingRequests */
2126
2230
  }
2127
2231
 
@@ -2240,6 +2344,8 @@ export declare class WebSocket extends EventEmitter {
2240
2344
  binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
2241
2345
  readonly bufferedAmount: number
2242
2346
  readonly extensions: string
2347
+ /** Indicates whether the websocket is paused */
2348
+ readonly isPaused: boolean
2243
2349
  readonly protocol: string
2244
2350
  /** The current state of the connection */
2245
2351
  readonly readyState:
@@ -2258,11 +2364,12 @@ export declare class WebSocket extends EventEmitter {
2258
2364
  /** The connection is closed. */
2259
2365
  readonly CLOSED: 3
2260
2366
 
2261
- onopen: (event: WebSocket.Event) => void
2262
- onerror: (event: WebSocket.ErrorEvent) => void
2263
- onclose: (event: WebSocket.CloseEvent) => void
2264
- onmessage: (event: WebSocket.MessageEvent) => void
2367
+ onopen: ((event: WebSocket.Event) => void) | null
2368
+ onerror: ((event: WebSocket.ErrorEvent) => void) | null
2369
+ onclose: ((event: WebSocket.CloseEvent) => void) | null
2370
+ onmessage: ((event: WebSocket.MessageEvent) => void) | null
2265
2371
 
2372
+ constructor(address: null)
2266
2373
  constructor(
2267
2374
  address: string | URL_2,
2268
2375
  options?: WebSocket.ClientOptions | ClientRequestArgs
@@ -2289,6 +2396,18 @@ export declare class WebSocket extends EventEmitter {
2289
2396
  ): void
2290
2397
  terminate(): void
2291
2398
 
2399
+ /**
2400
+ * Pause the websocket causing it to stop emitting events. Some events can still be
2401
+ * emitted after this is called, until all buffered data is consumed. This method
2402
+ * is a noop if the ready state is `CONNECTING` or `CLOSED`.
2403
+ */
2404
+ pause(): void
2405
+ /**
2406
+ * Make a paused socket resume emitting events. This method is a noop if the ready
2407
+ * state is `CONNECTING` or `CLOSED`.
2408
+ */
2409
+ resume(): void
2410
+
2292
2411
  // HTML5 WebSocket events
2293
2412
  addEventListener(
2294
2413
  method: 'message',
@@ -2525,6 +2644,7 @@ export declare namespace WebSocket {
2525
2644
  export interface ClientOptions extends SecureContextOptions {
2526
2645
  protocol?: string | undefined
2527
2646
  followRedirects?: boolean | undefined
2647
+ generateMask?(mask: Buffer): void
2528
2648
  handshakeTimeout?: number | undefined
2529
2649
  maxRedirects?: number | undefined
2530
2650
  perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
@@ -2538,6 +2658,7 @@ export declare namespace WebSocket {
2538
2658
  checkServerIdentity?(servername: string, cert: CertMeta): boolean
2539
2659
  rejectUnauthorized?: boolean | undefined
2540
2660
  maxPayload?: number | undefined
2661
+ skipUTF8Validation?: boolean | undefined
2541
2662
  }
2542
2663
 
2543
2664
  export interface PerMessageDeflateOptions {
@@ -2597,7 +2718,7 @@ export declare namespace WebSocket {
2597
2718
  host?: string | undefined
2598
2719
  port?: number | undefined
2599
2720
  backlog?: number | undefined
2600
- server?: Server | Server_2 | undefined
2721
+ server?: Server | Server_3 | undefined
2601
2722
  verifyClient?:
2602
2723
  | VerifyClientCallbackAsync
2603
2724
  | VerifyClientCallbackSync
@@ -2612,6 +2733,7 @@ export declare namespace WebSocket {
2612
2733
  perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
2613
2734
  maxPayload?: number | undefined
2614
2735
  skipUTF8Validation?: boolean | undefined
2736
+ WebSocket?: typeof WebSocket.WebSocket | undefined
2615
2737
  }
2616
2738
 
2617
2739
  export interface AddressInfo {
@@ -2621,10 +2743,10 @@ export declare namespace WebSocket {
2621
2743
  }
2622
2744
 
2623
2745
  // WebSocket Server
2624
- export class Server extends EventEmitter {
2746
+ export class Server<T extends WebSocket = WebSocket> extends EventEmitter {
2625
2747
  options: ServerOptions
2626
2748
  path: string
2627
- clients: Set<WebSocket>
2749
+ clients: Set<T>
2628
2750
 
2629
2751
  constructor(options?: ServerOptions, callback?: () => void)
2630
2752
 
@@ -2634,56 +2756,59 @@ export declare namespace WebSocket {
2634
2756
  request: IncomingMessage,
2635
2757
  socket: Duplex,
2636
2758
  upgradeHead: Buffer,
2637
- callback: (client: WebSocket, request: IncomingMessage) => void
2759
+ callback: (client: T, request: IncomingMessage) => void
2638
2760
  ): void
2639
2761
  shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
2640
2762
 
2641
2763
  // Events
2642
2764
  on(
2643
2765
  event: 'connection',
2644
- cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void
2766
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
2645
2767
  ): this
2646
- on(event: 'error', cb: (this: Server, error: Error) => void): this
2768
+ on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
2647
2769
  on(
2648
2770
  event: 'headers',
2649
- cb: (this: Server, headers: string[], request: IncomingMessage) => void
2771
+ cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
2650
2772
  ): this
2651
- on(event: 'close' | 'listening', cb: (this: Server) => void): this
2773
+ on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
2652
2774
  on(
2653
2775
  event: string | symbol,
2654
- listener: (this: Server, ...args: any[]) => void
2776
+ listener: (this: Server<T>, ...args: any[]) => void
2655
2777
  ): this
2656
2778
 
2657
2779
  once(
2658
2780
  event: 'connection',
2659
- cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void
2781
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
2660
2782
  ): this
2661
- once(event: 'error', cb: (this: Server, error: Error) => void): this
2783
+ once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
2662
2784
  once(
2663
2785
  event: 'headers',
2664
- cb: (this: Server, headers: string[], request: IncomingMessage) => void
2786
+ cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
2787
+ ): this
2788
+ once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
2789
+ once(
2790
+ event: string | symbol,
2791
+ listener: (this: Server<T>, ...args: any[]) => void
2665
2792
  ): this
2666
- once(event: 'close' | 'listening', cb: (this: Server) => void): this
2667
- once(event: string | symbol, listener: (...args: any[]) => void): this
2668
2793
 
2669
2794
  off(
2670
2795
  event: 'connection',
2671
- cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void
2796
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
2672
2797
  ): this
2673
- off(event: 'error', cb: (this: Server, error: Error) => void): this
2798
+ off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
2674
2799
  off(
2675
2800
  event: 'headers',
2676
- cb: (this: Server, headers: string[], request: IncomingMessage) => void
2801
+ cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
2677
2802
  ): this
2678
- off(event: 'close' | 'listening', cb: (this: Server) => void): this
2803
+ off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
2679
2804
  off(
2680
2805
  event: string | symbol,
2681
- listener: (this: Server, ...args: any[]) => void
2806
+ listener: (this: Server<T>, ...args: any[]) => void
2682
2807
  ): this
2683
2808
 
2684
2809
  addListener(
2685
2810
  event: 'connection',
2686
- cb: (client: WebSocket, request: IncomingMessage) => void
2811
+ cb: (client: T, request: IncomingMessage) => void
2687
2812
  ): this
2688
2813
  addListener(event: 'error', cb: (err: Error) => void): this
2689
2814
  addListener(
@@ -2696,7 +2821,7 @@ export declare namespace WebSocket {
2696
2821
  listener: (...args: any[]) => void
2697
2822
  ): this
2698
2823
 
2699
- removeListener(event: 'connection', cb: (client: WebSocket) => void): this
2824
+ removeListener(event: 'connection', cb: (client: T) => void): this
2700
2825
  removeListener(event: 'error', cb: (err: Error) => void): this
2701
2826
  removeListener(
2702
2827
  event: 'headers',
@@ -2710,9 +2835,9 @@ export declare namespace WebSocket {
2710
2835
  }
2711
2836
 
2712
2837
  const WebSocketServer: typeof Server
2713
- export type WebSocketServer = Server
2838
+ export interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
2714
2839
  const WebSocket: typeof WebSocketAlias
2715
- export type WebSocket = WebSocketAlias
2840
+ export interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
2716
2841
 
2717
2842
  // WebSocket stream
2718
2843
  export function createWebSocketStream(
@@ -2723,13 +2848,55 @@ export declare namespace WebSocket {
2723
2848
 
2724
2849
  export declare const WebSocketAlias: typeof WebSocket;
2725
2850
 
2726
- export declare type WebSocketAlias = WebSocket
2851
+ export declare interface WebSocketAlias extends WebSocket {}
2852
+
2853
+ export declare interface WebSocketClient {
2854
+ /**
2855
+ * Send event to the client
2856
+ */
2857
+ send(payload: HMRPayload): void;
2858
+ /**
2859
+ * Send custom event
2860
+ */
2861
+ send(event: string, payload?: CustomPayload['data']): void;
2862
+ /**
2863
+ * The raw WebSocket instance
2864
+ * @advanced
2865
+ */
2866
+ socket: WebSocket_2;
2867
+ }
2868
+
2869
+ export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
2727
2870
 
2728
2871
  export declare interface WebSocketServer {
2729
- on: WebSocket.Server['on'];
2730
- off: WebSocket.Server['off'];
2872
+ /**
2873
+ * Get all connected clients.
2874
+ */
2875
+ clients: Set<WebSocketClient>;
2876
+ /**
2877
+ * Boardcast events to all clients
2878
+ */
2731
2879
  send(payload: HMRPayload): void;
2880
+ /**
2881
+ * Send custom event
2882
+ */
2883
+ send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
2884
+ /**
2885
+ * Disconnect all clients and terminate the server.
2886
+ */
2732
2887
  close(): Promise<void>;
2888
+ /**
2889
+ * Handle custom event emitted by `import.meta.hot.send`
2890
+ */
2891
+ on: WebSocketServer_2['on'] & {
2892
+ <T extends string>(event: T, listener: WebSocketCustomListener<InferCustomEventPayload<T>>): void;
2893
+ };
2894
+ /**
2895
+ * Unregister event listener.
2896
+ */
2897
+ off: WebSocketServer_2['off'] & {
2898
+ (event: string, listener: Function): void;
2899
+ };
2733
2900
  }
2734
2901
 
2735
2902
  export { }