recognize modules imported by AMD imports as library inputs

This commit is contained in:
Erik Krogh Kristensen
2022-02-23 10:39:45 +01:00
parent 31a204a5d9
commit 203212657e
5 changed files with 32 additions and 1 deletions

View File

@@ -87,6 +87,15 @@ private DataFlow::Node getAValueExportedByPackage() {
result = getAnExportFromModule(mod)
)
or
// require("./other-module.js"); inside an AMD module.
exists(Module mod, CallExpr call |
call = getAValueExportedByPackage().asExpr() and
call = any(AmdModuleDefinition e).getARequireCall() and
mod = call.getAnArgument().(Import).getImportedModule()
|
result = getAnExportFromModule(mod)
)
or
// module.exports = class Foo {
// bar() {} // <- result
// static baz() {} // <- result