vite 4.0.0-alpha.5 → 4.0.0-beta.0

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.
@@ -376,18 +376,18 @@ export declare namespace Connect {
376
376
 
377
377
  export type SimpleHandleFunction = (
378
378
  req: IncomingMessage,
379
- res: http.ServerResponse
379
+ res: http.ServerResponse,
380
380
  ) => void
381
381
  export type NextHandleFunction = (
382
382
  req: IncomingMessage,
383
383
  res: http.ServerResponse,
384
- next: NextFunction
384
+ next: NextFunction,
385
385
  ) => void
386
386
  export type ErrorHandleFunction = (
387
387
  err: any,
388
388
  req: IncomingMessage,
389
389
  res: http.ServerResponse,
390
- next: NextFunction
390
+ next: NextFunction,
391
391
  ) => void
392
392
  export type HandleFunction =
393
393
  | SimpleHandleFunction
@@ -428,7 +428,7 @@ export declare namespace Connect {
428
428
  handle(
429
429
  req: http.IncomingMessage,
430
430
  res: http.ServerResponse,
431
- next: Function
431
+ next: Function,
432
432
  ): void
433
433
 
434
434
  /**
@@ -457,7 +457,7 @@ export declare namespace Connect {
457
457
  port: number,
458
458
  hostname?: string,
459
459
  backlog?: number,
460
- callback?: Function
460
+ callback?: Function,
461
461
  ): http.Server
462
462
  listen(port: number, hostname?: string, callback?: Function): http.Server
463
463
  listen(path: string, callback?: Function): http.Server
@@ -500,7 +500,7 @@ export declare interface CSSModulesOptions {
500
500
  /**
501
501
  * default: undefined
502
502
  */
503
- localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
503
+ localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
504
504
  }
505
505
 
506
506
  export declare interface CSSOptions {
@@ -784,7 +784,7 @@ export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
784
784
 
785
785
  on(
786
786
  event: 'add' | 'addDir' | 'change',
787
- listener: (path: string, stats?: fs.Stats) => void
787
+ listener: (path: string, stats?: fs.Stats) => void,
788
788
  ): this
789
789
 
790
790
  on(
@@ -792,8 +792,8 @@ export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
792
792
  listener: (
793
793
  eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',
794
794
  path: string,
795
- stats?: fs.Stats
796
- ) => void
795
+ stats?: fs.Stats,
796
+ ) => void,
797
797
  ): this
798
798
 
799
799
  /**
@@ -806,7 +806,7 @@ export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
806
806
  */
807
807
  on(
808
808
  event: 'raw',
809
- listener: (eventName: string, path: string, details: any) => void
809
+ listener: (eventName: string, path: string, details: any) => void,
810
810
  ): this
811
811
 
812
812
  /**
@@ -882,7 +882,7 @@ export declare namespace HttpProxy {
882
882
  err: Error,
883
883
  req: http.IncomingMessage,
884
884
  res: http.ServerResponse,
885
- target?: ProxyTargetUrl
885
+ target?: ProxyTargetUrl,
886
886
  ) => void
887
887
 
888
888
  export class Server extends events.EventEmitter {
@@ -902,7 +902,7 @@ export declare namespace HttpProxy {
902
902
  req: http.IncomingMessage,
903
903
  res: http.ServerResponse,
904
904
  options?: ServerOptions,
905
- callback?: ErrorCallback
905
+ callback?: ErrorCallback,
906
906
  ): void
907
907
 
908
908
  /**
@@ -917,7 +917,7 @@ export declare namespace HttpProxy {
917
917
  socket: unknown,
918
918
  head: unknown,
919
919
  options?: ServerOptions,
920
- callback?: ErrorCallback
920
+ callback?: ErrorCallback,
921
921
  ): void
922
922
 
923
923
  /**
@@ -960,8 +960,8 @@ export declare namespace HttpProxy {
960
960
  listener: (
961
961
  req: http.IncomingMessage,
962
962
  res: http.ServerResponse,
963
- target: ProxyTargetUrl
964
- ) => void
963
+ target: ProxyTargetUrl,
964
+ ) => void,
965
965
  ): this
966
966
  on(
967
967
  event: 'proxyReq',
@@ -969,16 +969,16 @@ export declare namespace HttpProxy {
969
969
  proxyReq: http.ClientRequest,
970
970
  req: http.IncomingMessage,
971
971
  res: http.ServerResponse,
972
- options: ServerOptions
973
- ) => void
972
+ options: ServerOptions,
973
+ ) => void,
974
974
  ): this
975
975
  on(
976
976
  event: 'proxyRes',
977
977
  listener: (
978
978
  proxyRes: http.IncomingMessage,
979
979
  req: http.IncomingMessage,
980
- res: http.ServerResponse
981
- ) => void
980
+ res: http.ServerResponse,
981
+ ) => void,
982
982
  ): this
983
983
  on(
984
984
  event: 'proxyReqWs',
@@ -987,8 +987,8 @@ export declare namespace HttpProxy {
987
987
  req: http.IncomingMessage,
988
988
  socket: net.Socket,
989
989
  options: ServerOptions,
990
- head: any
991
- ) => void
990
+ head: any,
991
+ ) => void,
992
992
  ): this
993
993
  on(
994
994
  event: 'econnreset',
@@ -996,24 +996,24 @@ export declare namespace HttpProxy {
996
996
  err: Error,
997
997
  req: http.IncomingMessage,
998
998
  res: http.ServerResponse,
999
- target: ProxyTargetUrl
1000
- ) => void
999
+ target: ProxyTargetUrl,
1000
+ ) => void,
1001
1001
  ): this
1002
1002
  on(
1003
1003
  event: 'end',
1004
1004
  listener: (
1005
1005
  req: http.IncomingMessage,
1006
1006
  res: http.ServerResponse,
1007
- proxyRes: http.IncomingMessage
1008
- ) => void
1007
+ proxyRes: http.IncomingMessage,
1008
+ ) => void,
1009
1009
  ): this
1010
1010
  on(
1011
1011
  event: 'close',
1012
1012
  listener: (
1013
1013
  proxyRes: http.IncomingMessage,
1014
1014
  proxySocket: net.Socket,
1015
- proxyHead: any
1016
- ) => void
1015
+ proxyHead: any,
1016
+ ) => void,
1017
1017
  ): this
1018
1018
 
1019
1019
  once(event: string, listener: () => void): this
@@ -1095,8 +1095,22 @@ export { ImportGlobFunction }
1095
1095
  export { ImportGlobOptions }
1096
1096
 
1097
1097
  export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
1098
+ order?: 'pre' | 'post' | null;
1099
+ /**
1100
+ * @deprecated renamed to `order`
1101
+ */
1098
1102
  enforce?: 'pre' | 'post';
1103
+ /**
1104
+ * @deprecated renamed to `handler`
1105
+ */
1099
1106
  transform: IndexHtmlTransformHook;
1107
+ } | {
1108
+ order?: 'pre' | 'post' | null;
1109
+ /**
1110
+ * @deprecated renamed to `order`
1111
+ */
1112
+ enforce?: 'pre' | 'post';
1113
+ handler: IndexHtmlTransformHook;
1100
1114
  };
