File
Blob: build/typescript.bzl
| 1 | def module_name(ts_name): |
| 2 | if ts_name.endswith(".ts"): |
| 3 | return ts_name.removesuffix(".ts") |
| 4 | if ts_name.endswith(".mts"): |
| 5 | return ts_name.removesuffix(".mts") |
| 6 | fail("Expected TypeScript source file, got " + ts_name) |
| 7 | |
| 8 | def js_name(ts_name): |
| 9 | if ts_name.endswith(".ts"): |
| 10 | return ts_name.removesuffix(".ts") + ".js" |
| 11 | if ts_name.endswith(".mts"): |
| 12 | return ts_name.removesuffix(".mts") + ".mjs" |
| 13 | fail("Expected TypeScript source file, got " + ts_name) |