refactor: rename build typings dir to types

This commit is contained in:
Tianyi Cui
2026-06-20 00:26:02 +08:00
parent ed94daed9e
commit 7f131dd4d8
65 changed files with 166 additions and 166 deletions

6
vendor/README.md vendored
View File

@@ -31,10 +31,10 @@ Intentionally **not** vendored (verified unused by this set): `reggol`, `@cordis
Keep this log exhaustive — every divergence from upstream must be listed.
1. **`hmr/src/index.ts`**: removed the `./locales/en-US.yml` / `./locales/zh-CN.yml` imports, the `.i18n({...})` call on the `Config` schema, and the `src/locales/` directory. Rationale: those imports require a runtime YAML loader hook (`@cordisjs/unyaml`) that we do not vendor; the i18n texts only localize config descriptions.
2. **All `package.json` files**: regenerated — added `private: true`, added precise `files` entries for bundled runtime files and `lib/typings/**/*.d.ts` / `.d.ts.map`, preserved `src` in `files` only for packages whose previous file list already shipped it, added a `./src/*` export where missing, pointed declaration metadata at `lib/typings`, and removed upstream `devDependencies`/`scripts`/`repository` fields. Dependency and peer-dependency ranges preserved, except `hmr` declares `esbuild` as a direct dev dependency because its source imports the `BuildFailure` type and pnpm's strict workspace resolution requires the owner package to name that dependency.
3. **All `tsconfig.json` files**: regenerated to extend the repo-root `tsconfig.base.json`, emit TypeScript intermediates to `lib/typings`, and declare project references.
2. **All `package.json` files**: regenerated — added `private: true`, added precise `files` entries for bundled runtime files and `lib/types/**/*.d.ts` / `.d.ts.map`, preserved `src` in `files` only for packages whose previous file list already shipped it, added a `./src/*` export where missing, pointed declaration metadata at `lib/types`, and removed upstream `devDependencies`/`scripts`/`repository` fields. Dependency and peer-dependency ranges preserved, except `hmr` declares `esbuild` as a direct dev dependency because its source imports the `BuildFailure` type and pnpm's strict workspace resolution requires the owner package to name that dependency.
3. **All `tsconfig.json` files**: regenerated to extend the repo-root `tsconfig.base.json`, emit TypeScript intermediates to `lib/types`, and declare project references.
4. **Vendored TypeScript source internal specifiers**: changed local relative imports/exports from explicit `.ts` / `.js` specifiers to extensionless specifiers so generated `.js` and `.d.ts` intermediates are extensionless and no declaration postprocess is needed. This includes `loader/src/config/isolate.ts` changing `declare module './entry.ts'` to `declare module './entry'`.
5. **`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. They read the JS emitted under `lib/typings` and then write the publish runtime entries under `lib/`. Like the regenerated tsconfigs, they are not part of the upstream sync surface.
5. **`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. They read the JS emitted under `lib/types` and then write the publish runtime entries under `lib/`. Like the regenerated tsconfigs, they are not part of the upstream sync surface.
## Sync procedure

View File

@@ -6,11 +6,11 @@
"sideEffects": false,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"bin": "bin.js",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -18,8 +18,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"bin.js"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noImplicitAny": false,
"noImplicitThis": false,
"strictFunctionTypes": false,

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -16,8 +16,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,
"noImplicitOverride": false,

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -16,8 +16,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,
"noImplicitOverride": false,

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -16,8 +16,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,
"noImplicitOverride": false,

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -16,8 +16,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noImplicitAny": false,
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -16,8 +16,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noImplicitAny": false,
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/shared.d.ts",
"types": "lib/types/shared.d.ts",
"exports": {
".": {
"types": "./lib/typings/shared.d.ts",
"types": "./lib/types/shared.d.ts",
"node": "./lib/index.js",
"default": "./lib/browser.js"
},
@@ -18,8 +18,8 @@
"files": [
"lib/index.js",
"lib/browser.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,
"noImplicitOverride": false,

View File

@@ -3,7 +3,7 @@ import { defineConfig } from 'tsdown'
/**
* logger-console ships two entries: the node exporter (index) and the
* browser exporter (browser), selected via package.json `exports`
* conditions. The entries are JS emitted by tsc under lib/typings and are
* conditions. The entries are JS emitted by tsc under lib/types and are
* bundled 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.
@@ -19,6 +19,6 @@ const shared = {
} as const
export default defineConfig([
{ ...shared, entry: ['lib/typings/index.js'] },
{ ...shared, entry: ['lib/typings/browser.js'] },
{ ...shared, entry: ['lib/types/index.js'] },
{ ...shared, entry: ['lib/types/browser.js'] },
])

View File

@@ -5,12 +5,12 @@
"private": true,
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"files": [
"lib/index.mjs",
"lib/index.cjs",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"module": "preserve",
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,

View File

@@ -3,11 +3,11 @@ import { defineConfig } from 'tsdown'
/**
* schemastery has no `"type": "module"` and publishes dual-format output
* (package.json: main → lib/index.cjs, module → lib/index.mjs). The entry is
* the JS emitted by tsc under lib/typings; pin the bundled extensions
* the JS emitted by tsc under lib/types; pin the bundled extensions
* explicitly because the defaults for a CommonJS package would emit .mjs/.js.
*/
export default defineConfig({
entry: ['lib/typings/index.js'],
entry: ['lib/types/index.js'],
outDir: 'lib',
format: ['esm', 'cjs'],
platform: 'node',

View File

@@ -5,10 +5,10 @@
"private": true,
"type": "module",
"main": "lib/index.js",
"types": "lib/typings/index.d.ts",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/typings/index.d.ts",
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./src/*": "./src/*",
@@ -16,8 +16,8 @@
},
"files": [
"lib/index.js",
"lib/typings/**/*.d.ts",
"lib/typings/**/*.d.ts.map",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"src"
],
"author": "Shigma <shigma10826@gmail.com>",

View File

@@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/typings",
"outDir": "lib/types",
"noUncheckedIndexedAccess": false,
"exactOptionalPropertyTypes": false,
"noImplicitOverride": false,