ts-node-pack 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +5 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -630,9 +630,13 @@ function rewriteTsToJs(p) {
|
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
// `.ts`/`.tsx` → `.d.ts`; `.mts` → `.d.mts`. Matches the declaration files
|
|
633
|
-
// tsc emits from an .mts source.
|
|
633
|
+
// tsc emits from an .mts source. A path that already ends in `.d.ts` or
|
|
634
|
+
// `.d.mts` is returned unchanged — a hand-authored `types: "./types.d.ts"`
|
|
635
|
+
// is a declaration file, not a source to rewrite, and naively running the
|
|
636
|
+
// `.tsx?$` replacement on it would yield `./types.d.d.ts`.
|
|
634
637
|
function rewriteTsToDts(p) {
|
|
635
638
|
if (typeof p !== "string") return p;
|
|
639
|
+
if (p.endsWith(".d.ts") || p.endsWith(".d.mts")) return p;
|
|
636
640
|
return p.replace(/\.mts$/, ".d.mts").replace(/\.tsx?$/, ".d.ts");
|
|
637
641
|
}
|
|
638
642
|
|