Repository navigation
fix(deps): a fresh scaffold's tree carries no ts-morph — the CLI takes the compiler from typescript directly - #29711
Conversation
…ctly @objectstack/cli used ts-morph only for the compiler namespace it re-exports. It now declares typescript ^6.0.3 (the range @objectstack/lint already declares) and drops ts-morph, so a fresh scaffold's tree no longer carries @ts-morph/common or its minimatch 10 line. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
The in-repo scaffold pin compared IN_REPO_TYPESCRIPT_RANGE with the CLI's devDependencies.typescript; that declaration now lives under dependencies, where the tsc the file spawns resolves it from. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 35 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 748121db508ca9dabceddf04464bfc627b4f1632 && git checkout 748121db508ca9dabceddf04464bfc627b4f1632
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c9636f1e50e48a2fee5205f0a9978c2a63f2dc07 deaa7e450e040e8ac8f1f05738c01dacae616dcd && git checkout -B drift-repro c9636f1e50e48a2fee5205f0a9978c2a63f2dc07 && git merge --no-ff deaa7e450e040e8ac8f1f05738c01dacae616dcd
node scripts/docs-audit/affected-docs.mjs --json c9636f1e50e48a2fee5205f0a9978c2a63f2dc07 |
|
domain:skills#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
…Dependency #29711 dropped ts-morph from @objectstack/cli, and no workspace package declares it any more. The codemod resolved ts-morph through the CLI's closure, so on a fresh `pnpm install --frozen-lockfile` its --verify and --self-test stopped at exit 2 and the ruled proofs could not be reproduced from a clean checkout. - package.json: ts-morph ^28.0.0 joins the root devDependencies, the way the other root scripts take typescript, yaml and semver. - pnpm-lock.yaml: written by `pnpm install --lockfile-only`. It adds ts-morph@28.0.0, @ts-morph/common@0.29.0 and code-block-writer@13.0.3. @ts-morph/common's minimatch resolves to the 10.2.6 already in the tree. - scripts/codemod-split-sql-driver.mjs: the loader resolves from the root manifest. The header says so, and also says which exit a tree with no install at all gets. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2gLghEqeDKTbDTC7Zd
Clause-②: no
Metadata-protocol: none
维护者速读
@objectstack/cli不再依赖ts-morph,改为直接依赖typescript^6.0.3(与@objectstack/lint已声明的同一范围);CLI 只用到ts-morph转出的编译器命名空间,从未用它的项目 API。ts-morph → @ts-morph/common → minimatch10 这一支是我们自己的包可以去掉的;改后新脚手架的树不再含ts-morph、@ts-morph/common及其带入的minimatch10。typescript@6.0.3(净增约 9.9 MB 解包体积,pnpm 无增量反而净减);回滚即还原本 PR。packages/cli/package.json(依赖互换)、packages/cli/src/utils/emitted-source-parses.ts(懒加载改为取default)、packages/cli/test/published-subpath-hook-body.pin.test.ts(tarball pin 改借typescript)。pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 test/published-subpath-hook-body.pin.test.ts,预期 15 个用例全过(打包后的 tarball 用typescript执行抽取器)。What changes
The rule: a fresh scaffold's tree carries no
ts-morphand no@ts-morph/common, so none of theminimatch10 line that@ts-morph/common0.29.0 (its newest release,minimatch ^10.0.1) pulls in. The CLI takes the TypeScript compiler fromtypescriptdirectly.packages/cli/package.json:ts-morph^28.0.0is dropped fromdependencies;typescript^6.0.3moves fromdevDependenciestodependencies. That is the range@objectstack/lint(a CLI dependency) already declares at runtime, on the 6.0 linets-morph28 bundled (6.0.2).ts) fromts-morph. They now import it fromtypescript: a staticimport ts from 'typescript'indetect-free-identifiers.tsandextract-hook-body.ts, and a lazyconst { default: ts } = await import('typescript')inemitted-source-parses.ts,importable-binding.ts,scaffold-wiring.tsandauthored-source-codemod.ts, which stay lazy for the reason their headers give. Type-only imports becomeimport type TS from 'typescript'../hook-bodytarball pin now borrowstypescriptinto its consumer and asserts that the manifest declares it underdependencies.create-in-repo-scaffold-typechecks.test.tsreads the CLI's own TypeScript range fromdependencies, which is where it is declared now.pnpm-lock.yaml:ts-morph@28.0.0,@ts-morph/common@0.29.0andcode-block-writer@13.0.3leave the lockfile.osv-scanner.tomland apnpm-workspace.yamlcomment stop listing@ts-morph/common/ts-morphas aminimatchparent, because the lockfile no longer has it..changeset/cli-compiler-from-typescript.md:@objectstack/clipatch.The other path a fresh scaffold had to the affected
globline,@objectstack/metadata, already carries the patchedglob^14.0.3range onmain(pending changeset28292-glob-14-advisory). This PR does not touch it.Tests
All run at
deaa7e45unless a line says otherwise. Build and test seconds were measured under the shared verify lock on a shared box.turbo run build --filter=@objectstack/cli...: 62/62 tasks, lock VERDICT command-exit 0 (5b804323; the later commit only changes a test file).pnpm --filter @objectstack/cli typecheck: exit 0 at5b804323. The run includes the test-layer check,check:test-typecheck: OK, with debt held at its pinned entries. The later commit's test file was re-run, as described below.pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2: 374/375 files and 5286/5287 tests passed at5b804323. The one red wascreate-in-repo-scaffold-typechecks.test.ts, which still read the CLI's TypeScript range fromdevDependencies. It was fixed indeaa7e45and re-run: 1/1 file, 5/5 tests. Theintegrationtier is left to CI, because no integration-tier file or spawn entry changed.create-objectstack, the scaffold package:typecheckexit 0, andvitest runpassed 23/23 files and 356/356 tests.distexecuted on plainnode, with no tsx and no vitest:findEmissionParseFailuresflagsexport const x = ;and passesexport const y = 1;.findBarrelAliasRefusal('my-alias')refuses andfindBarrelAliasRefusal('myAlias')returnsnull.barrelExportsBindinganswerstruefor an exportedaandfalseforb, which appears only in a comment. The compiler resolved from the CLI is 6.0.3.typescriptline was deleted frompackages/cli/package.json(anchor count 1 to 0, blob9c7c8f4a630cto9cd3a889c435). The pin then failed on@objectstack/cli must declare typescript in "dependencies". Restored: blob equals HEAD andgit diff HEADis empty. The first attempt was a no-op that the helper refused before any test ran, because its replacement text was a substring of the anchor.Acceptance notes
minimatchbelow 11.@oclif/core5.1.11, its newest release, declares^10.2.5.exceljs4.4.0 (@objectstack/rest's xlsx import/export, also its newest release) reachesminimatchthrougharchiver5 andunzipper0.10.archiver8.0.0'sreaddir-glob3.0.0 declaresminimatch ^10.2.2.minimatchis 11, which removesmakeReandASTand changes the parsed-pattern form thatglob7 reads. No published parent accepts it yet, the same reading theosv-scanner.tomlentry records for this workspace. So a cross-major scaffoldoverridesentry was not added.npm auditcheck in the scaffold smoke. Not added. New gates are "no" by default, and the only exception is a maintainer naming one (.claude/skills/pm-dispatch/SKILL.md, andreferences/instrument-discipline.md). No such naming exists here.typescriptis the scaffold's^5.3.0gets one more nestedtypescript@6.0.3under@objectstack/clifrom npm.@objectstack/lint's copy is nested beside it, and npm cannot share sibling-nested copies. That copy is 24.3 MB unpacked. It replacests-morph(1.5 MB),@ts-morph/common(12.8 MB, which bundled its own compiler),code-block-writerandpath-browserify, for a net of about +9.9 MB on npm. pnpm stores one copy, so the net there is about -14.4 MB.osv-scanner.toml: the existingminimatchentry keeps its id, scope andignoreUntil. Its reason only drops@ts-morph/common, a parent that is no longer in the lockfile. That is not an addition or a renewal, so it may ride with the fix under the file's convention 3.mainmoved 14 commits since the base06881565. None of them touch a path in this diff, so the branch was not merged.Verification
Simulated next-release scaffold: the blank template's manifest, with every reachable
@objectstack/*package (60) replaced by its current workspace manifest. npm 10.9.9,npm install --package-lock-only --ignore-scripts --install-links, thennpm ls.Installed-node diff, base 0688156 vs this branch (537 to 534 nodes)
npm ls ts-morph @ts-morph/common typescript, this branch
Gates
Generated by Claude Code