Skip to content

Wrap tsdown instead of rollup/rolldown #2301

@stipsan

Description

@stipsan

We're currently wrapping rolldown for dts generation.
We also have a path for using api-extractor to generate dts.
And we wrap rollup for generating esm and cjs.
Lastly, our --check command has some fancy logic using esbuild for checking that generated code loads.

The logic with watch is also tricky.

What if we instead wrap and configure tsdown.
It would mean using tsdown to generate esm, cjs and dts. It's esm and cjs generation needs to match somewhat how we currently configure rollup, as much as possible.
The way it generates dts needs to match how we currently configure rolldown + rolldown-plugin-dts.

We would no longer have rollup dependencies, except the babel plugin as tsdown recommends it for loading babel-plugin-react-compiler https://tsdown.dev/recipes/react-support#enabling-react-compiler

We would no longer support generating dts with api-extractor, we can keep api extractor for checking tsdoc tags, like we do today when package config has dts: 'rolldown'.
We could depend on publint, and enable it in tsdown when the --check flag is used.
Publint would replace custom esbuild logic we run during check.

A lot of consideration will have to be made for how pkg-utils watch would wrap tsdown's watch.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions