|
|
@@ -30,15 +30,15 @@ In-package relative imports are extensionless.
|
|
|
|
|
|
`pnpm run build` is a two-stage build:
|
|
|
|
|
|
-- Stage 1: `tsc -b tsconfig.build.json` emits per-module `.js`, declarations `.d.ts`, JS sourcemaps `.js.map`, and declaration sourcemaps `.d.ts.map` into each package's `lib/typings`. This is the authoritative TypeScript compilation result. For publish we keep `.d.ts` / `.d.ts.map` and ignore `.js` / `.js.map`.
|
|
|
+- Stage 1: `tsc -b tsconfig.build.json` emits per-module `.js`, declarations `.d.ts`, JS sourcemaps `.js.map`, and declaration sourcemaps `.d.ts.map` into each package's `lib/types`. This is the authoritative TypeScript compilation result. For publish we keep `.d.ts` / `.d.ts.map` and ignore `.js` / `.js.map`.
|
|
|
- The build project uses the project-reference graph that `tsc -b` compiles. For example, root `tsconfig.build.json` references package and vendor tsconfigs. It validates and emits package/vendor build results.
|
|
|
-- Stage 2: a bundler reads the emitted JS under `lib/typings` and writes the bundled runtime entry as `lib/index.js` or `lib/index.mjs` (follow current behavior). This stage is bundling only. It must not read TypeScript source or emit declarations.
|
|
|
+- Stage 2: a bundler reads the emitted JS under `lib/types` and writes the bundled runtime entry as `lib/index.js` or `lib/index.mjs` (follow current behavior). This stage is bundling only. It must not read TypeScript source or emit declarations.
|
|
|
|
|
|
`tsdown` is no longer the owner of TypeScript compilation or declaration output.
|
|
|
|
|
|
`pnpm run typecheck` runs build mode over the root `tsconfig.json`.
|
|
|
- The root `tsconfig.json` is the single development/typecheck project. It typechecks examples, tests, and scripts with `noEmit`, and validates package/vendor source through references.
|
|
|
-- Referenced package/vendor projects keep the same emit behavior as build, so typecheck can refresh their `lib/typings` outputs instead of using a separate no-emit graph. Project-specific strictness changes live in the owning `packages/*/tsconfig.json` or `vendor/*/tsconfig.json`.
|
|
|
+- Referenced package/vendor projects keep the same emit behavior as build, so typecheck can refresh their `lib/types` outputs instead of using a separate no-emit graph. Project-specific strictness changes live in the owning `packages/*/tsconfig.json` or `vendor/*/tsconfig.json`.
|
|
|
|
|
|
The command orchestration shape is:
|
|
|
|
|
|
@@ -59,8 +59,8 @@ Build responsibilities are clearer:
|
|
|
|
|
|
- Each module under `packages/*` and `vendor/*` has one local tsconfig for build, typecheck, and tools that run source directly, such as `tsx` and `vitest`.
|
|
|
- The `build` command uses `tsconfig.build.json`. `tsc -b` owns the publishable per-module `.js` and `.d.ts` output, and the bundler owns only `lib/index.*`.
|
|
|
- - `lib/typings/*.d.ts` and `.d.ts.map` are the publish declaration output.
|
|
|
- - `lib/typings/*.js` is only a bundler input and must not be used as a runtime entry or public import target.
|
|
|
+ - `lib/types/*.d.ts` and `.d.ts.map` are the publish declaration output.
|
|
|
+ - `lib/types/*.js` is only a bundler input and must not be used as a runtime entry or public import target.
|
|
|
- `lib/index.*` is the publish runtime output and is generated by the bundler, currently `tsdown`.
|
|
|
- The `typecheck` command uses `tsconfig.json`. Examples, tests, and scripts are checked by the root no-emit project, while packages and vendor modules keep the same emit behavior as `build`. Package and vendor source stays behind project-reference boundaries.
|
|
|
|