|
31 | 31 | * |
32 | 32 | * OUTPUT: |
33 | 33 | * - build/wasm-bundle/pkg/socket_ai_bg.wasm (~115MB with INT4) |
34 | | - * - external/socket-ai-sync.mjs (brotli-compressed, base64-encoded WASM) |
| 34 | + * - packages/cli/build/unified-wasm.mjs (brotli-compressed, base64-encoded WASM) |
35 | 35 | */ |
36 | 36 |
|
37 | 37 | import { existsSync, promises as fs } from 'node:fs' |
@@ -159,7 +159,7 @@ async function installBinaryen() { |
159 | 159 | const __dirname = path.dirname(fileURLToPath(import.meta.url)) |
160 | 160 | const rootPath = path.join(__dirname, '../..') |
161 | 161 | const wasmBundleDir = path.join(rootPath, 'build/wasm-bundle') |
162 | | -const externalDir = path.join(rootPath, 'external') |
| 162 | +const cliBuildDir = path.join(rootPath, 'packages/cli/build') |
163 | 163 |
|
164 | 164 | logger.step('Build Unified WASM Bundle') |
165 | 165 |
|
@@ -380,8 +380,8 @@ logger.progress('Encoding as base64') |
380 | 380 | const wasmBase64 = wasmCompressed.toString('base64') |
381 | 381 | logger.done(`Encoded: ${wasmBase64.length} bytes`) |
382 | 382 |
|
383 | | -// Generate socket-ai-sync.mjs. |
384 | | -logger.progress('Generating external/socket-ai-sync.mjs') |
| 383 | +// Generate unified-wasm.mjs. |
| 384 | +logger.progress('Generating packages/cli/build/unified-wasm.mjs') |
385 | 385 |
|
386 | 386 | const syncContent = `/** |
387 | 387 | * Unified WASM Loader for Socket CLI AI Features |
@@ -542,7 +542,10 @@ export function getEmbeddedSizes() { |
542 | 542 | } |
543 | 543 | ` |
544 | 544 |
|
545 | | -const outputPath = path.join(externalDir, 'socket-ai-sync.mjs') |
| 545 | +// Ensure build directory exists. |
| 546 | +await fs.mkdir(cliBuildDir, { recursive: true }) |
| 547 | + |
| 548 | +const outputPath = path.join(cliBuildDir, 'unified-wasm.mjs') |
546 | 549 | await fs.writeFile(outputPath, syncContent, 'utf-8') |
547 | 550 |
|
548 | 551 | logger.done(`Generated ${outputPath}`) |
|
0 commit comments