vite 3.0.0-alpha.7 → 3.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.
- package/LICENSE.md +82 -3
- package/bin/vite.js +1 -1
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +51 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-395deadd.js → dep-3f55e00c.js} +21 -9
- package/dist/node/chunks/{dep-3a62832d.js → dep-50504393.js} +4 -4
- package/dist/node/chunks/{dep-17430d09.js → dep-58d622b1.js} +5 -5
- package/dist/node/chunks/{dep-e214e00e.js → dep-6736a7e2.js} +14878 -13115
- package/dist/node/chunks/{dep-16fa9be9.js → dep-926cae74.js} +7 -7
- package/dist/node/chunks/dep-e8ca8d40.js +3 -3
- package/dist/node/cli.js +24 -11
- package/dist/node/constants.js +22 -5
- package/dist/node/index.d.ts +188 -44
- package/dist/node/index.js +21 -8
- package/dist/node-cjs/publicUtils.cjs +2178 -29
- package/package.json +29 -28
- package/src/client/client.ts +95 -22
- package/types/chokidar.d.ts +2 -2
- package/types/connect.d.ts +1 -1
- package/types/hot.d.ts +17 -3
- package/types/http-proxy.d.ts +5 -5
- package/types/ws.d.ts +6 -6
- package/dist/node-cjs/terser.cjs +0 -32876
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -20,10 +20,7 @@
|
|
|
20
20
|
"./client": {
|
|
21
21
|
"types": "./client.d.ts"
|
|
22
22
|
},
|
|
23
|
-
"./dist/client/*": "./dist/client/*"
|
|
24
|
-
"./terser": {
|
|
25
|
-
"require": "./dist/node-cjs/terser.cjs"
|
|
26
|
-
}
|
|
23
|
+
"./dist/client/*": "./dist/client/*"
|
|
27
24
|
},
|
|
28
25
|
"files": [
|
|
29
26
|
"bin",
|
|
@@ -34,7 +31,7 @@
|
|
|
34
31
|
"types"
|
|
35
32
|
],
|
|
36
33
|
"engines": {
|
|
37
|
-
"node": ">=14.
|
|
34
|
+
"node": ">=14.18.0"
|
|
38
35
|
},
|
|
39
36
|
"repository": {
|
|
40
37
|
"type": "git",
|
|
@@ -54,35 +51,35 @@
|
|
|
54
51
|
"patch-types": "esno scripts/patchTypes.ts",
|
|
55
52
|
"roll-types": "api-extractor run && rimraf temp",
|
|
56
53
|
"check-dist-types": "tsc --project tsconfig.check.json",
|
|
57
|
-
"lint": "eslint --ext .ts src/**",
|
|
58
|
-
"format": "prettier --write --parser typescript \"src/**/*.ts\"",
|
|
54
|
+
"lint": "eslint --cache --ext .ts src/**",
|
|
55
|
+
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
|
59
56
|
"prepublishOnly": "npm run build"
|
|
60
57
|
},
|
|
61
58
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
62
59
|
"dependencies": {
|
|
63
|
-
"esbuild": "^0.14.
|
|
60
|
+
"esbuild": "^0.14.43",
|
|
64
61
|
"postcss": "^8.4.14",
|
|
65
|
-
"resolve": "^1.22.
|
|
66
|
-
"rollup": "^2.
|
|
62
|
+
"resolve": "^1.22.1",
|
|
63
|
+
"rollup": "^2.75.6"
|
|
67
64
|
},
|
|
68
65
|
"optionalDependencies": {
|
|
69
66
|
"fsevents": "~2.3.2"
|
|
70
67
|
},
|
|
71
68
|
"devDependencies": {
|
|
72
69
|
"@ampproject/remapping": "^2.2.0",
|
|
73
|
-
"@babel/parser": "^7.18.
|
|
74
|
-
"@babel/types": "^7.18.
|
|
70
|
+
"@babel/parser": "^7.18.5",
|
|
71
|
+
"@babel/types": "^7.18.4",
|
|
75
72
|
"@jridgewell/trace-mapping": "^0.3.13",
|
|
76
73
|
"@rollup/plugin-alias": "^3.1.9",
|
|
77
74
|
"@rollup/plugin-commonjs": "^21.1.0",
|
|
78
75
|
"@rollup/plugin-dynamic-import-vars": "^1.4.3",
|
|
79
76
|
"@rollup/plugin-json": "^4.1.0",
|
|
80
77
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
81
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
78
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
82
79
|
"@rollup/pluginutils": "^4.2.1",
|
|
83
|
-
"@vue/compiler-dom": "^3.2.
|
|
80
|
+
"@vue/compiler-dom": "^3.2.37",
|
|
84
81
|
"acorn": "^8.7.1",
|
|
85
|
-
"cac": "6.7.
|
|
82
|
+
"cac": "^6.7.12",
|
|
86
83
|
"chokidar": "^3.5.3",
|
|
87
84
|
"connect": "^3.7.0",
|
|
88
85
|
"connect-history-api-fallback": "^1.6.0",
|
|
@@ -94,41 +91,42 @@
|
|
|
94
91
|
"dotenv-expand": "^5.1.0",
|
|
95
92
|
"es-module-lexer": "^0.10.5",
|
|
96
93
|
"esno": "^0.16.3",
|
|
97
|
-
"estree-walker": "^
|
|
94
|
+
"estree-walker": "^3.0.1",
|
|
98
95
|
"etag": "^1.8.1",
|
|
99
96
|
"fast-glob": "^3.2.11",
|
|
100
97
|
"http-proxy": "^1.18.1",
|
|
101
98
|
"json5": "^2.2.1",
|
|
102
|
-
"launch-editor-middleware": "^2.
|
|
99
|
+
"launch-editor-middleware": "^2.4.0",
|
|
103
100
|
"magic-string": "^0.26.2",
|
|
104
101
|
"micromatch": "^4.0.5",
|
|
105
|
-
"
|
|
102
|
+
"mlly": "^0.5.3",
|
|
103
|
+
"mrmime": "^1.0.1",
|
|
106
104
|
"node-forge": "^1.3.1",
|
|
107
105
|
"okie": "^1.0.1",
|
|
108
106
|
"open": "^8.4.0",
|
|
109
|
-
"periscopic": "^
|
|
107
|
+
"periscopic": "^3.0.4",
|
|
110
108
|
"picocolors": "^1.0.0",
|
|
111
109
|
"postcss-import": "^14.1.0",
|
|
112
|
-
"postcss-load-config": "^
|
|
110
|
+
"postcss-load-config": "^4.0.1",
|
|
113
111
|
"postcss-modules": "^4.3.1",
|
|
114
112
|
"resolve.exports": "^1.1.0",
|
|
115
|
-
"rollup-plugin-license": "^2.
|
|
113
|
+
"rollup-plugin-license": "^2.8.1",
|
|
116
114
|
"sirv": "^2.0.2",
|
|
117
115
|
"source-map-js": "^1.0.2",
|
|
118
116
|
"source-map-support": "^0.5.21",
|
|
119
|
-
"strip-ansi": "^
|
|
120
|
-
"strip-literal": "^0.
|
|
121
|
-
"
|
|
122
|
-
"tsconfck": "^2.0.0",
|
|
117
|
+
"strip-ansi": "^7.0.1",
|
|
118
|
+
"strip-literal": "^0.4.0",
|
|
119
|
+
"tsconfck": "^2.0.1",
|
|
123
120
|
"tslib": "^2.4.0",
|
|
124
121
|
"types": "link:./types",
|
|
125
122
|
"ufo": "^0.8.4",
|
|
126
|
-
"ws": "^8.
|
|
123
|
+
"ws": "^8.8.0"
|
|
127
124
|
},
|
|
128
125
|
"peerDependencies": {
|
|
129
126
|
"less": "*",
|
|
130
127
|
"sass": "*",
|
|
131
|
-
"stylus": "*"
|
|
128
|
+
"stylus": "*",
|
|
129
|
+
"terser": "^5.4.0"
|
|
132
130
|
},
|
|
133
131
|
"peerDependenciesMeta": {
|
|
134
132
|
"sass": {
|
|
@@ -139,6 +137,9 @@
|
|
|
139
137
|
},
|
|
140
138
|
"less": {
|
|
141
139
|
"optional": true
|
|
140
|
+
},
|
|
141
|
+
"terser": {
|
|
142
|
+
"optional": true
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
}
|
package/src/client/client.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ErrorPayload, HMRPayload, Update } from 'types/hmrPayload'
|
|
2
|
-
import type { ViteHotContext } from 'types/hot'
|
|
2
|
+
import type { ModuleNamespace, ViteHotContext } from 'types/hot'
|
|
3
3
|
import type { InferCustomEventPayload } from 'types/customEvent'
|
|
4
4
|
import { ErrorOverlay, overlayId } from './overlay'
|
|
5
5
|
// eslint-disable-next-line node/no-missing-import
|
|
@@ -7,24 +7,70 @@ import '@vite/env'
|
|
|
7
7
|
|
|
8
8
|
// injected by the hmr plugin when served
|
|
9
9
|
declare const __BASE__: string
|
|
10
|
-
declare const __HMR_PROTOCOL__: string
|
|
11
|
-
declare const __HMR_HOSTNAME__: string
|
|
12
|
-
declare const __HMR_PORT__: string
|
|
10
|
+
declare const __HMR_PROTOCOL__: string | null
|
|
11
|
+
declare const __HMR_HOSTNAME__: string | null
|
|
12
|
+
declare const __HMR_PORT__: string | null
|
|
13
|
+
declare const __HMR_DIRECT_TARGET__: string
|
|
14
|
+
declare const __HMR_BASE__: string
|
|
13
15
|
declare const __HMR_TIMEOUT__: number
|
|
14
16
|
declare const __HMR_ENABLE_OVERLAY__: boolean
|
|
15
17
|
|
|
16
18
|
console.debug('[vite] connecting...')
|
|
17
19
|
|
|
20
|
+
const importMetaUrl = new URL(import.meta.url)
|
|
21
|
+
|
|
18
22
|
// use server configuration, then fallback to inference
|
|
19
23
|
const socketProtocol =
|
|
20
24
|
__HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')
|
|
21
|
-
const
|
|
25
|
+
const hmrPort = __HMR_PORT__
|
|
26
|
+
const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${
|
|
27
|
+
hmrPort || importMetaUrl.port
|
|
28
|
+
}${__HMR_BASE__}`
|
|
29
|
+
const directSocketHost = __HMR_DIRECT_TARGET__
|
|
22
30
|
const base = __BASE__ || '/'
|
|
23
31
|
const messageBuffer: string[] = []
|
|
24
32
|
|
|
25
33
|
let socket: WebSocket
|
|
26
34
|
try {
|
|
27
|
-
|
|
35
|
+
let fallback: (() => void) | undefined
|
|
36
|
+
// only use fallback when port is inferred to prevent confusion
|
|
37
|
+
if (!hmrPort) {
|
|
38
|
+
fallback = () => {
|
|
39
|
+
// fallback to connecting directly to the hmr server
|
|
40
|
+
// for servers which does not support proxying websocket
|
|
41
|
+
socket = setupWebSocket(socketProtocol, directSocketHost)
|
|
42
|
+
socket.addEventListener(
|
|
43
|
+
'open',
|
|
44
|
+
() => {
|
|
45
|
+
console.info(
|
|
46
|
+
'[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.'
|
|
47
|
+
)
|
|
48
|
+
},
|
|
49
|
+
{ once: true }
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
socket = setupWebSocket(socketProtocol, socketHost, fallback)
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(`[vite] failed to connect to websocket (${error}). `)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function setupWebSocket(
|
|
60
|
+
protocol: string,
|
|
61
|
+
hostAndPath: string,
|
|
62
|
+
onCloseWithoutOpen?: () => void
|
|
63
|
+
) {
|
|
64
|
+
const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr')
|
|
65
|
+
let isOpened = false
|
|
66
|
+
|
|
67
|
+
socket.addEventListener(
|
|
68
|
+
'open',
|
|
69
|
+
() => {
|
|
70
|
+
isOpened = true
|
|
71
|
+
},
|
|
72
|
+
{ once: true }
|
|
73
|
+
)
|
|
28
74
|
|
|
29
75
|
// Listen for messages
|
|
30
76
|
socket.addEventListener('message', async ({ data }) => {
|
|
@@ -34,12 +80,18 @@ try {
|
|
|
34
80
|
// ping server
|
|
35
81
|
socket.addEventListener('close', async ({ wasClean }) => {
|
|
36
82
|
if (wasClean) return
|
|
83
|
+
|
|
84
|
+
if (!isOpened && onCloseWithoutOpen) {
|
|
85
|
+
onCloseWithoutOpen()
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
37
89
|
console.log(`[vite] server connection lost. polling for restart...`)
|
|
38
|
-
await waitForSuccessfulPing()
|
|
90
|
+
await waitForSuccessfulPing(hostAndPath)
|
|
39
91
|
location.reload()
|
|
40
92
|
})
|
|
41
|
-
|
|
42
|
-
|
|
93
|
+
|
|
94
|
+
return socket
|
|
43
95
|
}
|
|
44
96
|
|
|
45
97
|
function warnFailedFetch(err: Error, path: string | string[]) {
|
|
@@ -101,7 +153,18 @@ async function handleMessage(payload: HMRPayload) {
|
|
|
101
153
|
const newPath = `${base}${searchUrl.slice(1)}${
|
|
102
154
|
searchUrl.includes('?') ? '&' : '?'
|
|
103
155
|
}t=${timestamp}`
|
|
104
|
-
|
|
156
|
+
|
|
157
|
+
// rather than swapping the href on the existing tag, we will
|
|
158
|
+
// create a new link tag. Once the new stylesheet has loaded we
|
|
159
|
+
// will remove the existing link tag. This removes a Flash Of
|
|
160
|
+
// Unstyled Content that can occur when swapping out the tag href
|
|
161
|
+
// directly, as the new stylesheet has not yet been loaded.
|
|
162
|
+
const newLinkTag = el.cloneNode() as HTMLLinkElement
|
|
163
|
+
newLinkTag.href = new URL(newPath, el.href).href
|
|
164
|
+
const removeOldEl = () => el.remove()
|
|
165
|
+
newLinkTag.addEventListener('load', removeOldEl)
|
|
166
|
+
newLinkTag.addEventListener('error', removeOldEl)
|
|
167
|
+
el.after(newLinkTag)
|
|
105
168
|
}
|
|
106
169
|
console.log(`[vite] css hot updated: ${searchUrl}`)
|
|
107
170
|
}
|
|
@@ -211,13 +274,13 @@ async function queueUpdate(p: Promise<(() => void) | undefined>) {
|
|
|
211
274
|
}
|
|
212
275
|
}
|
|
213
276
|
|
|
214
|
-
async function waitForSuccessfulPing(ms = 1000) {
|
|
277
|
+
async function waitForSuccessfulPing(hostAndPath: string, ms = 1000) {
|
|
215
278
|
// eslint-disable-next-line no-constant-condition
|
|
216
279
|
while (true) {
|
|
217
280
|
try {
|
|
218
281
|
// A fetch on a websocket URL will return a successful promise with status 400,
|
|
219
282
|
// but will reject a networking error.
|
|
220
|
-
await fetch(`${location.protocol}//${
|
|
283
|
+
await fetch(`${location.protocol}//${hostAndPath}`)
|
|
221
284
|
break
|
|
222
285
|
} catch (e) {
|
|
223
286
|
// wait ms before attempting to ping again
|
|
@@ -237,7 +300,10 @@ const supportsConstructedSheet = (() => {
|
|
|
237
300
|
return false
|
|
238
301
|
})()
|
|
239
302
|
|
|
240
|
-
const sheetsMap = new Map
|
|
303
|
+
const sheetsMap = new Map<
|
|
304
|
+
string,
|
|
305
|
+
HTMLStyleElement | CSSStyleSheet | undefined
|
|
306
|
+
>()
|
|
241
307
|
|
|
242
308
|
export function updateStyle(id: string, content: string): void {
|
|
243
309
|
let style = sheetsMap.get(id)
|
|
@@ -249,10 +315,12 @@ export function updateStyle(id: string, content: string): void {
|
|
|
249
315
|
|
|
250
316
|
if (!style) {
|
|
251
317
|
style = new CSSStyleSheet()
|
|
318
|
+
// @ts-expect-error: using experimental API
|
|
252
319
|
style.replaceSync(content)
|
|
253
320
|
// @ts-expect-error: using experimental API
|
|
254
321
|
document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]
|
|
255
322
|
} else {
|
|
323
|
+
// @ts-expect-error: using experimental API
|
|
256
324
|
style.replaceSync(content)
|
|
257
325
|
}
|
|
258
326
|
} else {
|
|
@@ -297,7 +365,7 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
|
|
|
297
365
|
return
|
|
298
366
|
}
|
|
299
367
|
|
|
300
|
-
const moduleMap = new Map()
|
|
368
|
+
const moduleMap = new Map<string, ModuleNamespace>()
|
|
301
369
|
const isSelfUpdate = path === acceptedPath
|
|
302
370
|
|
|
303
371
|
// make sure we only import each dep once
|
|
@@ -327,7 +395,7 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
|
|
|
327
395
|
if (disposer) await disposer(dataMap.get(dep))
|
|
328
396
|
const [path, query] = dep.split(`?`)
|
|
329
397
|
try {
|
|
330
|
-
const newMod = await import(
|
|
398
|
+
const newMod: ModuleNamespace = await import(
|
|
331
399
|
/* @vite-ignore */
|
|
332
400
|
base +
|
|
333
401
|
path.slice(1) +
|
|
@@ -364,18 +432,17 @@ interface HotModule {
|
|
|
364
432
|
interface HotCallback {
|
|
365
433
|
// the dependencies must be fetchable paths
|
|
366
434
|
deps: string[]
|
|
367
|
-
fn: (modules:
|
|
435
|
+
fn: (modules: Array<ModuleNamespace | undefined>) => void
|
|
368
436
|
}
|
|
369
437
|
|
|
438
|
+
type CustomListenersMap = Map<string, ((data: any) => void)[]>
|
|
439
|
+
|
|
370
440
|
const hotModulesMap = new Map<string, HotModule>()
|
|
371
441
|
const disposeMap = new Map<string, (data: any) => void | Promise<void>>()
|
|
372
442
|
const pruneMap = new Map<string, (data: any) => void | Promise<void>>()
|
|
373
443
|
const dataMap = new Map<string, any>()
|
|
374
|
-
const customListenersMap = new Map
|
|
375
|
-
const ctxToListenersMap = new Map<
|
|
376
|
-
string,
|
|
377
|
-
Map<string, ((data: any) => void)[]>
|
|
378
|
-
>()
|
|
444
|
+
const customListenersMap: CustomListenersMap = new Map()
|
|
445
|
+
const ctxToListenersMap = new Map<string, CustomListenersMap>()
|
|
379
446
|
|
|
380
447
|
export function createHotContext(ownerPath: string): ViteHotContext {
|
|
381
448
|
if (!dataMap.has(ownerPath)) {
|
|
@@ -403,7 +470,7 @@ export function createHotContext(ownerPath: string): ViteHotContext {
|
|
|
403
470
|
}
|
|
404
471
|
}
|
|
405
472
|
|
|
406
|
-
const newListeners = new Map()
|
|
473
|
+
const newListeners: CustomListenersMap = new Map()
|
|
407
474
|
ctxToListenersMap.set(ownerPath, newListeners)
|
|
408
475
|
|
|
409
476
|
function acceptDeps(deps: string[], callback: HotCallback['fn'] = () => {}) {
|
|
@@ -437,6 +504,12 @@ export function createHotContext(ownerPath: string): ViteHotContext {
|
|
|
437
504
|
}
|
|
438
505
|
},
|
|
439
506
|
|
|
507
|
+
// export names (first arg) are irrelevant on the client side, they're
|
|
508
|
+
// extracted in the server for propagation
|
|
509
|
+
acceptExports(_: string | readonly string[], callback?: any) {
|
|
510
|
+
acceptDeps([ownerPath], callback && (([mod]) => callback(mod)))
|
|
511
|
+
},
|
|
512
|
+
|
|
440
513
|
dispose(cb) {
|
|
441
514
|
disposeMap.set(ownerPath, cb)
|
|
442
515
|
},
|
package/types/chokidar.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ THE SOFTWARE.
|
|
|
28
28
|
*/
|
|
29
29
|
/// <reference types="node" />
|
|
30
30
|
|
|
31
|
-
import type * as fs from 'fs'
|
|
32
|
-
import { EventEmitter } from 'events'
|
|
31
|
+
import type * as fs from 'node:fs'
|
|
32
|
+
import { EventEmitter } from 'node:events'
|
|
33
33
|
import type { Matcher } from './anymatch'
|
|
34
34
|
|
|
35
35
|
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
package/types/connect.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
9
9
|
|
|
10
10
|
/// <reference types="node" />
|
|
11
|
-
import * as http from 'http'
|
|
11
|
+
import * as http from 'node:http'
|
|
12
12
|
|
|
13
13
|
export namespace Connect {
|
|
14
14
|
export type ServerHandle = HandleFunction | http.Server
|
package/types/hot.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import type { InferCustomEventPayload } from './customEvent'
|
|
2
2
|
|
|
3
|
+
export type ModuleNamespace = Record<string, any> & {
|
|
4
|
+
[Symbol.toStringTag]: 'Module'
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
export interface ViteHotContext {
|
|
4
8
|
readonly data: any
|
|
5
9
|
|
|
6
10
|
accept(): void
|
|
7
|
-
accept(cb: (mod:
|
|
8
|
-
accept(dep: string, cb: (mod:
|
|
9
|
-
accept(
|
|
11
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
12
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
13
|
+
accept(
|
|
14
|
+
deps: readonly string[],
|
|
15
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
16
|
+
): void
|
|
17
|
+
|
|
18
|
+
acceptExports(exportNames: string | readonly string[]): void
|
|
19
|
+
acceptExports(
|
|
20
|
+
exportNames: string | readonly string[],
|
|
21
|
+
cb: (mod: ModuleNamespace | undefined) => void
|
|
22
|
+
): void
|
|
23
|
+
|
|
10
24
|
dispose(cb: (data: any) => void): void
|
|
11
25
|
decline(): void
|
|
12
26
|
invalidate(): void
|
package/types/http-proxy.d.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
/// <reference types="node" />
|
|
15
15
|
|
|
16
|
-
import type * as net from 'net'
|
|
17
|
-
import type * as http from 'http'
|
|
18
|
-
import * as events from 'events'
|
|
19
|
-
import type * as url from 'url'
|
|
20
|
-
import type * as stream from 'stream'
|
|
16
|
+
import type * as net from 'node:net'
|
|
17
|
+
import type * as http from 'node:http'
|
|
18
|
+
import * as events from 'node:events'
|
|
19
|
+
import type * as url from 'node:url'
|
|
20
|
+
import type * as stream from 'node:stream'
|
|
21
21
|
|
|
22
22
|
export namespace HttpProxy {
|
|
23
23
|
export type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed
|
package/types/ws.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
/// <reference types="node" />
|
|
17
17
|
|
|
18
|
-
import { EventEmitter } from 'events'
|
|
18
|
+
import { EventEmitter } from 'node:events'
|
|
19
19
|
import type {
|
|
20
20
|
Agent,
|
|
21
21
|
ClientRequest,
|
|
@@ -23,12 +23,12 @@ import type {
|
|
|
23
23
|
Server as HTTPServer,
|
|
24
24
|
IncomingMessage,
|
|
25
25
|
OutgoingHttpHeaders
|
|
26
|
-
} from 'http'
|
|
27
|
-
import type { Server as HTTPSServer } from 'https'
|
|
28
|
-
import type { Duplex, DuplexOptions } from 'stream'
|
|
26
|
+
} from 'node:http'
|
|
27
|
+
import type { Server as HTTPSServer } from 'node:https'
|
|
28
|
+
import type { Duplex, DuplexOptions } from 'node:stream'
|
|
29
29
|
import type { SecureContextOptions } from 'tls'
|
|
30
|
-
import type { URL } from 'url'
|
|
31
|
-
import type { ZlibOptions } from 'zlib'
|
|
30
|
+
import type { URL } from 'node:url'
|
|
31
|
+
import type { ZlibOptions } from 'node:zlib'
|
|
32
32
|
|
|
33
33
|
// WebSocket socket.
|
|
34
34
|
declare class WebSocket extends EventEmitter {
|