Bundle Analyzer Agent Skill: Stream versioned analyzer graph as JSON Lines (#99387)
## Summary Separate analyzer capture from versioned JSON Lines graph replay. `next analyze` builds the analyzer data and serves its UI; `next analyze --output --snapshot-name <name>` saves the usual binary snapshot and UI without serving. `next analyze --export-graph --snapshot-name <name>` reads a saved snapshot and streams one typed JSON record per line **without building or spawning a child**. Bare `--export-graph` reads the newest snapshot; `--snapshot <id>` selects an exact generated ID, and `--route` filters route records. Replay rejects a duplicate/missing name and an explicit `--port`, but accepts inherited `PORT`. Capture honors the configured `distDir` and holds Next's existing build lock from before Turbopack writes through snapshot completion (or until the UI exits). SWC bindings are installed **before** acquiring that native lock. Replay does not load the app config: apps using a custom directory pass `--dist-dir <relative-dir>` explicitly, leaving stdout as JSON Lines. The authoritative v1 record schema ships with the installed `next` package at `next/analyze/graph-v1.schema.json`; this root layer exports verified base fields, and the stacked producer PRs add typed roots, output membership and load relationships. The former `--output=json` shortcut and `--graph-json` spelling are intentionally rejected. Analyzer-owned filesystem work uses synchronous I/O for capture setup, snapshot persistence/history pruning and graph reads. Export keeps stdout drain handling and validates selected route data before emitting; serial reads do not eliminate retained route-buffer memory. ## Verification - Removed the broad `analyze-graph-dump.test.ts` fixture suite from this root and all descendants, leaving existing e2e unchanged. This intentionally drops unique malformed-input, stream/backpressure, collision and package-allowlist checks as agreed. Also removed `analyze-snapshot-selection.test.ts` (254 lines) without replacements; targeted mocked-history/path coverage is intentionally dropped. Neither analyzer unit suite remains. Next package no-emit types, ESLint and formatting pass across the distinct code layers. Scratch runtime probes match prior export bytes, check route filtering, corruption-before-output, drain/error behavior and snapshot history/pruning/cleanup. Existing e2e/schema/producer/skill files are unchanged; this pass changes four source files to use synchronous analyzer I/O. Earlier packaging checks confirmed the schema in a packed tarball. - Native e2e/full Rust build cannot run in this disk-limited sandbox. Prior head `39726552` passed the analyzer changed-test dev/prod jobs; **new-head CI is still required**. Its full CI had separate failures outside analyzer tests. Full model-driven agent evals were not run locally. <!-- NEXT_JS_LLM --> <!-- fleet d7bdbc2b-b0bc-4591-99eb-dccb0fa49c73 --> <!-- fleet ea768377-d71c-4a15-90b2-f4d50d4f6a1c --> --------- Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Will Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
Showing
| ... | ... | @@ -172,6 +172,7 @@ |
| "@vercel/kv": "3.0.0", | ||
| "@vercel/og": "1.0.1", | ||
| "@vercel/sandbox": "1.8.0", | ||
| "ajv": "8.17.1", | ||
| "alex": "9.1.0", | ||
| "async-sema": "3.0.1", | ||
| "babel-plugin-react-compiler": "0.0.0-experimental-1371fcb-20260227", | ||
| ... | ... |
This diff is collapsed.
This diff is collapsed.
Please
register
or
sign in
to comment