Skip to content

feat(hub): ng serve dev-server builder, and module timings in the Build tab - #493

Merged
erkamyaman merged 6 commits into
mainfrom
feat/dev-server-builder-timings
Nov 8, 2026
Merged

erkamyaman merged 6 commits into
mainfrom
feat/dev-server-builder-timings

Conversation

@erkamyaman

@erkamyaman erkamyaman commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Two open tracker items. Ships in 1.0.0.

Dev-server builder (#342)

A client-only app run with ng serve gets the devtools without editing server.ts and without running the standalone CLI behind a proxy.

  • New builder: @pangular-inspector/devtools:dev-server wraps @angular/build:dev-server (or @angular-devkit/build-angular:dev-server). It hands the hub middleware to executeDevServerBuilder, and the middleware runs before Angular's HTML fallback.
  • Options: the wrapped builder's own schema validates them, so its defaults apply. devtools: false turns the hub off. The builder warns on a webpack build target, because webpack takes no middleware.
  • Built as CommonJS: the CLI loads builders with require().
  • ng add: switches eligible serve targets to the new builder: application and browser-esbuild builds. --dev-server=false keeps the old behaviour. Express SSR and Vite setups are unchanged.
  • Docs: installation.md and the quick start explain the builder.

Module timings in the Build tab (#373)

  • Collection: vite-timings.ts wraps the client environment's plugin container. It records the resolveId, load and transform times of each module, keeps at most 5,000 modules, and runs in dev only.
  • Reports: module-graph reports the times and gets a "Slowest modules" section. There is no new tool or argument.
  • Panel: the Build tab has sortable columns (Module, Size, Time, Importers, Imports), using the shared SortHeader. A Time cell shows the per-phase breakdown when you hover it.
  • Docs: build.md has a new "Module timings" section with its limits. Timings are wall-clock and come from the Vite plugin only.

Refs #342, #373

Checks

  • Pass: typecheck, format:check, lint, commit:check, docs:build, test:axe (245 ok).
  • Tests:
    • test:devtools: 4443 passed.
    • test:panel: 1068 passed.
    • New: dev-server-builder.test.ts (13 tests), 9 ng-add tests, vite-timings.test.ts (7 tests, including a real Vite dev server), and Build tab sorting tests.
  • Manual: I ran the real @angular/build dev server through the builder:
    • the app returned 200;
    • /__devframes/ returned 200;
    • a foreign origin was refused with 403.
  • After merging main: I reran typecheck, format, lint and the affected tests.

Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added per-module resolve, load, and transform timings to the Build inspector, with sortable time columns, timing breakdowns, and coverage information.
    • Module-graph search results now include timing details and identify the slowest modules.
    • Client-only Angular CLI apps can mount the inspector in ng serve; ng add configures this automatically when the project is compatible.
  • Documentation
    • Updated setup guides, troubleshooting, and Build inspector documentation with the new Angular server option and module timing details.

A client-only Angular CLI app had no server to mount the devtools in,
so it needed the standalone CLI next to ng serve and a proxy config.
The @pangular-inspector/devtools:dev-server builder runs the Angular
CLI dev server from the workspace (@angular/build or
@angular-devkit/build-angular) through executeDevServerBuilder() and
hands it the hub's middleware, so the panel answers at /__devframes/
on the ng serve origin. The wrapped builder validates the serve
options against its own schema; the builder adds `devtools` and
`builder`, and closes the hub when the dev server stops.

ng add now switches the serve target of a project with no Express
server.ts and no Vite config to the builder, keeps an
@angular-devkit/build-angular dev server as its `builder` option,
skips webpack builds, and takes --dev-server=false to keep the target
and print the standalone CLI steps. SSR and Vite setups are unchanged.

Refs #342
…ild tab

The Build tab and the module-graph agent tool showed the module graph,
lazy boundaries and chunks, but not where the dev server spends its
time. The Vite plugin now wraps the client plugin container's
resolveId, load and transform calls when the dev server starts and
keeps the durations per module id (dev server only, at most 5,000
modules, restored when the server closes). The module graph carries a
`time` per module, the Build tab gets a sortable Time column next to
sortable Size, Importers and Imports columns, and module-graph lists
the slowest modules and a time per search hit.

Refs #373
…er-timings

# Conflicts:
#	extension/ui/assets/browser-agent-rpc-KH4HHvHf-B5Zk0AzF.js
#	extension/ui/assets/browser-agent-rpc-KH4HHvHf-DqNFcBHr.js
#	extension/ui/assets/browser-agent-rpc-KH4HHvHf-G6FmeCEh.js
#	extension/ui/assets/index-B6W3bI5a.js
#	extension/ui/assets/index-CH3Xqq9h.js
#	extension/ui/assets/index-Dw3jx7J8.js
#	extension/ui/index.html
@github-actions github-actions Bot added area: panel The devtools panel app (app/) area: package The ng-devtools package (packages/ng-devtools) area: extension The Chrome extension area: agents MCP server, agent tools and resources area: docs The documentation site labels Nov 8, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
04f9cd7 2026-11-08T08:46:41.250Z View logs ↗
  • Build: In progress 🔵

View logs ↗
bd654b4 2026-11-08T08:39:25.752Z View logs ↗

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The PR adds per-module Vite timing collection and reporting in the Build inspector and module-graph tool. It also adds an Angular CLI dev-server builder, updates ng add to select it for eligible projects, and documents both setup paths.

Changes: Vite Module Timings

Layer / File(s) Summary
Collect Vite module timings
packages/devtools/src/vite-timings.ts, packages/devtools/src/vite.ts, packages/devtools/src/__tests__/vite-timings.test.ts
The Vite plugin records resolve, load, and transform durations for modules. The collector caps storage at 5,000 modules and stops when the HTTP server closes.
Attach timings to the build graph
packages/devtools/src/build-graph.ts, packages/devtools/src/rpc/build-register.ts, packages/devtools/src/__tests__/build-graph.test.ts
The graph includes rounded phase durations, totals, and timing coverage. The module-graph report includes timing in search results and lists the slowest timed modules.
Display and document module timings
app/src/pages/build-inspector.ts, app/src/__tests__/performance-build-pages.test.ts, apps/docs/src/content/inspectors/build.md, apps/docs/src/content/agents/tools.md, packages/devtools/CHANGELOG.md, extension/ui/*
The Build inspector shows timing coverage and sortable module timing columns. Documentation and changelog entries describe the timing data; extension asset references are updated.

Angular CLI Dev-Server Builder

Layer / File(s) Summary
Implement and package the dev-server builder
packages/devtools/src/builders/*, packages/devtools/src/__tests__/dev-server-builder.test.ts, packages/devtools/package.json, packages/devtools/tsdown.config.ts
The builder selects a supported Angular dev server, forwards its options, and manages Inspector hub middleware and shutdown. The package registers and builds the builder, with tests for execution, schema, and published output.
Switch supported ng add serve targets
packages/devtools/src/schematics/ng-add/*, packages/devtools/src/__tests__/schematics-ng-add.test.ts
ng add adds a default-enabled devServer option and switches eligible client-only serve targets. Tests cover opt-out and unsupported project configurations.
Document the Angular CLI setup paths
apps/docs/src/content/getting-started/*, apps/docs/src/content/roadmap.md, packages/devtools/CHANGELOG.md, packages/devtools/src/__tests__/proxy-setup.test.ts
The guides describe builder-based setup and retain the standalone CLI and proxy alternative. The roadmap, changelog, and proxy documentation test reflect these setup paths.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant VitePlugin
  participant timeViteModules
  participant PluginContainer
  participant ModuleTimings
  participant viteGraphSource
  VitePlugin->>timeViteModules: wrap the client plugin container
  PluginContainer->>ModuleTimings: record phase durations
  VitePlugin->>viteGraphSource: pass collected timings
  viteGraphSource->>ModuleTimings: look up timings by module ID
Loading
sequenceDiagram
  participant AngularCLI
  participant runDevServer
  participant AngularDevServer
  participant InspectorHub
  AngularCLI->>runDevServer: run serve target with builder options
  runDevServer->>InspectorHub: start hub and obtain middleware when enabled
  runDevServer->>AngularDevServer: execute selected server with options and middleware
  AngularDevServer->>runDevServer: emit server output
  runDevServer->>InspectorHub: close hub on shutdown
Loading

Possibly related issues

Possibly related PRs

Merge Risk: Low · up to 04f9c

The new dev-server builder and module timings show no established functional problems. The installation guide overstates test coverage for the builder setup, which is a small docs fix.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nx-cloud

nx-cloud Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit bd654b4

Command Status Duration Result
nx affected -t test build ✅ Succeeded 3m 5s View ↗
nx build --configuration development ✅ Succeeded 1m 52s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-08 08:49:08 UTC

On the Windows runner tmpdir() is an 8.3 short name (RUNNER~1). Vite
resolves the files to their long path, so serving /main.ts from the
short-name root failed to load. The test now creates its project under
realpathSync.native of the temp folder.
The Analog example's vite.config.ts imports the plugin from source, and
Node loads it with type stripping only, which rejects the constructor
parameter property in ModuleTimings. It is now a plain field set in the
constructor.

Copy link
Copy Markdown
Member Author

Workers Builds: angular-devtools fails on every open PR. The cause is the Cloudflare deploy setup, not this change, and this PR has no fix for it. The merge is gated by the repo's own CI: Nx test and build, typecheck, axe and docs.


Generated by Claude Code

@erkamyaman
erkamyaman merged commit 07e5fab into main Nov 8, 2026
13 of 15 checks passed
@erkamyaman
erkamyaman deleted the feat/dev-server-builder-timings branch November 8, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents MCP server, agent tools and resources area: docs The documentation site area: extension The Chrome extension area: package The ng-devtools package (packages/ng-devtools) area: panel The devtools panel app (app/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant