Skip to content

feat(opencode): bundle deps with bun build for zero-dependency runtime#21

Open
iceteaSA wants to merge 1 commit into
cortexkit:mainfrom
iceteaSA:feat/bun-build
Open

feat(opencode): bundle deps with bun build for zero-dependency runtime#21
iceteaSA wants to merge 1 commit into
cortexkit:mainfrom
iceteaSA:feat/bun-build

Conversation

@iceteaSA
Copy link
Copy Markdown

Summary

Changes the default build script in packages/opencode from tsc to bun build, producing self-contained output with all dependencies inlined. No node_modules/ needed at runtime.

Before

bun run build  # tsc → dist/*.js (requires node_modules at runtime)

After

bun run build      # bun build → bundled dist/ (~85KB, all deps inlined, minified, code-split)
bun run build:dev  # tsc → individual dist/*.js (for development, requires node_modules)

The bundled output inlines @cortexkit/anthropic-auth-core and all transitive deps (like xxhash-wasm). Only @opencode-ai/plugin is kept external (peer dep provided by OpenCode at runtime).

Type declarations are still emitted via tsc --emitDeclarationOnly.

Use case

This enables using the plugin via file:// path without publishing to npm:

{
  "plugin": ["file:///path/to/anthropic-auth/packages/opencode"]
}

Files Changed

  • packages/opencode/package.json — new build script (bun build + tsc declarations), build:dev for old tsc behavior
  • packages/opencode/README.md — documents both build modes

Testing

All 214 tests pass. Build output verified: 3 files (~85KB total).

Default build now uses bun to inline core + xxhash-wasm into dist/.
No node_modules needed at runtime — the plugin works via file:// path.
Keeps build:dev for tsc output during development.

Output: 3 files totaling ~85KB (minified, code-split).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant