(sandpack: SandpackState)
| 3 | import { useSandpack } from "./useSandpack"; |
| 4 | |
| 5 | function getTranspiledCode(sandpack: SandpackState): string | null { |
| 6 | const { activeFile, bundlerState } = sandpack; |
| 7 | if (bundlerState == null) { |
| 8 | return null; |
| 9 | } |
| 10 | |
| 11 | const tModule = bundlerState.transpiledModules[activeFile + ":"]; |
| 12 | return tModule?.source?.compiledCode ?? null; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * @category Hooks |