Skip to content

Commit 4437f47

Browse files
authored
Merge pull request #20297 from asgerf/js/simpler-summary-pruning
JS: Change pruning to not rely on Import
2 parents bd31e7f + be32579 commit 4437f47

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsSpecific.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ predicate parseTypeString(string rawType, string package, string qualifiedName)
5858
predicate isPackageUsed(string package) {
5959
package = "global"
6060
or
61-
package = any(JS::Import imp).getImportedPathString()
61+
// To simplify which dependencies are needed to construct DataFlow::Node, we don't want to rely on `Import` here.
62+
// Just check all string literals.
63+
package = any(JS::Expr imp).getStringValue()
6264
or
63-
any(JS::TypeAnnotation t).hasUnderlyingType(package, _)
65+
package = any(JS::StringLiteralTypeExpr t).getValue() // Can be used in `import("foo")`
6466
or
6567
exists(JS::PackageJson json | json.getPackageName() = package)
6668
}

0 commit comments

Comments
 (0)