File tree Expand file tree Collapse file tree 1 file changed +3
-24
lines changed
javascript/ql/src/semmle/javascript Expand file tree Collapse file tree 1 file changed +3
-24
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,12 @@ DataFlow::ParameterNode getALibraryInputParameter() {
17
17
}
18
18
19
19
/**
20
- * Gets the number of occurrences of "/" in `path`.
21
- */
22
- bindingset [ path]
23
- private int countSlashes ( string path ) { result = count ( path .splitAt ( "/" ) ) - 1 }
24
-
25
- /**
26
- * Gets the topmost named package.json that appears in the project.
27
- *
28
- * There can be multiple results if the there exists multiple package.json that are equally deeply nested in the folder structure.
29
- * Results are limited to package.json files that are at most nested 2 directories deep.
30
- */
31
- PackageJSON getTopmostPackageJSON ( ) {
32
- result =
33
- min ( PackageJSON j |
34
- countSlashes ( j .getFile ( ) .getRelativePath ( ) ) <= 3 and
35
- exists ( j .getPackageName ( ) )
36
- |
37
- j order by countSlashes ( j .getFile ( ) .getRelativePath ( ) )
38
- )
39
- }
40
-
41
- /**
42
- * Gets a value exported by the main module from one of the topmost `package.json` files (see `getTopmostPackageJSON`).
20
+ * Gets a value exported by the main module from a named `package.json` file.
43
21
* The value is either directly the `module.exports` value, a nested property of `module.exports`, or a method on an exported class.
44
22
*/
45
23
private DataFlow:: Node getAValueExportedByPackage ( ) {
46
- result = getAnExportFromModule ( getTopmostPackageJSON ( ) .getMainModule ( ) )
24
+ result =
25
+ getAnExportFromModule ( any ( PackageJSON pack | exists ( pack .getPackageName ( ) ) ) .getMainModule ( ) )
47
26
or
48
27
result = getAValueExportedByPackage ( ) .( DataFlow:: PropWrite ) .getRhs ( )
49
28
or
You can’t perform that action at this time.
0 commit comments