@@ -327,78 +327,6 @@ class Require extends CallExpr, Import {
327
327
328
328
override Module getEnclosingModule ( ) { this = result .getAnImport ( ) }
329
329
330
- /**
331
- * Gets the file that is imported by this `require`.
332
- *
333
- * The result can be a JavaScript file, a JSON file or a `.node` file.
334
- * Externs files are not treated differently from other files by this predicate.
335
- */
336
- deprecated File getImportedFile ( ) { result = this .load ( min ( int prio | exists ( this .load ( prio ) ) ) ) }
337
-
338
- /**
339
- * Gets the file that this `require` refers to (which may not be a JavaScript file),
340
- * using the root folder of priority `priority`.
341
- *
342
- * This predicate implements the specification of
343
- * [`require.resolve`](https://nodejs.org/api/modules.html#modules_all_together),
344
- * modified to allow additional JavaScript file extensions, such as `ts` and `jsx`.
345
- *
346
- * Module resolution order is modeled using the `priority` parameter as follows.
347
- *
348
- * Each candidate folder in which the path may be resolved is assigned
349
- * a priority (this is actually done by `Module.searchRoot`, but we explain it
350
- * here for completeness):
351
- *
352
- * - if the path starts with `'./'`, `'../'`, or `/`, it has a single candidate
353
- * folder (the enclosing folder of the module for the former two, the file
354
- * system root for the latter) of priority 0
355
- * - otherwise, candidate folders are folders of the form `<prefix>/node_modules`
356
- * such that `<prefix>` is a (not necessarily proper) ancestor of the enclosing
357
- * folder of the module which is not itself named `node_modules`; the priority
358
- * of a candidate folder is the number of steps from the enclosing folder of
359
- * the module to `<prefix>`.
360
- *
361
- * To resolve an import of a path `p`, we consider each candidate folder `c` with
362
- * priority `r` and resolve the import to the following files if they exist
363
- * (in order of priority):
364
- *
365
- * <ul>
366
- * <li> the file `c/p`;
367
- * <li> the file `c/p.{tsx,ts,jsx,es6,es,mjs,cjs}`;
368
- * <li> the file `c/p.js`;
369
- * <li> the file `c/p.json`;
370
- * <li> the file `c/p.node`;
371
- * <li> if `c/p` is a folder:
372
- * <ul>
373
- * <li> if `c/p/package.json` exists and specifies a `main` module `m`:
374
- * <ul>
375
- * <li> the file `c/p/m`;
376
- * <li> the file `c/p/m.{tsx,ts,jsx,es6,es,mjs,cjs}`;
377
- * <li> the file `c/p/m.js`;
378
- * <li> the file `c/p/m.json`;
379
- * <li> the file `c/p/m.node`;
380
- * </ul>
381
- * <li> the file `c/p/index.{tsx,ts,jsx,es6,es,mjs,cjs}`;
382
- * <li> the file `c/p/index.js`;
383
- * <li> the file `c/p/index.json`;
384
- * <li> the file `c/p/index.node`.
385
- * </ul>
386
- * </ul>
387
- *
388
- * The first four steps are factored out into predicate `loadAsFile`,
389
- * the remainder into `loadAsDirectory`; both make use of an auxiliary
390
- * predicate `tryExtensions` that handles the repeated distinction between
391
- * `.js`, `.json` and `.node`.
392
- */
393
- deprecated private File load ( int priority ) {
394
- exists ( int r | this .getEnclosingModule ( ) .searchRoot ( this .getImportedPathExpr ( ) , _, r ) |
395
- result = loadAsFile ( this , r , priority - prioritiesPerCandidate ( ) * r ) or
396
- result =
397
- loadAsDirectory ( this , r ,
398
- priority - ( prioritiesPerCandidate ( ) * r + numberOfExtensions ( ) + 1 ) )
399
- )
400
- }
401
-
402
330
override DataFlow:: Node getImportedModuleNode ( ) { result = DataFlow:: valueNode ( this ) }
403
331
}
404
332
0 commit comments