()
| 136 | } |
| 137 | |
| 138 | export async function ensureRuntimeAssets(): Promise<void> { |
| 139 | if (!isBunCompiled()) { |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | const { loadEmbeddedAssets } = await import('#embedded-assets'); |
| 144 | const runtimeRoot = runtimePath(); |
| 145 | const markerPath = join(runtimeRoot, RUNTIME_MARKER); |
| 146 | if (existsSync(markerPath)) { |
| 147 | const markerVersion = readFileSync(markerPath, 'utf-8').trim(); |
| 148 | if (markerVersion === packageJson.version && runtimeAssetsReady(runtimeRoot)) { |
| 149 | return; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | ensureDirectory(runtimeRoot); |
| 154 | |
| 155 | const embeddedAssets = await loadEmbeddedAssets(); |
| 156 | |
| 157 | for (const asset of embeddedAssets) { |
| 158 | const targetPath = join(runtimeRoot, asset.relativePath); |
| 159 | await copyAssetFile(asset, targetPath); |
| 160 | } |
| 161 | |
| 162 | unpackTools(runtimeRoot); |
| 163 | ensureTunwgExecutable(runtimeRoot); |
| 164 | writeFileSync(markerPath, packageJson.version, 'utf-8'); |
| 165 | } |
| 166 | |
| 167 | export function getTunwgPath(): string { |
| 168 | const isWin = platform() === 'win32'; |
no test coverage detected