Uh oh!
There was an error while loading. Please reload this page.
capnweb-validate: ship typescript as a capped dependency - #240
Conversation
🦋 Changeset detectedLatest commit: af74f4d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
The transform needs the JS compiler API, which TypeScript 7 (tsgo) no longer ships. The uncapped peer (>=5.7.0) resolved to whatever the consumer's workspace has, so under a TS 7 workspace the transform got a metadata-only package and crashed at build time; consumers had to work around it with a .pnpmfile.cjs rewriting the peer. A real dependency capped at <7 gives the transform its own JS-based compiler under TS 7 workspaces (transform compiler and check compiler are independent), and dedupes against the consumer's install on 5.7-6.x. The lockfile diff is hand-minimized because npm 11.9 strips the libc fields a newer npm wrote; npm ci validates it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
380aa93 to
af74f4dCompareteamchong
commented
Aug 12, 2026
/bonk review this |
There was a problem hiding this comment.
Review: ship typescript as a capped dependency
The change is sound and correctly targeted. The root cause analysis is accurate: capnweb-validate's transform imports the typescript compiler API at build time (import ts from "typescript" in src/transform/{run,context,transform-module}.ts), and those entry points call ts.sys / ts.findConfigFile / transpileModule / createProgram — none of which exist in the metadata-only TS 7 (tsgo) package. Moving typescript from an uncapped peer to a >=5.7.0 <7 direct dependency guarantees a real JS compiler is present regardless of the workspace's TS version, and consumers on 5.7–6.x will dedupe.
Consistency check (all good)
package.jsonand the lockfile agree:dependencies.typescript = ">=5.7.0 <7", peer removed, devDep removed.- Resolved lockfile version
5.9.3satisfies the new range and is no longer markeddev. - Root workspace still declares
typescript: ^5.9.3, so in-repo build/test are unaffected. - Changeset wording matches the actual range.
Points worth confirming before merge
Trade-off is a real duplicate install for TS 7 consumers. Under a TS 7 workspace,
<7forces a second, JS-based TypeScript (6.x) to be installed alongside the consumer's tsgo. That's the intended behavior and is stated in the PR body, but it's worth flagging explicitly for reviewers: this is a deliberate on-disk cost, not a bug.import type ts from "typescript"intype-introspector.tsis type-only and would have been erased — so the runtime need is genuinely the three value-importing modules. No concern, just confirming the peer->dep move is necessary rather than cosmetic.Making
typescripta harddependenciesrather than an optional peer changes install semantics for all consumers, including any who only use the runtime./internalexports and never the build-time transform. Those consumers will now always pull a TypeScript copy. If there is a runtime-only consumption path that never touches the compiler, consider whethertypescriptcould instead be a capped peer (>=5.7.0 <7) so it stays out of pure-runtime installs. If the package is only ever consumed as a build-time transform, the direct dependency is the right call and this is a non-issue.
Nothing blocking from a correctness standpoint. Items 1 and 3 are design confirmations rather than defects.
Review posted successfully. Summary of my assessment of PR #240: Verdict: sound and correctly targeted, no blocking issues. The change moves What I verified:
Points I flagged for the maintainer (design confirmations, not defects):
|
Uh oh!
There was an error while loading. Please reload this page.
capnweb-validate's build-time transform needs the JS compiler API (
transpileModule,createProgram,ts.sys), which TypeScript 7 (tsgo) no longer ships. The current peer is uncapped (>=5.7.0), so in a workspace whosetypescriptis 7.x the transform resolves a metadata-only package and dies at build time (ts.sys/ts.findConfigFileundefined). Working around it consumer-side takes a.pnpmfile.cjshook, because pnpm resolves peers from the importer's context and neitheroverridesnorpackageExtensionscan move one.This swaps the peer for a real dependency capped at
<7: under a TS 7 workspace the transform gets its own JS-based compiler (transform compiler and check compiler are independent - checking with tsgo still works fine), and consumers on 5.7–6.x dedupe to their existing install. The 6.0.3 compiler is validated against the transform in a real consumer.