Skip to content

Reproduce runtime root ERM build output#147

Draft
mmkal wants to merge 2 commits into
mainfrom
repro/runtime-root-using-transform
Draft

Reproduce runtime root ERM build output#147
mmkal wants to merge 2 commits into
mainfrom
repro/runtime-root-using-transform

Conversation

@mmkal

@mmkal mmkal commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces #142 with a focused repro of the real runtime-root packaging problem instead of hand-editing selected using sites in source.

The new scripts/repro-runtime-root-using-transform.sh does three things:

  1. Runs the real pnpm --filter sqlfu build.
  2. Uses esbuild metadata to walk the built dist/index.js import graph.
  3. Parses each reachable built dist/*.js file as ES2022 through ESLint's parser.

What It Shows

Current build output still contains explicit resource management syntax in the root runtime import graph:

FAIL: built sqlfu root import graph contains syntax that an ES2022 parser rejects.
Checked 48 built files reachable from dist/index.js.

First failures:
- dist/config-inline.js:56:11 Parsing error: Unexpected token stmt
  using stmt = client.prepare(sql);
- dist/dialect.js:73:25 Parsing error: Unexpected token database
  await using database = await host.openScratchDb('materialize-schema');
- dist/schemadiff/sqlite/index.js:8:17 Parsing error: Unexpected token baseline
  await using baseline = await host.openScratchDb('baseline');

The same script also runs an esbuild target=es2022 probe of the root graph, and that lowered output parses successfully. That supports the likely follow-up fix: keep ERM in authored TypeScript, then transform the built runtime output during pnpm build.

Verification

scripts/repro-runtime-root-using-transform.sh

Expected today: exits 1 with the parse failures above.

Notes

PR #142 is closed. This PR intentionally does not implement the build transform; it gives the next PR a concrete failing signal.

Package size — packed 280.3 kB (no change)

Package size

main this PR Δ
packed 280.3 kB 280.3 kB 0
unpacked 1.12 MB 1.12 MB 0
files 226 226 0

dist/vendor/*.js bundles

main this PR Δ
vendor/sha256.js 4.3 kB 4.3 kB 0
vendor/sql-formatter/*.js 94.5 kB 94.5 kB 0
vendor/sqlfu-sqlite-parser/*.js 17.2 kB 17.2 kB 0
vendor/standard-schema/*.js 2.8 kB 2.8 kB 0
vendor/typesql/*.js 134.8 kB 134.8 kB 0

Measured with npm pack --dry-run --json on sqlfu (0.0.3-7 on main vs 0.0.3-7 on this PR).

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/sqlfu@147

commit: e33c5f3

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