1101
1115
 
1102
1116
  export declare interface IndexHtmlTransformContext {
@@ -1151,11 +1165,12 @@ export declare interface InternalResolveOptions extends Required<ResolveOptions>
1151
1165
  ssrOptimizeCheck?: boolean;
1152
1166
  getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
1153
1167
  shouldExternalize?: (id: string) => boolean | undefined;
1154
- isHookNodeResolve?: boolean;
1155
1168
  }
1156
1169
 
1157
1170
  export { InvalidatePayload }
1158
1171
 
1172
+ export declare const isCSSRequest: (request: string) => boolean;
1173
+
1159
1174
  export declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
1160
1175
 
1161
1176
  export declare interface JsonOptions {
@@ -1471,7 +1486,7 @@ declare interface Plugin_2 extends Plugin_3 {
1471
1486
  *
1472
1487
  * By default the transform is applied **after** vite's internal html
1473
1488
  * transform. If you need to apply the transform before vite, use an object:
1474
- * `{ enforce: 'pre', transform: hook }`
1489
+ * `{ order: 'pre', handler: hook }`
1475
1490
  */
1476
1491
  transformIndexHtml?: IndexHtmlTransform;
1477
1492
  /**
@@ -1615,7 +1630,7 @@ export declare type RenderBuiltAssetUrl = (filename: string, type: {
1615
1630
  */
1616
1631
  export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger): string;
1617
1632
 
1618
- export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
1633
+ export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string): Promise<ResolvedConfig>;
1619
1634
 
