Repository navigation
Commit eb96780
fix(cli): the peer-range read threw on a real install, and the fallback hid it
`604eb348a` had `meta init` declare what `meta gen`'s output imports, reading the version
ranges from `@metaobjectsdev/runtime-ts`'s own peerDependencies. Against the published
rc.4 it declared ONE of the four packages and reported success. The cold quickstart still
ended in six TS2307s.
Two defects, and the second is the one worth remembering.
**The resolve was wrong.** `require.resolve("@metaobjectsdev/runtime-ts/package.json")` is
gated by that package's `exports` map, which is `.` / `./drivers` / `./fastify` /
`./drizzle-fastify` / `./hono` — no `./package.json`. Under real Node it throws
ERR_PACKAGE_PATH_NOT_EXPORTED. It resolves the ENTRY now and walks up to the nearest
manifest bearing the right `name`: `.` is the one subpath every package exports, so that
form works under npm, pnpm, bun and a linked checkout alike. Verified against the
published rc.4 tree — it reads all five declared peer ranges.
**The fallback was silent, which is why the workspace could not see it.** `catch { return
{} }` turned a hard failure into "declare fewer packages", and the run looked successful.
`meta init` now says outright which packages it could NOT declare and why. A fallback
nobody can observe is indistinguishable from a bug — this one WAS the bug, for one
release.
Why every existing test passed: the workspace runs the CLI under bun against a symlinked
source tree, where the subpath resolves. Only a real external install has the exports map
in force. That is the same blindness as the peer-range gate's ("a workspace cannot see a
peer range") and it is why `scaffold-output-imports-declared` — which asserts exactly the
right thing — was green while the published CLI was broken.
The new gate needs neither an install nor a runtime, so it does not share that blindness:
for every `resolve("<pkg>/package.json")` in the CLI's source it reads that package's own
manifest and requires it to have no exports map, or to export `./package.json`. Proven by
restoring the old call — it fails and names the defect. Its second test asserts runtime-ts
really does withhold `./package.json`, so the rule cannot quietly become vacuous.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3v6M6uqECZ2Sb5eUv6YY1 parent 7706b63 commit eb96780
2 files changed
Lines changed: 126 additions & 4 deletions
File tree
- server/typescript/packages/cli
- src/commands
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
810 | 826 | | |
811 | 827 | | |
812 | 828 | | |
| |||
904 | 920 | | |
905 | 921 | | |
906 | 922 | | |
907 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
908 | 937 | | |
909 | 938 | | |
910 | 939 | | |
911 | | - | |
912 | | - | |
913 | | - | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
914 | 956 | | |
915 | 957 | | |
916 | 958 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments