Repository navigation
fix: prevent unrelated CommonJS member call targets - #28
Merged
Merged
Conversation
This was referenced Nov 9, 2026
Closed
This was referenced Nov 17, 2026
Closed
Closed
Track imported export files during sync, retain callable export aliases, and require block visibility for local class shadows.
A whole-file `module.exports = require('./m')` forwarder was matched on
raw text, so a license header or a trailing comment line made it look
like other code. The default binding then lost its namespace answer and
an absent member fell back to an unrelated class's method by name.
Match the forwarder on comment-blanked text instead.
… and syncs
A .js module is read in JSX mode, where a Flow or TS generic such as
`type Fn = <T>(x: T) => T;` opens an element that never closes and turns
the rest of the file into text. A later `module.exports = new Store()`
went unseen, the module read as a namespace, and a correct member call was
dropped. A read that ends with an element still open is now uncertain.
A call the namespace guard leaves unresolved waits under the module key of
the binding it goes through. Behind a `module.exports = require('./m')`
forwarder that key names the forwarder, so an edit to m.js that made the
call resolvable was never retried, and a sync disagreed with a fresh
index. The sync's failed-reference retry now adds the keys of the
forwarders that reach a changed file.
…onJS writes A Flow or TS generic such as `type Fn = <T>(x: T) => T;` reads as a JSX element in JSX mode, and a `</div>` later in a comment or string closes it, so the file looked fully read while `module.exports = new Decoy()` sat in the swallowed text. The module read as a namespace and a correct member call was dropped. A file with any JSX is now read in plain mode as well: either read being uncertain makes it uncertain, and a member either read sees is a member. Both only hand the file back to the resolution it had before. A whole-file forwarder needs both `require(` and `exports`, so files without them skip the comment strip (the sync's forwarder walk reads every importer).
inth3shadows
force-pushed
the
fix/commonjs-missing-member
branch
from
November 17, 2026 11:40
8c34a85 to
c6bb300
Compare
inth3shadows
marked this pull request as ready for review
November 17, 2026 11:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CommonJS default-binding member calls could resolve to an unrelated class when the imported module does not export that member. This change adds the namespace guard, sync dependency tracking, scope checks, and an isolated tokenizer-based export reader while preserving explicitly exported callable aliases.
Draft checkpoint of the current work. Do not merge by itself: known review finding F8 mistakes wrap(eval)("ignored") for grouped direct eval, which can restore a decoy call for a missing member. The separate correction is #29, based on this branch; review and integrate that follow-up before considering this PR for main.
Validation on this checkpoint: 91 focused tests and npm run build passed. The pre-final-eval full suite passed 10,650 tests (2 expected failures, 448 skips), predating the last eval adjustment. The final checkpoint full run was deliberately interrupted after review demonstrated F8. Both native review lanes completed; the intended eval cases passed, but the broad lane reproduced F8. Final combined verification is tracked in #29.
Refs #27. No deployment or upstream report is included.