-
Notifications
You must be signed in to change notification settings - Fork 17
feat: unified AST analysis framework (Phase 3.1) #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
322b527
feat: unified AST analysis framework with pluggable visitor pattern
carlos-alm e4a5ac0
merge: resolve BACKLOG.md conflict, renumber dynamic import item to I…
carlos-alm 7480476
revert: restore original check-dead-exports.sh hook
carlos-alm cd7f0e1
fix: address Greptile review — indexOf→m.index, precise publicAPI reg…
carlos-alm 445a04a
Merge branch 'main' into feat/unified-ast-analysis-framework
carlos-alm c196c8e
fix: address Greptile review — halsteadSkip depth counter, debug logg…
carlos-alm 89344de
Merge remote-tracking branch 'origin/main' into feat/unified-ast-anal…
carlos-alm a47eb47
fix: remove function nodes from nestingNodeTypes and eliminate O(n²) …
carlos-alm 77b4516
fix: remove function nesting inflation in computeAllMetrics and pass …
carlos-alm a84b7e4
fix: guard runAnalyses call, fix nested function nesting, rename _eng…
carlos-alm 6d0f34e
fix: remove redundant processed Set and fix multi-line destructuring …
carlos-alm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single-line-only destructuring extraction misses multi-line patterns
The
linevariable captures only the source line that containsimport(...). When a dynamic import is consumed with a multi-line destructuring pattern, the opening{and the imported names are on different lines from theimport()call:In that case the "line" captured is
) = await import('./ast-analysis/engine.js');— no{…}on that line — so the regex at line 99 produces no match and none of the names are added topublicAPI. As a result the hook may continue to flagrunAnalysesandbuildExtensionSetas dead exports even after this fix, causing spurious pre-commit failures.A more robust approach is to search the surrounding window (e.g. a few lines before the
import()match) for the opening brace, or to scan the full source once with a multi-line regex that capturesconst\s*\{([^}]+)\}\s*=\s*(?:await\s+)?import(:(The
sflag makes.match newlines, covering multi-line destructuring blocks.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6d0f34e — replaced the single-line regex with a multi-line-safe pattern using the
sflag:const\s*\{([^}]+)\}\s*=\s*(?:await\s+)?import\s*\(['"/gs. This correctly handles multi-line destructuring likeconst {\n runAnalyses,\n} = await import(...). Also added a second pattern for single-binding default imports (const X = await import(...)).