Problem
The package root is the only server SQL entry, so applications that need createQueryBuilder, configuration, and connection lifecycle also evaluate migrations, generators, seeders, DynamoDB tooling, browser models, factories, and CLI actions.
On exact main commit 7cdd77f8faa83b8ce5908f43fb824efd6307918d with stable Bun 1.4.2, 30 alternating fresh-process measurements report:
- root import median: 15.711 ms
- settled root RSS median: 30,081,024 bytes
- empty harness median: 0.002 ms and 12,500,992 bytes
- built root graph: 688,614 bytes across seven generated JavaScript files
This cost is inherited by @stacksjs/database/runtime. In Stacks, the query-builder import accounts for roughly 15.74 ms of the database runtime entry's 20.20 ms median.
Proposed change
Add a supported bun-query-builder/runtime entry containing the SQL request-time surface: query construction, configuration, connection lifecycle, and SQLite bootstrap support. Keep migrations, schema tooling, seeders, DynamoDB, browser-only code, factories, and CLI actions on the package root or their existing dedicated entries.
The root entry remains API compatible. Consumers can opt into the runtime entry without importing generated chunk filenames or private paths.
Acceptance criteria
- Export the SQL request-time API needed by framework database packages through
bun-query-builder/runtime. - Preserve the root, browser, DynamoDB, and CLI entry behavior.
- Add package export metadata and generated declarations for the runtime entry.
- Add a fresh-process root/runtime benchmark with retained raw samples and exact source/runtime provenance.
- Verify root/runtime SQL behavior parity against SQLite.
- Measure import time, settled RSS, and reachable built graph on stable Bun 1.4.2.
- Run the full test suite, lint, typecheck, build, CLI compile, and a fresh packed-consumer import check.
Baseline artifact
/Users/chris/.cache/codex-bench/stacks/database-runtime/bqb-main-root-30.json