@analogjs/vite-plugin-angular 3.0.0-beta.4 → 3.0.0-beta.6

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.
@@ -6,6 +6,7 @@ import { emitAngularExpr, emitAngularStmt, setEmitterSourceCode, setEmitterSourc
6
6
  import { lowerClassFields } from "./class-field-lowering.js";
7
7
  import { collectStringConstants, detectFieldDecorators, detectSignals, extractConstructorDeps, extractMetadata } from "./metadata.js";
8
8
  import { buildDeferDependencyMap } from "./defer.js";
9
+ import { buildCtorParameters, buildPropDecorators } from "./jit-metadata.js";
9
10
  import { debugCompile } from "./debug.js";
10
11
  import * as fs from "node:fs";
11
12
  import * as path$1 from "node:path";
@@ -640,6 +641,8 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
640
641
  ivyCode.unshift(`static ɵfac = /*@__PURE__*/ ${emitAngularExpr(fac.expression)}`);
641
642
  }
642
643
  }
644
+ const ctorParameters = oxcNode ? buildCtorParameters(oxcNode, sourceCode, typeOnlyImports) : null;
645
+ const propDecorators = oxcNode ? buildPropDecorators(oxcNode, sourceCode, "i0.") : null;
643
646
  angularDecorators.forEach((dec) => {
644
647
  const call = dec.expression;
645
648
  const decName = call.expression.getText(origSourceFile);
@@ -679,8 +682,8 @@ function compile(sourceCode, fileName, optionsOrRegistry) {
679
682
  value: new o.LiteralArrayExpr([new o.WrappedNodeExpr(metadataArgsExpr)]),
680
683
  quoted: false
681
684
  }] : []])]),
682
- ctorParameters: null,
683
- propDecorators: null
685
+ ctorParameters: ctorParameters ? new o.WrappedNodeExpr(`() => [${ctorParameters}]`) : null,
686
+ propDecorators: propDecorators ? new o.WrappedNodeExpr(propDecorators) : null
684
687
  };
685
688
  const classMetadataExpr = isPartial ? compileDeclareClassMetadata(classMetaInput) : compileClassMetadata(classMetaInput);
