feat(invariants): require package-owned companions

This commit is contained in:
Tianyi Cui
2026-07-19 22:13:50 +08:00
parent 2c7822ddee
commit 433670a754
316 changed files with 5348 additions and 646 deletions

View File

@@ -3,8 +3,9 @@ import { defineConfig } from 'tsdown'
/**
* JS bundling for vendored Cordis and Harness TypeScript packages.
* TypeScript source is compiled first by `tsc -b tsconfig.build.json`; tsdown
* reads only the emitted JS under lib/types and writes lib/index.* runtime
* bundles. Declarations are NOT produced here, hence `dts: false`.
* 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`.
*
* Per-package shape overrides live in `<package>/tsdown.config.ts`
* (schemastery: dual ESM+CJS; logger-console: extra browser entry).
@@ -14,7 +15,9 @@ export default defineConfig({
// `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.
workspace: ['vendor/*', 'packages/*/*'],
entry: ['lib/types/index.js'],
// 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'],
outDir: 'lib',
format: ['esm'],
platform: 'node',