Architecture: Should compilerEliminated flag account for @Directive/@Pipe/...

Documentation for Sessions

🏗️ Architecture: Should compilerEliminated flag account for @Directive/@Pipe/...

Date: 2026-03-24
Time: 19:40:36 UTC
Session: gspace1-264.7
Agent: angular
Confidence: 92%
Status: ✅ Documented


📋 Decision Context

Question:

Should compilerEliminated flag account for @Directive/@Pipe/@NgModule decorators that our transformer doesn't handle?

Task: S264.4: Fix compilerEliminated accuracy


🎯 Decision Made

Chosen:

Yes — scan for untransformed decorators and set compilerEliminated=false when found

Options Considered:

  1. Option A: Only track @Component transformation success (risky)
  2. Option B: Also scan for untransformed decorators (chosen — conservative, correct)
  3. Option C: Transform all decorator types (too much work for current scope)

💭 Reasoning

The compilerEliminated flag drives whether PreviewServerService loads @angular/compiler at runtime. If it's true but untransformed @Directive/@Pipe decorators exist, those will fail at runtime with 'needs JIT compiler' errors. Conservative approach: always check for UNTRANSFORMED_DECORATORS = ['@Directive', '@Pipe', '@NgModule']. If any are present, set false. This prevents silent runtime failures. The flag is already forced to false in AotCompilationStrategy (S267 finding: Angular library packages need JIT), but fixing the accuracy in transformAngularSources ensures correctness if the strategy changes later.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation