Skip to content

Commit

Permalink
fix: ws types (#6083)
Browse files Browse the repository at this point in the history
  • Loading branch information
Niputi committed Dec 12, 2021
1 parent 745c2ec commit 1ded1a8
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 294 deletions.
4 changes: 2 additions & 2 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/resolve": "^1.20.1",
"@types/sass": "~1.43.0",
"@types/stylus": "^0.48.36",
"@types/ws": "^8.2.0",
"@types/ws": "^8.2.2",
"@vue/compiler-dom": "^3.2.22",
"acorn": "^8.6.0",
"acorn-class-fields": "^1.0.0",
Expand Down Expand Up @@ -117,7 +117,7 @@
"tsconfck": "1.1.1",
"tslib": "^2.3.1",
"types": "link:./types",
"ws": "^8.2.3"
"ws": "^8.3.0"
},
"peerDependencies": {
"less": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type {
ErrorPayload
} from 'types/hmrPayload'
export type { Connect } from 'types/connect'
export type { WebSocket } from 'types/ws'
export type { WebSocket, WebSocketAlias } 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import {
ServerOptions as HttpsServerOptions
} from 'https'
import { WebSocketServer as WebSocket, ServerOptions } 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['on']
off: WebSocket['off']
on: WebSocketTypes.Server['on']
off: WebSocketTypes.Server['off']
send(payload: HMRPayload): void
close(): Promise<void>
}
Expand Down

0 comments on commit 1ded1a8

Please sign in to comment.