1620
1635
  export declare interface ResolvedBuildOptions extends Required<Omit<BuildOptions, 'polyfillModulePreload'>> {
1621
1636
  modulePreload: false | ResolvedModulePreloadOptions;
@@ -1684,7 +1699,7 @@ resolvedId: string,
1684
1699
  meta: object | null | undefined
1685
1700
  ];
1686
1701
 
1687
- export declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
1702
+ export declare function resolveEnvPrefix({ envPrefix, }: UserConfig): string[];
1688
1703
 
1689
1704
  export declare type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
1690
1705
 
@@ -2153,7 +2168,7 @@ export declare namespace Terser {
2153
2168
  Disabled = 0,
2154
2169
  SimpleFunctions = 1,
2155
2170
  WithArguments = 2,
2156
- WithArgumentsAndVariables = 3
2171
+ WithArgumentsAndVariables = 3,
2157
2172
  }
2158
2173
 
2159
2174
  export interface MangleOptions {
@@ -2229,7 +2244,7 @@ export declare namespace Terser {
2229
2244
  pos: number
2230
2245
  line: number
2231
2246
  col: number
2232
- }
2247
+ },
2233
2248
  ) => boolean)
2234
2249
  ecma?: ECMA
2235
2250
  ie8?: boolean
@@ -2258,7 +2273,7 @@ export declare namespace Terser {
2258
2273
  PreferDouble = 0,
2259
2274
  AlwaysSingle = 1,
2260
2275
  AlwaysDouble = 2,
2261
- AlwaysOriginal = 3
2276
+ AlwaysOriginal = 3,
2262
2277
  }
2263
2278
 
