refactor(vite-plugin-angular): fold @analogjs/angular-compiler into vite-plugin-angular#2299
Conversation
…ite-plugin-angular Move compiler sources from packages/angular-compiler/src/lib/ to packages/vite-plugin-angular/src/lib/compiler/ and consume them via an internal barrel instead of the published package. The compiler is no longer a standalone public package — it becomes an implementation detail behind the vite plugin. Removes: - @analogjs/angular-compiler dependency from vite-plugin-angular - packages/angular-compiler/ directory - ng-update packageGroup entries across 6 packages - release.config.cjs and tools/publish.sh entries - tsconfig.base.json path mapping - Scope references in pr-scope-map, commitlint, issue templates, coderabbit, AGENTS.md, CONTRIBUTING.md Adds magic-string, obug, and oxc-parser as direct dependencies of vite-plugin-angular (previously transitive via the old package). Moves COMPILER.md alongside the code and relocates scripts/setup-conformance.sh to packages/vite-plugin-angular/scripts/. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…to fastCompile Graduate the option out of the experimental block to a top-level boolean. Hard rename — the flag was never in a stable release and lived under experimental, so no deprecation alias is provided. analogCompilationMode stays inside experimental as an advanced escape hatch for library vs application output mode. Default remains false so existing behavior is preserved on upgrade. Updates the single repo consumer (analog-app's vite config) and the deps-plugin gating in @analogjs/platform to read the new flag. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename angular-compiler-compat.yml to compiler-compat.yml and retarget path filters, vitest paths, auto-issue template fields, and header comments to packages/vite-plugin-angular/src/lib/compiler/. Update conformance.yml to run the compiler suite from its new location and drop the standalone angular-compiler build step — vitest runs against source, so no build is needed. Update the COMPILER.md code comment reference in angular-version.ts to the new workflow filename. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ection Delete the standalone Analog Compiler docs page. The compiler is no longer a public package, so surfacing it as its own docs entry is misleading. Add a concise fastCompile section to the vite-plugin-angular README (which feeds the docs site) covering what the flag does, how to enable it, and the required ngc type-check step. Rewrite the COMPILER.md header so it reads as internal maintainer lore: the install/programmatic-API sections referenced a package that no longer exists, so those are replaced with a short note pointing at fastCompile. Path and workflow references throughout the file are updated to the new locations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pilePlugin Rename the internal plugin function, file, interface, and plugin name string to match the public fastCompile flag. Keeps internal naming in lockstep with the user-facing option so the implementation detail reads consistently. - analog-compiler-plugin.ts → fast-compile-plugin.ts - analogCompilerPlugin() → fastCompilePlugin() - AnalogCompilerPluginOptions → FastCompilePluginOptions - initAnalogCompiler / handleAnalogCompilerTransform → initFastCompile / handleFastCompileTransform - Vite plugin name "@analogjs/vite-plugin-angular-compiler" → "@analogjs/vite-plugin-angular-fast-compile" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… to [fast-compile] User-facing error and warning messages emitted by the compiler now use the [fast-compile] prefix to match the public flag name. The error shape and thrown Error behavior are unchanged — only the label string is updated, along with the test that asserts on it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…compile The obug root namespace used for structured compiler logging becomes analog-fast-compile (was analog-compiler) to match the public flag name. Updates the debug factory, CI workflow env var and issue template, and code comments that reference the DEBUG= invocation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ode to fastCompileMode Consistency rename for the advanced escape hatch that chooses between full (application) and partial (library) Ivy output. Stays under experimental — only the option name changes. Hard rename, no alias, for the same reasons as fastCompile: it was never in a stable release and lived under experimental.*. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…compile plugin state Rename the private local state variables inside fastCompilePlugin to match the file's new name: - analogRegistry → registry - analogResourceToSource → resourceToSource - analogProjectRoot → projectRoot These are private closure variables with no external reference — the prefix was a holdover from when the plugin and its state belonged to a separately-published package. Also simplify the now-redundant registry: registry property to shorthand and refresh the "Analog compiler state" comment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hoist fastCompileMode to the top level of PluginOptions alongside fastCompile. The option is read directly when fastCompile is enabled, so there's no reason to keep it nested one level deeper than its sibling flag. experimental now only carries useAngularCompilationAPI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…o 'fast-compile path' Final cosmetic sweep — stale references to the old "Analog compiler" concept in code comments and a line in COMPILER.md. The code doesn't know itself as the analog compiler anymore; it's the fast-compile path inside vite-plugin-angular. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This PR touches multiple package scopes: Please confirm the changes are closely related. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughDeprecated the standalone Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Vite as Vite (dev server / build)
participant Plugin as vite-plugin-angular
participant Fast as fast-compile module
participant TS as TypeScript/ngc (type-check step, external)
participant HMR as Vite HMR runtime
rect rgba(200,200,255,0.5)
Vite->>Plugin: load plugin (options include fastCompile?)
Plugin->>Fast: initialize fast-compile (buildStart / scan)
Fast-->>Plugin: registry, virtual modules
end
rect rgba(200,255,200,0.5)
Vite->>Plugin: transform(file)
Plugin->>Fast: handleFastCompileTransform(file)
Fast-->>Plugin: compiled code + HMR info
Plugin->>Vite: return transformed code (and HMR updates)
end
rect rgba(255,200,200,0.5)
Note over Plugin,TS: If fastCompile enabled, type-checking is recommended as a separate step
Plugin->>TS: (optional) developer runs `ngc --noEmit` as separate script
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~70 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…lugin-angular Surface fastCompile and fastCompileMode at the top level of the platform Options so users can enable the fast-compile path without nesting a vite block. Matches the existing passthrough convention for jit, inlineStylesExtension, liveReload, and friends — the platform top-level value is the default and vite.fastCompile / vite.fastCompileMode still win when both are set. Also teach deps-plugin.ts to honor the platform-level fastCompile flag so the TS/JS bundler exclusions get disabled correctly regardless of which location the user sets it at. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mirror the path filter from compiler-compat.yml so conformance fires the same way: on PRs or pushes to beta that touch the compiler source tree, package.json, or this workflow file. Stops the 7-way Angular matrix from running on every unrelated PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/vite-plugin-angular/README.md (1)
51-72: Nice fast-compile docs; consider making the conformance metric time-scoped.The section is clear and actionable. Optional tweak: at Line 71, annotate the
~91%figure with a date/CI reference so it doesn’t become stale.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/vite-plugin-angular/README.md` around lines 51 - 72, Update the loose conformance metric in the Fast Compile Mode docs so it is time-scoped: change the sentence that states "The fast compile path currently passes ~91% of Angular's conformance suite." (referencing the fastCompile section/README content) to include a date and/or CI reference (e.g., "as of YYYY-MM-DD" or "based on CI run `#1234`") and, if available, a link or note pointing to the test run or benchmark so readers know when and where the ~91% measurement came from.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/platform/src/lib/deps-plugin.ts`:
- Around line 18-20: fastCompile currently uses top-level options.fastCompile
before nested options.vite.fastCompile (using A || B), causing nested vite
settings to be ignored; update the assignment so options.vite.fastCompile takes
precedence by checking it first (use options?.vite?.fastCompile ??
options?.fastCompile as the resolution strategy) and apply the same change to
the other similar occurrences in this file where fastCompile is derived so
nested vite options override top-level ones.
---
Nitpick comments:
In `@packages/vite-plugin-angular/README.md`:
- Around line 51-72: Update the loose conformance metric in the Fast Compile
Mode docs so it is time-scoped: change the sentence that states "The fast
compile path currently passes ~91% of Angular's conformance suite." (referencing
the fastCompile section/README content) to include a date and/or CI reference
(e.g., "as of YYYY-MM-DD" or "based on CI run `#1234`") and, if available, a link
or note pointing to the test run or benchmark so readers know when and where the
~91% measurement came from.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0bced432-5991-4e62-b0cf-09a3d72bdde8
⛔ Files ignored due to path filters (3)
.coderabbit.yamlis excluded by none and included by none.github/ISSUE_TEMPLATE/01-bug-report.ymlis excluded by none and included by none.github/ISSUE_TEMPLATE/02-feature-request.ymlis excluded by none and included by none
📒 Files selected for processing (81)
.github/pr-scope-map.json.github/workflows/compiler-compat.yml.github/workflows/conformance.ymlAGENTS.mdCONTRIBUTING.mdapps/analog-app/vite.config.tsapps/docs-app/docs/packages/angular-compiler/overview.mdcommitlint.config.cjspackages/angular-compiler/README.mdpackages/angular-compiler/package.jsonpackages/angular-compiler/project.jsonpackages/angular-compiler/src/index.tspackages/angular-compiler/src/test-setup.tspackages/angular-compiler/tsconfig.jsonpackages/angular-compiler/tsconfig.lib.jsonpackages/angular-compiler/tsconfig.spec.jsonpackages/angular-compiler/vite.config.tspackages/astro-angular/package.jsonpackages/content/package.jsonpackages/platform/package.jsonpackages/platform/src/lib/deps-plugin.tspackages/platform/src/lib/options.tspackages/platform/src/lib/platform-plugin.tspackages/router/package.jsonpackages/vite-plugin-angular/README.mdpackages/vite-plugin-angular/package.jsonpackages/vite-plugin-angular/scripts/setup-conformance.shpackages/vite-plugin-angular/src/lib/angular-vite-plugin.tspackages/vite-plugin-angular/src/lib/compiler/COMPILER.mdpackages/vite-plugin-angular/src/lib/compiler/__fixtures__/test.component.csspackages/vite-plugin-angular/src/lib/compiler/__fixtures__/test.component.htmlpackages/vite-plugin-angular/src/lib/compiler/__fixtures__/test.component.scsspackages/vite-plugin-angular/src/lib/compiler/angular-version.tspackages/vite-plugin-angular/src/lib/compiler/class-field-lowering.spec.tspackages/vite-plugin-angular/src/lib/compiler/class-field-lowering.tspackages/vite-plugin-angular/src/lib/compiler/compile.spec.tspackages/vite-plugin-angular/src/lib/compiler/compile.tspackages/vite-plugin-angular/src/lib/compiler/component.spec.tspackages/vite-plugin-angular/src/lib/compiler/conformance.spec.tspackages/vite-plugin-angular/src/lib/compiler/constants.tspackages/vite-plugin-angular/src/lib/compiler/constructor-di.spec.tspackages/vite-plugin-angular/src/lib/compiler/cross-file-resolution.spec.tspackages/vite-plugin-angular/src/lib/compiler/debug.tspackages/vite-plugin-angular/src/lib/compiler/decorator-fields.spec.tspackages/vite-plugin-angular/src/lib/compiler/defer.tspackages/vite-plugin-angular/src/lib/compiler/directive.spec.tspackages/vite-plugin-angular/src/lib/compiler/dts-reader.spec.tspackages/vite-plugin-angular/src/lib/compiler/dts-reader.tspackages/vite-plugin-angular/src/lib/compiler/error-handling.spec.tspackages/vite-plugin-angular/src/lib/compiler/hmr.spec.tspackages/vite-plugin-angular/src/lib/compiler/hmr.tspackages/vite-plugin-angular/src/lib/compiler/i18n.spec.tspackages/vite-plugin-angular/src/lib/compiler/index.tspackages/vite-plugin-angular/src/lib/compiler/injectable.spec.tspackages/vite-plugin-angular/src/lib/compiler/integration.spec.tspackages/vite-plugin-angular/src/lib/compiler/jit-integration.spec.tspackages/vite-plugin-angular/src/lib/compiler/jit-metadata.tspackages/vite-plugin-angular/src/lib/compiler/jit-transform.spec.tspackages/vite-plugin-angular/src/lib/compiler/jit-transform.tspackages/vite-plugin-angular/src/lib/compiler/js-emitter.spec.tspackages/vite-plugin-angular/src/lib/compiler/js-emitter.tspackages/vite-plugin-angular/src/lib/compiler/metadata-emit.spec.tspackages/vite-plugin-angular/src/lib/compiler/metadata.tspackages/vite-plugin-angular/src/lib/compiler/ngmodule.spec.tspackages/vite-plugin-angular/src/lib/compiler/partial.spec.tspackages/vite-plugin-angular/src/lib/compiler/pipe.spec.tspackages/vite-plugin-angular/src/lib/compiler/registry.spec.tspackages/vite-plugin-angular/src/lib/compiler/registry.tspackages/vite-plugin-angular/src/lib/compiler/resource-inliner.tspackages/vite-plugin-angular/src/lib/compiler/style-ast.tspackages/vite-plugin-angular/src/lib/compiler/styles.tspackages/vite-plugin-angular/src/lib/compiler/test-helpers.tspackages/vite-plugin-angular/src/lib/compiler/type-elision.spec.tspackages/vite-plugin-angular/src/lib/compiler/type-elision.tspackages/vite-plugin-angular/src/lib/compiler/utils.tspackages/vite-plugin-angular/src/lib/fast-compile-plugin.tspackages/vite-plugin-angular/src/lib/utils/virtual-resources.tspackages/vite-plugin-nitro/package.jsonrelease.config.cjstools/publish.shtsconfig.base.json
💤 Files with no reviewable changes (16)
- CONTRIBUTING.md
- packages/angular-compiler/README.md
- AGENTS.md
- tools/publish.sh
- .github/pr-scope-map.json
- apps/docs-app/docs/packages/angular-compiler/overview.md
- commitlint.config.cjs
- packages/angular-compiler/tsconfig.spec.json
- packages/angular-compiler/tsconfig.json
- packages/angular-compiler/tsconfig.lib.json
- tsconfig.base.json
- packages/angular-compiler/vite.config.ts
- packages/angular-compiler/project.json
- packages/angular-compiler/package.json
- release.config.cjs
- packages/angular-compiler/src/index.ts
PR Checklist
Folds the
@analogjs/angular-compilerpackage into@analogjs/vite-plugin-angularas an internal implementation detail behind a new publicfastCompileflag. The compiler stops being a standalone published package — users opt into it via one knob on the vite plugin.Closes #
Affected scope
vite-plugin-angularplatform(deps-plugin readsfastCompile; new top-levelfastCompile/fastCompileModepassthroughs),ci(workflows retargeted),docs(standalone overview replaced with afastCompilesection in the vpa README)Recommended merge strategy for maintainer [optional]
Commit preservation note [optional]
The commits are split by concern — code move + package removal, option rename, CI retarget, docs, then a series of naming consistency passes (plugin function, error prefix, DEBUG namespace, option name, internal state), plus the platform-level passthrough. Each commit stands alone and compiles, which makes
git bisectand targeted revert useful if something regresses. Squashing loses that structure without any corresponding benefit since everything here is one scope area (vite-plugin-angular+ its direct platform passthrough).What is the new behavior?
User-facing
fastCompile?: boolean(top-level on bothvite-plugin-angularand@analogjs/platform) — opts into the single-pass compile path that skips Angular's template type-checking.fastCompileMode?: 'full' | 'partial'(top-level on both) — chooses between application ('full') and library ('partial') Ivy output whenfastCompileis enabled.experimental.useAnalogCompiler→fastCompile.experimental.analogCompilationMode→fastCompileMode.DEBUG=analog-compiler*→DEBUG=analog-fast-compile*.[fast-compile]instead of[angular-compiler].@analogjs/angular-compileris no longer published. All of its code now lives atpackages/vite-plugin-angular/src/lib/compiler/as internal modules with no public export path.Internal
packages/vite-plugin-angular/src/lib/compiler/(flat, tests co-located,__fixtures__/preserved).analogCompilerPlugin→fastCompilePlugin; fileanalog-compiler-plugin.ts→fast-compile-plugin.ts..github/workflows/angular-compiler-compat.ymlrenamed tocompiler-compat.yml, path filters and test commands retargeted.conformance.ymlpaths updated and the now-unusednx build angular-compilerstep dropped.magic-string,obug,oxc-parsermoved from transitive to direct dependencies ofvite-plugin-angular.ng-updatepackageGroups (6 packages),release.config.cjs,tools/publish.sh,tsconfig.base.json,.github/pr-scope-map.json,commitlint.config.cjs, issue templates,.coderabbit.yaml,AGENTS.md,CONTRIBUTING.md.Optionsgains top-levelfastCompile/fastCompileMode; thedeps-pluginbundler-exclusion gating reads either location.Test plan
pnpm exec vitest run packages/vite-plugin-angular/src/lib/compiler/— 602 passed, 2 skipped (conformance soft-failures pre-exist)pnpm exec vitest run packages/vite-plugin-angular/src/lib/angular-vite-plugin.spec.ts— 37 passedpnpm installregenerates the lockfile cleanly; no residual@analogjs/angular-compilerreferencescompiler-compat.ymlandconformance.ymlneed to pass on the PRDoes this PR introduce a breaking change?
The compiler and every option renamed here (
experimental.useAnalogCompiler,experimental.analogCompilationMode) lived in pre-1.0 beta under theexperimental.*namespace and were never in a stable release, so the project doesn't treat these renames as breaking. Users still on the old option names should rename as follows:angular({ - experimental: { - useAnalogCompiler: true, - analogCompilationMode: 'partial', - }, + fastCompile: true, + fastCompileMode: 'partial', })External consumers of the published
@analogjs/angular-compilerpackage (if any exist at the beta tag) should migrate to usingvite-plugin-angulardirectly withfastCompile: true— the compiler is no longer intended as a standalone API.Other information
The compiler was already integrated into
vite-plugin-angularviaexperimental.useAnalogCompiler; this PR doesn't change the compilation path itself, only the packaging and public surface around it. The rename trio (fastCompile/fastCompileMode/ internal naming) brings every user-visible touchpoint — option names, error prefix, DEBUG namespace — onto one consistent label.🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
@analogjs/vite-plugin-angularunder a new "fast compile" mode.@analogjs/angular-compilerpackage.useAnalogCompiler/analogCompilationModeconfiguration withfastCompile/fastCompileModeoptions.Chores