Skip to content
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

Port more changes to JS rules #320

Merged
merged 48 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0afdd2a
Adds missing syntax types
hendrikvanantwerpen Oct 9, 2023
a352c39
Adds class to definiens rules for assignments etc
hendrikvanantwerpen Oct 9, 2023
46dde3e
Excludes CommonJS exports from definiens
hendrikvanantwerpen Oct 9, 2023
e53474a
Adds test case and fix
hendrikvanantwerpen Oct 9, 2023
f3bb1d8
Fix test assertion
hendrikvanantwerpen Oct 9, 2023
0ffa7b4
Adds fix for default CommonJS default imports
hendrikvanantwerpen Oct 9, 2023
1bce687
Adds current versions of tests, etc.
hendrikvanantwerpen Oct 9, 2023
5e978ce
Reorgs
hendrikvanantwerpen Oct 10, 2023
664772e
Reorg (cont.)
hendrikvanantwerpen Oct 10, 2023
ecba922
Adds default import test & Fixes bugs
hendrikvanantwerpen Oct 10, 2023
3525306
Adds CJS versions of tests
hendrikvanantwerpen Oct 10, 2023
37ef4a2
Removes some commented out queries
hendrikvanantwerpen Oct 10, 2023
a595055
Adds first vea test
hendrikvanantwerpen Oct 10, 2023
8b4bfee
Fixes small bug
hendrikvanantwerpen Oct 10, 2023
c4f5b45
Adds bug fixes for transitive callers
hendrikvanantwerpen Oct 10, 2023
050a6cb
Adds some new tests and fixes
hendrikvanantwerpen Oct 10, 2023
f6a6b08
Removes no-longer-needed definition baselines
hendrikvanantwerpen Oct 11, 2023
b2f5370
Adds more tests and some bug fixes
hendrikvanantwerpen Oct 11, 2023
5c817dc
Reorgs and fixes some bugs
hendrikvanantwerpen Oct 11, 2023
fec4e45
Add remaining tests and bug fixes
hendrikvanantwerpen Oct 12, 2023
2f582a9
Adds more tests and testing info
hendrikvanantwerpen Oct 12, 2023
e0f66aa
Fixes definiens syntax types
hendrikvanantwerpen Oct 12, 2023
310995d
Remove unnecessary patterns
hendrikvanantwerpen Oct 12, 2023
9b13fc1
Adds empty statement block bug fix
hendrikvanantwerpen Oct 12, 2023
a543dbd
Hoisting changes:
hendrikvanantwerpen Oct 12, 2023
182ab99
Adds support for `import`'s default field
hendrikvanantwerpen Oct 12, 2023
b9d5119
Adds tests for module.exports.foo pattern
hendrikvanantwerpen Oct 12, 2023
6c33f75
Adds fix for ES6 default exports
hendrikvanantwerpen Oct 12, 2023
83a470c
Add comment explaining import & export specifier rules
hendrikvanantwerpen Oct 10, 2023
03d755d
Fix definiens warning
hendrikvanantwerpen Oct 10, 2023
2e2e221
Drop explicit tree-sitter version dependency
hendrikvanantwerpen Oct 10, 2023
d8e6c28
Remove unconditional scope pass-throughs for empty elements
hendrikvanantwerpen Oct 11, 2023
4be77c5
Fix bug when main is unset in package.json and clarify behavior
hendrikvanantwerpen Oct 12, 2023
80d73ca
Make subscripts proper references
hendrikvanantwerpen Oct 13, 2023
00ea067
Add definiens for CommonJS exports
hendrikvanantwerpen Oct 13, 2023
271df51
Fix some default guard definiens
hendrikvanantwerpen Oct 13, 2023
a25b9c4
Use statement as definiens like the old code
hendrikvanantwerpen Oct 13, 2023
84015cc
Consolidate syntax type rules
hendrikvanantwerpen Oct 13, 2023
1178fc2
Port detour nodes
hendrikvanantwerpen Oct 13, 2023
2a81b45
Add missing expression
hendrikvanantwerpen Oct 13, 2023
769d984
Fix scope after member assignment
hendrikvanantwerpen Oct 14, 2023
1475444
Add exponential blowup tests (but skipped)
hendrikvanantwerpen Oct 16, 2023
8835141
Add reference for ES6/CommonJS interop.
hendrikvanantwerpen Oct 16, 2023
2a22ad2
Fix bug with string property keys
hendrikvanantwerpen Oct 16, 2023
e8feb26
Merge branch 'new_js' into new_js_more_changes
hendrikvanantwerpen Oct 17, 2023
a342c0d
Prefer higher-priority similar paths
hendrikvanantwerpen Oct 17, 2023
6fd2a98
Renable exponential blowup tests
hendrikvanantwerpen Oct 17, 2023
d067d27
Merge branch 'new_js' into new_js_more_changes
hendrikvanantwerpen Oct 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion languages/tree-sitter-stack-graphs-javascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ clap = { version = "4", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
stack-graphs = { version = "0.12", path = "../../stack-graphs" }
tree-sitter = "=0.20.9"
tree-sitter-stack-graphs = { version = "0.7", path = "../../tree-sitter-stack-graphs" }
tree-sitter-javascript = { git = "https://github.com/tree-sitter/tree-sitter-javascript", rev = "5720b249490b3c17245ba772f6be4a43edb4e3b7" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ impl FileAnalyzer for NpmPackageAnalyzer {
// [root] -> [pop "GUARD:PKG"] -> [pop PKG_NAME]* -> [push PKG_INTERNAL_NAME] -> [push "GUARD:PKG_INTERNAL"] -> [root]
//
if !npm_pkg.name.is_empty() {
// NOTE Because all modules expose their exports at the top-level, both paths created below are equivalent for
// exports of the main module. This means multiple equivalent paths to those exports, which is bad for
// performance. At the moment, we have no mechanism to prevent this from happening.

// reach package internals via package name
//
// [root] -> [pop "GUARD:PKG"] -> [pop pkg_name]* -> [push pkg_internal_name]
Expand All @@ -112,7 +116,9 @@ impl FileAnalyzer for NpmPackageAnalyzer {
"exports_guard_pop",
);
replace_edge(graph, pkg_name_pop, exports_guard_pop, 1);
let main = NormalizedRelativePath::from_str(&npm_pkg.main)
let main = Some(npm_pkg.main)
.filter(|main| !main.is_empty())
.and_then(|main| NormalizedRelativePath::from_str(&main))
.map(|p| p.into_path_buf())
.unwrap_or(PathBuf::from("index"))
.with_extension("");
Expand Down
Loading
Loading