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.
2026-06-11 22:08:10 +08:00
|
|
|
import { defineConfig } from 'tsdown'
|
|
|
|
|
|
|
|
|
|
/**
|
2026-07-14 16:21:41 +08:00
|
|
|
* JS bundling for vendored Cordis and Harness TypeScript packages.
|
2026-06-17 23:31:38 +08:00
|
|
|
* TypeScript source is compiled first by `tsc -b tsconfig.build.json`; tsdown
|
2026-07-19 22:13:50 +08:00
|
|
|
* reads only the emitted JS under lib/types and writes the package root and
|
|
|
|
|
* invariant companion runtime bundles. Declarations are NOT produced here,
|
|
|
|
|
* hence `dts: false`.
|
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.
2026-06-11 22:08:10 +08:00
|
|
|
*
|
|
|
|
|
* Per-package shape overrides live in `<package>/tsdown.config.ts`
|
|
|
|
|
* (schemastery: dual ESM+CJS; logger-console: extra browser entry).
|
|
|
|
|
*/
|
|
|
|
|
export default defineConfig({
|
2026-07-14 16:21:41 +08:00
|
|
|
// Explicit globs keep bundling to vendored Cordis and the TypeScript package tree;
|
|
|
|
|
// `workspace: true` would discover package manifests outside that bundle set. Landlock
|
|
|
|
|
// platform packages contain only a prebuilt native binary, so they have no JS entry.
|
2026-07-22 10:55:17 +08:00
|
|
|
workspace: ['vendor/*', 'packages/*/*', 'apps/*'],
|
2026-07-19 22:13:50 +08:00
|
|
|
// The brace glob admits the package companion when present while retaining the
|
|
|
|
|
// index-only build for vendored Cordis packages outside the Harness package tree.
|
|
|
|
|
entry: ['lib/types/{index,invariant}.js'],
|
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.
2026-06-11 22:08:10 +08:00
|
|
|
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,
|
|
|
|
|
})
|