Replace dumble with tsdown for JS bundling

dumble (0.2.x, ~530 dl/wk, single-maintainer) was a bus-factor risk as
the load-bearing bundler. tsdown (rolldown-based, ~2.5M dl/wk, actively
maintained) replaces it while output stays list-identical, verified by
snapshot diff: 17 JS bundles, externals preserved, schemastery dual
.mjs/.cjs and logger-console node+browser entries intact.

Root tsdown.config.ts uses workspace globs ['vendor/*', 'packages/*']
(explicit, so examples/* stays excluded); two per-package overrides in
vendor/ cover the special shapes and are logged in vendor/README.md as
ours (not upstream sync surface). scripts/build.ts (dumble
orchestration) is deleted; yarn build = tsc -b && tsdown. tsc -b keeps
owning declarations (dts: false, clean: false).

Rationale recorded in ADR 0008 (also covers the direct-esbuild and
pkgroll alternatives).

Gates: lint, typecheck, 134 tests, hygiene (knip/publint/constraints),
demo smoke all green.
This commit is contained in:
Tianyi Cui
2026-06-11 22:34:43 +08:00
parent 4dafad4db6
commit 630bbddf9a
11 changed files with 590 additions and 246 deletions
+26
View File
@@ -0,0 +1,26 @@
import { defineConfig } from 'tsdown'
/**
* JS bundling for all workspace packages (vendor/* + packages/*).
* Declarations are NOT produced here — `tsc -b tsconfig.build.json` owns
* .d.ts output (composite project references); hence `dts: false` and
* `clean: false` (lib/ already holds tsc's declarations).
*
* Per-package shape overrides live in `<package>/tsdown.config.ts`
* (schemastery: dual ESM+CJS; logger-console: extra browser entry).
*/
export default defineConfig({
// Explicit globs: `workspace: true` would also discover examples/* (any
// package.json), but only vendor/* and packages/* are yarn workspaces.
workspace: ['vendor/*', 'packages/*'],
entry: ['src/index.ts'],
outDir: 'lib',
format: ['esm'],
platform: 'node',
target: 'es2024',
// All packages set "type": "module"; fixedExtension false keeps ESM output
// at .js (not .mjs), matching the package.json main/exports fields.
fixedExtension: false,
dts: false,
clean: false,
})