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:
- Option A: Only track @Component transformation success (risky)
- Option B: Also scan for untransformed decorators (chosen — conservative, correct)
- 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
libs/libs-structural/platform-preview/src/lib/compiler/decorator-transformer.ts
🔗 Related
- Decision ID:
dev_1774381236668_0cbkv6g - Session: 264
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation