mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +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")
|
result = c.(Folder).getJavaScriptFile("index")
|
||||||
)
|
)
|
||||||
or
|
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) |
|
exists(Folder f | f = path.resolveUpTo(path.getNumComponent() - 1) |
|
||||||
result = f.getJavaScriptFile(path.getBaseName())
|
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. */
|
/** Gets the base name of the folder or file this path refers to. */
|
||||||
string getBaseName() { result = getValue().(PathString).getBaseName() }
|
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
|
* 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`.
|
* when resolved relative to the root folder of the given `priority`.
|
||||||
|
|||||||
Reference in New Issue
Block a user