2264
2279
  export interface MinifyOptions {
@@ -2720,12 +2735,12 @@ declare class WebSocket_2 extends EventEmitter {
2720
2735
  constructor(address: null)
2721
2736
  constructor(
2722
2737
  address: string | URL_2,
2723
- options?: WebSocket_2.ClientOptions | ClientRequestArgs
2738
+ options?: WebSocket_2.ClientOptions | ClientRequestArgs,
2724
2739
  )
2725
2740
  constructor(
2726
2741
  address: string | URL_2,
2727
2742
  protocols?: string | string[],
2728
- options?: WebSocket_2.ClientOptions | ClientRequestArgs
2743
+ options?: WebSocket_2.ClientOptions | ClientRequestArgs,
2729
2744
  )
2730
2745
 
2731
2746
  close(code?: number, data?: string | Buffer): void
@@ -2740,7 +2755,7 @@ declare class WebSocket_2 extends EventEmitter {
2740
2755
  compress?: boolean | undefined
2741
2756
  fin?: boolean | undefined
2742
2757
  },
2743
- cb?: (err?: Error) => void
2758
+ cb?: (err?: Error) => void,
2744
2759
  ): void
2745
2760
  terminate(): void
2746
2761
 
@@ -2760,190 +2775,190 @@ declare class WebSocket_2 extends EventEmitter {
2760
2775
  addEventListener(
2761
2776
  method: 'message',
2762
2777
  cb: (event: WebSocket_2.MessageEvent) => void,
2763
- options?: WebSocket_2.EventListenerOptions
2778
+ options?: WebSocket_2.EventListenerOptions,
2764
2779
  ): void
2765
2780
  addEventListener(
2766
2781
  method: 'close',
2767
2782
  cb: (event: WebSocket_2.CloseEvent) => void,
2768
- options?: WebSocket_2.EventListenerOptions
2783
+ options?: WebSocket_2.EventListenerOptions,
2769
2784
  ): void
2770
2785
  addEventListener(
2771
2786
  method: 'error',
2772
2787
  cb: (event: WebSocket_2.ErrorEvent) => void,
2773
- options?: WebSocket_2.EventListenerOptions
2788
+ options?: WebSocket_2.EventListenerOptions,
2774
2789
  ): void
2775
2790
  addEventListener(
2776
2791
  method: 'open',
2777
2792
  cb: (event: WebSocket_2.Event) => void,
2778
- options?: WebSocket_2.EventListenerOptions
2793
+ options?: WebSocket_2.EventListenerOptions,
2779
2794
  ): void
2780
2795
 
2781
2796
  removeEventListener(
2782
2797
  method: 'message',
2783
- cb: (event: WebSocket_2.MessageEvent) => void
2798
+ cb: (event: WebSocket_2.MessageEvent) => void,
2784
2799
  ): void
2785
2800
  removeEventListener(
2786
2801
  method: 'close',
2787
- cb: (event: WebSocket_2.CloseEvent) => void
2802
+ cb: (event: WebSocket_2.CloseEvent) => void,
2788
2803
  ): void
2789
2804
  removeEventListener(
2790
2805
  method: 'error',
2791
- cb: (event: WebSocket_2.ErrorEvent) => void
2806
+ cb: (event: WebSocket_2.ErrorEvent) => void,
2792
2807
  ): void
2793
2808
  removeEventListener(
2794
2809
  method: 'open',
2795
- cb: (event: WebSocket_2.Event) => void
2810
+ cb: (event: WebSocket_2.Event) => void,
2796
2811
  ): void
2797
2812
 
2798
2813
  // Events
2799
2814
  on(
2800
2815
  event: 'close',
2801
- listener: (this: WebSocket_2, code: number, reason: Buffer) => void
2816
+ listener: (this: WebSocket_2, code: number, reason: Buffer) => void,
2802
2817
  ): this
2803
2818
  on(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
2804
2819
  on(
2805
2820
  event: 'upgrade',
2806
- listener: (this: WebSocket_2, request: IncomingMessage) => void
2821
+ listener: (this: WebSocket_2, request: IncomingMessage) => void,
2807
2822
  ): this
2808
2823
  on(
2809
2824
  event: 'message',
2810
2825
  listener: (
2811
2826
  this: WebSocket_2,
2812
2827
  data: WebSocket_2.RawData,
2813
- isBinary: boolean
2814
- ) => void
2828
+ isBinary: boolean,
2829
+ ) => void,
2815
2830
  ): this
2816
2831
  on(event: 'open', listener: (this: WebSocket_2) => void): this
2817
2832
  on(
2818
2833
  event: 'ping' | 'pong',
2819
- listener: (this: WebSocket_2, data: Buffer) => void
2834
+ listener: (this: WebSocket_2, data: Buffer) => void,
2820
2835
  ): this
2821
2836
  on(
2822
2837
  event: 'unexpected-response',
2823
2838
  listener: (
2824
2839
  this: WebSocket_2,
2825
2840
  request: ClientRequest,
2826
- response: IncomingMessage
2827
- ) => void
2841
+ response: IncomingMessage,
2842
+ ) => void,
2828
2843
  ): this
2829
2844
  on(
2830
2845
  event: string | symbol,
2831
- listener: (this: WebSocket_2, ...args: any[]) => void
2846
+ listener: (this: WebSocket_2, ...args: any[]) => void,
2832
2847
  ): this
2833
2848
 
2834
2849
  once(
2835
2850
  event: 'close',
2836
- listener: (this: WebSocket_2, code: number, reason: Buffer) => void
2851
+ listener: (this: WebSocket_2, code: number, reason: Buffer) => void,
2837
2852
  ): this
2838
2853
  once(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
2839
2854
  once(
2840
2855
  event: 'upgrade',
2841
- listener: (this: WebSocket_2, request: IncomingMessage) => void
2856
+ listener: (this: WebSocket_2, request: IncomingMessage) => void,
2842
2857
  ): this
2843
2858
  once(
2844
2859
  event: 'message',
2845
2860
  listener: (
2846
2861
  this: WebSocket_2,
2847
2862
  data: WebSocket_2.RawData,
2848
- isBinary: boolean
2849
- ) => void
2863
+ isBinary: boolean,
2864
+ ) => void,
2850
2865
  ): this
2851
2866
  once(event: 'open', listener: (this: WebSocket_2) => void): this
2852
2867
  once(
2853
2868
  event: 'ping' | 'pong',
2854
- listener: (this: WebSocket_2, data: Buffer) => void
2869
+ listener: (this: WebSocket_2, data: Buffer) => void,
2855
2870
  ): this
2856
2871
  once(
2857
2872
  event: 'unexpected-response',
2858
2873
  listener: (
2859
2874
  this: WebSocket_2,
2860
2875
  request: ClientRequest,
2861
- response: IncomingMessage
2862
- ) => void
2876
+ response: IncomingMessage,
2877
+ ) => void,
2863
2878
  ): this
