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

Function createRoot

packages/@ant/ink/src/core/root.ts:130–158  ·  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

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

Callers 2

main.tsxFile · 0.85
runFunction · 0.85

Calls 5

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

Tested by

no test coverage detected