Repository navigation
fix(parser): give ESM entries an explicit module scope - #201
pyramation wants to merge 1 commit into
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review complete. 🟡 1 medium 📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Failed load permanently poisons In the ESM A transient failure that would succeed on retry becomes permanent, which matters precisely for the newly relocated This PR introduces dual ESM/CJS entry points for the parser package: the prepare script now writes an
Reviewed commit: 129194d |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Summary
@pgsql/parser's ESM entries currently rely on Node's syntax detection; with detection disabled,import { Parser } from '@pgsql/parser'fails withSyntaxError: Named export 'Parser' not found. This gives the ESM entries an explicit module scope without.mjsfiles.parser/scripts/prepare.jswriteswasm/esm/package.json({"type":"module"}) and puts the ESM entries inside it; the WASM loader and bundled types stay outside as CommonJS.parser/package.jsonpoints every existing ESM export atwasm/esm/…and liststypesconditions first. CJS paths and versions unchanged.parser/templates/index.js.templateimports the scoped entries.parser/test/esm.test.mjsadds a root + v18 regression test run with syntax detection disabled (subprocess errors surfaced, not discarded).Fresh redo of #182 on current main. Left out vs #182:
.mjsoutputs (folder-scopedtype: moduleinstead) and the duplicated per-version (PG13–17) regression tests — the shared export map covers those versions and PG 18 is the focus.Tested locally: PG18 WASM built from source,
versions/18tests 150/150, parser suite 34/34 on Node 20; packed tarball imports root and all six subpaths in ESM and CJS with detection disabled and type-checks under NodeNext.Implemented in session Redo explicit ESM module scope in libpg-query-node
Review with Devin · Open in Devin Desktop
Summary by CodeRabbit
requirepaths remain available.