egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
8.49k stars 209 forks source link

Fix chmod error setting mode of DTS file that may not yet be written #1002

Open sentience opened 9 months ago

sentience commented 9 months ago

Fixes #1001.

This removes rollup-plugin-hashbang from the configuration of Rollup that is used to generate DTS files. In theory, this plug-in is not needed for this build. rollup-plugin-hashbang remains in the configuration used when invoking Rollup to perform treeshaking.

The root cause of the issue may be inside rollup-plugin-hashbang, and a better fix might be possible there.

I have added a test to cover the issue being fixed, but it's possible this has broken something not covered by the existing tests.

codesandbox[bot] commented 9 months ago

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tsup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 18, 2023 6:23am
sentience commented 9 months ago

Note: this removes the shebang from .d.ts and .d.mts files generated by tsup --dts.

dist/scripts/extract.d.ts before:

#!/usr/bin/env node

dist/scripts/extract.d.ts after:


export { }

I believe this is correct. A shebang line in a .d.ts file doesn't seem to make any sense to me.