(specifier: string)
| 88 | * For example, returns "export.ts" from "./export". |
| 89 | */ |
| 90 | export function getFileNameFromModuleSpecifier(specifier: string): string { |
| 91 | // Remove the ./ prefix. |
| 92 | if (specifier.startsWith('./')) |
| 93 | specifier = specifier.substr(2); |
| 94 | // Make sure the extension is .ts . |
| 95 | if (/\.[\w]+$/.test(specifier)) |
| 96 | specifier = specifier.replace(/\.[\w]+$/, '.ts'); |
| 97 | else |
| 98 | specifier += '.ts'; |
| 99 | return specifier; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Calculate the node's namespace according to the file it is defined. |
no outgoing calls
no test coverage detected