Repository navigation
fix(metadata-core): drop the optional vitest peer so npm 10 installs it again - #23834
Conversation
…ever reads The `.` entry's built output (dist/index.js, its chunk, dist/index.cjs) imports nothing from vitest; only the test-only `./testing` entry does, and its docblock already tells consumers to bring vitest as a devDependency. The optional `vitest: ^4.0.0` peer led npm 10 into vitest@4.1.12, whose own peer set contradicts itself, and npm 10's resolver crashed (`Cannot read properties of null (reading 'edgesOut')`) on any install that reached this package. Claude-Session: https://claude.ai/code/session_01TQLy3Yq6vF4SDpTXdr3Uwi Co-authored-by: Claude <noreply@anthropic.com>
… peer Claude-Session: https://claude.ai/code/session_01TQLy3Yq6vF4SDpTXdr3Uwi Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
What this run could not see
Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
席位核对 · ✅ ACCEPT: PR #23834 at
|
Fixes #23806
Clause-②: no
What changes
@objectstack/metadata-coreno longer declaresvitestinpeerDependencies/peerDependenciesMeta. Both objects became empty and are removed. ThevitestdevDependency stays. One patch changeset is added,.changeset/23806-metadata-core-vitest-peer.md.pnpm-lock.yamldoes not move. The importer entry never recorded the peer.pnpm install --frozen-lockfileandpnpm install --lockfile-onlyboth exit 0, and the lockfile stays byte-unchanged.dist/is byte-identical before and after the edit (diff -rexit 0).tsup.config.tslistsvitestinexternalitself, sodist/testing.jsstill imports it and does not bundle it.Why: who reads
vitest?Measured on this branch's build and on the published
18.0.0-next.2tarball:vitest?.(import)dist/index.js+dist/chunk-URJ4AGQ3.js@objectstack/specsubpaths,zod,module,crypto.(require)dist/index.cjs./testingdist/testing.jsimport { describe, it, expect } from "vitest"./testingtypesdist/testing.d.tsThe runtime entry never reads
vitest. Only the test-only./testingentry does, and the docblock insrc/testing.tsalready tells consumers to listvitestas a devDependency. That sentence is still true, so the file is unchanged.In-repo consumers. Every in-repo consumer of
@objectstack/metadata-core/testingis a test file, inmetadata-fs,metadata-protocol,restorruntime. Each of those packages:vitest: ^4.1.11in its owndevDependencies;workspace:*.So none of them relied on the peer.
../objectui(at63d00da) has no consumer. Of the 85 trackedpackage.jsonfiles, metadata-core's was the only one withvitestas a peer, a dependency or an optional dependency.Measured: npm 10 (control first), then this branch
Each install ran in an empty scratch project on 2026-10-16. Upstream at measurement time:
vitestdist-tags:V4= 4.1.12,latest= 5.0.5.vitest@4.1.12peers@vitest/browser-webdriverio: ^4.1.11.vitest: 4.1.11exactly.So the upstream peer set is still incoherent.
@objectstack/metadata-core@18.0.0-next.2(control)Cannot read properties of null (reading 'edgesOut')vitestin the tree;import('@objectstack/metadata-core')loads 121 exports@objectstack/objectql@18.0.0-next.2(a dependent)edgesOutoverridespointing metadata-core at this branch's tarballvitest@5.0.5+ published metadata-coreERESOLVE:peerOptional vitest@"^4.0.0" from @objectstack/metadata-core@18.0.0-next.2vitest@5.0.5+ this branch's tarball17 published packages declare metadata-core directly, among them
objectql,runtime,rest,cli,metadataandmetadata-protocol. The peer therefore reached every npm install of any of them.What this does not fix
@objectstack/plugin-authstill exits 1 on npm 10.9.9 with the same error, even with metadata-core overridden to this branch's tarball. The cause isbetter-auth@1.7.3, which declares its own optionalvitestpeer (^2.0.0 || ^3.0.0 || ^4.0.0). This PR does not work around it.Both user remedies were measured, and the changeset names both:
"overrides": { "vitest": "~4.0.0" }(exit 0).Putting that remedy where an installing user reads the docs is the
domain:devxhalf of the card, as triage routed it. This PR touches nocontent/docs/**.The one reader the peer had, and what replaces it
Under one non-default layout, the peer did have a reader that the docblock cannot serve. The probe below runs
await import('@objectstack/metadata-core/testing')in a consumer that listsvitest4.1.11 as a devDependency:hoist=falseERR_MODULE_NOT_FOUND:Cannot find package 'vitest'hoist=falsevitest ~4.0.0plus the same override (blank-scaffold shape)hoist=false, pluspackageExtensionsre-declaring the peerThe changeset gives that layout the measured
packageExtensionsremedy.Keeping the peer and narrowing its range was considered and rejected, for two reasons:
ERESOLVEabove for every project on vitest 5, including projects that never import./testing.Verification (at
a27899a51)pnpm --filter @objectstack/metadata-core exec vitest run --maxWorkers=2: 18 files, 733 tests passed.pnpm --filter @objectstack/metadata-core run typecheck: exit 0.node scripts/pm/dispatch-gates.mjs --commandsderived 65 commands. All 65 ran: 64 exit 0, and 1 is NOT MEASURED. That one ispnpm check:dual-build-cjs-loads, which reports PREREQUISITE NOT MET because it needs every package'sdist/; CI runs it. In its place, a direct reading:requireofpackages/metadata-core/dist/index.cjsloads 121 keys. The--ranreconciliation reads 65 derived, 64 run, 1 NOT MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testfirst exited 3; it passed after its pinned commit was fetched.check:lean-entry-closurefirst exited 3; it passed after objectql's closure was built. Both exit 0.packages/.check:authz-resolver,check:error-code-casingandcheck:filter-alias-parityeach exit 0..tssources, and this diff contains none. CI runs them.Acceptance notes
src/testing.tsis left as is; its sentence is still true.vitest@4.1.11on its own also fails on npm 10.9.9:npm install -D vitest@4.1.11in an empty project exits 1 withedgesOut. So on npm 10, consumers of./testingare held back by upstream whatever this package declares. The~4.0.0shape works.Generated by Claude Code