chore(8.0): modernize toolchain + position Bun as a runtime

Consumer-invisible modernization pass — no public API or runtime-behavior
change; dist for the override-only files is byte-identical.

Toolchain:
- CI: GitHub Actions matrix — Node 22/24 (test:unit) + Bun latest (test:bun).
- engines: node ">=22" (was "22.x"), bun ">=1.1.0".
- tsconfig: isolatedModules + noImplicitOverride; add the 33 `override`
  modifiers the flag requires across storage/integrations/vfs/transaction.
- deps: @types/node ^22; add prettier; drop dead standard-version,
  @rollup/plugin-* and the redundant embedded eslintConfig (flat
  eslint.config.js is the active config — verified identical lint output).

paramValidation: replace the top-level `await import('node:os'/'node:fs')`
with static ESM imports. The top-level-await form poisoned the module graph;
static imports also drop the browser/edge fallback branches no supported
runtime reaches (8.0 is Node/Bun/Deno-only).

Bun positioning: recommend Bun as a runtime (`bun add` / `bun run`), which is
green (test:bun 8/8). Drop single-binary `bun build --compile` as a target —
native addons cannot embed into it, and Bun 1.3.10 has a `--compile` codegen
regression around top-level await. Rename the Bun test to bun-runtime-test.ts
and correct docs that overclaimed single-binary support.

Gates: typecheck 0, build 0, test:unit 1743/1743, test:bun 8/8.
This commit is contained in:
David Snelling 2026-07-01 09:16:46 -07:00
parent ae55d54cb5
commit ca9129a924
20 changed files with 159 additions and 2330 deletions

View file

@ -215,9 +215,9 @@ console.log('Server running on http://localhost:3000')
```
**Benefits:**
- ✅ Native Bun performance (~2x faster than Node.js)
- ✅ Native Bun runtime performance
- ✅ No framework dependencies
- ✅ Works with `bun --compile` for single-binary deployment
- ✅ Pure WASM — no native binaries, bundler-friendly
- ✅ Built-in TypeScript support
### Pattern 4: Express/Node.js Middleware (Legacy)

View file

@ -35,15 +35,18 @@ This single WASM file contains everything needed for sentence embeddings.
### Bun (Recommended)
```typescript
// Works with Bun runtime
```bash
# Bun as a runtime — supported and recommended
bun add @soulcraft/brainy
bun run server.ts
// Works with bun --compile (single binary deployment!)
bun build --compile --target=bun server.ts
./server // Self-contained binary with embedded model
```
Brainy is pure WebAssembly with no native binaries, so the module graph stays
bundler-friendly. Single-binary `bun build --compile` is **not a supported
target** at present: Bun 1.3.10 has a `--compile` codegen regression
(`__promiseAll is not defined`) triggered by top-level `await` in the bundled
graph. Run Brainy under the Bun runtime (above) instead.
### Node.js
```typescript
@ -164,7 +167,7 @@ await brain.init()
**What's new:**
- Faster initialization
- Works with `bun --compile`
- Bundler-friendly (pure WASM, no native binaries)
- No network requirements
### From Custom Embedding Functions
@ -216,9 +219,8 @@ export { brain }
### Deployment
```bash
# Option 1: Bun compile (single binary)
bun build --compile server.ts
./server # Contains everything
# Option 1: Bun runtime
bun run server.ts
# Option 2: Docker
docker build -t my-app .