Commit 4264c8b
fix temporal-dead-zone on PKGX_MIN_VERSION
The previous commit placed `const PKGX_MIN_VERSION = new SemVer("2.4.0")`
above pkgx_meets_minimum() near line ~540, but the top-level dispatch
block (parsedArgs switch at lines 60–126) calls install() → get_pkgx() →
pkgx_meets_minimum() at module-init time, which is BEFORE execution
reaches line 540. `const` declarations are hoisted in name only (TDZ),
unlike `function` declarations whose bodies are hoisted — so the
reference threw `Cannot access 'PKGX_MIN_VERSION' before initialization`
at runtime, causing every `pkgm install` to fail silently with exit 1.
Neither `deno fmt`, `deno lint`, nor `deno check` detect this — it's a
module-init ordering issue invisible to static analysis. Pushed CI on
#86 caught it via the existing `./pkgm.ts i git` test.
Move the constant up to module-scope right after the `hydrate` import,
above any function that's reachable from top-level code.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e1104ea commit 4264c8b
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| |||
535 | 542 | | |
536 | 543 | | |
537 | 544 | | |
538 | | - | |
539 | | - | |
540 | 545 | | |
541 | 546 | | |
542 | 547 | | |
| |||
0 commit comments