2864
2879
  once(
2865
2880
  event: string | symbol,
2866
- listener: (this: WebSocket_2, ...args: any[]) => void
2881
+ listener: (this: WebSocket_2, ...args: any[]) => void,
2867
2882
  ): this
2868
2883
 
2869
2884
  off(
2870
2885
  event: 'close',
2871
- listener: (this: WebSocket_2, code: number, reason: Buffer) => void
2886
+ listener: (this: WebSocket_2, code: number, reason: Buffer) => void,
2872
2887
  ): this
2873
2888
  off(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
2874
2889
  off(
2875
2890
  event: 'upgrade',
2876
- listener: (this: WebSocket_2, request: IncomingMessage) => void
2891
+ listener: (this: WebSocket_2, request: IncomingMessage) => void,
2877
2892
  ): this
2878
2893
  off(
2879
2894
  event: 'message',
2880
2895
  listener: (
2881
2896
  this: WebSocket_2,
2882
2897
  data: WebSocket_2.RawData,
2883
- isBinary: boolean
2884
- ) => void
2898
+ isBinary: boolean,
2899
+ ) => void,
2885
2900
  ): this
2886
2901
  off(event: 'open', listener: (this: WebSocket_2) => void): this
2887
2902
  off(
2888
2903
  event: 'ping' | 'pong',
2889
- listener: (this: WebSocket_2, data: Buffer) => void
2904
+ listener: (this: WebSocket_2, data: Buffer) => void,
2890
2905
  ): this
2891
2906
  off(
2892
2907
  event: 'unexpected-response',
2893
2908
  listener: (
2894
2909
  this: WebSocket_2,
2895
2910
  request: ClientRequest,
2896
- response: IncomingMessage
2897
- ) => void
2911
+ response: IncomingMessage,
2912
+ ) => void,
2898
2913
  ): this
2899
2914
  off(
2900
2915
  event: string | symbol,
2901
- listener: (this: WebSocket_2, ...args: any[]) => void
2916
+ listener: (this: WebSocket_2, ...args: any[]) => void,
2902
2917
  ): this
2903
2918
 
2904
2919
  addListener(
2905
2920
  event: 'close',
2906
- listener: (code: number, reason: Buffer) => void
2921
+ listener: (code: number, reason: Buffer) => void,
2907
2922
  ): this
