forked from optix2000/opencode-ast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.ts
More file actions
28 lines (23 loc) · 673 Bytes
/
Copy pathbundle.ts
File metadata and controls
28 lines (23 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bun
import path from "node:path"
const out = await Bun.build({
entrypoints: [path.join(import.meta.dir, "src/index.ts")],
target: "bun",
format: "esm",
minify: false,
external: ["@opencode-ai/plugin"],
})
if (!out.success) {
console.error("Bundle failed:")
for (const msg of out.logs) console.error(msg)
process.exit(1)
}
const artifact = out.outputs[0]
if (!artifact) {
console.error("Bundle produced no output")
process.exit(1)
}
const result = await artifact.text()
const dest = path.join(import.meta.dir, "dist", "ast.js")
await Bun.write(dest, result)
console.log(`Bundled to ${dest} (${(result.length / 1024).toFixed(1)} KB)`)