Skip to content

feat(lexer): add opt-in minified enumerable detection - #127

Open
BridgeAR wants to merge 2 commits into
mainfrom
BridgeAR/2026-10-05-minified-enumerable
Open

BridgeAR wants to merge 2 commits into
mainfrom
BridgeAR/2026-10-05-minified-enumerable

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Oct 5, 2026

Copy link
Copy Markdown
Member

Minifiers can replace enumerable: true with enumerable: !0, which prevents detection of otherwise supported exports and star reexports.
allowMinifiedEnumerable enables this spelling for each parse call and preserves the default detection patterns.

Refs: #64

@guybedford guybedford left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, the implementation is consistent between the JS and C sources and I verified the committed Wasm matches a fresh build. The framing of keeping the default patterns frozen while allowing opt-in configuration for new patterns works for me.

One thing to fix before landing: this carries over a pre-existing && / || bug at the reexport site and then codifies it in the tests. See inline comments.

Comment thread lexer.js Outdated
Comment thread src/lexer.c Outdated
Comment thread test/_unit.js Outdated
Minifiers can replace `enumerable: true` with `enumerable: !0`, which prevents detection of otherwise supported exports and star reexports.
`allowMinifiedEnumerable` enables this spelling for each parse call and preserves the default detection patterns.

Refs: #64
Identifiers such as tfoo and xrue produce false star reexports. The enumerable
check accepts either the leading t or the remaining rue.
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-10-05-minified-enumerable branch from 5454a47 to 8891efd Compare October 11, 2026 09:34
@BridgeAR
BridgeAR marked this pull request as ready for review October 11, 2026 09:38
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.

2 participants