Skip to content

Conversation

@jakebailey
Copy link
Member

These fake nodes should not contribute to the module-ness of a file.

Copilot AI review requested due to automatic review settings November 9, 2025 06:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes module detection in CommonJS files by preventing reparsed nodes (synthetic nodes created during parsing, such as from JSDoc tags) from being considered as external module indicators. The change adds a guard in isAnExternalModuleIndicatorNode to skip nodes with the NodeFlagsReparsed flag.

Key Changes:

  • Added early return in isAnExternalModuleIndicatorNode when NodeFlagsReparsed flag is set
  • Numerous baseline updates showing removal of Object.defineProperty(exports, "__esModule", { value: true }); from generated JavaScript
  • Several test baseline convergences with TypeScript reference implementation (reduction in .diff files)

Reviewed Changes

Copilot reviewed 76 out of 76 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/ast/parseoptions.go Added check to filter out reparsed nodes from external module indicator detection
testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.* Regression: JS module no longer treated as ES module, causing type errors
testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types* Improved: Dynamic import now correctly returns wrapped object type
Various *.js baseline files Removal of Object.defineProperty(exports, "__esModule", ...) preamble
Various *.diff baseline files Convergence with TypeScript reference implementation

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