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:08:10 +08:00
parent 4dafad4db6
commit 630bbddf9a
11 changed files with 590 additions and 246 deletions

5
vendor/README.md vendored
View File

@@ -49,6 +49,11 @@ Keep this log exhaustive — every divergence from upstream must be listed.
peer-dependency ranges preserved.
3. **All `tsconfig.json` files**: regenerated to extend the repo-root
`tsconfig.base.json` and declare project references.
4. **`schemastery/tsdown.config.ts` and `logger-console/tsdown.config.ts`**:
ours, not upstream files — per-package build-shape overrides (dual
ESM+CJS output; separate node/browser entries) for the repo-root tsdown
build. Like the regenerated tsconfigs, they are not part of the upstream
sync surface.
## Sync procedure

23
vendor/logger-console/tsdown.config.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
import { defineConfig } from 'tsdown'
/**
* logger-console ships two entries: the node exporter (index) and the
* browser exporter (browser), selected via package.json `exports`
* conditions. They are built as two single-entry passes so the shared
* base class is inlined into each (matching upstream's published shape)
* instead of split into a hash-named chunk.
*/
const shared = {
outDir: 'lib',
format: ['esm'],
platform: 'node',
target: 'es2024',
fixedExtension: false,
dts: false,
clean: false,
} as const
export default defineConfig([
{ ...shared, entry: ['src/index.ts'] },
{ ...shared, entry: ['src/browser.ts'] },
])

18
vendor/schemastery/tsdown.config.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
import { defineConfig } from 'tsdown'
/**
* schemastery has no `"type": "module"` and publishes dual-format output
* (package.json: main → lib/index.cjs, module → lib/index.mjs). Pin the
* extensions explicitly — the defaults for a CommonJS package would emit
* .mjs/.js instead.
*/
export default defineConfig({
entry: ['src/index.ts'],
outDir: 'lib',
format: ['esm', 'cjs'],
platform: 'node',
target: 'es2024',
outExtensions: ({ format }) => ({ js: format === 'es' ? '.mjs' : '.cjs' }),
dts: false,
clean: false,
})