Today we use a two-pass tsdown strategy in some packages to keep runtime dependencies external while still producing portable declaration files.
This is intentionally more complex, but currently the most reliable approach for our edge cases.
There is upstream work/discussion around DTS-specific dependency inlining that may allow us to simplify this in the future:
depscontrols are shared behavior for JS + DTS.- We still need separate control for "external in JS, inline in DTS" in our real packages.
- Keep the two-pass helper/config in place for now.
- The
deps.dtswork exists in a fork commit right now; adopt only after equivalent support lands in the tsdown version we actually use.
Retry a single-pass setup when one of these happens:
tsdown/rolldown-plugin-dtsrelease notes add explicit DTS-only dependency inlining controls.- Issue #199 (or equivalent) is implemented and documented.
- We upgrade tool versions and can validate with a small spike.
- Our installed
tsdownversion includes a supporteddeps.dtsoption (or equivalent).
- Pick one package first (
packages/veto). - Replace two-pass config with one-pass config that attempts the same JS external + DTS portability behavior.
- Run package build and type checks.
- Verify generated
.d.tshas no non-portable/internal path references. - Verify consumer-style checks with strict TypeScript (
skipLibCheck: false) still pass.
- Same runtime bundling behavior as today.
- No DTS portability regressions (
TS2742,TS2883,TS2307style consumer failures). - No package-specific exceptions that reintroduce complexity equal to two-pass.
If any core package (veto, pixel-utils, pixel-motion) regresses on declaration portability or introduces fragile per-package hacks, revert to two-pass and retry on a later tool release.