@analogjs/vite-plugin-angular 3.0.0-beta.42 → 3.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -5,14 +5,14 @@ import { detectTypeOnlyImportNames, elideTypeOnlyImportsMagicString } from "./ty
|
|
|
5
5
|
import { emitAngularExpr, emitAngularStmt, setEmitterSourceCode } from "./js-emitter.js";
|
|
6
6
|
import { lowerClassFields } from "./class-field-lowering.js";
|
|
7
7
|
import { collectStringConstants, detectFieldDecorators, detectSignals, extractConstructorDeps, extractMetadata } from "./metadata.js";
|
|
8
|
-
import { buildDeferDependencyMap } from "./defer.js";
|
|
8
|
+
import { buildDeferDependencyMap, buildImportMap } from "./defer.js";
|
|
9
9
|
import { buildCtorParameters, buildPropDecorators } from "./jit-metadata.js";
|
|
10
10
|
import { debugCompile } from "./debug.js";
|
|
11
11
|
import { inlineStyleRanges } from "./style-ast.js";
|
|
12
12
|
import * as fs from "node:fs";
|
|
13
13
|
import * as path$1 from "node:path";
|
|
14
14
|
import * as o from "@angular/compiler";
|
|
15
|
-
import { ConstantPool, FactoryTarget, ParseLocation, ParseSourceFile, ParseSourceSpan, R3NgModuleMetadataKind, R3SelectorScopeMode, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjector, compileNgModule, compilePipeFromMetadata, makeBindingParser, parseHostBindings, parseTemplate } from "@angular/compiler";
|
|
15
|
+
import { ConstantPool, FactoryTarget, ParseLocation, ParseSourceFile, ParseSourceSpan, R3NgModuleMetadataKind, R3SelectorScopeMode, compileClassMetadata, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjector, compileNgModule, compilePipeFromMetadata, makeBindingParser, parseHostBindings, parseTemplate } from "@angular/compiler";
|
|
16
16
|
import MagicString from "magic-string";
|
|
17
17
|
//#region packages/vite-plugin-angular/src/lib/compiler/compile.ts
|
|
18
18
|
function toTopLevelStatement(stmt) {
|
|
@@ -143,6 +143,11 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
const localSelectors = /* @__PURE__ */ new Map();
|
|
146
|
+
/**
|
|
147
|
+
* Per component class: the dependencies only its @defer blocks use, which
|
|
148
|
+
* its class metadata must load lazily (`ɵsetClassMetadataAsync`).
|
|
149
|
+
*/
|
|
150
|
+
const deferredMetadataDeps = /* @__PURE__ */ new Map();
|
|
146
151
|
if (!registry) for (const [clsName, oxcNode] of oxcClassMap) {
|
|
147
152
|
const decs = oxcNode.decorators || [];
|
|
148
153
|
if (decs.length > 0) {
|
|
@@ -405,6 +410,23 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
|
|
|
405
410
|
classCompileError = /* @__PURE__ */ new Error(`[fast-compile] Template parse error in ${fileName} (${className}): ${firstError.msg}`);
|
|
406
411
|
return;
|
|
407
412
|
}
|
|
413
|
+
const deferDependencies = buildDeferDependencyMap(parsedTemplate, oxcProgram, registry, localSelectors);
|
|
414
|
+
if (!isPartial && deferDependencies.deferredImports.size > 0) {
|
|
415
|
+
const importMap = buildImportMap(oxcProgram);
|
|
416
|
+
const metadataDeps = [];
|
|
417
|
+
for (let i = declarations.length - 1; i >= 0; i--) {
|
|
418
|
+
const name = declarationName(declarations[i]);
|
|
419
|
+
const info = name !== null ? importMap.get(name) : void 0;
|
|
420
|
+
if (name === null || info === void 0 || !deferDependencies.deferredImports.has(name)) continue;
|
|
421
|
+
declarations.splice(i, 1);
|
|
422
|
+
metadataDeps.unshift({
|
|
423
|
+
symbolName: name,
|
|
424
|
+
importPath: info.path,
|
|
425
|
+
isDefaultImport: info.isDefault
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
if (metadataDeps.length > 0) deferredMetadataDeps.set(className, metadataDeps);
|
|
429
|
+
}
|
|
408
430
|
const componentMeta = {
|
|
409
431
|
...meta,
|
|
410
432
|
name: className,
|
|
@@ -442,7 +464,7 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
|
|
|
442
464
|
usesInheritance,
|
|
443
465
|
defer: {
|
|
444
466
|
mode: 0,
|
|
445
|
-
blocks:
|
|
467
|
+
blocks: deferDependencies.blocks
|
|
446
468
|
},
|
|
447
469
|
declarationListEmitMode: 1,
|
|
448
470
|
i18nUseExternalIds: opts.i18nUseExternalIds ?? false,
|
|
@@ -704,7 +726,8 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
|
|
|
704
726
|
ctorParameters: ctorParameters ? new o.WrappedNodeExpr(`() => [${ctorParameters}]`) : null,
|
|
705
727
|
propDecorators: propDecorators ? new o.WrappedNodeExpr(propDecorators) : null
|
|
706
728
|
};
|
|
707
|
-
const
|
|
729
|
+
const deferredDeps = decName === "Component" ? deferredMetadataDeps.get(className) : void 0;
|
|
730
|
+
const classMetadataExpr = isPartial ? compileDeclareClassMetadata(classMetaInput) : deferredDeps ? compileComponentClassMetadata(classMetaInput, deferredDeps) : compileClassMetadata(classMetaInput);
|
|
708
731
|
const metadataStmt = new o.ExpressionStatement(classMetadataExpr);
|
|
709
732
|
if (topLevelClasses.has(node)) constantPool.statements.push(metadataStmt);
|
|
710
733
|
else scopedMetadata.push(metadataStmt);
|
|
@@ -815,6 +838,13 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
|
|
|
815
838
|
resourceDependencies
|
|
816
839
|
};
|
|
817
840
|
}
|
|
841
|
+
/** The local class name an `imports` entry declares, when it is a plain identifier. */
|
|
842
|
+
function declarationName(declaration) {
|
|
843
|
+
const node = declaration.type.node;
|
|
844
|
+
if (typeof node === "string") return node;
|
|
845
|
+
if (node?.type === "Identifier" && typeof node.name === "string") return node.name;
|
|
846
|
+
return declaration.className ?? null;
|
|
847
|
+
}
|
|
818
848
|
//#endregion
|
|
819
849
|
export { compile };
|
|
820
850
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","names":[],"sources":["../../../../src/lib/compiler/compile.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as o from '@angular/compiler';\nimport MagicString from 'magic-string';\nimport type { parseSync } from 'oxc-parser';\nimport { parseOxc } from './utils.js';\nimport {\n ConstantPool,\n compileComponentFromMetadata,\n compileDirectiveFromMetadata,\n compilePipeFromMetadata,\n compileNgModule,\n compileInjector,\n R3NgModuleMetadataKind,\n R3SelectorScopeMode,\n FactoryTarget,\n compileFactoryFunction,\n parseTemplate,\n makeBindingParser,\n parseHostBindings,\n ParseSourceFile,\n ParseLocation,\n ParseSourceSpan,\n compileClassMetadata,\n compileDeclareComponentFromMetadata,\n compileDeclareDirectiveFromMetadata,\n compileDeclarePipeFromMetadata,\n compileDeclareNgModuleFromMetadata,\n compileDeclareInjectorFromMetadata,\n compileDeclareInjectableFromMetadata,\n compileDeclareFactoryFunction,\n compileDeclareClassMetadata,\n} from '@angular/compiler';\nimport { ComponentRegistry } from './registry.js';\nimport {\n findAllClasses,\n resolveSyntheticImportSpecifier,\n walkOxc,\n} from './utils.js';\nimport { ANGULAR_DECORATORS, FIELD_DECORATORS } from './constants.js';\nimport { angularVersionAtLeast } from './angular-version.js';\nimport {\n detectTypeOnlyImportNames,\n elideTypeOnlyImportsMagicString,\n} from './type-elision.js';\n\nimport {\n emitAngularExpr,\n emitAngularStmt,\n setEmitterSourceCode,\n} from './js-emitter.js';\nimport { lowerClassFields } from './class-field-lowering.js';\nimport {\n extractMetadata,\n collectStringConstants,\n detectSignals,\n detectFieldDecorators,\n extractConstructorDeps,\n} from './metadata.js';\nimport { buildDeferDependencyMap } from './defer.js';\nimport { buildCtorParameters, buildPropDecorators } from './jit-metadata.js';\nimport { debugCompile, debugEmit } from './debug.js';\nimport { inlineStyleRanges } from './style-ast.js';\n\n/**\n * COMPLETE EXHAUSTIVE ANGULAR LITE COMPILER\n * Translates Angular Decorators + Signals to Ivy Static Definitions.\n *\n * @param registry - Optional external registry from the global analysis plugin.\n * When provided, used to resolve component/directive selectors for template compilation.\n */\nexport interface CompileResult {\n code: string;\n /** Source map for the transformation */\n map: ReturnType<MagicString['generateMap']>;\n /** Absolute paths of external resources (templateUrl, styleUrl) read during compilation */\n resourceDependencies: string[];\n}\n\nexport interface CompileOptions {\n registry?: ComponentRegistry;\n /** Pre-resolved style contents keyed by absolute file path (e.g. SCSS already compiled to CSS). */\n resolvedStyles?: Map<string, string>;\n /** Pre-processed inline styles (index in styles array → compiled CSS). */\n resolvedInlineStyles?: Map<number, string>;\n /**\n * When `false` (default), instance class field initializers are lowered to\n * constructor assignments (matching TypeScript's `useDefineForClassFields: false`\n * behavior). This is required for Angular's `inject()` and constructor DI to\n * work correctly with the standard Angular tsconfig.\n */\n useDefineForClassFields?: boolean;\n /** Enable legacy i18n message ID format (default: true). */\n enableI18nLegacyMessageIdFormat?: boolean;\n /** Normalize line endings in ICU expressions (default: true). */\n i18nNormalizeLineEndingsInICUs?: boolean;\n /** Use external IDs in `$localize` calls (for Closure Compiler compatibility). */\n i18nUseExternalIds?: boolean;\n /**\n * Compilation output mode.\n * - `'full'` (default): Emit final Ivy definitions (`ɵɵdefineComponent`) for application builds.\n * - `'partial'`: Emit partial declarations (`ɵɵngDeclareComponent`) for library publishing.\n * Partial output is version-stable and linked at application build time.\n */\n compilationMode?: 'full' | 'partial';\n /**\n * Pre-parsed OXC program of `sourceCode`, so callers that already parsed\n * the identical string can avoid a re-parse. Treated as read-only.\n */\n oxcProgram?: ReturnType<typeof parseSync>['program'];\n}\n\ntype CompileMetadata = ReturnType<typeof extractMetadata>;\n\ntype CompileDeclaration = {\n type: o.Expression;\n selector: string | null;\n className?: string;\n kind: number;\n name?: string;\n inputs?: string[];\n outputs?: string[];\n exportAs?: string[];\n isComponent?: boolean;\n};\n\n/** A top-level statement with any `export` wrapper unwrapped. */\ninterface TopLevelStatement {\n /** The declaration (or the statement itself when not exported). */\n decl: any;\n exported: boolean;\n /** Start of the whole statement, including leading class decorators. */\n start: number;\n end: number;\n}\n\nfunction toTopLevelStatement(stmt: any): TopLevelStatement {\n const isExport =\n (stmt.type === 'ExportNamedDeclaration' ||\n stmt.type === 'ExportDefaultDeclaration') &&\n stmt.declaration;\n const decl = isExport ? stmt.declaration : stmt;\n return {\n decl,\n exported: !!isExport,\n start: Math.min(stmt.start, decl.decorators?.[0]?.start ?? stmt.start),\n end: stmt.end,\n };\n}\n\n/** Get the callee name of a decorator call, e.g. `Component` for `@Component(...)`. */\nfunction decoratorCallName(dec: any, sourceCode: string): string | undefined {\n const callee = dec.expression;\n if (callee?.type !== 'CallExpression') return undefined;\n return sourceCode.slice(callee.callee.start, callee.callee.end);\n}\n\n/**\n * Normalize a `providers` / `viewProviders` metadata value into the single\n * `o.Expression` Angular's injector/host emitters expect.\n *\n * `extractMetadata` stores these as an array of `WrappedNodeExpr` when the\n * source used an inline array literal (`providers: [A, B]`) — those get\n * wrapped in a `LiteralArrayExpr`. When the source referenced a const,\n * spread, or call instead (`providers: safeProviders`), it stores the raw\n * expression, which is emitted by value. Returns `null` when there is\n * nothing to emit so callers skip the feature entirely.\n */\nfunction providersToExpr(\n value: o.Expression[] | o.Expression | undefined | null,\n): o.Expression | null {\n if (!value) return null;\n if (Array.isArray(value)) {\n return value.length ? new o.LiteralArrayExpr(value) : null;\n }\n return value;\n}\n\nconst LAZY_SCOPE_TYPES = new Set([\n 'FunctionDeclaration',\n 'FunctionExpression',\n 'ArrowFunctionExpression',\n 'ClassDeclaration',\n 'ClassExpression',\n 'TSFunctionType',\n 'TSConstructorType',\n 'TSMethodSignature',\n 'TSCallSignatureDeclaration',\n 'TSConstructSignatureDeclaration',\n]);\n\n/**\n * Collect identifier names referenced in eagerly-evaluated code only.\n * Skips function/arrow/class bodies so that lazy references\n * (e.g. `const TOKEN = () => LaterClass`) are not treated as dependencies.\n * The root node's own children are always walked.\n */\nfunction collectIdentifiers(root: any): Set<string> {\n const ids = new Set<string>();\n walkOxc(root, (n) => {\n if (n.type === 'Identifier') ids.add(n.name);\n return n === root || !LAZY_SCOPE_TYPES.has(n.type);\n });\n return ids;\n}\n\n/** Extract the names defined by a top-level declaration. */\nfunction getDefinedNames(decl: any): string[] {\n if (decl.type === 'VariableDeclaration') {\n const names: string[] = [];\n for (const d of decl.declarations) {\n collectBindingNames(d.id, names);\n }\n return names;\n }\n if (\n (decl.type === 'FunctionDeclaration' || decl.type === 'ClassDeclaration') &&\n decl.id\n ) {\n return [decl.id.name];\n }\n return [];\n}\n\n/** Recursively collect all bound identifiers from a binding pattern. */\nfunction collectBindingNames(pattern: any, out: string[]): void {\n if (!pattern) return;\n switch (pattern.type) {\n case 'Identifier':\n out.push(pattern.name);\n break;\n case 'ObjectPattern':\n for (const prop of pattern.properties) {\n collectBindingNames(\n prop.type === 'RestElement' ? prop.argument : prop.value,\n out,\n );\n }\n break;\n case 'ArrayPattern':\n for (const el of pattern.elements) collectBindingNames(el, out);\n break;\n case 'RestElement':\n collectBindingNames(pattern.argument, out);\n break;\n case 'AssignmentPattern':\n collectBindingNames(pattern.left, out);\n break;\n }\n}\n\nexport function compile(\n sourceCode: string,\n fileName: string,\n optionsOrRegistry?: CompileOptions | ComponentRegistry,\n): CompileResult {\n // Backward compat: accept ComponentRegistry directly\n const opts: CompileOptions =\n optionsOrRegistry instanceof Map\n ? { registry: optionsOrRegistry }\n : optionsOrRegistry || {};\n const registry = opts.registry;\n const resolvedStyles = opts.resolvedStyles;\n const resolvedInlineStyles = opts.resolvedInlineStyles;\n const useDefineForClassFields = opts.useDefineForClassFields ?? false;\n const isPartial = opts.compilationMode === 'partial';\n const startTimeMs = debugCompile.enabled ? performance.now() : 0;\n debugCompile(\n 'compile %s (mode=%s, registry=%d entries)',\n fileName,\n isPartial ? 'partial' : 'full',\n registry?.size ?? 0,\n );\n const oxcProgram = opts.oxcProgram ?? parseOxc(fileName, sourceCode).program;\n const styleRanges = resolvedInlineStyles && inlineStyleRanges(oxcProgram);\n const oxcClassMap = new Map<string, any>();\n for (const stmt of oxcProgram.body) {\n const decl =\n stmt.type === 'ExportNamedDeclaration' ||\n stmt.type === 'ExportDefaultDeclaration'\n ? (stmt as any).declaration\n : stmt;\n if (\n decl &&\n (decl.type === 'ClassDeclaration' || decl.type === 'ClassExpression') &&\n decl.id?.name\n ) {\n oxcClassMap.set(decl.id.name, decl);\n }\n }\n\n // Collect module-level string constants so decorator metadata can resolve\n // template-literal interpolations like `template: \\`<div class=\"${tw}\">x</div>\\``.\n const stringConsts = collectStringConstants(oxcProgram);\n\n const constantPool = new ConstantPool();\n const resourceDependencies: string[] = [];\n const parseFile = new ParseSourceFile(sourceCode, fileName);\n const parseLoc = new ParseLocation(parseFile, 0, 0, 0);\n const typeSourceSpan = new ParseSourceSpan(parseLoc, parseLoc);\n const typeOnlyImports = detectTypeOnlyImportNames(sourceCode, oxcProgram);\n const importSpecifierByName = new Map<string, string>();\n const importedNames = new Set<string>();\n const typeOnlyImportedNames = new Set<string>();\n\n for (const stmt of oxcProgram.body as any[]) {\n if (stmt.type !== 'ImportDeclaration') continue;\n\n const moduleSpecifier: string = stmt.source.value;\n // Explicit `import type { X }` — declaration-level type-only import\n const isDeclarationTypeOnly = stmt.importKind === 'type';\n for (const element of stmt.specifiers) {\n if (element.type !== 'ImportSpecifier') continue;\n const localName: string = element.local.name;\n importSpecifierByName.set(localName, moduleSpecifier);\n // Explicit `import { type X }` — specifier-level type-only import.\n // Both forms erase the symbol at runtime, so they cannot be used as\n // DI tokens. Add them to typeOnlyImports so extractConstructorDeps\n // surfaces ɵɵinvalidFactory() instead of emitting a broken\n // ɵɵdirectiveInject(X) referring to a non-existent value.\n if (isDeclarationTypeOnly || element.importKind === 'type') {\n typeOnlyImports.add(localName);\n typeOnlyImportedNames.add(localName);\n } else {\n importedNames.add(localName);\n }\n }\n }\n\n // Build a file-local selector map as fallback when no external registry is provided.\n // Skip the expensive extractMetadata scan when a registry covers all classes.\n const localSelectors = new Map<string, string>();\n if (!registry) {\n for (const [clsName, oxcNode] of oxcClassMap) {\n const decs: any[] = oxcNode.decorators || [];\n if (decs.length > 0) {\n const meta = extractMetadata(decs[0], sourceCode, stringConsts);\n if (meta?.selector) {\n localSelectors.set(clsName, meta.selector.split(',')[0].trim());\n }\n }\n }\n }\n\n const bindingParser = isPartial ? undefined : makeBindingParser();\n setEmitterSourceCode(sourceCode);\n\n // --- Direct walk: compile each Angular-decorated class and collect string outputs ---\n interface ClassCompileResult {\n ivyCode: string[]; // \"static ɵfac = ...\", \"static ɵcmp = ...\", etc.\n decorators: any[]; // Angular decorators to remove (OXC nodes)\n classEnd: number; // Position of closing } in original source\n // setClassMetadata calls for classes nested in a function scope, which\n // must be emitted next to the class rather than at module scope.\n scopedMetadata: o.Statement[];\n }\n const classResults: ClassCompileResult[] = [];\n const topLevelClasses = new Set(\n (oxcProgram.body as any[]).map((stmt) => toTopLevelStatement(stmt).decl),\n );\n // Track synthetic imports needed for NgModule export expansion.\n // Maps exported class name → import specifier.\n const syntheticImports = new Map<string, string>();\n // A type-only import is erased at runtime, so its synthetic value import\n // needs an alias to avoid redeclaring the type-only binding.\n const dependencyLocalName = (name: string) =>\n typeOnlyImportedNames.has(name) ? `ɵngDep_${name}` : name;\n\n // ANGULAR_DECORATORS imported from utils\n\n for (const node of findAllClasses(oxcProgram)) {\n const decorators: any[] = node.decorators;\n if (!decorators || decorators.length === 0) continue;\n\n const className: string | undefined = node.id?.name;\n if (!className) continue;\n\n const angularDecorators = decorators.filter((dec) =>\n ANGULAR_DECORATORS.has(decoratorCallName(dec, sourceCode) ?? ''),\n );\n if (angularDecorators.length === 0) continue;\n\n const ivyCode: string[] = [];\n let targetType: FactoryTarget = FactoryTarget.Injectable;\n // Store resolved resources per decorator for metadata inlining\n const resolvedResources = new Map<\n any,\n { template?: string; styles?: string[] }\n >();\n\n const classRef: o.R3Reference = {\n value: new o.WrappedNodeExpr(className),\n type: new o.WrappedNodeExpr(className),\n };\n\n // Detect `class Foo extends Bar` so the directive/component def\n // gets `usesInheritance: true`. Angular's compiler turns that into\n // `features: [InheritDefinitionFeature]`, which is what causes the\n // runtime to merge inputs/outputs/queries/host bindings from the\n // base class. Without it, derived directives like\n // `BrnPopover extends BrnDialog` lose every input declared on the\n // base, and any host directive that references those inputs by\n // public name fails at runtime with NG0311.\n const usesInheritance = !!node.superClass;\n\n let classCompileError: Error | null = null;\n\n angularDecorators.forEach((dec) => {\n const decoratorName = decoratorCallName(dec, sourceCode)!;\n const meta = extractMetadata(dec, sourceCode, stringConsts);\n const sigs = detectSignals(node, sourceCode);\n const fields = detectFieldDecorators(node, sourceCode);\n const hostBindings = parseHostBindings(meta.hostRaw || {});\n\n const hostMetadata: o.R3HostMetadata = {\n attributes: hostBindings.attributes,\n listeners: { ...hostBindings.listeners, ...fields.hostListeners },\n properties: { ...hostBindings.properties, ...fields.hostProperties },\n specialAttributes: hostBindings.specialAttributes,\n };\n\n switch (decoratorName) {\n case 'Component': {\n targetType = FactoryTarget.Component;\n if (!meta.selector) {\n meta.selector = `ng-component-${className.toLowerCase()}`;\n }\n\n const declarations: CompileDeclaration[] = [];\n // Dedupe by class name across direct imports, tuple-barrel\n // expansion, and NgModule export expansion so the final\n // `dependencies: () => [...]` list never contains the same\n // class twice. Otherwise Angular's runtime throws NG0300\n // (\"Multiple components match …\") when a file lists both\n // `NgIcon` and a barrel like `HlmIconImports = [HlmIcon, NgIcon]`\n // that re-exports it, or when two NgModules re-export the same\n // directive (e.g. FormsModule + ReactiveFormsModule →\n // DefaultValueAccessor).\n const seenDeclarationNames = new Set<string>();\n\n // Expand `imports` entries that are not directives themselves\n // (e.g. NgModules and tuple barrels like `HlmSelectImports =\n // [HlmSelect, HlmSelectContent, ...] as const`) into the\n // underlying directive class names. Returns the original entry\n // when it doesn't match either expansion case.\n const collectExpandedImports = (\n depClassName: string,\n visited: Set<string>,\n ): string[] => {\n if (visited.has(depClassName)) return [];\n visited.add(depClassName);\n const entry = registry?.get(depClassName);\n if (!entry) return [depClassName];\n if (entry.kind === 'ngmodule' && entry.exports) {\n const out: string[] = [];\n for (const name of entry.exports) {\n out.push(...collectExpandedImports(name, visited));\n }\n return out;\n }\n if (entry.kind === 'tuple' && entry.members) {\n const out: string[] = [];\n for (const name of entry.members) {\n out.push(...collectExpandedImports(name, visited));\n }\n return out;\n }\n return [depClassName];\n };\n\n for (const dep of Array.isArray(meta.imports) ? meta.imports : []) {\n const depNode = dep.node;\n const depClassName: string =\n typeof depNode === 'string'\n ? depNode\n : (depNode?.name ?? depNode?.type === 'Identifier')\n ? depNode.name\n : sourceCode.slice(depNode?.start ?? 0, depNode?.end ?? 0);\n const registryEntry = registry?.get(depClassName);\n\n // Tuple barrel: `imports: [HlmSelectImports]` where the\n // const is `[HlmSelect, HlmSelectContent, ...] as const`.\n // Expand into the underlying directive declarations and\n // track synthetic imports for any classes not already\n // referenced in this file.\n if (registryEntry?.kind === 'tuple' && registryEntry.members) {\n const expanded = collectExpandedImports(depClassName, new Set());\n const tupleSpecifier = importSpecifierByName.get(depClassName);\n for (const memberName of expanded) {\n const memberEntry = registry?.get(memberName);\n if (!memberEntry || memberEntry.kind === 'tuple') continue;\n const memberRef = new o.WrappedNodeExpr(\n dependencyLocalName(memberName),\n );\n if (!importedNames.has(memberName)) {\n const memberSpecifier = resolveSyntheticImportSpecifier(\n fileName,\n memberEntry,\n tupleSpecifier,\n );\n if (memberSpecifier) {\n syntheticImports.set(memberName, memberSpecifier);\n }\n }\n const kind = memberEntry.kind === 'pipe' ? 1 : 0;\n const memberDecl: CompileDeclaration = {\n type: memberRef,\n selector: memberEntry.selector,\n kind,\n ...(kind === 1 ? { name: memberEntry.pipeName } : {}),\n };\n if (memberEntry.inputs) {\n memberDecl.inputs = Object.values(memberEntry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (memberEntry.outputs) {\n memberDecl.outputs = Object.values(\n memberEntry.outputs,\n ) as string[];\n }\n if (!seenDeclarationNames.has(memberName)) {\n seenDeclarationNames.add(memberName);\n declarations.push(memberDecl);\n }\n }\n continue;\n }\n\n if (registryEntry?.kind === 'ngmodule' && registryEntry.exports) {\n const moduleSpecifier = importSpecifierByName.get(depClassName);\n\n // Recursively collect all non-module exports (handles nested NgModules\n // like ReactiveFormsModule → ɵInternalFormsSharedModule → DefaultValueAccessor)\n const allExports: string[] = [];\n const expandModule = (\n moduleName: string,\n visited = new Set<string>(),\n ) => {\n if (visited.has(moduleName)) return;\n visited.add(moduleName);\n const mod = registry?.get(moduleName);\n if (!mod?.exports) return;\n for (const name of mod.exports) {\n const entry = registry?.get(name);\n if (!entry) continue;\n if (entry.kind === 'ngmodule') {\n expandModule(name, visited);\n } else {\n allExports.push(name);\n }\n }\n };\n expandModule(depClassName);\n\n for (const exportedName of allExports) {\n const exportedEntry = registry?.get(exportedName);\n if (exportedEntry) {\n const kind = exportedEntry.kind === 'pipe' ? 1 : 0;\n // Create a reference to the exported class. If it's not\n // already imported, track it for synthetic import injection.\n const exportedRef = new o.WrappedNodeExpr(\n dependencyLocalName(exportedName),\n );\n const exportedSpecifier = resolveSyntheticImportSpecifier(\n fileName,\n exportedEntry,\n moduleSpecifier,\n );\n if (exportedSpecifier) {\n syntheticImports.set(exportedName, exportedSpecifier);\n }\n const decl: CompileDeclaration = {\n type: exportedRef,\n selector: exportedEntry.selector,\n kind,\n ...(kind === 1 ? { name: exportedEntry.pipeName } : {}),\n };\n if (exportedEntry.inputs) {\n decl.inputs = Object.values(exportedEntry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (exportedEntry.outputs) {\n decl.outputs = Object.values(\n exportedEntry.outputs,\n ) as string[];\n }\n if (!seenDeclarationNames.has(exportedName)) {\n seenDeclarationNames.add(exportedName);\n declarations.push(decl);\n }\n }\n }\n continue;\n }\n\n const selector =\n registryEntry?.selector ?? localSelectors.get(depClassName);\n const kind = registryEntry?.kind === 'pipe' ? 1 : 0;\n const decl: CompileDeclaration = {\n type: dep,\n selector: selector || `_unresolved-${depClassName}`,\n kind,\n ...(kind === 1 ? { name: registryEntry?.pipeName } : {}),\n };\n // Pass inputs/outputs from registry so template bindings resolve.\n // R3DirectiveDependencyMetadata expects inputs/outputs as string[]\n // of binding property names.\n if (registryEntry?.inputs) {\n decl.inputs = Object.values(registryEntry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (registryEntry?.outputs) {\n decl.outputs = Object.values(registryEntry.outputs) as string[];\n }\n if (!seenDeclarationNames.has(depClassName)) {\n seenDeclarationNames.add(depClassName);\n declarations.push(decl);\n }\n }\n\n // Add self-reference so recursive components (e.g. tree views)\n // can use their own selector in their template.\n // Skip in partial mode — the linker handles self-resolution.\n if (!isPartial && !seenDeclarationNames.has(className)) {\n const selfInputs = Object.entries(sigs.inputs).map(\n ([, v]: [string, any]) => v.bindingPropertyName,\n );\n const selfOutputs = Object.values({\n ...meta.outputs,\n ...fields.outputs,\n ...sigs.outputs,\n }) as string[];\n seenDeclarationNames.add(className);\n declarations.push({\n type: classRef.value,\n selector: meta.selector,\n kind: 0,\n ...(selfInputs.length > 0 ? { inputs: selfInputs } : {}),\n ...(selfOutputs.length > 0 ? { outputs: selfOutputs } : {}),\n });\n }\n\n // Non-standalone components get their directive/pipe scope from the\n // @NgModule that declares them. Whole-program ngtsc resolves this; a\n // per-file engine can't read the module from the component file, but the\n // project-wide registry (populated at buildStart) records every module's\n // declarations + imports. We resolve the owning module's transitive scope\n // here and inline it into the component's own `dependencies` — matching\n // ngtsc, and surviving tree-shaking (unlike a separate, droppable\n // `ɵɵsetComponentScope` call).\n //\n // A component declared in an @NgModule must set\n // `standalone: false`, so only those need the owning-module lookup.\n if (!isPartial && meta.standalone === false && registry) {\n let owningModule:\n | { declarations?: string[]; imports?: string[] }\n | undefined;\n for (const entry of registry.values()) {\n if (\n entry.kind === 'ngmodule' &&\n entry.declarations?.includes(className)\n ) {\n owningModule = entry;\n break;\n }\n }\n if (owningModule) {\n // Transitive scope = the module's own declarations + the exported\n // declarations of every imported module (recursively) + tuple members.\n const scopeNames = new Set<string>();\n const addExportsOf = (modName: string, visited: Set<string>) => {\n if (visited.has(modName)) return;\n visited.add(modName);\n const e = registry.get(modName);\n if (!e) return;\n if (e.kind === 'ngmodule') {\n for (const exp of e.exports ?? []) addExportsOf(exp, visited);\n } else if (e.kind === 'tuple') {\n for (const m of e.members ?? []) scopeNames.add(m);\n } else {\n scopeNames.add(modName);\n }\n };\n for (const d of owningModule.declarations ?? [])\n scopeNames.add(d);\n for (const imp of owningModule.imports ?? [])\n addExportsOf(imp, new Set());\n\n for (const name of scopeNames) {\n if (seenDeclarationNames.has(name)) continue;\n const entry = registry.get(name);\n if (\n !entry ||\n entry.kind === 'ngmodule' ||\n entry.kind === 'tuple'\n )\n continue;\n if (!importedNames.has(name)) {\n const spec = resolveSyntheticImportSpecifier(\n fileName,\n entry,\n importSpecifierByName.get(name),\n );\n if (spec) syntheticImports.set(name, spec);\n }\n const kind = entry.kind === 'pipe' ? 1 : 0;\n const decl: CompileDeclaration = {\n type: new o.WrappedNodeExpr(dependencyLocalName(name)),\n selector: entry.selector || `_unresolved-${name}`,\n kind,\n ...(kind === 1 ? { name: entry.pipeName } : {}),\n };\n if (entry.inputs) {\n decl.inputs = Object.values(entry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (entry.outputs) {\n decl.outputs = Object.values(entry.outputs) as string[];\n }\n seenDeclarationNames.add(name);\n declarations.push(decl);\n }\n }\n }\n\n let templateContent = meta.template || '';\n if (!templateContent && meta.templateUrl) {\n try {\n const templatePath = path.resolve(\n path.dirname(fileName),\n meta.templateUrl,\n );\n templateContent = fs.readFileSync(templatePath, 'utf-8');\n resourceDependencies.push(templatePath);\n } catch {\n console.warn(\n `[fast-compile] Could not read template file \"${meta.templateUrl}\" for ${className}`,\n );\n }\n }\n\n if (Array.isArray(meta.styleUrls)) {\n for (const url of meta.styleUrls) {\n try {\n const stylePath = path.resolve(path.dirname(fileName), url);\n const styleContent =\n resolvedStyles?.get(stylePath) ??\n fs.readFileSync(stylePath, 'utf-8');\n meta.styles.push(styleContent);\n resourceDependencies.push(stylePath);\n } catch {\n console.warn(\n `[fast-compile] Could not read style file \"${url}\" for ${className}`,\n );\n }\n }\n }\n\n const styleRange = styleRanges?.get(dec);\n if (resolvedInlineStyles && styleRange) {\n for (let k = 0; k < styleRange.count; k++) {\n const css = resolvedInlineStyles.get(styleRange.start + k);\n if (css !== undefined) meta.styles[k] = css;\n }\n }\n\n // Store resolved resources for metadata inlining\n resolvedResources.set(dec, {\n template: templateContent || undefined,\n styles: meta.styles?.length > 0 ? [...meta.styles] : undefined,\n });\n\n const parsedTemplate = parseTemplate(templateContent, fileName, {\n preserveWhitespaces: meta.preserveWhitespaces,\n enableI18nLegacyMessageIdFormat:\n opts.enableI18nLegacyMessageIdFormat ?? true,\n i18nNormalizeLineEndingsInICUs:\n opts.i18nNormalizeLineEndingsInICUs ?? true,\n });\n\n const ivyInputs: Record<string, unknown> = {};\n if (Array.isArray(meta.inputs)) {\n meta.inputs.forEach((i: string) => (ivyInputs[i] = i));\n } else if (meta.inputs) {\n Object.assign(ivyInputs, meta.inputs);\n }\n Object.assign(ivyInputs, fields.inputs);\n for (const [key, val] of Object.entries(sigs.inputs)) {\n const sigDesc = val as {\n bindingPropertyName?: string;\n required?: boolean;\n transform?: o.Expression | null;\n };\n ivyInputs[key] = {\n classPropertyName: key,\n // Honor the binding name (alias) extracted by detectSignals\n // so `input(null, { alias: 'aria-label' })` registers with\n // the public name `aria-label`, not the class property name.\n bindingPropertyName: sigDesc.bindingPropertyName ?? key,\n isSignal: true,\n required: sigDesc.required || false,\n transformFunction: sigDesc.transform || null,\n };\n }\n const templateErrors = parsedTemplate.errors ?? [];\n if (templateErrors.length > 0) {\n const firstError = templateErrors[0];\n classCompileError = new Error(\n `[fast-compile] Template parse error in ${fileName} (${className}): ${firstError.msg}`,\n );\n return;\n }\n\n const componentMeta: CompileMetadata & {\n name: string;\n type: o.R3Reference;\n typeSourceSpan: ParseSourceSpan;\n declarations: CompileDeclaration[];\n template: {\n nodes: o.Node[];\n ngContentSelectors: string[];\n preserveWhitespaces: boolean;\n };\n } = {\n ...meta,\n name: className,\n type: classRef,\n typeSourceSpan,\n declarations,\n template: {\n nodes: parsedTemplate.nodes,\n ngContentSelectors: parsedTemplate.ngContentSelectors,\n preserveWhitespaces: parsedTemplate.preserveWhitespaces,\n },\n styles: [...(meta.styles || []), ...(parsedTemplate.styles || [])],\n inputs: ivyInputs,\n outputs: { ...meta.outputs, ...fields.outputs, ...sigs.outputs },\n viewQueries: [...fields.viewQueries, ...sigs.viewQueries],\n queries: [...fields.contentQueries, ...sigs.contentQueries],\n host: hostMetadata,\n changeDetection: meta.changeDetection ?? (isPartial ? null : 1),\n encapsulation: meta.encapsulation ?? 0,\n exportAs: meta.exportAs,\n providers: providersToExpr(meta.providers),\n viewProviders: providersToExpr(meta.viewProviders),\n animations: meta.animations?.length\n ? new o.LiteralArrayExpr(meta.animations)\n : null,\n isStandalone: meta.standalone,\n imports: meta.imports,\n lifecycle: { usesOnChanges: false },\n // Angular v19/v20's `createComponentDefinitionMap` reads\n // `meta.interpolation.start` and `meta.interpolation.end`\n // unconditionally (the `!== DEFAULT_INTERPOLATION_CONFIG` check\n // is reference-equality, so a missing field enters the block\n // and crashes with `Cannot read properties of undefined`). v21\n // dropped the field from `createComponentDefinitionMap`\n // entirely. Use the v19/v20 singleton when the Angular package\n // exports it (matches the reference-equality check, skipping\n // the partial-mode emission block) and fall back to a plain\n // shape on v21+ where the field is ignored anyway.\n interpolation: (\n o as {\n DEFAULT_INTERPOLATION_CONFIG?: { start: string; end: string };\n }\n ).DEFAULT_INTERPOLATION_CONFIG ?? { start: '{{', end: '}}' },\n usesInheritance,\n defer: {\n mode: 0,\n blocks: buildDeferDependencyMap(\n parsedTemplate,\n oxcProgram,\n registry,\n localSelectors,\n ).blocks,\n },\n declarationListEmitMode: 1,\n i18nUseExternalIds: opts.i18nUseExternalIds ?? false,\n relativeContextFilePath: fileName,\n controlCreate: null,\n hasDirectiveDependencies:\n declarations.length > 0 ||\n (Array.isArray(meta.imports) && meta.imports.length > 0),\n };\n\n if (isPartial) {\n // Partial compilation accesses .inputs, .outputs, .exportAs on\n // each declaration — ensure they are arrays (not undefined).\n componentMeta.declarations = declarations.map((d) => ({\n ...d,\n inputs: d.inputs ?? null,\n outputs: d.outputs ?? null,\n exportAs: d.exportAs ?? null,\n isComponent: d.isComponent ?? false,\n }));\n const cmp = compileDeclareComponentFromMetadata(\n componentMeta,\n parsedTemplate,\n {\n content: templateContent,\n sourceUrl: fileName,\n isInline: !meta.templateUrl,\n inlineTemplateLiteralExpression: null,\n },\n );\n ivyCode.push(\n `static ɵcmp = /*@__PURE__*/ ${emitAngularExpr(cmp.expression)}`,\n );\n } else {\n const cmp = compileComponentFromMetadata(\n componentMeta,\n constantPool,\n bindingParser!,\n );\n ivyCode.push(\n `static ɵcmp = /*@__PURE__*/ ${emitAngularExpr(cmp.expression)}`,\n );\n }\n break;\n }\n\n case 'Directive': {\n targetType = FactoryTarget.Directive;\n // Build proper input descriptors (same as Component path)\n const dirInputs: Record<string, unknown> = {};\n if (Array.isArray(meta.inputs)) {\n meta.inputs.forEach((i: string) => (dirInputs[i] = i));\n } else if (meta.inputs) {\n Object.assign(dirInputs, meta.inputs);\n }\n Object.assign(dirInputs, fields.inputs);\n for (const [key, val] of Object.entries(sigs.inputs)) {\n const sigDesc = val as {\n bindingPropertyName?: string;\n required?: boolean;\n transform?: o.Expression | null;\n };\n dirInputs[key] = {\n classPropertyName: key,\n // Honor the binding name (alias) extracted by detectSignals.\n bindingPropertyName: sigDesc.bindingPropertyName ?? key,\n isSignal: true,\n required: sigDesc.required || false,\n transformFunction: sigDesc.transform || null,\n };\n }\n const directiveMeta = {\n ...meta,\n // Abstract base directives are declared as `@Directive()` with\n // no metadata. Angular's R3DirectiveMetadata accepts\n // `selector: string | null`, but the downstream selector parser\n // calls `.replace()` on the value and crashes on `undefined`.\n // Coerce missing selectors to `null` so abstract base classes\n // compile correctly.\n selector: meta.selector ?? null,\n name: className,\n type: classRef,\n typeSourceSpan,\n host: hostMetadata,\n inputs: dirInputs,\n outputs: { ...meta.outputs, ...fields.outputs, ...sigs.outputs },\n viewQueries: [...fields.viewQueries, ...sigs.viewQueries],\n queries: [...fields.contentQueries, ...sigs.contentQueries],\n // Angular's compiler treats `providers` as an Expression and\n // emits `ɵɵProvidersFeature(<expr>)` whenever it is truthy.\n // `providersToExpr` lowers an inline array literal to a\n // LiteralArrayExpr (matching the Component branch) and passes a\n // const/spread reference through by value — returning `null`\n // when there are no providers so Angular skips the feature\n // entirely. Passing the bare JS array would otherwise be lowered\n // to `null` and crash Angular at runtime in `resolveProvider`.\n providers: providersToExpr(meta.providers),\n exportAs: meta.exportAs,\n isStandalone: meta.standalone,\n lifecycle: { usesOnChanges: false },\n usesInheritance,\n controlCreate: null,\n };\n if (isPartial) {\n const dir = compileDeclareDirectiveFromMetadata(directiveMeta);\n ivyCode.push(\n `static ɵdir = /*@__PURE__*/ ${emitAngularExpr(dir.expression)}`,\n );\n } else {\n const dir = compileDirectiveFromMetadata(\n directiveMeta,\n constantPool,\n bindingParser!,\n );\n ivyCode.push(\n `static ɵdir = /*@__PURE__*/ ${emitAngularExpr(dir.expression)}`,\n );\n }\n break;\n }\n\n case 'Pipe': {\n targetType = FactoryTarget.Pipe;\n const pipeMeta = {\n ...meta,\n name: className,\n pipeName: meta.name,\n type: classRef,\n isStandalone: meta.standalone,\n pure: meta.pure ?? true,\n };\n if (isPartial) {\n const pipe = compileDeclarePipeFromMetadata(pipeMeta);\n ivyCode.push(\n `static ɵpipe = /*@__PURE__*/ ${emitAngularExpr(pipe.expression)}`,\n );\n } else {\n const pipe = compilePipeFromMetadata(pipeMeta);\n ivyCode.push(\n `static ɵpipe = /*@__PURE__*/ ${emitAngularExpr(pipe.expression)}`,\n );\n }\n break;\n }\n\n case 'Injectable': {\n targetType = FactoryTarget.Injectable;\n const injectableMeta: any = {\n name: className,\n type: classRef,\n typeArgumentCount: 0,\n providedIn: {\n expression: new o.LiteralExpr(meta.providedIn ?? null),\n forwardRef: 0,\n },\n };\n // Forward provider configuration so `ɵprov` honors useFactory/\n // useClass/useExisting/useValue. Without this, an\n // `@Injectable({ useFactory: () => ... })` quietly falls back\n // to constructor instantiation.\n if (meta.useClass) injectableMeta.useClass = meta.useClass;\n if (meta.useFactory) injectableMeta.useFactory = meta.useFactory;\n if (meta.useExisting) injectableMeta.useExisting = meta.useExisting;\n if (meta.useValue) injectableMeta.useValue = meta.useValue;\n // Dependency list for `useFactory` / `useClass`; without it the\n // emitted factory is invoked with no arguments.\n if (meta.deps) injectableMeta.deps = meta.deps;\n if (isPartial) {\n const inj = compileDeclareInjectableFromMetadata(injectableMeta);\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(inj.expression)}`,\n );\n } else {\n const inj = o.compileInjectable(injectableMeta, true);\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(inj.expression)}`,\n );\n }\n break;\n }\n\n case 'Service': {\n // `@Service` (and the `compileService` compiler API) landed in\n // Angular 22. On older peers the decorator does not exist; fail\n // loudly rather than falling through and emitting a default\n // `Injectable`-target factory with no `ɵprov`.\n if (!angularVersionAtLeast(22)) {\n classCompileError = new Error(\n `[fast-compile] @Service on ${className} requires Angular 22 or later`,\n );\n break;\n }\n targetType = (FactoryTarget as any).Service;\n const serviceMeta: any = {\n name: className,\n type: classRef,\n typeArgumentCount: 0,\n };\n if (meta.autoProvided === false) serviceMeta.autoProvided = false;\n if (meta.factory) serviceMeta.factory = meta.factory;\n if (isPartial) {\n const svc = (o as any).compileDeclareServiceFromMetadata(\n serviceMeta,\n );\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(svc.expression)}`,\n );\n } else {\n const svc = (o as any).compileService(serviceMeta, false);\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(svc.expression)}`,\n );\n }\n break;\n }\n\n case 'NgModule': {\n targetType = FactoryTarget.NgModule;\n const ngModuleImports = Array.isArray(meta.imports)\n ? meta.imports\n : [];\n const ngModuleDeclarations = Array.isArray(meta.declarations)\n ? meta.declarations\n : [];\n const ngModuleExports = Array.isArray(meta.exports)\n ? meta.exports\n : [];\n const ngModuleBootstrap = Array.isArray(meta.bootstrap)\n ? meta.bootstrap\n : [];\n\n const ngModuleMeta = {\n kind: R3NgModuleMetadataKind.Global as const,\n type: classRef,\n bootstrap: ngModuleBootstrap.map((e: o.WrappedNodeExpr<any>) => ({\n value: e,\n type: e,\n })),\n declarations: ngModuleDeclarations.map(\n (e: o.WrappedNodeExpr<any>) => ({ value: e, type: e }),\n ),\n publicDeclarationTypes: null,\n imports: ngModuleImports.map((e: o.WrappedNodeExpr<any>) => ({\n value: e,\n type: e,\n })),\n includeImportTypes: true,\n exports: ngModuleExports.map((e: o.WrappedNodeExpr<any>) => ({\n value: e,\n type: e,\n })),\n selectorScopeMode: R3SelectorScopeMode.Inline,\n containsForwardDecls: false,\n schemas: [],\n id: null,\n };\n const injectorMeta = {\n name: className,\n type: classRef,\n providers: providersToExpr(meta.providers),\n imports: ngModuleImports.map((e: o.WrappedNodeExpr<any>) => e),\n };\n if (isPartial) {\n const ngMod = compileDeclareNgModuleFromMetadata(ngModuleMeta);\n ivyCode.push(\n `static ɵmod = /*@__PURE__*/ ${emitAngularExpr(ngMod.expression)}`,\n );\n const injector = compileDeclareInjectorFromMetadata(injectorMeta);\n ivyCode.push(\n `static ɵinj = /*@__PURE__*/ ${emitAngularExpr(injector.expression)}`,\n );\n } else {\n const ngMod = compileNgModule(ngModuleMeta);\n ivyCode.push(\n `static ɵmod = /*@__PURE__*/ ${emitAngularExpr(ngMod.expression)}`,\n );\n const injector = compileInjector(injectorMeta);\n ivyCode.push(\n `static ɵinj = /*@__PURE__*/ ${emitAngularExpr(injector.expression)}`,\n );\n }\n break;\n }\n }\n });\n\n if (classCompileError) {\n throw classCompileError;\n }\n\n // Generate factory\n const deps = extractConstructorDeps(node, sourceCode, typeOnlyImports);\n if (deps === null) {\n const baseVar = `ɵ${className}_BaseFactory`;\n ivyCode.unshift(\n `static ɵfac = /*@__PURE__*/ (() => { let ${baseVar}; return function ${className}_Factory(__ngFactoryType__) { return (${baseVar} || (${baseVar} = i0.ɵɵgetInheritedFactory(${className})))(__ngFactoryType__ || ${className}); }; })()`,\n );\n } else if (deps === 'invalid') {\n ivyCode.unshift(\n `static ɵfac = function ${className}_Factory(__ngFactoryType__) { i0.ɵɵinvalidFactory(); }`,\n );\n } else {\n const factoryMeta = {\n name: className,\n type: classRef,\n typeArgumentCount: 0,\n deps,\n target: targetType,\n };\n if (isPartial) {\n const fac = compileDeclareFactoryFunction(factoryMeta);\n ivyCode.unshift(\n `static ɵfac = /*@__PURE__*/ ${emitAngularExpr(fac.expression)}`,\n );\n } else {\n const fac = compileFactoryFunction(factoryMeta);\n ivyCode.unshift(\n `static ɵfac = /*@__PURE__*/ ${emitAngularExpr(fac.expression)}`,\n );\n }\n }\n\n // Emit setClassMetadata for runtime decorator reflection (devMode only)\n const ctorParameters = buildCtorParameters(\n node,\n sourceCode,\n typeOnlyImports,\n );\n const propDecorators = buildPropDecorators(node, sourceCode, 'i0.');\n const scopedMetadata: o.Statement[] = [];\n angularDecorators.forEach((dec) => {\n const decName = decoratorCallName(dec, sourceCode)!;\n const decArgsNode = dec.expression.arguments[0];\n const textOf = (n: any) => sourceCode.slice(n.start, n.end);\n\n // Build the decorator args for setClassMetadata, inlining resources if needed.\n const resources = resolvedResources.get(dec);\n let metadataArgsExpr: string | null = null;\n if (decArgsNode) {\n if (resources && decArgsNode.type === 'ObjectExpression') {\n // Inline external templateUrl/styleUrl(s) into the metadata so Angular's\n // runtime doesn't try to fetch relative URLs (which fails during SSR).\n const rewrittenProps: string[] = [];\n let needsTransform = false;\n for (const prop of decArgsNode.properties) {\n if (\n prop.type !== 'Property' ||\n prop.shorthand ||\n prop.method ||\n prop.kind !== 'init'\n ) {\n rewrittenProps.push(textOf(prop));\n continue;\n }\n const propName = textOf(prop.key);\n\n if (propName === 'templateUrl' && resources.template) {\n rewrittenProps.push(\n `template: ${JSON.stringify(resources.template)}`,\n );\n needsTransform = true;\n } else if (\n (propName === 'styleUrl' || propName === 'styleUrls') &&\n resources.styles?.length\n ) {\n rewrittenProps.push(\n `styles: [${resources.styles.map((s) => JSON.stringify(s)).join(', ')}]`,\n );\n needsTransform = true;\n } else {\n rewrittenProps.push(textOf(prop));\n }\n }\n metadataArgsExpr = needsTransform\n ? `{${rewrittenProps.join(', ')}}`\n : textOf(decArgsNode);\n } else {\n metadataArgsExpr = textOf(decArgsNode);\n }\n }\n\n try {\n // `LiteralMapPropertyAssignment` was a class with a constructor in\n // Angular up through ~v19, removed-then-restored in later v20/v21\n // patches. The only stable shape across versions is the plain\n // `{ key, value, quoted }` object literal — Angular's own emitter\n // and Analog's `JSEmitter` both consume entries via duck typing\n // (`.key` / `.value` / `.quoted`), and `compileClassMetadata` does\n // not `instanceof`-check entries. The js-emitter has a matching\n // comment at the consumption site. Using `new o.LiteralMapProperty\n // Assignment(...)` would throw \"is not a constructor\" on Angular\n // versions where the class export is missing (e.g. 20.3.x), and\n // the surrounding try/catch would silently disable class metadata\n // emission for every class in the project.\n const classMetaInput = {\n type: new o.WrappedNodeExpr(className),\n decorators: new o.LiteralArrayExpr([\n new o.LiteralMapExpr([\n {\n key: 'type',\n value: new o.WrappedNodeExpr(decName),\n quoted: false,\n },\n ...(metadataArgsExpr\n ? [\n {\n key: 'args',\n value: new o.LiteralArrayExpr([\n new o.WrappedNodeExpr(metadataArgsExpr),\n ]),\n quoted: false,\n },\n ]\n : []),\n ] as unknown as o.LiteralMapPropertyAssignment[]),\n ]),\n ctorParameters: ctorParameters\n ? new o.WrappedNodeExpr(`() => [${ctorParameters}]`)\n : null,\n propDecorators: propDecorators\n ? new o.WrappedNodeExpr(propDecorators)\n : null,\n };\n const classMetadataExpr = isPartial\n ? compileDeclareClassMetadata(classMetaInput)\n : compileClassMetadata(classMetaInput);\n const metadataStmt = new o.ExpressionStatement(classMetadataExpr);\n if (topLevelClasses.has(node)) {\n constantPool.statements.push(metadataStmt);\n } else {\n scopedMetadata.push(metadataStmt);\n }\n } catch (e) {\n // Skip if compileClassMetadata fails — surfaced via DEBUG=analog-fast-compile\n if (debugCompile.enabled) {\n debugCompile(\n 'compileClassMetadata failed for %s in %s: %s',\n className,\n fileName,\n (e as Error)?.message,\n );\n }\n }\n });\n\n // Collect member decorators (@HostListener, @HostBinding, @Input, @Output,\n // @ViewChild, @ContentChild, etc.) so they are removed from the source.\n // The metadata has already been extracted by detectFieldDecorators().\n const memberDecorators: any[] = [];\n for (const member of node.body.body) {\n for (const dec of member.decorators ?? []) {\n if (FIELD_DECORATORS.has(decoratorCallName(dec, sourceCode) ?? '')) {\n memberDecorators.push(dec);\n }\n }\n }\n\n classResults.push({\n ivyCode,\n decorators: [...angularDecorators, ...memberDecorators],\n classEnd: node.end,\n scopedMetadata,\n });\n }\n\n // Apply edits via MagicString\n const ms = new MagicString(sourceCode, { filename: fileName });\n\n // 1. Prepend i0 import (skip if already present)\n if (!sourceCode.includes('import * as i0 from')) {\n ms.prepend('import * as i0 from \"@angular/core\";\\n');\n }\n\n // 1b. Inject synthetic imports for NgModule-exported classes\n for (const [name, specifier] of syntheticImports) {\n const localName = dependencyLocalName(name);\n if (!importedNames.has(localName)) {\n const binding = localName === name ? name : `${name} as ${localName}`;\n ms.prepend(`import { ${binding} } from \"${specifier}\";\\n`);\n importedNames.add(localName);\n }\n }\n\n // 2a. Hoist non-exported variable/function declarations that appear after\n // a class to just before the first class. This avoids TDZ errors when\n // static ɵcmp references file-level constants declared after the class.\n //\n // We must NOT hoist a statement whose initializer references a name\n // (class, exported const/let) that is defined between firstClassPos and\n // the statement itself — doing so would move the reference before the\n // definition and cause a TDZ error at runtime.\n if (classResults.length > 0) {\n // Find the position right before the first class (any class, not just Angular-decorated)\n const statements = (oxcProgram.body as any[]).map(toTopLevelStatement);\n let firstClassPos = Infinity;\n const nonHoistableNames = new Set<string>();\n for (const { decl, start } of statements) {\n if (decl.type === 'ClassDeclaration') {\n firstClassPos = start;\n // The first class itself is non-hoistable — statements hoisted\n // before it must not reference it.\n if (decl.id) {\n nonHoistableNames.add(decl.id.name);\n }\n break;\n }\n }\n\n // Pass 1: collect names defined by statements that will NOT be hoisted\n // (classes, enums, exported vars/functions) and therefore remain after\n // firstClassPos.\n for (const { decl, exported, start } of statements) {\n if (start <= firstClassPos) continue;\n\n if (\n decl.type === 'ClassDeclaration' ||\n decl.type === 'TSEnumDeclaration'\n ) {\n if (decl.id) nonHoistableNames.add(decl.id.name);\n } else if (\n exported &&\n (decl.type === 'VariableDeclaration' ||\n decl.type === 'FunctionDeclaration')\n ) {\n for (const n of getDefinedNames(decl)) {\n nonHoistableNames.add(n);\n }\n }\n }\n\n // Pass 2: for each hoist candidate, check if it references any\n // non-hoistable name. If it does, skip it and add its own names to the\n // non-hoistable set (transitivity).\n for (const { decl, exported, start, end } of statements) {\n if (start <= firstClassPos) continue;\n\n const isCandidate =\n !exported &&\n (decl.type === 'VariableDeclaration' ||\n decl.type === 'FunctionDeclaration');\n if (!isCandidate) continue;\n\n const referencedIds = collectIdentifiers(decl);\n let referencesNonHoistable = false;\n for (const id of referencedIds) {\n if (nonHoistableNames.has(id)) {\n referencesNonHoistable = true;\n break;\n }\n }\n\n if (referencesNonHoistable) {\n // Don't hoist — mark this statement's names as non-hoistable too\n for (const name of getDefinedNames(decl)) {\n nonHoistableNames.add(name);\n }\n } else {\n // Move rather than re-insert so the statement keeps its source map.\n // The separating newline is attached to the moved chunk.\n ms.appendLeft(end, '\\n');\n ms.move(start, end, firstClassPos);\n }\n }\n }\n\n // 2. For each compiled class: remove decorators + insert Ivy definitions\n for (const cr of classResults) {\n // Remove Angular decorators from source\n for (const dec of cr.decorators) {\n const start = dec.start;\n const end = dec.end;\n let trimEnd = end;\n while (\n trimEnd < sourceCode.length &&\n (sourceCode[trimEnd] === ' ' ||\n sourceCode[trimEnd] === '\\n' ||\n sourceCode[trimEnd] === '\\r')\n ) {\n trimEnd++;\n }\n ms.remove(start, trimEnd);\n }\n\n // Insert static members before closing }\n if (cr.ivyCode.length > 0) {\n const memberCode = cr.ivyCode.map((c) => ' ' + c + ';').join('\\n');\n ms.appendLeft(cr.classEnd - 1, '\\n' + memberCode + '\\n');\n }\n\n for (const stmt of cr.scopedMetadata) {\n ms.appendLeft(cr.classEnd, `\\n/*@__PURE__*/ ${emitAngularStmt(stmt)}`);\n }\n }\n\n // 3. Emit constant pool statements.\n // Split into: helper declarations (const/function) that must appear before\n // the class (since static property initializers reference them), and\n // side-effect statements (setClassMetadata IIFEs) that go after.\n const helpers: string[] = [];\n const sideEffects: string[] = [];\n for (const s of constantPool.statements) {\n const code = emitAngularStmt(s);\n if (\n s instanceof o.ExpressionStatement &&\n s.expr instanceof o.InvokeFunctionExpr\n ) {\n // setClassMetadata is wrapped in `(() => { ... })()` — annotate\n // the IIFE call so bundlers can drop it when ngDevMode is folded\n // to false at production build time.\n sideEffects.push(`/*@__PURE__*/ ${code}`);\n } else {\n helpers.push(code);\n }\n }\n\n if (sideEffects.length > 0) {\n ms.append('\\n\\n' + sideEffects.join('\\n'));\n }\n\n // 4. Lower class field initializers to constructor assignments when\n // useDefineForClassFields is false (standard Angular tsconfig).\n // Uses the original OXC AST positions which are still valid for MagicString\n // since MagicString tracks edits relative to the original source.\n // Ivy static definitions (ɵcmp, ɵfac) are not in the original AST so they\n // are unaffected, and shouldLowerField skips static fields regardless.\n if (!useDefineForClassFields) {\n lowerClassFields(ms, sourceCode, oxcProgram);\n }\n\n // 5. Elide imports that are only used in type positions (type annotations,\n // implements, generics, etc.). Without this pass, single-file transpilers\n // like OXC / esbuild cannot tell that `import { SomeType }` is type-only\n // and will leave the import in the output, causing runtime errors.\n // Detection runs once on the final output; helpers are appended for\n // analysis only, since their position does not affect references.\n const helperCode = helpers.join('\\n');\n const willElide = detectTypeOnlyImportNames(\n ms.toString() + '\\n' + helperCode,\n );\n if (helpers.length > 0) {\n // Insert helpers after the last import / top-level non-class statement,\n // well before any class that references them. Skip imports that will be\n // fully removed by type elision (step 5): inserting inside a\n // soon-to-be-removed range would discard the helpers with the import.\n let insertPos = 0;\n for (const stmt of oxcProgram.body as any[]) {\n const { decl } = toTopLevelStatement(stmt);\n if (stmt.type === 'ImportDeclaration') {\n // Skip imports that will be entirely removed by type elision\n if (willElide.size > 0 && stmt.specifiers.length > 0) {\n const allElided = stmt.specifiers.every(\n (spec: any) =>\n spec.type === 'ImportNamespaceSpecifier' ||\n spec.importKind === 'type' ||\n willElide.has(spec.local.name),\n );\n if (allElided) continue;\n }\n insertPos = stmt.end;\n } else if (\n decl.type === 'VariableDeclaration' &&\n !sourceCode.slice(stmt.start, stmt.end).includes('class')\n ) {\n insertPos = stmt.end;\n } else if (\n stmt.type !== 'TSExportAssignment' &&\n !(\n stmt.type === 'ExportDefaultDeclaration' &&\n decl.type !== 'ClassDeclaration' &&\n decl.type !== 'FunctionDeclaration'\n )\n ) {\n // Stop at the first class or non-import/non-variable statement\n break;\n }\n }\n // Helpers must survive downstream `ms.overwrite()` / `ms.remove()` of\n // imports performed by the type-only specifier elision pass (step 5).\n //\n // Case `insertPos > 0`: a surviving import ends at `insertPos`. Use\n // `appendRight(insertPos, …)` so helpers bind to the `\\n` after the\n // import's `;` — outside any overwrite range `[node.start, node.end)`\n // of a preceding import. `appendLeft(insertPos, …)` would bind to the\n // `;` itself, which IS inside the overwrite range and would be wiped.\n //\n // Case `insertPos === 0`: no import survives — every import is going\n // to be elided, and `elideTypeOnlyImportsMagicString` will\n // `ms.remove(0, declEnd)` the first one. `appendRight(0, …)` anchors\n // to the character at position 0 (the first import's first char),\n // which is inside `[0, declEnd)` and gets wiped. Use `appendLeft(0, …)`\n // instead — it anchors to the LEFT of position 0, outside any range\n // starting at 0, so the helpers survive. Ordering is still correct\n // because the i0 import prepended in step 1 lives in MagicString's\n // `intro` (from `ms.prepend`), which always emits before any\n // `appendLeft` content at position 0.\n if (insertPos === 0) {\n ms.appendLeft(0, helperCode + '\\n');\n } else {\n ms.appendRight(insertPos, '\\n' + helperCode + '\\n');\n }\n }\n elideTypeOnlyImportsMagicString(ms, oxcProgram, willElide);\n\n const map = ms.generateMap({\n source: fileName,\n file: fileName + '.js',\n includeContent: true,\n hires: 'boundary',\n });\n\n if (debugCompile.enabled) {\n debugCompile(\n 'compile %s done (%dms, %d classes, %d resource deps)',\n fileName,\n Math.round(performance.now() - startTimeMs),\n classResults.length,\n resourceDependencies.length,\n );\n }\n return {\n code: ms.toString(),\n map,\n resourceDependencies,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwIA,SAAS,oBAAoB,MAA8B;CACzD,MAAM,YACH,KAAK,SAAS,4BACb,KAAK,SAAS,+BAChB,KAAK;CACP,MAAM,OAAO,WAAW,KAAK,cAAc;CAC3C,OAAO;EACL;EACA,UAAU,CAAC,CAAC;EACZ,OAAO,KAAK,IAAI,KAAK,OAAO,KAAK,aAAa,EAAE,EAAE,SAAS,KAAK,KAAK;EACrE,KAAK,KAAK;CACZ;AACF;;AAGA,SAAS,kBAAkB,KAAU,YAAwC;CAC3E,MAAM,SAAS,IAAI;CACnB,IAAI,QAAQ,SAAS,kBAAkB,OAAO,KAAA;CAC9C,OAAO,WAAW,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,GAAG;AAChE;;;;;;;;;;;;AAaA,SAAS,gBACP,OACqB;CACrB,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS,IAAI,EAAE,iBAAiB,KAAK,IAAI;CAEx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,MAAM,KAAK,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,OAAO,GAExD,YAAY,KAAK;QACZ,IACL,KAAK,SAAS,wBACd,EACE,KAAK,SAAS,8BACd,KAAK,SAAS,sBACd,KAAK,SAAS,wBAIhB;EAEJ;EAoBA,IAAI,cAAc,GAChB,GAAG,WAAW,GAAG,aAAa,IAAI;OAElC,GAAG,YAAY,WAAW,OAAO,aAAa,IAAI;CAEtD;CACA,gCAAgC,IAAI,YAAY,SAAS;CAEzD,MAAM,MAAM,GAAG,YAAY;EACzB,QAAQ;EACR,MAAM,WAAW;EACjB,gBAAgB;EAChB,OAAO;CACT,CAAC;CAED,IAAI,aAAa,SACf,aACE,wDACA,UACA,KAAK,MAAM,YAAY,IAAI,IAAI,WAAW,GAC1C,aAAa,QACb,qBAAqB,MACvB;CAEF,OAAO;EACL,MAAM,GAAG,SAAS;EAClB;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"compile.js","names":[],"sources":["../../../../src/lib/compiler/compile.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as o from '@angular/compiler';\nimport MagicString from 'magic-string';\nimport type { parseSync } from 'oxc-parser';\nimport { parseOxc } from './utils.js';\nimport {\n ConstantPool,\n compileComponentFromMetadata,\n compileDirectiveFromMetadata,\n compilePipeFromMetadata,\n compileNgModule,\n compileInjector,\n R3NgModuleMetadataKind,\n R3SelectorScopeMode,\n FactoryTarget,\n compileFactoryFunction,\n parseTemplate,\n makeBindingParser,\n parseHostBindings,\n ParseSourceFile,\n ParseLocation,\n ParseSourceSpan,\n compileClassMetadata,\n compileComponentClassMetadata,\n compileDeclareComponentFromMetadata,\n compileDeclareDirectiveFromMetadata,\n compileDeclarePipeFromMetadata,\n compileDeclareNgModuleFromMetadata,\n compileDeclareInjectorFromMetadata,\n compileDeclareInjectableFromMetadata,\n compileDeclareFactoryFunction,\n compileDeclareClassMetadata,\n} from '@angular/compiler';\nimport { ComponentRegistry } from './registry.js';\nimport {\n findAllClasses,\n resolveSyntheticImportSpecifier,\n walkOxc,\n} from './utils.js';\nimport { ANGULAR_DECORATORS, FIELD_DECORATORS } from './constants.js';\nimport { angularVersionAtLeast } from './angular-version.js';\nimport {\n detectTypeOnlyImportNames,\n elideTypeOnlyImportsMagicString,\n} from './type-elision.js';\n\nimport {\n emitAngularExpr,\n emitAngularStmt,\n setEmitterSourceCode,\n} from './js-emitter.js';\nimport { lowerClassFields } from './class-field-lowering.js';\nimport {\n extractMetadata,\n collectStringConstants,\n detectSignals,\n detectFieldDecorators,\n extractConstructorDeps,\n} from './metadata.js';\nimport { buildDeferDependencyMap, buildImportMap } from './defer.js';\nimport { buildCtorParameters, buildPropDecorators } from './jit-metadata.js';\nimport { debugCompile, debugEmit } from './debug.js';\nimport { inlineStyleRanges } from './style-ast.js';\n\n/**\n * COMPLETE EXHAUSTIVE ANGULAR LITE COMPILER\n * Translates Angular Decorators + Signals to Ivy Static Definitions.\n *\n * @param registry - Optional external registry from the global analysis plugin.\n * When provided, used to resolve component/directive selectors for template compilation.\n */\nexport interface CompileResult {\n code: string;\n /** Source map for the transformation */\n map: ReturnType<MagicString['generateMap']>;\n /** Absolute paths of external resources (templateUrl, styleUrl) read during compilation */\n resourceDependencies: string[];\n}\n\nexport interface CompileOptions {\n registry?: ComponentRegistry;\n /** Pre-resolved style contents keyed by absolute file path (e.g. SCSS already compiled to CSS). */\n resolvedStyles?: Map<string, string>;\n /** Pre-processed inline styles (index in styles array → compiled CSS). */\n resolvedInlineStyles?: Map<number, string>;\n /**\n * When `false` (default), instance class field initializers are lowered to\n * constructor assignments (matching TypeScript's `useDefineForClassFields: false`\n * behavior). This is required for Angular's `inject()` and constructor DI to\n * work correctly with the standard Angular tsconfig.\n */\n useDefineForClassFields?: boolean;\n /** Enable legacy i18n message ID format (default: true). */\n enableI18nLegacyMessageIdFormat?: boolean;\n /** Normalize line endings in ICU expressions (default: true). */\n i18nNormalizeLineEndingsInICUs?: boolean;\n /** Use external IDs in `$localize` calls (for Closure Compiler compatibility). */\n i18nUseExternalIds?: boolean;\n /**\n * Compilation output mode.\n * - `'full'` (default): Emit final Ivy definitions (`ɵɵdefineComponent`) for application builds.\n * - `'partial'`: Emit partial declarations (`ɵɵngDeclareComponent`) for library publishing.\n * Partial output is version-stable and linked at application build time.\n */\n compilationMode?: 'full' | 'partial';\n /**\n * Pre-parsed OXC program of `sourceCode`, so callers that already parsed\n * the identical string can avoid a re-parse. Treated as read-only.\n */\n oxcProgram?: ReturnType<typeof parseSync>['program'];\n}\n\ntype CompileMetadata = ReturnType<typeof extractMetadata>;\n\ntype CompileDeclaration = {\n type: o.Expression;\n selector: string | null;\n className?: string;\n kind: number;\n name?: string;\n inputs?: string[];\n outputs?: string[];\n exportAs?: string[];\n isComponent?: boolean;\n};\n\n/** A top-level statement with any `export` wrapper unwrapped. */\ninterface TopLevelStatement {\n /** The declaration (or the statement itself when not exported). */\n decl: any;\n exported: boolean;\n /** Start of the whole statement, including leading class decorators. */\n start: number;\n end: number;\n}\n\nfunction toTopLevelStatement(stmt: any): TopLevelStatement {\n const isExport =\n (stmt.type === 'ExportNamedDeclaration' ||\n stmt.type === 'ExportDefaultDeclaration') &&\n stmt.declaration;\n const decl = isExport ? stmt.declaration : stmt;\n return {\n decl,\n exported: !!isExport,\n start: Math.min(stmt.start, decl.decorators?.[0]?.start ?? stmt.start),\n end: stmt.end,\n };\n}\n\n/** Get the callee name of a decorator call, e.g. `Component` for `@Component(...)`. */\nfunction decoratorCallName(dec: any, sourceCode: string): string | undefined {\n const callee = dec.expression;\n if (callee?.type !== 'CallExpression') return undefined;\n return sourceCode.slice(callee.callee.start, callee.callee.end);\n}\n\n/**\n * Normalize a `providers` / `viewProviders` metadata value into the single\n * `o.Expression` Angular's injector/host emitters expect.\n *\n * `extractMetadata` stores these as an array of `WrappedNodeExpr` when the\n * source used an inline array literal (`providers: [A, B]`) — those get\n * wrapped in a `LiteralArrayExpr`. When the source referenced a const,\n * spread, or call instead (`providers: safeProviders`), it stores the raw\n * expression, which is emitted by value. Returns `null` when there is\n * nothing to emit so callers skip the feature entirely.\n */\nfunction providersToExpr(\n value: o.Expression[] | o.Expression | undefined | null,\n): o.Expression | null {\n if (!value) return null;\n if (Array.isArray(value)) {\n return value.length ? new o.LiteralArrayExpr(value) : null;\n }\n return value;\n}\n\nconst LAZY_SCOPE_TYPES = new Set([\n 'FunctionDeclaration',\n 'FunctionExpression',\n 'ArrowFunctionExpression',\n 'ClassDeclaration',\n 'ClassExpression',\n 'TSFunctionType',\n 'TSConstructorType',\n 'TSMethodSignature',\n 'TSCallSignatureDeclaration',\n 'TSConstructSignatureDeclaration',\n]);\n\n/**\n * Collect identifier names referenced in eagerly-evaluated code only.\n * Skips function/arrow/class bodies so that lazy references\n * (e.g. `const TOKEN = () => LaterClass`) are not treated as dependencies.\n * The root node's own children are always walked.\n */\nfunction collectIdentifiers(root: any): Set<string> {\n const ids = new Set<string>();\n walkOxc(root, (n) => {\n if (n.type === 'Identifier') ids.add(n.name);\n return n === root || !LAZY_SCOPE_TYPES.has(n.type);\n });\n return ids;\n}\n\n/** Extract the names defined by a top-level declaration. */\nfunction getDefinedNames(decl: any): string[] {\n if (decl.type === 'VariableDeclaration') {\n const names: string[] = [];\n for (const d of decl.declarations) {\n collectBindingNames(d.id, names);\n }\n return names;\n }\n if (\n (decl.type === 'FunctionDeclaration' || decl.type === 'ClassDeclaration') &&\n decl.id\n ) {\n return [decl.id.name];\n }\n return [];\n}\n\n/** Recursively collect all bound identifiers from a binding pattern. */\nfunction collectBindingNames(pattern: any, out: string[]): void {\n if (!pattern) return;\n switch (pattern.type) {\n case 'Identifier':\n out.push(pattern.name);\n break;\n case 'ObjectPattern':\n for (const prop of pattern.properties) {\n collectBindingNames(\n prop.type === 'RestElement' ? prop.argument : prop.value,\n out,\n );\n }\n break;\n case 'ArrayPattern':\n for (const el of pattern.elements) collectBindingNames(el, out);\n break;\n case 'RestElement':\n collectBindingNames(pattern.argument, out);\n break;\n case 'AssignmentPattern':\n collectBindingNames(pattern.left, out);\n break;\n }\n}\n\nexport function compile(\n sourceCode: string,\n fileName: string,\n optionsOrRegistry?: CompileOptions | ComponentRegistry,\n): CompileResult {\n // Backward compat: accept ComponentRegistry directly\n const opts: CompileOptions =\n optionsOrRegistry instanceof Map\n ? { registry: optionsOrRegistry }\n : optionsOrRegistry || {};\n const registry = opts.registry;\n const resolvedStyles = opts.resolvedStyles;\n const resolvedInlineStyles = opts.resolvedInlineStyles;\n const useDefineForClassFields = opts.useDefineForClassFields ?? false;\n const isPartial = opts.compilationMode === 'partial';\n const startTimeMs = debugCompile.enabled ? performance.now() : 0;\n debugCompile(\n 'compile %s (mode=%s, registry=%d entries)',\n fileName,\n isPartial ? 'partial' : 'full',\n registry?.size ?? 0,\n );\n const oxcProgram = opts.oxcProgram ?? parseOxc(fileName, sourceCode).program;\n const styleRanges = resolvedInlineStyles && inlineStyleRanges(oxcProgram);\n const oxcClassMap = new Map<string, any>();\n for (const stmt of oxcProgram.body) {\n const decl =\n stmt.type === 'ExportNamedDeclaration' ||\n stmt.type === 'ExportDefaultDeclaration'\n ? (stmt as any).declaration\n : stmt;\n if (\n decl &&\n (decl.type === 'ClassDeclaration' || decl.type === 'ClassExpression') &&\n decl.id?.name\n ) {\n oxcClassMap.set(decl.id.name, decl);\n }\n }\n\n // Collect module-level string constants so decorator metadata can resolve\n // template-literal interpolations like `template: \\`<div class=\"${tw}\">x</div>\\``.\n const stringConsts = collectStringConstants(oxcProgram);\n\n const constantPool = new ConstantPool();\n const resourceDependencies: string[] = [];\n const parseFile = new ParseSourceFile(sourceCode, fileName);\n const parseLoc = new ParseLocation(parseFile, 0, 0, 0);\n const typeSourceSpan = new ParseSourceSpan(parseLoc, parseLoc);\n const typeOnlyImports = detectTypeOnlyImportNames(sourceCode, oxcProgram);\n const importSpecifierByName = new Map<string, string>();\n const importedNames = new Set<string>();\n const typeOnlyImportedNames = new Set<string>();\n\n for (const stmt of oxcProgram.body as any[]) {\n if (stmt.type !== 'ImportDeclaration') continue;\n\n const moduleSpecifier: string = stmt.source.value;\n // Explicit `import type { X }` — declaration-level type-only import\n const isDeclarationTypeOnly = stmt.importKind === 'type';\n for (const element of stmt.specifiers) {\n if (element.type !== 'ImportSpecifier') continue;\n const localName: string = element.local.name;\n importSpecifierByName.set(localName, moduleSpecifier);\n // Explicit `import { type X }` — specifier-level type-only import.\n // Both forms erase the symbol at runtime, so they cannot be used as\n // DI tokens. Add them to typeOnlyImports so extractConstructorDeps\n // surfaces ɵɵinvalidFactory() instead of emitting a broken\n // ɵɵdirectiveInject(X) referring to a non-existent value.\n if (isDeclarationTypeOnly || element.importKind === 'type') {\n typeOnlyImports.add(localName);\n typeOnlyImportedNames.add(localName);\n } else {\n importedNames.add(localName);\n }\n }\n }\n\n // Build a file-local selector map as fallback when no external registry is provided.\n // Skip the expensive extractMetadata scan when a registry covers all classes.\n const localSelectors = new Map<string, string>();\n /**\n * Per component class: the dependencies only its @defer blocks use, which\n * its class metadata must load lazily (`ɵsetClassMetadataAsync`).\n */\n const deferredMetadataDeps = new Map<\n string,\n { symbolName: string; importPath: string; isDefaultImport: boolean }[]\n >();\n if (!registry) {\n for (const [clsName, oxcNode] of oxcClassMap) {\n const decs: any[] = oxcNode.decorators || [];\n if (decs.length > 0) {\n const meta = extractMetadata(decs[0], sourceCode, stringConsts);\n if (meta?.selector) {\n localSelectors.set(clsName, meta.selector.split(',')[0].trim());\n }\n }\n }\n }\n\n const bindingParser = isPartial ? undefined : makeBindingParser();\n setEmitterSourceCode(sourceCode);\n\n // --- Direct walk: compile each Angular-decorated class and collect string outputs ---\n interface ClassCompileResult {\n ivyCode: string[]; // \"static ɵfac = ...\", \"static ɵcmp = ...\", etc.\n decorators: any[]; // Angular decorators to remove (OXC nodes)\n classEnd: number; // Position of closing } in original source\n // setClassMetadata calls for classes nested in a function scope, which\n // must be emitted next to the class rather than at module scope.\n scopedMetadata: o.Statement[];\n }\n const classResults: ClassCompileResult[] = [];\n const topLevelClasses = new Set(\n (oxcProgram.body as any[]).map((stmt) => toTopLevelStatement(stmt).decl),\n );\n // Track synthetic imports needed for NgModule export expansion.\n // Maps exported class name → import specifier.\n const syntheticImports = new Map<string, string>();\n // A type-only import is erased at runtime, so its synthetic value import\n // needs an alias to avoid redeclaring the type-only binding.\n const dependencyLocalName = (name: string) =>\n typeOnlyImportedNames.has(name) ? `ɵngDep_${name}` : name;\n\n // ANGULAR_DECORATORS imported from utils\n\n for (const node of findAllClasses(oxcProgram)) {\n const decorators: any[] = node.decorators;\n if (!decorators || decorators.length === 0) continue;\n\n const className: string | undefined = node.id?.name;\n if (!className) continue;\n\n const angularDecorators = decorators.filter((dec) =>\n ANGULAR_DECORATORS.has(decoratorCallName(dec, sourceCode) ?? ''),\n );\n if (angularDecorators.length === 0) continue;\n\n const ivyCode: string[] = [];\n let targetType: FactoryTarget = FactoryTarget.Injectable;\n // Store resolved resources per decorator for metadata inlining\n const resolvedResources = new Map<\n any,\n { template?: string; styles?: string[] }\n >();\n\n const classRef: o.R3Reference = {\n value: new o.WrappedNodeExpr(className),\n type: new o.WrappedNodeExpr(className),\n };\n\n // Detect `class Foo extends Bar` so the directive/component def\n // gets `usesInheritance: true`. Angular's compiler turns that into\n // `features: [InheritDefinitionFeature]`, which is what causes the\n // runtime to merge inputs/outputs/queries/host bindings from the\n // base class. Without it, derived directives like\n // `BrnPopover extends BrnDialog` lose every input declared on the\n // base, and any host directive that references those inputs by\n // public name fails at runtime with NG0311.\n const usesInheritance = !!node.superClass;\n\n let classCompileError: Error | null = null;\n\n angularDecorators.forEach((dec) => {\n const decoratorName = decoratorCallName(dec, sourceCode)!;\n const meta = extractMetadata(dec, sourceCode, stringConsts);\n const sigs = detectSignals(node, sourceCode);\n const fields = detectFieldDecorators(node, sourceCode);\n const hostBindings = parseHostBindings(meta.hostRaw || {});\n\n const hostMetadata: o.R3HostMetadata = {\n attributes: hostBindings.attributes,\n listeners: { ...hostBindings.listeners, ...fields.hostListeners },\n properties: { ...hostBindings.properties, ...fields.hostProperties },\n specialAttributes: hostBindings.specialAttributes,\n };\n\n switch (decoratorName) {\n case 'Component': {\n targetType = FactoryTarget.Component;\n if (!meta.selector) {\n meta.selector = `ng-component-${className.toLowerCase()}`;\n }\n\n const declarations: CompileDeclaration[] = [];\n // Dedupe by class name across direct imports, tuple-barrel\n // expansion, and NgModule export expansion so the final\n // `dependencies: () => [...]` list never contains the same\n // class twice. Otherwise Angular's runtime throws NG0300\n // (\"Multiple components match …\") when a file lists both\n // `NgIcon` and a barrel like `HlmIconImports = [HlmIcon, NgIcon]`\n // that re-exports it, or when two NgModules re-export the same\n // directive (e.g. FormsModule + ReactiveFormsModule →\n // DefaultValueAccessor).\n const seenDeclarationNames = new Set<string>();\n\n // Expand `imports` entries that are not directives themselves\n // (e.g. NgModules and tuple barrels like `HlmSelectImports =\n // [HlmSelect, HlmSelectContent, ...] as const`) into the\n // underlying directive class names. Returns the original entry\n // when it doesn't match either expansion case.\n const collectExpandedImports = (\n depClassName: string,\n visited: Set<string>,\n ): string[] => {\n if (visited.has(depClassName)) return [];\n visited.add(depClassName);\n const entry = registry?.get(depClassName);\n if (!entry) return [depClassName];\n if (entry.kind === 'ngmodule' && entry.exports) {\n const out: string[] = [];\n for (const name of entry.exports) {\n out.push(...collectExpandedImports(name, visited));\n }\n return out;\n }\n if (entry.kind === 'tuple' && entry.members) {\n const out: string[] = [];\n for (const name of entry.members) {\n out.push(...collectExpandedImports(name, visited));\n }\n return out;\n }\n return [depClassName];\n };\n\n for (const dep of Array.isArray(meta.imports) ? meta.imports : []) {\n const depNode = dep.node;\n const depClassName: string =\n typeof depNode === 'string'\n ? depNode\n : (depNode?.name ?? depNode?.type === 'Identifier')\n ? depNode.name\n : sourceCode.slice(depNode?.start ?? 0, depNode?.end ?? 0);\n const registryEntry = registry?.get(depClassName);\n\n // Tuple barrel: `imports: [HlmSelectImports]` where the\n // const is `[HlmSelect, HlmSelectContent, ...] as const`.\n // Expand into the underlying directive declarations and\n // track synthetic imports for any classes not already\n // referenced in this file.\n if (registryEntry?.kind === 'tuple' && registryEntry.members) {\n const expanded = collectExpandedImports(depClassName, new Set());\n const tupleSpecifier = importSpecifierByName.get(depClassName);\n for (const memberName of expanded) {\n const memberEntry = registry?.get(memberName);\n if (!memberEntry || memberEntry.kind === 'tuple') continue;\n const memberRef = new o.WrappedNodeExpr(\n dependencyLocalName(memberName),\n );\n if (!importedNames.has(memberName)) {\n const memberSpecifier = resolveSyntheticImportSpecifier(\n fileName,\n memberEntry,\n tupleSpecifier,\n );\n if (memberSpecifier) {\n syntheticImports.set(memberName, memberSpecifier);\n }\n }\n const kind = memberEntry.kind === 'pipe' ? 1 : 0;\n const memberDecl: CompileDeclaration = {\n type: memberRef,\n selector: memberEntry.selector,\n kind,\n ...(kind === 1 ? { name: memberEntry.pipeName } : {}),\n };\n if (memberEntry.inputs) {\n memberDecl.inputs = Object.values(memberEntry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (memberEntry.outputs) {\n memberDecl.outputs = Object.values(\n memberEntry.outputs,\n ) as string[];\n }\n if (!seenDeclarationNames.has(memberName)) {\n seenDeclarationNames.add(memberName);\n declarations.push(memberDecl);\n }\n }\n continue;\n }\n\n if (registryEntry?.kind === 'ngmodule' && registryEntry.exports) {\n const moduleSpecifier = importSpecifierByName.get(depClassName);\n\n // Recursively collect all non-module exports (handles nested NgModules\n // like ReactiveFormsModule → ɵInternalFormsSharedModule → DefaultValueAccessor)\n const allExports: string[] = [];\n const expandModule = (\n moduleName: string,\n visited = new Set<string>(),\n ) => {\n if (visited.has(moduleName)) return;\n visited.add(moduleName);\n const mod = registry?.get(moduleName);\n if (!mod?.exports) return;\n for (const name of mod.exports) {\n const entry = registry?.get(name);\n if (!entry) continue;\n if (entry.kind === 'ngmodule') {\n expandModule(name, visited);\n } else {\n allExports.push(name);\n }\n }\n };\n expandModule(depClassName);\n\n for (const exportedName of allExports) {\n const exportedEntry = registry?.get(exportedName);\n if (exportedEntry) {\n const kind = exportedEntry.kind === 'pipe' ? 1 : 0;\n // Create a reference to the exported class. If it's not\n // already imported, track it for synthetic import injection.\n const exportedRef = new o.WrappedNodeExpr(\n dependencyLocalName(exportedName),\n );\n const exportedSpecifier = resolveSyntheticImportSpecifier(\n fileName,\n exportedEntry,\n moduleSpecifier,\n );\n if (exportedSpecifier) {\n syntheticImports.set(exportedName, exportedSpecifier);\n }\n const decl: CompileDeclaration = {\n type: exportedRef,\n selector: exportedEntry.selector,\n kind,\n ...(kind === 1 ? { name: exportedEntry.pipeName } : {}),\n };\n if (exportedEntry.inputs) {\n decl.inputs = Object.values(exportedEntry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (exportedEntry.outputs) {\n decl.outputs = Object.values(\n exportedEntry.outputs,\n ) as string[];\n }\n if (!seenDeclarationNames.has(exportedName)) {\n seenDeclarationNames.add(exportedName);\n declarations.push(decl);\n }\n }\n }\n continue;\n }\n\n const selector =\n registryEntry?.selector ?? localSelectors.get(depClassName);\n const kind = registryEntry?.kind === 'pipe' ? 1 : 0;\n const decl: CompileDeclaration = {\n type: dep,\n selector: selector || `_unresolved-${depClassName}`,\n kind,\n ...(kind === 1 ? { name: registryEntry?.pipeName } : {}),\n };\n // Pass inputs/outputs from registry so template bindings resolve.\n // R3DirectiveDependencyMetadata expects inputs/outputs as string[]\n // of binding property names.\n if (registryEntry?.inputs) {\n decl.inputs = Object.values(registryEntry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (registryEntry?.outputs) {\n decl.outputs = Object.values(registryEntry.outputs) as string[];\n }\n if (!seenDeclarationNames.has(depClassName)) {\n seenDeclarationNames.add(depClassName);\n declarations.push(decl);\n }\n }\n\n // Add self-reference so recursive components (e.g. tree views)\n // can use their own selector in their template.\n // Skip in partial mode — the linker handles self-resolution.\n if (!isPartial && !seenDeclarationNames.has(className)) {\n const selfInputs = Object.entries(sigs.inputs).map(\n ([, v]: [string, any]) => v.bindingPropertyName,\n );\n const selfOutputs = Object.values({\n ...meta.outputs,\n ...fields.outputs,\n ...sigs.outputs,\n }) as string[];\n seenDeclarationNames.add(className);\n declarations.push({\n type: classRef.value,\n selector: meta.selector,\n kind: 0,\n ...(selfInputs.length > 0 ? { inputs: selfInputs } : {}),\n ...(selfOutputs.length > 0 ? { outputs: selfOutputs } : {}),\n });\n }\n\n // Non-standalone components get their directive/pipe scope from the\n // @NgModule that declares them. Whole-program ngtsc resolves this; a\n // per-file engine can't read the module from the component file, but the\n // project-wide registry (populated at buildStart) records every module's\n // declarations + imports. We resolve the owning module's transitive scope\n // here and inline it into the component's own `dependencies` — matching\n // ngtsc, and surviving tree-shaking (unlike a separate, droppable\n // `ɵɵsetComponentScope` call).\n //\n // A component declared in an @NgModule must set\n // `standalone: false`, so only those need the owning-module lookup.\n if (!isPartial && meta.standalone === false && registry) {\n let owningModule:\n | { declarations?: string[]; imports?: string[] }\n | undefined;\n for (const entry of registry.values()) {\n if (\n entry.kind === 'ngmodule' &&\n entry.declarations?.includes(className)\n ) {\n owningModule = entry;\n break;\n }\n }\n if (owningModule) {\n // Transitive scope = the module's own declarations + the exported\n // declarations of every imported module (recursively) + tuple members.\n const scopeNames = new Set<string>();\n const addExportsOf = (modName: string, visited: Set<string>) => {\n if (visited.has(modName)) return;\n visited.add(modName);\n const e = registry.get(modName);\n if (!e) return;\n if (e.kind === 'ngmodule') {\n for (const exp of e.exports ?? []) addExportsOf(exp, visited);\n } else if (e.kind === 'tuple') {\n for (const m of e.members ?? []) scopeNames.add(m);\n } else {\n scopeNames.add(modName);\n }\n };\n for (const d of owningModule.declarations ?? [])\n scopeNames.add(d);\n for (const imp of owningModule.imports ?? [])\n addExportsOf(imp, new Set());\n\n for (const name of scopeNames) {\n if (seenDeclarationNames.has(name)) continue;\n const entry = registry.get(name);\n if (\n !entry ||\n entry.kind === 'ngmodule' ||\n entry.kind === 'tuple'\n )\n continue;\n if (!importedNames.has(name)) {\n const spec = resolveSyntheticImportSpecifier(\n fileName,\n entry,\n importSpecifierByName.get(name),\n );\n if (spec) syntheticImports.set(name, spec);\n }\n const kind = entry.kind === 'pipe' ? 1 : 0;\n const decl: CompileDeclaration = {\n type: new o.WrappedNodeExpr(dependencyLocalName(name)),\n selector: entry.selector || `_unresolved-${name}`,\n kind,\n ...(kind === 1 ? { name: entry.pipeName } : {}),\n };\n if (entry.inputs) {\n decl.inputs = Object.values(entry.inputs).map(\n (i) => i.bindingPropertyName,\n );\n }\n if (entry.outputs) {\n decl.outputs = Object.values(entry.outputs) as string[];\n }\n seenDeclarationNames.add(name);\n declarations.push(decl);\n }\n }\n }\n\n let templateContent = meta.template || '';\n if (!templateContent && meta.templateUrl) {\n try {\n const templatePath = path.resolve(\n path.dirname(fileName),\n meta.templateUrl,\n );\n templateContent = fs.readFileSync(templatePath, 'utf-8');\n resourceDependencies.push(templatePath);\n } catch {\n console.warn(\n `[fast-compile] Could not read template file \"${meta.templateUrl}\" for ${className}`,\n );\n }\n }\n\n if (Array.isArray(meta.styleUrls)) {\n for (const url of meta.styleUrls) {\n try {\n const stylePath = path.resolve(path.dirname(fileName), url);\n const styleContent =\n resolvedStyles?.get(stylePath) ??\n fs.readFileSync(stylePath, 'utf-8');\n meta.styles.push(styleContent);\n resourceDependencies.push(stylePath);\n } catch {\n console.warn(\n `[fast-compile] Could not read style file \"${url}\" for ${className}`,\n );\n }\n }\n }\n\n const styleRange = styleRanges?.get(dec);\n if (resolvedInlineStyles && styleRange) {\n for (let k = 0; k < styleRange.count; k++) {\n const css = resolvedInlineStyles.get(styleRange.start + k);\n if (css !== undefined) meta.styles[k] = css;\n }\n }\n\n // Store resolved resources for metadata inlining\n resolvedResources.set(dec, {\n template: templateContent || undefined,\n styles: meta.styles?.length > 0 ? [...meta.styles] : undefined,\n });\n\n const parsedTemplate = parseTemplate(templateContent, fileName, {\n preserveWhitespaces: meta.preserveWhitespaces,\n enableI18nLegacyMessageIdFormat:\n opts.enableI18nLegacyMessageIdFormat ?? true,\n i18nNormalizeLineEndingsInICUs:\n opts.i18nNormalizeLineEndingsInICUs ?? true,\n });\n\n const ivyInputs: Record<string, unknown> = {};\n if (Array.isArray(meta.inputs)) {\n meta.inputs.forEach((i: string) => (ivyInputs[i] = i));\n } else if (meta.inputs) {\n Object.assign(ivyInputs, meta.inputs);\n }\n Object.assign(ivyInputs, fields.inputs);\n for (const [key, val] of Object.entries(sigs.inputs)) {\n const sigDesc = val as {\n bindingPropertyName?: string;\n required?: boolean;\n transform?: o.Expression | null;\n };\n ivyInputs[key] = {\n classPropertyName: key,\n // Honor the binding name (alias) extracted by detectSignals\n // so `input(null, { alias: 'aria-label' })` registers with\n // the public name `aria-label`, not the class property name.\n bindingPropertyName: sigDesc.bindingPropertyName ?? key,\n isSignal: true,\n required: sigDesc.required || false,\n transformFunction: sigDesc.transform || null,\n };\n }\n const templateErrors = parsedTemplate.errors ?? [];\n if (templateErrors.length > 0) {\n const firstError = templateErrors[0];\n classCompileError = new Error(\n `[fast-compile] Template parse error in ${fileName} (${className}): ${firstError.msg}`,\n );\n return;\n }\n\n // Classes used only inside @defer blocks load through the blocks'\n // dynamic import()s, so they must not also be eager dependencies:\n // that would keep their module in this chunk. Once nothing else\n // references them, the TypeScript strip pass drops their imports.\n const deferDependencies = buildDeferDependencyMap(\n parsedTemplate,\n oxcProgram,\n registry,\n localSelectors,\n );\n if (!isPartial && deferDependencies.deferredImports.size > 0) {\n const importMap = buildImportMap(oxcProgram);\n const metadataDeps: {\n symbolName: string;\n importPath: string;\n isDefaultImport: boolean;\n }[] = [];\n for (let i = declarations.length - 1; i >= 0; i--) {\n const name = declarationName(declarations[i]);\n const info = name !== null ? importMap.get(name) : undefined;\n if (\n name === null ||\n info === undefined ||\n !deferDependencies.deferredImports.has(name)\n ) {\n continue;\n }\n declarations.splice(i, 1);\n metadataDeps.unshift({\n symbolName: name,\n importPath: info.path,\n isDefaultImport: info.isDefault,\n });\n }\n if (metadataDeps.length > 0) {\n deferredMetadataDeps.set(className, metadataDeps);\n }\n }\n\n const componentMeta: CompileMetadata & {\n name: string;\n type: o.R3Reference;\n typeSourceSpan: ParseSourceSpan;\n declarations: CompileDeclaration[];\n template: {\n nodes: o.Node[];\n ngContentSelectors: string[];\n preserveWhitespaces: boolean;\n };\n } = {\n ...meta,\n name: className,\n type: classRef,\n typeSourceSpan,\n declarations,\n template: {\n nodes: parsedTemplate.nodes,\n ngContentSelectors: parsedTemplate.ngContentSelectors,\n preserveWhitespaces: parsedTemplate.preserveWhitespaces,\n },\n styles: [...(meta.styles || []), ...(parsedTemplate.styles || [])],\n inputs: ivyInputs,\n outputs: { ...meta.outputs, ...fields.outputs, ...sigs.outputs },\n viewQueries: [...fields.viewQueries, ...sigs.viewQueries],\n queries: [...fields.contentQueries, ...sigs.contentQueries],\n host: hostMetadata,\n changeDetection: meta.changeDetection ?? (isPartial ? null : 1),\n encapsulation: meta.encapsulation ?? 0,\n exportAs: meta.exportAs,\n providers: providersToExpr(meta.providers),\n viewProviders: providersToExpr(meta.viewProviders),\n animations: meta.animations?.length\n ? new o.LiteralArrayExpr(meta.animations)\n : null,\n isStandalone: meta.standalone,\n imports: meta.imports,\n lifecycle: { usesOnChanges: false },\n // Angular v19/v20's `createComponentDefinitionMap` reads\n // `meta.interpolation.start` and `meta.interpolation.end`\n // unconditionally (the `!== DEFAULT_INTERPOLATION_CONFIG` check\n // is reference-equality, so a missing field enters the block\n // and crashes with `Cannot read properties of undefined`). v21\n // dropped the field from `createComponentDefinitionMap`\n // entirely. Use the v19/v20 singleton when the Angular package\n // exports it (matches the reference-equality check, skipping\n // the partial-mode emission block) and fall back to a plain\n // shape on v21+ where the field is ignored anyway.\n interpolation: (\n o as {\n DEFAULT_INTERPOLATION_CONFIG?: { start: string; end: string };\n }\n ).DEFAULT_INTERPOLATION_CONFIG ?? { start: '{{', end: '}}' },\n usesInheritance,\n defer: {\n mode: 0,\n blocks: deferDependencies.blocks,\n },\n declarationListEmitMode: 1,\n i18nUseExternalIds: opts.i18nUseExternalIds ?? false,\n relativeContextFilePath: fileName,\n controlCreate: null,\n hasDirectiveDependencies:\n declarations.length > 0 ||\n (Array.isArray(meta.imports) && meta.imports.length > 0),\n };\n\n if (isPartial) {\n // Partial compilation accesses .inputs, .outputs, .exportAs on\n // each declaration — ensure they are arrays (not undefined).\n componentMeta.declarations = declarations.map((d) => ({\n ...d,\n inputs: d.inputs ?? null,\n outputs: d.outputs ?? null,\n exportAs: d.exportAs ?? null,\n isComponent: d.isComponent ?? false,\n }));\n const cmp = compileDeclareComponentFromMetadata(\n componentMeta,\n parsedTemplate,\n {\n content: templateContent,\n sourceUrl: fileName,\n isInline: !meta.templateUrl,\n inlineTemplateLiteralExpression: null,\n },\n );\n ivyCode.push(\n `static ɵcmp = /*@__PURE__*/ ${emitAngularExpr(cmp.expression)}`,\n );\n } else {\n const cmp = compileComponentFromMetadata(\n componentMeta,\n constantPool,\n bindingParser!,\n );\n ivyCode.push(\n `static ɵcmp = /*@__PURE__*/ ${emitAngularExpr(cmp.expression)}`,\n );\n }\n break;\n }\n\n case 'Directive': {\n targetType = FactoryTarget.Directive;\n // Build proper input descriptors (same as Component path)\n const dirInputs: Record<string, unknown> = {};\n if (Array.isArray(meta.inputs)) {\n meta.inputs.forEach((i: string) => (dirInputs[i] = i));\n } else if (meta.inputs) {\n Object.assign(dirInputs, meta.inputs);\n }\n Object.assign(dirInputs, fields.inputs);\n for (const [key, val] of Object.entries(sigs.inputs)) {\n const sigDesc = val as {\n bindingPropertyName?: string;\n required?: boolean;\n transform?: o.Expression | null;\n };\n dirInputs[key] = {\n classPropertyName: key,\n // Honor the binding name (alias) extracted by detectSignals.\n bindingPropertyName: sigDesc.bindingPropertyName ?? key,\n isSignal: true,\n required: sigDesc.required || false,\n transformFunction: sigDesc.transform || null,\n };\n }\n const directiveMeta = {\n ...meta,\n // Abstract base directives are declared as `@Directive()` with\n // no metadata. Angular's R3DirectiveMetadata accepts\n // `selector: string | null`, but the downstream selector parser\n // calls `.replace()` on the value and crashes on `undefined`.\n // Coerce missing selectors to `null` so abstract base classes\n // compile correctly.\n selector: meta.selector ?? null,\n name: className,\n type: classRef,\n typeSourceSpan,\n host: hostMetadata,\n inputs: dirInputs,\n outputs: { ...meta.outputs, ...fields.outputs, ...sigs.outputs },\n viewQueries: [...fields.viewQueries, ...sigs.viewQueries],\n queries: [...fields.contentQueries, ...sigs.contentQueries],\n // Angular's compiler treats `providers` as an Expression and\n // emits `ɵɵProvidersFeature(<expr>)` whenever it is truthy.\n // `providersToExpr` lowers an inline array literal to a\n // LiteralArrayExpr (matching the Component branch) and passes a\n // const/spread reference through by value — returning `null`\n // when there are no providers so Angular skips the feature\n // entirely. Passing the bare JS array would otherwise be lowered\n // to `null` and crash Angular at runtime in `resolveProvider`.\n providers: providersToExpr(meta.providers),\n exportAs: meta.exportAs,\n isStandalone: meta.standalone,\n lifecycle: { usesOnChanges: false },\n usesInheritance,\n controlCreate: null,\n };\n if (isPartial) {\n const dir = compileDeclareDirectiveFromMetadata(directiveMeta);\n ivyCode.push(\n `static ɵdir = /*@__PURE__*/ ${emitAngularExpr(dir.expression)}`,\n );\n } else {\n const dir = compileDirectiveFromMetadata(\n directiveMeta,\n constantPool,\n bindingParser!,\n );\n ivyCode.push(\n `static ɵdir = /*@__PURE__*/ ${emitAngularExpr(dir.expression)}`,\n );\n }\n break;\n }\n\n case 'Pipe': {\n targetType = FactoryTarget.Pipe;\n const pipeMeta = {\n ...meta,\n name: className,\n pipeName: meta.name,\n type: classRef,\n isStandalone: meta.standalone,\n pure: meta.pure ?? true,\n };\n if (isPartial) {\n const pipe = compileDeclarePipeFromMetadata(pipeMeta);\n ivyCode.push(\n `static ɵpipe = /*@__PURE__*/ ${emitAngularExpr(pipe.expression)}`,\n );\n } else {\n const pipe = compilePipeFromMetadata(pipeMeta);\n ivyCode.push(\n `static ɵpipe = /*@__PURE__*/ ${emitAngularExpr(pipe.expression)}`,\n );\n }\n break;\n }\n\n case 'Injectable': {\n targetType = FactoryTarget.Injectable;\n const injectableMeta: any = {\n name: className,\n type: classRef,\n typeArgumentCount: 0,\n providedIn: {\n expression: new o.LiteralExpr(meta.providedIn ?? null),\n forwardRef: 0,\n },\n };\n // Forward provider configuration so `ɵprov` honors useFactory/\n // useClass/useExisting/useValue. Without this, an\n // `@Injectable({ useFactory: () => ... })` quietly falls back\n // to constructor instantiation.\n if (meta.useClass) injectableMeta.useClass = meta.useClass;\n if (meta.useFactory) injectableMeta.useFactory = meta.useFactory;\n if (meta.useExisting) injectableMeta.useExisting = meta.useExisting;\n if (meta.useValue) injectableMeta.useValue = meta.useValue;\n // Dependency list for `useFactory` / `useClass`; without it the\n // emitted factory is invoked with no arguments.\n if (meta.deps) injectableMeta.deps = meta.deps;\n if (isPartial) {\n const inj = compileDeclareInjectableFromMetadata(injectableMeta);\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(inj.expression)}`,\n );\n } else {\n const inj = o.compileInjectable(injectableMeta, true);\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(inj.expression)}`,\n );\n }\n break;\n }\n\n case 'Service': {\n // `@Service` (and the `compileService` compiler API) landed in\n // Angular 22. On older peers the decorator does not exist; fail\n // loudly rather than falling through and emitting a default\n // `Injectable`-target factory with no `ɵprov`.\n if (!angularVersionAtLeast(22)) {\n classCompileError = new Error(\n `[fast-compile] @Service on ${className} requires Angular 22 or later`,\n );\n break;\n }\n targetType = (FactoryTarget as any).Service;\n const serviceMeta: any = {\n name: className,\n type: classRef,\n typeArgumentCount: 0,\n };\n if (meta.autoProvided === false) serviceMeta.autoProvided = false;\n if (meta.factory) serviceMeta.factory = meta.factory;\n if (isPartial) {\n const svc = (o as any).compileDeclareServiceFromMetadata(\n serviceMeta,\n );\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(svc.expression)}`,\n );\n } else {\n const svc = (o as any).compileService(serviceMeta, false);\n ivyCode.push(\n `static ɵprov = /*@__PURE__*/ ${emitAngularExpr(svc.expression)}`,\n );\n }\n break;\n }\n\n case 'NgModule': {\n targetType = FactoryTarget.NgModule;\n const ngModuleImports = Array.isArray(meta.imports)\n ? meta.imports\n : [];\n const ngModuleDeclarations = Array.isArray(meta.declarations)\n ? meta.declarations\n : [];\n const ngModuleExports = Array.isArray(meta.exports)\n ? meta.exports\n : [];\n const ngModuleBootstrap = Array.isArray(meta.bootstrap)\n ? meta.bootstrap\n : [];\n\n const ngModuleMeta = {\n kind: R3NgModuleMetadataKind.Global as const,\n type: classRef,\n bootstrap: ngModuleBootstrap.map((e: o.WrappedNodeExpr<any>) => ({\n value: e,\n type: e,\n })),\n declarations: ngModuleDeclarations.map(\n (e: o.WrappedNodeExpr<any>) => ({ value: e, type: e }),\n ),\n publicDeclarationTypes: null,\n imports: ngModuleImports.map((e: o.WrappedNodeExpr<any>) => ({\n value: e,\n type: e,\n })),\n includeImportTypes: true,\n exports: ngModuleExports.map((e: o.WrappedNodeExpr<any>) => ({\n value: e,\n type: e,\n })),\n selectorScopeMode: R3SelectorScopeMode.Inline,\n containsForwardDecls: false,\n schemas: [],\n id: null,\n };\n const injectorMeta = {\n name: className,\n type: classRef,\n providers: providersToExpr(meta.providers),\n imports: ngModuleImports.map((e: o.WrappedNodeExpr<any>) => e),\n };\n if (isPartial) {\n const ngMod = compileDeclareNgModuleFromMetadata(ngModuleMeta);\n ivyCode.push(\n `static ɵmod = /*@__PURE__*/ ${emitAngularExpr(ngMod.expression)}`,\n );\n const injector = compileDeclareInjectorFromMetadata(injectorMeta);\n ivyCode.push(\n `static ɵinj = /*@__PURE__*/ ${emitAngularExpr(injector.expression)}`,\n );\n } else {\n const ngMod = compileNgModule(ngModuleMeta);\n ivyCode.push(\n `static ɵmod = /*@__PURE__*/ ${emitAngularExpr(ngMod.expression)}`,\n );\n const injector = compileInjector(injectorMeta);\n ivyCode.push(\n `static ɵinj = /*@__PURE__*/ ${emitAngularExpr(injector.expression)}`,\n );\n }\n break;\n }\n }\n });\n\n if (classCompileError) {\n throw classCompileError;\n }\n\n // Generate factory\n const deps = extractConstructorDeps(node, sourceCode, typeOnlyImports);\n if (deps === null) {\n const baseVar = `ɵ${className}_BaseFactory`;\n ivyCode.unshift(\n `static ɵfac = /*@__PURE__*/ (() => { let ${baseVar}; return function ${className}_Factory(__ngFactoryType__) { return (${baseVar} || (${baseVar} = i0.ɵɵgetInheritedFactory(${className})))(__ngFactoryType__ || ${className}); }; })()`,\n );\n } else if (deps === 'invalid') {\n ivyCode.unshift(\n `static ɵfac = function ${className}_Factory(__ngFactoryType__) { i0.ɵɵinvalidFactory(); }`,\n );\n } else {\n const factoryMeta = {\n name: className,\n type: classRef,\n typeArgumentCount: 0,\n deps,\n target: targetType,\n };\n if (isPartial) {\n const fac = compileDeclareFactoryFunction(factoryMeta);\n ivyCode.unshift(\n `static ɵfac = /*@__PURE__*/ ${emitAngularExpr(fac.expression)}`,\n );\n } else {\n const fac = compileFactoryFunction(factoryMeta);\n ivyCode.unshift(\n `static ɵfac = /*@__PURE__*/ ${emitAngularExpr(fac.expression)}`,\n );\n }\n }\n\n // Emit setClassMetadata for runtime decorator reflection (devMode only)\n const ctorParameters = buildCtorParameters(\n node,\n sourceCode,\n typeOnlyImports,\n );\n const propDecorators = buildPropDecorators(node, sourceCode, 'i0.');\n const scopedMetadata: o.Statement[] = [];\n angularDecorators.forEach((dec) => {\n const decName = decoratorCallName(dec, sourceCode)!;\n const decArgsNode = dec.expression.arguments[0];\n const textOf = (n: any) => sourceCode.slice(n.start, n.end);\n\n // Build the decorator args for setClassMetadata, inlining resources if needed.\n const resources = resolvedResources.get(dec);\n let metadataArgsExpr: string | null = null;\n if (decArgsNode) {\n if (resources && decArgsNode.type === 'ObjectExpression') {\n // Inline external templateUrl/styleUrl(s) into the metadata so Angular's\n // runtime doesn't try to fetch relative URLs (which fails during SSR).\n const rewrittenProps: string[] = [];\n let needsTransform = false;\n for (const prop of decArgsNode.properties) {\n if (\n prop.type !== 'Property' ||\n prop.shorthand ||\n prop.method ||\n prop.kind !== 'init'\n ) {\n rewrittenProps.push(textOf(prop));\n continue;\n }\n const propName = textOf(prop.key);\n\n if (propName === 'templateUrl' && resources.template) {\n rewrittenProps.push(\n `template: ${JSON.stringify(resources.template)}`,\n );\n needsTransform = true;\n } else if (\n (propName === 'styleUrl' || propName === 'styleUrls') &&\n resources.styles?.length\n ) {\n rewrittenProps.push(\n `styles: [${resources.styles.map((s) => JSON.stringify(s)).join(', ')}]`,\n );\n needsTransform = true;\n } else {\n rewrittenProps.push(textOf(prop));\n }\n }\n metadataArgsExpr = needsTransform\n ? `{${rewrittenProps.join(', ')}}`\n : textOf(decArgsNode);\n } else {\n metadataArgsExpr = textOf(decArgsNode);\n }\n }\n\n try {\n // `LiteralMapPropertyAssignment` was a class with a constructor in\n // Angular up through ~v19, removed-then-restored in later v20/v21\n // patches. The only stable shape across versions is the plain\n // `{ key, value, quoted }` object literal — Angular's own emitter\n // and Analog's `JSEmitter` both consume entries via duck typing\n // (`.key` / `.value` / `.quoted`), and `compileClassMetadata` does\n // not `instanceof`-check entries. The js-emitter has a matching\n // comment at the consumption site. Using `new o.LiteralMapProperty\n // Assignment(...)` would throw \"is not a constructor\" on Angular\n // versions where the class export is missing (e.g. 20.3.x), and\n // the surrounding try/catch would silently disable class metadata\n // emission for every class in the project.\n const classMetaInput = {\n type: new o.WrappedNodeExpr(className),\n decorators: new o.LiteralArrayExpr([\n new o.LiteralMapExpr([\n {\n key: 'type',\n value: new o.WrappedNodeExpr(decName),\n quoted: false,\n },\n ...(metadataArgsExpr\n ? [\n {\n key: 'args',\n value: new o.LiteralArrayExpr([\n new o.WrappedNodeExpr(metadataArgsExpr),\n ]),\n quoted: false,\n },\n ]\n : []),\n ] as unknown as o.LiteralMapPropertyAssignment[]),\n ]),\n ctorParameters: ctorParameters\n ? new o.WrappedNodeExpr(`() => [${ctorParameters}]`)\n : null,\n propDecorators: propDecorators\n ? new o.WrappedNodeExpr(propDecorators)\n : null,\n };\n // A component whose @defer blocks load some dependencies lazily must\n // not reference them eagerly in its metadata either.\n const deferredDeps =\n decName === 'Component'\n ? deferredMetadataDeps.get(className)\n : undefined;\n const classMetadataExpr = isPartial\n ? compileDeclareClassMetadata(classMetaInput)\n : deferredDeps\n ? compileComponentClassMetadata(classMetaInput, deferredDeps)\n : compileClassMetadata(classMetaInput);\n const metadataStmt = new o.ExpressionStatement(classMetadataExpr);\n if (topLevelClasses.has(node)) {\n constantPool.statements.push(metadataStmt);\n } else {\n scopedMetadata.push(metadataStmt);\n }\n } catch (e) {\n // Skip if compileClassMetadata fails — surfaced via DEBUG=analog-fast-compile\n if (debugCompile.enabled) {\n debugCompile(\n 'compileClassMetadata failed for %s in %s: %s',\n className,\n fileName,\n (e as Error)?.message,\n );\n }\n }\n });\n\n // Collect member decorators (@HostListener, @HostBinding, @Input, @Output,\n // @ViewChild, @ContentChild, etc.) so they are removed from the source.\n // The metadata has already been extracted by detectFieldDecorators().\n const memberDecorators: any[] = [];\n for (const member of node.body.body) {\n for (const dec of member.decorators ?? []) {\n if (FIELD_DECORATORS.has(decoratorCallName(dec, sourceCode) ?? '')) {\n memberDecorators.push(dec);\n }\n }\n }\n\n classResults.push({\n ivyCode,\n decorators: [...angularDecorators, ...memberDecorators],\n classEnd: node.end,\n scopedMetadata,\n });\n }\n\n // Apply edits via MagicString\n const ms = new MagicString(sourceCode, { filename: fileName });\n\n // 1. Prepend i0 import (skip if already present)\n if (!sourceCode.includes('import * as i0 from')) {\n ms.prepend('import * as i0 from \"@angular/core\";\\n');\n }\n\n // 1b. Inject synthetic imports for NgModule-exported classes\n for (const [name, specifier] of syntheticImports) {\n const localName = dependencyLocalName(name);\n if (!importedNames.has(localName)) {\n const binding = localName === name ? name : `${name} as ${localName}`;\n ms.prepend(`import { ${binding} } from \"${specifier}\";\\n`);\n importedNames.add(localName);\n }\n }\n\n // 2a. Hoist non-exported variable/function declarations that appear after\n // a class to just before the first class. This avoids TDZ errors when\n // static ɵcmp references file-level constants declared after the class.\n //\n // We must NOT hoist a statement whose initializer references a name\n // (class, exported const/let) that is defined between firstClassPos and\n // the statement itself — doing so would move the reference before the\n // definition and cause a TDZ error at runtime.\n if (classResults.length > 0) {\n // Find the position right before the first class (any class, not just Angular-decorated)\n const statements = (oxcProgram.body as any[]).map(toTopLevelStatement);\n let firstClassPos = Infinity;\n const nonHoistableNames = new Set<string>();\n for (const { decl, start } of statements) {\n if (decl.type === 'ClassDeclaration') {\n firstClassPos = start;\n // The first class itself is non-hoistable — statements hoisted\n // before it must not reference it.\n if (decl.id) {\n nonHoistableNames.add(decl.id.name);\n }\n break;\n }\n }\n\n // Pass 1: collect names defined by statements that will NOT be hoisted\n // (classes, enums, exported vars/functions) and therefore remain after\n // firstClassPos.\n for (const { decl, exported, start } of statements) {\n if (start <= firstClassPos) continue;\n\n if (\n decl.type === 'ClassDeclaration' ||\n decl.type === 'TSEnumDeclaration'\n ) {\n if (decl.id) nonHoistableNames.add(decl.id.name);\n } else if (\n exported &&\n (decl.type === 'VariableDeclaration' ||\n decl.type === 'FunctionDeclaration')\n ) {\n for (const n of getDefinedNames(decl)) {\n nonHoistableNames.add(n);\n }\n }\n }\n\n // Pass 2: for each hoist candidate, check if it references any\n // non-hoistable name. If it does, skip it and add its own names to the\n // non-hoistable set (transitivity).\n for (const { decl, exported, start, end } of statements) {\n if (start <= firstClassPos) continue;\n\n const isCandidate =\n !exported &&\n (decl.type === 'VariableDeclaration' ||\n decl.type === 'FunctionDeclaration');\n if (!isCandidate) continue;\n\n const referencedIds = collectIdentifiers(decl);\n let referencesNonHoistable = false;\n for (const id of referencedIds) {\n if (nonHoistableNames.has(id)) {\n referencesNonHoistable = true;\n break;\n }\n }\n\n if (referencesNonHoistable) {\n // Don't hoist — mark this statement's names as non-hoistable too\n for (const name of getDefinedNames(decl)) {\n nonHoistableNames.add(name);\n }\n } else {\n // Move rather than re-insert so the statement keeps its source map.\n // The separating newline is attached to the moved chunk.\n ms.appendLeft(end, '\\n');\n ms.move(start, end, firstClassPos);\n }\n }\n }\n\n // 2. For each compiled class: remove decorators + insert Ivy definitions\n for (const cr of classResults) {\n // Remove Angular decorators from source\n for (const dec of cr.decorators) {\n const start = dec.start;\n const end = dec.end;\n let trimEnd = end;\n while (\n trimEnd < sourceCode.length &&\n (sourceCode[trimEnd] === ' ' ||\n sourceCode[trimEnd] === '\\n' ||\n sourceCode[trimEnd] === '\\r')\n ) {\n trimEnd++;\n }\n ms.remove(start, trimEnd);\n }\n\n // Insert static members before closing }\n if (cr.ivyCode.length > 0) {\n const memberCode = cr.ivyCode.map((c) => ' ' + c + ';').join('\\n');\n ms.appendLeft(cr.classEnd - 1, '\\n' + memberCode + '\\n');\n }\n\n for (const stmt of cr.scopedMetadata) {\n ms.appendLeft(cr.classEnd, `\\n/*@__PURE__*/ ${emitAngularStmt(stmt)}`);\n }\n }\n\n // 3. Emit constant pool statements.\n // Split into: helper declarations (const/function) that must appear before\n // the class (since static property initializers reference them), and\n // side-effect statements (setClassMetadata IIFEs) that go after.\n const helpers: string[] = [];\n const sideEffects: string[] = [];\n for (const s of constantPool.statements) {\n const code = emitAngularStmt(s);\n if (\n s instanceof o.ExpressionStatement &&\n s.expr instanceof o.InvokeFunctionExpr\n ) {\n // setClassMetadata is wrapped in `(() => { ... })()` — annotate\n // the IIFE call so bundlers can drop it when ngDevMode is folded\n // to false at production build time.\n sideEffects.push(`/*@__PURE__*/ ${code}`);\n } else {\n helpers.push(code);\n }\n }\n\n if (sideEffects.length > 0) {\n ms.append('\\n\\n' + sideEffects.join('\\n'));\n }\n\n // 4. Lower class field initializers to constructor assignments when\n // useDefineForClassFields is false (standard Angular tsconfig).\n // Uses the original OXC AST positions which are still valid for MagicString\n // since MagicString tracks edits relative to the original source.\n // Ivy static definitions (ɵcmp, ɵfac) are not in the original AST so they\n // are unaffected, and shouldLowerField skips static fields regardless.\n if (!useDefineForClassFields) {\n lowerClassFields(ms, sourceCode, oxcProgram);\n }\n\n // 5. Elide imports that are only used in type positions (type annotations,\n // implements, generics, etc.). Without this pass, single-file transpilers\n // like OXC / esbuild cannot tell that `import { SomeType }` is type-only\n // and will leave the import in the output, causing runtime errors.\n // Detection runs once on the final output; helpers are appended for\n // analysis only, since their position does not affect references.\n const helperCode = helpers.join('\\n');\n const willElide = detectTypeOnlyImportNames(\n ms.toString() + '\\n' + helperCode,\n );\n if (helpers.length > 0) {\n // Insert helpers after the last import / top-level non-class statement,\n // well before any class that references them. Skip imports that will be\n // fully removed by type elision (step 5): inserting inside a\n // soon-to-be-removed range would discard the helpers with the import.\n let insertPos = 0;\n for (const stmt of oxcProgram.body as any[]) {\n const { decl } = toTopLevelStatement(stmt);\n if (stmt.type === 'ImportDeclaration') {\n // Skip imports that will be entirely removed by type elision\n if (willElide.size > 0 && stmt.specifiers.length > 0) {\n const allElided = stmt.specifiers.every(\n (spec: any) =>\n spec.type === 'ImportNamespaceSpecifier' ||\n spec.importKind === 'type' ||\n willElide.has(spec.local.name),\n );\n if (allElided) continue;\n }\n insertPos = stmt.end;\n } else if (\n decl.type === 'VariableDeclaration' &&\n !sourceCode.slice(stmt.start, stmt.end).includes('class')\n ) {\n insertPos = stmt.end;\n } else if (\n stmt.type !== 'TSExportAssignment' &&\n !(\n stmt.type === 'ExportDefaultDeclaration' &&\n decl.type !== 'ClassDeclaration' &&\n decl.type !== 'FunctionDeclaration'\n )\n ) {\n // Stop at the first class or non-import/non-variable statement\n break;\n }\n }\n // Helpers must survive downstream `ms.overwrite()` / `ms.remove()` of\n // imports performed by the type-only specifier elision pass (step 5).\n //\n // Case `insertPos > 0`: a surviving import ends at `insertPos`. Use\n // `appendRight(insertPos, …)` so helpers bind to the `\\n` after the\n // import's `;` — outside any overwrite range `[node.start, node.end)`\n // of a preceding import. `appendLeft(insertPos, …)` would bind to the\n // `;` itself, which IS inside the overwrite range and would be wiped.\n //\n // Case `insertPos === 0`: no import survives — every import is going\n // to be elided, and `elideTypeOnlyImportsMagicString` will\n // `ms.remove(0, declEnd)` the first one. `appendRight(0, …)` anchors\n // to the character at position 0 (the first import's first char),\n // which is inside `[0, declEnd)` and gets wiped. Use `appendLeft(0, …)`\n // instead — it anchors to the LEFT of position 0, outside any range\n // starting at 0, so the helpers survive. Ordering is still correct\n // because the i0 import prepended in step 1 lives in MagicString's\n // `intro` (from `ms.prepend`), which always emits before any\n // `appendLeft` content at position 0.\n if (insertPos === 0) {\n ms.appendLeft(0, helperCode + '\\n');\n } else {\n ms.appendRight(insertPos, '\\n' + helperCode + '\\n');\n }\n }\n elideTypeOnlyImportsMagicString(ms, oxcProgram, willElide);\n\n const map = ms.generateMap({\n source: fileName,\n file: fileName + '.js',\n includeContent: true,\n hires: 'boundary',\n });\n\n if (debugCompile.enabled) {\n debugCompile(\n 'compile %s done (%dms, %d classes, %d resource deps)',\n fileName,\n Math.round(performance.now() - startTimeMs),\n classResults.length,\n resourceDependencies.length,\n );\n }\n return {\n code: ms.toString(),\n map,\n resourceDependencies,\n };\n}\n\n/** The local class name an `imports` entry declares, when it is a plain identifier. */\nfunction declarationName(declaration: CompileDeclaration): string | null {\n const node = (declaration.type as { node?: unknown }).node as\n | string\n | { type?: string; name?: string }\n | undefined;\n if (typeof node === 'string') {\n return node;\n }\n if (node?.type === 'Identifier' && typeof node.name === 'string') {\n return node.name;\n }\n return declaration.className ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyIA,SAAS,oBAAoB,MAA8B;CACzD,MAAM,YACH,KAAK,SAAS,4BACb,KAAK,SAAS,+BAChB,KAAK;CACP,MAAM,OAAO,WAAW,KAAK,cAAc;CAC3C,OAAO;EACL;EACA,UAAU,CAAC,CAAC;EACZ,OAAO,KAAK,IAAI,KAAK,OAAO,KAAK,aAAa,EAAE,EAAE,SAAS,KAAK,KAAK;EACrE,KAAK,KAAK;CACZ;AACF;;AAGA,SAAS,kBAAkB,KAAU,YAAwC;CAC3E,MAAM,SAAS,IAAI;CACnB,IAAI,QAAQ,SAAS,kBAAkB,OAAO,KAAA;CAC9C,OAAO,WAAW,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,GAAG;AAChE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O;CACT,CAAC;CAED,IAAI,aAAa,SACf,aACE,wDACA,UACA,KAAK,MAAM,YAAY,IAAI,IAAI,WAAW,GAC1C,aAAa,QACb,qBAAqB,MACvB;CAEF,OAAO;EACL,MAAM,GAAG,SAAS;EAClB;EACA;CACF;AACF;;AAGA,SAAS,gBAAgB,aAAgD;CACvE,MAAM,OAAQ,YAAY,KAA4B;CAItD,IAAI,OAAO,SAAS,UAClB,OAAO;CAET,IAAI,MAAM,SAAS,gBAAgB,OAAO,KAAK,SAAS,UACtD,OAAO,KAAK;CAEd,OAAO,YAAY,aAAa;AAClC"}
|
|
@@ -138,7 +138,7 @@ function buildDeferDependencyMap(parsedTemplate, program, registry, localSelecto
|
|
|
138
138
|
const mVar = ast.variable("m");
|
|
139
139
|
const innerFn = ast.arrowFn([new ast.FnParam("m", ast.DYNAMIC_TYPE)], new o.ReadPropExpr(mVar, symbolName));
|
|
140
140
|
const importExpr = new o.InvokeFunctionExpr(new o.ReadPropExpr(new o.DynamicImportExpr(new o.LiteralExpr(info.path)), "then"), [innerFn]);
|
|
141
|
-
blockDeps.push(
|
|
141
|
+
blockDeps.push(importExpr);
|
|
142
142
|
}
|
|
143
143
|
if (blockDeps.length > 0) blocks.set(block, new o.ArrowFunctionExpr([], new o.LiteralArrayExpr(blockDeps)));
|
|
144
144
|
else blocks.set(block, null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defer.js","names":[],"sources":["../../../../src/lib/compiler/defer.ts"],"sourcesContent":["import * as o from '@angular/compiler';\nimport { ComponentRegistry } from './registry.js';\n\n/** Recursively collect all DeferredBlock nodes from a template AST. */\nexport function collectDeferBlocks(nodes: any[]): any[] {\n const result: any[] = [];\n function walk(node: any) {\n if (!node) return;\n if (node.constructor?.name === 'DeferredBlock') {\n result.push(node);\n }\n // Walk all possible child structures across block types:\n // Element/Template: children\n // IfBlock: branches (each has children)\n // ForLoopBlock: children, empty (has children)\n // SwitchBlock: groups (Angular v21+, each is a SwitchBlockCaseGroup with\n // children) or cases (Angular v18-v20, each has children)\n // DeferredBlock: children, placeholder/loading/error (each has children)\n if (Array.isArray(node.children)) node.children.forEach(walk);\n if (Array.isArray(node.branches)) node.branches.forEach(walk);\n if (Array.isArray(node.errorBlocks)) node.errorBlocks.forEach(walk);\n if (Array.isArray(node.groups)) node.groups.forEach(walk);\n if (Array.isArray(node.cases)) node.cases.forEach(walk);\n if (node.empty?.children) node.empty.children.forEach(walk);\n if (node.placeholder?.children) node.placeholder.children.forEach(walk);\n if (node.loading?.children) node.loading.children.forEach(walk);\n if (node.error?.children) node.error.children.forEach(walk);\n }\n nodes.forEach(walk);\n return result;\n}\n\n/**\n * Collect element tag names from template AST nodes recursively.\n *\n * When `excludeDeferBlocks` is true, the deferred body of any DeferredBlock is\n * skipped — its children are treated as deferred, not eager. The fallback\n * subtrees (`@placeholder`, `@loading`, `@error`) are still walked: Angular\n * treats them as *eager* dependencies because the placeholder must render in\n * the main bundle before the defer trigger fires. A component shared between\n * the defer body and a fallback block must stay in static imports, otherwise\n * the fallback render breaks.\n */\nexport function collectElementNames(\n nodes: any[],\n excludeDeferBlocks = false,\n): Set<string> {\n const result = new Set<string>();\n function walk(node: any) {\n if (!node) return;\n if (excludeDeferBlocks && node.constructor?.name === 'DeferredBlock') {\n // Skip the deferred body but keep walking the fallback subtrees so\n // components referenced in `@placeholder` / `@loading` / `@error`\n // stay in the eager set.\n if (node.placeholder?.children) node.placeholder.children.forEach(walk);\n if (node.loading?.children) node.loading.children.forEach(walk);\n if (node.error?.children) node.error.children.forEach(walk);\n return;\n }\n if (node.constructor?.name === 'Element') result.add(node.name);\n if (Array.isArray(node.children)) node.children.forEach(walk);\n if (Array.isArray(node.branches)) node.branches.forEach(walk);\n if (Array.isArray(node.errorBlocks)) node.errorBlocks.forEach(walk);\n if (Array.isArray(node.groups)) node.groups.forEach(walk);\n if (Array.isArray(node.cases)) node.cases.forEach(walk);\n if (node.empty?.children) node.empty.children.forEach(walk);\n if (node.placeholder?.children) node.placeholder.children.forEach(walk);\n if (node.loading?.children) node.loading.children.forEach(walk);\n if (node.error?.children) node.error.children.forEach(walk);\n }\n nodes.forEach(walk);\n return result;\n}\n\n/** Information about how a class is imported. */\nexport interface ImportInfo {\n /** Module path from the import statement. */\n path: string;\n /** Whether the class was imported as a default import (`import X from`). */\n isDefault: boolean;\n /**\n * Original exported name on the source module's namespace. For\n * `import { HeavyWidget as Widget } from './heavy'`, the local\n * binding is `Widget` but the namespace exposes `HeavyWidget` —\n * `await import('./heavy')` returns `{ HeavyWidget }`, not\n * `{ Widget }`. Defer dependency emit must use the exported name,\n * not the local alias, or the lookup resolves to `undefined` at\n * runtime.\n */\n exportName: string;\n}\n\n/**\n * Build import info map: localName → { path, isDefault, exportName }\n * from source file imports. Tracks default vs named imports plus the\n * original exported name so the defer dependency generator can emit\n * `import('./p').then(m => m.default)` for default imports and\n * `import('./p').then(m => m.OriginalExportName)` for aliased named\n * imports.\n */\nexport function buildImportMap(program: any): Map<string, ImportInfo> {\n const result = new Map<string, ImportInfo>();\n for (const stmt of program.body) {\n if (stmt.type !== 'ImportDeclaration') continue;\n const path: string = stmt.source.value;\n for (const spec of stmt.specifiers) {\n if (spec.type === 'ImportDefaultSpecifier') {\n result.set(spec.local.name, {\n path,\n isDefault: true,\n exportName: 'default',\n });\n } else if (spec.type === 'ImportSpecifier') {\n // `import { Foo as Bar }` → imported is `Foo`, local is `Bar`.\n const exportName: string = spec.imported.name ?? spec.imported.value;\n const info: ImportInfo = { path, isDefault: false, exportName };\n // Key the map by BOTH the local binding and the original export\n // name. The defer-dep lookup uses the className from the\n // registry — which is always the original class name from the\n // source file (`HeavyWidget`), not the consumer's local alias\n // (`Widget`). Without the export-name key, aliased imports\n // would silently produce no defer dependency at all.\n result.set(spec.local.name, info);\n if (exportName !== spec.local.name) {\n result.set(exportName, info);\n }\n }\n }\n }\n return result;\n}\n\n/**\n * Build defer block dependency map with dynamic import() expressions.\n *\n * For each defer block, identifies which imported components are only used\n * inside defer blocks (not in the eager template), and generates dynamic\n * import expressions for lazy loading.\n *\n * Returns:\n * - blocks: Map<DeferredBlock, Expression | null> for compileComponentFromMetadata\n * - deferredImports: Set<string> of class names that should be removed from static imports\n */\nexport function buildDeferDependencyMap(\n parsedTemplate: any,\n program: any,\n registry: ComponentRegistry | undefined,\n localSelectors: Map<string, string>,\n): { blocks: Map<any, any>; deferredImports: Set<string> } {\n const deferBlocks = collectDeferBlocks(parsedTemplate.nodes);\n if (deferBlocks.length === 0) {\n return { blocks: new Map(), deferredImports: new Set() };\n }\n\n const deferElements = new Set<string>();\n for (const block of deferBlocks) {\n const elements = collectElementNames(block.children || []);\n for (const el of elements) deferElements.add(el);\n }\n // Eager elements = elements reachable without crossing into a DeferredBlock.\n // Pass `excludeDeferBlocks` so a defer block nested inside @switch / @if /\n // @for is not unfolded into the eager set. Without this, a component used\n // only inside such a nested defer would be misclassified as eager and lose\n // its lazy-load dependency function.\n const eagerElements = collectElementNames(parsedTemplate.nodes, true);\n\n // Build selector → className map from registry + local selectors\n const selectorToClass = new Map<string, string>();\n if (registry) {\n for (const [className, entry] of registry) {\n if (entry.selector) selectorToClass.set(entry.selector, className);\n }\n }\n for (const [className, selector] of localSelectors) {\n selectorToClass.set(selector, className);\n }\n\n // Build className → importPath map\n const importMap = buildImportMap(program);\n\n // Find defer-only component class names\n const deferredImports = new Set<string>();\n const deferOnlyElements = new Set<string>();\n for (const el of deferElements) {\n if (!eagerElements.has(el)) deferOnlyElements.add(el);\n }\n\n for (const el of deferOnlyElements) {\n const className = selectorToClass.get(el);\n if (className && importMap.has(className)) {\n deferredImports.add(className);\n }\n }\n\n // Build the blocks map with dependency functions\n const blocks = new Map<any, any>();\n for (const block of deferBlocks) {\n const blockElements = collectElementNames(block.children || []);\n const blockDeps: any[] = [];\n // Within a single block, dedupe by `${path}#${symbolName}` so two\n // refs to the same component don't generate two import expressions.\n const seenInBlock = new Set<string>();\n\n for (const el of blockElements) {\n const className = selectorToClass.get(el);\n if (!className || !deferredImports.has(className)) continue;\n const info = importMap.get(className)!;\n // Use the original exported name (tracked by buildImportMap) so\n // aliased imports like `import { HeavyWidget as Widget }` resolve\n // to `m.HeavyWidget` instead of `m.Widget` (which would be\n // `undefined` on the module namespace).\n const symbolName = info.exportName;\n const key = `${info.path}#${symbolName}`;\n if (seenInBlock.has(key)) continue;\n seenInBlock.add(key);\n // import('./path').then(m => m.ClassName) — or `m.default` for\n // default imports. Without the `.then(...)` resolver Angular's\n // runtime gets a module namespace and can't find the class.\n // `FnParam` and the `variable()` helper aren't on the top-level\n // namespace; they live in the `outputAst` sub-namespace.\n const ast: any = (o as any).outputAst;\n const mVar = ast.variable('m');\n const innerFn = ast.arrowFn(\n [new ast.FnParam('m', ast.DYNAMIC_TYPE)],\n new o.ReadPropExpr(mVar, symbolName),\n );\n const importExpr = new o.InvokeFunctionExpr(\n new o.ReadPropExpr(\n new o.DynamicImportExpr(new o.LiteralExpr(info.path)),\n 'then',\n ),\n [innerFn],\n );\n blockDeps.push(new o.ArrowFunctionExpr([], importExpr));\n }\n\n if (blockDeps.length > 0) {\n // () => [import('./a').then(m => m.A), import('./b').then(m => m.default)]\n blocks.set(\n block,\n new o.ArrowFunctionExpr([], new o.LiteralArrayExpr(blockDeps)),\n );\n } else {\n blocks.set(block, null);\n }\n }\n\n return { blocks, deferredImports };\n}\n"],"mappings":";;;AAIA,SAAgB,mBAAmB,OAAqB;CACtD,MAAM,SAAgB,CAAC;CACvB,SAAS,KAAK,MAAW;EACvB,IAAI,CAAC,MAAM;EACX,IAAI,KAAK,aAAa,SAAS,iBAC7B,OAAO,KAAK,IAAI;EASlB,IAAI,MAAM,QAAQ,KAAK,QAAQ,GAAG,KAAK,SAAS,QAAQ,IAAI;EAC5D,IAAI,MAAM,QAAQ,KAAK,QAAQ,GAAG,KAAK,SAAS,QAAQ,IAAI;EAC5D,IAAI,MAAM,QAAQ,KAAK,WAAW,GAAG,KAAK,YAAY,QAAQ,IAAI;EAClE,IAAI,MAAM,QA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AE,mBACvB,IAAI,EAAE,aACJ,IAAI,EAAE,kBAAkB,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC,GACpD,MACF,GACA,CAAC,OAAO,CACV;GACA,UAAU,KAAK,IAAI,EAAE,kBAAkB,CAAC,GAAG,UAAU,CAAC;EACxD;EAEA,IAAI,UAAU,SAAS,GAErB,OAAO,IACL,OACA,IAAI,EAAE,kBAAkB,CAAC,GAAG,IAAI,EAAE,iBAAiB,SAAS,CAAC,CAC/D;OAEA,OAAO,IAAI,OAAO,IAAI;CAE1B;CAEA,OAAO;EAAE;EAAQ;CAAgB;AACnC"}
|
|
1
|
+
{"version":3,"file":"defer.js","names":[],"sources":["../../../../src/lib/compiler/defer.ts"],"sourcesContent":["import * as o from '@angular/compiler';\nimport { ComponentRegistry } from './registry.js';\n\n/** Recursively collect all DeferredBlock nodes from a template AST. */\nexport function collectDeferBlocks(nodes: any[]): any[] {\n const result: any[] = [];\n function walk(node: any) {\n if (!node) return;\n if (node.constructor?.name === 'DeferredBlock') {\n result.push(node);\n }\n // Walk all possible child structures across block types:\n // Element/Template: children\n // IfBlock: branches (each has children)\n // ForLoopBlock: children, empty (has children)\n // SwitchBlock: groups (Angular v21+, each is a SwitchBlockCaseGroup with\n // children) or cases (Angular v18-v20, each has children)\n // DeferredBlock: children, placeholder/loading/error (each has children)\n if (Array.isArray(node.children)) node.children.forEach(walk);\n if (Array.isArray(node.branches)) node.branches.forEach(walk);\n if (Array.isArray(node.errorBlocks)) node.errorBlocks.forEach(walk);\n if (Array.isArray(node.groups)) node.groups.forEach(walk);\n if (Array.isArray(node.cases)) node.cases.forEach(walk);\n if (node.empty?.children) node.empty.children.forEach(walk);\n if (node.placeholder?.children) node.placeholder.children.forEach(walk);\n if (node.loading?.children) node.loading.children.forEach(walk);\n if (node.error?.children) node.error.children.forEach(walk);\n }\n nodes.forEach(walk);\n return result;\n}\n\n/**\n * Collect element tag names from template AST nodes recursively.\n *\n * When `excludeDeferBlocks` is true, the deferred body of any DeferredBlock is\n * skipped — its children are treated as deferred, not eager. The fallback\n * subtrees (`@placeholder`, `@loading`, `@error`) are still walked: Angular\n * treats them as *eager* dependencies because the placeholder must render in\n * the main bundle before the defer trigger fires. A component shared between\n * the defer body and a fallback block must stay in static imports, otherwise\n * the fallback render breaks.\n */\nexport function collectElementNames(\n nodes: any[],\n excludeDeferBlocks = false,\n): Set<string> {\n const result = new Set<string>();\n function walk(node: any) {\n if (!node) return;\n if (excludeDeferBlocks && node.constructor?.name === 'DeferredBlock') {\n // Skip the deferred body but keep walking the fallback subtrees so\n // components referenced in `@placeholder` / `@loading` / `@error`\n // stay in the eager set.\n if (node.placeholder?.children) node.placeholder.children.forEach(walk);\n if (node.loading?.children) node.loading.children.forEach(walk);\n if (node.error?.children) node.error.children.forEach(walk);\n return;\n }\n if (node.constructor?.name === 'Element') result.add(node.name);\n if (Array.isArray(node.children)) node.children.forEach(walk);\n if (Array.isArray(node.branches)) node.branches.forEach(walk);\n if (Array.isArray(node.errorBlocks)) node.errorBlocks.forEach(walk);\n if (Array.isArray(node.groups)) node.groups.forEach(walk);\n if (Array.isArray(node.cases)) node.cases.forEach(walk);\n if (node.empty?.children) node.empty.children.forEach(walk);\n if (node.placeholder?.children) node.placeholder.children.forEach(walk);\n if (node.loading?.children) node.loading.children.forEach(walk);\n if (node.error?.children) node.error.children.forEach(walk);\n }\n nodes.forEach(walk);\n return result;\n}\n\n/** Information about how a class is imported. */\nexport interface ImportInfo {\n /** Module path from the import statement. */\n path: string;\n /** Whether the class was imported as a default import (`import X from`). */\n isDefault: boolean;\n /**\n * Original exported name on the source module's namespace. For\n * `import { HeavyWidget as Widget } from './heavy'`, the local\n * binding is `Widget` but the namespace exposes `HeavyWidget` —\n * `await import('./heavy')` returns `{ HeavyWidget }`, not\n * `{ Widget }`. Defer dependency emit must use the exported name,\n * not the local alias, or the lookup resolves to `undefined` at\n * runtime.\n */\n exportName: string;\n}\n\n/**\n * Build import info map: localName → { path, isDefault, exportName }\n * from source file imports. Tracks default vs named imports plus the\n * original exported name so the defer dependency generator can emit\n * `import('./p').then(m => m.default)` for default imports and\n * `import('./p').then(m => m.OriginalExportName)` for aliased named\n * imports.\n */\nexport function buildImportMap(program: any): Map<string, ImportInfo> {\n const result = new Map<string, ImportInfo>();\n for (const stmt of program.body) {\n if (stmt.type !== 'ImportDeclaration') continue;\n const path: string = stmt.source.value;\n for (const spec of stmt.specifiers) {\n if (spec.type === 'ImportDefaultSpecifier') {\n result.set(spec.local.name, {\n path,\n isDefault: true,\n exportName: 'default',\n });\n } else if (spec.type === 'ImportSpecifier') {\n // `import { Foo as Bar }` → imported is `Foo`, local is `Bar`.\n const exportName: string = spec.imported.name ?? spec.imported.value;\n const info: ImportInfo = { path, isDefault: false, exportName };\n // Key the map by BOTH the local binding and the original export\n // name. The defer-dep lookup uses the className from the\n // registry — which is always the original class name from the\n // source file (`HeavyWidget`), not the consumer's local alias\n // (`Widget`). Without the export-name key, aliased imports\n // would silently produce no defer dependency at all.\n result.set(spec.local.name, info);\n if (exportName !== spec.local.name) {\n result.set(exportName, info);\n }\n }\n }\n }\n return result;\n}\n\n/**\n * Build defer block dependency map with dynamic import() expressions.\n *\n * For each defer block, identifies which imported components are only used\n * inside defer blocks (not in the eager template), and generates dynamic\n * import expressions for lazy loading.\n *\n * Returns:\n * - blocks: Map<DeferredBlock, Expression | null> for compileComponentFromMetadata\n * - deferredImports: Set<string> of class names that should be removed from static imports\n */\nexport function buildDeferDependencyMap(\n parsedTemplate: any,\n program: any,\n registry: ComponentRegistry | undefined,\n localSelectors: Map<string, string>,\n): { blocks: Map<any, any>; deferredImports: Set<string> } {\n const deferBlocks = collectDeferBlocks(parsedTemplate.nodes);\n if (deferBlocks.length === 0) {\n return { blocks: new Map(), deferredImports: new Set() };\n }\n\n const deferElements = new Set<string>();\n for (const block of deferBlocks) {\n const elements = collectElementNames(block.children || []);\n for (const el of elements) deferElements.add(el);\n }\n // Eager elements = elements reachable without crossing into a DeferredBlock.\n // Pass `excludeDeferBlocks` so a defer block nested inside @switch / @if /\n // @for is not unfolded into the eager set. Without this, a component used\n // only inside such a nested defer would be misclassified as eager and lose\n // its lazy-load dependency function.\n const eagerElements = collectElementNames(parsedTemplate.nodes, true);\n\n // Build selector → className map from registry + local selectors\n const selectorToClass = new Map<string, string>();\n if (registry) {\n for (const [className, entry] of registry) {\n if (entry.selector) selectorToClass.set(entry.selector, className);\n }\n }\n for (const [className, selector] of localSelectors) {\n selectorToClass.set(selector, className);\n }\n\n // Build className → importPath map\n const importMap = buildImportMap(program);\n\n // Find defer-only component class names\n const deferredImports = new Set<string>();\n const deferOnlyElements = new Set<string>();\n for (const el of deferElements) {\n if (!eagerElements.has(el)) deferOnlyElements.add(el);\n }\n\n for (const el of deferOnlyElements) {\n const className = selectorToClass.get(el);\n if (className && importMap.has(className)) {\n deferredImports.add(className);\n }\n }\n\n // Build the blocks map with dependency functions\n const blocks = new Map<any, any>();\n for (const block of deferBlocks) {\n const blockElements = collectElementNames(block.children || []);\n const blockDeps: any[] = [];\n // Within a single block, dedupe by `${path}#${symbolName}` so two\n // refs to the same component don't generate two import expressions.\n const seenInBlock = new Set<string>();\n\n for (const el of blockElements) {\n const className = selectorToClass.get(el);\n if (!className || !deferredImports.has(className)) continue;\n const info = importMap.get(className)!;\n // Use the original exported name (tracked by buildImportMap) so\n // aliased imports like `import { HeavyWidget as Widget }` resolve\n // to `m.HeavyWidget` instead of `m.Widget` (which would be\n // `undefined` on the module namespace).\n const symbolName = info.exportName;\n const key = `${info.path}#${symbolName}`;\n if (seenInBlock.has(key)) continue;\n seenInBlock.add(key);\n // import('./path').then(m => m.ClassName) — or `m.default` for\n // default imports. Without the `.then(...)` resolver Angular's\n // runtime gets a module namespace and can't find the class.\n // `FnParam` and the `variable()` helper aren't on the top-level\n // namespace; they live in the `outputAst` sub-namespace.\n const ast: any = (o as any).outputAst;\n const mVar = ast.variable('m');\n const innerFn = ast.arrowFn(\n [new ast.FnParam('m', ast.DYNAMIC_TYPE)],\n new o.ReadPropExpr(mVar, symbolName),\n );\n const importExpr = new o.InvokeFunctionExpr(\n new o.ReadPropExpr(\n new o.DynamicImportExpr(new o.LiteralExpr(info.path)),\n 'then',\n ),\n [innerFn],\n );\n // Angular's dependency resolver returns the import promises themselves.\n // A function in the array would be taken for an already-loaded class.\n blockDeps.push(importExpr);\n }\n\n if (blockDeps.length > 0) {\n // () => [import('./a').then(m => m.A), import('./b').then(m => m.default)]\n blocks.set(\n block,\n new o.ArrowFunctionExpr([], new o.LiteralArrayExpr(blockDeps)),\n );\n } else {\n blocks.set(block, null);\n }\n }\n\n return { blocks, deferredImports };\n}\n"],"mappings":";;;AAIA,SAAgB,mBAAmB,OAAqB;CACtD,MAAM,SAAgB,CAAC;CACvB,SAAS,KAAK,MAAW;EACvB,IAAI,CAAC,MAAM;EACX,IAAI,KAAK,aAAa,SAAS,iBAC7B,OAAO,KAAK,IAAI;EASlB,IAAI,MAAM,QAAQ,KAAK,QAAQ,GAAG,KAAK,SAAS,QAAQ,IAAI;EAC5D,IAAI,MAAM,QAAQ,KAAK,QAAQ,GAAG,KAAK,SAAS,QAAQ,IAAI;EAC5D,IAAI,MAAM,QAAQ,KAAK,WAAW,GAAG,KAAK,YAAY,QAAQ,IAAI;EAClE,IAAI,MAAM,QAAQ,KAAK,MAAM,GAAG,KAAK,OAAO,QAAQ,IAAI;EACxD,IAAI,MAAM,QAAQ,KAAK,KAAK,GAAG,KAAK,MAAM,QAAQ,IAAI;EACtD,IAAI,KAAK,OAAO,UAAU,KAAK,MAAM,SAAS,QAAQ,IAAI;EAC1D,IAAI,KAAK,aAAa,UAAU,KAAK,YAAY,SAAS,QAAQ,IAAI;EACtE,IAAI,KAAK,SAAS,UAAU,KAAK,QAAQ,SAAS,QAAQ,IAAI;EAC9D,IAAI,KAAK,OAAO,UAAU,KAAK,MAAM,SAAS,QAAQ,IAAI;CAC5D;CACA,MAAM,QAAQ,IAAI;CAClB,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB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