vite 3.0.0-alpha.9 → 3.0.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.
- package/LICENSE.md +84 -343
- package/bin/vite.js +1 -1
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +61 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-e8ca8d40.js → dep-07a79996.js} +124 -116
- package/dist/node/chunks/{dep-17430d09.js → dep-41eb528c.js} +12 -12
- package/dist/node/chunks/{dep-8df7bfd6.js → dep-7c75cb17.js} +33378 -30892
- package/dist/node/chunks/{dep-523c8a1b.js → dep-af860ceb.js} +3122 -3122
- package/dist/node/chunks/dep-bc80f1d6.js +7545 -0
- package/dist/node/cli.js +32 -19
- package/dist/node/constants.js +43 -7
- package/dist/node/index.d.ts +235 -96
- package/dist/node/index.js +23 -10
- package/dist/node-cjs/publicUtils.cjs +3058 -868
- package/package.json +32 -32
- package/src/client/client.ts +109 -22
- package/src/client/tsconfig.json +0 -2
- 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/chunks/dep-08f2a2be.js +0 -19603
- package/dist/node/chunks/dep-3165073f.js +0 -7505
- package/dist/node-cjs/terser.cjs +0 -31023
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.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -21,9 +21,7 @@
|
|
|
21
21
|
"types": "./client.d.ts"
|
|
22
22
|
},
|
|
23
23
|
"./dist/client/*": "./dist/client/*",
|
|
24
|
-
"./
|
|
25
|
-
"require": "./dist/node-cjs/terser.cjs"
|
|
26
|
-
}
|
|
24
|
+
"./package.json": "./package.json"
|
|
27
25
|
},
|
|
28
26
|
"files": [
|
|
29
27
|
"bin",
|
|
@@ -34,7 +32,7 @@
|
|
|
34
32
|
"types"
|
|
35
33
|
],
|
|
36
34
|
"engines": {
|
|
37
|
-
"node": ">=14.
|
|
35
|
+
"node": ">=14.18.0"
|
|
38
36
|
},
|
|
39
37
|
"repository": {
|
|
40
38
|
"type": "git",
|
|
@@ -51,41 +49,41 @@
|
|
|
51
49
|
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
|
|
52
50
|
"build-types": "run-s build-temp-types patch-types roll-types check-dist-types",
|
|
53
51
|
"build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
|
|
54
|
-
"patch-types": "
|
|
52
|
+
"patch-types": "tsx scripts/patchTypes.ts",
|
|
55
53
|
"roll-types": "api-extractor run && rimraf temp",
|
|
56
54
|
"check-dist-types": "tsc --project tsconfig.check.json",
|
|
57
|
-
"lint": "eslint --ext .ts src/**",
|
|
58
|
-
"format": "prettier --write --parser typescript \"src/**/*.ts\"",
|
|
55
|
+
"lint": "eslint --cache --ext .ts src/**",
|
|
56
|
+
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
|
59
57
|
"prepublishOnly": "npm run build"
|
|
60
58
|
},
|
|
61
59
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
62
60
|
"dependencies": {
|
|
63
|
-
"esbuild": "^0.14.
|
|
61
|
+
"esbuild": "^0.14.47",
|
|
64
62
|
"postcss": "^8.4.14",
|
|
65
|
-
"resolve": "^1.22.
|
|
66
|
-
"rollup": "^2.
|
|
63
|
+
"resolve": "^1.22.1",
|
|
64
|
+
"rollup": "^2.75.6"
|
|
67
65
|
},
|
|
68
66
|
"optionalDependencies": {
|
|
69
67
|
"fsevents": "~2.3.2"
|
|
70
68
|
},
|
|
71
69
|
"devDependencies": {
|
|
72
70
|
"@ampproject/remapping": "^2.2.0",
|
|
73
|
-
"@babel/parser": "^7.18.
|
|
74
|
-
"@babel/types": "^7.18.
|
|
75
|
-
"@jridgewell/trace-mapping": "^0.3.
|
|
71
|
+
"@babel/parser": "^7.18.8",
|
|
72
|
+
"@babel/types": "^7.18.8",
|
|
73
|
+
"@jridgewell/trace-mapping": "^0.3.14",
|
|
76
74
|
"@rollup/plugin-alias": "^3.1.9",
|
|
77
|
-
"@rollup/plugin-commonjs": "^
|
|
75
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
78
76
|
"@rollup/plugin-dynamic-import-vars": "^1.4.3",
|
|
79
77
|
"@rollup/plugin-json": "^4.1.0",
|
|
80
78
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
81
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
79
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
82
80
|
"@rollup/pluginutils": "^4.2.1",
|
|
83
|
-
"@vue/compiler-dom": "^3.2.
|
|
81
|
+
"@vue/compiler-dom": "^3.2.37",
|
|
84
82
|
"acorn": "^8.7.1",
|
|
85
|
-
"cac": "6.7.
|
|
83
|
+
"cac": "^6.7.12",
|
|
86
84
|
"chokidar": "^3.5.3",
|
|
87
85
|
"connect": "^3.7.0",
|
|
88
|
-
"connect-history-api-fallback": "^
|
|
86
|
+
"connect-history-api-fallback": "^2.0.0",
|
|
89
87
|
"convert-source-map": "^1.8.0",
|
|
90
88
|
"cors": "^2.8.5",
|
|
91
89
|
"cross-spawn": "^7.0.3",
|
|
@@ -93,8 +91,7 @@
|
|
|
93
91
|
"dotenv": "^14.3.2",
|
|
94
92
|
"dotenv-expand": "^5.1.0",
|
|
95
93
|
"es-module-lexer": "^0.10.5",
|
|
96
|
-
"
|
|
97
|
-
"estree-walker": "^2.0.2",
|
|
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",
|
|
@@ -102,33 +99,33 @@
|
|
|
102
99
|
"launch-editor-middleware": "^2.4.0",
|
|
103
100
|
"magic-string": "^0.26.2",
|
|
104
101
|
"micromatch": "^4.0.5",
|
|
105
|
-
"
|
|
106
|
-
"
|
|
102
|
+
"mlly": "^0.5.4",
|
|
103
|
+
"mrmime": "^1.0.1",
|
|
107
104
|
"okie": "^1.0.1",
|
|
108
105
|
"open": "^8.4.0",
|
|
109
|
-
"periscopic": "^
|
|
106
|
+
"periscopic": "^3.0.4",
|
|
110
107
|
"picocolors": "^1.0.0",
|
|
111
108
|
"postcss-import": "^14.1.0",
|
|
112
|
-
"postcss-load-config": "^
|
|
109
|
+
"postcss-load-config": "^4.0.1",
|
|
113
110
|
"postcss-modules": "^4.3.1",
|
|
114
111
|
"resolve.exports": "^1.1.0",
|
|
115
|
-
"rollup-plugin-license": "^2.8.
|
|
112
|
+
"rollup-plugin-license": "^2.8.1",
|
|
116
113
|
"sirv": "^2.0.2",
|
|
117
114
|
"source-map-js": "^1.0.2",
|
|
118
115
|
"source-map-support": "^0.5.21",
|
|
119
|
-
"strip-ansi": "^
|
|
120
|
-
"strip-literal": "^0.
|
|
121
|
-
"terser": "^5.14.0",
|
|
116
|
+
"strip-ansi": "^7.0.1",
|
|
117
|
+
"strip-literal": "^0.4.0",
|
|
122
118
|
"tsconfck": "^2.0.1",
|
|
123
119
|
"tslib": "^2.4.0",
|
|
124
120
|
"types": "link:./types",
|
|
125
|
-
"ufo": "^0.8.
|
|
126
|
-
"ws": "^8.
|
|
121
|
+
"ufo": "^0.8.5",
|
|
122
|
+
"ws": "^8.8.0"
|
|
127
123
|
},
|
|
128
124
|
"peerDependencies": {
|
|
129
125
|
"less": "*",
|
|
130
126
|
"sass": "*",
|
|
131
|
-
"stylus": "*"
|
|
127
|
+
"stylus": "*",
|
|
128
|
+
"terser": "^5.4.0"
|
|
132
129
|
},
|
|
133
130
|
"peerDependenciesMeta": {
|
|
134
131
|
"sass": {
|
|
@@ -139,6 +136,9 @@
|
|
|
139
136
|
},
|
|
140
137
|
"less": {
|
|
141
138
|
"optional": true
|
|
139
|
+
},
|
|
140
|
+
"terser": {
|
|
141
|
+
"optional": true
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
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,84 @@ import '@vite/env'
|
|
|
7
7
|
|
|
8
8
|
// injected by the hmr plugin when served
|
|
9
9
|
declare const __BASE__: string
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
10
|
+
declare const __SERVER_HOST__: string
|
|
11
|
+
declare const __HMR_PROTOCOL__: string | null
|
|
12
|
+
declare const __HMR_HOSTNAME__: string | null
|
|
13
|
+
declare const __HMR_PORT__: number | null
|
|
14
|
+
declare const __HMR_DIRECT_TARGET__: string
|
|
15
|
+
declare const __HMR_BASE__: string
|
|
13
16
|
declare const __HMR_TIMEOUT__: number
|
|
14
17
|
declare const __HMR_ENABLE_OVERLAY__: boolean
|
|
15
18
|
|
|
16
19
|
console.debug('[vite] connecting...')
|
|
17
20
|
|
|
21
|
+
const importMetaUrl = new URL(import.meta.url)
|
|
22
|
+
|
|
18
23
|
// use server configuration, then fallback to inference
|
|
24
|
+
const serverHost = __SERVER_HOST__
|
|
19
25
|
const socketProtocol =
|
|
20
26
|
__HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')
|
|
21
|
-
const
|
|
27
|
+
const hmrPort = __HMR_PORT__
|
|
28
|
+
const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${
|
|
29
|
+
hmrPort || importMetaUrl.port
|
|
30
|
+
}${__HMR_BASE__}`
|
|
31
|
+
const directSocketHost = __HMR_DIRECT_TARGET__
|
|
22
32
|
const base = __BASE__ || '/'
|
|
23
33
|
const messageBuffer: string[] = []
|
|
24
34
|
|
|
25
35
|
let socket: WebSocket
|
|
26
36
|
try {
|
|
27
|
-
|
|
37
|
+
let fallback: (() => void) | undefined
|
|
38
|
+
// only use fallback when port is inferred to prevent confusion
|
|
39
|
+
if (!hmrPort) {
|
|
40
|
+
fallback = () => {
|
|
41
|
+
// fallback to connecting directly to the hmr server
|
|
42
|
+
// for servers which does not support proxying websocket
|
|
43
|
+
socket = setupWebSocket(socketProtocol, directSocketHost, () => {
|
|
44
|
+
const currentScriptHostURL = new URL(import.meta.url)
|
|
45
|
+
const currentScriptHost =
|
|
46
|
+
currentScriptHostURL.host +
|
|
47
|
+
currentScriptHostURL.pathname.replace(/@vite\/client$/, '')
|
|
48
|
+
console.error(
|
|
49
|
+
'[vite] failed to connect to websocket.\n' +
|
|
50
|
+
'your current setup:\n' +
|
|
51
|
+
` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\n` +
|
|
52
|
+
` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\n` +
|
|
53
|
+
'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .'
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
socket.addEventListener(
|
|
57
|
+
'open',
|
|
58
|
+
() => {
|
|
59
|
+
console.info(
|
|
60
|
+
'[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.'
|
|
61
|
+
)
|
|
62
|
+
},
|
|
63
|
+
{ once: true }
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
socket = setupWebSocket(socketProtocol, socketHost, fallback)
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(`[vite] failed to connect to websocket (${error}). `)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function setupWebSocket(
|
|
74
|
+
protocol: string,
|
|
75
|
+
hostAndPath: string,
|
|
76
|
+
onCloseWithoutOpen?: () => void
|
|
77
|
+
) {
|
|
78
|
+
const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr')
|
|
79
|
+
let isOpened = false
|
|
80
|
+
|
|
81
|
+
socket.addEventListener(
|
|
82
|
+
'open',
|
|
83
|
+
() => {
|
|
84
|
+
isOpened = true
|
|
85
|
+
},
|
|
86
|
+
{ once: true }
|
|
87
|
+
)
|
|
28
88
|
|
|
29
89
|
// Listen for messages
|
|
30
90
|
socket.addEventListener('message', async ({ data }) => {
|
|
@@ -34,12 +94,18 @@ try {
|
|
|
34
94
|
// ping server
|
|
35
95
|
socket.addEventListener('close', async ({ wasClean }) => {
|
|
36
96
|
if (wasClean) return
|
|
97
|
+
|
|
98
|
+
if (!isOpened && onCloseWithoutOpen) {
|
|
99
|
+
onCloseWithoutOpen()
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
37
103
|
console.log(`[vite] server connection lost. polling for restart...`)
|
|
38
|
-
await waitForSuccessfulPing()
|
|
104
|
+
await waitForSuccessfulPing(hostAndPath)
|
|
39
105
|
location.reload()
|
|
40
106
|
})
|
|
41
|
-
|
|
42
|
-
|
|
107
|
+
|
|
108
|
+
return socket
|
|
43
109
|
}
|
|
44
110
|
|
|
45
111
|
function warnFailedFetch(err: Error, path: string | string[]) {
|
|
@@ -101,7 +167,18 @@ async function handleMessage(payload: HMRPayload) {
|
|
|
101
167
|
const newPath = `${base}${searchUrl.slice(1)}${
|
|
102
168
|
searchUrl.includes('?') ? '&' : '?'
|
|
103
169
|
}t=${timestamp}`
|
|
104
|
-
|
|
170
|
+
|
|
171
|
+
// rather than swapping the href on the existing tag, we will
|
|
172
|
+
// create a new link tag. Once the new stylesheet has loaded we
|
|
173
|
+
// will remove the existing link tag. This removes a Flash Of
|
|
174
|
+
// Unstyled Content that can occur when swapping out the tag href
|
|
175
|
+
// directly, as the new stylesheet has not yet been loaded.
|
|
176
|
+
const newLinkTag = el.cloneNode() as HTMLLinkElement
|
|
177
|
+
newLinkTag.href = new URL(newPath, el.href).href
|
|
178
|
+
const removeOldEl = () => el.remove()
|
|
179
|
+
newLinkTag.addEventListener('load', removeOldEl)
|
|
180
|
+
newLinkTag.addEventListener('error', removeOldEl)
|
|
181
|
+
el.after(newLinkTag)
|
|
105
182
|
}
|
|
106
183
|
console.log(`[vite] css hot updated: ${searchUrl}`)
|
|
107
184
|
}
|
|
@@ -211,13 +288,13 @@ async function queueUpdate(p: Promise<(() => void) | undefined>) {
|
|
|
211
288
|
}
|
|
212
289
|
}
|
|
213
290
|
|
|
214
|
-
async function waitForSuccessfulPing(ms = 1000) {
|
|
291
|
+
async function waitForSuccessfulPing(hostAndPath: string, ms = 1000) {
|
|
215
292
|
// eslint-disable-next-line no-constant-condition
|
|
216
293
|
while (true) {
|
|
217
294
|
try {
|
|
218
295
|
// A fetch on a websocket URL will return a successful promise with status 400,
|
|
219
296
|
// but will reject a networking error.
|
|
220
|
-
await fetch(`${location.protocol}//${
|
|
297
|
+
await fetch(`${location.protocol}//${hostAndPath}`)
|
|
221
298
|
break
|
|
222
299
|
} catch (e) {
|
|
223
300
|
// wait ms before attempting to ping again
|
|
@@ -237,7 +314,10 @@ const supportsConstructedSheet = (() => {
|
|
|
237
314
|
return false
|
|
238
315
|
})()
|
|
239
316
|
|
|
240
|
-
const sheetsMap = new Map
|
|
317
|
+
const sheetsMap = new Map<
|
|
318
|
+
string,
|
|
319
|
+
HTMLStyleElement | CSSStyleSheet | undefined
|
|
320
|
+
>()
|
|
241
321
|
|
|
242
322
|
export function updateStyle(id: string, content: string): void {
|
|
243
323
|
let style = sheetsMap.get(id)
|
|
@@ -249,10 +329,12 @@ export function updateStyle(id: string, content: string): void {
|
|
|
249
329
|
|
|
250
330
|
if (!style) {
|
|
251
331
|
style = new CSSStyleSheet()
|
|
332
|
+
// @ts-expect-error: using experimental API
|
|
252
333
|
style.replaceSync(content)
|
|
253
334
|
// @ts-expect-error: using experimental API
|
|
254
335
|
document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]
|
|
255
336
|
} else {
|
|
337
|
+
// @ts-expect-error: using experimental API
|
|
256
338
|
style.replaceSync(content)
|
|
257
339
|
}
|
|
258
340
|
} else {
|
|
@@ -297,7 +379,7 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
|
|
|
297
379
|
return
|
|
298
380
|
}
|
|
299
381
|
|
|
300
|
-
const moduleMap = new Map()
|
|
382
|
+
const moduleMap = new Map<string, ModuleNamespace>()
|
|
301
383
|
const isSelfUpdate = path === acceptedPath
|
|
302
384
|
|
|
303
385
|
// make sure we only import each dep once
|
|
@@ -327,7 +409,7 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
|
|
|
327
409
|
if (disposer) await disposer(dataMap.get(dep))
|
|
328
410
|
const [path, query] = dep.split(`?`)
|
|
329
411
|
try {
|
|
330
|
-
const newMod = await import(
|
|
412
|
+
const newMod: ModuleNamespace = await import(
|
|
331
413
|
/* @vite-ignore */
|
|
332
414
|
base +
|
|
333
415
|
path.slice(1) +
|
|
@@ -364,18 +446,17 @@ interface HotModule {
|
|
|
364
446
|
interface HotCallback {
|
|
365
447
|
// the dependencies must be fetchable paths
|
|
366
448
|
deps: string[]
|
|
367
|
-
fn: (modules:
|
|
449
|
+
fn: (modules: Array<ModuleNamespace | undefined>) => void
|
|
368
450
|
}
|
|
369
451
|
|
|
452
|
+
type CustomListenersMap = Map<string, ((data: any) => void)[]>
|
|
453
|
+
|
|
370
454
|
const hotModulesMap = new Map<string, HotModule>()
|
|
371
455
|
const disposeMap = new Map<string, (data: any) => void | Promise<void>>()
|
|
372
456
|
const pruneMap = new Map<string, (data: any) => void | Promise<void>>()
|
|
373
457
|
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
|
-
>()
|
|
458
|
+
const customListenersMap: CustomListenersMap = new Map()
|
|
459
|
+
const ctxToListenersMap = new Map<string, CustomListenersMap>()
|
|
379
460
|
|
|
380
461
|
export function createHotContext(ownerPath: string): ViteHotContext {
|
|
381
462
|
if (!dataMap.has(ownerPath)) {
|
|
@@ -403,7 +484,7 @@ export function createHotContext(ownerPath: string): ViteHotContext {
|
|
|
403
484
|
}
|
|
404
485
|
}
|
|
405
486
|
|
|
406
|
-
const newListeners = new Map()
|
|
487
|
+
const newListeners: CustomListenersMap = new Map()
|
|
407
488
|
ctxToListenersMap.set(ownerPath, newListeners)
|
|
408
489
|
|
|
409
490
|
function acceptDeps(deps: string[], callback: HotCallback['fn'] = () => {}) {
|
|
@@ -437,6 +518,12 @@ export function createHotContext(ownerPath: string): ViteHotContext {
|
|
|
437
518
|
}
|
|
438
519
|
},
|
|
439
520
|
|
|
521
|
+
// export names (first arg) are irrelevant on the client side, they're
|
|
522
|
+
// extracted in the server for propagation
|
|
523
|
+
acceptExports(_: string | readonly string[], callback?: any) {
|
|
524
|
+
acceptDeps([ownerPath], callback && (([mod]) => callback(mod)))
|
|
525
|
+
},
|
|
526
|
+
|
|
440
527
|
dispose(cb) {
|
|
441
528
|
disposeMap.set(ownerPath, cb)
|
|
442
529
|
},
|
package/src/client/tsconfig.json
CHANGED
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 {
|