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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-node-pack",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Pack a TypeScript package into a Node-compatible npm tarball without modifying the source tree",
5
5
  "keywords": [
6
6
  "cli",
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