(node: Node)
| 1026 | |
| 1027 | // e.g. "./a.ts" for `import("./a.ts")`, `require("./a.ts")` or `import a = require("./a.ts")` |
| 1028 | export const loadedSpecifierOf = (node: Node): unknown => { |
| 1029 | // a require() may be one createRequire() returns |
| 1030 | const source = |
| 1031 | loadedSourceOf(node) ?? |
| 1032 | (( |
| 1033 | node.type === "TSImportEqualsDeclaration" && |
| 1034 | node.importKind !== "type" && |
| 1035 | node.moduleReference.type === "TSExternalModuleReference" |
| 1036 | ) ? |
| 1037 | node.moduleReference.expression |
| 1038 | : undefined) |
| 1039 | return source?.type === "Literal" ? source.value : undefined |
| 1040 | } |
| 1041 | |
| 1042 | // e.g. `await import("arktype")` as a statement, loading a module only to run it |
| 1043 | export const isDiscarded = (node: Node): boolean => { |
no test coverage detected