Commit e47b40d
committed
perf(cli): keep the env-graph barrel out of the CLI entry point
Splitting the commands off left a 559KB shared chunk still loaded on every
invocation. That chunk was env-graph + the @env-spec parser + clack prompts
+ ansis, merged together because the entry reached the env-graph barrel
through three edges:
- helpers/error-checks.ts imports { EnvGraph, FileBasedDataSource } from the
barrel, but the entry only ever wanted InvalidEnvError from that module.
Moved that class to its own leaf module and pointed the entry at it.
- lib/formatting.ts imported ConfigItem and VarlockError as values, though
both are only used as parameter annotations. Made it an `import type`, so
the edge is erased at compile time.
- helpers/telemetry-usage-context.ts already deep-imports env-graph/lib/errors,
which is a leaf (its only import is my-dash), so it costs nothing.
error-checks.ts re-exports InvalidEnvError, so no other caller changes. The
class is still defined exactly once in the bundle, which is what keeps the
entry's `instanceof InvalidEnvError` catch working.
Entry static closure: 1029KB -> 320KB.1 parent 794322d commit e47b40d
4 files changed
Lines changed: 22 additions & 10 deletions
File tree
- packages/varlock/src
- cli
- helpers
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | 136 | | |
142 | 137 | | |
143 | 138 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments