Repository navigation
build: migrate from tsup to tsdown - #162
Merged
Merged
Conversation
Replace the esbuild-based bundler with tsdown, which is built on Rolldown and supports TypeScript 7. • Add `tsdown.config.ts` reproducing the seven existing builds: CJS and ESM for the library, stream and CLI entries, plus ESM and IIFE browser bundles with minified variants. • Keep the published artifact set stable: the same 26 files with the same names, shebang, source maps and declarations. • Remove `tsup`, `tsup.config.ts` and the `tsup` → `esbuild` override; dropping tsup also removes esbuild from the tree entirely. • Explain declaration extensions explicitly (`index.d.ts` for ESM, `index.d.cts` for CJS) so the output matches the previous layout. • Drop the now-unused `esbuild` entry from `allowScripts`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
tsupwithtsdown. The published artifacts are unchanged, the dependency tree shrinks by 39 packages, and the TypeScript 7 blocker goes away.• Add
tsdown.config.tsmapping the seven existing builds one-for-one: CJS/ESM forindexandstream, CJS/ESM for the CLI with the shebang banner, and ESM/IIFE browser bundles with minified variants.• Keep the output layout identical — all 26 files keep their names (
index.cjs,index.mjs,index.d.ts,index.d.cts,index.esm.js,index.esm.min.js,index.umd.js,index.umd.min.js,stream.*,cli.*, and their maps). Declarations are pinned explicitly to.d.tsfor ESM and.d.ctsfor CJS because tsdown defaults to.d.mts.• Remove
tsup,tsup.config.ts, and thetsup→esbuild@^0.28.2override. tsdown has no esbuild dependency, soesbuilddisappears from the tree and the earlier GHSA-g7r4-m6w7-qqqr workaround is no longer needed.• Remove the stale
esbuildentry fromallowScripts;fseventsremains approved.• Pin
tsdownto~0.23.4because it is still pre-1.0.Why now:
typescript@7removed the compiler API thatrollup-plugin-dtsuses, and tsup still bundles it (upstream #1405 and #1408 are open). tsdown usesrolldown-plugin-dts, which supports TypeScript 7.Verification
On Node.js 26.13.0:
diffof thels distoutput before (tsup) and after (tsdown) is empty — 26/26 identical filenames.npm test -- test/build-artifacts.spec.ts— 21/21 passed, including CJS/ESM interop, default exports, the IIFE global shape (var jmespath = (function), source maps, declaration contents, and the CLI shebang.dist/index.umd.jsin a VM:jmespath.search({a:1}, 'a')andjmespath.default.search(...)both return1;dist/index.esm.jsexposes named and default exports.npm test— 1,380 tests passed;npm run coverage— same thresholds and percentages as before (statements 95.66%, branches 91.93%, functions 95.83%, lines 95.54%).npm run lint:ci— passes.npm audit— 0 vulnerabilities;osv-scanner— "No issues found".npm pack --dry-run— 29 files, 2.33 MB unpacked (2.85 MB with tsup); the lockfile drops from 307 to 180 packages.The CI matrix (22.x/24.x/26.x), the OSV workflows, and
verify-lockfileall run on this pull request. Do not merge before the CI run completes — this changes the build toolchain.Next
typescript@7can be attempted immediately after this lands; it was closed in #158 only because tsup could not generate declarations with it.