Description
Bug Report Checklist
- I have pulled the latest
main
branch of the repository. - I have searched for related issues and found none that matched my issue.
Overview
Coming over and recapping from JoshuaKGoldberg/eslint-fix-utils#7 -> JoshuaKGoldberg/eslint-fix-utils#13: CTA right now uses tsup for production builds. tsup is a pretty darn good wrapper around esbuild. It was originally added to CTA in #623 -> #640 to avoid transpiling test files such as *.test.*
.
tsup is configured at the moment with a couple opinionated settings:
bundle: false
: I prefer having outputlib/
files match the structure insrc/
for a few reasons:- Development: faster incremental rebuilds, especially in larger packages
- Production: IMO it's easier to debug
node_modules/
contents when the structure matches
entry: ["src/**/*.ts", "!src/**/*.test.*"]
: since there isn't bundling, the full list of files to build needs to be told to tsup- I think this is a bug in tsup: bundle: false only includes entrypoint modules in output egoist/tsup#1000
- Unfortunate byproduct: files that are only used in tests, like
data.fakes.ts
, still get pushed...
We've also started to see some issues with tsup falling out of maintenance a bit (💔 - sustained open source maintenance is hard and taxing!):
- bundle: false only includes entrypoint modules in output egoist/tsup#1000
- tsup build failing with ERR_WORKER_OUT_OF_MEMORY egoist/tsup#920
- egoist/tsup/issues with comment count 0: 126 at time of filing
I think there are two root issues here:
- tsup is build on a bundler, esbuild, and is tailored to the bundling use case. The file-by-file transpilation use case is not as emphasized.
- tsup is not being maintained at a level needed to match its growing userbase.
Therefore, I think it would make sense to think critically about how CTA packages build lib/
output. Is there a tool that can satisfy all the desired needs?
- File-by-file transpilation
- Tree-shaking based on entry points, not hardcoded heuristics like
*.test.*
- Quick JS output (read: not waiting on type checking to output JS files)
- Full
.d.ts
output (read: not being limited to just what's supported inisolatedDeclarations
)
If not, I shudder to think I might have to build one. 😬
Additional Info
The fact that tsup exists & works at all is awesome. I don't mean to file this issue judgementally. https://xkcd.com/2347, https://nolanlawson.com/2017/03/05/what-it-feels-like-to-be-an-open-source-maintainer etc. etc. This is a pragmatic issue: tsup isn't completely able to do what CTA needs right now and so we need to evaluate what's best for the project.
Edit: see also https://bsky.app/profile/joshuakgoldberg.com/post/3lhgppvnyjc2e for links to other projects
🎁