Skip to content

Commit da0a2b3

Browse files
committed
refactor(wasm): update unified bundle output path
Update build-unified-wasm.mjs to output to packages/cli/build/unified-wasm.mjs instead of external/socket-ai-sync.mjs for better integration with CLI build process. This change prepares for future unified WASM bundle experimentation while keeping the current working individual extraction pattern.
1 parent a99140a commit da0a2b3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/wasm/build-unified-wasm.mjs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* OUTPUT:
3333
* - 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)
3535
*/
3636

3737
import { existsSync, promises as fs } from 'node:fs'
@@ -159,7 +159,7 @@ async function installBinaryen() {
159159
const __dirname = path.dirname(fileURLToPath(import.meta.url))
160160
const rootPath = path.join(__dirname, '../..')
161161
const wasmBundleDir = path.join(rootPath, 'build/wasm-bundle')
162-
const externalDir = path.join(rootPath, 'external')
162+
const cliBuildDir = path.join(rootPath, 'packages/cli/build')
163163

164164
logger.step('Build Unified WASM Bundle')
165165

@@ -380,8 +380,8 @@ logger.progress('Encoding as base64')
380380
const wasmBase64 = wasmCompressed.toString('base64')
381381
logger.done(`Encoded: ${wasmBase64.length} bytes`)
382382

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')
385385

386386
const syncContent = `/**
387387
* Unified WASM Loader for Socket CLI AI Features
@@ -542,7 +542,10 @@ export function getEmbeddedSizes() {
542542
}
543543
`
544544

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')
546549
await fs.writeFile(outputPath, syncContent, 'utf-8')
547550

548551
logger.done(`Generated ${outputPath}`)

0 commit comments

Comments
 (0)