File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
javascript/ql/src/semmle/javascript/dataflow Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 55 */
66
77import javascript
8+ import semmle.javascript.dependencies.Dependencies
89
910/** A data flow node corresponding to an expression. */
1011class ExprNode extends DataFlow:: ValueNode {
@@ -487,6 +488,15 @@ module ModuleImportNode {
487488 */
488489ModuleImportNode moduleImport ( string path ) { result .getPath ( ) = path }
489490
491+ /**
492+ * Gets a (default) import of the given dependency `dep`, such as
493+ * `require("lodash")` in a context where a package.json file includes
494+ * `"lodash"` as a dependency.
495+ */
496+ ModuleImportNode dependencyModuleImport ( Dependency dep ) {
497+ result = dep .getAUse ( "import" ) .( Import ) .getDefaultNode ( )
498+ }
499+
490500/**
491501 * Gets a data flow node that either imports `m` from the module with
492502 * the given `path`, or accesses `m` as a member on a default or
You can’t perform that action at this time.
0 commit comments