vite 3.1.4 → 3.2.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.
package/types/ws.d.ts CHANGED
@@ -1,553 +1 @@
1
- // Modified and inlined to avoid extra dependency
2
- // Source: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ws/index.d.ts
3
-
4
- // Type definitions for ws 8.5
5
- // Project: https://github.com/websockets/ws
6
- // Definitions by: Paul Loyd <https://github.com/loyd>
7
- // Margus Lamp <https://github.com/mlamp>
8
- // Philippe D'Alva <https://github.com/TitaneBoy>
9
- // reduckted <https://github.com/reduckted>
10
- // teidesu <https://github.com/teidesu>
11
- // Bartosz Wojtkowiak <https://github.com/wojtkowiak>
12
- // Kyle Hensel <https://github.com/k-yle>
13
- // Samuel Skeen <https://github.com/cwadrupldijjit>
14
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
15
-
16
- /// <reference types="node" />
17
-
18
- import { EventEmitter } from 'node:events'
19
- import type {
20
- Agent,
21
- ClientRequest,
22
- ClientRequestArgs,
23
- Server as HTTPServer,
24
- IncomingMessage,
25
- OutgoingHttpHeaders
26
- } from 'node:http'
27
- import type { Server as HTTPSServer } from 'node:https'
28
- import type { Duplex, DuplexOptions } from 'node:stream'
29
- import type { SecureContextOptions } from 'node:tls'
30
- import type { URL } from 'node:url'
31
- import type { ZlibOptions } from 'node:zlib'
32
-
33
- // WebSocket socket.
34
- declare class WebSocket extends EventEmitter {
35
- /** The connection is not yet open. */
36
- static readonly CONNECTING: 0
37
- /** The connection is open and ready to communicate. */
38
- static readonly OPEN: 1
39
- /** The connection is in the process of closing. */
40
- static readonly CLOSING: 2
41
- /** The connection is closed. */
42
- static readonly CLOSED: 3
43
-
44
- binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
45
- readonly bufferedAmount: number
46
- readonly extensions: string
47
- /** Indicates whether the websocket is paused */
48
- readonly isPaused: boolean
49
- readonly protocol: string
50
- /** The current state of the connection */
51
- readonly readyState:
52
- | typeof WebSocket.CONNECTING
53
- | typeof WebSocket.OPEN
54
- | typeof WebSocket.CLOSING
55
- | typeof WebSocket.CLOSED
56
- readonly url: string
57
-
58
- /** The connection is not yet open. */
59
- readonly CONNECTING: 0
60
- /** The connection is open and ready to communicate. */
61
- readonly OPEN: 1
62
- /** The connection is in the process of closing. */
63
- readonly CLOSING: 2
64
- /** The connection is closed. */
65
- readonly CLOSED: 3
66
-
67
- onopen: ((event: WebSocket.Event) => void) | null
68
- onerror: ((event: WebSocket.ErrorEvent) => void) | null
69
- onclose: ((event: WebSocket.CloseEvent) => void) | null
70
- onmessage: ((event: WebSocket.MessageEvent) => void) | null
71
-
72
- constructor(address: null)
73
- constructor(
74
- address: string | URL,
75
- options?: WebSocket.ClientOptions | ClientRequestArgs
76
- )
77
- constructor(
78
- address: string | URL,
79
- protocols?: string | string[],
80
- options?: WebSocket.ClientOptions | ClientRequestArgs
81
- )
82
-
83
- close(code?: number, data?: string | Buffer): void
84
- ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void
85
- pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void
86
- send(data: any, cb?: (err?: Error) => void): void
87
- send(
88
- data: any,
89
- options: {
90
- mask?: boolean | undefined
91
- binary?: boolean | undefined
92
- compress?: boolean | undefined
93
- fin?: boolean | undefined
94
- },
95
- cb?: (err?: Error) => void
96
- ): void
97
- terminate(): void
98
-
99
- /**
100
- * Pause the websocket causing it to stop emitting events. Some events can still be
101
- * emitted after this is called, until all buffered data is consumed. This method
102
- * is a noop if the ready state is `CONNECTING` or `CLOSED`.
103
- */
104
- pause(): void
105
- /**
106
- * Make a paused socket resume emitting events. This method is a noop if the ready
107
- * state is `CONNECTING` or `CLOSED`.
108
- */
109
- resume(): void
110
-
111
- // HTML5 WebSocket events
112
- addEventListener(
113
- method: 'message',
114
- cb: (event: WebSocket.MessageEvent) => void,
115
- options?: WebSocket.EventListenerOptions
116
- ): void
117
- addEventListener(
118
- method: 'close',
119
- cb: (event: WebSocket.CloseEvent) => void,
120
- options?: WebSocket.EventListenerOptions
121
- ): void
122
- addEventListener(
123
- method: 'error',
124
- cb: (event: WebSocket.ErrorEvent) => void,
125
- options?: WebSocket.EventListenerOptions
126
- ): void
127
- addEventListener(
128
- method: 'open',
129
- cb: (event: WebSocket.Event) => void,
130
- options?: WebSocket.EventListenerOptions
131
- ): void
132
-
133
- removeEventListener(
134
- method: 'message',
135
- cb: (event: WebSocket.MessageEvent) => void
136
- ): void
137
- removeEventListener(
138
- method: 'close',
139
- cb: (event: WebSocket.CloseEvent) => void
140
- ): void
141
- removeEventListener(
142
- method: 'error',
143
- cb: (event: WebSocket.ErrorEvent) => void
144
- ): void
145
- removeEventListener(
146
- method: 'open',
147
- cb: (event: WebSocket.Event) => void
148
- ): void
149
-
150
- // Events
151
- on(
152
- event: 'close',
153
- listener: (this: WebSocket, code: number, reason: Buffer) => void
154
- ): this
155
- on(event: 'error', listener: (this: WebSocket, err: Error) => void): this
156
- on(
157
- event: 'upgrade',
158
- listener: (this: WebSocket, request: IncomingMessage) => void
159
- ): this
160
- on(
161
- event: 'message',
162
- listener: (
163
- this: WebSocket,
164
- data: WebSocket.RawData,
165
- isBinary: boolean
166
- ) => void
167
- ): this
168
- on(event: 'open', listener: (this: WebSocket) => void): this
169
- on(
170
- event: 'ping' | 'pong',
171
- listener: (this: WebSocket, data: Buffer) => void
172
- ): this
173
- on(
174
- event: 'unexpected-response',
175
- listener: (
176
- this: WebSocket,
177
- request: ClientRequest,
178
- response: IncomingMessage
179
- ) => void
180
- ): this
181
- on(
182
- event: string | symbol,
183
- listener: (this: WebSocket, ...args: any[]) => void
184
- ): this
185
-
186
- once(
187
- event: 'close',
188
- listener: (this: WebSocket, code: number, reason: Buffer) => void
189
- ): this
190
- once(event: 'error', listener: (this: WebSocket, err: Error) => void): this
191
- once(
192
- event: 'upgrade',
193
- listener: (this: WebSocket, request: IncomingMessage) => void
194
- ): this
195
- once(
196
- event: 'message',
197
- listener: (
198
- this: WebSocket,
199
- data: WebSocket.RawData,
200
- isBinary: boolean
201
- ) => void
202
- ): this
203
- once(event: 'open', listener: (this: WebSocket) => void): this
204
- once(
205
- event: 'ping' | 'pong',
206
- listener: (this: WebSocket, data: Buffer) => void
207
- ): this
208
- once(
209
- event: 'unexpected-response',
210
- listener: (
211
- this: WebSocket,
212
- request: ClientRequest,
213
- response: IncomingMessage
214
- ) => void
215
- ): this
216
- once(
217
- event: string | symbol,
218
- listener: (this: WebSocket, ...args: any[]) => void
219
- ): this
220
-
221
- off(
222
- event: 'close',
223
- listener: (this: WebSocket, code: number, reason: Buffer) => void
224
- ): this
225
- off(event: 'error', listener: (this: WebSocket, err: Error) => void): this
226
- off(
227
- event: 'upgrade',
228
- listener: (this: WebSocket, request: IncomingMessage) => void
229
- ): this
230
- off(
231
- event: 'message',
232
- listener: (
233
- this: WebSocket,
234
- data: WebSocket.RawData,
235
- isBinary: boolean
236
- ) => void
237
- ): this
238
- off(event: 'open', listener: (this: WebSocket) => void): this
239
- off(
240
- event: 'ping' | 'pong',
241
- listener: (this: WebSocket, data: Buffer) => void
242
- ): this
243
- off(
244
- event: 'unexpected-response',
245
- listener: (
246
- this: WebSocket,
247
- request: ClientRequest,
248
- response: IncomingMessage
249
- ) => void
250
- ): this
251
- off(
252
- event: string | symbol,
253
- listener: (this: WebSocket, ...args: any[]) => void
254
- ): this
255
-
256
- addListener(
257
- event: 'close',
258
- listener: (code: number, reason: Buffer) => void
259
- ): this
260
- addListener(event: 'error', listener: (err: Error) => void): this
261
- addListener(
262
- event: 'upgrade',
263
- listener: (request: IncomingMessage) => void
264
- ): this
265
- addListener(
266
- event: 'message',
267
- listener: (data: WebSocket.RawData, isBinary: boolean) => void
268
- ): this
269
- addListener(event: 'open', listener: () => void): this
270
- addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
271
- addListener(
272
- event: 'unexpected-response',
273
- listener: (request: ClientRequest, response: IncomingMessage) => void
274
- ): this
275
- addListener(event: string | symbol, listener: (...args: any[]) => void): this
276
-
277
- removeListener(
278
- event: 'close',
279
- listener: (code: number, reason: Buffer) => void
280
- ): this
281
- removeListener(event: 'error', listener: (err: Error) => void): this
282
- removeListener(
283
- event: 'upgrade',
284
- listener: (request: IncomingMessage) => void
285
- ): this
286
- removeListener(
287
- event: 'message',
288
- listener: (data: WebSocket.RawData, isBinary: boolean) => void
289
- ): this
290
- removeListener(event: 'open', listener: () => void): this
291
- removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
292
- removeListener(
293
- event: 'unexpected-response',
294
- listener: (request: ClientRequest, response: IncomingMessage) => void
295
- ): this
296
- removeListener(
297
- event: string | symbol,
298
- listener: (...args: any[]) => void
299
- ): this
300
- }
301
-
302
- declare const WebSocketAlias: typeof WebSocket
303
- interface WebSocketAlias extends WebSocket {} // tslint:disable-line no-empty-interface
304
-
305
- declare namespace WebSocket {
306
- /**
307
- * Data represents the raw message payload received over the WebSocket.
308
- */
309
- type RawData = Buffer | ArrayBuffer | Buffer[]
310
-
311
- /**
312
- * Data represents the message payload received over the WebSocket.
313
- */
314
- type Data = string | Buffer | ArrayBuffer | Buffer[]
315
-
316
- /**
317
- * CertMeta represents the accepted types for certificate & key data.
318
- */
319
- type CertMeta = string | string[] | Buffer | Buffer[]
320
-
321
- /**
322
- * VerifyClientCallbackSync is a synchronous callback used to inspect the
323
- * incoming message. The return value (boolean) of the function determines
324
- * whether or not to accept the handshake.
325
- */
326
- type VerifyClientCallbackSync = (info: {
327
- origin: string
328
- secure: boolean
329
- req: IncomingMessage
330
- }) => boolean
331
-
332
- /**
333
- * VerifyClientCallbackAsync is an asynchronous callback used to inspect the
334
- * incoming message. The return value (boolean) of the function determines
335
- * whether or not to accept the handshake.
336
- */
337
- type VerifyClientCallbackAsync = (
338
- info: { origin: string; secure: boolean; req: IncomingMessage },
339
- callback: (
340
- res: boolean,
341
- code?: number,
342
- message?: string,
343
- headers?: OutgoingHttpHeaders
344
- ) => void
345
- ) => void
346
-
347
- interface ClientOptions extends SecureContextOptions {
348
- protocol?: string | undefined
349
- followRedirects?: boolean | undefined
350
- generateMask?(mask: Buffer): void
351
- handshakeTimeout?: number | undefined
352
- maxRedirects?: number | undefined
353
- perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
354
- localAddress?: string | undefined
355
- protocolVersion?: number | undefined
356
- headers?: { [key: string]: string } | undefined
357
- origin?: string | undefined
358
- agent?: Agent | undefined
359
- host?: string | undefined
360
- family?: number | undefined
361
- checkServerIdentity?(servername: string, cert: CertMeta): boolean
362
- rejectUnauthorized?: boolean | undefined
363
- maxPayload?: number | undefined
364
- skipUTF8Validation?: boolean | undefined
365
- }
366
-
367
- interface PerMessageDeflateOptions {
368
- serverNoContextTakeover?: boolean | undefined
369
- clientNoContextTakeover?: boolean | undefined
370
- serverMaxWindowBits?: number | undefined
371
- clientMaxWindowBits?: number | undefined
372
- zlibDeflateOptions?:
373
- | {
374
- flush?: number | undefined
375
- finishFlush?: number | undefined
376
- chunkSize?: number | undefined
377
- windowBits?: number | undefined
378
- level?: number | undefined
379
- memLevel?: number | undefined
380
- strategy?: number | undefined
381
- dictionary?: Buffer | Buffer[] | DataView | undefined
382
- info?: boolean | undefined
383
- }
384
- | undefined
385
- zlibInflateOptions?: ZlibOptions | undefined
386
- threshold?: number | undefined
387
- concurrencyLimit?: number | undefined
388
- }
389
-
390
- interface Event {
391
- type: string
392
- target: WebSocket
393
- }
394
-
395
- interface ErrorEvent {
396
- error: any
397
- message: string
398
- type: string
399
- target: WebSocket
400
- }
401
-
402
- interface CloseEvent {
403
- wasClean: boolean
404
- code: number
405
- reason: string
406
- type: string
407
- target: WebSocket
408
- }
409
-
410
- interface MessageEvent {
411
- data: Data
412
- type: string
413
- target: WebSocket
414
- }
415
-
416
- interface EventListenerOptions {
417
- once?: boolean | undefined
418
- }
419
-
420
- interface ServerOptions {
421
- host?: string | undefined
422
- port?: number | undefined
423
- backlog?: number | undefined
424
- server?: HTTPServer | HTTPSServer | undefined
425
- verifyClient?:
426
- | VerifyClientCallbackAsync
427
- | VerifyClientCallbackSync
428
- | undefined
429
- handleProtocols?: (
430
- protocols: Set<string>,
431
- request: IncomingMessage
432
- ) => string | false
433
- path?: string | undefined
434
- noServer?: boolean | undefined
435
- clientTracking?: boolean | undefined
436
- perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
437
- maxPayload?: number | undefined
438
- skipUTF8Validation?: boolean | undefined
439
- WebSocket?: typeof WebSocket.WebSocket | undefined
440
- }
441
-
442
- interface AddressInfo {
443
- address: string
444
- family: string
445
- port: number
446
- }
447
-
448
- // WebSocket Server
449
- class Server<T extends WebSocket = WebSocket> extends EventEmitter {
450
- options: ServerOptions
451
- path: string
452
- clients: Set<T>
453
-
454
- constructor(options?: ServerOptions, callback?: () => void)
455
-
456
- address(): AddressInfo | string
457
- close(cb?: (err?: Error) => void): void
458
- handleUpgrade(
459
- request: IncomingMessage,
460
- socket: Duplex,
461
- upgradeHead: Buffer,
462
- callback: (client: T, request: IncomingMessage) => void
463
- ): void
464
- shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
465
-
466
- // Events
467
- on(
468
- event: 'connection',
469
- cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
470
- ): this
471
- on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
472
- on(
473
- event: 'headers',
474
- cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
475
- ): this
476
- on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
477
- on(
478
- event: string | symbol,
479
- listener: (this: Server<T>, ...args: any[]) => void
480
- ): this
481
-
482
- once(
483
- event: 'connection',
484
- cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
485
- ): this
486
- once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
487
- once(
488
- event: 'headers',
489
- cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
490
- ): this
491
- once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
492
- once(
493
- event: string | symbol,
494
- listener: (this: Server<T>, ...args: any[]) => void
495
- ): this
496
-
497
- off(
498
- event: 'connection',
499
- cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
500
- ): this
501
- off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
502
- off(
503
- event: 'headers',
504
- cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
505
- ): this
506
- off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
507
- off(
508
- event: string | symbol,
509
- listener: (this: Server<T>, ...args: any[]) => void
510
- ): this
511
-
512
- addListener(
513
- event: 'connection',
514
- cb: (client: T, request: IncomingMessage) => void
515
- ): this
516
- addListener(event: 'error', cb: (err: Error) => void): this
517
- addListener(
518
- event: 'headers',
519
- cb: (headers: string[], request: IncomingMessage) => void
520
- ): this
521
- addListener(event: 'close' | 'listening', cb: () => void): this
522
- addListener(
523
- event: string | symbol,
524
- listener: (...args: any[]) => void
525
- ): this
526
-
527
- removeListener(event: 'connection', cb: (client: T) => void): this
528
- removeListener(event: 'error', cb: (err: Error) => void): this
529
- removeListener(
530
- event: 'headers',
531
- cb: (headers: string[], request: IncomingMessage) => void
532
- ): this
533
- removeListener(event: 'close' | 'listening', cb: () => void): this
534
- removeListener(
535
- event: string | symbol,
536
- listener: (...args: any[]) => void
537
- ): this
538
- }
539
-
540
- const WebSocketServer: typeof Server
541
- interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
542
- const WebSocket: typeof WebSocketAlias
543
- interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
544
-
545
- // WebSocket stream
546
- function createWebSocketStream(
547
- websocket: WebSocket,
548
- options?: DuplexOptions
549
- ): Duplex
550
- }
551
-
552
- // export = WebSocket
553
- export { WebSocket, WebSocketAlias }
1
+ export type { WebSocket, WebSocketAlias } from '../dist/node'
@@ -1,3 +0,0 @@
1
- {
2
- "//": "this file is just here to make pnpm happy with --frozen-lockfile"
3
- }
package/types/shims.d.ts DELETED
@@ -1,96 +0,0 @@
1
- declare module 'connect' {
2
- const connect: () => any
3
- export = connect
4
- }
5
-
6
- declare module 'cors' {
7
- function cors(options: any): any
8
- export = cors
9
- }
10
-
11
- declare module 'selfsigned' {
12
- export function generate(attrs: any, options: any, done?: any): any
13
- }
14
-
15
- declare module 'http-proxy' {
16
- const proxy: any
17
- export = proxy
18
- }
19
-
20
- declare module 'connect-history-api-fallback' {
21
- const plugin: any
22
- export = plugin
23
- }
24
-
25
- declare module 'launch-editor-middleware' {
26
- const plugin: any
27
- export = plugin
28
- }
29
-
30
- declare module 'postcss-load-config' {
31
- import type { Plugin, ProcessOptions } from 'postcss'
32
- function load(
33
- inline: any,
34
- root: string
35
- ): Promise<{
36
- options: ProcessOptions
37
- plugins: Plugin[]
38
- }>
39
- export = load
40
- }
41
-
42
- declare module 'postcss-import' {
43
- import type { Plugin } from 'postcss'
44
- const plugin: (options: {
45
- resolve: (
46
- id: string,
47
- basedir: string,
48
- importOptions: any
49
- ) => string | string[] | Promise<string | string[]>
50
- nameLayer: (index: number, rootFilename: string) => string
51
- }) => Plugin
52
- export = plugin
53
- }
54
-
55
- declare module 'postcss-modules' {
56
- import type { Plugin } from 'postcss'
57
- const plugin: (options: any) => Plugin
58
- export = plugin
59
- }
60
-
61
- declare module '@rollup/plugin-dynamic-import-vars' {
62
- import type { Plugin } from 'rollup'
63
- import type { BaseNode } from 'estree'
64
-
65
- interface Options {
66
- include?: string | RegExp | (string | RegExp)[]
67
- exclude?: string | RegExp | (string | RegExp)[]
68
- warnOnError?: boolean
69
- }
70
-
71
- const p: (o?: Options) => Plugin
72
- export default p
73
- export function dynamicImportToGlob(
74
- ast: BaseNode,
75
- source: string
76
- ): null | string
77
- }
78
-
79
- declare module 'rollup-plugin-web-worker-loader' {
80
- import type { Plugin } from 'rollup'
81
-
82
- interface Options {
83
- targetPlatform?: string
84
- pattern?: RegExp
85
- extensions?: string[]
86
- sourcemap?: boolean
87
- inline?: boolean
88
- }
89
-
90
- const p: (o?: Options) => Plugin
91
- export default p
92
- }
93
-
94
- // LESS' types somewhat references this which doesn't make sense in Node,
95
- // so we have to shim it
96
- declare interface HTMLLinkElement {}