ts-node-pack 0.1.2 → 0.1.3
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 +8 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -534,15 +534,21 @@ export function rewritePackageJson(pkg) {
|
|
|
534
534
|
delete result.scripts;
|
|
535
535
|
|
|
536
536
|
// Rewrite entry points
|
|
537
|
+
const originalMain = result.main;
|
|
537
538
|
if (result.main) result.main = rewriteTsToJs(result.main);
|
|
538
539
|
if (result.module) result.module = rewriteTsToJs(result.module);
|
|
540
|
+
const mainWasTs = result.main !== originalMain;
|
|
539
541
|
|
|
540
|
-
//
|
|
542
|
+
// Only synthesize a `types` field from `main` when `main` was a .ts
|
|
543
|
+
// source (a .d.ts will be emitted alongside the .js). For pure JS+JSDoc
|
|
544
|
+
// packages, inventing `"./index.d.ts"` would point at a file that
|
|
545
|
+
// ts-node-pack never creates — see @endo/ses-ava in agoric/endo, where
|
|
546
|
+
// this produced a dangling types pointer in published tarballs.
|
|
541
547
|
if (result.types) {
|
|
542
548
|
result.types = rewriteTsToDts(result.types);
|
|
543
549
|
} else if (result.typings) {
|
|
544
550
|
result.typings = rewriteTsToDts(result.typings);
|
|
545
|
-
} else if (
|
|
551
|
+
} else if (mainWasTs) {
|
|
546
552
|
result.types = result.main.replace(/\.js$/, ".d.ts");
|
|
547
553
|
}
|
|
548
554
|
|