2908
2923
  addListener(event: 'error', listener: (err: Error) => void): this
2909
2924
  addListener(
2910
2925
  event: 'upgrade',
2911
- listener: (request: IncomingMessage) => void
2926
+ listener: (request: IncomingMessage) => void,
2912
2927
  ): this
2913
2928
  addListener(
2914
2929
  event: 'message',
2915
- listener: (data: WebSocket_2.RawData, isBinary: boolean) => void
2930
+ listener: (data: WebSocket_2.RawData, isBinary: boolean) => void,
2916
2931
  ): this
2917
2932
  addListener(event: 'open', listener: () => void): this
2918
2933
  addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
2919
2934
  addListener(
2920
2935
  event: 'unexpected-response',
2921
- listener: (request: ClientRequest, response: IncomingMessage) => void
2936
+ listener: (request: ClientRequest, response: IncomingMessage) => void,
2922
2937
  ): this
2923
2938
  addListener(event: string | symbol, listener: (...args: any[]) => void): this
2924
2939
 
2925
2940
  removeListener(
2926
2941
  event: 'close',
2927
- listener: (code: number, reason: Buffer) => void
2942
+ listener: (code: number, reason: Buffer) => void,
2928
2943
  ): this
2929
2944
  removeListener(event: 'error', listener: (err: Error) => void): this
2930
2945
  removeListener(
2931
2946
  event: 'upgrade',
2932
- listener: (request: IncomingMessage) => void
2947
+ listener: (request: IncomingMessage) => void,
2933
2948
  ): this
2934
2949
  removeListener(
2935
2950
  event: 'message',
2936
- listener: (data: WebSocket_2.RawData, isBinary: boolean) => void
2951
+ listener: (data: WebSocket_2.RawData, isBinary: boolean) => void,
2937
2952
  ): this
2938
2953
  removeListener(event: 'open', listener: () => void): this
2939
2954
  removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
2940
2955
  removeListener(
2941
2956
  event: 'unexpected-response',
2942
- listener: (request: ClientRequest, response: IncomingMessage) => void
2957
+ listener: (request: ClientRequest, response: IncomingMessage) => void,
2943
2958
  ): this
2944
2959
  removeListener(
2945
2960
  event: string | symbol,
2946
- listener: (...args: any[]) => void
2961
+ listener: (...args: any[]) => void,
2947
2962
  ): this
2948
2963
  }
2949
2964
 
@@ -2985,8 +3000,8 @@ declare namespace WebSocket_2 {
2985
3000
  res: boolean,
2986
3001
  code?: number,
2987
3002
  message?: string,
2988
- headers?: OutgoingHttpHeaders
2989
- ) => void
3003
+ headers?: OutgoingHttpHeaders,
3004
+ ) => void,
2990
3005
  ) => void
2991
3006
 
