tsdown.config.ts 1.3 KB

123456789101112131415161718192021222324252627282930
  1. import { defineConfig } from 'tsdown'
  2. /**
  3. * JS bundling for vendored Cordis and Harness TypeScript packages.
  4. * TypeScript source is compiled first by `tsc -b` (the root solution); tsdown
  5. * reads only the emitted JS under lib/types and writes the package root and
  6. * invariant companion runtime bundles. Declarations are NOT produced here,
  7. * hence `dts: false`.
  8. *
  9. * Per-package shape overrides live in `<package>/tsdown.config.ts`
  10. * (schemastery: dual ESM+CJS; logger-console: extra browser entry).
  11. */
  12. export default defineConfig({
  13. // Explicit globs keep bundling to vendored Cordis, the TypeScript package tree, and
  14. // the Node CLI assembly. `apps/web` is a Vite application with no lib/types entry;
  15. // `workspace: true` or `apps/*` would incorrectly treat it as a package bundle.
  16. workspace: ['vendor/*', 'packages/*/*', 'apps/cli'],
  17. // The brace glob admits the package companion when present while retaining the
  18. // index-only build for vendored Cordis packages outside the Harness package tree.
  19. entry: ['lib/types/{index,invariant}.js'],
  20. outDir: 'lib',
  21. format: ['esm'],
  22. platform: 'node',
  23. target: 'es2024',
  24. // All packages set "type": "module"; fixedExtension false keeps ESM output
  25. // at .js (not .mjs), matching the package.json main/exports fields.
  26. fixedExtension: false,
  27. dts: false,
  28. clean: false,
  29. })