686
689
  constantPool.statements.push(new o.ExpressionStatement(classMetadataExpr));
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","names":[],"sources":["../../../../src/lib/compiler/compile.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as o from '@angular/compiler';\nimport MagicString from 'magic-string';\nimport { parseSync } from 'oxc-parser';\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 { findAllClasses, resolveSyntheticImportSpecifier } 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 setEmitterSourceFile,\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 { debugCompile, debugEmit } from './debug.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\nfunction hasExportModifier(node: ts.Node): boolean {\n return (\n ts.canHaveModifiers(node) &&\n ts\n .getModifiers(node)\n ?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) === true\n );\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\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 */\nfunction collectIdentifiers(node: ts.Node): Set<string> {\n const ids = new Set<string>();\n function walk(n: ts.Node) {\n if (ts.isIdentifier(n)) {\n ids.add(n.text);\n }\n // Stop recursing into lazily-evaluated scopes\n if (ts.isFunctionLike(n) || ts.isClassLike(n)) {\n return;\n }\n ts.forEachChild(n, walk);\n }\n ts.forEachChild(node, walk);\n return ids;\n}\n\n/** Extract the names defined by a top-level statement. */\nfunction getDefinedNames(stmt: ts.Statement): string[] {\n if (ts.isVariableStatement(stmt)) {\n const names: string[] = [];\n for (const decl of stmt.declarationList.declarations) {\n collectBindingNames(decl.name, names);\n }\n return names;\n }\n if (ts.isFunctionDeclaration(stmt) && stmt.name) {\n return [stmt.name.text];\n }\n if (ts.isClassDeclaration(stmt) && stmt.name) {\n return [stmt.name.text];\n }\n return [];\n}\n\n/** Recursively collect all bound identifiers from a binding name/pattern. */\nfunction collectBindingNames(name: ts.BindingName, out: string[]): void {\n if (ts.isIdentifier(name)) {\n out.push(name.text);\n } else if (\n ts.isObjectBindingPattern(name) ||\n ts.isArrayBindingPattern(name)\n ) {\n for (const el of name.elements) {\n if (!ts.isOmittedExpression(el)) {\n collectBindingNames(el.name, out);\n }\n }\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 origSourceFile = ts.createSourceFile(\n fileName,\n sourceCode,\n ts.ScriptTarget.Latest,\n false,\n );\n // OXC parse for metadata extraction (faster than TS for decorator/signal analysis)\n const oxcProgram = opts.oxcProgram ?? parseSync(fileName, sourceCode).program;\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\n for (const stmt of origSourceFile.statements) {\n if (\n !ts.isImportDeclaration(stmt) ||\n !stmt.importClause?.namedBindings ||\n !ts.isNamedImports(stmt.importClause.namedBindings)\n ) {\n continue;\n }\n\n const moduleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n // Explicit `import type { X }` — declaration-level type-only import\n const isDeclarationTypeOnly = stmt.importClause.isTypeOnly;\n for (const element of stmt.importClause.namedBindings.elements) {\n const localName = element.name.text;\n importedNames.add(localName);\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.isTypeOnly) {\n typeOnlyImports.add(localName);\n }\n }\n }\n\n // Inject 'import * as i0 from \"@angular/core\"'\n const sourceFile = injectAngularImport(origSourceFile);\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 setEmitterSourceFile(origSourceFile);\n setEmitterSourceCode(sourceCode);\n\n // --- Direct walk: compile each Angular-decorated class and collect string outputs ---\n // This replaces the previous ts.transform + printer.printNode approach.\n // By emitting strings directly from the Angular output AST, we skip both\n // ts.factory node creation and ts.Printer serialization (~4x faster).\n interface ClassCompileResult {\n ivyCode: string[]; // \"static ɵfac = ...\", \"static ɵcmp = ...\", etc.\n decorators: ts.Decorator[]; // Angular decorators to remove\n classEnd: number; // Position of closing } in original source\n }\n const classResults: ClassCompileResult[] = [];\n // Track synthetic imports needed for NgModule export expansion.\n // Maps exported class name → import specifier.\n const syntheticImports = new Map<string, string>();\n\n // ANGULAR_DECORATORS imported from utils\n\n for (const node of findAllClasses(origSourceFile)) {\n const decorators = ts.getDecorators(node);\n if (!decorators || decorators.length === 0) continue;\n\n const className = node.name?.text;\n if (!className) continue;\n\n const angularDecorators = decorators.filter((dec) => {\n if (!ts.isCallExpression(dec.expression)) return false;\n const name = dec.expression.expression.getText(origSourceFile);\n return ANGULAR_DECORATORS.has(name);\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 ts.Decorator,\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 extendsClause = node.heritageClauses?.find(\n (h) => h.token === ts.SyntaxKind.ExtendsKeyword,\n );\n const usesInheritance = !!extendsClause && extendsClause.types.length > 0;\n\n // Look up the corresponding OXC class node for metadata extraction\n const oxcNode = oxcClassMap.get(className);\n\n let classCompileError: Error | null = null;\n\n angularDecorators.forEach((dec) => {\n const decoratorName = (\n dec.expression as ts.CallExpression\n ).expression.getText(origSourceFile);\n // Find the matching OXC decorator by name\n const oxcDec = oxcNode?.decorators?.find((d: any) => {\n const expr = d.expression;\n return (\n expr?.type === 'CallExpression' && expr.callee?.name === decoratorName\n );\n });\n const meta = extractMetadata(oxcDec, sourceCode, stringConsts);\n const sigs = oxcNode\n ? detectSignals(oxcNode, sourceCode)\n : { inputs: {}, outputs: {}, viewQueries: [], contentQueries: [] };\n const fields = oxcNode\n ? detectFieldDecorators(oxcNode, sourceCode)\n : {\n inputs: {},\n outputs: {},\n viewQueries: [],\n contentQueries: [],\n hostProperties: {},\n hostListeners: {},\n };\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(memberName);\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(exportedName);\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(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 if (resolvedInlineStyles) {\n for (const [idx, css] of resolvedInlineStyles) {\n if (idx < meta.styles.length) {\n meta.styles[idx] = css;\n }\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 sourceFile,\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 = oxcNode\n ? extractConstructorDeps(oxcNode, sourceCode, typeOnlyImports)\n : [];\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 angularDecorators.forEach((dec) => {\n const call = dec.expression as ts.CallExpression;\n const decName = call.expression.getText(origSourceFile);\n const decArgsNode = call.arguments[0];\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 && ts.isObjectLiteralExpression(decArgsNode)) {\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 as ts.ObjectLiteralExpression)\n .properties) {\n if (!ts.isPropertyAssignment(prop)) {\n rewrittenProps.push(prop.getText(origSourceFile));\n continue;\n }\n const propName = prop.name?.getText(origSourceFile);\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(prop.getText(origSourceFile));\n }\n }\n metadataArgsExpr = needsTransform\n ? `{${rewrittenProps.join(', ')}}`\n : decArgsNode.getText(origSourceFile);\n } else {\n metadataArgsExpr = decArgsNode.getText(origSourceFile);\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(ts.factory.createIdentifier(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: null,\n propDecorators: null,\n };\n const classMetadataExpr = isPartial\n ? compileDeclareClassMetadata(classMetaInput)\n : compileClassMetadata(classMetaInput);\n constantPool.statements.push(\n new o.ExpressionStatement(classMetadataExpr),\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: ts.Decorator[] = [];\n for (const member of node.members) {\n const mDecorators = ts.getDecorators(member as any);\n if (!mDecorators) continue;\n for (const dec of mDecorators) {\n if (!ts.isCallExpression(dec.expression)) continue;\n const decName = dec.expression.expression.getText(origSourceFile);\n if (FIELD_DECORATORS.has(decName)) {\n memberDecorators.push(dec);\n }\n }\n }\n\n classResults.push({\n ivyCode,\n decorators: [...angularDecorators, ...memberDecorators],\n classEnd: node.getEnd(),\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 if (!importedNames.has(name)) {\n ms.prepend(`import { ${name} } from \"${specifier}\";\\n`);\n importedNames.add(name);\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 let firstClassPos = Infinity;\n const nonHoistableNames = new Set<string>();\n for (const stmt of origSourceFile.statements) {\n if (ts.isClassDeclaration(stmt)) {\n firstClassPos = stmt.getStart(origSourceFile);\n // The first class itself is non-hoistable — statements hoisted\n // before it must not reference it.\n if (stmt.name) {\n nonHoistableNames.add(stmt.name.text);\n }\n break;\n }\n }\n\n // Pass 1: collect names defined by statements that will NOT be hoisted\n // (classes, exported vars/functions) and therefore remain after firstClassPos.\n for (const stmt of origSourceFile.statements) {\n const stmtStart = stmt.getStart(origSourceFile);\n if (stmtStart <= firstClassPos) continue;\n\n if (ts.isClassDeclaration(stmt) && stmt.name) {\n nonHoistableNames.add(stmt.name.text);\n }\n if (ts.isEnumDeclaration(stmt)) {\n nonHoistableNames.add(stmt.name.text);\n }\n if (ts.isVariableStatement(stmt) && hasExportModifier(stmt)) {\n for (const decl of stmt.declarationList.declarations) {\n const names: string[] = [];\n collectBindingNames(decl.name, names);\n for (const n of names) {\n nonHoistableNames.add(n);\n }\n }\n }\n if (\n ts.isFunctionDeclaration(stmt) &&\n hasExportModifier(stmt) &&\n stmt.name\n ) {\n nonHoistableNames.add(stmt.name.text);\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 stmt of origSourceFile.statements) {\n const stmtStart = stmt.getStart(origSourceFile);\n if (stmtStart <= firstClassPos) continue;\n\n const isCandidate =\n (ts.isVariableStatement(stmt) && !hasExportModifier(stmt)) ||\n (ts.isFunctionDeclaration(stmt) && !hasExportModifier(stmt));\n if (!isCandidate) continue;\n\n const referencedIds = collectIdentifiers(stmt);\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(stmt)) {\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(stmt.getEnd(), '\\n');\n ms.move(stmtStart, stmt.getEnd(), 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.getStart(origSourceFile);\n const end = dec.getEnd();\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\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 (helpers.length > 0) {\n // Insert helpers after the last import / top-level non-class statement,\n // well before any class that references them.\n // Detect which imported names are type-only so we skip imports that will\n // be fully removed by elideTypeOnlyImportsMagicString (step 4).\n // Inserting at a position inside a soon-to-be-removed range would cause\n // MagicString to discard the helpers along with the import.\n const willElide = detectTypeOnlyImportNames(ms.toString());\n\n let insertPos = 0;\n for (const stmt of origSourceFile.statements) {\n if (ts.isImportDeclaration(stmt)) {\n // Skip imports that will be entirely removed by type elision\n if (willElide.size > 0 && stmt.importClause) {\n const clause = stmt.importClause;\n const namedBindings =\n clause.namedBindings && ts.isNamedImports(clause.namedBindings)\n ? clause.namedBindings.elements\n : undefined;\n const defaultName = clause.name;\n const allElided =\n (!defaultName || willElide.has(defaultName.text)) &&\n (!namedBindings ||\n namedBindings.every(\n (el) => el.isTypeOnly || willElide.has(el.name.text),\n ));\n if (allElided) continue;\n }\n insertPos = stmt.getEnd();\n } else if (\n ts.isVariableStatement(stmt) &&\n !stmt.getText(origSourceFile).includes('class')\n ) {\n insertPos = stmt.getEnd();\n } else if (!ts.isExportAssignment(stmt)) {\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, helpers.join('\\n') + '\\n');\n } else {\n ms.appendRight(insertPos, '\\n' + helpers.join('\\n') + '\\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 elideTypeOnlyImportsMagicString(ms, oxcProgram);\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\nfunction injectAngularImport(sf: ts.SourceFile) {\n return ts.factory.updateSourceFile(sf, [\n ts.factory.createImportDeclaration(\n undefined,\n ts.factory.createImportClause(\n false,\n undefined,\n ts.factory.createNamespaceImport(ts.factory.createIdentifier('i0')),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Aa,QACb,qBAAqB,MACvB;CAEF,OAAO;EACL,MAAM,GAAG,SAAS;EAClB;EACA;CACF;AACF;AAEA,SAAS,oBAAoB,IAAmB;CAC9C,OAAO,GAAG,QAAQ,iBAAiB,IAAI,CACrC,GAAG,QAAQ,wBACT,KAAA,GACA,GAAG,QAAQ,mBACT,OACA,KAAA,GACA,GAAG,QAAQ,sBAAsB,GAAG,QAAQ,iBAAiB,IAAI,CAAC,CACpE,GACA,GAAG,QAAQ,oBAAoB,eAAe,CAChD,GACA,GAAG,GAAG,UACR,CAAC;AACH"}
1
+ {"version":3,"file":"compile.js","names":[],"sources":["../../../../src/lib/compiler/compile.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as o from '@angular/compiler';\nimport MagicString from 'magic-string';\nimport { parseSync } from 'oxc-parser';\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 { findAllClasses, resolveSyntheticImportSpecifier } 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 setEmitterSourceFile,\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';\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\nfunction hasExportModifier(node: ts.Node): boolean {\n return (\n ts.canHaveModifiers(node) &&\n ts\n .getModifiers(node)\n ?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) === true\n );\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\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 */\nfunction collectIdentifiers(node: ts.Node): Set<string> {\n const ids = new Set<string>();\n function walk(n: ts.Node) {\n if (ts.isIdentifier(n)) {\n ids.add(n.text);\n }\n // Stop recursing into lazily-evaluated scopes\n if (ts.isFunctionLike(n) || ts.isClassLike(n)) {\n return;\n }\n ts.forEachChild(n, walk);\n }\n ts.forEachChild(node, walk);\n return ids;\n}\n\n/** Extract the names defined by a top-level statement. */\nfunction getDefinedNames(stmt: ts.Statement): string[] {\n if (ts.isVariableStatement(stmt)) {\n const names: string[] = [];\n for (const decl of stmt.declarationList.declarations) {\n collectBindingNames(decl.name, names);\n }\n return names;\n }\n if (ts.isFunctionDeclaration(stmt) && stmt.name) {\n return [stmt.name.text];\n }\n if (ts.isClassDeclaration(stmt) && stmt.name) {\n return [stmt.name.text];\n }\n return [];\n}\n\n/** Recursively collect all bound identifiers from a binding name/pattern. */\nfunction collectBindingNames(name: ts.BindingName, out: string[]): void {\n if (ts.isIdentifier(name)) {\n out.push(name.text);\n } else if (\n ts.isObjectBindingPattern(name) ||\n ts.isArrayBindingPattern(name)\n ) {\n for (const el of name.elements) {\n if (!ts.isOmittedExpression(el)) {\n collectBindingNames(el.name, out);\n }\n }\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 origSourceFile = ts.createSourceFile(\n fileName,\n sourceCode,\n ts.ScriptTarget.Latest,\n false,\n );\n // OXC parse for metadata extraction (faster than TS for decorator/signal analysis)\n const oxcProgram = opts.oxcProgram ?? parseSync(fileName, sourceCode).program;\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\n for (const stmt of origSourceFile.statements) {\n if (\n !ts.isImportDeclaration(stmt) ||\n !stmt.importClause?.namedBindings ||\n !ts.isNamedImports(stmt.importClause.namedBindings)\n ) {\n continue;\n }\n\n const moduleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n // Explicit `import type { X }` — declaration-level type-only import\n const isDeclarationTypeOnly = stmt.importClause.isTypeOnly;\n for (const element of stmt.importClause.namedBindings.elements) {\n const localName = element.name.text;\n importedNames.add(localName);\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.isTypeOnly) {\n typeOnlyImports.add(localName);\n }\n }\n }\n\n // Inject 'import * as i0 from \"@angular/core\"'\n const sourceFile = injectAngularImport(origSourceFile);\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 setEmitterSourceFile(origSourceFile);\n setEmitterSourceCode(sourceCode);\n\n // --- Direct walk: compile each Angular-decorated class and collect string outputs ---\n // This replaces the previous ts.transform + printer.printNode approach.\n // By emitting strings directly from the Angular output AST, we skip both\n // ts.factory node creation and ts.Printer serialization (~4x faster).\n interface ClassCompileResult {\n ivyCode: string[]; // \"static ɵfac = ...\", \"static ɵcmp = ...\", etc.\n decorators: ts.Decorator[]; // Angular decorators to remove\n classEnd: number; // Position of closing } in original source\n }\n const classResults: ClassCompileResult[] = [];\n // Track synthetic imports needed for NgModule export expansion.\n // Maps exported class name → import specifier.\n const syntheticImports = new Map<string, string>();\n\n // ANGULAR_DECORATORS imported from utils\n\n for (const node of findAllClasses(origSourceFile)) {\n const decorators = ts.getDecorators(node);\n if (!decorators || decorators.length === 0) continue;\n\n const className = node.name?.text;\n if (!className) continue;\n\n const angularDecorators = decorators.filter((dec) => {\n if (!ts.isCallExpression(dec.expression)) return false;\n const name = dec.expression.expression.getText(origSourceFile);\n return ANGULAR_DECORATORS.has(name);\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 ts.Decorator,\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 extendsClause = node.heritageClauses?.find(\n (h) => h.token === ts.SyntaxKind.ExtendsKeyword,\n );\n const usesInheritance = !!extendsClause && extendsClause.types.length > 0;\n\n // Look up the corresponding OXC class node for metadata extraction\n const oxcNode = oxcClassMap.get(className);\n\n let classCompileError: Error | null = null;\n\n angularDecorators.forEach((dec) => {\n const decoratorName = (\n dec.expression as ts.CallExpression\n ).expression.getText(origSourceFile);\n // Find the matching OXC decorator by name\n const oxcDec = oxcNode?.decorators?.find((d: any) => {\n const expr = d.expression;\n return (\n expr?.type === 'CallExpression' && expr.callee?.name === decoratorName\n );\n });\n const meta = extractMetadata(oxcDec, sourceCode, stringConsts);\n const sigs = oxcNode\n ? detectSignals(oxcNode, sourceCode)\n : { inputs: {}, outputs: {}, viewQueries: [], contentQueries: [] };\n const fields = oxcNode\n ? detectFieldDecorators(oxcNode, sourceCode)\n : {\n inputs: {},\n outputs: {},\n viewQueries: [],\n contentQueries: [],\n hostProperties: {},\n hostListeners: {},\n };\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(memberName);\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(exportedName);\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(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 if (resolvedInlineStyles) {\n for (const [idx, css] of resolvedInlineStyles) {\n if (idx < meta.styles.length) {\n meta.styles[idx] = css;\n }\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 sourceFile,\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 = oxcNode\n ? extractConstructorDeps(oxcNode, sourceCode, typeOnlyImports)\n : [];\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 = oxcNode\n ? buildCtorParameters(oxcNode, sourceCode, typeOnlyImports)\n : null;\n const propDecorators = oxcNode\n ? buildPropDecorators(oxcNode, sourceCode, 'i0.')\n : null;\n angularDecorators.forEach((dec) => {\n const call = dec.expression as ts.CallExpression;\n const decName = call.expression.getText(origSourceFile);\n const decArgsNode = call.arguments[0];\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 && ts.isObjectLiteralExpression(decArgsNode)) {\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 as ts.ObjectLiteralExpression)\n .properties) {\n if (!ts.isPropertyAssignment(prop)) {\n rewrittenProps.push(prop.getText(origSourceFile));\n continue;\n }\n const propName = prop.name?.getText(origSourceFile);\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(prop.getText(origSourceFile));\n }\n }\n metadataArgsExpr = needsTransform\n ? `{${rewrittenProps.join(', ')}}`\n : decArgsNode.getText(origSourceFile);\n } else {\n metadataArgsExpr = decArgsNode.getText(origSourceFile);\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(ts.factory.createIdentifier(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 constantPool.statements.push(\n new o.ExpressionStatement(classMetadataExpr),\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: ts.Decorator[] = [];\n for (const member of node.members) {\n const mDecorators = ts.getDecorators(member as any);\n if (!mDecorators) continue;\n for (const dec of mDecorators) {\n if (!ts.isCallExpression(dec.expression)) continue;\n const decName = dec.expression.expression.getText(origSourceFile);\n if (FIELD_DECORATORS.has(decName)) {\n memberDecorators.push(dec);\n }\n }\n }\n\n classResults.push({\n ivyCode,\n decorators: [...angularDecorators, ...memberDecorators],\n classEnd: node.getEnd(),\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 if (!importedNames.has(name)) {\n ms.prepend(`import { ${name} } from \"${specifier}\";\\n`);\n importedNames.add(name);\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 let firstClassPos = Infinity;\n const nonHoistableNames = new Set<string>();\n for (const stmt of origSourceFile.statements) {\n if (ts.isClassDeclaration(stmt)) {\n firstClassPos = stmt.getStart(origSourceFile);\n // The first class itself is non-hoistable — statements hoisted\n // before it must not reference it.\n if (stmt.name) {\n nonHoistableNames.add(stmt.name.text);\n }\n break;\n }\n }\n\n // Pass 1: collect names defined by statements that will NOT be hoisted\n // (classes, exported vars/functions) and therefore remain after firstClassPos.\n for (const stmt of origSourceFile.statements) {\n const stmtStart = stmt.getStart(origSourceFile);\n if (stmtStart <= firstClassPos) continue;\n\n if (ts.isClassDeclaration(stmt) && stmt.name) {\n nonHoistableNames.add(stmt.name.text);\n }\n if (ts.isEnumDeclaration(stmt)) {\n nonHoistableNames.add(stmt.name.text);\n }\n if (ts.isVariableStatement(stmt) && hasExportModifier(stmt)) {\n for (const decl of stmt.declarationList.declarations) {\n const names: string[] = [];\n collectBindingNames(decl.name, names);\n for (const n of names) {\n nonHoistableNames.add(n);\n }\n }\n }\n if (\n ts.isFunctionDeclaration(stmt) &&\n hasExportModifier(stmt) &&\n stmt.name\n ) {\n nonHoistableNames.add(stmt.name.text);\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 stmt of origSourceFile.statements) {\n const stmtStart = stmt.getStart(origSourceFile);\n if (stmtStart <= firstClassPos) continue;\n\n const isCandidate =\n (ts.isVariableStatement(stmt) && !hasExportModifier(stmt)) ||\n (ts.isFunctionDeclaration(stmt) && !hasExportModifier(stmt));\n if (!isCandidate) continue;\n\n const referencedIds = collectIdentifiers(stmt);\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(stmt)) {\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(stmt.getEnd(), '\\n');\n ms.move(stmtStart, stmt.getEnd(), 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.getStart(origSourceFile);\n const end = dec.getEnd();\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\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 (helpers.length > 0) {\n // Insert helpers after the last import / top-level non-class statement,\n // well before any class that references them.\n // Detect which imported names are type-only so we skip imports that will\n // be fully removed by elideTypeOnlyImportsMagicString (step 4).\n // Inserting at a position inside a soon-to-be-removed range would cause\n // MagicString to discard the helpers along with the import.\n const willElide = detectTypeOnlyImportNames(ms.toString());\n\n let insertPos = 0;\n for (const stmt of origSourceFile.statements) {\n if (ts.isImportDeclaration(stmt)) {\n // Skip imports that will be entirely removed by type elision\n if (willElide.size > 0 && stmt.importClause) {\n const clause = stmt.importClause;\n const namedBindings =\n clause.namedBindings && ts.isNamedImports(clause.namedBindings)\n ? clause.namedBindings.elements\n : undefined;\n const defaultName = clause.name;\n const allElided =\n (!defaultName || willElide.has(defaultName.text)) &&\n (!namedBindings ||\n namedBindings.every(\n (el) => el.isTypeOnly || willElide.has(el.name.text),\n ));\n if (allElided) continue;\n }\n insertPos = stmt.getEnd();\n } else if (\n ts.isVariableStatement(stmt) &&\n !stmt.getText(origSourceFile).includes('class')\n ) {\n insertPos = stmt.getEnd();\n } else if (!ts.isExportAssignment(stmt)) {\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, helpers.join('\\n') + '\\n');\n } else {\n ms.appendRight(insertPos, '\\n' + helpers.join('\\n') + '\\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 elideTypeOnlyImportsMagicString(ms, oxcProgram);\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\nfunction injectAngularImport(sf: ts.SourceFile) {\n return ts.factory.updateSourceFile(sf, [\n ts.factory.createImportDeclaration(\n undefined,\n ts.factory.createImportClause(\n false,\n undefined,\n ts.factory.createNamespaceImport(ts.factory.createIdentifier('i0')),\n ),\n ts.factory.createStringLiteral('@angular/core'),\n ),\n ...sf.statements,\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0HA,SAAS,kBAAkB,MAAwB;CACjD,OACE,GAAG,iBAAiB,IAAI,KACxB,GACG,aAAa,IAAI,CAAC,EACjB,MAAM,MAAM,EAAE,SAAS,GAAG,WAAW,aAAa,MAAM;AAEhE;;;;;;;;;;;;AAaA,SAAS,gBACP,OACqB;CACrB,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS,IAAI,EAAE,iBAAiB,KAAK,IAAI;CAExD,OAAO;AACT;;;;;;AAOA,SAAS,mBAAmB,MAA4B;CACtD,MAAM,sBAAM,IAAI,IAAY;CAC5B,SAAS,KAAK,GAAY;EACxB,IAAI,GAAG,aAAa,CAAC,GACnB,IAAI,IAAI,EAAE,IAAI;EAGhB,IAAI,GAAG,eAAe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ildCtorParameters(classNode: any, sourceCode: string,
12
12
  * Returns a JS object literal string or null if no props.
13
13
  *
14
14
  * Accepts an OXC ClassDeclaration node and the original source string.
15
+ * `coreNamespace` (e.g. `i0.`) qualifies the decorators synthesized for
16
+ * signal APIs, whose names the source may not import.
15
17
  */
16
- export declare function buildPropDecorators(classNode: any, sourceCode: string): string | null;
18
+ export declare function buildPropDecorators(classNode: any, sourceCode: string, coreNamespace?: string): string | null;
@@ -98,8 +98,10 @@ function buildCtorParameters(classNode, sourceCode, typeOnlyImports) {
98
98
  * Returns a JS object literal string or null if no props.
99
99
  *
100
100
  * Accepts an OXC ClassDeclaration node and the original source string.
101
+ * `coreNamespace` (e.g. `i0.`) qualifies the decorators synthesized for
102
+ * signal APIs, whose names the source may not import.
101
103
  */
102
- function buildPropDecorators(classNode, sourceCode) {
104
+ function buildPropDecorators(classNode, sourceCode, coreNamespace = "") {
103
105
  const props = {};
104
106
  const members = classNode.body?.body || [];
105
107
  for (const member of members) {
@@ -142,24 +144,24 @@ function buildPropDecorators(classNode, sourceCode) {
142
144
  optParts.push(sourceCode.slice(p.start, p.end));
143
145
  }
144
146
  optParts.push(`isSignal: true`, `required: ${required}`);
145
- props[memberName].push(`{type: Input, args: [{${optParts.join(", ")}}]}`);
147
+ props[memberName].push(`{type: ${coreNamespace}Input, args: [{${optParts.join(", ")}}]}`);
146
148
  } else if (api === "model") {
147
149
  if (!props[memberName]) props[memberName] = [];
148
150
  const bindingName = extractAlias(required ? args[0] : args[1]) ?? memberName;
149
- props[memberName].push(`{type: Input, args: [{isSignal: true, alias: '${escapeStringLiteral(bindingName)}', required: ${required}}]}`);
150
- props[memberName].push(`{type: Output, args: ['${escapeStringLiteral(bindingName + "Change")}']}`);
151
+ props[memberName].push(`{type: ${coreNamespace}Input, args: [{isSignal: true, alias: '${escapeStringLiteral(bindingName)}', required: ${required}}]}`);
152
+ props[memberName].push(`{type: ${coreNamespace}Output, args: ['${escapeStringLiteral(bindingName + "Change")}']}`);
151
153
  } else if (api === "output" || api === "outputFromObservable") {
152
154
  if (!props[memberName]) props[memberName] = [];
153
155
  const alias = extractAlias(api === "outputFromObservable" ? args[1] : args[0]);
154
- if (alias !== null) props[memberName].push(`{type: Output, args: ['${escapeStringLiteral(alias)}']}`);
155
- else props[memberName].push(`{type: Output}`);
156
+ if (alias !== null) props[memberName].push(`{type: ${coreNamespace}Output, args: ['${escapeStringLiteral(alias)}']}`);
157
+ else props[memberName].push(`{type: ${coreNamespace}Output}`);
156
158
  } else if (api === "viewChild" || api === "viewChildren" || api === "contentChild" || api === "contentChildren") {
157
159
  if (!props[memberName]) props[memberName] = [];
158
160
  const queryType = api === "viewChildren" ? "ViewChildren" : api === "viewChild" ? "ViewChild" : api === "contentChildren" ? "ContentChildren" : "ContentChild";
159
161
  if (args.length > 0) {
160
162
  const opts = args.length > 1 ? `{...${sourceCode.slice(args[1].start, args[1].end)}, isSignal: true}` : `{isSignal: true}`;
161
- props[memberName].push(`{type: ${queryType}, args: [${sourceCode.slice(args[0].start, args[0].end)}, ${opts}]}`);
162
- } else props[memberName].push(`{type: ${queryType}, args: [undefined, {isSignal: true}]}`);
163
+ props[memberName].push(`{type: ${coreNamespace}${queryType}, args: [${sourceCode.slice(args[0].start, args[0].end)}, ${opts}]}`);
164
+ } else props[memberName].push(`{type: ${coreNamespace}${queryType}, args: [undefined, {isSignal: true}]}`);
163
165
  }
164
166
  }
165
167
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jit-metadata.js","names":[],"sources":["../../../../src/lib/compiler/jit-metadata.ts"],"sourcesContent":["/**\n * JIT metadata helpers — OXC AST edition.\n *\n * Builds static metadata arrays that Angular's ReflectionCapabilities reads\n * at runtime for JIT compilation (ctorParameters, propDecorators).\n *\n * Uses source-position slicing instead of AST getText() for speed.\n */\nimport { FIELD_DECORATORS } from './constants.js';\n\nfunction getCallApi(call: any): { api: string; required: boolean } | null {\n const callee = call.callee;\n if (!callee) return null;\n\n if (callee.type === 'Identifier') {\n return { api: callee.name, required: false };\n }\n\n if (\n (callee.type === 'StaticMemberExpression' ||\n callee.type === 'MemberExpression') &&\n callee.object?.type === 'Identifier' &&\n callee.property?.name === 'required'\n ) {\n return { api: callee.object.name, required: true };\n }\n\n return null;\n}\n\n/**\n * Read a string-literal `alias` value out of an OXC ObjectExpression.\n * Returns null when the arg isn't an object literal, has no alias, or\n * the alias value isn't a static string. Shorthand `{alias}` is skipped\n * because the identifier wouldn't be in scope when the propDecorators\n * static block is evaluated at class top level.\n */\nfunction extractAlias(optArg: any): string | null {\n if (!optArg || optArg.type !== 'ObjectExpression') return null;\n for (const p of optArg.properties || []) {\n if (p.type !== 'ObjectProperty' && p.type !== 'Property') continue;\n if (p.shorthand) continue;\n const pKey = p.key?.name || p.key?.value;\n if (pKey !== 'alias') continue;\n const v = p.value;\n if (v?.type === 'StringLiteral') return v.value;\n if (v?.type === 'Literal' && typeof v.value === 'string') return v.value;\n }\n return null;\n}\n\nfunction escapeStringLiteral(s: string): string {\n return s.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n}\n\n/** The constructor implementation, skipping overload signatures. */\nexport function findConstructor(classNode: any): any {\n return (classNode.body?.body || []).find(\n (m: any) =>\n m.type === 'MethodDefinition' &&\n m.kind === 'constructor' &&\n m.value?.body,\n );\n}\n\n/**\n * Build ctorParameters for constructor DI in JIT format:\n * [{ type: ServiceA }, { type: ServiceB, decorators: [{type: Optional}] }]\n *\n * Accepts an OXC ClassDeclaration node and the original source string.\n */\nexport function buildCtorParameters(\n classNode: any,\n sourceCode: string,\n typeOnlyImports: Set<string>,\n): string | null {\n const ctor = findConstructor(classNode);\n if (!ctor) return null;\n\n const params: any[] = ctor.value?.params?.items || ctor.value?.params || [];\n if (params.length === 0) return null;\n\n const result: string[] = [];\n for (const param of params) {\n const parts: string[] = [];\n\n // Handle TSParameterProperty (e.g., constructor(private foo: Bar))\n const actualParam =\n param.type === 'TSParameterProperty' ? param.parameter : param;\n const typeAnn =\n actualParam?.typeAnnotation?.typeAnnotation ??\n param?.typeAnnotation?.typeAnnotation;\n\n // Extract type name from annotation\n let typeName: string | null = null;\n if (typeAnn) {\n if (typeAnn.type === 'TSTypeReference' && typeAnn.typeName) {\n typeName =\n typeAnn.typeName.name ??\n sourceCode.slice(typeAnn.typeName.start, typeAnn.typeName.end);\n } else if (typeAnn.type === 'TSUnionType') {\n for (const t of typeAnn.types || []) {\n if (t.type === 'TSTypeReference' && t.typeName) {\n typeName =\n t.typeName.name ??\n sourceCode.slice(t.typeName.start, t.typeName.end);\n break;\n }\n }\n }\n }\n\n // Extract parameter decorators (may live on TSParameterProperty or the param itself)\n const paramDecs: any[] = param.decorators || actualParam?.decorators || [];\n // @Inject supplies the token, so its annotation may be an interface\n // with no runtime value; referencing it would throw.\n const hasInject = paramDecs.some(\n (dec: any) => dec.expression?.callee?.name === 'Inject',\n );\n\n if (typeName && !hasInject && !typeOnlyImports.has(typeName)) {\n parts.push(`type: ${typeName}`);\n } else {\n parts.push(`type: undefined`);\n }\n\n if (paramDecs.length > 0) {\n const decEntries = paramDecs\n .map((dec: any) => {\n const expr = dec.expression;\n if (!expr || expr.type !== 'CallExpression') return '';\n const name = expr.callee?.name;\n if (!name) return '';\n const args: any[] = expr.arguments || [];\n if (args.length > 0) {\n return `{type: ${name}, args: [${args.map((a: any) => sourceCode.slice(a.start, a.end)).join(', ')}]}`;\n }\n return `{type: ${name}}`;\n })\n .filter(Boolean);\n if (decEntries.length > 0) {\n parts.push(`decorators: [${decEntries.join(', ')}]`);\n }\n }\n\n result.push(`{${parts.join(', ')}}`);\n }\n\n return result.join(', ');\n}\n\n/**\n * Build propDecorators for field decorators + signal API downleveling.\n * Returns a JS object literal string or null if no props.\n *\n * Accepts an OXC ClassDeclaration node and the original source string.\n */\nexport function buildPropDecorators(\n classNode: any,\n sourceCode: string,\n): string | null {\n const props: Record<string, string[]> = {};\n const members: any[] = classNode.body?.body || [];\n\n for (const member of members) {\n const memberName: string | undefined = member.key?.name;\n if (!memberName) continue;\n\n // Check for field decorators (@Input, @Output, @ViewChild, etc.)\n const explicitDecoratorNames = new Set<string>();\n const decorators: any[] = member.decorators || [];\n for (const dec of decorators) {\n const expr = dec.expression;\n if (!expr || expr.type !== 'CallExpression') continue;\n const decName: string | undefined = expr.callee?.name;\n if (!decName || !FIELD_DECORATORS.has(decName)) continue;\n\n explicitDecoratorNames.add(decName);\n if (!props[memberName]) props[memberName] = [];\n const args: any[] = expr.arguments || [];\n if (args.length > 0) {\n props[memberName].push(\n `{type: ${decName}, args: [${args.map((a: any) => sourceCode.slice(a.start, a.end)).join(', ')}]}`,\n );\n } else {\n props[memberName].push(`{type: ${decName}}`);\n }\n }\n\n // Signal API downleveling. Skip when a matching explicit decorator\n // is already on the field — Angular's transform bails in that case\n // (input_function.ts, model_function.ts, output_function.ts,\n // query_functions.ts) to avoid duplicate metadata entries.\n if (\n member.type === 'PropertyDefinition' &&\n member.value?.type === 'CallExpression'\n ) {\n const signalCall = getCallApi(member.value);\n if (!signalCall) continue;\n\n const { api, required } = signalCall;\n const args: any[] = member.value.arguments || [];\n\n const hasInput = explicitDecoratorNames.has('Input');\n const hasOutput = explicitDecoratorNames.has('Output');\n const hasQuery =\n explicitDecoratorNames.has('ViewChild') ||\n explicitDecoratorNames.has('ViewChildren') ||\n explicitDecoratorNames.has('ContentChild') ||\n explicitDecoratorNames.has('ContentChildren');\n\n if (api === 'input' && hasInput) continue;\n if (api === 'model' && (hasInput || hasOutput)) continue;\n if ((api === 'output' || api === 'outputFromObservable') && hasOutput) {\n continue;\n }\n if (\n (api === 'viewChild' ||\n api === 'viewChildren' ||\n api === 'contentChild' ||\n api === 'contentChildren') &&\n hasQuery\n ) {\n continue;\n }\n\n if (api === 'input') {\n if (!props[memberName]) props[memberName] = [];\n // Preserve original options from the input() call and overlay\n // isSignal/required. `transform` is dropped: the input signal\n // already applies it internally, so forwarding it to the\n // decorator would make Angular's runtime JIT wrap it a second\n // time via the directive metadata's transformFunction slot.\n // Shorthand props ({alias}) are skipped — the identifier\n // wouldn't be in scope when the propDecorators block runs at\n // class top level.\n const optArg = required ? args[0] : args[1];\n const optParts: string[] = [];\n if (optArg?.type === 'ObjectExpression') {\n for (const p of optArg.properties || []) {\n if (p.type !== 'ObjectProperty' && p.type !== 'Property') continue;\n if (p.shorthand) continue;\n const pKey = p.key?.name || p.key?.value;\n if (\n pKey === 'isSignal' ||\n pKey === 'required' ||\n pKey === 'transform'\n ) {\n continue;\n }\n optParts.push(sourceCode.slice(p.start, p.end));\n }\n }\n optParts.push(`isSignal: true`, `required: ${required}`);\n props[memberName].push(\n `{type: Input, args: [{${optParts.join(', ')}}]}`,\n );\n } else if (api === 'model') {\n // Both Input and Output must live on the SAME propDecorators key\n // (the class field name). Angular's JIT facade indexes outputs by\n // classPropertyName and reads `instance[classPropertyName]` for\n // the EventEmitter — for a model that's the signal itself, which\n // exposes the emitter via [SIGNAL]. Splitting Output onto a\n // synthetic `<name>Change` key would point at a field that does\n // not exist on the class, breaking two-way bindings.\n if (!props[memberName]) props[memberName] = [];\n const optArg = required ? args[0] : args[1];\n const alias = extractAlias(optArg);\n const bindingName = alias ?? memberName;\n props[memberName].push(\n `{type: Input, args: [{isSignal: true, alias: '${escapeStringLiteral(bindingName)}', required: ${required}}]}`,\n );\n props[memberName].push(\n `{type: Output, args: ['${escapeStringLiteral(bindingName + 'Change')}']}`,\n );\n } else if (api === 'output' || api === 'outputFromObservable') {\n if (!props[memberName]) props[memberName] = [];\n // outputFromObservable(observable, options) — options is args[1].\n // output(options) — options is args[0].\n const optArg = api === 'outputFromObservable' ? args[1] : args[0];\n const alias = extractAlias(optArg);\n if (alias !== null) {\n props[memberName].push(\n `{type: Output, args: ['${escapeStringLiteral(alias)}']}`,\n );\n } else {\n props[memberName].push(`{type: Output}`);\n }\n } else if (\n api === 'viewChild' ||\n api === 'viewChildren' ||\n api === 'contentChild' ||\n api === 'contentChildren'\n ) {\n if (!props[memberName]) props[memberName] = [];\n const queryType =\n api === 'viewChildren'\n ? 'ViewChildren'\n : api === 'viewChild'\n ? 'ViewChild'\n : api === 'contentChildren'\n ? 'ContentChildren'\n : 'ContentChild';\n // Signal queries need `isSignal: true` so the runtime JIT compiler\n // wires them through the signal query infrastructure rather than\n // treating them as plain @ViewChild/@ContentChild assignments.\n // Mirrors Angular's own JIT transform in\n // compiler-cli/.../initializer_api_transforms/query_functions.ts.\n if (args.length > 0) {\n const opts =\n args.length > 1\n ? `{...${sourceCode.slice(args[1].start, args[1].end)}, isSignal: true}`\n : `{isSignal: true}`;\n props[memberName].push(\n `{type: ${queryType}, args: [${sourceCode.slice(args[0].start, args[0].end)}, ${opts}]}`,\n );\n } else {\n props[memberName].push(\n `{type: ${queryType}, args: [undefined, {isSignal: true}]}`,\n );\n }\n }\n }\n }\n\n const entries = Object.entries(props);\n if (entries.length === 0) return null;\n\n const propsStr = entries\n .map(([key, decs]) => `${key}: [${decs.join(', ')}]`)\n .join(', ');\n return `{${propsStr}}`;\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAS,WAAW,MAAsD;CACxE,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,QAAQ,OAAO;CAEpB,IAAI,OAAO,SAAS,cAClB,OAAO;EAAE,KAAK,OAAO;EAAM,UAAU;CAAM;CAG7C,KACG,OAAO,SAAS,4BACf,OAAO,SAAS,uBAClB,OAAO,QAAQ,SAAS,gBACxB,OAAO,UAAU,SAAS,YAE1B,OAAO;EAAE,KAAK,OAAO,OAAO;EAAM,UAAU;CAAK;CAGnD,OAAO;AACT;;;;;;;;AASA,SAAS,aAAa,QAA4B;CAChD,IAAI,CAAC,UAAU,OAAO,SAAS,oBAAoB,OAAO;CAC1D,KAAK,MAAM,KAAK,OAAO,cAAc,CAAC,GAAG;EACvC,IAAI,EAAE,SAAS,oBAAoB,EAAE,SAAS,YAAY;EAC1D,IAAI,EAAE,WAAW;EAEjB,KADa,EAAE,KAAK,QAAQ,EAAE,KAAK,WACtB,SAAS;EACtB,MAAM,IAAI,EAAE;EACZ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E,CAAC,OAAO,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,GACvF;IACF,OACE,MAAM,WAAW,CAAC,KAChB,UAAU,UAAU,uCACtB;GAEJ;EACF;CACF;CAEA,MAAM,UAAU,OAAO,QAAQ,KAAK;CACpC,IAAI,QAAQ,WAAW,GAAG,OAAO;CAKjC,OAAO,IAHU,QACd,KAAK,CAAC,KAAK,UAAU,GAAG,IAAI,KAAK,KAAK,KAAK,IAAI,EAAE,EAAE,CAAC,CACpD,KAAK,IACG,EAAS;AACtB"}
1
+ {"version":3,"file":"jit-metadata.js","names":[],"sources":["../../../../src/lib/compiler/jit-metadata.ts"],"sourcesContent":["/**\n * JIT metadata helpers — OXC AST edition.\n *\n * Builds static metadata arrays that Angular's ReflectionCapabilities reads\n * at runtime for JIT compilation (ctorParameters, propDecorators).\n *\n * Uses source-position slicing instead of AST getText() for speed.\n */\nimport { FIELD_DECORATORS } from './constants.js';\n\nfunction getCallApi(call: any): { api: string; required: boolean } | null {\n const callee = call.callee;\n if (!callee) return null;\n\n if (callee.type === 'Identifier') {\n return { api: callee.name, required: false };\n }\n\n if (\n (callee.type === 'StaticMemberExpression' ||\n callee.type === 'MemberExpression') &&\n callee.object?.type === 'Identifier' &&\n callee.property?.name === 'required'\n ) {\n return { api: callee.object.name, required: true };\n }\n\n return null;\n}\n\n/**\n * Read a string-literal `alias` value out of an OXC ObjectExpression.\n * Returns null when the arg isn't an object literal, has no alias, or\n * the alias value isn't a static string. Shorthand `{alias}` is skipped\n * because the identifier wouldn't be in scope when the propDecorators\n * static block is evaluated at class top level.\n */\nfunction extractAlias(optArg: any): string | null {\n if (!optArg || optArg.type !== 'ObjectExpression') return null;\n for (const p of optArg.properties || []) {\n if (p.type !== 'ObjectProperty' && p.type !== 'Property') continue;\n if (p.shorthand) continue;\n const pKey = p.key?.name || p.key?.value;\n if (pKey !== 'alias') continue;\n const v = p.value;\n if (v?.type === 'StringLiteral') return v.value;\n if (v?.type === 'Literal' && typeof v.value === 'string') return v.value;\n }\n return null;\n}\n\nfunction escapeStringLiteral(s: string): string {\n return s.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n}\n\n/** The constructor implementation, skipping overload signatures. */\nexport function findConstructor(classNode: any): any {\n return (classNode.body?.body || []).find(\n (m: any) =>\n m.type === 'MethodDefinition' &&\n m.kind === 'constructor' &&\n m.value?.body,\n );\n}\n\n/**\n * Build ctorParameters for constructor DI in JIT format:\n * [{ type: ServiceA }, { type: ServiceB, decorators: [{type: Optional}] }]\n *\n * Accepts an OXC ClassDeclaration node and the original source string.\n */\nexport function buildCtorParameters(\n classNode: any,\n sourceCode: string,\n typeOnlyImports: Set<string>,\n): string | null {\n const ctor = findConstructor(classNode);\n if (!ctor) return null;\n\n const params: any[] = ctor.value?.params?.items || ctor.value?.params || [];\n if (params.length === 0) return null;\n\n const result: string[] = [];\n for (const param of params) {\n const parts: string[] = [];\n\n // Handle TSParameterProperty (e.g., constructor(private foo: Bar))\n const actualParam =\n param.type === 'TSParameterProperty' ? param.parameter : param;\n const typeAnn =\n actualParam?.typeAnnotation?.typeAnnotation ??\n param?.typeAnnotation?.typeAnnotation;\n\n // Extract type name from annotation\n let typeName: string | null = null;\n if (typeAnn) {\n if (typeAnn.type === 'TSTypeReference' && typeAnn.typeName) {\n typeName =\n typeAnn.typeName.name ??\n sourceCode.slice(typeAnn.typeName.start, typeAnn.typeName.end);\n } else if (typeAnn.type === 'TSUnionType') {\n for (const t of typeAnn.types || []) {\n if (t.type === 'TSTypeReference' && t.typeName) {\n typeName =\n t.typeName.name ??\n sourceCode.slice(t.typeName.start, t.typeName.end);\n break;\n }\n }\n }\n }\n\n // Extract parameter decorators (may live on TSParameterProperty or the param itself)\n const paramDecs: any[] = param.decorators || actualParam?.decorators || [];\n // @Inject supplies the token, so its annotation may be an interface\n // with no runtime value; referencing it would throw.\n const hasInject = paramDecs.some(\n (dec: any) => dec.expression?.callee?.name === 'Inject',\n );\n\n if (typeName && !hasInject && !typeOnlyImports.has(typeName)) {\n parts.push(`type: ${typeName}`);\n } else {\n parts.push(`type: undefined`);\n }\n\n if (paramDecs.length > 0) {\n const decEntries = paramDecs\n .map((dec: any) => {\n const expr = dec.expression;\n if (!expr || expr.type !== 'CallExpression') return '';\n const name = expr.callee?.name;\n if (!name) return '';\n const args: any[] = expr.arguments || [];\n if (args.length > 0) {\n return `{type: ${name}, args: [${args.map((a: any) => sourceCode.slice(a.start, a.end)).join(', ')}]}`;\n }\n return `{type: ${name}}`;\n })\n .filter(Boolean);\n if (decEntries.length > 0) {\n parts.push(`decorators: [${decEntries.join(', ')}]`);\n }\n }\n\n result.push(`{${parts.join(', ')}}`);\n }\n\n return result.join(', ');\n}\n\n/**\n * Build propDecorators for field decorators + signal API downleveling.\n * Returns a JS object literal string or null if no props.\n *\n * Accepts an OXC ClassDeclaration node and the original source string.\n * `coreNamespace` (e.g. `i0.`) qualifies the decorators synthesized for\n * signal APIs, whose names the source may not import.\n */\nexport function buildPropDecorators(\n classNode: any,\n sourceCode: string,\n coreNamespace = '',\n): string | null {\n const props: Record<string, string[]> = {};\n const members: any[] = classNode.body?.body || [];\n\n for (const member of members) {\n const memberName: string | undefined = member.key?.name;\n if (!memberName) continue;\n\n // Check for field decorators (@Input, @Output, @ViewChild, etc.)\n const explicitDecoratorNames = new Set<string>();\n const decorators: any[] = member.decorators || [];\n for (const dec of decorators) {\n const expr = dec.expression;\n if (!expr || expr.type !== 'CallExpression') continue;\n const decName: string | undefined = expr.callee?.name;\n if (!decName || !FIELD_DECORATORS.has(decName)) continue;\n\n explicitDecoratorNames.add(decName);\n if (!props[memberName]) props[memberName] = [];\n const args: any[] = expr.arguments || [];\n if (args.length > 0) {\n props[memberName].push(\n `{type: ${decName}, args: [${args.map((a: any) => sourceCode.slice(a.start, a.end)).join(', ')}]}`,\n );\n } else {\n props[memberName].push(`{type: ${decName}}`);\n }\n }\n\n // Signal API downleveling. Skip when a matching explicit decorator\n // is already on the field — Angular's transform bails in that case\n // (input_function.ts, model_function.ts, output_function.ts,\n // query_functions.ts) to avoid duplicate metadata entries.\n if (\n member.type === 'PropertyDefinition' &&\n member.value?.type === 'CallExpression'\n ) {\n const signalCall = getCallApi(member.value);\n if (!signalCall) continue;\n\n const { api, required } = signalCall;\n const args: any[] = member.value.arguments || [];\n\n const hasInput = explicitDecoratorNames.has('Input');\n const hasOutput = explicitDecoratorNames.has('Output');\n const hasQuery =\n explicitDecoratorNames.has('ViewChild') ||\n explicitDecoratorNames.has('ViewChildren') ||\n explicitDecoratorNames.has('ContentChild') ||\n explicitDecoratorNames.has('ContentChildren');\n\n if (api === 'input' && hasInput) continue;\n if (api === 'model' && (hasInput || hasOutput)) continue;\n if ((api === 'output' || api === 'outputFromObservable') && hasOutput) {\n continue;\n }\n if (\n (api === 'viewChild' ||\n api === 'viewChildren' ||\n api === 'contentChild' ||\n api === 'contentChildren') &&\n hasQuery\n ) {\n continue;\n }\n\n if (api === 'input') {\n if (!props[memberName]) props[memberName] = [];\n // Preserve original options from the input() call and overlay\n // isSignal/required. `transform` is dropped: the input signal\n // already applies it internally, so forwarding it to the\n // decorator would make Angular's runtime JIT wrap it a second\n // time via the directive metadata's transformFunction slot.\n // Shorthand props ({alias}) are skipped — the identifier\n // wouldn't be in scope when the propDecorators block runs at\n // class top level.\n const optArg = required ? args[0] : args[1];\n const optParts: string[] = [];\n if (optArg?.type === 'ObjectExpression') {\n for (const p of optArg.properties || []) {\n if (p.type !== 'ObjectProperty' && p.type !== 'Property') continue;\n if (p.shorthand) continue;\n const pKey = p.key?.name || p.key?.value;\n if (\n pKey === 'isSignal' ||\n pKey === 'required' ||\n pKey === 'transform'\n ) {\n continue;\n }\n optParts.push(sourceCode.slice(p.start, p.end));\n }\n }\n optParts.push(`isSignal: true`, `required: ${required}`);\n props[memberName].push(\n `{type: ${coreNamespace}Input, args: [{${optParts.join(', ')}}]}`,\n );\n } else if (api === 'model') {\n // Both Input and Output must live on the SAME propDecorators key\n // (the class field name). Angular's JIT facade indexes outputs by\n // classPropertyName and reads `instance[classPropertyName]` for\n // the EventEmitter — for a model that's the signal itself, which\n // exposes the emitter via [SIGNAL]. Splitting Output onto a\n // synthetic `<name>Change` key would point at a field that does\n // not exist on the class, breaking two-way bindings.\n if (!props[memberName]) props[memberName] = [];\n const optArg = required ? args[0] : args[1];\n const alias = extractAlias(optArg);\n const bindingName = alias ?? memberName;\n props[memberName].push(\n `{type: ${coreNamespace}Input, args: [{isSignal: true, alias: '${escapeStringLiteral(bindingName)}', required: ${required}}]}`,\n );\n props[memberName].push(\n `{type: ${coreNamespace}Output, args: ['${escapeStringLiteral(bindingName + 'Change')}']}`,\n );\n } else if (api === 'output' || api === 'outputFromObservable') {\n if (!props[memberName]) props[memberName] = [];\n // outputFromObservable(observable, options) — options is args[1].\n // output(options) — options is args[0].\n const optArg = api === 'outputFromObservable' ? args[1] : args[0];\n const alias = extractAlias(optArg);\n if (alias !== null) {\n props[memberName].push(\n `{type: ${coreNamespace}Output, args: ['${escapeStringLiteral(alias)}']}`,\n );\n } else {\n props[memberName].push(`{type: ${coreNamespace}Output}`);\n }\n } else if (\n api === 'viewChild' ||\n api === 'viewChildren' ||\n api === 'contentChild' ||\n api === 'contentChildren'\n ) {\n if (!props[memberName]) props[memberName] = [];\n const queryType =\n api === 'viewChildren'\n ? 'ViewChildren'\n : api === 'viewChild'\n ? 'ViewChild'\n : api === 'contentChildren'\n ? 'ContentChildren'\n : 'ContentChild';\n // Signal queries need `isSignal: true` so the runtime JIT compiler\n // wires them through the signal query infrastructure rather than\n // treating them as plain @ViewChild/@ContentChild assignments.\n // Mirrors Angular's own JIT transform in\n // compiler-cli/.../initializer_api_transforms/query_functions.ts.\n if (args.length > 0) {\n const opts =\n args.length > 1\n ? `{...${sourceCode.slice(args[1].start, args[1].end)}, isSignal: true}`\n : `{isSignal: true}`;\n props[memberName].push(\n `{type: ${coreNamespace}${queryType}, args: [${sourceCode.slice(args[0].start, args[0].end)}, ${opts}]}`,\n );\n } else {\n props[memberName].push(\n `{type: ${coreNamespace}${queryType}, args: [undefined, {isSignal: true}]}`,\n );\n }\n }\n }\n }\n\n const entries = Object.entries(props);\n if (entries.length === 0) return null;\n\n const propsStr = entries\n .map(([key, decs]) => `${key}: [${decs.join(', ')}]`)\n .join(', ');\n return `{${propsStr}}`;\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAS,WAAW,MAAsD;CACxE,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,QAAQ,OAAO;CAEpB,IAAI,OAAO,SAAS,cAClB,OAAO;EAAE,KAAK,OAAO;EAAM,UAAU;CAAM;CAG7C,KACG,OAAO,SAAS,4BACf,OAAO,SAAS,uBAClB,OAAO,QAAQ,SAAS,gBACxB,OAAO,UAAU,SAAS,YAE1B,OAAO;EAAE,KAAK,OAAO,OAAO;EAAM,UAAU;CAAK;CAGnD,OAAO;AACT;;;;;;;;AASA,SAAS,aAAa,QAA4B;CAChD,IAAI,CAAC,UAAU,OAAO,SAAS,oBAAoB,OAAO;CAC1D,KAAK,MAAM,KAAK,OAAO,cAAc,CAAC,GAAG;EACvC,IAAI,EAAE,SAAS,oBAAoB,EAAE,SAAS,YAAY;EAC1D,IAAI,EAAE,WAAW;EAEjB,KADa,EAAE,KAAK,QAAQ,EAAE,KAAK,WACtB,SAAS;EACtB,MAAM,IAAI,EAAE;EACZ,IAAI,GAAG,SAAS,iBAAiB,OAAO,EAAE;EAC1C,IAAI,GAAG,SAAS,aAAa,OAAO,EAAE,UAAU,UAAU,OAAO,EAAE;CACrE;CACA,OAAO;AACT;AAEA,SAAS,oBAAoB,GAAmB;CAC9C,OAAO,EAAE,QAAQ,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,KAAK;AACrD;;AAGA,SAAgB,gBAAgB,WAAqB;CACnD,QAAQ,UAAU,MAAM,QAAQ,CAAC,EAAA,CAAG,MACjC,MACC,EAAE,SAAS,sBACX,EAAE,SAAS,iBACX,EAAE,OAAO,IACb;AACF;;;;;;;AAQA,SAAg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