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

@ -1,25 +1,24 @@
/**
* Bun Compile Test
* Bun Runtime Test
*
* Tests that Brainy works when compiled with `bun build --compile`.
* This verifies:
* Tests that Brainy runs correctly under the Bun runtime (`bun add` / `bun run`)
* the supported Bun story. Verifies:
* 1. No native binaries required (pure WASM)
* 2. Model is properly bundled
* 3. Embeddings work without network access
*
* To test manually:
* bun build tests/integration/bun-compile-test.ts --compile --outfile /tmp/brainy-bun-test
* /tmp/brainy-bun-test
* To run manually:
* bun tests/integration/bun-runtime-test.ts
*/
import { Brainy } from '../../dist/index.js'
import { embeddingManager } from '../../dist/embeddings/EmbeddingManager.js'
import { WASMEmbeddingEngine } from '../../dist/embeddings/wasm/index.js'
async function testBunCompile() {
async function testBunRuntime() {
const results: { test: string; passed: boolean; error?: string }[] = []
console.log('🚀 Brainy Bun Compile Test\n')
console.log('🚀 Brainy Bun Runtime Test\n')
console.log('Runtime:', typeof Bun !== 'undefined' ? `Bun ${Bun.version}` : `Node.js ${process.version}`)
console.log('')
@ -153,13 +152,13 @@ async function testBunCompile() {
console.log('\n❌ Some tests failed!')
process.exit(1)
} else {
console.log('\n✅ All tests passed! Brainy works with Bun compile.')
console.log('\n✅ All tests passed! Brainy runs under Bun.')
process.exit(0)
}
}
// Run tests
testBunCompile().catch(error => {
testBunRuntime().catch(error => {
console.error('Fatal error:', error)
process.exit(1)
})