@@ -146,7 +146,7 @@ class NodeModule extends Module {
146146 )
147147 }
148148
149- override predicate searchRoot ( PathExpr path , Folder searchRoot , int priority ) {
149+ deprecated override predicate searchRoot ( PathExpr path , Folder searchRoot , int priority ) {
150150 path .getEnclosingModule ( ) = this and
151151 exists ( string pathval | pathval = path .getValue ( ) |
152152 // paths starting with `./` or `../` are resolved relative to the importing
@@ -236,11 +236,6 @@ private class RequireVariable extends Variable {
236236 }
237237}
238238
239- /**
240- * Holds if module `m` is in file `f`.
241- */
242- private predicate moduleInFile ( Module m , File f ) { m .getFile ( ) = f }
243-
244239private predicate isModuleModule ( EarlyStageNode nd ) {
245240 exists ( ImportDeclaration imp | imp .getRawImportPath ( ) = "module" |
246241 nd = TDestructuredModuleImportNode ( imp )
@@ -328,24 +323,17 @@ private predicate isRequire(EarlyStageNode nd) {
328323class Require extends CallExpr , Import {
329324 Require ( ) { isRequire ( TValueNode ( this .getCallee ( ) ) ) }
330325
331- override PathExpr getImportedPath ( ) { result = this .getArgument ( 0 ) }
326+ override Expr getImportedPathExpr ( ) { result = this .getArgument ( 0 ) }
332327
333328 override Module getEnclosingModule ( ) { this = result .getAnImport ( ) }
334329
335- override Module resolveImportedPath ( ) {
336- moduleInFile ( result , this .load ( min ( int prio | moduleInFile ( _, this .load ( prio ) ) ) ) )
337- or
338- not moduleInFile ( _, this .load ( _) ) and
339- result = Import .super .resolveImportedPath ( )
340- }
341-
342330 /**
343331 * Gets the file that is imported by this `require`.
344332 *
345333 * The result can be a JavaScript file, a JSON file or a `.node` file.
346334 * Externs files are not treated differently from other files by this predicate.
347335 */
348- File getImportedFile ( ) { result = this .load ( min ( int prio | exists ( this .load ( prio ) ) ) ) }
336+ deprecated File getImportedFile ( ) { result = this .load ( min ( int prio | exists ( this .load ( prio ) ) ) ) }
349337
350338 /**
351339 * Gets the file that this `require` refers to (which may not be a JavaScript file),
@@ -402,8 +390,8 @@ class Require extends CallExpr, Import {
402390 * predicate `tryExtensions` that handles the repeated distinction between
403391 * `.js`, `.json` and `.node`.
404392 */
405- private File load ( int priority ) {
406- exists ( int r | this .getEnclosingModule ( ) .searchRoot ( this .getImportedPath ( ) , _, r ) |
393+ deprecated private File load ( int priority ) {
394+ exists ( int r | this .getEnclosingModule ( ) .searchRoot ( this .getImportedPathExpr ( ) , _, r ) |
407395 result = loadAsFile ( this , r , priority - prioritiesPerCandidate ( ) * r ) or
408396 result =
409397 loadAsDirectory ( this , r ,
@@ -415,7 +403,7 @@ class Require extends CallExpr, Import {
415403}
416404
417405/** An argument to `require` or `require.resolve`, considered as a path expression. */
418- private class RequirePath extends PathExprCandidate {
406+ deprecated private class RequirePath extends PathExprCandidate {
419407 RequirePath ( ) {
420408 this = any ( Require req ) .getArgument ( 0 )
421409 or
@@ -428,14 +416,14 @@ private class RequirePath extends PathExprCandidate {
428416}
429417
430418/** A constant path element appearing in a call to `require` or `require.resolve`. */
431- private class ConstantRequirePathElement extends PathExpr , ConstantString {
419+ deprecated private class ConstantRequirePathElement extends PathExpr , ConstantString {
432420 ConstantRequirePathElement ( ) { this = any ( RequirePath rp ) .getAPart ( ) }
433421
434422 override string getValue ( ) { result = this .getStringValue ( ) }
435423}
436424
437425/** A `__dirname` path expression. */
438- private class DirNamePath extends PathExpr , VarAccess {
426+ deprecated private class DirNamePath extends PathExpr , VarAccess {
439427 DirNamePath ( ) {
440428 this .getName ( ) = "__dirname" and
441429 this .getVariable ( ) .getScope ( ) instanceof ModuleScope
@@ -445,7 +433,7 @@ private class DirNamePath extends PathExpr, VarAccess {
445433}
446434
447435/** A `__filename` path expression. */
448- private class FileNamePath extends PathExpr , VarAccess {
436+ deprecated private class FileNamePath extends PathExpr , VarAccess {
449437 FileNamePath ( ) {
450438 this .getName ( ) = "__filename" and
451439 this .getVariable ( ) .getScope ( ) instanceof ModuleScope
@@ -458,7 +446,7 @@ private class FileNamePath extends PathExpr, VarAccess {
458446 * A path expression of the form `path.join(p, "...")` where
459447 * `p` is also a path expression.
460448 */
461- private class JoinedPath extends PathExpr , @call_expr {
449+ deprecated private class JoinedPath extends PathExpr , @call_expr {
462450 JoinedPath ( ) {
463451 exists ( MethodCallExpr call | call = this |
464452 call .getReceiver ( ) .( VarAccess ) .getName ( ) = "path" and
0 commit comments