mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
JS: Handle .js import of .ts file
This commit is contained in:
@@ -83,9 +83,13 @@ abstract class Module extends TopLevel {
|
||||
result = c.(Folder).getJavaScriptFile("index")
|
||||
)
|
||||
or
|
||||
// handle the case where the import path is missing an extension
|
||||
// handle the case where the import path is missing the extension
|
||||
exists(Folder f | f = path.resolveUpTo(path.getNumComponent() - 1) |
|
||||
result = f.getJavaScriptFile(path.getBaseName())
|
||||
or
|
||||
// If a js file was not found look for a file that compiles to js
|
||||
not exists(f.getJavaScriptFile(path.getBaseName())) and
|
||||
result = f.getJavaScriptFile(path.getStem())
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -205,6 +205,9 @@ abstract class PathExpr extends PathExprBase {
|
||||
/** Gets the base name of the folder or file this path refers to. */
|
||||
string getBaseName() { result = getValue().(PathString).getBaseName() }
|
||||
|
||||
/** Gets the stem, that is, base name without extension, of the folder or file this path refers to. */
|
||||
string getStem() { result = getValue().(PathString).getStem() }
|
||||
|
||||
/**
|
||||
* Gets the file or folder that the first `n` components of this path refer to
|
||||
* when resolved relative to the root folder of the given `priority`.
|
||||
|
||||
Reference in New Issue
Block a user