createServerModuleRunnerTransport() — vite Function Reference
Architecture documentation for the createServerModuleRunnerTransport() function in serverModuleRunner.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD ff59ab93_7c74_485b_47bc_a4e4a58d6455["createServerModuleRunnerTransport()"] d14cf24c_f830_6905_0df1_4e9b0f67c84b["serverModuleRunner.ts"] ff59ab93_7c74_485b_47bc_a4e4a58d6455 -->|defined in| d14cf24c_f830_6905_0df1_4e9b0f67c84b ebea5da1_fa3d_b3f6_9793_71dfb88847a4["createServerModuleRunner()"] ebea5da1_fa3d_b3f6_9793_71dfb88847a4 -->|calls| ff59ab93_7c74_485b_47bc_a4e4a58d6455 f297b990_b9f9_4d71_aa05_07419a0a6688["constructor()"] f297b990_b9f9_4d71_aa05_07419a0a6688 -->|calls| ff59ab93_7c74_485b_47bc_a4e4a58d6455 style ff59ab93_7c74_485b_47bc_a4e4a58d6455 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/ssr/runtime/serverModuleRunner.ts lines 74–124
export const createServerModuleRunnerTransport = (options: {
channel: NormalizedServerHotChannel
}): ModuleRunnerTransport => {
const hmrClient: HotChannelClient = {
send: (payload: HotPayload) => {
if (payload.type !== 'custom') {
throw new Error(
'Cannot send non-custom events from the client to the server.',
)
}
options.channel.send(payload)
},
}
let handler: ((data: HotPayload) => void) | undefined
return {
connect({ onMessage }) {
options.channel.api!.outsideEmitter.on('send', onMessage)
options.channel.api!.innerEmitter.emit(
'vite:client:connect',
undefined,
hmrClient,
)
onMessage({ type: 'connected' })
handler = onMessage
},
disconnect() {
if (handler) {
options.channel.api!.outsideEmitter.off('send', handler)
}
options.channel.api!.innerEmitter.emit(
'vite:client:disconnect',
undefined,
hmrClient,
)
},
send(payload) {
if (payload.type !== 'custom') {
throw new Error(
'Cannot send non-custom events from the server to the client.',
)
}
options.channel.api!.innerEmitter.emit(
payload.event,
payload.data,
hmrClient,
)
},
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does createServerModuleRunnerTransport() do?
createServerModuleRunnerTransport() is a function in the vite codebase, defined in packages/vite/src/node/ssr/runtime/serverModuleRunner.ts.
Where is createServerModuleRunnerTransport() defined?
createServerModuleRunnerTransport() is defined in packages/vite/src/node/ssr/runtime/serverModuleRunner.ts at line 74.
What calls createServerModuleRunnerTransport()?
createServerModuleRunnerTransport() is called by 2 function(s): constructor, createServerModuleRunner.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free