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.
- package/LICENSE.md +3 -285
- package/dist/client/client.mjs +28 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-56143c31.js → dep-046b0a83.js} +4 -4
- package/dist/node/chunks/{dep-00df106d.js → dep-6899b575.js} +6 -6
- package/dist/node/chunks/{dep-9c153816.js → dep-7a52803b.js} +25114 -35140
- package/dist/node/chunks/{dep-383194a7.js → dep-a96b376f.js} +117 -9
- package/dist/node/chunks/{dep-ec2e68f4.js → dep-bcc0af00.js} +103 -25
- package/dist/node/cli.js +15 -15
- package/dist/node/index.d.ts +214 -47
- package/dist/node/index.js +128 -22
- package/dist/node/terser.js +90 -15
- package/package.json +23 -23
- package/src/client/client.ts +39 -34
- package/types/customEvent.d.ts +16 -5
- package/types/hot.d.ts +25 -0
- package/types/importMeta.d.ts +11 -46
- package/types/shims.d.ts +0 -5
- package/types/ws.d.ts +54 -29
package/types/importMeta.d.ts
CHANGED
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/consistent-type-imports */
|
|
6
6
|
|
|
7
|
-
// Duplicate import('../src/node/importGlob').
|
|
8
|
-
//
|
|
9
|
-
// in vite/client.d.ts and in production src/node/importGlob.ts doesn't exist
|
|
10
|
-
interface
|
|
7
|
+
// Duplicate of import('../src/node/importGlob').GlobOptions in order to
|
|
8
|
+
// avoid breaking the production client type. Because this file is referenced
|
|
9
|
+
// in vite/client.d.ts and in production src/node/importGlob.ts doesn't exist.
|
|
10
|
+
interface GlobOptions {
|
|
11
|
+
as?: string
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
11
15
|
assert?: {
|
|
12
16
|
type: string
|
|
13
17
|
}
|
|
@@ -16,57 +20,18 @@ interface AssertOptions {
|
|
|
16
20
|
interface ImportMeta {
|
|
17
21
|
url: string
|
|
18
22
|
|
|
19
|
-
readonly hot?:
|
|
20
|
-
readonly data: any
|
|
21
|
-
|
|
22
|
-
accept(): void
|
|
23
|
-
accept(cb: (mod: any) => void): void
|
|
24
|
-
accept(dep: string, cb: (mod: any) => void): void
|
|
25
|
-
accept(deps: readonly string[], cb: (mods: any[]) => void): void
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated
|
|
29
|
-
*/
|
|
30
|
-
acceptDeps(): never
|
|
31
|
-
|
|
32
|
-
dispose(cb: (data: any) => void): void
|
|
33
|
-
decline(): void
|
|
34
|
-
invalidate(): void
|
|
35
|
-
|
|
36
|
-
on: {
|
|
37
|
-
(
|
|
38
|
-
event: 'vite:beforeUpdate',
|
|
39
|
-
cb: (payload: import('./hmrPayload').UpdatePayload) => void
|
|
40
|
-
): void
|
|
41
|
-
(
|
|
42
|
-
event: 'vite:beforePrune',
|
|
43
|
-
cb: (payload: import('./hmrPayload').PrunePayload) => void
|
|
44
|
-
): void
|
|
45
|
-
(
|
|
46
|
-
event: 'vite:beforeFullReload',
|
|
47
|
-
cb: (payload: import('./hmrPayload').FullReloadPayload) => void
|
|
48
|
-
): void
|
|
49
|
-
(
|
|
50
|
-
event: 'vite:error',
|
|
51
|
-
cb: (payload: import('./hmrPayload').ErrorPayload) => void
|
|
52
|
-
): void
|
|
53
|
-
<T extends string>(
|
|
54
|
-
event: import('./customEvent').CustomEventName<T>,
|
|
55
|
-
cb: (data: any) => void
|
|
56
|
-
): void
|
|
57
|
-
}
|
|
58
|
-
}
|
|
23
|
+
readonly hot?: import('./hot').ViteHotContext
|
|
59
24
|
|
|
60
25
|
readonly env: ImportMetaEnv
|
|
61
26
|
|
|
62
27
|
glob<Module = { [key: string]: any }>(
|
|
63
28
|
pattern: string,
|
|
64
|
-
options?:
|
|
29
|
+
options?: GlobOptions
|
|
65
30
|
): Record<string, () => Promise<Module>>
|
|
66
31
|
|
|
67
32
|
globEager<Module = { [key: string]: any }>(
|
|
68
33
|
pattern: string,
|
|
69
|
-
options?:
|
|
34
|
+
options?: GlobOptions
|
|
70
35
|
): Record<string, Module>
|
|
71
36
|
}
|
|
72
37
|
|
package/types/shims.d.ts
CHANGED
|
@@ -93,11 +93,6 @@ declare module 'micromatch' {
|
|
|
93
93
|
): boolean
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
declare module 'compression' {
|
|
97
|
-
function compression(): any
|
|
98
|
-
export default compression
|
|
99
|
-
}
|
|
100
|
-
|
|
101
96
|
// LESS' types somewhat references this which doesn't make sense in Node,
|
|
102
97
|
// so we have to shim it
|
|
103
98
|
declare interface HTMLLinkElement {}
|
package/types/ws.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
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
|
|
2
5
|
// Project: https://github.com/websockets/ws
|
|
3
6
|
// Definitions by: Paul Loyd <https://github.com/loyd>
|
|
4
7
|
// Margus Lamp <https://github.com/mlamp>
|
|
@@ -7,6 +10,7 @@
|
|
|
7
10
|
// teidesu <https://github.com/teidesu>
|
|
8
11
|
// Bartosz Wojtkowiak <https://github.com/wojtkowiak>
|
|
9
12
|
// Kyle Hensel <https://github.com/k-yle>
|
|
13
|
+
// Samuel Skeen <https://github.com/cwadrupldijjit>
|
|
10
14
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
11
15
|
|
|
12
16
|
/// <reference types="node" />
|
|
@@ -40,6 +44,8 @@ declare class WebSocket extends EventEmitter {
|
|
|
40
44
|
binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
|
|
41
45
|
readonly bufferedAmount: number
|
|
42
46
|
readonly extensions: string
|
|
47
|
+
/** Indicates whether the websocket is paused */
|
|
48
|
+
readonly isPaused: boolean
|
|
43
49
|
readonly protocol: string
|
|
44
50
|
/** The current state of the connection */
|
|
45
51
|
readonly readyState:
|
|
@@ -58,11 +64,12 @@ declare class WebSocket extends EventEmitter {
|
|
|
58
64
|
/** The connection is closed. */
|
|
59
65
|
readonly CLOSED: 3
|
|
60
66
|
|
|
61
|
-
onopen: (event: WebSocket.Event) => void
|
|
62
|
-
onerror: (event: WebSocket.ErrorEvent) => void
|
|
63
|
-
onclose: (event: WebSocket.CloseEvent) => void
|
|
64
|
-
onmessage: (event: WebSocket.MessageEvent) => void
|
|
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
|
|
65
71
|
|
|
72
|
+
constructor(address: null)
|
|
66
73
|
constructor(
|
|
67
74
|
address: string | URL,
|
|
68
75
|
options?: WebSocket.ClientOptions | ClientRequestArgs
|
|
@@ -89,6 +96,18 @@ declare class WebSocket extends EventEmitter {
|
|
|
89
96
|
): void
|
|
90
97
|
terminate(): void
|
|
91
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
|
+
|
|
92
111
|
// HTML5 WebSocket events
|
|
93
112
|
addEventListener(
|
|
94
113
|
method: 'message',
|
|
@@ -281,7 +300,7 @@ declare class WebSocket extends EventEmitter {
|
|
|
281
300
|
}
|
|
282
301
|
|
|
283
302
|
declare const WebSocketAlias: typeof WebSocket
|
|
284
|
-
|
|
303
|
+
interface WebSocketAlias extends WebSocket {} // tslint:disable-line no-empty-interface
|
|
285
304
|
|
|
286
305
|
declare namespace WebSocket {
|
|
287
306
|
/**
|
|
@@ -328,6 +347,7 @@ declare namespace WebSocket {
|
|
|
328
347
|
interface ClientOptions extends SecureContextOptions {
|
|
329
348
|
protocol?: string | undefined
|
|
330
349
|
followRedirects?: boolean | undefined
|
|
350
|
+
generateMask?(mask: Buffer): void
|
|
331
351
|
handshakeTimeout?: number | undefined
|
|
332
352
|
maxRedirects?: number | undefined
|
|
333
353
|
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
|
|
@@ -341,6 +361,7 @@ declare namespace WebSocket {
|
|
|
341
361
|
checkServerIdentity?(servername: string, cert: CertMeta): boolean
|
|
342
362
|
rejectUnauthorized?: boolean | undefined
|
|
343
363
|
maxPayload?: number | undefined
|
|
364
|
+
skipUTF8Validation?: boolean | undefined
|
|
344
365
|
}
|
|
345
366
|
|
|
346
367
|
interface PerMessageDeflateOptions {
|
|
@@ -415,6 +436,7 @@ declare namespace WebSocket {
|
|
|
415
436
|
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
|
|
416
437
|
maxPayload?: number | undefined
|
|
417
438
|
skipUTF8Validation?: boolean | undefined
|
|
439
|
+
WebSocket?: typeof WebSocket.WebSocket | undefined
|
|
418
440
|
}
|
|
419
441
|
|
|
420
442
|
interface AddressInfo {
|
|
@@ -424,10 +446,10 @@ declare namespace WebSocket {
|
|
|
424
446
|
}
|
|
425
447
|
|
|
426
448
|
// WebSocket Server
|
|
427
|
-
class Server extends EventEmitter {
|
|
449
|
+
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
|
428
450
|
options: ServerOptions
|
|
429
451
|
path: string
|
|
430
|
-
clients: Set<
|
|
452
|
+
clients: Set<T>
|
|
431
453
|
|
|
432
454
|
constructor(options?: ServerOptions, callback?: () => void)
|
|
433
455
|
|
|
@@ -437,56 +459,59 @@ declare namespace WebSocket {
|
|
|
437
459
|
request: IncomingMessage,
|
|
438
460
|
socket: Duplex,
|
|
439
461
|
upgradeHead: Buffer,
|
|
440
|
-
callback: (client:
|
|
462
|
+
callback: (client: T, request: IncomingMessage) => void
|
|
441
463
|
): void
|
|
442
464
|
shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
|
|
443
465
|
|
|
444
466
|
// Events
|
|
445
467
|
on(
|
|
446
468
|
event: 'connection',
|
|
447
|
-
cb: (this: Server
|
|
469
|
+
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
|
|
448
470
|
): this
|
|
449
|
-
on(event: 'error', cb: (this: Server
|
|
471
|
+
on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
|
|
450
472
|
on(
|
|
451
473
|
event: 'headers',
|
|
452
|
-
cb: (this: Server
|
|
474
|
+
cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
|
|
453
475
|
): this
|
|
454
|
-
on(event: 'close' | 'listening', cb: (this: Server) => void): this
|
|
476
|
+
on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
|
|
455
477
|
on(
|
|
456
478
|
event: string | symbol,
|
|
457
|
-
listener: (this: Server
|
|
479
|
+
listener: (this: Server<T>, ...args: any[]) => void
|
|
458
480
|
): this
|
|
459
481
|
|
|
460
482
|
once(
|
|
461
483
|
event: 'connection',
|
|
462
|
-
cb: (this: Server
|
|
484
|
+
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
|
|
463
485
|
): this
|
|
464
|
-
once(event: 'error', cb: (this: Server
|
|
486
|
+
once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
|
|
465
487
|
once(
|
|
466
488
|
event: 'headers',
|
|
467
|
-
cb: (this: Server
|
|
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
|
|
468
495
|
): this
|
|
469
|
-
once(event: 'close' | 'listening', cb: (this: Server) => void): this
|
|
470
|
-
once(event: string | symbol, listener: (...args: any[]) => void): this
|
|
471
496
|
|
|
472
497
|
off(
|
|
473
498
|
event: 'connection',
|
|
474
|
-
cb: (this: Server
|
|
499
|
+
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
|
|
475
500
|
): this
|
|
476
|
-
off(event: 'error', cb: (this: Server
|
|
501
|
+
off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
|
|
477
502
|
off(
|
|
478
503
|
event: 'headers',
|
|
479
|
-
cb: (this: Server
|
|
504
|
+
cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
|
|
480
505
|
): this
|
|
481
|
-
off(event: 'close' | 'listening', cb: (this: Server) => void): this
|
|
506
|
+
off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
|
|
482
507
|
off(
|
|
483
508
|
event: string | symbol,
|
|
484
|
-
listener: (this: Server
|
|
509
|
+
listener: (this: Server<T>, ...args: any[]) => void
|
|
485
510
|
): this
|
|
486
511
|
|
|
487
512
|
addListener(
|
|
488
513
|
event: 'connection',
|
|
489
|
-
cb: (client:
|
|
514
|
+
cb: (client: T, request: IncomingMessage) => void
|
|
490
515
|
): this
|
|
491
516
|
addListener(event: 'error', cb: (err: Error) => void): this
|
|
492
517
|
addListener(
|
|
@@ -499,7 +524,7 @@ declare namespace WebSocket {
|
|
|
499
524
|
listener: (...args: any[]) => void
|
|
500
525
|
): this
|
|
501
526
|
|
|
502
|
-
removeListener(event: 'connection', cb: (client:
|
|
527
|
+
removeListener(event: 'connection', cb: (client: T) => void): this
|
|
503
528
|
removeListener(event: 'error', cb: (err: Error) => void): this
|
|
504
529
|
removeListener(
|
|
505
530
|
event: 'headers',
|
|
@@ -513,9 +538,9 @@ declare namespace WebSocket {
|
|
|
513
538
|
}
|
|
514
539
|
|
|
515
540
|
const WebSocketServer: typeof Server
|
|
516
|
-
|
|
541
|
+
interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
|
|
517
542
|
const WebSocket: typeof WebSocketAlias
|
|
518
|
-
|
|
543
|
+
interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
|
|
519
544
|
|
|
520
545
|
// WebSocket stream
|
|
521
546
|
function createWebSocketStream(
|
|
@@ -524,5 +549,5 @@ declare namespace WebSocket {
|
|
|
524
549
|
): Duplex
|
|
525
550
|
}
|
|
526
551
|
|
|
527
|
-
//export = WebSocket
|
|
552
|
+
// export = WebSocket
|
|
528
553
|
export { WebSocket, WebSocketAlias }
|