MCPcopy
hub / github.com/vitejs/vite / accept

Method accept

packages/vite/src/shared/hmr.ts:64–76  ·  view source on GitHub ↗
(deps?: any, callback?: any)

Source from the content-addressed store, hash-verified

62 }
63
64 accept(deps?: any, callback?: any): void {
65 if (typeof deps === 'function' || !deps) {
66 // self-accept: hot.accept(() => {})
67 this.acceptDeps([this.ownerPath], ([mod]) => deps?.(mod))
68 } else if (typeof deps === 'string') {
69 // explicit deps
70 this.acceptDeps([deps], ([mod]) => callback?.(mod))
71 } else if (Array.isArray(deps)) {
72 this.acceptDeps(deps, callback)
73 } else {
74 throw new Error(`invalid hot.accept() usage.`)
75 }
76 }
77
78 // export names (first arg) are irrelevant on the client side, they're
79 // extracted in the server for propagation

Callers

nothing calls this directly

Calls 2

acceptDepsMethod · 0.95
callbackFunction · 0.85

Tested by

no test coverage detected