Skip to content

Commit 6c39053

Browse files
dmealingclaude
andcommitted
fix(metadata): the /library subpath needs an index.ts, or scripts/ typechecks against dist
`tsconfig.scripts.json` maps `@metaobjectsdev/metadata/*` to `packages/metadata/src/*` so the repo-root `scripts/` typecheck reads workspace SOURCE — its own comment says so, and the reason is that a bare import and a relative import to the same file would otherwise be two class declarations. `/library` was the one subpath with no `index.ts` to land on: `/core` has one, the root entry has one, and `package.json` pointed `/library` straight at `library-sources.ts`. So the mapping missed, tsc fell through to `node_modules`, and found `dist/library/library-sources.d.ts`. That file exists on a machine that has built and does not exist on a fresh checkout, where the `gates` lane runs `bun install` and never builds. Hence green here, `TS2307` × 4 there. `--traceResolution` before: `src/library/index.ts` does not exist → node_modules. After: `src/library/index.ts` exists - use it as a name resolution result. The fallback is never reached, so the result no longer depends on a warm `dist/`. `package.json` now names the index for all three conditions, which is what every other subpath does. The exported surface is unchanged — both modules were loaded and their key sets compared, and the eleven names are identical. The gate's own instruction is "fix the error; do not widen this gate", so nothing in `tsconfig.scripts.json` moved. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011cQxyVuTkdPmAduLiedNEg
1 parent 0b20f0b commit 6c39053

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎server/typescript/packages/metadata/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"default": "./dist/core/index.js"
1818
},
1919
"./library": {
20-
"bun": "./src/library/library-sources.ts",
21-
"types": "./dist/library/library-sources.d.ts",
22-
"default": "./dist/library/library-sources.js"
20+
"bun": "./src/library/index.ts",
21+
"types": "./dist/library/index.d.ts",
22+
"default": "./dist/library/index.js"
2323
},
2424
"./constants": {
2525
"bun": "./src/constants.ts",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @metaobjectsdev/metadata/library — the shipped-library surface (FR-043).
2+
//
3+
// Every other subpath of this package resolves through a directory `index.ts`
4+
// (`/core`, and the root entry itself). This one pointed straight at
5+
// `library-sources.ts`, and that inconsistency was not cosmetic: the repo-root
6+
// `tsconfig.scripts.json` maps `@metaobjectsdev/metadata/*` to
7+
// `packages/metadata/src/*` so that `scripts/` typechecks against workspace
8+
// SOURCE rather than a build output. With no `index.ts` here that mapping had
9+
// nothing to land on, so resolution fell through to `node_modules` and found
10+
// `dist/library/library-sources.d.ts` — which exists on a developer's machine
11+
// and does NOT exist on a fresh CI checkout, where the `gates` lane runs
12+
// `bun install` and never builds. The gate was green locally and red on the
13+
// runner for exactly that reason.
14+
//
15+
// So this file is the subpath's entry, and `package.json` names it. Adding a
16+
// module under `library/` means re-exporting it here.
17+
export * from "./library-sources.js";

0 commit comments

Comments
 (0)