@@ -57,52 +57,67 @@ private class GlobFileNameSource extends FileNameSource {
5757 }
5858}
5959
60+ /**
61+ * Gets a file name or an array of file names from the `globby` library.
62+ */
63+ private DataFlow:: SourceNode globbyFileNameSource ( DataFlow:: TypeTracker t ) {
64+ exists ( string moduleName | moduleName = "globby" |
65+ // `require('globby').sync(_)`
66+ t .start ( ) and
67+ result = DataFlow:: moduleMember ( moduleName , "sync" ) .getACall ( )
68+ or
69+ // `files` in `require('globby')(_).then(files => ...)`
70+ t .start ( ) and
71+ result =
72+ DataFlow:: moduleImport ( moduleName )
73+ .getACall ( )
74+ .getAMethodCall ( "then" )
75+ .getCallback ( 0 )
76+ .getParameter ( 0 )
77+ )
78+ }
79+
6080/**
6181 * A file name or an array of file names from the `globby` library.
6282 */
6383private class GlobbyFileNameSource extends FileNameSource {
64- GlobbyFileNameSource ( ) {
65- exists ( string moduleName | moduleName = "globby" |
66- // `require('globby').sync(_)`
67- this = DataFlow:: moduleMember ( moduleName , "sync" ) .getACall ( )
84+ GlobbyFileNameSource ( ) { this = globbyFileNameSource ( DataFlow:: TypeTracker:: end ( ) ) }
85+ }
86+
87+ /**
88+ * Gets a file name or an array of file names from the `fast-glob` library.
89+ */
90+ private DataFlow:: Node fastGlobFileNameSource ( DataFlow:: TypeTracker t ) {
91+ exists ( string moduleName | moduleName = "fast-glob" |
92+ // `require('fast-glob').sync(_)
93+ t .start ( ) and
94+ result = DataFlow:: moduleMember ( moduleName , "sync" ) .getACall ( )
95+ or
96+ exists ( DataFlow:: SourceNode f |
97+ f = DataFlow:: moduleImport ( moduleName )
6898 or
69- // `files` in `require('globby')(_).then(files => ...)`
70- this =
71- DataFlow:: moduleImport ( moduleName )
72- .getACall ( )
73- .getAMethodCall ( "then" )
74- .getCallback ( 0 )
75- .getParameter ( 0 )
99+ f = DataFlow:: moduleMember ( moduleName , "async" )
100+ |
101+ // `files` in `require('fast-glob')(_).then(files => ...)` and
102+ // `files` in `require('fast-glob').async(_).then(files => ...)`
103+ t .start ( ) and
104+ result = f .getACall ( ) .getAMethodCall ( "then" ) .getCallback ( 0 ) .getParameter ( 0 )
76105 )
77- }
106+ or
107+ // `file` in `require('fast-glob').stream(_).on(_, file => ...)`
108+ t .start ( ) and
109+ result =
110+ DataFlow:: moduleMember ( moduleName , "stream" )
111+ .getACall ( )
112+ .getAMethodCall ( EventEmitter:: on ( ) )
113+ .getCallback ( 1 )
114+ .getParameter ( 0 )
115+ )
78116}
79117
80118/**
81119 * A file name or an array of file names from the `fast-glob` library.
82120 */
83121private class FastGlobFileNameSource extends FileNameSource {
84- FastGlobFileNameSource ( ) {
85- exists ( string moduleName | moduleName = "fast-glob" |
86- // `require('fast-glob').sync(_)`
87- this = DataFlow:: moduleMember ( moduleName , "sync" ) .getACall ( )
88- or
89- exists ( DataFlow:: SourceNode f |
90- f = DataFlow:: moduleImport ( moduleName )
91- or
92- f = DataFlow:: moduleMember ( moduleName , "async" )
93- |
94- // `files` in `require('fast-glob')(_).then(files => ...)` and
95- // `files` in `require('fast-glob').async(_).then(files => ...)`
96- this = f .getACall ( ) .getAMethodCall ( "then" ) .getCallback ( 0 ) .getParameter ( 0 )
97- )
98- or
99- // `file` in `require('fast-glob').stream(_).on(_, file => ...)`
100- this =
101- DataFlow:: moduleMember ( moduleName , "stream" )
102- .getACall ( )
103- .getAMethodCall ( EventEmitter:: on ( ) )
104- .getCallback ( 1 )
105- .getParameter ( 0 )
106- )
107- }
122+ FastGlobFileNameSource ( ) { this = fastGlobFileNameSource ( DataFlow:: TypeTracker:: end ( ) ) }
108123}
0 commit comments