Skip to content

Commit

Permalink
fix: bundle ws types (#5340)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 18, 2021
1 parent ffb57d6 commit bc4a96c
Show file tree
Hide file tree
Showing 5 changed files with 548 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/vite/package.json
Expand Up @@ -54,6 +54,8 @@
},
"devDependencies": {
"@ampproject/remapping": "^1.0.1",
"@babel/parser": "^7.15.8",
"@babel/types": "^7.15.6",
"@rollup/plugin-alias": "^3.1.5",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-dynamic-import-vars": "^1.4.0",
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/index.ts
Expand Up @@ -81,6 +81,7 @@ export type {
ErrorPayload
} from 'types/hmrPayload'
export type { Connect } from 'types/connect'
export type { WebSocket } from 'types/ws'
export type { HttpProxy } from 'types/http-proxy'
export type { FSWatcher, WatchOptions } from 'types/chokidar'
export type { Terser } from 'types/terser'
Expand Down
5 changes: 3 additions & 2 deletions packages/vite/src/node/server/ws.ts
Expand Up @@ -5,15 +5,16 @@ import {
ServerOptions as HttpsServerOptions
} from 'https'
import WebSocket from 'ws'
import { WebSocket as WebSocketTypes } from 'types/ws'
import { ErrorPayload, HMRPayload } from 'types/hmrPayload'
import { ResolvedConfig } from '..'
import { isObject } from '../utils'
import { Socket } from 'net'
export const HMR_HEADER = 'vite-hmr'

export interface WebSocketServer {
on: WebSocket.Server['on']
off: WebSocket.Server['off']
on: WebSocketTypes.Server['on']
off: WebSocketTypes.Server['off']
send(payload: HMRPayload): void
close(): Promise<void>
}
Expand Down

0 comments on commit bc4a96c

Please sign in to comment.