MCPcopy Create free account
hub / github.com/TanStack/devtools / injectRuntimeBridge

Function injectRuntimeBridge

packages/devtools-vite/src/runtime-bridge.ts:54–65  ·  view source on GitHub ↗
(
  code: string,
  id: string,
  environmentName: string | undefined,
)

Source from the content-addressed store, hash-verified

52}
53
54export function injectRuntimeBridge(
55 code: string,
56 id: string,
57 environmentName: string | undefined,
58): string | undefined {
59 // Only isolated server environments need the bridge. The client environment
60 // has `window`; the in-process RunnableDevEnvironment is handled by the
61 // runtime global guard inside the injected code.
62 if (!environmentName || environmentName === 'client') return undefined
63 if (!isEventClientModule(id, code)) return undefined
64 return `${code}\n${generateRuntimeBridgeCode()}`
65}
66
67interface BridgeHotChannel {
68 on?: (event: string, cb: (data: any) => void) => void

Callers 2

transformFunction · 0.90

Calls 2

isEventClientModuleFunction · 0.85

Tested by

no test coverage detected