Merge pull request #20297 from asgerf/js/simpler-summary-pruning

JS: Change pruning to not rely on Import
This commit is contained in:
Asger F
2025-08-28 11:20:14 +02:00
committed by GitHub

View File

@@ -58,9 +58,11 @@ predicate parseTypeString(string rawType, string package, string qualifiedName)
predicate isPackageUsed(string package) {
package = "global"
or
package = any(JS::Import imp).getImportedPathString()
// To simplify which dependencies are needed to construct DataFlow::Node, we don't want to rely on `Import` here.
// Just check all string literals.
package = any(JS::Expr imp).getStringValue()
or
any(JS::TypeAnnotation t).hasUnderlyingType(package, _)
package = any(JS::StringLiteralTypeExpr t).getValue() // Can be used in `import("foo")`
or
exists(JS::PackageJson json | json.getPackageName() = package)
}