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