|
5 | 5 | * Usage: |
6 | 6 | * node scripts/download-assets.mjs [asset-names...] [options] |
7 | 7 | * node scripts/download-assets.mjs # Download all assets (parallel) |
8 | | - * node scripts/download-assets.mjs yoga models # Download specific assets (parallel) |
| 8 | + * node scripts/download-assets.mjs models # Download specific assets (parallel) |
9 | 9 | * node scripts/download-assets.mjs --no-parallel # Download all assets (sequential) |
10 | 10 | * |
11 | 11 | * Assets: |
12 | 12 | * binject - Binary injection tool |
13 | 13 | * iocraft - iocraft native bindings (.node files) |
14 | 14 | * models - AI models tar.gz (MiniLM, CodeT5) |
15 | 15 | * node-smol - Minimal Node.js binaries |
16 | | - * yoga - Yoga layout WASM (yoga-sync.mjs) |
17 | 16 | */ |
18 | 17 |
|
19 | 18 | import { existsSync, promises as fs } from 'node:fs' |
@@ -94,22 +93,6 @@ const ASSETS = { |
94 | 93 | name: 'node-smol', |
95 | 94 | type: 'binary', |
96 | 95 | }, |
97 | | - yoga: { |
98 | | - description: 'Yoga layout WASM', |
99 | | - download: { |
100 | | - asset: 'yoga-sync-*.mjs', |
101 | | - cwd: rootPath, |
102 | | - downloadDir: '../../packages/build-infra/build/downloaded', |
103 | | - quiet: false, |
104 | | - tool: 'yoga-layout', |
105 | | - }, |
106 | | - name: 'yoga', |
107 | | - process: { |
108 | | - format: 'javascript', |
109 | | - outputPath: path.join(rootPath, 'build/yoga-sync.mjs'), |
110 | | - }, |
111 | | - type: 'processed', |
112 | | - }, |
113 | 96 | } |
114 | 97 |
|
115 | 98 | /** |
@@ -221,29 +204,6 @@ async function extractArchive(tarGzPath, extractConfig, assetName) { |
221 | 204 | await fs.writeFile(versionPath, tag, 'utf-8') |
222 | 205 | } |
223 | 206 |
|
224 | | -/** |
225 | | - * Transform yoga-sync.mjs to remove top-level await for CJS compatibility. |
226 | | - * |
227 | | - * The newer yoga-sync builds incorrectly use top-level await which isn't |
228 | | - * compatible with esbuild's CJS output format. Despite the name, yogaPromise |
229 | | - * is synchronous (-sWASM_ASYNC_COMPILATION=0), so we can call it directly. |
230 | | - */ |
231 | | -function transformYogaSync(content) { |
232 | | - // Pattern: const Yoga = wrapAssembly(await yogaPromise); |
233 | | - // Transform to: const Yoga = wrapAssembly(yogaPromise); |
234 | | - // (yogaPromise is synchronous despite its name) |
235 | | - const hasTopLevelAwait = content.includes('wrapAssembly(await yogaPromise)') |
236 | | - if (!hasTopLevelAwait) { |
237 | | - return content |
238 | | - } |
239 | | - |
240 | | - // Replace the top-level await pattern with synchronous call. |
241 | | - return content.replace( |
242 | | - /const Yoga = wrapAssembly\(await yogaPromise\);/, |
243 | | - 'const Yoga = wrapAssembly(yogaPromise);', |
244 | | - ) |
245 | | -} |
246 | | - |
247 | 207 | /** |
248 | 208 | * Process and transform asset (e.g., add header to JS file). |
249 | 209 | */ |
@@ -276,11 +236,6 @@ async function processAsset(assetPath, processConfig, assetName) { |
276 | 236 | // Read the downloaded asset. |
277 | 237 | let content = await fs.readFile(assetPath, 'utf-8') |
278 | 238 |
|
279 | | - // Transform yoga-sync to remove top-level await for CJS compatibility. |
280 | | - if (assetName === 'yoga') { |
281 | | - content = transformYogaSync(content) |
282 | | - } |
283 | | - |
284 | 239 | // Compute source hash for cache validation. |
285 | 240 | const sourceHash = await computeFileHash(assetPath) |
286 | 241 |
|
|
0 commit comments