2992
3007
  interface ClientOptions extends SecureContextOptions {
@@ -3073,7 +3088,7 @@ declare namespace WebSocket_2 {
3073
3088
  | undefined
3074
3089
  handleProtocols?: (
3075
3090
  protocols: Set<string>,
3076
- request: IncomingMessage
3091
+ request: IncomingMessage,
3077
3092
  ) => string | false
3078
3093
  path?: string | undefined
3079
3094
  noServer?: boolean | undefined
@@ -3104,81 +3119,93 @@ declare namespace WebSocket_2 {
3104
3119
  request: IncomingMessage,
3105
3120
  socket: Duplex,
3106
3121
  upgradeHead: Buffer,
3107
- callback: (client: T, request: IncomingMessage) => void
3122
+ callback: (client: T, request: IncomingMessage) => void,
3108
3123
  ): void
3109
3124
  shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
3110
3125
 
3111
3126
  // Events
3112
3127
  on(
3113
3128
  event: 'connection',
3114
- cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
3129
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
3115
3130
  ): this
3116
3131
  on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
3117
3132
  on(
3118
3133
  event: 'headers',
3119
- cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
3134
+ cb: (
3135
+ this: Server<T>,
3136
+ headers: string[],
3137
+ request: IncomingMessage,
3138
+ ) => void,
3120
3139
  ): this
3121
3140
  on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
3122
3141
  on(
3123
3142
  event: string | symbol,
3124
- listener: (this: Server<T>, ...args: any[]) => void
3143
+ listener: (this: Server<T>, ...args: any[]) => void,
3125
3144
  ): this
3126
3145
 
3127
3146
  once(
3128
3147
  event: 'connection',
3129
- cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
3148
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
3130
3149
  ): this
3131
3150
  once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
3132
3151
  once(
3133
3152
  event: 'headers',
3134
- cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
3153
+ cb: (
3154
+ this: Server<T>,
3155
+ headers: string[],
3156
+ request: IncomingMessage,
3157
+ ) => void,
3135
3158
  ): this
3136
3159
  once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
3137
3160
  once(
3138
3161
  event: string | symbol,
3139
- listener: (this: Server<T>, ...args: any[]) => void
3162
+ listener: (this: Server<T>, ...args: any[]) => void,
3140
3163
  ): this
3141
3164
 
3142
3165
  off(
3143
3166
  event: 'connection',
3144
- cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
3167
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
3145
3168
  ): this
3146
3169
  off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
3147
3170
  off(
3148
3171
  event: 'headers',
3149
- cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
3172
+ cb: (
3173
+ this: Server<T>,
3174
+ headers: string[],
3175
+ request: IncomingMessage,
3176
+ ) => void,
3150
3177
  ): this
3151
3178
  off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
3152
3179
  off(
3153
3180
  event: string | symbol,
3154
- listener: (this: Server<T>, ...args: any[]) => void
3181
+ listener: (this: Server<T>, ...args: any[]) => void,
3155
3182
  ): this
3156
3183
 
3157
3184
  addListener(
3158
3185
  event: 'connection',
3159
- cb: (client: T, request: IncomingMessage) => void
3186
+ cb: (client: T, request: IncomingMessage) => void,
3160
3187
  ): this
3161
3188
  addListener(event: 'error', cb: (err: Error) => void): this
3162
3189
  addListener(
3163
3190
  event: 'headers',
3164
- cb: (headers: string[], request: IncomingMessage) => void
3191
+ cb: (headers: string[], request: IncomingMessage) => void,
3165
3192
  ): this
3166
3193
  addListener(event: 'close' | 'listening', cb: () => void): this
3167
3194
  addListener(
3168
3195
  event: string | symbol,
3169
- listener: (...args: any[]) => void
3196
+ listener: (...args: any[]) => void,
3170
3197
  ): this
3171
3198
 
3172
3199
  removeListener(event: 'connection', cb: (client: T) => void): this
3173
3200
  removeListener(event: 'error', cb: (err: Error) => void): this
3174
3201
  removeListener(
3175
3202
  event: 'headers',
3176
- cb: (headers: string[], request: IncomingMessage) => void
3203
+ cb: (headers: string[], request: IncomingMessage) => void,
3177
3204
  ): this
3178
3205
  removeListener(event: 'close' | 'listening', cb: () => void): this
3179
3206
  removeListener(
3180
3207
  event: string | symbol,
3181
- listener: (...args: any[]) => void
3208
+ listener: (...args: any[]) => void,
3182
3209
  ): this
3183
3210
  }
3184
3211
 
@@ -3190,7 +3217,7 @@ declare namespace WebSocket_2 {
3190
3217
  // WebSocket stream
3191
3218
  function createWebSocketStream(
3192
3219
  websocket: WebSocket,
3193
- options?: DuplexOptions
3220
+ options?: DuplexOptions,
3194
3221
  ): Duplex
3195
3222
  }
3196
3223
  export { WebSocket_2 as WebSocket }