MCPcopy
hub / github.com/codeaashu/claude-code / createRoot

Function createRoot

src/ink/root.ts:129–157  ·  view source on GitHub ↗
({
  stdout = process.stdout,
  stdin = process.stdin,
  stderr = process.stderr,
  exitOnCtrlC = true,
  patchConsole = true,
  onFrame,
}: RenderOptions = {})

Source from the content-addressed store, hash-verified

127 * Like react-dom's createRoot — call root.render() to mount a tree.
128 */
129export async function createRoot({
130 stdout = process.stdout,
131 stdin = process.stdin,
132 stderr = process.stderr,
133 exitOnCtrlC = true,
134 patchConsole = true,
135 onFrame,
136}: RenderOptions = {}): Promise<Root> {
137 // See wrappedRender — preserve microtask boundary from the old WASM await.
138 await Promise.resolve()
139 const instance = new Ink({
140 stdout,
141 stdin,
142 stderr,
143 exitOnCtrlC,
144 patchConsole,
145 onFrame,
146 })
147
148 // Register in the instances map so that code that looks up the Ink
149 // instance by stdout (e.g. external editor pause/resume) can find it.
150 instances.set(stdout, instance)
151
152 return {
153 render: node => instance.render(node),
154 unmount: () => instance.unmount(),
155 waitUntilExit: () => instance.waitUntilExit(),
156 }
157}
158
159const getOptions = (
160 stdout: NodeJS.WriteStream | RenderOptions | undefined = {},

Callers

nothing calls this directly

Calls 5

renderMethod · 0.95
unmountMethod · 0.95
waitUntilExitMethod · 0.95
resolveMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected