@eui/core 22.0.0-alpha.90 → 22.0.0-rc.1

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.
@@ -2201,14 +2201,26 @@
2201
2201
  },
2202
2202
  {
2203
2203
  "name": "Edit",
2204
- "id": "interface-Edit-1f2d4cb62366aa9aa509b1306410734c135d050f21f7337a1c94e646185a2f016f4f7cb64b7d92719e26cc96bd7aaa73265b366365a145e7b2aa71476fe5202c-22",
2205
- "file": "packages/core/schematics/utils/tooltip-message.ts",
2204
+ "id": "interface-Edit-bdeb132e57974e9cf0ecc701fc740055cb5bf71469a03b748668e1c33e6365cc60701d8ed980432fc5cd62827c42a92a1166a7cfa04156ee9c1f5e504c35781c-22",
2205
+ "file": "packages/core/schematics/migrate-to-signals/index.ts",
2206
2206
  "deprecated": false,
2207
2207
  "deprecationMessage": "",
2208
2208
  "type": "interface",
2209
- "sourceCode": "import { parseTemplate, TmplAstElement } from '@angular/compiler';\nimport { SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { forEachElement } from './template-walk';\n\nconst OLD_INPUT = 'tooltipMessage';\nconst NEW_INPUT = 'euiTooltip';\nconst DIRECTIVE_CLASS = 'EuiTooltipDirective';\nconst DIRECTIVE_PATH = '@eui/components/directives';\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n let result = source;\n for (const edit of [...edits].sort((a, b) => b.start - a.start)) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n\n/**\n * Renames the removed `tooltipMessage` input to `euiTooltip` (static, bound and interpolated forms)\n * on the elements accepted by `isTarget`. Elements already carrying `euiTooltip` are left unchanged and reported.\n */\nexport function renameTooltipMessage(\n source: string,\n isTarget: (element: TmplAstElement) => boolean,\n warn: (message: string) => void,\n): { result: string; renamed: number } {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: Edit[] = [];\n\n const collect = (element: TmplAstElement): void => {\n const candidates = [\n ...element.attributes.filter((a) => a.name === OLD_INPUT),\n ...element.inputs.filter((i) => i.name === OLD_INPUT),\n ];\n if (candidates.length === 0) return;\n\n const hasTooltip = element.attributes.some((a) => a.name === NEW_INPUT) || element.inputs.some((i) => i.name === NEW_INPUT);\n for (const attr of candidates) {\n const start = attr.sourceSpan.start.offset;\n if (hasTooltip) {\n const line = source.slice(0, start).split('\\n').length;\n warn(`line ${line} - \"${OLD_INPUT}\" was removed and \"${NEW_INPUT}\" is already set on <${element.name}>. Remove \"${OLD_INPUT}\" manually.`);\n continue;\n }\n // `sourceSpan` starts at the attribute (`tooltipMessage`, `[tooltipMessage]`, `bind-tooltipMessage`): rename only the key.\n const index = source.indexOf(OLD_INPUT, start);\n if (index === -1 || index >= attr.sourceSpan.end.offset) continue;\n edits.push({ start: index, end: index + OLD_INPUT.length, replacement: NEW_INPUT });\n }\n };\n\n forEachElement(parsed.nodes, (element) => {\n if (isTarget(element)) collect(element);\n });\n return { result: applyEdits(source, edits), renamed: edits.length };\n}\n\ntype ImportTarget = { kind: 'inline' } | { kind: 'templateUrl'; htmlFileName: string };\n\n/**\n * Collects the components that now use `euiTooltip` and adds `EuiTooltipDirective` to their `imports`.\n */\nexport class TooltipImportCollector {\n private readonly pending = new Map<string, ImportTarget[]>();\n\n /** The template is inlined in the component file `tsPath`. */\n addInline(tsPath: string): void {\n this.push(tsPath, { kind: 'inline' });\n }\n\n /** The template lives in `htmlPath`; the owning component is resolved through its `templateUrl`. */\n addExternal(tree: Tree, htmlPath: string): void {\n const slash = htmlPath.lastIndexOf('/');\n const dirPath = slash > 0 ? htmlPath.slice(0, slash) : '/';\n const htmlFileName = htmlPath.slice(slash + 1);\n const dir = tree.getDir(dirPath);\n for (const file of dir.subfiles) {\n if (!file.endsWith('.ts') || file.endsWith('.d.ts') || file.endsWith('.spec.ts')) continue;\n const content = tree.read(`${dir.path}/${file}`)?.toString('utf-8');\n if (content?.includes('templateUrl') && content.includes(htmlFileName)) {\n this.push(`${dir.path}/${file}`, { kind: 'templateUrl', htmlFileName });\n return;\n }\n }\n this.unresolved.push(htmlPath);\n }\n\n private readonly unresolved: string[] = [];\n\n private push(tsPath: string, target: ImportTarget): void {\n const list = this.pending.get(tsPath) ?? [];\n list.push(target);\n this.pending.set(tsPath, list);\n }\n\n apply(tree: Tree, context: SchematicContext): void {\n for (const html of this.unresolved) {\n context.logger.warn(`${html} - could not find the component of this template. Add ${DIRECTIVE_CLASS} to its imports manually.`);\n }\n for (const [tsPath, targets] of this.pending) {\n const original = tree.read(tsPath)?.toString('utf-8');\n if (original === undefined) continue;\n let current = original;\n for (const target of targets) {\n const outcome = addDirectiveImport(current, tsPath, target);\n if (outcome.status === 'manual') {\n context.logger.warn(`${tsPath} - add ${DIRECTIVE_CLASS} (from '${DIRECTIVE_PATH}') to the component \"imports\" manually (${outcome.reason}).`);\n }\n current = outcome.result;\n }\n if (current !== original) tree.overwrite(tsPath, current);\n }\n }\n}\n\nfunction propertyName(prop: ts.ObjectLiteralElementLike): string | null {\n if (!ts.isPropertyAssignment(prop)) return null;\n return ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name) ? prop.name.text : null;\n}\n\nfunction addDirectiveImport(\n source: string,\n filePath: string,\n target: ImportTarget,\n): { result: string; status: 'added' | 'present' | 'manual'; reason?: string } {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n\n const matches = (obj: ts.ObjectLiteralExpression): boolean =>\n obj.properties.some((prop) => {\n const name = propertyName(prop);\n if (!name || !ts.isPropertyAssignment(prop)) return false;\n const init = prop.initializer;\n const text = ts.isStringLiteralLike(init) ? init.text : '';\n if (target.kind === 'inline') return name === 'template' && text.includes(NEW_INPUT);\n return name === 'templateUrl' && text.split('/').pop() === target.htmlFileName;\n });\n\n let component: ts.ObjectLiteralExpression | undefined;\n const find = (node: ts.Node): void => {\n if (component) return;\n if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === 'Component') {\n const arg = node.expression.arguments[0];\n if (arg && ts.isObjectLiteralExpression(arg) && matches(arg)) component = arg;\n }\n ts.forEachChild(node, find);\n };\n find(sourceFile);\n\n if (!component) return { result: source, status: 'manual', reason: 'no matching @Component found' };\n\n const standalone = component.properties.find((p) => propertyName(p) === 'standalone');\n if (standalone && ts.isPropertyAssignment(standalone) && standalone.initializer.kind === ts.SyntaxKind.FalseKeyword) {\n return { result: source, status: 'manual', reason: 'the component is not standalone, update its NgModule' };\n }\n\n const importsProp = component.properties.find((p) => propertyName(p) === 'imports');\n if (!importsProp || !ts.isPropertyAssignment(importsProp) || !ts.isArrayLiteralExpression(importsProp.initializer)) {\n return { result: source, status: 'manual', reason: 'the component has no inline \"imports\" array' };\n }\n\n const array = importsProp.initializer;\n if (array.elements.some((e) => ts.isIdentifier(e) && e.text === DIRECTIVE_CLASS)) {\n return { result: source, status: 'present' };\n }\n\n const edits: Edit[] = [];\n if (array.elements.length > 0) {\n const pos = array.elements[array.elements.length - 1].getEnd();\n edits.push({ start: pos, end: pos, replacement: `, ${DIRECTIVE_CLASS}` });\n } else {\n const pos = array.getStart(sourceFile) + 1;\n edits.push({ start: pos, end: pos, replacement: DIRECTIVE_CLASS });\n }\n\n const imports = sourceFile.statements.filter(ts.isImportDeclaration);\n const existing = imports.find(\n (i) => ts.isStringLiteral(i.moduleSpecifier) && i.moduleSpecifier.text === DIRECTIVE_PATH && i.importClause?.namedBindings && ts.isNamedImports(i.importClause.namedBindings),\n );\n const named = existing?.importClause?.namedBindings;\n if (named && ts.isNamedImports(named)) {\n if (!named.elements.some((e) => e.name.text === DIRECTIVE_CLASS)) {\n if (named.elements.length > 0) {\n const pos = named.elements[named.elements.length - 1].getEnd();\n edits.push({ start: pos, end: pos, replacement: `, ${DIRECTIVE_CLASS}` });\n } else {\n const pos = named.getStart(sourceFile) + 1;\n edits.push({ start: pos, end: pos, replacement: ` ${DIRECTIVE_CLASS} ` });\n }\n }\n } else if (imports.length > 0) {\n const last = imports[imports.length - 1];\n const quote = source[(last.moduleSpecifier as ts.StringLiteral).getStart(sourceFile)] === '\"' ? '\"' : '\\'';\n const pos = last.getEnd();\n edits.push({ start: pos, end: pos, replacement: `\\nimport { ${DIRECTIVE_CLASS} } from ${quote}${DIRECTIVE_PATH}${quote};` });\n } else {\n edits.push({ start: 0, end: 0, replacement: `import { ${DIRECTIVE_CLASS} } from '${DIRECTIVE_PATH}';\\n` });\n }\n\n return { result: applyEdits(source, edits), status: 'added' };\n}\n\n/**\n * Applies `renameTooltipMessage` to a whole file: the file itself for `.html`, the `template: \\`...\\`` literals for `.ts`.\n */\nexport function renameTooltipMessageInFile(\n source: string,\n filePath: string,\n isTarget: (element: TmplAstElement) => boolean,\n warn: (message: string) => void,\n): { result: string; renamed: number } {\n if (filePath.endsWith('.html')) return renameTooltipMessage(source, isTarget, warn);\n\n let renamed = 0;\n const result = source.replace(/template\\s*:\\s*`([^`]*)`/gs, (match, templateContent: string) => {\n if (!templateContent.includes(OLD_INPUT)) return match;\n const migrated = renameTooltipMessage(templateContent, isTarget, warn);\n renamed += migrated.renamed;\n return migrated.result === templateContent ? match : match.replace(templateContent, () => migrated.result);\n });\n return { result, renamed };\n}\n\n/** Reports `x.tooltipMessage` property accesses in TS files, which cannot be migrated automatically. */\nexport function warnTooltipMessageUsages(source: string, filePath: string, context: SchematicContext): void {\n if (!filePath.endsWith('.ts') || filePath.endsWith('.spec.ts') || !source.includes(OLD_INPUT)) return;\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && node.name.text === OLD_INPUT) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(`${filePath}:${line + 1} - \"${OLD_INPUT}\" is no longer an input on eui-chip. Use the \"${NEW_INPUT}\" directive instead.`);\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n}\n",
2209
+ "sourceCode": "import { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { forEachElement } from '../utils/template-walk';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\nimport {\n EUI_SIGNAL_MAP as EUI_SIGNAL_MAP_RAW,\n EUI_SELECTOR_TO_CLASS as EUI_SELECTOR_TO_CLASS_RAW,\n EUI_OUTPUT_MAP,\n EUI_HOST_BINDING_REMOVED_MAP,\n EUI_WRITABLE_SIGNAL_MAP,\n} from './signal-map';\nimport { ECL_SIGNAL_MAP, ECL_SELECTOR_TO_CLASS } from './ecl-signal-map';\n\n/**\n * Combined EUI + ECL signal maps. The migration logic is identical for both\n * libraries (plain field → signal getter), so the maps are merged and the rest\n * of the engine treats them uniformly. EUI and ECL class names don't collide\n * (Eui* vs Ecl* prefixes), and the selector namespaces are disjoint.\n */\nconst EUI_SIGNAL_MAP: Record<string, ReadonlySet<string>> = { ...EUI_SIGNAL_MAP_RAW, ...ECL_SIGNAL_MAP };\nconst EUI_SELECTOR_TO_CLASS: Record<string, string> = { ...EUI_SELECTOR_TO_CLASS_RAW, ...ECL_SELECTOR_TO_CLASS };\n\n/** Every class the schematic knows about (signals, outputs or removed host bindings). */\nconst KNOWN_CLASSES: ReadonlySet<string> = new Set([\n ...Object.keys(EUI_SIGNAL_MAP),\n ...Object.keys(EUI_OUTPUT_MAP),\n ...Object.keys(EUI_HOST_BINDING_REMOVED_MAP),\n]);\nconst isKnownClass = (name: string | null | undefined): name is string => !!name && KNOWN_CLASSES.has(name);\n\n/**\n * Tracked references. Class members are tracked by name (reached via `this.name`); locals/parameters are\n * tracked by their DECLARATION node, so a same-named untracked parameter or variable is never confused\n * with a tracked class member (shadowing). `lists*` hold QueryList<EuiXxx> / EuiXxx[] holders.\n */\ninterface Refs {\n props: Map<string, string>;\n propLists: Map<string, string>;\n decls: Map<ts.Node, string>;\n listDecls: Map<ts.Node, string>;\n}\n\n/** rxjs functions that take Observables as (possibly array-wrapped) arguments. */\nconst OBSERVABLE_COMBINATORS = new Set([\n 'merge', 'race', 'combineLatest', 'forkJoin', 'concat', 'zip', 'firstValueFrom', 'lastValueFrom', 'raceWith', 'mergeWith', 'concatWith', 'zipWith', 'combineLatestWith',\n]);\n\n/** Observable methods that need a real Observable instead of an OutputEmitterRef. */\nconst OBSERVABLE_METHODS = new Set(['subscribe', 'pipe', 'asObservable', 'forEach', 'toPromise']);\n/** QueryList iteration methods whose callback parameter is an element of the list. */\nconst LIST_ITERATION_METHODS = new Set(['forEach', 'map', 'filter', 'some', 'every', 'find', 'findIndex', 'reduce']);\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n /** When several zero-width edits share a position, `after` ones end up after the others. */\n after?: boolean;\n}\n\n/**\n * Migrates consumer code that accesses EUI or ECL component instances\n * programmatically.\n *\n * When EUI/ECL migrated @Input() → input(), @ViewChild() → viewChild(), and\n * @ContentChild() → contentChild(), properties that were plain class fields\n * became signal getters. Consumers who access them via @ViewChild need to\n * change `comp.prop` to `comp.prop()`.\n *\n * This schematic:\n * 1. Finds @ViewChild / @ContentChild fields typed as EUI component classes\n * 2. Resolves untyped @ViewChild('refName') by reading the component template\n * and matching #refName to an EUI element tag/selector\n * 3. Tracks which local variable names hold EUI component references (incl. aliases)\n * 4. Rewrites property accesses on those references: `ref.prop` → `ref.prop()`\n * (only for properties listed in the signal map)\n * 5. Does NOT touch template bindings — those are unaffected by signal migrations\n */\nexport function migrateToSignals(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n let propCount = 0;\n let todoCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n // Skip spec files — test code may use different patterns\n if (path.endsWith('.spec.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n\n // Fast bail: file must mention at least one EUI class name or have\n // ViewChild/ContentChild with string refs (which might reference EUI elements)\n if (!hasEuiReference(original) && !hasStringRefQuery(original)) return;\n\n const result = migrateTypeScript(original, path, tree, context);\n if (result.source !== original) {\n if (options.dryRun) {\n if (result.editCount > 0) {\n logDryRun(context, `Would migrate ${result.editCount} signal property access(es) in ${path}`);\n }\n if (result.todoCount > 0) {\n logDryRun(\n context,\n `Would comment out ${result.todoCount} programmatic signal-input write(s) with a TODO in ${path}`,\n );\n }\n } else {\n tree.overwrite(path, result.source);\n }\n fileCount++;\n propCount += result.editCount;\n todoCount += result.todoCount;\n }\n });\n\n context.logger.info(`Migrated ${propCount} property access(es) to signal getters in ${fileCount} file(s).`);\n if (todoCount > 0) {\n context.logger.info(\n `Commented out ${todoCount} programmatic signal-input write(s) and left a TODO — these cannot be migrated automatically and need a manual fix.`,\n );\n }\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\n/** Quick check: does the file reference any EUI class name from the signal map? */\nfunction hasEuiReference(source: string): boolean {\n for (const className of KNOWN_CLASSES) {\n if (source.includes(className)) return true;\n }\n return false;\n}\n\n/** Quick check: does the file have @ViewChild('...') or @ContentChild('...') with string refs? */\nfunction hasStringRefQuery(source: string): boolean {\n return /(@ViewChild|@ContentChild|@ViewChildren|@ContentChildren)\\s*\\(\\s*['\"]/.test(source);\n}\n\ninterface MigrateResult {\n source: string;\n editCount: number;\n todoCount: number;\n}\n\nfunction migrateTypeScript(source: string, filePath: string, tree: Tree, context: SchematicContext): MigrateResult {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n const todoEdits: Edit[] = [];\n\n // Phase 0: Build template ref map (#refName → EUI class name) from the component's template\n const templateRefMap = buildTemplateRefMap(sourceFile, source, filePath, tree);\n\n // Phase 1: Collect all variables/properties typed as EUI classes\n const euiRefs = collectEuiReferences(sourceFile, source, templateRefMap);\n\n if (euiRefs.props.size === 0 && euiRefs.propLists.size === 0 && euiRefs.decls.size === 0 && euiRefs.listDecls.size === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const hostTodoEdits: Edit[] = [];\n let needsOutputImport = false;\n\n // Phase 2: Find property accesses on those references and rewrite signal props\n const visitNode = (node: ts.Node): void => {\n // Match: ref.prop (PropertyAccessExpression)\n if (ts.isPropertyAccessExpression(node)) {\n const rewrite = tryRewritePropertyAccess(node, euiRefs, sourceFile, source);\n if (rewrite) {\n edits.push(rewrite);\n }\n\n // Writable signal (model()): `ref.prop = value` -> `ref.prop.set(value)`\n edits.push(...trySetRewrite(node, euiRefs, sourceFile));\n\n // Output: `ref.out.subscribe()` -> `outputToObservable(ref.out).subscribe()`\n const wrap = tryWrapOutput(node, euiRefs, sourceFile);\n if (wrap) {\n edits.push(...wrap);\n needsOutputImport = true;\n }\n\n // Output handed to rxjs combinators / used as a value: wrap or flag\n const outputUse = tryOutputUsage(node, euiRefs, sourceFile, source);\n if (outputUse) {\n edits.push(...outputUse.edits);\n if (outputUse.todo) hostTodoEdits.push(outputUse.todo);\n if (outputUse.edits.length > 0) needsOutputImport = true;\n }\n\n // Removed @HostBinding property: flag with a TODO\n const hostTodo = tryHostBindingTodo(node, euiRefs, sourceFile, source);\n if (hostTodo) {\n hostTodoEdits.push(hostTodo);\n }\n\n // Separately: a programmatic WRITE to a now-signal input cannot be\n // migrated automatically. Flag it with a TODO instead of silently\n // leaving a line that will fail to compile against the signal API.\n const todo = tryInsertWriteTodo(node, euiRefs, sourceFile, source);\n if (todo) {\n todoEdits.push(todo);\n }\n }\n // Destructuring / aliasing of a tracked reference cannot be followed: flag it.\n const alias = tryAliasTodo(node, euiRefs, sourceFile, source);\n if (alias) hostTodoEdits.push(alias);\n ts.forEachChild(node, visitNode);\n };\n\n ts.forEachChild(sourceFile, visitNode);\n\n if (edits.length === 0 && todoEdits.length === 0 && hostTodoEdits.length === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const dedupedTodos = deduplicateEdits(todoEdits);\n const dedupedHostTodos = deduplicateEdits(hostTodoEdits);\n\n // A TODO edit comments out the whole write statement. Any read-rewrite `()`\n // edit whose position falls inside that commented-out range must be dropped,\n // otherwise we'd both edit and comment the same text (and produce overlapping\n // edits that corrupt the output).\n const keptEdits = edits.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const keptHostTodos = dedupedHostTodos.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const importEdit = needsOutputImport ? buildOutputImportEdit(sourceFile) : null;\n\n return {\n source: applyEdits(source, [...keptEdits, ...dedupedTodos, ...keptHostTodos, ...(importEdit ? [importEdit] : [])]),\n editCount: keptEdits.length,\n todoCount: dedupedTodos.length + keptHostTodos.length,\n };\n}\n\n/**\n * Scans the source file for class properties or variables typed as EUI component classes.\n * Returns a map: localName → Set of signal property names.\n *\n * Handles:\n * @ViewChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild(EuiXxxComponent) name!: EuiXxxComponent;\n * @ViewChild('ref') name: EuiXxxComponent;\n * @ContentChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild('ref') name: ElementRef; (resolved via template #ref → EUI selector)\n * someVar: EuiXxxComponent; (typed class field, even without decorator)\n * const alias = this.viewChildRef; (alias tracking)\n */\nfunction collectEuiReferences(\n sourceFile: ts.SourceFile,\n source: string,\n templateRefMap: Map<string, string>,\n): Refs {\n const tracked: Refs = { props: new Map(), propLists: new Map(), decls: new Map(), listDecls: new Map() };\n const { props, propLists, decls, listDecls } = tracked;\n\n // Pass 1: collect directly-typed references\n const visitDirect = (node: ts.Node): void => {\n // Class property declarations\n if (ts.isPropertyDeclaration(node) && node.name && ts.isIdentifier(node.name)) {\n const euiClass = resolveEuiClassName(node, sourceFile, templateRefMap);\n if (isKnownClass(euiClass)) {\n (isListProperty(node) ? propLists : props).set(node.name.text, euiClass);\n }\n }\n\n // Variable (const x: EuiXxxComponent = ...) and parameter (method(ref: EuiXxxComponent)) declarations\n if ((ts.isVariableDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n decls.set(node, typeName);\n // constructor parameter property: also reachable as `this.name`\n if (ts.isParameter(node) && (ts.getModifiers?.(node) ?? []).length > 0) props.set(node.name.text, typeName);\n } else {\n const listClass = listElementClass(node.type);\n if (listClass) listDecls.set(node, listClass);\n }\n }\n\n ts.forEachChild(node, visitDirect);\n };\n\n ts.forEachChild(sourceFile, visitDirect);\n\n // Pass 2: aliases, QueryList/array iteration (source order)\n const visitAlias = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && !decls.has(node)) {\n const aliased = trackedClass(node.initializer, tracked);\n if (aliased) decls.set(node, aliased);\n const aliasedList = listClassOf(node.initializer, tracked);\n if (aliasedList) listDecls.set(node, aliasedList);\n }\n\n // list.forEach((el) => ...) / list.map(function (el) {...}) -> `el` is an element of the list\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n LIST_ITERATION_METHODS.has(node.expression.name.text)\n ) {\n const listClass = listClassOf(node.expression.expression, tracked);\n const callback = node.arguments[0];\n if (\n listClass &&\n callback &&\n (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) &&\n callback.parameters[0] &&\n ts.isIdentifier(callback.parameters[0].name) &&\n !callback.parameters[0].type\n ) {\n decls.set(callback.parameters[0], listClass);\n }\n }\n\n // for (const el of list) -> `el` is an element of the list\n if (ts.isForOfStatement(node) && ts.isVariableDeclarationList(node.initializer)) {\n const listClass = listClassOf(node.expression, tracked);\n const decl = node.initializer.declarations[0];\n if (listClass && decl && ts.isIdentifier(decl.name) && !decls.has(decl)) decls.set(decl, listClass);\n }\n\n ts.forEachChild(node, visitAlias);\n };\n\n ts.forEachChild(sourceFile, visitAlias);\n return tracked;\n}\n\n/** `EuiXxx[]`, `Array<EuiXxx>`, `QueryList<EuiXxx>` -> the known element class. */\nfunction listElementClass(type: ts.TypeNode | undefined): string | null {\n if (!type) return null;\n if (ts.isArrayTypeNode(type)) {\n const n = getTypeAnnotationName(type.elementType);\n return isKnownClass(n) ? n : null;\n }\n if (ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && ['Array', 'ReadonlyArray', 'QueryList'].includes(type.typeName.text)) {\n const n = getTypeAnnotationName(type.typeArguments?.[0]);\n return isKnownClass(n) ? n : null;\n }\n return null;\n}\n\n/** Strips parentheses, `!`, `as T`, `<T>x` and `satisfies`. */\nfunction unwrap(expr: ts.Expression): ts.Expression {\n let cur = expr;\n while (\n ts.isParenthesizedExpression(cur) ||\n ts.isNonNullExpression(cur) ||\n ts.isAsExpression(cur) ||\n ts.isTypeAssertionExpression(cur) ||\n ts.isSatisfiesExpression(cur)\n ) {\n cur = cur.expression;\n }\n return cur;\n}\n\n/** Nearest declaration (parameter / variable / binding element) of a bare identifier, or null. */\nfunction findDeclaration(id: ts.Identifier): ts.Node | null {\n const name = id.text;\n const boundIn = (bn: ts.BindingName): boolean =>\n ts.isIdentifier(bn) ? bn.text === name : bn.elements.some((e) => !ts.isOmittedExpression(e) && boundIn(e.name));\n const matchDecl = (d: ts.ParameterDeclaration | ts.VariableDeclaration): ts.Node | null => (boundIn(d.name) ? d : null);\n\n for (let cur: ts.Node | undefined = id.parent; cur; cur = cur.parent) {\n if (ts.isFunctionLike(cur)) {\n for (const p of cur.parameters) {\n const m = matchDecl(p);\n if (m) return m;\n }\n }\n if (ts.isBlock(cur) || ts.isSourceFile(cur) || ts.isModuleBlock(cur) || ts.isCaseClause(cur) || ts.isDefaultClause(cur)) {\n const stmts = ts.isCaseClause(cur) || ts.isDefaultClause(cur) ? cur.statements : cur.statements;\n for (const st of stmts) {\n if (ts.isVariableStatement(st)) {\n for (const d of st.declarationList.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n }\n }\n if ((ts.isForStatement(cur) || ts.isForOfStatement(cur) || ts.isForInStatement(cur)) && cur.initializer && ts.isVariableDeclarationList(cur.initializer)) {\n for (const d of cur.initializer.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n if (ts.isCatchClause(cur) && cur.variableDeclaration) {\n const m = matchDecl(cur.variableDeclaration);\n if (m) return m;\n }\n }\n return null;\n}\n\n/** `this.name` -> name; anything else null. */\nfunction thisMemberName(expr: ts.Expression): string | null {\n return ts.isPropertyAccessExpression(expr) && expr.expression.kind === ts.SyntaxKind.ThisKeyword ? expr.name.text : null;\n}\n\n/** Element class of a tracked QueryList / array expression, or null. */\nfunction listClassOf(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.listDecls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n return member ? (tracked.propLists.get(member) ?? null) : null;\n}\n\n/**\n * Resolves the EUI class name from a property declaration.\n * Checks: type annotation → decorator class argument → template ref map.\n */\nfunction resolveEuiClassName(\n node: ts.PropertyDeclaration,\n sourceFile: ts.SourceFile,\n templateRefMap: Map<string, string>,\n): string | null {\n // Check type annotation first\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n return typeName;\n }\n\n const arrayClass = listElementClass(node.type);\n if (arrayClass) return arrayClass;\n\n // Check generic type argument: ElementRef<EuiXxxComponent> / QueryList<EuiXxxComponent>\n if (node.type && ts.isTypeReferenceNode(node.type) && node.type.typeArguments?.length) {\n const genericArg = getTypeAnnotationName(node.type.typeArguments[0]);\n if (isKnownClass(genericArg)) {\n return genericArg;\n }\n }\n\n // Check decorator arguments: @ViewChild(EuiXxxComponent) or @ViewChild('refName')\n if (node.modifiers) {\n for (const modifier of node.modifiers) {\n if (!ts.isDecorator(modifier)) continue;\n if (!ts.isCallExpression(modifier.expression)) continue;\n\n const decoratorName = getDecoratorName(modifier.expression);\n if (!decoratorName) continue;\n if (!['ViewChild', 'ViewChildren', 'ContentChild', 'ContentChildren'].includes(decoratorName)) continue;\n\n const args = modifier.expression.arguments;\n if (args.length > 0) {\n const firstArg = args[0];\n\n // @ViewChild(EuiXxxComponent) — class reference\n if (ts.isIdentifier(firstArg) && isKnownClass(firstArg.text)) {\n return firstArg.text;\n }\n\n // @ViewChild('refName') — string template ref, resolve via template\n if (ts.isStringLiteralLike(firstArg)) {\n const refName = firstArg.text;\n const euiClass = templateRefMap.get(refName);\n if (isKnownClass(euiClass)) {\n return euiClass;\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/** True for `@ViewChildren/@ContentChildren` fields and `QueryList<...>`-typed fields. */\nfunction isListProperty(node: ts.PropertyDeclaration): boolean {\n if (listElementClass(node.type)) return true;\n if (node.type && ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName) && node.type.typeName.text === 'QueryList') {\n return true;\n }\n return (ts.getDecorators?.(node) ?? []).some(\n (d) => ts.isCallExpression(d.expression) && ['ViewChildren', 'ContentChildren'].includes(getDecoratorName(d.expression) ?? ''),\n );\n}\n\n/**\n * Resolves an expression to the tracked EUI class: `ref`, `this.ref`, `this.ref!`, `(this.ref as any)`,\n * the `.first` / `.last` element of a tracked QueryList, or `list[i]` of a tracked list/array.\n */\nfunction trackedClass(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.decls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n if (member) return tracked.props.get(member) ?? null;\n if (ts.isPropertyAccessExpression(e) && (e.name.text === 'first' || e.name.text === 'last')) {\n return listClassOf(e.expression, tracked);\n }\n if (ts.isElementAccessExpression(e)) return listClassOf(e.expression, tracked);\n return null;\n}\n\nfunction getDecoratorName(callExpr: ts.CallExpression): string | null {\n if (ts.isIdentifier(callExpr.expression)) {\n return callExpr.expression.text;\n }\n return null;\n}\n\nfunction getTypeAnnotationName(typeNode: ts.TypeNode | undefined): string | null {\n if (!typeNode) return null;\n if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n return null;\n}\n\n/**\n * Checks if a property access `ref.prop` should be rewritten to `ref.prop()`.\n *\n * We rewrite if:\n * - `ref` is tracked in euiRefs\n * - `prop` is in the signal set for that EUI class\n * - The access is NOT already a call expression (not `ref.prop()` or `ref.prop(args)`)\n * - The access is NOT a write target (not `ref.prop = value`)\n * - The access is NOT a template binding argument (those are unaffected)\n */\nfunction tryRewritePropertyAccess(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n // Resolve the reference class — handle `this.ref.prop`, `ref.prop`, `list.first.prop`\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Skip if parent is already a call expression on this property: ref.prop(...)\n if (ts.isCallExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip a signal handed to toObservable(ref.prop): it needs the signal itself (e.g. written by migrate-eui-tab-signals)\n if (ts.isCallExpression(node.parent) && node.parent.arguments[0] === node &&\n ts.isIdentifier(node.parent.expression) && node.parent.expression.text === 'toObservable') {\n return null;\n }\n\n // Skip signal API access already in place: ref.prop.set(..) / .update(..) / .asReadonly()\n if (ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node &&\n ['set', 'update', 'asReadonly'].includes(node.parent.name.text)) {\n return null;\n }\n\n // Skip if this is the left side of an assignment: ref.prop = value\n if (ts.isBinaryExpression(node.parent) &&\n node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n node.parent.left === node) {\n return null;\n }\n\n // Skip if this is a compound assignment: ref.prop += value, ref.prop &&= value, etc.\n if (ts.isBinaryExpression(node.parent) && isAssignmentOperator(node.parent.operatorToken.kind) && node.parent.left === node) {\n return null;\n }\n\n // Skip if this is used with delete: delete ref.prop\n if (ts.isDeleteExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip if inside a typeof: typeof ref.prop\n if (ts.isTypeOfExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip property access chains that go deeper: ref.prop.something → ref.prop().something\n // This IS correct — we still want to add ()\n\n // Rewrite: insert () after the property name\n const end = node.name.getEnd();\n return {\n start: end,\n end: end,\n replacement: '()',\n };\n}\n\nfunction isAssignmentOperator(kind: ts.SyntaxKind): boolean {\n return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;\n}\n\n/** Marker used to detect an already-inserted TODO so the schematic stays idempotent. */\nconst WRITE_TODO_MARKER = 'TODO(eui-signals):';\n\n/**\n * Detects a programmatic WRITE to a now-signal input and returns an edit that\n * comments out the offending statement and prepends an explanatory TODO.\n *\n * A signal input (`input()`) exposes a read-only getter — it cannot be assigned\n * from outside the component (`comp.prop = value` no longer compiles, and\n * `comp.prop()` is a getter, not a setter). There is no safe, mechanical\n * rewrite: the correct fix is to drive the value declaratively through a\n * template binding (`[prop]=\"...\"`) or, when a ComponentRef is genuinely\n * available, `componentRef.setInput('prop', value)`. Both require human\n * judgement, so instead of rewriting we comment the statement out (keeping the\n * build green) and leave a TODO pointing at the manual fix.\n *\n * Only acts when the assignment is the ENTIRE statement\n * (`ExpressionStatement` whose expression is exactly this assignment):\n * ref.prop = value (simple assignment)\n * ref.prop += value, etc. (compound assignment)\n * where `ref` is a tracked EUI/ECL reference and `prop` is in its signal set.\n *\n * When the write is only part of a larger statement (e.g. inside an `if`\n * without a block, or nested in another expression), commenting it out would\n * also remove unrelated logic, so we leave it untouched (it will surface as a\n * compile error the developer must resolve by hand).\n */\nfunction tryInsertWriteTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Only act on assignment targets: `ref.prop = ...` or `ref.prop <op>= ...`\n if (\n !ts.isBinaryExpression(node.parent) ||\n node.parent.left !== node ||\n !isAssignmentOperator(node.parent.operatorToken.kind)\n ) {\n return null;\n }\n\n const assignment = node.parent;\n\n // A plain `=` to a writable signal is migrated to `.set()` by trySetRewrite\n if (assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken && EUI_WRITABLE_SIGNAL_MAP[cls]?.has(propName)) {\n return null;\n }\n\n // Only comment out when the assignment IS the whole statement — otherwise we'd\n // delete unrelated logic from a larger statement.\n const statement = node.parent.parent;\n if (!statement || !ts.isExpressionStatement(statement) || statement.expression !== assignment) {\n return null;\n }\n\n // The statement must stand on its own (a direct child of a block/source), not\n // be the unbraced body of an `if`/`for`/`while` etc. — commenting those out by\n // line would swallow the surrounding `if (...)` and break the code.\n const parent = statement.parent;\n if (\n !parent ||\n !(ts.isBlock(parent) || ts.isSourceFile(parent) || ts.isModuleBlock(parent) || ts.isCaseClause(parent) || ts.isDefaultClause(parent))\n ) {\n return null;\n }\n\n const stmtStart = statement.getStart(sourceFile);\n const stmtEnd = statement.getEnd(); // includes the trailing semicolon\n const lineStart = getLineStartPosition(source, stmtStart);\n const indent = source.slice(lineStart, stmtStart);\n\n // Commenting works per line: the statement must be alone on its lines, otherwise\n // (e.g. `run() { ref.prop = 1; }`) we would comment out surrounding code.\n const eol = source.indexOf('\\n', stmtEnd);\n const restOfLine = source.slice(stmtEnd, eol === -1 ? source.length : eol);\n if (indent.trim() !== '' || restOfLine.trim() !== '') {\n return null;\n }\n\n // The statement text, as written (may span multiple lines).\n const statementText = source.slice(stmtStart, stmtEnd);\n\n // Comment out every line of the statement, preserving each line's own\n // indentation (insert `// ` after the leading whitespace). The first line's\n // indentation was stripped by starting the replacement at lineStart, so we\n // re-add it explicitly.\n const commentedStatement = statementText\n .split('\\n')\n .map((line, i) => {\n if (i === 0) return `${indent}// ${line}`;\n const lineIndent = line.slice(0, line.length - line.trimStart().length);\n return `${lineIndent}// ${line.trimStart()}`;\n })\n .join('\\n');\n\n const todo =\n `${indent}// ${WRITE_TODO_MARKER} '${propName}' is now a signal input and cannot be assigned directly.\\n` +\n `${indent}// Set it via a template binding ([${propName}]=\"...\") or componentRef.setInput('${propName}', ...).\\n` +\n `${indent}// The original statement is commented out below so the build does not fail:\\n`;\n\n // Replace the statement (from the start of its line, to drop the original\n // indentation we re-add) with the TODO + commented-out statement.\n return {\n start: lineStart,\n end: stmtEnd,\n replacement: todo + commentedStatement,\n };\n}\n\n/** `ref.prop = value;` on a writable signal -> `ref.prop.set(value);` (two zero-width-safe edits). */\nfunction trySetRewrite(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] {\n const assignment = node.parent;\n if (\n !ts.isBinaryExpression(assignment) ||\n assignment.left !== node ||\n assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken ||\n !ts.isExpressionStatement(assignment.parent)\n ) {\n return [];\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_WRITABLE_SIGNAL_MAP[cls]?.has(node.name.text)) return [];\n\n return [\n { start: node.getEnd(), end: assignment.right.getStart(sourceFile), replacement: '.set(' },\n { start: assignment.right.getEnd(), end: assignment.right.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** `ref.out.subscribe(...)` -> `outputToObservable(ref.out).subscribe(...)`. */\nfunction tryWrapOutput(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] | null {\n const parent = node.parent;\n if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node || !OBSERVABLE_METHODS.has(parent.name.text)) {\n return null;\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n\n const start = node.getStart(sourceFile);\n return [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** Marker for a read of a property that was a @HostBinding and no longer exists. */\nconst HOST_TODO_MARKER = 'TODO(eui-signals):';\n\nfunction tryHostBindingTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_HOST_BINDING_REMOVED_MAP[cls]?.has(propName) || EUI_SIGNAL_MAP[cls]?.has(propName)) return null;\n return flagTodo(\n node,\n sourceFile,\n source,\n `'${propName}' was a @HostBinding`,\n `'${propName}' was a @HostBinding property of ${cls} and no longer exists on the instance ` +\n '(moved to static host metadata). Remove or replace this access.',\n );\n}\n\n/**\n * Inserts a `// TODO(eui-signals): <message>` line above the enclosing statement / class member.\n * `key` identifies the TODO for idempotency (looked for in the comment lines right above).\n */\nfunction flagTodo(node: ts.Node, sourceFile: ts.SourceFile, source: string, key: string, message: string): Edit | null {\n // Anchor on the enclosing statement / class member\n let anchor: ts.Node = node;\n while (\n anchor.parent &&\n !(\n ts.isBlock(anchor.parent) ||\n ts.isSourceFile(anchor.parent) ||\n ts.isModuleBlock(anchor.parent) ||\n ts.isCaseClause(anchor.parent) ||\n ts.isDefaultClause(anchor.parent) ||\n ts.isClassLike(anchor.parent)\n )\n ) {\n anchor = anchor.parent;\n }\n\n const lineStart = getLineStartPosition(source, anchor.getStart(sourceFile));\n const indent = source.slice(lineStart).match(/^[ \\t]*/)![0];\n const text = `${indent}// ${HOST_TODO_MARKER} ${message}\\n`;\n\n // Idempotent: look at the contiguous comment lines right above\n const above = source.slice(0, lineStart).split('\\n').slice(-8).reverse();\n for (const line of above.slice(1)) {\n if (!line.trim().startsWith('//')) break;\n if (line.includes(`${HOST_TODO_MARKER} ${key}`) || line.includes(key)) return null;\n }\n // A single-line anchor like `run() { ... }` shares its line with other code: still fine, the comment goes above the line.\n return { start: lineStart, end: lineStart, replacement: text };\n}\n\n/**\n * An output (OutputEmitterRef) used as a value:\n * - an argument of an rxjs combinator (`merge(ref.out, ...)`, also inside an array) is wrapped in `outputToObservable()`;\n * - any other use that is not `.emit()` / `.subscribe()` & co / already wrapped is flagged with a TODO.\n */\nfunction tryOutputUsage(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): { edits: Edit[]; todo?: Edit | null } | null {\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n const parent = node.parent;\n\n // handled elsewhere (tryWrapOutput) or fine as is\n if (ts.isPropertyAccessExpression(parent) && parent.expression === node) return null;\n if (ts.isNonNullExpression(parent) || ts.isParenthesizedExpression(parent) || ts.isAsExpression(parent)) return null;\n // declared / written outputs are not reads\n if (ts.isBinaryExpression(parent) && parent.left === node) return null;\n\n // argument of a combinator?\n let arg: ts.Node = node;\n if (ts.isArrayLiteralExpression(arg.parent)) arg = arg.parent;\n const call = arg.parent;\n if (ts.isCallExpression(call) && call.arguments.includes(arg as ts.Expression)) {\n const callee = ts.isIdentifier(call.expression) ? call.expression.text : null;\n if (callee === 'outputToObservable') return null; // already migrated\n if (callee && OBSERVABLE_COMBINATORS.has(callee)) {\n const start = node.getStart(sourceFile);\n return {\n edits: [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ],\n };\n }\n }\n\n return {\n edits: [],\n todo: flagTodo(\n node,\n sourceFile,\n source,\n `output '${node.name.text}'`,\n `output '${node.name.text}' of ${cls} is an OutputEmitterRef, not an Observable. Wrap it with outputToObservable() ` +\n '(@angular/core/rxjs-interop) where an Observable is needed.',\n ),\n };\n}\n\n/** Destructuring of a tracked reference, or storing it in a field/variable we cannot follow. */\nfunction tryAliasTodo(node: ts.Node, euiRefs: Refs, sourceFile: ts.SourceFile, source: string): Edit | null {\n if (ts.isVariableDeclaration(node) && node.initializer && !ts.isIdentifier(node.name)) {\n const cls = trackedClass(node.initializer, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `destructuring of ${cls}`,\n `destructuring of ${cls} cannot be migrated automatically: its signal inputs/outputs must be read as ref.prop() / outputToObservable(ref.out).`,\n );\n }\n }\n if (\n ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n !ts.isIdentifier(unwrap(node.left)) &&\n ts.isExpressionStatement(node.parent)\n ) {\n const cls = trackedClass(node.right, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `aliasing of ${cls}`,\n `aliasing of ${cls}: this copy is not tracked, so its signal inputs/outputs must be updated manually (ref.prop()).`,\n );\n }\n }\n return null;\n}\n\n/** Adds `outputToObservable` to the file's imports (merging into an existing rxjs-interop import). */\nfunction buildOutputImportEdit(sourceFile: ts.SourceFile): Edit | null {\n let lastImportEnd = 0;\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n lastImportEnd = stmt.getEnd();\n if (!ts.isStringLiteral(stmt.moduleSpecifier) || stmt.moduleSpecifier.text !== '@angular/core/rxjs-interop') continue;\n const bindings = stmt.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings)) {\n if (bindings.elements.some((e) => e.name.text === 'outputToObservable')) return null;\n const last = bindings.elements[bindings.elements.length - 1];\n if (last) {\n return { start: last.getEnd(), end: last.getEnd(), replacement: ', outputToObservable' };\n }\n }\n }\n const line = 'import { outputToObservable } from \\'@angular/core/rxjs-interop\\';';\n return lastImportEnd === 0\n ? { start: 0, end: 0, replacement: `${line}\\n` }\n : { start: lastImportEnd, end: lastImportEnd, replacement: `\\n${line}` };\n}\n\n/** True if `edit`'s position falls within any of the given ranges. */\nfunction isInsideAnyRange(edit: Edit, ranges: Edit[]): boolean {\n return ranges.some((range) => edit.start >= range.start && edit.end <= range.end);\n}\n\n/** Returns the index of the first character of the line containing `pos`. */\nfunction getLineStartPosition(source: string, pos: number): number {\n const newlineIndex = source.lastIndexOf('\\n', pos - 1);\n return newlineIndex === -1 ? 0 : newlineIndex + 1;\n}\n\n// ---------------------------------------------------------------------------\n// Template ref resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Builds a map of template reference variable names (#ref) to EUI class names.\n *\n * Parses the component's template (inline or external) and finds elements like:\n * <eui-alert #myAlert> → myAlert → EuiAlertComponent\n * <input euiAutocomplete #ac> → ac → EuiAutocompleteComponent\n *\n * Returns Map<refName, euiClassName>.\n */\nfunction buildTemplateRefMap(\n sourceFile: ts.SourceFile,\n source: string,\n filePath: string,\n tree: Tree,\n): Map<string, string> {\n const refMap = new Map<string, string>();\n\n // Find @Component decorator\n const componentMeta = findComponentMetadata(sourceFile, source);\n if (!componentMeta) return refMap;\n\n let templateSource: string | null = null;\n\n if (componentMeta.inlineTemplate !== null) {\n templateSource = componentMeta.inlineTemplate;\n } else if (componentMeta.templateUrl) {\n // Resolve templateUrl relative to the TS file\n const dir = filePath.substring(0, filePath.lastIndexOf('/'));\n const templatePath = `${dir}/${componentMeta.templateUrl}`;\n const buffer = tree.read(templatePath);\n if (buffer) {\n templateSource = buffer.toString('utf-8');\n }\n }\n\n if (!templateSource) return refMap;\n\n // Parse the template and collect #refs\n try {\n const parsed = parseTemplate(templateSource, '', { preserveWhitespaces: true });\n collectTemplateRefs(parsed.nodes, refMap);\n } catch {\n // Template parse failure — silently skip (might be malformed or use third-party syntax)\n }\n\n return refMap;\n}\n\n/**\n * Extracts @Component metadata: templateUrl or inline template content.\n */\nfunction findComponentMetadata(\n sourceFile: ts.SourceFile,\n source: string,\n): { templateUrl: string | null; inlineTemplate: string | null } | null {\n let result: { templateUrl: string | null; inlineTemplate: string | null } | null = null;\n\n const visit = (node: ts.Node): void => {\n if (result) return;\n\n if (ts.isDecorator(node) && ts.isCallExpression(node.expression)) {\n const name = getDecoratorName(node.expression);\n if (name !== 'Component') {\n ts.forEachChild(node, visit);\n return;\n }\n\n const args = node.expression.arguments;\n if (args.length === 0 || !ts.isObjectLiteralExpression(args[0])) {\n ts.forEachChild(node, visit);\n return;\n }\n\n const meta: { templateUrl: string | null; inlineTemplate: string | null } = {\n templateUrl: null,\n inlineTemplate: null,\n };\n\n for (const prop of args[0].properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue;\n\n if (prop.name.text === 'templateUrl') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.templateUrl = init.text;\n }\n }\n\n if (prop.name.text === 'template') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.inlineTemplate = init.text;\n } else if (ts.isNoSubstitutionTemplateLiteral(init)) {\n meta.inlineTemplate = init.text;\n }\n }\n }\n\n result = meta;\n return;\n }\n\n ts.forEachChild(node, visit);\n };\n\n ts.forEachChild(sourceFile, visit);\n return result;\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression;\n while (ts.isParenthesizedExpression(current)) current = current.expression;\n return current;\n}\n\n/**\n * Recursively walks template AST nodes, collecting #refName → EUI class name mappings.\n *\n * For each element with a template reference (#ref), we try to resolve its EUI class:\n * 1. Match element tag name against EUI_SELECTOR_TO_CLASS (e.g. 'eui-alert' → EuiAlertComponent)\n * 2. Match element attributes against attribute selectors (e.g. [euiAutocomplete] → EuiAutocompleteComponent)\n */\nfunction collectTemplateRefs(nodes: TmplAstNode[], refMap: Map<string, string>): void {\n forEachElement(nodes, (node) => {\n if (node.references === undefined || node.references.length === 0) return;\n const euiClass = resolveElementToEuiClass(node);\n if (!euiClass) return;\n for (const ref of node.references) {\n refMap.set(ref.name, euiClass);\n }\n });\n}\n\n/**\n * Given a template element, resolves it to an EUI class name by checking:\n * 1. Tag name: <eui-alert> → look up 'eui-alert' in EUI_SELECTOR_TO_CLASS\n * 2. Attribute selectors: <input euiAutocomplete> → look up 'input[euiAutocomplete]' or '[euiAutocomplete]'\n */\nfunction resolveElementToEuiClass(element: TmplAstElement): string | null {\n const tag = element.name;\n\n // Direct tag match: eui-alert, eui-dialog, etc.\n if (EUI_SELECTOR_TO_CLASS[tag]) {\n return EUI_SELECTOR_TO_CLASS[tag];\n }\n\n // Attribute selector match: check all attributes against known patterns\n const allAttrNames = [\n ...element.attributes.map((a) => a.name),\n ...element.inputs.map((i) => i.name),\n ];\n\n for (const attrName of allAttrNames) {\n // Try tag[attr] pattern first (e.g. 'button[euiButton]', 'input[euiAutocomplete]')\n const tagAttrSelector = `${tag}[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[tagAttrSelector]) {\n return EUI_SELECTOR_TO_CLASS[tagAttrSelector];\n }\n\n // Try [attr] pattern (e.g. '[euiTooltip]', '[euiLoading]')\n const attrSelector = `[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[attrSelector]) {\n return EUI_SELECTOR_TO_CLASS[attrSelector];\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Edit helpers\n// ---------------------------------------------------------------------------\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n // Descending by position; at equal positions `after` edits are applied first so they land last.\n for (const edit of unique.sort((a, b) => b.start - a.start || Number(!!b.after) - Number(!!a.after))) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}:${edit.replacement}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n",
2210
2210
  "displayName": "Edit",
2211
2211
  "properties": [
2212
+ {
2213
+ "name": "after",
2214
+ "coverageIgnore": false,
2215
+ "deprecated": false,
2216
+ "deprecationMessage": "",
2217
+ "type": "boolean",
2218
+ "indexKey": "",
2219
+ "optional": true,
2220
+ "description": "<p>When several zero-width edits share a position, <code>after</code> ones end up after the others.</p>\n",
2221
+ "line": 64,
2222
+ "rawdescription": "\nWhen several zero-width edits share a position, `after` ones end up after the others."
2223
+ },
2212
2224
  {
2213
2225
  "name": "end",
2214
2226
  "coverageIgnore": false,
@@ -2218,7 +2230,7 @@
2218
2230
  "indexKey": "",
2219
2231
  "optional": false,
2220
2232
  "description": "",
2221
- "line": 13,
2233
+ "line": 61,
2222
2234
  "rawdescription": "\n"
2223
2235
  },
2224
2236
  {
@@ -2230,7 +2242,7 @@
2230
2242
  "indexKey": "",
2231
2243
  "optional": false,
2232
2244
  "description": "",
2233
- "line": 14,
2245
+ "line": 62,
2234
2246
  "rawdescription": "\n"
2235
2247
  },
2236
2248
  {
@@ -2242,7 +2254,7 @@
2242
2254
  "indexKey": "",
2243
2255
  "optional": false,
2244
2256
  "description": "",
2245
- "line": 12,
2257
+ "line": 60,
2246
2258
  "rawdescription": "\n"
2247
2259
  }
2248
2260
  ],
@@ -2260,26 +2272,14 @@
2260
2272
  },
2261
2273
  {
2262
2274
  "name": "Edit",
2263
- "id": "interface-Edit-bdeb132e57974e9cf0ecc701fc740055cb5bf71469a03b748668e1c33e6365cc60701d8ed980432fc5cd62827c42a92a1166a7cfa04156ee9c1f5e504c35781c-23",
2264
- "file": "packages/core/schematics/migrate-to-signals/index.ts",
2275
+ "id": "interface-Edit-1f2d4cb62366aa9aa509b1306410734c135d050f21f7337a1c94e646185a2f016f4f7cb64b7d92719e26cc96bd7aaa73265b366365a145e7b2aa71476fe5202c-23",
2276
+ "file": "packages/core/schematics/utils/tooltip-message.ts",
2265
2277
  "deprecated": false,
2266
2278
  "deprecationMessage": "",
2267
2279
  "type": "interface",
2268
- "sourceCode": "import { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { forEachElement } from '../utils/template-walk';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\nimport {\n EUI_SIGNAL_MAP as EUI_SIGNAL_MAP_RAW,\n EUI_SELECTOR_TO_CLASS as EUI_SELECTOR_TO_CLASS_RAW,\n EUI_OUTPUT_MAP,\n EUI_HOST_BINDING_REMOVED_MAP,\n EUI_WRITABLE_SIGNAL_MAP,\n} from './signal-map';\nimport { ECL_SIGNAL_MAP, ECL_SELECTOR_TO_CLASS } from './ecl-signal-map';\n\n/**\n * Combined EUI + ECL signal maps. The migration logic is identical for both\n * libraries (plain field → signal getter), so the maps are merged and the rest\n * of the engine treats them uniformly. EUI and ECL class names don't collide\n * (Eui* vs Ecl* prefixes), and the selector namespaces are disjoint.\n */\nconst EUI_SIGNAL_MAP: Record<string, ReadonlySet<string>> = { ...EUI_SIGNAL_MAP_RAW, ...ECL_SIGNAL_MAP };\nconst EUI_SELECTOR_TO_CLASS: Record<string, string> = { ...EUI_SELECTOR_TO_CLASS_RAW, ...ECL_SELECTOR_TO_CLASS };\n\n/** Every class the schematic knows about (signals, outputs or removed host bindings). */\nconst KNOWN_CLASSES: ReadonlySet<string> = new Set([\n ...Object.keys(EUI_SIGNAL_MAP),\n ...Object.keys(EUI_OUTPUT_MAP),\n ...Object.keys(EUI_HOST_BINDING_REMOVED_MAP),\n]);\nconst isKnownClass = (name: string | null | undefined): name is string => !!name && KNOWN_CLASSES.has(name);\n\n/**\n * Tracked references. Class members are tracked by name (reached via `this.name`); locals/parameters are\n * tracked by their DECLARATION node, so a same-named untracked parameter or variable is never confused\n * with a tracked class member (shadowing). `lists*` hold QueryList<EuiXxx> / EuiXxx[] holders.\n */\ninterface Refs {\n props: Map<string, string>;\n propLists: Map<string, string>;\n decls: Map<ts.Node, string>;\n listDecls: Map<ts.Node, string>;\n}\n\n/** rxjs functions that take Observables as (possibly array-wrapped) arguments. */\nconst OBSERVABLE_COMBINATORS = new Set([\n 'merge', 'race', 'combineLatest', 'forkJoin', 'concat', 'zip', 'firstValueFrom', 'lastValueFrom', 'raceWith', 'mergeWith', 'concatWith', 'zipWith', 'combineLatestWith',\n]);\n\n/** Observable methods that need a real Observable instead of an OutputEmitterRef. */\nconst OBSERVABLE_METHODS = new Set(['subscribe', 'pipe', 'asObservable', 'forEach', 'toPromise']);\n/** QueryList iteration methods whose callback parameter is an element of the list. */\nconst LIST_ITERATION_METHODS = new Set(['forEach', 'map', 'filter', 'some', 'every', 'find', 'findIndex', 'reduce']);\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n /** When several zero-width edits share a position, `after` ones end up after the others. */\n after?: boolean;\n}\n\n/**\n * Migrates consumer code that accesses EUI or ECL component instances\n * programmatically.\n *\n * When EUI/ECL migrated @Input() → input(), @ViewChild() → viewChild(), and\n * @ContentChild() → contentChild(), properties that were plain class fields\n * became signal getters. Consumers who access them via @ViewChild need to\n * change `comp.prop` to `comp.prop()`.\n *\n * This schematic:\n * 1. Finds @ViewChild / @ContentChild fields typed as EUI component classes\n * 2. Resolves untyped @ViewChild('refName') by reading the component template\n * and matching #refName to an EUI element tag/selector\n * 3. Tracks which local variable names hold EUI component references (incl. aliases)\n * 4. Rewrites property accesses on those references: `ref.prop` → `ref.prop()`\n * (only for properties listed in the signal map)\n * 5. Does NOT touch template bindings — those are unaffected by signal migrations\n */\nexport function migrateToSignals(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n let propCount = 0;\n let todoCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n // Skip spec files — test code may use different patterns\n if (path.endsWith('.spec.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n\n // Fast bail: file must mention at least one EUI class name or have\n // ViewChild/ContentChild with string refs (which might reference EUI elements)\n if (!hasEuiReference(original) && !hasStringRefQuery(original)) return;\n\n const result = migrateTypeScript(original, path, tree, context);\n if (result.source !== original) {\n if (options.dryRun) {\n if (result.editCount > 0) {\n logDryRun(context, `Would migrate ${result.editCount} signal property access(es) in ${path}`);\n }\n if (result.todoCount > 0) {\n logDryRun(\n context,\n `Would comment out ${result.todoCount} programmatic signal-input write(s) with a TODO in ${path}`,\n );\n }\n } else {\n tree.overwrite(path, result.source);\n }\n fileCount++;\n propCount += result.editCount;\n todoCount += result.todoCount;\n }\n });\n\n context.logger.info(`Migrated ${propCount} property access(es) to signal getters in ${fileCount} file(s).`);\n if (todoCount > 0) {\n context.logger.info(\n `Commented out ${todoCount} programmatic signal-input write(s) and left a TODO — these cannot be migrated automatically and need a manual fix.`,\n );\n }\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\n/** Quick check: does the file reference any EUI class name from the signal map? */\nfunction hasEuiReference(source: string): boolean {\n for (const className of KNOWN_CLASSES) {\n if (source.includes(className)) return true;\n }\n return false;\n}\n\n/** Quick check: does the file have @ViewChild('...') or @ContentChild('...') with string refs? */\nfunction hasStringRefQuery(source: string): boolean {\n return /(@ViewChild|@ContentChild|@ViewChildren|@ContentChildren)\\s*\\(\\s*['\"]/.test(source);\n}\n\ninterface MigrateResult {\n source: string;\n editCount: number;\n todoCount: number;\n}\n\nfunction migrateTypeScript(source: string, filePath: string, tree: Tree, context: SchematicContext): MigrateResult {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n const todoEdits: Edit[] = [];\n\n // Phase 0: Build template ref map (#refName → EUI class name) from the component's template\n const templateRefMap = buildTemplateRefMap(sourceFile, source, filePath, tree);\n\n // Phase 1: Collect all variables/properties typed as EUI classes\n const euiRefs = collectEuiReferences(sourceFile, source, templateRefMap);\n\n if (euiRefs.props.size === 0 && euiRefs.propLists.size === 0 && euiRefs.decls.size === 0 && euiRefs.listDecls.size === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const hostTodoEdits: Edit[] = [];\n let needsOutputImport = false;\n\n // Phase 2: Find property accesses on those references and rewrite signal props\n const visitNode = (node: ts.Node): void => {\n // Match: ref.prop (PropertyAccessExpression)\n if (ts.isPropertyAccessExpression(node)) {\n const rewrite = tryRewritePropertyAccess(node, euiRefs, sourceFile, source);\n if (rewrite) {\n edits.push(rewrite);\n }\n\n // Writable signal (model()): `ref.prop = value` -> `ref.prop.set(value)`\n edits.push(...trySetRewrite(node, euiRefs, sourceFile));\n\n // Output: `ref.out.subscribe()` -> `outputToObservable(ref.out).subscribe()`\n const wrap = tryWrapOutput(node, euiRefs, sourceFile);\n if (wrap) {\n edits.push(...wrap);\n needsOutputImport = true;\n }\n\n // Output handed to rxjs combinators / used as a value: wrap or flag\n const outputUse = tryOutputUsage(node, euiRefs, sourceFile, source);\n if (outputUse) {\n edits.push(...outputUse.edits);\n if (outputUse.todo) hostTodoEdits.push(outputUse.todo);\n if (outputUse.edits.length > 0) needsOutputImport = true;\n }\n\n // Removed @HostBinding property: flag with a TODO\n const hostTodo = tryHostBindingTodo(node, euiRefs, sourceFile, source);\n if (hostTodo) {\n hostTodoEdits.push(hostTodo);\n }\n\n // Separately: a programmatic WRITE to a now-signal input cannot be\n // migrated automatically. Flag it with a TODO instead of silently\n // leaving a line that will fail to compile against the signal API.\n const todo = tryInsertWriteTodo(node, euiRefs, sourceFile, source);\n if (todo) {\n todoEdits.push(todo);\n }\n }\n // Destructuring / aliasing of a tracked reference cannot be followed: flag it.\n const alias = tryAliasTodo(node, euiRefs, sourceFile, source);\n if (alias) hostTodoEdits.push(alias);\n ts.forEachChild(node, visitNode);\n };\n\n ts.forEachChild(sourceFile, visitNode);\n\n if (edits.length === 0 && todoEdits.length === 0 && hostTodoEdits.length === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const dedupedTodos = deduplicateEdits(todoEdits);\n const dedupedHostTodos = deduplicateEdits(hostTodoEdits);\n\n // A TODO edit comments out the whole write statement. Any read-rewrite `()`\n // edit whose position falls inside that commented-out range must be dropped,\n // otherwise we'd both edit and comment the same text (and produce overlapping\n // edits that corrupt the output).\n const keptEdits = edits.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const keptHostTodos = dedupedHostTodos.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const importEdit = needsOutputImport ? buildOutputImportEdit(sourceFile) : null;\n\n return {\n source: applyEdits(source, [...keptEdits, ...dedupedTodos, ...keptHostTodos, ...(importEdit ? [importEdit] : [])]),\n editCount: keptEdits.length,\n todoCount: dedupedTodos.length + keptHostTodos.length,\n };\n}\n\n/**\n * Scans the source file for class properties or variables typed as EUI component classes.\n * Returns a map: localName → Set of signal property names.\n *\n * Handles:\n * @ViewChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild(EuiXxxComponent) name!: EuiXxxComponent;\n * @ViewChild('ref') name: EuiXxxComponent;\n * @ContentChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild('ref') name: ElementRef; (resolved via template #ref → EUI selector)\n * someVar: EuiXxxComponent; (typed class field, even without decorator)\n * const alias = this.viewChildRef; (alias tracking)\n */\nfunction collectEuiReferences(\n sourceFile: ts.SourceFile,\n source: string,\n templateRefMap: Map<string, string>,\n): Refs {\n const tracked: Refs = { props: new Map(), propLists: new Map(), decls: new Map(), listDecls: new Map() };\n const { props, propLists, decls, listDecls } = tracked;\n\n // Pass 1: collect directly-typed references\n const visitDirect = (node: ts.Node): void => {\n // Class property declarations\n if (ts.isPropertyDeclaration(node) && node.name && ts.isIdentifier(node.name)) {\n const euiClass = resolveEuiClassName(node, sourceFile, templateRefMap);\n if (isKnownClass(euiClass)) {\n (isListProperty(node) ? propLists : props).set(node.name.text, euiClass);\n }\n }\n\n // Variable (const x: EuiXxxComponent = ...) and parameter (method(ref: EuiXxxComponent)) declarations\n if ((ts.isVariableDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n decls.set(node, typeName);\n // constructor parameter property: also reachable as `this.name`\n if (ts.isParameter(node) && (ts.getModifiers?.(node) ?? []).length > 0) props.set(node.name.text, typeName);\n } else {\n const listClass = listElementClass(node.type);\n if (listClass) listDecls.set(node, listClass);\n }\n }\n\n ts.forEachChild(node, visitDirect);\n };\n\n ts.forEachChild(sourceFile, visitDirect);\n\n // Pass 2: aliases, QueryList/array iteration (source order)\n const visitAlias = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && !decls.has(node)) {\n const aliased = trackedClass(node.initializer, tracked);\n if (aliased) decls.set(node, aliased);\n const aliasedList = listClassOf(node.initializer, tracked);\n if (aliasedList) listDecls.set(node, aliasedList);\n }\n\n // list.forEach((el) => ...) / list.map(function (el) {...}) -> `el` is an element of the list\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n LIST_ITERATION_METHODS.has(node.expression.name.text)\n ) {\n const listClass = listClassOf(node.expression.expression, tracked);\n const callback = node.arguments[0];\n if (\n listClass &&\n callback &&\n (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) &&\n callback.parameters[0] &&\n ts.isIdentifier(callback.parameters[0].name) &&\n !callback.parameters[0].type\n ) {\n decls.set(callback.parameters[0], listClass);\n }\n }\n\n // for (const el of list) -> `el` is an element of the list\n if (ts.isForOfStatement(node) && ts.isVariableDeclarationList(node.initializer)) {\n const listClass = listClassOf(node.expression, tracked);\n const decl = node.initializer.declarations[0];\n if (listClass && decl && ts.isIdentifier(decl.name) && !decls.has(decl)) decls.set(decl, listClass);\n }\n\n ts.forEachChild(node, visitAlias);\n };\n\n ts.forEachChild(sourceFile, visitAlias);\n return tracked;\n}\n\n/** `EuiXxx[]`, `Array<EuiXxx>`, `QueryList<EuiXxx>` -> the known element class. */\nfunction listElementClass(type: ts.TypeNode | undefined): string | null {\n if (!type) return null;\n if (ts.isArrayTypeNode(type)) {\n const n = getTypeAnnotationName(type.elementType);\n return isKnownClass(n) ? n : null;\n }\n if (ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && ['Array', 'ReadonlyArray', 'QueryList'].includes(type.typeName.text)) {\n const n = getTypeAnnotationName(type.typeArguments?.[0]);\n return isKnownClass(n) ? n : null;\n }\n return null;\n}\n\n/** Strips parentheses, `!`, `as T`, `<T>x` and `satisfies`. */\nfunction unwrap(expr: ts.Expression): ts.Expression {\n let cur = expr;\n while (\n ts.isParenthesizedExpression(cur) ||\n ts.isNonNullExpression(cur) ||\n ts.isAsExpression(cur) ||\n ts.isTypeAssertionExpression(cur) ||\n ts.isSatisfiesExpression(cur)\n ) {\n cur = cur.expression;\n }\n return cur;\n}\n\n/** Nearest declaration (parameter / variable / binding element) of a bare identifier, or null. */\nfunction findDeclaration(id: ts.Identifier): ts.Node | null {\n const name = id.text;\n const boundIn = (bn: ts.BindingName): boolean =>\n ts.isIdentifier(bn) ? bn.text === name : bn.elements.some((e) => !ts.isOmittedExpression(e) && boundIn(e.name));\n const matchDecl = (d: ts.ParameterDeclaration | ts.VariableDeclaration): ts.Node | null => (boundIn(d.name) ? d : null);\n\n for (let cur: ts.Node | undefined = id.parent; cur; cur = cur.parent) {\n if (ts.isFunctionLike(cur)) {\n for (const p of cur.parameters) {\n const m = matchDecl(p);\n if (m) return m;\n }\n }\n if (ts.isBlock(cur) || ts.isSourceFile(cur) || ts.isModuleBlock(cur) || ts.isCaseClause(cur) || ts.isDefaultClause(cur)) {\n const stmts = ts.isCaseClause(cur) || ts.isDefaultClause(cur) ? cur.statements : cur.statements;\n for (const st of stmts) {\n if (ts.isVariableStatement(st)) {\n for (const d of st.declarationList.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n }\n }\n if ((ts.isForStatement(cur) || ts.isForOfStatement(cur) || ts.isForInStatement(cur)) && cur.initializer && ts.isVariableDeclarationList(cur.initializer)) {\n for (const d of cur.initializer.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n if (ts.isCatchClause(cur) && cur.variableDeclaration) {\n const m = matchDecl(cur.variableDeclaration);\n if (m) return m;\n }\n }\n return null;\n}\n\n/** `this.name` -> name; anything else null. */\nfunction thisMemberName(expr: ts.Expression): string | null {\n return ts.isPropertyAccessExpression(expr) && expr.expression.kind === ts.SyntaxKind.ThisKeyword ? expr.name.text : null;\n}\n\n/** Element class of a tracked QueryList / array expression, or null. */\nfunction listClassOf(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.listDecls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n return member ? (tracked.propLists.get(member) ?? null) : null;\n}\n\n/**\n * Resolves the EUI class name from a property declaration.\n * Checks: type annotation → decorator class argument → template ref map.\n */\nfunction resolveEuiClassName(\n node: ts.PropertyDeclaration,\n sourceFile: ts.SourceFile,\n templateRefMap: Map<string, string>,\n): string | null {\n // Check type annotation first\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n return typeName;\n }\n\n const arrayClass = listElementClass(node.type);\n if (arrayClass) return arrayClass;\n\n // Check generic type argument: ElementRef<EuiXxxComponent> / QueryList<EuiXxxComponent>\n if (node.type && ts.isTypeReferenceNode(node.type) && node.type.typeArguments?.length) {\n const genericArg = getTypeAnnotationName(node.type.typeArguments[0]);\n if (isKnownClass(genericArg)) {\n return genericArg;\n }\n }\n\n // Check decorator arguments: @ViewChild(EuiXxxComponent) or @ViewChild('refName')\n if (node.modifiers) {\n for (const modifier of node.modifiers) {\n if (!ts.isDecorator(modifier)) continue;\n if (!ts.isCallExpression(modifier.expression)) continue;\n\n const decoratorName = getDecoratorName(modifier.expression);\n if (!decoratorName) continue;\n if (!['ViewChild', 'ViewChildren', 'ContentChild', 'ContentChildren'].includes(decoratorName)) continue;\n\n const args = modifier.expression.arguments;\n if (args.length > 0) {\n const firstArg = args[0];\n\n // @ViewChild(EuiXxxComponent) — class reference\n if (ts.isIdentifier(firstArg) && isKnownClass(firstArg.text)) {\n return firstArg.text;\n }\n\n // @ViewChild('refName') — string template ref, resolve via template\n if (ts.isStringLiteralLike(firstArg)) {\n const refName = firstArg.text;\n const euiClass = templateRefMap.get(refName);\n if (isKnownClass(euiClass)) {\n return euiClass;\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/** True for `@ViewChildren/@ContentChildren` fields and `QueryList<...>`-typed fields. */\nfunction isListProperty(node: ts.PropertyDeclaration): boolean {\n if (listElementClass(node.type)) return true;\n if (node.type && ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName) && node.type.typeName.text === 'QueryList') {\n return true;\n }\n return (ts.getDecorators?.(node) ?? []).some(\n (d) => ts.isCallExpression(d.expression) && ['ViewChildren', 'ContentChildren'].includes(getDecoratorName(d.expression) ?? ''),\n );\n}\n\n/**\n * Resolves an expression to the tracked EUI class: `ref`, `this.ref`, `this.ref!`, `(this.ref as any)`,\n * the `.first` / `.last` element of a tracked QueryList, or `list[i]` of a tracked list/array.\n */\nfunction trackedClass(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.decls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n if (member) return tracked.props.get(member) ?? null;\n if (ts.isPropertyAccessExpression(e) && (e.name.text === 'first' || e.name.text === 'last')) {\n return listClassOf(e.expression, tracked);\n }\n if (ts.isElementAccessExpression(e)) return listClassOf(e.expression, tracked);\n return null;\n}\n\nfunction getDecoratorName(callExpr: ts.CallExpression): string | null {\n if (ts.isIdentifier(callExpr.expression)) {\n return callExpr.expression.text;\n }\n return null;\n}\n\nfunction getTypeAnnotationName(typeNode: ts.TypeNode | undefined): string | null {\n if (!typeNode) return null;\n if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n return null;\n}\n\n/**\n * Checks if a property access `ref.prop` should be rewritten to `ref.prop()`.\n *\n * We rewrite if:\n * - `ref` is tracked in euiRefs\n * - `prop` is in the signal set for that EUI class\n * - The access is NOT already a call expression (not `ref.prop()` or `ref.prop(args)`)\n * - The access is NOT a write target (not `ref.prop = value`)\n * - The access is NOT a template binding argument (those are unaffected)\n */\nfunction tryRewritePropertyAccess(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n // Resolve the reference class — handle `this.ref.prop`, `ref.prop`, `list.first.prop`\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Skip if parent is already a call expression on this property: ref.prop(...)\n if (ts.isCallExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip a signal handed to toObservable(ref.prop): it needs the signal itself (e.g. written by migrate-eui-tab-signals)\n if (ts.isCallExpression(node.parent) && node.parent.arguments[0] === node &&\n ts.isIdentifier(node.parent.expression) && node.parent.expression.text === 'toObservable') {\n return null;\n }\n\n // Skip signal API access already in place: ref.prop.set(..) / .update(..) / .asReadonly()\n if (ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node &&\n ['set', 'update', 'asReadonly'].includes(node.parent.name.text)) {\n return null;\n }\n\n // Skip if this is the left side of an assignment: ref.prop = value\n if (ts.isBinaryExpression(node.parent) &&\n node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n node.parent.left === node) {\n return null;\n }\n\n // Skip if this is a compound assignment: ref.prop += value, ref.prop &&= value, etc.\n if (ts.isBinaryExpression(node.parent) && isAssignmentOperator(node.parent.operatorToken.kind) && node.parent.left === node) {\n return null;\n }\n\n // Skip if this is used with delete: delete ref.prop\n if (ts.isDeleteExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip if inside a typeof: typeof ref.prop\n if (ts.isTypeOfExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip property access chains that go deeper: ref.prop.something → ref.prop().something\n // This IS correct — we still want to add ()\n\n // Rewrite: insert () after the property name\n const end = node.name.getEnd();\n return {\n start: end,\n end: end,\n replacement: '()',\n };\n}\n\nfunction isAssignmentOperator(kind: ts.SyntaxKind): boolean {\n return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;\n}\n\n/** Marker used to detect an already-inserted TODO so the schematic stays idempotent. */\nconst WRITE_TODO_MARKER = 'TODO(eui-signals):';\n\n/**\n * Detects a programmatic WRITE to a now-signal input and returns an edit that\n * comments out the offending statement and prepends an explanatory TODO.\n *\n * A signal input (`input()`) exposes a read-only getter — it cannot be assigned\n * from outside the component (`comp.prop = value` no longer compiles, and\n * `comp.prop()` is a getter, not a setter). There is no safe, mechanical\n * rewrite: the correct fix is to drive the value declaratively through a\n * template binding (`[prop]=\"...\"`) or, when a ComponentRef is genuinely\n * available, `componentRef.setInput('prop', value)`. Both require human\n * judgement, so instead of rewriting we comment the statement out (keeping the\n * build green) and leave a TODO pointing at the manual fix.\n *\n * Only acts when the assignment is the ENTIRE statement\n * (`ExpressionStatement` whose expression is exactly this assignment):\n * ref.prop = value (simple assignment)\n * ref.prop += value, etc. (compound assignment)\n * where `ref` is a tracked EUI/ECL reference and `prop` is in its signal set.\n *\n * When the write is only part of a larger statement (e.g. inside an `if`\n * without a block, or nested in another expression), commenting it out would\n * also remove unrelated logic, so we leave it untouched (it will surface as a\n * compile error the developer must resolve by hand).\n */\nfunction tryInsertWriteTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Only act on assignment targets: `ref.prop = ...` or `ref.prop <op>= ...`\n if (\n !ts.isBinaryExpression(node.parent) ||\n node.parent.left !== node ||\n !isAssignmentOperator(node.parent.operatorToken.kind)\n ) {\n return null;\n }\n\n const assignment = node.parent;\n\n // A plain `=` to a writable signal is migrated to `.set()` by trySetRewrite\n if (assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken && EUI_WRITABLE_SIGNAL_MAP[cls]?.has(propName)) {\n return null;\n }\n\n // Only comment out when the assignment IS the whole statement — otherwise we'd\n // delete unrelated logic from a larger statement.\n const statement = node.parent.parent;\n if (!statement || !ts.isExpressionStatement(statement) || statement.expression !== assignment) {\n return null;\n }\n\n // The statement must stand on its own (a direct child of a block/source), not\n // be the unbraced body of an `if`/`for`/`while` etc. — commenting those out by\n // line would swallow the surrounding `if (...)` and break the code.\n const parent = statement.parent;\n if (\n !parent ||\n !(ts.isBlock(parent) || ts.isSourceFile(parent) || ts.isModuleBlock(parent) || ts.isCaseClause(parent) || ts.isDefaultClause(parent))\n ) {\n return null;\n }\n\n const stmtStart = statement.getStart(sourceFile);\n const stmtEnd = statement.getEnd(); // includes the trailing semicolon\n const lineStart = getLineStartPosition(source, stmtStart);\n const indent = source.slice(lineStart, stmtStart);\n\n // Commenting works per line: the statement must be alone on its lines, otherwise\n // (e.g. `run() { ref.prop = 1; }`) we would comment out surrounding code.\n const eol = source.indexOf('\\n', stmtEnd);\n const restOfLine = source.slice(stmtEnd, eol === -1 ? source.length : eol);\n if (indent.trim() !== '' || restOfLine.trim() !== '') {\n return null;\n }\n\n // The statement text, as written (may span multiple lines).\n const statementText = source.slice(stmtStart, stmtEnd);\n\n // Comment out every line of the statement, preserving each line's own\n // indentation (insert `// ` after the leading whitespace). The first line's\n // indentation was stripped by starting the replacement at lineStart, so we\n // re-add it explicitly.\n const commentedStatement = statementText\n .split('\\n')\n .map((line, i) => {\n if (i === 0) return `${indent}// ${line}`;\n const lineIndent = line.slice(0, line.length - line.trimStart().length);\n return `${lineIndent}// ${line.trimStart()}`;\n })\n .join('\\n');\n\n const todo =\n `${indent}// ${WRITE_TODO_MARKER} '${propName}' is now a signal input and cannot be assigned directly.\\n` +\n `${indent}// Set it via a template binding ([${propName}]=\"...\") or componentRef.setInput('${propName}', ...).\\n` +\n `${indent}// The original statement is commented out below so the build does not fail:\\n`;\n\n // Replace the statement (from the start of its line, to drop the original\n // indentation we re-add) with the TODO + commented-out statement.\n return {\n start: lineStart,\n end: stmtEnd,\n replacement: todo + commentedStatement,\n };\n}\n\n/** `ref.prop = value;` on a writable signal -> `ref.prop.set(value);` (two zero-width-safe edits). */\nfunction trySetRewrite(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] {\n const assignment = node.parent;\n if (\n !ts.isBinaryExpression(assignment) ||\n assignment.left !== node ||\n assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken ||\n !ts.isExpressionStatement(assignment.parent)\n ) {\n return [];\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_WRITABLE_SIGNAL_MAP[cls]?.has(node.name.text)) return [];\n\n return [\n { start: node.getEnd(), end: assignment.right.getStart(sourceFile), replacement: '.set(' },\n { start: assignment.right.getEnd(), end: assignment.right.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** `ref.out.subscribe(...)` -> `outputToObservable(ref.out).subscribe(...)`. */\nfunction tryWrapOutput(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] | null {\n const parent = node.parent;\n if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node || !OBSERVABLE_METHODS.has(parent.name.text)) {\n return null;\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n\n const start = node.getStart(sourceFile);\n return [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** Marker for a read of a property that was a @HostBinding and no longer exists. */\nconst HOST_TODO_MARKER = 'TODO(eui-signals):';\n\nfunction tryHostBindingTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_HOST_BINDING_REMOVED_MAP[cls]?.has(propName) || EUI_SIGNAL_MAP[cls]?.has(propName)) return null;\n return flagTodo(\n node,\n sourceFile,\n source,\n `'${propName}' was a @HostBinding`,\n `'${propName}' was a @HostBinding property of ${cls} and no longer exists on the instance ` +\n '(moved to static host metadata). Remove or replace this access.',\n );\n}\n\n/**\n * Inserts a `// TODO(eui-signals): <message>` line above the enclosing statement / class member.\n * `key` identifies the TODO for idempotency (looked for in the comment lines right above).\n */\nfunction flagTodo(node: ts.Node, sourceFile: ts.SourceFile, source: string, key: string, message: string): Edit | null {\n // Anchor on the enclosing statement / class member\n let anchor: ts.Node = node;\n while (\n anchor.parent &&\n !(\n ts.isBlock(anchor.parent) ||\n ts.isSourceFile(anchor.parent) ||\n ts.isModuleBlock(anchor.parent) ||\n ts.isCaseClause(anchor.parent) ||\n ts.isDefaultClause(anchor.parent) ||\n ts.isClassLike(anchor.parent)\n )\n ) {\n anchor = anchor.parent;\n }\n\n const lineStart = getLineStartPosition(source, anchor.getStart(sourceFile));\n const indent = source.slice(lineStart).match(/^[ \\t]*/)![0];\n const text = `${indent}// ${HOST_TODO_MARKER} ${message}\\n`;\n\n // Idempotent: look at the contiguous comment lines right above\n const above = source.slice(0, lineStart).split('\\n').slice(-8).reverse();\n for (const line of above.slice(1)) {\n if (!line.trim().startsWith('//')) break;\n if (line.includes(`${HOST_TODO_MARKER} ${key}`) || line.includes(key)) return null;\n }\n // A single-line anchor like `run() { ... }` shares its line with other code: still fine, the comment goes above the line.\n return { start: lineStart, end: lineStart, replacement: text };\n}\n\n/**\n * An output (OutputEmitterRef) used as a value:\n * - an argument of an rxjs combinator (`merge(ref.out, ...)`, also inside an array) is wrapped in `outputToObservable()`;\n * - any other use that is not `.emit()` / `.subscribe()` & co / already wrapped is flagged with a TODO.\n */\nfunction tryOutputUsage(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): { edits: Edit[]; todo?: Edit | null } | null {\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n const parent = node.parent;\n\n // handled elsewhere (tryWrapOutput) or fine as is\n if (ts.isPropertyAccessExpression(parent) && parent.expression === node) return null;\n if (ts.isNonNullExpression(parent) || ts.isParenthesizedExpression(parent) || ts.isAsExpression(parent)) return null;\n // declared / written outputs are not reads\n if (ts.isBinaryExpression(parent) && parent.left === node) return null;\n\n // argument of a combinator?\n let arg: ts.Node = node;\n if (ts.isArrayLiteralExpression(arg.parent)) arg = arg.parent;\n const call = arg.parent;\n if (ts.isCallExpression(call) && call.arguments.includes(arg as ts.Expression)) {\n const callee = ts.isIdentifier(call.expression) ? call.expression.text : null;\n if (callee === 'outputToObservable') return null; // already migrated\n if (callee && OBSERVABLE_COMBINATORS.has(callee)) {\n const start = node.getStart(sourceFile);\n return {\n edits: [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ],\n };\n }\n }\n\n return {\n edits: [],\n todo: flagTodo(\n node,\n sourceFile,\n source,\n `output '${node.name.text}'`,\n `output '${node.name.text}' of ${cls} is an OutputEmitterRef, not an Observable. Wrap it with outputToObservable() ` +\n '(@angular/core/rxjs-interop) where an Observable is needed.',\n ),\n };\n}\n\n/** Destructuring of a tracked reference, or storing it in a field/variable we cannot follow. */\nfunction tryAliasTodo(node: ts.Node, euiRefs: Refs, sourceFile: ts.SourceFile, source: string): Edit | null {\n if (ts.isVariableDeclaration(node) && node.initializer && !ts.isIdentifier(node.name)) {\n const cls = trackedClass(node.initializer, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `destructuring of ${cls}`,\n `destructuring of ${cls} cannot be migrated automatically: its signal inputs/outputs must be read as ref.prop() / outputToObservable(ref.out).`,\n );\n }\n }\n if (\n ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n !ts.isIdentifier(unwrap(node.left)) &&\n ts.isExpressionStatement(node.parent)\n ) {\n const cls = trackedClass(node.right, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `aliasing of ${cls}`,\n `aliasing of ${cls}: this copy is not tracked, so its signal inputs/outputs must be updated manually (ref.prop()).`,\n );\n }\n }\n return null;\n}\n\n/** Adds `outputToObservable` to the file's imports (merging into an existing rxjs-interop import). */\nfunction buildOutputImportEdit(sourceFile: ts.SourceFile): Edit | null {\n let lastImportEnd = 0;\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n lastImportEnd = stmt.getEnd();\n if (!ts.isStringLiteral(stmt.moduleSpecifier) || stmt.moduleSpecifier.text !== '@angular/core/rxjs-interop') continue;\n const bindings = stmt.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings)) {\n if (bindings.elements.some((e) => e.name.text === 'outputToObservable')) return null;\n const last = bindings.elements[bindings.elements.length - 1];\n if (last) {\n return { start: last.getEnd(), end: last.getEnd(), replacement: ', outputToObservable' };\n }\n }\n }\n const line = 'import { outputToObservable } from \\'@angular/core/rxjs-interop\\';';\n return lastImportEnd === 0\n ? { start: 0, end: 0, replacement: `${line}\\n` }\n : { start: lastImportEnd, end: lastImportEnd, replacement: `\\n${line}` };\n}\n\n/** True if `edit`'s position falls within any of the given ranges. */\nfunction isInsideAnyRange(edit: Edit, ranges: Edit[]): boolean {\n return ranges.some((range) => edit.start >= range.start && edit.end <= range.end);\n}\n\n/** Returns the index of the first character of the line containing `pos`. */\nfunction getLineStartPosition(source: string, pos: number): number {\n const newlineIndex = source.lastIndexOf('\\n', pos - 1);\n return newlineIndex === -1 ? 0 : newlineIndex + 1;\n}\n\n// ---------------------------------------------------------------------------\n// Template ref resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Builds a map of template reference variable names (#ref) to EUI class names.\n *\n * Parses the component's template (inline or external) and finds elements like:\n * <eui-alert #myAlert> → myAlert → EuiAlertComponent\n * <input euiAutocomplete #ac> → ac → EuiAutocompleteComponent\n *\n * Returns Map<refName, euiClassName>.\n */\nfunction buildTemplateRefMap(\n sourceFile: ts.SourceFile,\n source: string,\n filePath: string,\n tree: Tree,\n): Map<string, string> {\n const refMap = new Map<string, string>();\n\n // Find @Component decorator\n const componentMeta = findComponentMetadata(sourceFile, source);\n if (!componentMeta) return refMap;\n\n let templateSource: string | null = null;\n\n if (componentMeta.inlineTemplate !== null) {\n templateSource = componentMeta.inlineTemplate;\n } else if (componentMeta.templateUrl) {\n // Resolve templateUrl relative to the TS file\n const dir = filePath.substring(0, filePath.lastIndexOf('/'));\n const templatePath = `${dir}/${componentMeta.templateUrl}`;\n const buffer = tree.read(templatePath);\n if (buffer) {\n templateSource = buffer.toString('utf-8');\n }\n }\n\n if (!templateSource) return refMap;\n\n // Parse the template and collect #refs\n try {\n const parsed = parseTemplate(templateSource, '', { preserveWhitespaces: true });\n collectTemplateRefs(parsed.nodes, refMap);\n } catch {\n // Template parse failure — silently skip (might be malformed or use third-party syntax)\n }\n\n return refMap;\n}\n\n/**\n * Extracts @Component metadata: templateUrl or inline template content.\n */\nfunction findComponentMetadata(\n sourceFile: ts.SourceFile,\n source: string,\n): { templateUrl: string | null; inlineTemplate: string | null } | null {\n let result: { templateUrl: string | null; inlineTemplate: string | null } | null = null;\n\n const visit = (node: ts.Node): void => {\n if (result) return;\n\n if (ts.isDecorator(node) && ts.isCallExpression(node.expression)) {\n const name = getDecoratorName(node.expression);\n if (name !== 'Component') {\n ts.forEachChild(node, visit);\n return;\n }\n\n const args = node.expression.arguments;\n if (args.length === 0 || !ts.isObjectLiteralExpression(args[0])) {\n ts.forEachChild(node, visit);\n return;\n }\n\n const meta: { templateUrl: string | null; inlineTemplate: string | null } = {\n templateUrl: null,\n inlineTemplate: null,\n };\n\n for (const prop of args[0].properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue;\n\n if (prop.name.text === 'templateUrl') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.templateUrl = init.text;\n }\n }\n\n if (prop.name.text === 'template') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.inlineTemplate = init.text;\n } else if (ts.isNoSubstitutionTemplateLiteral(init)) {\n meta.inlineTemplate = init.text;\n }\n }\n }\n\n result = meta;\n return;\n }\n\n ts.forEachChild(node, visit);\n };\n\n ts.forEachChild(sourceFile, visit);\n return result;\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression;\n while (ts.isParenthesizedExpression(current)) current = current.expression;\n return current;\n}\n\n/**\n * Recursively walks template AST nodes, collecting #refName → EUI class name mappings.\n *\n * For each element with a template reference (#ref), we try to resolve its EUI class:\n * 1. Match element tag name against EUI_SELECTOR_TO_CLASS (e.g. 'eui-alert' → EuiAlertComponent)\n * 2. Match element attributes against attribute selectors (e.g. [euiAutocomplete] → EuiAutocompleteComponent)\n */\nfunction collectTemplateRefs(nodes: TmplAstNode[], refMap: Map<string, string>): void {\n forEachElement(nodes, (node) => {\n if (node.references === undefined || node.references.length === 0) return;\n const euiClass = resolveElementToEuiClass(node);\n if (!euiClass) return;\n for (const ref of node.references) {\n refMap.set(ref.name, euiClass);\n }\n });\n}\n\n/**\n * Given a template element, resolves it to an EUI class name by checking:\n * 1. Tag name: <eui-alert> → look up 'eui-alert' in EUI_SELECTOR_TO_CLASS\n * 2. Attribute selectors: <input euiAutocomplete> → look up 'input[euiAutocomplete]' or '[euiAutocomplete]'\n */\nfunction resolveElementToEuiClass(element: TmplAstElement): string | null {\n const tag = element.name;\n\n // Direct tag match: eui-alert, eui-dialog, etc.\n if (EUI_SELECTOR_TO_CLASS[tag]) {\n return EUI_SELECTOR_TO_CLASS[tag];\n }\n\n // Attribute selector match: check all attributes against known patterns\n const allAttrNames = [\n ...element.attributes.map((a) => a.name),\n ...element.inputs.map((i) => i.name),\n ];\n\n for (const attrName of allAttrNames) {\n // Try tag[attr] pattern first (e.g. 'button[euiButton]', 'input[euiAutocomplete]')\n const tagAttrSelector = `${tag}[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[tagAttrSelector]) {\n return EUI_SELECTOR_TO_CLASS[tagAttrSelector];\n }\n\n // Try [attr] pattern (e.g. '[euiTooltip]', '[euiLoading]')\n const attrSelector = `[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[attrSelector]) {\n return EUI_SELECTOR_TO_CLASS[attrSelector];\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Edit helpers\n// ---------------------------------------------------------------------------\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n // Descending by position; at equal positions `after` edits are applied first so they land last.\n for (const edit of unique.sort((a, b) => b.start - a.start || Number(!!b.after) - Number(!!a.after))) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}:${edit.replacement}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n",
2280
+ "sourceCode": "import { parseTemplate, TmplAstElement } from '@angular/compiler';\nimport { SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { forEachElement } from './template-walk';\n\nconst OLD_INPUT = 'tooltipMessage';\nconst NEW_INPUT = 'euiTooltip';\nconst DIRECTIVE_CLASS = 'EuiTooltipDirective';\nconst DIRECTIVE_PATH = '@eui/components/directives';\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n let result = source;\n for (const edit of [...edits].sort((a, b) => b.start - a.start)) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n\n/**\n * Renames the removed `tooltipMessage` input to `euiTooltip` (static, bound and interpolated forms)\n * on the elements accepted by `isTarget`. Elements already carrying `euiTooltip` are left unchanged and reported.\n */\nexport function renameTooltipMessage(\n source: string,\n isTarget: (element: TmplAstElement) => boolean,\n warn: (message: string) => void,\n): { result: string; renamed: number } {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: Edit[] = [];\n\n const collect = (element: TmplAstElement): void => {\n const candidates = [\n ...element.attributes.filter((a) => a.name === OLD_INPUT),\n ...element.inputs.filter((i) => i.name === OLD_INPUT),\n ];\n if (candidates.length === 0) return;\n\n const hasTooltip = element.attributes.some((a) => a.name === NEW_INPUT) || element.inputs.some((i) => i.name === NEW_INPUT);\n for (const attr of candidates) {\n const start = attr.sourceSpan.start.offset;\n if (hasTooltip) {\n const line = source.slice(0, start).split('\\n').length;\n warn(`line ${line} - \"${OLD_INPUT}\" was removed and \"${NEW_INPUT}\" is already set on <${element.name}>. Remove \"${OLD_INPUT}\" manually.`);\n continue;\n }\n // `sourceSpan` starts at the attribute (`tooltipMessage`, `[tooltipMessage]`, `bind-tooltipMessage`): rename only the key.\n const index = source.indexOf(OLD_INPUT, start);\n if (index === -1 || index >= attr.sourceSpan.end.offset) continue;\n edits.push({ start: index, end: index + OLD_INPUT.length, replacement: NEW_INPUT });\n }\n };\n\n forEachElement(parsed.nodes, (element) => {\n if (isTarget(element)) collect(element);\n });\n return { result: applyEdits(source, edits), renamed: edits.length };\n}\n\ntype ImportTarget = { kind: 'inline' } | { kind: 'templateUrl'; htmlFileName: string };\n\n/**\n * Collects the components that now use `euiTooltip` and adds `EuiTooltipDirective` to their `imports`.\n */\nexport class TooltipImportCollector {\n private readonly pending = new Map<string, ImportTarget[]>();\n\n /** The template is inlined in the component file `tsPath`. */\n addInline(tsPath: string): void {\n this.push(tsPath, { kind: 'inline' });\n }\n\n /** The template lives in `htmlPath`; the owning component is resolved through its `templateUrl`. */\n addExternal(tree: Tree, htmlPath: string): void {\n const slash = htmlPath.lastIndexOf('/');\n const dirPath = slash > 0 ? htmlPath.slice(0, slash) : '/';\n const htmlFileName = htmlPath.slice(slash + 1);\n const dir = tree.getDir(dirPath);\n for (const file of dir.subfiles) {\n if (!file.endsWith('.ts') || file.endsWith('.d.ts') || file.endsWith('.spec.ts')) continue;\n const content = tree.read(`${dir.path}/${file}`)?.toString('utf-8');\n if (content?.includes('templateUrl') && content.includes(htmlFileName)) {\n this.push(`${dir.path}/${file}`, { kind: 'templateUrl', htmlFileName });\n return;\n }\n }\n this.unresolved.push(htmlPath);\n }\n\n private readonly unresolved: string[] = [];\n\n private push(tsPath: string, target: ImportTarget): void {\n const list = this.pending.get(tsPath) ?? [];\n list.push(target);\n this.pending.set(tsPath, list);\n }\n\n apply(tree: Tree, context: SchematicContext): void {\n for (const html of this.unresolved) {\n context.logger.warn(`${html} - could not find the component of this template. Add ${DIRECTIVE_CLASS} to its imports manually.`);\n }\n for (const [tsPath, targets] of this.pending) {\n const original = tree.read(tsPath)?.toString('utf-8');\n if (original === undefined) continue;\n let current = original;\n for (const target of targets) {\n const outcome = addDirectiveImport(current, tsPath, target);\n if (outcome.status === 'manual') {\n context.logger.warn(`${tsPath} - add ${DIRECTIVE_CLASS} (from '${DIRECTIVE_PATH}') to the component \"imports\" manually (${outcome.reason}).`);\n }\n current = outcome.result;\n }\n if (current !== original) tree.overwrite(tsPath, current);\n }\n }\n}\n\nfunction propertyName(prop: ts.ObjectLiteralElementLike): string | null {\n if (!ts.isPropertyAssignment(prop)) return null;\n return ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name) ? prop.name.text : null;\n}\n\nfunction addDirectiveImport(\n source: string,\n filePath: string,\n target: ImportTarget,\n): { result: string; status: 'added' | 'present' | 'manual'; reason?: string } {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n\n const matches = (obj: ts.ObjectLiteralExpression): boolean =>\n obj.properties.some((prop) => {\n const name = propertyName(prop);\n if (!name || !ts.isPropertyAssignment(prop)) return false;\n const init = prop.initializer;\n const text = ts.isStringLiteralLike(init) ? init.text : '';\n if (target.kind === 'inline') return name === 'template' && text.includes(NEW_INPUT);\n return name === 'templateUrl' && text.split('/').pop() === target.htmlFileName;\n });\n\n let component: ts.ObjectLiteralExpression | undefined;\n const find = (node: ts.Node): void => {\n if (component) return;\n if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === 'Component') {\n const arg = node.expression.arguments[0];\n if (arg && ts.isObjectLiteralExpression(arg) && matches(arg)) component = arg;\n }\n ts.forEachChild(node, find);\n };\n find(sourceFile);\n\n if (!component) return { result: source, status: 'manual', reason: 'no matching @Component found' };\n\n const standalone = component.properties.find((p) => propertyName(p) === 'standalone');\n if (standalone && ts.isPropertyAssignment(standalone) && standalone.initializer.kind === ts.SyntaxKind.FalseKeyword) {\n return { result: source, status: 'manual', reason: 'the component is not standalone, update its NgModule' };\n }\n\n const importsProp = component.properties.find((p) => propertyName(p) === 'imports');\n if (!importsProp || !ts.isPropertyAssignment(importsProp) || !ts.isArrayLiteralExpression(importsProp.initializer)) {\n return { result: source, status: 'manual', reason: 'the component has no inline \"imports\" array' };\n }\n\n const array = importsProp.initializer;\n if (array.elements.some((e) => ts.isIdentifier(e) && e.text === DIRECTIVE_CLASS)) {\n return { result: source, status: 'present' };\n }\n\n const edits: Edit[] = [];\n if (array.elements.length > 0) {\n const pos = array.elements[array.elements.length - 1].getEnd();\n edits.push({ start: pos, end: pos, replacement: `, ${DIRECTIVE_CLASS}` });\n } else {\n const pos = array.getStart(sourceFile) + 1;\n edits.push({ start: pos, end: pos, replacement: DIRECTIVE_CLASS });\n }\n\n const imports = sourceFile.statements.filter(ts.isImportDeclaration);\n const existing = imports.find(\n (i) => ts.isStringLiteral(i.moduleSpecifier) && i.moduleSpecifier.text === DIRECTIVE_PATH && i.importClause?.namedBindings && ts.isNamedImports(i.importClause.namedBindings),\n );\n const named = existing?.importClause?.namedBindings;\n if (named && ts.isNamedImports(named)) {\n if (!named.elements.some((e) => e.name.text === DIRECTIVE_CLASS)) {\n if (named.elements.length > 0) {\n const pos = named.elements[named.elements.length - 1].getEnd();\n edits.push({ start: pos, end: pos, replacement: `, ${DIRECTIVE_CLASS}` });\n } else {\n const pos = named.getStart(sourceFile) + 1;\n edits.push({ start: pos, end: pos, replacement: ` ${DIRECTIVE_CLASS} ` });\n }\n }\n } else if (imports.length > 0) {\n const last = imports[imports.length - 1];\n const quote = source[(last.moduleSpecifier as ts.StringLiteral).getStart(sourceFile)] === '\"' ? '\"' : '\\'';\n const pos = last.getEnd();\n edits.push({ start: pos, end: pos, replacement: `\\nimport { ${DIRECTIVE_CLASS} } from ${quote}${DIRECTIVE_PATH}${quote};` });\n } else {\n edits.push({ start: 0, end: 0, replacement: `import { ${DIRECTIVE_CLASS} } from '${DIRECTIVE_PATH}';\\n` });\n }\n\n return { result: applyEdits(source, edits), status: 'added' };\n}\n\n/**\n * Applies `renameTooltipMessage` to a whole file: the file itself for `.html`, the `template: \\`...\\`` literals for `.ts`.\n */\nexport function renameTooltipMessageInFile(\n source: string,\n filePath: string,\n isTarget: (element: TmplAstElement) => boolean,\n warn: (message: string) => void,\n): { result: string; renamed: number } {\n if (filePath.endsWith('.html')) return renameTooltipMessage(source, isTarget, warn);\n\n let renamed = 0;\n const result = source.replace(/template\\s*:\\s*`([^`]*)`/gs, (match, templateContent: string) => {\n if (!templateContent.includes(OLD_INPUT)) return match;\n const migrated = renameTooltipMessage(templateContent, isTarget, warn);\n renamed += migrated.renamed;\n return migrated.result === templateContent ? match : match.replace(templateContent, () => migrated.result);\n });\n return { result, renamed };\n}\n\n/** Reports `x.tooltipMessage` property accesses in TS files, which cannot be migrated automatically. */\nexport function warnTooltipMessageUsages(source: string, filePath: string, context: SchematicContext): void {\n if (!filePath.endsWith('.ts') || filePath.endsWith('.spec.ts') || !source.includes(OLD_INPUT)) return;\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && node.name.text === OLD_INPUT) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(`${filePath}:${line + 1} - \"${OLD_INPUT}\" is no longer an input on eui-chip. Use the \"${NEW_INPUT}\" directive instead.`);\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n}\n",
2269
2281
  "displayName": "Edit",
2270
2282
  "properties": [
2271
- {
2272
- "name": "after",
2273
- "coverageIgnore": false,
2274
- "deprecated": false,
2275
- "deprecationMessage": "",
2276
- "type": "boolean",
2277
- "indexKey": "",
2278
- "optional": true,
2279
- "description": "<p>When several zero-width edits share a position, <code>after</code> ones end up after the others.</p>\n",
2280
- "line": 64,
2281
- "rawdescription": "\nWhen several zero-width edits share a position, `after` ones end up after the others."
2282
- },
2283
2283
  {
2284
2284
  "name": "end",
2285
2285
  "coverageIgnore": false,
@@ -2289,7 +2289,7 @@
2289
2289
  "indexKey": "",
2290
2290
  "optional": false,
2291
2291
  "description": "",
2292
- "line": 61,
2292
+ "line": 13,
2293
2293
  "rawdescription": "\n"
2294
2294
  },
2295
2295
  {
@@ -2301,7 +2301,7 @@
2301
2301
  "indexKey": "",
2302
2302
  "optional": false,
2303
2303
  "description": "",
2304
- "line": 62,
2304
+ "line": 14,
2305
2305
  "rawdescription": "\n"
2306
2306
  },
2307
2307
  {
@@ -2313,7 +2313,7 @@
2313
2313
  "indexKey": "",
2314
2314
  "optional": false,
2315
2315
  "description": "",
2316
- "line": 60,
2316
+ "line": 12,
2317
2317
  "rawdescription": "\n"
2318
2318
  }
2319
2319
  ],
@@ -5964,12 +5964,12 @@
5964
5964
  },
5965
5965
  {
5966
5966
  "name": "Schema",
5967
- "id": "interface-Schema-9ee907f6235e54dc564fd1a3f1f033debd4767715b1337e518de4f47f358dfcbff287bd8398fa3fe457784ecf36e625d57b4f9672b760879a507c1a823d51089-42",
5968
- "file": "packages/core/schematics/migrate-to-standalone/index.ts",
5967
+ "id": "interface-Schema-bdeb132e57974e9cf0ecc701fc740055cb5bf71469a03b748668e1c33e6365cc60701d8ed980432fc5cd62827c42a92a1166a7cfa04156ee9c1f5e504c35781c-42",
5968
+ "file": "packages/core/schematics/migrate-to-signals/index.ts",
5969
5969
  "deprecated": false,
5970
5970
  "deprecationMessage": "",
5971
5971
  "type": "interface",
5972
- "sourceCode": "import { parseTemplate } from '@angular/compiler';\nimport { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { forEachElement } from '../utils/template-walk';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\n\ninterface ModuleMapping {\n importPath: string;\n selectors: Record<string, string>;\n}\n\nconst MODULE_MAPPINGS: Record<string, ModuleMapping> = {\n EuiAccordionModule: {\n importPath: '@eui/components/eui-accordion',\n selectors: {\n 'eui-accordion': 'EuiAccordionComponent',\n 'eui-accordion-item': 'EuiAccordionItemComponent',\n euiAccordionItemHeader: 'EuiAccordionItemHeaderDirective',\n },\n },\n EuiAlertModule: {\n importPath: '@eui/components/eui-alert',\n selectors: {\n 'eui-alert': 'EuiAlertComponent',\n euiAlert: 'EuiAlertComponent',\n 'eui-alert-title': 'EuiAlertTitleComponent',\n },\n },\n EuiAutocompleteModule: {\n importPath: '@eui/components/eui-autocomplete',\n selectors: {\n 'eui-autocomplete': 'EuiAutocompleteComponent',\n euiAutocomplete: 'EuiAutocompleteComponent',\n 'eui-autocomplete-option': 'EuiAutocompleteOptionComponent',\n 'eui-autocomplete-option-group': 'EuiAutocompleteOptionGroupComponent',\n 'eui-autocomplete-panel': 'EuiAutocompletePanelComponent',\n },\n },\n EuiAvatarModule: {\n importPath: '@eui/components/eui-avatar',\n selectors: {\n 'eui-avatar': 'EuiAvatarComponent',\n euiAvatar: 'EuiAvatarComponent',\n },\n },\n EuiBadgeModule: {\n importPath: '@eui/components/eui-badge',\n selectors: {\n 'eui-badge': 'EuiBadgeComponent',\n euiBadge: 'EuiBadgeComponent',\n },\n },\n EuiBlockContentModule: {\n importPath: '@eui/components/eui-block-content',\n selectors: {\n 'eui-block-content': 'EuiBlockContentComponent',\n },\n },\n EuiBreadcrumbModule: {\n importPath: '@eui/components/eui-breadcrumb',\n selectors: {\n 'eui-breadcrumb': 'EuiBreadcrumbComponent',\n },\n },\n EuiButtonModule: {\n importPath: '@eui/components/eui-button',\n selectors: {\n euiButton: 'EuiButtonComponent',\n },\n },\n EuiButtonGroupModule: {\n importPath: '@eui/components/eui-button-group',\n selectors: {\n 'eui-button-group': 'EuiButtonGroupComponent',\n },\n },\n EuiCardModule: {\n importPath: '@eui/components/eui-card',\n selectors: {\n 'eui-card': 'EuiCardComponent',\n 'eui-card-header': 'EuiCardHeaderComponent',\n 'eui-card-header-title': 'EuiCardHeaderTitleComponent',\n 'eui-card-content': 'EuiCardContentComponent',\n 'eui-card-footer': 'EuiCardFooterComponent',\n 'eui-card-media': 'EuiCardMediaComponent',\n },\n },\n EuiChipModule: {\n importPath: '@eui/components/eui-chip',\n selectors: {\n 'eui-chip': 'EuiChipComponent',\n euiChip: 'EuiChipComponent',\n },\n },\n EuiChipListModule: {\n importPath: '@eui/components/eui-chip-list',\n selectors: {\n 'eui-chip-list': 'EuiChipListComponent',\n },\n },\n EuiChipGroupModule: {\n importPath: '@eui/components/eui-chip-group',\n selectors: {\n 'eui-chip-group': 'EuiChipGroupComponent',\n },\n },\n EuiDashboardCardModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDashboardButtonModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDatepickerModule: {\n importPath: '@eui/components/eui-datepicker',\n selectors: {\n 'eui-datepicker': 'EuiDatepickerComponent',\n },\n },\n EuiDateRangeSelectorModule: {\n importPath: '@eui/components/eui-date-range-selector',\n selectors: {\n 'eui-date-range-selector': 'EuiDateRangeSelectorComponent',\n },\n },\n EuiDialogModule: {\n importPath: '@eui/components/eui-dialog',\n selectors: {\n 'eui-dialog': 'EuiDialogComponent',\n 'eui-dialog-header': 'EuiDialogHeaderDirective',\n 'eui-dialog-footer': 'EuiDialogFooterDirective',\n 'eui-dialog-container': 'EuiDialogContainerComponent',\n },\n },\n EuiDisableContentModule: {\n importPath: '@eui/components/eui-disable-content',\n selectors: {\n 'eui-disable-content': 'EuiDisableContentComponent',\n },\n },\n EuiDiscussionThreadModule: {\n importPath: '@eui/components/eui-discussion-thread',\n selectors: {\n 'eui-discussion-thread': 'EuiDiscussionThreadComponent',\n 'eui-discussion-thread-item': 'EuiDiscussionThreadItemComponent',\n },\n },\n EuiDropdownModule: {\n importPath: '@eui/components/eui-dropdown',\n selectors: {\n 'eui-dropdown': 'EuiDropdownComponent',\n },\n },\n EuiFeedbackMessageModule: {\n importPath: '@eui/components/eui-feedback-message',\n selectors: {\n 'eui-feedback-message': 'EuiFeedbackMessageComponent',\n },\n },\n EuiFieldsetModule: {\n importPath: '@eui/components/eui-fieldset',\n selectors: {\n 'eui-fieldset': 'EuiFieldsetComponent',\n euiFieldsetLabelRightContent: 'EuiFieldsetLabelRightContentTagDirective',\n euiFieldsetLabelExtraContent: 'EuiFieldsetLabelExtraContentTagDirective',\n },\n },\n EuiFileUploadModule: {\n importPath: '@eui/components/eui-file-upload',\n selectors: {\n 'eui-file-upload': 'EuiFileUploadComponent',\n },\n },\n EuiGrowlModule: {\n importPath: '@eui/components/eui-growl',\n selectors: {\n 'eui-growl': 'EuiGrowlComponent',\n },\n },\n EuiIconModule: {\n importPath: '@eui/components/eui-icon',\n selectors: {\n 'eui-icon-svg': 'EuiIconSvgComponent',\n euiIconSvg: 'EuiIconSvgComponent',\n },\n },\n EuiIconButtonModule: {\n importPath: '@eui/components/eui-icon-button',\n selectors: {\n 'eui-icon-button': 'EuiIconButtonComponent',\n },\n },\n EuiIconToggleModule: {\n importPath: '@eui/components/eui-icon-toggle',\n selectors: {\n 'eui-icon-toggle': 'EuiIconToggleComponent',\n },\n },\n EuiInputCheckboxModule: {\n importPath: '@eui/components/eui-input-checkbox',\n selectors: {\n euiInputCheckBox: 'EuiInputCheckboxComponent',\n },\n },\n EuiInputGroupModule: {\n importPath: '@eui/components/eui-input-group',\n selectors: {\n euiInputGroup: 'EuiInputGroupComponent',\n 'eui-input-group-addon': 'EuiInputGroupAddOnComponent',\n euiInputGroupAddOn: 'EuiInputGroupAddOnComponent',\n 'eui-input-group-addon-item': 'EuiInputGroupAddOnItemComponent',\n euiInputGroupAddOnItem: 'EuiInputGroupAddOnItemComponent',\n },\n },\n EuiInputNumberModule: {\n importPath: '@eui/components/eui-input-number',\n selectors: {\n euiInputNumber: 'EuiInputNumberComponent',\n },\n },\n EuiInputRadioModule: {\n importPath: '@eui/components/eui-input-radio',\n selectors: {\n euiInputRadio: 'EuiInputRadioComponent',\n },\n },\n EuiInputTextModule: {\n importPath: '@eui/components/eui-input-text',\n selectors: {\n euiInputText: 'EuiInputTextComponent',\n },\n },\n EuiLabelModule: {\n importPath: '@eui/components/eui-label',\n selectors: {\n 'eui-label': 'EuiLabelComponent',\n euiLabel: 'EuiLabelComponent',\n },\n },\n EuiListModule: {\n importPath: '@eui/components/eui-list',\n selectors: {\n 'eui-list': 'EuiListComponent',\n euiList: 'EuiListComponent',\n 'eui-list-item': 'EuiListItemComponent',\n euiListItem: 'EuiListItemComponent',\n },\n },\n EuiMenuModule: {\n importPath: '@eui/components/eui-menu',\n selectors: {\n 'eui-menu': 'EuiMenuComponent',\n 'eui-menu-item': 'EuiMenuItemComponent',\n },\n },\n EuiMessageBoxModule: {\n importPath: '@eui/components/eui-message-box',\n selectors: {\n 'eui-message-box': 'EuiMessageBoxComponent',\n 'eui-message-box-footer': 'EuiMessageBoxFooterDirective',\n },\n },\n EuiOverlayModule: {\n importPath: '@eui/components/eui-overlay',\n selectors: {\n 'eui-overlay': 'EuiOverlayComponent',\n },\n },\n EuiPageModule: {\n importPath: '@eui/components/eui-page',\n selectors: {\n 'eui-page': 'EuiPageComponent',\n },\n },\n EuiPaginatorModule: {\n importPath: '@eui/components/eui-paginator',\n selectors: {\n 'eui-paginator': 'EuiPaginatorComponent',\n },\n },\n EuiPopoverModule: {\n importPath: '@eui/components/eui-popover',\n selectors: {\n 'eui-popover': 'EuiPopoverComponent',\n },\n },\n EuiProgressBarModule: {\n importPath: '@eui/components/eui-progress-bar',\n selectors: {\n 'eui-progress-bar': 'EuiProgressBarComponent',\n },\n },\n EuiProgressCircleModule: {\n importPath: '@eui/components/eui-progress-circle',\n selectors: {\n 'eui-progress-circle': 'EuiProgressCircleComponent',\n },\n },\n EuiSelectModule: {\n importPath: '@eui/components/eui-select',\n selectors: {\n euiSelect: 'EuiSelectComponent',\n },\n },\n EuiSidebarMenuModule: {\n importPath: '@eui/components/eui-sidebar-menu',\n selectors: {\n 'eui-sidebar-menu': 'EuiSidebarMenuComponent',\n },\n },\n EuiSkeletonModule: {\n importPath: '@eui/components/eui-skeleton',\n selectors: {\n 'eui-skeleton': 'EuiSkeletonComponent',\n },\n },\n EuiSlideToggleModule: {\n importPath: '@eui/components/eui-slide-toggle',\n selectors: {\n 'eui-slide-toggle': 'EuiSlideToggleComponent',\n },\n },\n EuiTableModule: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTableV2Module: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTabsModule: {\n importPath: '@eui/components/eui-tabs',\n selectors: {\n 'eui-tabs': 'EuiTabsComponent',\n 'eui-tab': 'EuiTabComponent',\n 'eui-tab-header': 'EuiTabHeaderComponent',\n 'eui-tab-body': 'EuiTabBodyComponent',\n },\n },\n EuiTextAreaModule: {\n importPath: '@eui/components/eui-textarea',\n selectors: {\n euiTextArea: 'EuiTextareaComponent',\n },\n },\n EuiTimelineModule: {\n importPath: '@eui/components/eui-timeline',\n selectors: {\n 'eui-timeline': 'EuiTimelineComponent',\n 'eui-timeline-item': 'EuiTimelineItemComponent',\n },\n },\n EuiTimepickerModule: {\n importPath: '@eui/components/eui-timepicker',\n selectors: {\n 'eui-timepicker': 'EuiTimepickerComponent',\n },\n },\n EuiTreeModule: {\n importPath: '@eui/components/eui-tree',\n selectors: {\n 'eui-tree': 'EuiTreeComponent',\n },\n },\n EuiTreeListModule: {\n importPath: '@eui/components/eui-tree-list',\n selectors: {\n 'eui-tree-list': 'EuiTreeListComponent',\n 'eui-tree-list-item': 'EuiTreeListItemComponent',\n },\n },\n EuiUserProfileModule: {\n importPath: '@eui/components/eui-user-profile',\n selectors: {\n 'eui-user-profile': 'EuiUserProfileComponent',\n },\n },\n EuiWizardModule: {\n importPath: '@eui/components/eui-wizard',\n selectors: {\n 'eui-wizard': 'EuiWizardComponent',\n 'eui-wizard-step': 'EuiWizardStepComponent',\n },\n },\n EuiTooltipDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTooltip: 'EuiTooltipDirective',\n },\n },\n EuiTemplateDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTemplate: 'EuiTemplateDirective',\n },\n },\n EuiResizableDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiResizable: 'EuiResizableDirective',\n 'eui-resizable': 'EuiResizableComponent',\n },\n },\n EuiMaxLengthDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiEditorMaxlength: 'EuiMaxLengthDirective',\n },\n },\n EuiTruncatePipeModule: {\n importPath: '@eui/components/pipes',\n selectors: {\n euiTruncate: 'EuiTruncatePipe',\n },\n },\n EuiLayoutModule: {\n importPath: '@eui/components/layout',\n selectors: {\n 'eui-app': 'EuiAppComponent',\n 'eui-header': 'EuiHeaderComponent',\n 'eui-footer': 'EuiFooterComponent',\n 'eui-toolbar': 'EuiToolbarComponent',\n 'eui-sidebar-toggle': 'EuiSidebarToggleComponent',\n },\n },\n};\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nexport function migrateToStandalone(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n const allModuleNames = Object.keys(MODULE_MAPPINGS);\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const source = buffer.toString('utf-8');\n if (!allModuleNames.some((m) => source.includes(m))) return;\n\n const sourceFile = ts.createSourceFile(path, source, ts.ScriptTarget.Latest, true);\n const componentDecorators = findComponentDecorators(sourceFile);\n\n for (const decorator of componentDecorators) {\n const importsNode = findImportsArrayNode(decorator);\n if (!importsNode) continue;\n\n const currentSource = tree.read(path)!.toString('utf-8');\n const modulesInArray = allModuleNames.filter((m) => hasModuleInArray(importsNode, m, source));\n if (modulesInArray.length === 0) continue;\n\n const templateSelectors = getTemplateSelectors(tree, path, decorator, source);\n const replacements = buildReplacements(modulesInArray, templateSelectors);\n if (replacements.size === 0) continue;\n\n const result = applyReplacements(currentSource, path, replacements);\n if (options.dryRun) {\n logDryRun(context, `Would replace module imports with standalone imports in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n }\n });\n\n context.logger.info('Migration to standalone imports complete.');\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n\nfunction buildReplacements(moduleNames: string[], templateSelectors: Set<string>): Map<string, { components: string[]; importPath: string }> {\n const map = new Map<string, { components: string[]; importPath: string }>();\n\n for (const moduleName of moduleNames) {\n const mapping = MODULE_MAPPINGS[moduleName];\n const components: string[] = [];\n\n for (const [selector, component] of Object.entries(mapping.selectors)) {\n if (templateSelectors.has(selector)) {\n components.push(component);\n }\n }\n\n if (components.length > 0) {\n map.set(moduleName, { components: [...new Set(components)].sort(), importPath: mapping.importPath });\n }\n }\n\n return map;\n}\n\nfunction findComponentDecorators(sourceFile: ts.SourceFile): ts.Decorator[] {\n const decorators: ts.Decorator[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (decs) {\n for (const dec of decs) {\n if (ts.isCallExpression(dec.expression) && ts.isIdentifier(dec.expression.expression) && dec.expression.expression.text === 'Component') {\n decorators.push(dec);\n }\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return decorators;\n}\n\nfunction findImportsArrayNode(decorator: ts.Decorator): ts.ArrayLiteralExpression | undefined {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) return undefined;\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'imports') {\n if (ts.isArrayLiteralExpression(prop.initializer)) {\n return prop.initializer;\n }\n }\n }\n return undefined;\n}\n\nfunction hasModuleInArray(array: ts.ArrayLiteralExpression, moduleName: string, source: string): boolean {\n return array.elements.some((el) => source.slice(el.getStart(), el.getEnd()).trim() === moduleName);\n}\n\nfunction getTemplateSelectors(tree: Tree, tsPath: string, decorator: ts.Decorator, source: string): Set<string> {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0] as ts.ObjectLiteralExpression;\n const allSelectors = Object.values(MODULE_MAPPINGS).flatMap((m) => Object.keys(m.selectors));\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'template') {\n const init = prop.initializer;\n if (ts.isStringLiteral(init) || ts.isNoSubstitutionTemplateLiteral(init)) {\n return findSelectorsInTemplate(init.text, allSelectors);\n }\n }\n }\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'templateUrl') {\n if (ts.isStringLiteral(prop.initializer)) {\n const dir = tsPath.substring(0, tsPath.lastIndexOf('/'));\n const templateBuffer = tree.read(`${dir}/${prop.initializer.text}`);\n if (templateBuffer) {\n return findSelectorsInTemplate(templateBuffer.toString('utf-8'), allSelectors);\n }\n }\n }\n }\n\n return new Set();\n}\n\nfunction findSelectorsInTemplate(html: string, knownSelectors: string[]): Set<string> {\n const selectors = new Set<string>();\n const parsed = parseTemplate(html, '', { preserveWhitespaces: true });\n\n forEachElement(parsed.nodes, (node) => {\n if (knownSelectors.includes(node.name)) selectors.add(node.name);\n for (const attr of node.attributes) {\n if (knownSelectors.includes(attr.name)) selectors.add(attr.name);\n }\n });\n return selectors;\n}\n\nfunction applyReplacements(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n let result = replaceInImportsArray(source, sourceFile, replacements);\n result = updateEsImports(result, filePath, replacements);\n return result;\n}\n\nfunction replaceInImportsArray(source: string, sourceFile: ts.SourceFile, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (!decs) return;\n for (const dec of decs) {\n if (!ts.isCallExpression(dec.expression) || !ts.isIdentifier(dec.expression.expression) || dec.expression.expression.text !== 'Component') continue;\n const metadata = dec.expression.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) continue;\n for (const prop of metadata.properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name) || prop.name.text !== 'imports') continue;\n if (!ts.isArrayLiteralExpression(prop.initializer)) continue;\n const newElements = prop.initializer.elements\n .map((el) => {\n const text = result.slice(el.getStart(sourceFile), el.getEnd()).trim();\n const replacement = replacements.get(text);\n return replacement ? replacement.components.join(', ') : text;\n })\n .join(', ');\n result = result.slice(0, prop.initializer.getStart(sourceFile) + 1) + newElements + result.slice(prop.initializer.getEnd() - 1);\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return result;\n}\n\nfunction updateEsImports(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n\n for (const [moduleName, { components, importPath }] of replacements) {\n const sf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n\n for (const stmt of sf.statements) {\n if (!ts.isImportDeclaration(stmt) || !stmt.importClause?.namedBindings || !ts.isNamedImports(stmt.importClause.namedBindings)) continue;\n const namedBindings = stmt.importClause.namedBindings;\n const importNames = namedBindings.elements.map((el) => el.name.text);\n if (!importNames.includes(moduleName)) continue;\n\n const moduleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const remaining = importNames.filter((n) => n !== moduleName);\n const toAdd = components.filter((c) => !importNames.includes(c));\n\n if (moduleSpecifier === importPath) {\n const newNames = [...remaining, ...toAdd].sort();\n const newClause = `{ ${newNames.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n if (remaining.length > 0) {\n const newClause = `{ ${remaining.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n result = result.slice(0, stmt.getStart(sf)) + result.slice(stmt.getEnd()).replace(/^\\r?\\n/, '');\n }\n\n if (toAdd.length > 0) {\n const updatedSf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n const existing = updatedSf.statements.find(\n (s) => ts.isImportDeclaration(s) && ts.isStringLiteral(s.moduleSpecifier) && s.moduleSpecifier.text === importPath,\n ) as ts.ImportDeclaration | undefined;\n\n if (existing?.importClause?.namedBindings && ts.isNamedImports(existing.importClause.namedBindings)) {\n const existingNames = existing.importClause.namedBindings.elements.map((el) => el.name.text);\n const allNames = [...new Set([...existingNames, ...toAdd])].sort();\n const newClause = `{ ${allNames.join(', ')} }`;\n result = result.slice(0, existing.importClause.namedBindings.getStart(updatedSf)) + newClause + result.slice(existing.importClause.namedBindings.getEnd());\n } else {\n const newImport = `import { ${toAdd.join(', ')} } from '${importPath}';\\n`;\n result = newImport + result;\n }\n }\n }\n break;\n }\n }\n\n return result;\n}\n",
5972
+ "sourceCode": "import { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { forEachElement } from '../utils/template-walk';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\nimport {\n EUI_SIGNAL_MAP as EUI_SIGNAL_MAP_RAW,\n EUI_SELECTOR_TO_CLASS as EUI_SELECTOR_TO_CLASS_RAW,\n EUI_OUTPUT_MAP,\n EUI_HOST_BINDING_REMOVED_MAP,\n EUI_WRITABLE_SIGNAL_MAP,\n} from './signal-map';\nimport { ECL_SIGNAL_MAP, ECL_SELECTOR_TO_CLASS } from './ecl-signal-map';\n\n/**\n * Combined EUI + ECL signal maps. The migration logic is identical for both\n * libraries (plain field → signal getter), so the maps are merged and the rest\n * of the engine treats them uniformly. EUI and ECL class names don't collide\n * (Eui* vs Ecl* prefixes), and the selector namespaces are disjoint.\n */\nconst EUI_SIGNAL_MAP: Record<string, ReadonlySet<string>> = { ...EUI_SIGNAL_MAP_RAW, ...ECL_SIGNAL_MAP };\nconst EUI_SELECTOR_TO_CLASS: Record<string, string> = { ...EUI_SELECTOR_TO_CLASS_RAW, ...ECL_SELECTOR_TO_CLASS };\n\n/** Every class the schematic knows about (signals, outputs or removed host bindings). */\nconst KNOWN_CLASSES: ReadonlySet<string> = new Set([\n ...Object.keys(EUI_SIGNAL_MAP),\n ...Object.keys(EUI_OUTPUT_MAP),\n ...Object.keys(EUI_HOST_BINDING_REMOVED_MAP),\n]);\nconst isKnownClass = (name: string | null | undefined): name is string => !!name && KNOWN_CLASSES.has(name);\n\n/**\n * Tracked references. Class members are tracked by name (reached via `this.name`); locals/parameters are\n * tracked by their DECLARATION node, so a same-named untracked parameter or variable is never confused\n * with a tracked class member (shadowing). `lists*` hold QueryList<EuiXxx> / EuiXxx[] holders.\n */\ninterface Refs {\n props: Map<string, string>;\n propLists: Map<string, string>;\n decls: Map<ts.Node, string>;\n listDecls: Map<ts.Node, string>;\n}\n\n/** rxjs functions that take Observables as (possibly array-wrapped) arguments. */\nconst OBSERVABLE_COMBINATORS = new Set([\n 'merge', 'race', 'combineLatest', 'forkJoin', 'concat', 'zip', 'firstValueFrom', 'lastValueFrom', 'raceWith', 'mergeWith', 'concatWith', 'zipWith', 'combineLatestWith',\n]);\n\n/** Observable methods that need a real Observable instead of an OutputEmitterRef. */\nconst OBSERVABLE_METHODS = new Set(['subscribe', 'pipe', 'asObservable', 'forEach', 'toPromise']);\n/** QueryList iteration methods whose callback parameter is an element of the list. */\nconst LIST_ITERATION_METHODS = new Set(['forEach', 'map', 'filter', 'some', 'every', 'find', 'findIndex', 'reduce']);\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n /** When several zero-width edits share a position, `after` ones end up after the others. */\n after?: boolean;\n}\n\n/**\n * Migrates consumer code that accesses EUI or ECL component instances\n * programmatically.\n *\n * When EUI/ECL migrated @Input() → input(), @ViewChild() → viewChild(), and\n * @ContentChild() → contentChild(), properties that were plain class fields\n * became signal getters. Consumers who access them via @ViewChild need to\n * change `comp.prop` to `comp.prop()`.\n *\n * This schematic:\n * 1. Finds @ViewChild / @ContentChild fields typed as EUI component classes\n * 2. Resolves untyped @ViewChild('refName') by reading the component template\n * and matching #refName to an EUI element tag/selector\n * 3. Tracks which local variable names hold EUI component references (incl. aliases)\n * 4. Rewrites property accesses on those references: `ref.prop` → `ref.prop()`\n * (only for properties listed in the signal map)\n * 5. Does NOT touch template bindings — those are unaffected by signal migrations\n */\nexport function migrateToSignals(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n let propCount = 0;\n let todoCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n // Skip spec files — test code may use different patterns\n if (path.endsWith('.spec.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n\n // Fast bail: file must mention at least one EUI class name or have\n // ViewChild/ContentChild with string refs (which might reference EUI elements)\n if (!hasEuiReference(original) && !hasStringRefQuery(original)) return;\n\n const result = migrateTypeScript(original, path, tree, context);\n if (result.source !== original) {\n if (options.dryRun) {\n if (result.editCount > 0) {\n logDryRun(context, `Would migrate ${result.editCount} signal property access(es) in ${path}`);\n }\n if (result.todoCount > 0) {\n logDryRun(\n context,\n `Would comment out ${result.todoCount} programmatic signal-input write(s) with a TODO in ${path}`,\n );\n }\n } else {\n tree.overwrite(path, result.source);\n }\n fileCount++;\n propCount += result.editCount;\n todoCount += result.todoCount;\n }\n });\n\n context.logger.info(`Migrated ${propCount} property access(es) to signal getters in ${fileCount} file(s).`);\n if (todoCount > 0) {\n context.logger.info(\n `Commented out ${todoCount} programmatic signal-input write(s) and left a TODO — these cannot be migrated automatically and need a manual fix.`,\n );\n }\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\n/** Quick check: does the file reference any EUI class name from the signal map? */\nfunction hasEuiReference(source: string): boolean {\n for (const className of KNOWN_CLASSES) {\n if (source.includes(className)) return true;\n }\n return false;\n}\n\n/** Quick check: does the file have @ViewChild('...') or @ContentChild('...') with string refs? */\nfunction hasStringRefQuery(source: string): boolean {\n return /(@ViewChild|@ContentChild|@ViewChildren|@ContentChildren)\\s*\\(\\s*['\"]/.test(source);\n}\n\ninterface MigrateResult {\n source: string;\n editCount: number;\n todoCount: number;\n}\n\nfunction migrateTypeScript(source: string, filePath: string, tree: Tree, context: SchematicContext): MigrateResult {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n const todoEdits: Edit[] = [];\n\n // Phase 0: Build template ref map (#refName → EUI class name) from the component's template\n const templateRefMap = buildTemplateRefMap(sourceFile, source, filePath, tree);\n\n // Phase 1: Collect all variables/properties typed as EUI classes\n const euiRefs = collectEuiReferences(sourceFile, source, templateRefMap);\n\n if (euiRefs.props.size === 0 && euiRefs.propLists.size === 0 && euiRefs.decls.size === 0 && euiRefs.listDecls.size === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const hostTodoEdits: Edit[] = [];\n let needsOutputImport = false;\n\n // Phase 2: Find property accesses on those references and rewrite signal props\n const visitNode = (node: ts.Node): void => {\n // Match: ref.prop (PropertyAccessExpression)\n if (ts.isPropertyAccessExpression(node)) {\n const rewrite = tryRewritePropertyAccess(node, euiRefs, sourceFile, source);\n if (rewrite) {\n edits.push(rewrite);\n }\n\n // Writable signal (model()): `ref.prop = value` -> `ref.prop.set(value)`\n edits.push(...trySetRewrite(node, euiRefs, sourceFile));\n\n // Output: `ref.out.subscribe()` -> `outputToObservable(ref.out).subscribe()`\n const wrap = tryWrapOutput(node, euiRefs, sourceFile);\n if (wrap) {\n edits.push(...wrap);\n needsOutputImport = true;\n }\n\n // Output handed to rxjs combinators / used as a value: wrap or flag\n const outputUse = tryOutputUsage(node, euiRefs, sourceFile, source);\n if (outputUse) {\n edits.push(...outputUse.edits);\n if (outputUse.todo) hostTodoEdits.push(outputUse.todo);\n if (outputUse.edits.length > 0) needsOutputImport = true;\n }\n\n // Removed @HostBinding property: flag with a TODO\n const hostTodo = tryHostBindingTodo(node, euiRefs, sourceFile, source);\n if (hostTodo) {\n hostTodoEdits.push(hostTodo);\n }\n\n // Separately: a programmatic WRITE to a now-signal input cannot be\n // migrated automatically. Flag it with a TODO instead of silently\n // leaving a line that will fail to compile against the signal API.\n const todo = tryInsertWriteTodo(node, euiRefs, sourceFile, source);\n if (todo) {\n todoEdits.push(todo);\n }\n }\n // Destructuring / aliasing of a tracked reference cannot be followed: flag it.\n const alias = tryAliasTodo(node, euiRefs, sourceFile, source);\n if (alias) hostTodoEdits.push(alias);\n ts.forEachChild(node, visitNode);\n };\n\n ts.forEachChild(sourceFile, visitNode);\n\n if (edits.length === 0 && todoEdits.length === 0 && hostTodoEdits.length === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const dedupedTodos = deduplicateEdits(todoEdits);\n const dedupedHostTodos = deduplicateEdits(hostTodoEdits);\n\n // A TODO edit comments out the whole write statement. Any read-rewrite `()`\n // edit whose position falls inside that commented-out range must be dropped,\n // otherwise we'd both edit and comment the same text (and produce overlapping\n // edits that corrupt the output).\n const keptEdits = edits.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const keptHostTodos = dedupedHostTodos.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const importEdit = needsOutputImport ? buildOutputImportEdit(sourceFile) : null;\n\n return {\n source: applyEdits(source, [...keptEdits, ...dedupedTodos, ...keptHostTodos, ...(importEdit ? [importEdit] : [])]),\n editCount: keptEdits.length,\n todoCount: dedupedTodos.length + keptHostTodos.length,\n };\n}\n\n/**\n * Scans the source file for class properties or variables typed as EUI component classes.\n * Returns a map: localName → Set of signal property names.\n *\n * Handles:\n * @ViewChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild(EuiXxxComponent) name!: EuiXxxComponent;\n * @ViewChild('ref') name: EuiXxxComponent;\n * @ContentChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild('ref') name: ElementRef; (resolved via template #ref → EUI selector)\n * someVar: EuiXxxComponent; (typed class field, even without decorator)\n * const alias = this.viewChildRef; (alias tracking)\n */\nfunction collectEuiReferences(\n sourceFile: ts.SourceFile,\n source: string,\n templateRefMap: Map<string, string>,\n): Refs {\n const tracked: Refs = { props: new Map(), propLists: new Map(), decls: new Map(), listDecls: new Map() };\n const { props, propLists, decls, listDecls } = tracked;\n\n // Pass 1: collect directly-typed references\n const visitDirect = (node: ts.Node): void => {\n // Class property declarations\n if (ts.isPropertyDeclaration(node) && node.name && ts.isIdentifier(node.name)) {\n const euiClass = resolveEuiClassName(node, sourceFile, templateRefMap);\n if (isKnownClass(euiClass)) {\n (isListProperty(node) ? propLists : props).set(node.name.text, euiClass);\n }\n }\n\n // Variable (const x: EuiXxxComponent = ...) and parameter (method(ref: EuiXxxComponent)) declarations\n if ((ts.isVariableDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n decls.set(node, typeName);\n // constructor parameter property: also reachable as `this.name`\n if (ts.isParameter(node) && (ts.getModifiers?.(node) ?? []).length > 0) props.set(node.name.text, typeName);\n } else {\n const listClass = listElementClass(node.type);\n if (listClass) listDecls.set(node, listClass);\n }\n }\n\n ts.forEachChild(node, visitDirect);\n };\n\n ts.forEachChild(sourceFile, visitDirect);\n\n // Pass 2: aliases, QueryList/array iteration (source order)\n const visitAlias = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && !decls.has(node)) {\n const aliased = trackedClass(node.initializer, tracked);\n if (aliased) decls.set(node, aliased);\n const aliasedList = listClassOf(node.initializer, tracked);\n if (aliasedList) listDecls.set(node, aliasedList);\n }\n\n // list.forEach((el) => ...) / list.map(function (el) {...}) -> `el` is an element of the list\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n LIST_ITERATION_METHODS.has(node.expression.name.text)\n ) {\n const listClass = listClassOf(node.expression.expression, tracked);\n const callback = node.arguments[0];\n if (\n listClass &&\n callback &&\n (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) &&\n callback.parameters[0] &&\n ts.isIdentifier(callback.parameters[0].name) &&\n !callback.parameters[0].type\n ) {\n decls.set(callback.parameters[0], listClass);\n }\n }\n\n // for (const el of list) -> `el` is an element of the list\n if (ts.isForOfStatement(node) && ts.isVariableDeclarationList(node.initializer)) {\n const listClass = listClassOf(node.expression, tracked);\n const decl = node.initializer.declarations[0];\n if (listClass && decl && ts.isIdentifier(decl.name) && !decls.has(decl)) decls.set(decl, listClass);\n }\n\n ts.forEachChild(node, visitAlias);\n };\n\n ts.forEachChild(sourceFile, visitAlias);\n return tracked;\n}\n\n/** `EuiXxx[]`, `Array<EuiXxx>`, `QueryList<EuiXxx>` -> the known element class. */\nfunction listElementClass(type: ts.TypeNode | undefined): string | null {\n if (!type) return null;\n if (ts.isArrayTypeNode(type)) {\n const n = getTypeAnnotationName(type.elementType);\n return isKnownClass(n) ? n : null;\n }\n if (ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && ['Array', 'ReadonlyArray', 'QueryList'].includes(type.typeName.text)) {\n const n = getTypeAnnotationName(type.typeArguments?.[0]);\n return isKnownClass(n) ? n : null;\n }\n return null;\n}\n\n/** Strips parentheses, `!`, `as T`, `<T>x` and `satisfies`. */\nfunction unwrap(expr: ts.Expression): ts.Expression {\n let cur = expr;\n while (\n ts.isParenthesizedExpression(cur) ||\n ts.isNonNullExpression(cur) ||\n ts.isAsExpression(cur) ||\n ts.isTypeAssertionExpression(cur) ||\n ts.isSatisfiesExpression(cur)\n ) {\n cur = cur.expression;\n }\n return cur;\n}\n\n/** Nearest declaration (parameter / variable / binding element) of a bare identifier, or null. */\nfunction findDeclaration(id: ts.Identifier): ts.Node | null {\n const name = id.text;\n const boundIn = (bn: ts.BindingName): boolean =>\n ts.isIdentifier(bn) ? bn.text === name : bn.elements.some((e) => !ts.isOmittedExpression(e) && boundIn(e.name));\n const matchDecl = (d: ts.ParameterDeclaration | ts.VariableDeclaration): ts.Node | null => (boundIn(d.name) ? d : null);\n\n for (let cur: ts.Node | undefined = id.parent; cur; cur = cur.parent) {\n if (ts.isFunctionLike(cur)) {\n for (const p of cur.parameters) {\n const m = matchDecl(p);\n if (m) return m;\n }\n }\n if (ts.isBlock(cur) || ts.isSourceFile(cur) || ts.isModuleBlock(cur) || ts.isCaseClause(cur) || ts.isDefaultClause(cur)) {\n const stmts = ts.isCaseClause(cur) || ts.isDefaultClause(cur) ? cur.statements : cur.statements;\n for (const st of stmts) {\n if (ts.isVariableStatement(st)) {\n for (const d of st.declarationList.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n }\n }\n if ((ts.isForStatement(cur) || ts.isForOfStatement(cur) || ts.isForInStatement(cur)) && cur.initializer && ts.isVariableDeclarationList(cur.initializer)) {\n for (const d of cur.initializer.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n if (ts.isCatchClause(cur) && cur.variableDeclaration) {\n const m = matchDecl(cur.variableDeclaration);\n if (m) return m;\n }\n }\n return null;\n}\n\n/** `this.name` -> name; anything else null. */\nfunction thisMemberName(expr: ts.Expression): string | null {\n return ts.isPropertyAccessExpression(expr) && expr.expression.kind === ts.SyntaxKind.ThisKeyword ? expr.name.text : null;\n}\n\n/** Element class of a tracked QueryList / array expression, or null. */\nfunction listClassOf(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.listDecls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n return member ? (tracked.propLists.get(member) ?? null) : null;\n}\n\n/**\n * Resolves the EUI class name from a property declaration.\n * Checks: type annotation → decorator class argument → template ref map.\n */\nfunction resolveEuiClassName(\n node: ts.PropertyDeclaration,\n sourceFile: ts.SourceFile,\n templateRefMap: Map<string, string>,\n): string | null {\n // Check type annotation first\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n return typeName;\n }\n\n const arrayClass = listElementClass(node.type);\n if (arrayClass) return arrayClass;\n\n // Check generic type argument: ElementRef<EuiXxxComponent> / QueryList<EuiXxxComponent>\n if (node.type && ts.isTypeReferenceNode(node.type) && node.type.typeArguments?.length) {\n const genericArg = getTypeAnnotationName(node.type.typeArguments[0]);\n if (isKnownClass(genericArg)) {\n return genericArg;\n }\n }\n\n // Check decorator arguments: @ViewChild(EuiXxxComponent) or @ViewChild('refName')\n if (node.modifiers) {\n for (const modifier of node.modifiers) {\n if (!ts.isDecorator(modifier)) continue;\n if (!ts.isCallExpression(modifier.expression)) continue;\n\n const decoratorName = getDecoratorName(modifier.expression);\n if (!decoratorName) continue;\n if (!['ViewChild', 'ViewChildren', 'ContentChild', 'ContentChildren'].includes(decoratorName)) continue;\n\n const args = modifier.expression.arguments;\n if (args.length > 0) {\n const firstArg = args[0];\n\n // @ViewChild(EuiXxxComponent) — class reference\n if (ts.isIdentifier(firstArg) && isKnownClass(firstArg.text)) {\n return firstArg.text;\n }\n\n // @ViewChild('refName') — string template ref, resolve via template\n if (ts.isStringLiteralLike(firstArg)) {\n const refName = firstArg.text;\n const euiClass = templateRefMap.get(refName);\n if (isKnownClass(euiClass)) {\n return euiClass;\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/** True for `@ViewChildren/@ContentChildren` fields and `QueryList<...>`-typed fields. */\nfunction isListProperty(node: ts.PropertyDeclaration): boolean {\n if (listElementClass(node.type)) return true;\n if (node.type && ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName) && node.type.typeName.text === 'QueryList') {\n return true;\n }\n return (ts.getDecorators?.(node) ?? []).some(\n (d) => ts.isCallExpression(d.expression) && ['ViewChildren', 'ContentChildren'].includes(getDecoratorName(d.expression) ?? ''),\n );\n}\n\n/**\n * Resolves an expression to the tracked EUI class: `ref`, `this.ref`, `this.ref!`, `(this.ref as any)`,\n * the `.first` / `.last` element of a tracked QueryList, or `list[i]` of a tracked list/array.\n */\nfunction trackedClass(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.decls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n if (member) return tracked.props.get(member) ?? null;\n if (ts.isPropertyAccessExpression(e) && (e.name.text === 'first' || e.name.text === 'last')) {\n return listClassOf(e.expression, tracked);\n }\n if (ts.isElementAccessExpression(e)) return listClassOf(e.expression, tracked);\n return null;\n}\n\nfunction getDecoratorName(callExpr: ts.CallExpression): string | null {\n if (ts.isIdentifier(callExpr.expression)) {\n return callExpr.expression.text;\n }\n return null;\n}\n\nfunction getTypeAnnotationName(typeNode: ts.TypeNode | undefined): string | null {\n if (!typeNode) return null;\n if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n return null;\n}\n\n/**\n * Checks if a property access `ref.prop` should be rewritten to `ref.prop()`.\n *\n * We rewrite if:\n * - `ref` is tracked in euiRefs\n * - `prop` is in the signal set for that EUI class\n * - The access is NOT already a call expression (not `ref.prop()` or `ref.prop(args)`)\n * - The access is NOT a write target (not `ref.prop = value`)\n * - The access is NOT a template binding argument (those are unaffected)\n */\nfunction tryRewritePropertyAccess(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n // Resolve the reference class — handle `this.ref.prop`, `ref.prop`, `list.first.prop`\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Skip if parent is already a call expression on this property: ref.prop(...)\n if (ts.isCallExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip a signal handed to toObservable(ref.prop): it needs the signal itself (e.g. written by migrate-eui-tab-signals)\n if (ts.isCallExpression(node.parent) && node.parent.arguments[0] === node &&\n ts.isIdentifier(node.parent.expression) && node.parent.expression.text === 'toObservable') {\n return null;\n }\n\n // Skip signal API access already in place: ref.prop.set(..) / .update(..) / .asReadonly()\n if (ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node &&\n ['set', 'update', 'asReadonly'].includes(node.parent.name.text)) {\n return null;\n }\n\n // Skip if this is the left side of an assignment: ref.prop = value\n if (ts.isBinaryExpression(node.parent) &&\n node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n node.parent.left === node) {\n return null;\n }\n\n // Skip if this is a compound assignment: ref.prop += value, ref.prop &&= value, etc.\n if (ts.isBinaryExpression(node.parent) && isAssignmentOperator(node.parent.operatorToken.kind) && node.parent.left === node) {\n return null;\n }\n\n // Skip if this is used with delete: delete ref.prop\n if (ts.isDeleteExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip if inside a typeof: typeof ref.prop\n if (ts.isTypeOfExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip property access chains that go deeper: ref.prop.something → ref.prop().something\n // This IS correct — we still want to add ()\n\n // Rewrite: insert () after the property name\n const end = node.name.getEnd();\n return {\n start: end,\n end: end,\n replacement: '()',\n };\n}\n\nfunction isAssignmentOperator(kind: ts.SyntaxKind): boolean {\n return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;\n}\n\n/** Marker used to detect an already-inserted TODO so the schematic stays idempotent. */\nconst WRITE_TODO_MARKER = 'TODO(eui-signals):';\n\n/**\n * Detects a programmatic WRITE to a now-signal input and returns an edit that\n * comments out the offending statement and prepends an explanatory TODO.\n *\n * A signal input (`input()`) exposes a read-only getter — it cannot be assigned\n * from outside the component (`comp.prop = value` no longer compiles, and\n * `comp.prop()` is a getter, not a setter). There is no safe, mechanical\n * rewrite: the correct fix is to drive the value declaratively through a\n * template binding (`[prop]=\"...\"`) or, when a ComponentRef is genuinely\n * available, `componentRef.setInput('prop', value)`. Both require human\n * judgement, so instead of rewriting we comment the statement out (keeping the\n * build green) and leave a TODO pointing at the manual fix.\n *\n * Only acts when the assignment is the ENTIRE statement\n * (`ExpressionStatement` whose expression is exactly this assignment):\n * ref.prop = value (simple assignment)\n * ref.prop += value, etc. (compound assignment)\n * where `ref` is a tracked EUI/ECL reference and `prop` is in its signal set.\n *\n * When the write is only part of a larger statement (e.g. inside an `if`\n * without a block, or nested in another expression), commenting it out would\n * also remove unrelated logic, so we leave it untouched (it will surface as a\n * compile error the developer must resolve by hand).\n */\nfunction tryInsertWriteTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Only act on assignment targets: `ref.prop = ...` or `ref.prop <op>= ...`\n if (\n !ts.isBinaryExpression(node.parent) ||\n node.parent.left !== node ||\n !isAssignmentOperator(node.parent.operatorToken.kind)\n ) {\n return null;\n }\n\n const assignment = node.parent;\n\n // A plain `=` to a writable signal is migrated to `.set()` by trySetRewrite\n if (assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken && EUI_WRITABLE_SIGNAL_MAP[cls]?.has(propName)) {\n return null;\n }\n\n // Only comment out when the assignment IS the whole statement — otherwise we'd\n // delete unrelated logic from a larger statement.\n const statement = node.parent.parent;\n if (!statement || !ts.isExpressionStatement(statement) || statement.expression !== assignment) {\n return null;\n }\n\n // The statement must stand on its own (a direct child of a block/source), not\n // be the unbraced body of an `if`/`for`/`while` etc. — commenting those out by\n // line would swallow the surrounding `if (...)` and break the code.\n const parent = statement.parent;\n if (\n !parent ||\n !(ts.isBlock(parent) || ts.isSourceFile(parent) || ts.isModuleBlock(parent) || ts.isCaseClause(parent) || ts.isDefaultClause(parent))\n ) {\n return null;\n }\n\n const stmtStart = statement.getStart(sourceFile);\n const stmtEnd = statement.getEnd(); // includes the trailing semicolon\n const lineStart = getLineStartPosition(source, stmtStart);\n const indent = source.slice(lineStart, stmtStart);\n\n // Commenting works per line: the statement must be alone on its lines, otherwise\n // (e.g. `run() { ref.prop = 1; }`) we would comment out surrounding code.\n const eol = source.indexOf('\\n', stmtEnd);\n const restOfLine = source.slice(stmtEnd, eol === -1 ? source.length : eol);\n if (indent.trim() !== '' || restOfLine.trim() !== '') {\n return null;\n }\n\n // The statement text, as written (may span multiple lines).\n const statementText = source.slice(stmtStart, stmtEnd);\n\n // Comment out every line of the statement, preserving each line's own\n // indentation (insert `// ` after the leading whitespace). The first line's\n // indentation was stripped by starting the replacement at lineStart, so we\n // re-add it explicitly.\n const commentedStatement = statementText\n .split('\\n')\n .map((line, i) => {\n if (i === 0) return `${indent}// ${line}`;\n const lineIndent = line.slice(0, line.length - line.trimStart().length);\n return `${lineIndent}// ${line.trimStart()}`;\n })\n .join('\\n');\n\n const todo =\n `${indent}// ${WRITE_TODO_MARKER} '${propName}' is now a signal input and cannot be assigned directly.\\n` +\n `${indent}// Set it via a template binding ([${propName}]=\"...\") or componentRef.setInput('${propName}', ...).\\n` +\n `${indent}// The original statement is commented out below so the build does not fail:\\n`;\n\n // Replace the statement (from the start of its line, to drop the original\n // indentation we re-add) with the TODO + commented-out statement.\n return {\n start: lineStart,\n end: stmtEnd,\n replacement: todo + commentedStatement,\n };\n}\n\n/** `ref.prop = value;` on a writable signal -> `ref.prop.set(value);` (two zero-width-safe edits). */\nfunction trySetRewrite(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] {\n const assignment = node.parent;\n if (\n !ts.isBinaryExpression(assignment) ||\n assignment.left !== node ||\n assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken ||\n !ts.isExpressionStatement(assignment.parent)\n ) {\n return [];\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_WRITABLE_SIGNAL_MAP[cls]?.has(node.name.text)) return [];\n\n return [\n { start: node.getEnd(), end: assignment.right.getStart(sourceFile), replacement: '.set(' },\n { start: assignment.right.getEnd(), end: assignment.right.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** `ref.out.subscribe(...)` -> `outputToObservable(ref.out).subscribe(...)`. */\nfunction tryWrapOutput(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] | null {\n const parent = node.parent;\n if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node || !OBSERVABLE_METHODS.has(parent.name.text)) {\n return null;\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n\n const start = node.getStart(sourceFile);\n return [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** Marker for a read of a property that was a @HostBinding and no longer exists. */\nconst HOST_TODO_MARKER = 'TODO(eui-signals):';\n\nfunction tryHostBindingTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_HOST_BINDING_REMOVED_MAP[cls]?.has(propName) || EUI_SIGNAL_MAP[cls]?.has(propName)) return null;\n return flagTodo(\n node,\n sourceFile,\n source,\n `'${propName}' was a @HostBinding`,\n `'${propName}' was a @HostBinding property of ${cls} and no longer exists on the instance ` +\n '(moved to static host metadata). Remove or replace this access.',\n );\n}\n\n/**\n * Inserts a `// TODO(eui-signals): <message>` line above the enclosing statement / class member.\n * `key` identifies the TODO for idempotency (looked for in the comment lines right above).\n */\nfunction flagTodo(node: ts.Node, sourceFile: ts.SourceFile, source: string, key: string, message: string): Edit | null {\n // Anchor on the enclosing statement / class member\n let anchor: ts.Node = node;\n while (\n anchor.parent &&\n !(\n ts.isBlock(anchor.parent) ||\n ts.isSourceFile(anchor.parent) ||\n ts.isModuleBlock(anchor.parent) ||\n ts.isCaseClause(anchor.parent) ||\n ts.isDefaultClause(anchor.parent) ||\n ts.isClassLike(anchor.parent)\n )\n ) {\n anchor = anchor.parent;\n }\n\n const lineStart = getLineStartPosition(source, anchor.getStart(sourceFile));\n const indent = source.slice(lineStart).match(/^[ \\t]*/)![0];\n const text = `${indent}// ${HOST_TODO_MARKER} ${message}\\n`;\n\n // Idempotent: look at the contiguous comment lines right above\n const above = source.slice(0, lineStart).split('\\n').slice(-8).reverse();\n for (const line of above.slice(1)) {\n if (!line.trim().startsWith('//')) break;\n if (line.includes(`${HOST_TODO_MARKER} ${key}`) || line.includes(key)) return null;\n }\n // A single-line anchor like `run() { ... }` shares its line with other code: still fine, the comment goes above the line.\n return { start: lineStart, end: lineStart, replacement: text };\n}\n\n/**\n * An output (OutputEmitterRef) used as a value:\n * - an argument of an rxjs combinator (`merge(ref.out, ...)`, also inside an array) is wrapped in `outputToObservable()`;\n * - any other use that is not `.emit()` / `.subscribe()` & co / already wrapped is flagged with a TODO.\n */\nfunction tryOutputUsage(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): { edits: Edit[]; todo?: Edit | null } | null {\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n const parent = node.parent;\n\n // handled elsewhere (tryWrapOutput) or fine as is\n if (ts.isPropertyAccessExpression(parent) && parent.expression === node) return null;\n if (ts.isNonNullExpression(parent) || ts.isParenthesizedExpression(parent) || ts.isAsExpression(parent)) return null;\n // declared / written outputs are not reads\n if (ts.isBinaryExpression(parent) && parent.left === node) return null;\n\n // argument of a combinator?\n let arg: ts.Node = node;\n if (ts.isArrayLiteralExpression(arg.parent)) arg = arg.parent;\n const call = arg.parent;\n if (ts.isCallExpression(call) && call.arguments.includes(arg as ts.Expression)) {\n const callee = ts.isIdentifier(call.expression) ? call.expression.text : null;\n if (callee === 'outputToObservable') return null; // already migrated\n if (callee && OBSERVABLE_COMBINATORS.has(callee)) {\n const start = node.getStart(sourceFile);\n return {\n edits: [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ],\n };\n }\n }\n\n return {\n edits: [],\n todo: flagTodo(\n node,\n sourceFile,\n source,\n `output '${node.name.text}'`,\n `output '${node.name.text}' of ${cls} is an OutputEmitterRef, not an Observable. Wrap it with outputToObservable() ` +\n '(@angular/core/rxjs-interop) where an Observable is needed.',\n ),\n };\n}\n\n/** Destructuring of a tracked reference, or storing it in a field/variable we cannot follow. */\nfunction tryAliasTodo(node: ts.Node, euiRefs: Refs, sourceFile: ts.SourceFile, source: string): Edit | null {\n if (ts.isVariableDeclaration(node) && node.initializer && !ts.isIdentifier(node.name)) {\n const cls = trackedClass(node.initializer, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `destructuring of ${cls}`,\n `destructuring of ${cls} cannot be migrated automatically: its signal inputs/outputs must be read as ref.prop() / outputToObservable(ref.out).`,\n );\n }\n }\n if (\n ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n !ts.isIdentifier(unwrap(node.left)) &&\n ts.isExpressionStatement(node.parent)\n ) {\n const cls = trackedClass(node.right, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `aliasing of ${cls}`,\n `aliasing of ${cls}: this copy is not tracked, so its signal inputs/outputs must be updated manually (ref.prop()).`,\n );\n }\n }\n return null;\n}\n\n/** Adds `outputToObservable` to the file's imports (merging into an existing rxjs-interop import). */\nfunction buildOutputImportEdit(sourceFile: ts.SourceFile): Edit | null {\n let lastImportEnd = 0;\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n lastImportEnd = stmt.getEnd();\n if (!ts.isStringLiteral(stmt.moduleSpecifier) || stmt.moduleSpecifier.text !== '@angular/core/rxjs-interop') continue;\n const bindings = stmt.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings)) {\n if (bindings.elements.some((e) => e.name.text === 'outputToObservable')) return null;\n const last = bindings.elements[bindings.elements.length - 1];\n if (last) {\n return { start: last.getEnd(), end: last.getEnd(), replacement: ', outputToObservable' };\n }\n }\n }\n const line = 'import { outputToObservable } from \\'@angular/core/rxjs-interop\\';';\n return lastImportEnd === 0\n ? { start: 0, end: 0, replacement: `${line}\\n` }\n : { start: lastImportEnd, end: lastImportEnd, replacement: `\\n${line}` };\n}\n\n/** True if `edit`'s position falls within any of the given ranges. */\nfunction isInsideAnyRange(edit: Edit, ranges: Edit[]): boolean {\n return ranges.some((range) => edit.start >= range.start && edit.end <= range.end);\n}\n\n/** Returns the index of the first character of the line containing `pos`. */\nfunction getLineStartPosition(source: string, pos: number): number {\n const newlineIndex = source.lastIndexOf('\\n', pos - 1);\n return newlineIndex === -1 ? 0 : newlineIndex + 1;\n}\n\n// ---------------------------------------------------------------------------\n// Template ref resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Builds a map of template reference variable names (#ref) to EUI class names.\n *\n * Parses the component's template (inline or external) and finds elements like:\n * <eui-alert #myAlert> → myAlert → EuiAlertComponent\n * <input euiAutocomplete #ac> → ac → EuiAutocompleteComponent\n *\n * Returns Map<refName, euiClassName>.\n */\nfunction buildTemplateRefMap(\n sourceFile: ts.SourceFile,\n source: string,\n filePath: string,\n tree: Tree,\n): Map<string, string> {\n const refMap = new Map<string, string>();\n\n // Find @Component decorator\n const componentMeta = findComponentMetadata(sourceFile, source);\n if (!componentMeta) return refMap;\n\n let templateSource: string | null = null;\n\n if (componentMeta.inlineTemplate !== null) {\n templateSource = componentMeta.inlineTemplate;\n } else if (componentMeta.templateUrl) {\n // Resolve templateUrl relative to the TS file\n const dir = filePath.substring(0, filePath.lastIndexOf('/'));\n const templatePath = `${dir}/${componentMeta.templateUrl}`;\n const buffer = tree.read(templatePath);\n if (buffer) {\n templateSource = buffer.toString('utf-8');\n }\n }\n\n if (!templateSource) return refMap;\n\n // Parse the template and collect #refs\n try {\n const parsed = parseTemplate(templateSource, '', { preserveWhitespaces: true });\n collectTemplateRefs(parsed.nodes, refMap);\n } catch {\n // Template parse failure — silently skip (might be malformed or use third-party syntax)\n }\n\n return refMap;\n}\n\n/**\n * Extracts @Component metadata: templateUrl or inline template content.\n */\nfunction findComponentMetadata(\n sourceFile: ts.SourceFile,\n source: string,\n): { templateUrl: string | null; inlineTemplate: string | null } | null {\n let result: { templateUrl: string | null; inlineTemplate: string | null } | null = null;\n\n const visit = (node: ts.Node): void => {\n if (result) return;\n\n if (ts.isDecorator(node) && ts.isCallExpression(node.expression)) {\n const name = getDecoratorName(node.expression);\n if (name !== 'Component') {\n ts.forEachChild(node, visit);\n return;\n }\n\n const args = node.expression.arguments;\n if (args.length === 0 || !ts.isObjectLiteralExpression(args[0])) {\n ts.forEachChild(node, visit);\n return;\n }\n\n const meta: { templateUrl: string | null; inlineTemplate: string | null } = {\n templateUrl: null,\n inlineTemplate: null,\n };\n\n for (const prop of args[0].properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue;\n\n if (prop.name.text === 'templateUrl') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.templateUrl = init.text;\n }\n }\n\n if (prop.name.text === 'template') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.inlineTemplate = init.text;\n } else if (ts.isNoSubstitutionTemplateLiteral(init)) {\n meta.inlineTemplate = init.text;\n }\n }\n }\n\n result = meta;\n return;\n }\n\n ts.forEachChild(node, visit);\n };\n\n ts.forEachChild(sourceFile, visit);\n return result;\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression;\n while (ts.isParenthesizedExpression(current)) current = current.expression;\n return current;\n}\n\n/**\n * Recursively walks template AST nodes, collecting #refName → EUI class name mappings.\n *\n * For each element with a template reference (#ref), we try to resolve its EUI class:\n * 1. Match element tag name against EUI_SELECTOR_TO_CLASS (e.g. 'eui-alert' → EuiAlertComponent)\n * 2. Match element attributes against attribute selectors (e.g. [euiAutocomplete] → EuiAutocompleteComponent)\n */\nfunction collectTemplateRefs(nodes: TmplAstNode[], refMap: Map<string, string>): void {\n forEachElement(nodes, (node) => {\n if (node.references === undefined || node.references.length === 0) return;\n const euiClass = resolveElementToEuiClass(node);\n if (!euiClass) return;\n for (const ref of node.references) {\n refMap.set(ref.name, euiClass);\n }\n });\n}\n\n/**\n * Given a template element, resolves it to an EUI class name by checking:\n * 1. Tag name: <eui-alert> → look up 'eui-alert' in EUI_SELECTOR_TO_CLASS\n * 2. Attribute selectors: <input euiAutocomplete> → look up 'input[euiAutocomplete]' or '[euiAutocomplete]'\n */\nfunction resolveElementToEuiClass(element: TmplAstElement): string | null {\n const tag = element.name;\n\n // Direct tag match: eui-alert, eui-dialog, etc.\n if (EUI_SELECTOR_TO_CLASS[tag]) {\n return EUI_SELECTOR_TO_CLASS[tag];\n }\n\n // Attribute selector match: check all attributes against known patterns\n const allAttrNames = [\n ...element.attributes.map((a) => a.name),\n ...element.inputs.map((i) => i.name),\n ];\n\n for (const attrName of allAttrNames) {\n // Try tag[attr] pattern first (e.g. 'button[euiButton]', 'input[euiAutocomplete]')\n const tagAttrSelector = `${tag}[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[tagAttrSelector]) {\n return EUI_SELECTOR_TO_CLASS[tagAttrSelector];\n }\n\n // Try [attr] pattern (e.g. '[euiTooltip]', '[euiLoading]')\n const attrSelector = `[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[attrSelector]) {\n return EUI_SELECTOR_TO_CLASS[attrSelector];\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Edit helpers\n// ---------------------------------------------------------------------------\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n // Descending by position; at equal positions `after` edits are applied first so they land last.\n for (const edit of unique.sort((a, b) => b.start - a.start || Number(!!b.after) - Number(!!a.after))) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}:${edit.replacement}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n",
5973
5973
  "displayName": "Schema",
5974
5974
  "properties": [
5975
5975
  {
@@ -5981,7 +5981,7 @@
5981
5981
  "indexKey": "",
5982
5982
  "optional": true,
5983
5983
  "description": "",
5984
- "line": 461,
5984
+ "line": 56,
5985
5985
  "rawdescription": "\n"
5986
5986
  },
5987
5987
  {
@@ -5993,7 +5993,7 @@
5993
5993
  "indexKey": "",
5994
5994
  "optional": true,
5995
5995
  "description": "",
5996
- "line": 460,
5996
+ "line": 55,
5997
5997
  "rawdescription": "\n"
5998
5998
  }
5999
5999
  ],
@@ -6011,12 +6011,12 @@
6011
6011
  },
6012
6012
  {
6013
6013
  "name": "Schema",
6014
- "id": "interface-Schema-bdeb132e57974e9cf0ecc701fc740055cb5bf71469a03b748668e1c33e6365cc60701d8ed980432fc5cd62827c42a92a1166a7cfa04156ee9c1f5e504c35781c-43",
6015
- "file": "packages/core/schematics/migrate-to-signals/index.ts",
6014
+ "id": "interface-Schema-9ee907f6235e54dc564fd1a3f1f033debd4767715b1337e518de4f47f358dfcbff287bd8398fa3fe457784ecf36e625d57b4f9672b760879a507c1a823d51089-43",
6015
+ "file": "packages/core/schematics/migrate-to-standalone/index.ts",
6016
6016
  "deprecated": false,
6017
6017
  "deprecationMessage": "",
6018
6018
  "type": "interface",
6019
- "sourceCode": "import { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { forEachElement } from '../utils/template-walk';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\nimport {\n EUI_SIGNAL_MAP as EUI_SIGNAL_MAP_RAW,\n EUI_SELECTOR_TO_CLASS as EUI_SELECTOR_TO_CLASS_RAW,\n EUI_OUTPUT_MAP,\n EUI_HOST_BINDING_REMOVED_MAP,\n EUI_WRITABLE_SIGNAL_MAP,\n} from './signal-map';\nimport { ECL_SIGNAL_MAP, ECL_SELECTOR_TO_CLASS } from './ecl-signal-map';\n\n/**\n * Combined EUI + ECL signal maps. The migration logic is identical for both\n * libraries (plain field → signal getter), so the maps are merged and the rest\n * of the engine treats them uniformly. EUI and ECL class names don't collide\n * (Eui* vs Ecl* prefixes), and the selector namespaces are disjoint.\n */\nconst EUI_SIGNAL_MAP: Record<string, ReadonlySet<string>> = { ...EUI_SIGNAL_MAP_RAW, ...ECL_SIGNAL_MAP };\nconst EUI_SELECTOR_TO_CLASS: Record<string, string> = { ...EUI_SELECTOR_TO_CLASS_RAW, ...ECL_SELECTOR_TO_CLASS };\n\n/** Every class the schematic knows about (signals, outputs or removed host bindings). */\nconst KNOWN_CLASSES: ReadonlySet<string> = new Set([\n ...Object.keys(EUI_SIGNAL_MAP),\n ...Object.keys(EUI_OUTPUT_MAP),\n ...Object.keys(EUI_HOST_BINDING_REMOVED_MAP),\n]);\nconst isKnownClass = (name: string | null | undefined): name is string => !!name && KNOWN_CLASSES.has(name);\n\n/**\n * Tracked references. Class members are tracked by name (reached via `this.name`); locals/parameters are\n * tracked by their DECLARATION node, so a same-named untracked parameter or variable is never confused\n * with a tracked class member (shadowing). `lists*` hold QueryList<EuiXxx> / EuiXxx[] holders.\n */\ninterface Refs {\n props: Map<string, string>;\n propLists: Map<string, string>;\n decls: Map<ts.Node, string>;\n listDecls: Map<ts.Node, string>;\n}\n\n/** rxjs functions that take Observables as (possibly array-wrapped) arguments. */\nconst OBSERVABLE_COMBINATORS = new Set([\n 'merge', 'race', 'combineLatest', 'forkJoin', 'concat', 'zip', 'firstValueFrom', 'lastValueFrom', 'raceWith', 'mergeWith', 'concatWith', 'zipWith', 'combineLatestWith',\n]);\n\n/** Observable methods that need a real Observable instead of an OutputEmitterRef. */\nconst OBSERVABLE_METHODS = new Set(['subscribe', 'pipe', 'asObservable', 'forEach', 'toPromise']);\n/** QueryList iteration methods whose callback parameter is an element of the list. */\nconst LIST_ITERATION_METHODS = new Set(['forEach', 'map', 'filter', 'some', 'every', 'find', 'findIndex', 'reduce']);\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n /** When several zero-width edits share a position, `after` ones end up after the others. */\n after?: boolean;\n}\n\n/**\n * Migrates consumer code that accesses EUI or ECL component instances\n * programmatically.\n *\n * When EUI/ECL migrated @Input() → input(), @ViewChild() → viewChild(), and\n * @ContentChild() → contentChild(), properties that were plain class fields\n * became signal getters. Consumers who access them via @ViewChild need to\n * change `comp.prop` to `comp.prop()`.\n *\n * This schematic:\n * 1. Finds @ViewChild / @ContentChild fields typed as EUI component classes\n * 2. Resolves untyped @ViewChild('refName') by reading the component template\n * and matching #refName to an EUI element tag/selector\n * 3. Tracks which local variable names hold EUI component references (incl. aliases)\n * 4. Rewrites property accesses on those references: `ref.prop` → `ref.prop()`\n * (only for properties listed in the signal map)\n * 5. Does NOT touch template bindings — those are unaffected by signal migrations\n */\nexport function migrateToSignals(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n let propCount = 0;\n let todoCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n // Skip spec files — test code may use different patterns\n if (path.endsWith('.spec.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n\n // Fast bail: file must mention at least one EUI class name or have\n // ViewChild/ContentChild with string refs (which might reference EUI elements)\n if (!hasEuiReference(original) && !hasStringRefQuery(original)) return;\n\n const result = migrateTypeScript(original, path, tree, context);\n if (result.source !== original) {\n if (options.dryRun) {\n if (result.editCount > 0) {\n logDryRun(context, `Would migrate ${result.editCount} signal property access(es) in ${path}`);\n }\n if (result.todoCount > 0) {\n logDryRun(\n context,\n `Would comment out ${result.todoCount} programmatic signal-input write(s) with a TODO in ${path}`,\n );\n }\n } else {\n tree.overwrite(path, result.source);\n }\n fileCount++;\n propCount += result.editCount;\n todoCount += result.todoCount;\n }\n });\n\n context.logger.info(`Migrated ${propCount} property access(es) to signal getters in ${fileCount} file(s).`);\n if (todoCount > 0) {\n context.logger.info(\n `Commented out ${todoCount} programmatic signal-input write(s) and left a TODO — these cannot be migrated automatically and need a manual fix.`,\n );\n }\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\n/** Quick check: does the file reference any EUI class name from the signal map? */\nfunction hasEuiReference(source: string): boolean {\n for (const className of KNOWN_CLASSES) {\n if (source.includes(className)) return true;\n }\n return false;\n}\n\n/** Quick check: does the file have @ViewChild('...') or @ContentChild('...') with string refs? */\nfunction hasStringRefQuery(source: string): boolean {\n return /(@ViewChild|@ContentChild|@ViewChildren|@ContentChildren)\\s*\\(\\s*['\"]/.test(source);\n}\n\ninterface MigrateResult {\n source: string;\n editCount: number;\n todoCount: number;\n}\n\nfunction migrateTypeScript(source: string, filePath: string, tree: Tree, context: SchematicContext): MigrateResult {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n const todoEdits: Edit[] = [];\n\n // Phase 0: Build template ref map (#refName → EUI class name) from the component's template\n const templateRefMap = buildTemplateRefMap(sourceFile, source, filePath, tree);\n\n // Phase 1: Collect all variables/properties typed as EUI classes\n const euiRefs = collectEuiReferences(sourceFile, source, templateRefMap);\n\n if (euiRefs.props.size === 0 && euiRefs.propLists.size === 0 && euiRefs.decls.size === 0 && euiRefs.listDecls.size === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const hostTodoEdits: Edit[] = [];\n let needsOutputImport = false;\n\n // Phase 2: Find property accesses on those references and rewrite signal props\n const visitNode = (node: ts.Node): void => {\n // Match: ref.prop (PropertyAccessExpression)\n if (ts.isPropertyAccessExpression(node)) {\n const rewrite = tryRewritePropertyAccess(node, euiRefs, sourceFile, source);\n if (rewrite) {\n edits.push(rewrite);\n }\n\n // Writable signal (model()): `ref.prop = value` -> `ref.prop.set(value)`\n edits.push(...trySetRewrite(node, euiRefs, sourceFile));\n\n // Output: `ref.out.subscribe()` -> `outputToObservable(ref.out).subscribe()`\n const wrap = tryWrapOutput(node, euiRefs, sourceFile);\n if (wrap) {\n edits.push(...wrap);\n needsOutputImport = true;\n }\n\n // Output handed to rxjs combinators / used as a value: wrap or flag\n const outputUse = tryOutputUsage(node, euiRefs, sourceFile, source);\n if (outputUse) {\n edits.push(...outputUse.edits);\n if (outputUse.todo) hostTodoEdits.push(outputUse.todo);\n if (outputUse.edits.length > 0) needsOutputImport = true;\n }\n\n // Removed @HostBinding property: flag with a TODO\n const hostTodo = tryHostBindingTodo(node, euiRefs, sourceFile, source);\n if (hostTodo) {\n hostTodoEdits.push(hostTodo);\n }\n\n // Separately: a programmatic WRITE to a now-signal input cannot be\n // migrated automatically. Flag it with a TODO instead of silently\n // leaving a line that will fail to compile against the signal API.\n const todo = tryInsertWriteTodo(node, euiRefs, sourceFile, source);\n if (todo) {\n todoEdits.push(todo);\n }\n }\n // Destructuring / aliasing of a tracked reference cannot be followed: flag it.\n const alias = tryAliasTodo(node, euiRefs, sourceFile, source);\n if (alias) hostTodoEdits.push(alias);\n ts.forEachChild(node, visitNode);\n };\n\n ts.forEachChild(sourceFile, visitNode);\n\n if (edits.length === 0 && todoEdits.length === 0 && hostTodoEdits.length === 0) {\n return { source, editCount: 0, todoCount: 0 };\n }\n\n const dedupedTodos = deduplicateEdits(todoEdits);\n const dedupedHostTodos = deduplicateEdits(hostTodoEdits);\n\n // A TODO edit comments out the whole write statement. Any read-rewrite `()`\n // edit whose position falls inside that commented-out range must be dropped,\n // otherwise we'd both edit and comment the same text (and produce overlapping\n // edits that corrupt the output).\n const keptEdits = edits.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const keptHostTodos = dedupedHostTodos.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));\n const importEdit = needsOutputImport ? buildOutputImportEdit(sourceFile) : null;\n\n return {\n source: applyEdits(source, [...keptEdits, ...dedupedTodos, ...keptHostTodos, ...(importEdit ? [importEdit] : [])]),\n editCount: keptEdits.length,\n todoCount: dedupedTodos.length + keptHostTodos.length,\n };\n}\n\n/**\n * Scans the source file for class properties or variables typed as EUI component classes.\n * Returns a map: localName → Set of signal property names.\n *\n * Handles:\n * @ViewChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild(EuiXxxComponent) name!: EuiXxxComponent;\n * @ViewChild('ref') name: EuiXxxComponent;\n * @ContentChild(EuiXxxComponent) name: EuiXxxComponent;\n * @ViewChild('ref') name: ElementRef; (resolved via template #ref → EUI selector)\n * someVar: EuiXxxComponent; (typed class field, even without decorator)\n * const alias = this.viewChildRef; (alias tracking)\n */\nfunction collectEuiReferences(\n sourceFile: ts.SourceFile,\n source: string,\n templateRefMap: Map<string, string>,\n): Refs {\n const tracked: Refs = { props: new Map(), propLists: new Map(), decls: new Map(), listDecls: new Map() };\n const { props, propLists, decls, listDecls } = tracked;\n\n // Pass 1: collect directly-typed references\n const visitDirect = (node: ts.Node): void => {\n // Class property declarations\n if (ts.isPropertyDeclaration(node) && node.name && ts.isIdentifier(node.name)) {\n const euiClass = resolveEuiClassName(node, sourceFile, templateRefMap);\n if (isKnownClass(euiClass)) {\n (isListProperty(node) ? propLists : props).set(node.name.text, euiClass);\n }\n }\n\n // Variable (const x: EuiXxxComponent = ...) and parameter (method(ref: EuiXxxComponent)) declarations\n if ((ts.isVariableDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n decls.set(node, typeName);\n // constructor parameter property: also reachable as `this.name`\n if (ts.isParameter(node) && (ts.getModifiers?.(node) ?? []).length > 0) props.set(node.name.text, typeName);\n } else {\n const listClass = listElementClass(node.type);\n if (listClass) listDecls.set(node, listClass);\n }\n }\n\n ts.forEachChild(node, visitDirect);\n };\n\n ts.forEachChild(sourceFile, visitDirect);\n\n // Pass 2: aliases, QueryList/array iteration (source order)\n const visitAlias = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && !decls.has(node)) {\n const aliased = trackedClass(node.initializer, tracked);\n if (aliased) decls.set(node, aliased);\n const aliasedList = listClassOf(node.initializer, tracked);\n if (aliasedList) listDecls.set(node, aliasedList);\n }\n\n // list.forEach((el) => ...) / list.map(function (el) {...}) -> `el` is an element of the list\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n LIST_ITERATION_METHODS.has(node.expression.name.text)\n ) {\n const listClass = listClassOf(node.expression.expression, tracked);\n const callback = node.arguments[0];\n if (\n listClass &&\n callback &&\n (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) &&\n callback.parameters[0] &&\n ts.isIdentifier(callback.parameters[0].name) &&\n !callback.parameters[0].type\n ) {\n decls.set(callback.parameters[0], listClass);\n }\n }\n\n // for (const el of list) -> `el` is an element of the list\n if (ts.isForOfStatement(node) && ts.isVariableDeclarationList(node.initializer)) {\n const listClass = listClassOf(node.expression, tracked);\n const decl = node.initializer.declarations[0];\n if (listClass && decl && ts.isIdentifier(decl.name) && !decls.has(decl)) decls.set(decl, listClass);\n }\n\n ts.forEachChild(node, visitAlias);\n };\n\n ts.forEachChild(sourceFile, visitAlias);\n return tracked;\n}\n\n/** `EuiXxx[]`, `Array<EuiXxx>`, `QueryList<EuiXxx>` -> the known element class. */\nfunction listElementClass(type: ts.TypeNode | undefined): string | null {\n if (!type) return null;\n if (ts.isArrayTypeNode(type)) {\n const n = getTypeAnnotationName(type.elementType);\n return isKnownClass(n) ? n : null;\n }\n if (ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && ['Array', 'ReadonlyArray', 'QueryList'].includes(type.typeName.text)) {\n const n = getTypeAnnotationName(type.typeArguments?.[0]);\n return isKnownClass(n) ? n : null;\n }\n return null;\n}\n\n/** Strips parentheses, `!`, `as T`, `<T>x` and `satisfies`. */\nfunction unwrap(expr: ts.Expression): ts.Expression {\n let cur = expr;\n while (\n ts.isParenthesizedExpression(cur) ||\n ts.isNonNullExpression(cur) ||\n ts.isAsExpression(cur) ||\n ts.isTypeAssertionExpression(cur) ||\n ts.isSatisfiesExpression(cur)\n ) {\n cur = cur.expression;\n }\n return cur;\n}\n\n/** Nearest declaration (parameter / variable / binding element) of a bare identifier, or null. */\nfunction findDeclaration(id: ts.Identifier): ts.Node | null {\n const name = id.text;\n const boundIn = (bn: ts.BindingName): boolean =>\n ts.isIdentifier(bn) ? bn.text === name : bn.elements.some((e) => !ts.isOmittedExpression(e) && boundIn(e.name));\n const matchDecl = (d: ts.ParameterDeclaration | ts.VariableDeclaration): ts.Node | null => (boundIn(d.name) ? d : null);\n\n for (let cur: ts.Node | undefined = id.parent; cur; cur = cur.parent) {\n if (ts.isFunctionLike(cur)) {\n for (const p of cur.parameters) {\n const m = matchDecl(p);\n if (m) return m;\n }\n }\n if (ts.isBlock(cur) || ts.isSourceFile(cur) || ts.isModuleBlock(cur) || ts.isCaseClause(cur) || ts.isDefaultClause(cur)) {\n const stmts = ts.isCaseClause(cur) || ts.isDefaultClause(cur) ? cur.statements : cur.statements;\n for (const st of stmts) {\n if (ts.isVariableStatement(st)) {\n for (const d of st.declarationList.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n }\n }\n if ((ts.isForStatement(cur) || ts.isForOfStatement(cur) || ts.isForInStatement(cur)) && cur.initializer && ts.isVariableDeclarationList(cur.initializer)) {\n for (const d of cur.initializer.declarations) {\n const m = matchDecl(d);\n if (m) return m;\n }\n }\n if (ts.isCatchClause(cur) && cur.variableDeclaration) {\n const m = matchDecl(cur.variableDeclaration);\n if (m) return m;\n }\n }\n return null;\n}\n\n/** `this.name` -> name; anything else null. */\nfunction thisMemberName(expr: ts.Expression): string | null {\n return ts.isPropertyAccessExpression(expr) && expr.expression.kind === ts.SyntaxKind.ThisKeyword ? expr.name.text : null;\n}\n\n/** Element class of a tracked QueryList / array expression, or null. */\nfunction listClassOf(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.listDecls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n return member ? (tracked.propLists.get(member) ?? null) : null;\n}\n\n/**\n * Resolves the EUI class name from a property declaration.\n * Checks: type annotation → decorator class argument → template ref map.\n */\nfunction resolveEuiClassName(\n node: ts.PropertyDeclaration,\n sourceFile: ts.SourceFile,\n templateRefMap: Map<string, string>,\n): string | null {\n // Check type annotation first\n const typeName = getTypeAnnotationName(node.type);\n if (isKnownClass(typeName)) {\n return typeName;\n }\n\n const arrayClass = listElementClass(node.type);\n if (arrayClass) return arrayClass;\n\n // Check generic type argument: ElementRef<EuiXxxComponent> / QueryList<EuiXxxComponent>\n if (node.type && ts.isTypeReferenceNode(node.type) && node.type.typeArguments?.length) {\n const genericArg = getTypeAnnotationName(node.type.typeArguments[0]);\n if (isKnownClass(genericArg)) {\n return genericArg;\n }\n }\n\n // Check decorator arguments: @ViewChild(EuiXxxComponent) or @ViewChild('refName')\n if (node.modifiers) {\n for (const modifier of node.modifiers) {\n if (!ts.isDecorator(modifier)) continue;\n if (!ts.isCallExpression(modifier.expression)) continue;\n\n const decoratorName = getDecoratorName(modifier.expression);\n if (!decoratorName) continue;\n if (!['ViewChild', 'ViewChildren', 'ContentChild', 'ContentChildren'].includes(decoratorName)) continue;\n\n const args = modifier.expression.arguments;\n if (args.length > 0) {\n const firstArg = args[0];\n\n // @ViewChild(EuiXxxComponent) — class reference\n if (ts.isIdentifier(firstArg) && isKnownClass(firstArg.text)) {\n return firstArg.text;\n }\n\n // @ViewChild('refName') — string template ref, resolve via template\n if (ts.isStringLiteralLike(firstArg)) {\n const refName = firstArg.text;\n const euiClass = templateRefMap.get(refName);\n if (isKnownClass(euiClass)) {\n return euiClass;\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/** True for `@ViewChildren/@ContentChildren` fields and `QueryList<...>`-typed fields. */\nfunction isListProperty(node: ts.PropertyDeclaration): boolean {\n if (listElementClass(node.type)) return true;\n if (node.type && ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName) && node.type.typeName.text === 'QueryList') {\n return true;\n }\n return (ts.getDecorators?.(node) ?? []).some(\n (d) => ts.isCallExpression(d.expression) && ['ViewChildren', 'ContentChildren'].includes(getDecoratorName(d.expression) ?? ''),\n );\n}\n\n/**\n * Resolves an expression to the tracked EUI class: `ref`, `this.ref`, `this.ref!`, `(this.ref as any)`,\n * the `.first` / `.last` element of a tracked QueryList, or `list[i]` of a tracked list/array.\n */\nfunction trackedClass(expr: ts.Expression, tracked: Refs): string | null {\n const e = unwrap(expr);\n if (ts.isIdentifier(e)) {\n const d = findDeclaration(e);\n return d ? (tracked.decls.get(d) ?? null) : null;\n }\n const member = thisMemberName(e);\n if (member) return tracked.props.get(member) ?? null;\n if (ts.isPropertyAccessExpression(e) && (e.name.text === 'first' || e.name.text === 'last')) {\n return listClassOf(e.expression, tracked);\n }\n if (ts.isElementAccessExpression(e)) return listClassOf(e.expression, tracked);\n return null;\n}\n\nfunction getDecoratorName(callExpr: ts.CallExpression): string | null {\n if (ts.isIdentifier(callExpr.expression)) {\n return callExpr.expression.text;\n }\n return null;\n}\n\nfunction getTypeAnnotationName(typeNode: ts.TypeNode | undefined): string | null {\n if (!typeNode) return null;\n if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n return null;\n}\n\n/**\n * Checks if a property access `ref.prop` should be rewritten to `ref.prop()`.\n *\n * We rewrite if:\n * - `ref` is tracked in euiRefs\n * - `prop` is in the signal set for that EUI class\n * - The access is NOT already a call expression (not `ref.prop()` or `ref.prop(args)`)\n * - The access is NOT a write target (not `ref.prop = value`)\n * - The access is NOT a template binding argument (those are unaffected)\n */\nfunction tryRewritePropertyAccess(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n // Resolve the reference class — handle `this.ref.prop`, `ref.prop`, `list.first.prop`\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Skip if parent is already a call expression on this property: ref.prop(...)\n if (ts.isCallExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip a signal handed to toObservable(ref.prop): it needs the signal itself (e.g. written by migrate-eui-tab-signals)\n if (ts.isCallExpression(node.parent) && node.parent.arguments[0] === node &&\n ts.isIdentifier(node.parent.expression) && node.parent.expression.text === 'toObservable') {\n return null;\n }\n\n // Skip signal API access already in place: ref.prop.set(..) / .update(..) / .asReadonly()\n if (ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node &&\n ['set', 'update', 'asReadonly'].includes(node.parent.name.text)) {\n return null;\n }\n\n // Skip if this is the left side of an assignment: ref.prop = value\n if (ts.isBinaryExpression(node.parent) &&\n node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n node.parent.left === node) {\n return null;\n }\n\n // Skip if this is a compound assignment: ref.prop += value, ref.prop &&= value, etc.\n if (ts.isBinaryExpression(node.parent) && isAssignmentOperator(node.parent.operatorToken.kind) && node.parent.left === node) {\n return null;\n }\n\n // Skip if this is used with delete: delete ref.prop\n if (ts.isDeleteExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip if inside a typeof: typeof ref.prop\n if (ts.isTypeOfExpression(node.parent) && node.parent.expression === node) {\n return null;\n }\n\n // Skip property access chains that go deeper: ref.prop.something → ref.prop().something\n // This IS correct — we still want to add ()\n\n // Rewrite: insert () after the property name\n const end = node.name.getEnd();\n return {\n start: end,\n end: end,\n replacement: '()',\n };\n}\n\nfunction isAssignmentOperator(kind: ts.SyntaxKind): boolean {\n return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;\n}\n\n/** Marker used to detect an already-inserted TODO so the schematic stays idempotent. */\nconst WRITE_TODO_MARKER = 'TODO(eui-signals):';\n\n/**\n * Detects a programmatic WRITE to a now-signal input and returns an edit that\n * comments out the offending statement and prepends an explanatory TODO.\n *\n * A signal input (`input()`) exposes a read-only getter — it cannot be assigned\n * from outside the component (`comp.prop = value` no longer compiles, and\n * `comp.prop()` is a getter, not a setter). There is no safe, mechanical\n * rewrite: the correct fix is to drive the value declaratively through a\n * template binding (`[prop]=\"...\"`) or, when a ComponentRef is genuinely\n * available, `componentRef.setInput('prop', value)`. Both require human\n * judgement, so instead of rewriting we comment the statement out (keeping the\n * build green) and leave a TODO pointing at the manual fix.\n *\n * Only acts when the assignment is the ENTIRE statement\n * (`ExpressionStatement` whose expression is exactly this assignment):\n * ref.prop = value (simple assignment)\n * ref.prop += value, etc. (compound assignment)\n * where `ref` is a tracked EUI/ECL reference and `prop` is in its signal set.\n *\n * When the write is only part of a larger statement (e.g. inside an `if`\n * without a block, or nested in another expression), commenting it out would\n * also remove unrelated logic, so we leave it untouched (it will surface as a\n * compile error the developer must resolve by hand).\n */\nfunction tryInsertWriteTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls) return null;\n\n const signalProps = EUI_SIGNAL_MAP[cls];\n if (!signalProps || !signalProps.has(propName)) return null;\n\n // Only act on assignment targets: `ref.prop = ...` or `ref.prop <op>= ...`\n if (\n !ts.isBinaryExpression(node.parent) ||\n node.parent.left !== node ||\n !isAssignmentOperator(node.parent.operatorToken.kind)\n ) {\n return null;\n }\n\n const assignment = node.parent;\n\n // A plain `=` to a writable signal is migrated to `.set()` by trySetRewrite\n if (assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken && EUI_WRITABLE_SIGNAL_MAP[cls]?.has(propName)) {\n return null;\n }\n\n // Only comment out when the assignment IS the whole statement — otherwise we'd\n // delete unrelated logic from a larger statement.\n const statement = node.parent.parent;\n if (!statement || !ts.isExpressionStatement(statement) || statement.expression !== assignment) {\n return null;\n }\n\n // The statement must stand on its own (a direct child of a block/source), not\n // be the unbraced body of an `if`/`for`/`while` etc. — commenting those out by\n // line would swallow the surrounding `if (...)` and break the code.\n const parent = statement.parent;\n if (\n !parent ||\n !(ts.isBlock(parent) || ts.isSourceFile(parent) || ts.isModuleBlock(parent) || ts.isCaseClause(parent) || ts.isDefaultClause(parent))\n ) {\n return null;\n }\n\n const stmtStart = statement.getStart(sourceFile);\n const stmtEnd = statement.getEnd(); // includes the trailing semicolon\n const lineStart = getLineStartPosition(source, stmtStart);\n const indent = source.slice(lineStart, stmtStart);\n\n // Commenting works per line: the statement must be alone on its lines, otherwise\n // (e.g. `run() { ref.prop = 1; }`) we would comment out surrounding code.\n const eol = source.indexOf('\\n', stmtEnd);\n const restOfLine = source.slice(stmtEnd, eol === -1 ? source.length : eol);\n if (indent.trim() !== '' || restOfLine.trim() !== '') {\n return null;\n }\n\n // The statement text, as written (may span multiple lines).\n const statementText = source.slice(stmtStart, stmtEnd);\n\n // Comment out every line of the statement, preserving each line's own\n // indentation (insert `// ` after the leading whitespace). The first line's\n // indentation was stripped by starting the replacement at lineStart, so we\n // re-add it explicitly.\n const commentedStatement = statementText\n .split('\\n')\n .map((line, i) => {\n if (i === 0) return `${indent}// ${line}`;\n const lineIndent = line.slice(0, line.length - line.trimStart().length);\n return `${lineIndent}// ${line.trimStart()}`;\n })\n .join('\\n');\n\n const todo =\n `${indent}// ${WRITE_TODO_MARKER} '${propName}' is now a signal input and cannot be assigned directly.\\n` +\n `${indent}// Set it via a template binding ([${propName}]=\"...\") or componentRef.setInput('${propName}', ...).\\n` +\n `${indent}// The original statement is commented out below so the build does not fail:\\n`;\n\n // Replace the statement (from the start of its line, to drop the original\n // indentation we re-add) with the TODO + commented-out statement.\n return {\n start: lineStart,\n end: stmtEnd,\n replacement: todo + commentedStatement,\n };\n}\n\n/** `ref.prop = value;` on a writable signal -> `ref.prop.set(value);` (two zero-width-safe edits). */\nfunction trySetRewrite(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] {\n const assignment = node.parent;\n if (\n !ts.isBinaryExpression(assignment) ||\n assignment.left !== node ||\n assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken ||\n !ts.isExpressionStatement(assignment.parent)\n ) {\n return [];\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_WRITABLE_SIGNAL_MAP[cls]?.has(node.name.text)) return [];\n\n return [\n { start: node.getEnd(), end: assignment.right.getStart(sourceFile), replacement: '.set(' },\n { start: assignment.right.getEnd(), end: assignment.right.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** `ref.out.subscribe(...)` -> `outputToObservable(ref.out).subscribe(...)`. */\nfunction tryWrapOutput(node: ts.PropertyAccessExpression, euiRefs: Refs, sourceFile: ts.SourceFile): Edit[] | null {\n const parent = node.parent;\n if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node || !OBSERVABLE_METHODS.has(parent.name.text)) {\n return null;\n }\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n\n const start = node.getStart(sourceFile);\n return [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ];\n}\n\n/** Marker for a read of a property that was a @HostBinding and no longer exists. */\nconst HOST_TODO_MARKER = 'TODO(eui-signals):';\n\nfunction tryHostBindingTodo(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): Edit | null {\n const propName = node.name.text;\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_HOST_BINDING_REMOVED_MAP[cls]?.has(propName) || EUI_SIGNAL_MAP[cls]?.has(propName)) return null;\n return flagTodo(\n node,\n sourceFile,\n source,\n `'${propName}' was a @HostBinding`,\n `'${propName}' was a @HostBinding property of ${cls} and no longer exists on the instance ` +\n '(moved to static host metadata). Remove or replace this access.',\n );\n}\n\n/**\n * Inserts a `// TODO(eui-signals): <message>` line above the enclosing statement / class member.\n * `key` identifies the TODO for idempotency (looked for in the comment lines right above).\n */\nfunction flagTodo(node: ts.Node, sourceFile: ts.SourceFile, source: string, key: string, message: string): Edit | null {\n // Anchor on the enclosing statement / class member\n let anchor: ts.Node = node;\n while (\n anchor.parent &&\n !(\n ts.isBlock(anchor.parent) ||\n ts.isSourceFile(anchor.parent) ||\n ts.isModuleBlock(anchor.parent) ||\n ts.isCaseClause(anchor.parent) ||\n ts.isDefaultClause(anchor.parent) ||\n ts.isClassLike(anchor.parent)\n )\n ) {\n anchor = anchor.parent;\n }\n\n const lineStart = getLineStartPosition(source, anchor.getStart(sourceFile));\n const indent = source.slice(lineStart).match(/^[ \\t]*/)![0];\n const text = `${indent}// ${HOST_TODO_MARKER} ${message}\\n`;\n\n // Idempotent: look at the contiguous comment lines right above\n const above = source.slice(0, lineStart).split('\\n').slice(-8).reverse();\n for (const line of above.slice(1)) {\n if (!line.trim().startsWith('//')) break;\n if (line.includes(`${HOST_TODO_MARKER} ${key}`) || line.includes(key)) return null;\n }\n // A single-line anchor like `run() { ... }` shares its line with other code: still fine, the comment goes above the line.\n return { start: lineStart, end: lineStart, replacement: text };\n}\n\n/**\n * An output (OutputEmitterRef) used as a value:\n * - an argument of an rxjs combinator (`merge(ref.out, ...)`, also inside an array) is wrapped in `outputToObservable()`;\n * - any other use that is not `.emit()` / `.subscribe()` & co / already wrapped is flagged with a TODO.\n */\nfunction tryOutputUsage(\n node: ts.PropertyAccessExpression,\n euiRefs: Refs,\n sourceFile: ts.SourceFile,\n source: string,\n): { edits: Edit[]; todo?: Edit | null } | null {\n const cls = trackedClass(node.expression, euiRefs);\n if (!cls || !EUI_OUTPUT_MAP[cls]?.has(node.name.text)) return null;\n const parent = node.parent;\n\n // handled elsewhere (tryWrapOutput) or fine as is\n if (ts.isPropertyAccessExpression(parent) && parent.expression === node) return null;\n if (ts.isNonNullExpression(parent) || ts.isParenthesizedExpression(parent) || ts.isAsExpression(parent)) return null;\n // declared / written outputs are not reads\n if (ts.isBinaryExpression(parent) && parent.left === node) return null;\n\n // argument of a combinator?\n let arg: ts.Node = node;\n if (ts.isArrayLiteralExpression(arg.parent)) arg = arg.parent;\n const call = arg.parent;\n if (ts.isCallExpression(call) && call.arguments.includes(arg as ts.Expression)) {\n const callee = ts.isIdentifier(call.expression) ? call.expression.text : null;\n if (callee === 'outputToObservable') return null; // already migrated\n if (callee && OBSERVABLE_COMBINATORS.has(callee)) {\n const start = node.getStart(sourceFile);\n return {\n edits: [\n { start, end: start, replacement: 'outputToObservable(' },\n { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },\n ],\n };\n }\n }\n\n return {\n edits: [],\n todo: flagTodo(\n node,\n sourceFile,\n source,\n `output '${node.name.text}'`,\n `output '${node.name.text}' of ${cls} is an OutputEmitterRef, not an Observable. Wrap it with outputToObservable() ` +\n '(@angular/core/rxjs-interop) where an Observable is needed.',\n ),\n };\n}\n\n/** Destructuring of a tracked reference, or storing it in a field/variable we cannot follow. */\nfunction tryAliasTodo(node: ts.Node, euiRefs: Refs, sourceFile: ts.SourceFile, source: string): Edit | null {\n if (ts.isVariableDeclaration(node) && node.initializer && !ts.isIdentifier(node.name)) {\n const cls = trackedClass(node.initializer, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `destructuring of ${cls}`,\n `destructuring of ${cls} cannot be migrated automatically: its signal inputs/outputs must be read as ref.prop() / outputToObservable(ref.out).`,\n );\n }\n }\n if (\n ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n !ts.isIdentifier(unwrap(node.left)) &&\n ts.isExpressionStatement(node.parent)\n ) {\n const cls = trackedClass(node.right, euiRefs);\n if (cls) {\n return flagTodo(\n node,\n sourceFile,\n source,\n `aliasing of ${cls}`,\n `aliasing of ${cls}: this copy is not tracked, so its signal inputs/outputs must be updated manually (ref.prop()).`,\n );\n }\n }\n return null;\n}\n\n/** Adds `outputToObservable` to the file's imports (merging into an existing rxjs-interop import). */\nfunction buildOutputImportEdit(sourceFile: ts.SourceFile): Edit | null {\n let lastImportEnd = 0;\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n lastImportEnd = stmt.getEnd();\n if (!ts.isStringLiteral(stmt.moduleSpecifier) || stmt.moduleSpecifier.text !== '@angular/core/rxjs-interop') continue;\n const bindings = stmt.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings)) {\n if (bindings.elements.some((e) => e.name.text === 'outputToObservable')) return null;\n const last = bindings.elements[bindings.elements.length - 1];\n if (last) {\n return { start: last.getEnd(), end: last.getEnd(), replacement: ', outputToObservable' };\n }\n }\n }\n const line = 'import { outputToObservable } from \\'@angular/core/rxjs-interop\\';';\n return lastImportEnd === 0\n ? { start: 0, end: 0, replacement: `${line}\\n` }\n : { start: lastImportEnd, end: lastImportEnd, replacement: `\\n${line}` };\n}\n\n/** True if `edit`'s position falls within any of the given ranges. */\nfunction isInsideAnyRange(edit: Edit, ranges: Edit[]): boolean {\n return ranges.some((range) => edit.start >= range.start && edit.end <= range.end);\n}\n\n/** Returns the index of the first character of the line containing `pos`. */\nfunction getLineStartPosition(source: string, pos: number): number {\n const newlineIndex = source.lastIndexOf('\\n', pos - 1);\n return newlineIndex === -1 ? 0 : newlineIndex + 1;\n}\n\n// ---------------------------------------------------------------------------\n// Template ref resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Builds a map of template reference variable names (#ref) to EUI class names.\n *\n * Parses the component's template (inline or external) and finds elements like:\n * <eui-alert #myAlert> → myAlert → EuiAlertComponent\n * <input euiAutocomplete #ac> → ac → EuiAutocompleteComponent\n *\n * Returns Map<refName, euiClassName>.\n */\nfunction buildTemplateRefMap(\n sourceFile: ts.SourceFile,\n source: string,\n filePath: string,\n tree: Tree,\n): Map<string, string> {\n const refMap = new Map<string, string>();\n\n // Find @Component decorator\n const componentMeta = findComponentMetadata(sourceFile, source);\n if (!componentMeta) return refMap;\n\n let templateSource: string | null = null;\n\n if (componentMeta.inlineTemplate !== null) {\n templateSource = componentMeta.inlineTemplate;\n } else if (componentMeta.templateUrl) {\n // Resolve templateUrl relative to the TS file\n const dir = filePath.substring(0, filePath.lastIndexOf('/'));\n const templatePath = `${dir}/${componentMeta.templateUrl}`;\n const buffer = tree.read(templatePath);\n if (buffer) {\n templateSource = buffer.toString('utf-8');\n }\n }\n\n if (!templateSource) return refMap;\n\n // Parse the template and collect #refs\n try {\n const parsed = parseTemplate(templateSource, '', { preserveWhitespaces: true });\n collectTemplateRefs(parsed.nodes, refMap);\n } catch {\n // Template parse failure — silently skip (might be malformed or use third-party syntax)\n }\n\n return refMap;\n}\n\n/**\n * Extracts @Component metadata: templateUrl or inline template content.\n */\nfunction findComponentMetadata(\n sourceFile: ts.SourceFile,\n source: string,\n): { templateUrl: string | null; inlineTemplate: string | null } | null {\n let result: { templateUrl: string | null; inlineTemplate: string | null } | null = null;\n\n const visit = (node: ts.Node): void => {\n if (result) return;\n\n if (ts.isDecorator(node) && ts.isCallExpression(node.expression)) {\n const name = getDecoratorName(node.expression);\n if (name !== 'Component') {\n ts.forEachChild(node, visit);\n return;\n }\n\n const args = node.expression.arguments;\n if (args.length === 0 || !ts.isObjectLiteralExpression(args[0])) {\n ts.forEachChild(node, visit);\n return;\n }\n\n const meta: { templateUrl: string | null; inlineTemplate: string | null } = {\n templateUrl: null,\n inlineTemplate: null,\n };\n\n for (const prop of args[0].properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue;\n\n if (prop.name.text === 'templateUrl') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.templateUrl = init.text;\n }\n }\n\n if (prop.name.text === 'template') {\n const init = unwrapExpression(prop.initializer);\n if (ts.isStringLiteralLike(init)) {\n meta.inlineTemplate = init.text;\n } else if (ts.isNoSubstitutionTemplateLiteral(init)) {\n meta.inlineTemplate = init.text;\n }\n }\n }\n\n result = meta;\n return;\n }\n\n ts.forEachChild(node, visit);\n };\n\n ts.forEachChild(sourceFile, visit);\n return result;\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression;\n while (ts.isParenthesizedExpression(current)) current = current.expression;\n return current;\n}\n\n/**\n * Recursively walks template AST nodes, collecting #refName → EUI class name mappings.\n *\n * For each element with a template reference (#ref), we try to resolve its EUI class:\n * 1. Match element tag name against EUI_SELECTOR_TO_CLASS (e.g. 'eui-alert' → EuiAlertComponent)\n * 2. Match element attributes against attribute selectors (e.g. [euiAutocomplete] → EuiAutocompleteComponent)\n */\nfunction collectTemplateRefs(nodes: TmplAstNode[], refMap: Map<string, string>): void {\n forEachElement(nodes, (node) => {\n if (node.references === undefined || node.references.length === 0) return;\n const euiClass = resolveElementToEuiClass(node);\n if (!euiClass) return;\n for (const ref of node.references) {\n refMap.set(ref.name, euiClass);\n }\n });\n}\n\n/**\n * Given a template element, resolves it to an EUI class name by checking:\n * 1. Tag name: <eui-alert> → look up 'eui-alert' in EUI_SELECTOR_TO_CLASS\n * 2. Attribute selectors: <input euiAutocomplete> → look up 'input[euiAutocomplete]' or '[euiAutocomplete]'\n */\nfunction resolveElementToEuiClass(element: TmplAstElement): string | null {\n const tag = element.name;\n\n // Direct tag match: eui-alert, eui-dialog, etc.\n if (EUI_SELECTOR_TO_CLASS[tag]) {\n return EUI_SELECTOR_TO_CLASS[tag];\n }\n\n // Attribute selector match: check all attributes against known patterns\n const allAttrNames = [\n ...element.attributes.map((a) => a.name),\n ...element.inputs.map((i) => i.name),\n ];\n\n for (const attrName of allAttrNames) {\n // Try tag[attr] pattern first (e.g. 'button[euiButton]', 'input[euiAutocomplete]')\n const tagAttrSelector = `${tag}[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[tagAttrSelector]) {\n return EUI_SELECTOR_TO_CLASS[tagAttrSelector];\n }\n\n // Try [attr] pattern (e.g. '[euiTooltip]', '[euiLoading]')\n const attrSelector = `[${attrName}]`;\n if (EUI_SELECTOR_TO_CLASS[attrSelector]) {\n return EUI_SELECTOR_TO_CLASS[attrSelector];\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Edit helpers\n// ---------------------------------------------------------------------------\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n // Descending by position; at equal positions `after` edits are applied first so they land last.\n for (const edit of unique.sort((a, b) => b.start - a.start || Number(!!b.after) - Number(!!a.after))) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}:${edit.replacement}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n",
6019
+ "sourceCode": "import { parseTemplate } from '@angular/compiler';\nimport { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { forEachElement } from '../utils/template-walk';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\n\ninterface ModuleMapping {\n importPath: string;\n selectors: Record<string, string>;\n}\n\nconst MODULE_MAPPINGS: Record<string, ModuleMapping> = {\n EuiAccordionModule: {\n importPath: '@eui/components/eui-accordion',\n selectors: {\n 'eui-accordion': 'EuiAccordionComponent',\n 'eui-accordion-item': 'EuiAccordionItemComponent',\n euiAccordionItemHeader: 'EuiAccordionItemHeaderDirective',\n },\n },\n EuiAlertModule: {\n importPath: '@eui/components/eui-alert',\n selectors: {\n 'eui-alert': 'EuiAlertComponent',\n euiAlert: 'EuiAlertComponent',\n 'eui-alert-title': 'EuiAlertTitleComponent',\n },\n },\n EuiAutocompleteModule: {\n importPath: '@eui/components/eui-autocomplete',\n selectors: {\n 'eui-autocomplete': 'EuiAutocompleteComponent',\n euiAutocomplete: 'EuiAutocompleteComponent',\n 'eui-autocomplete-option': 'EuiAutocompleteOptionComponent',\n 'eui-autocomplete-option-group': 'EuiAutocompleteOptionGroupComponent',\n 'eui-autocomplete-panel': 'EuiAutocompletePanelComponent',\n },\n },\n EuiAvatarModule: {\n importPath: '@eui/components/eui-avatar',\n selectors: {\n 'eui-avatar': 'EuiAvatarComponent',\n euiAvatar: 'EuiAvatarComponent',\n },\n },\n EuiBadgeModule: {\n importPath: '@eui/components/eui-badge',\n selectors: {\n 'eui-badge': 'EuiBadgeComponent',\n euiBadge: 'EuiBadgeComponent',\n },\n },\n EuiBlockContentModule: {\n importPath: '@eui/components/eui-block-content',\n selectors: {\n 'eui-block-content': 'EuiBlockContentComponent',\n },\n },\n EuiBreadcrumbModule: {\n importPath: '@eui/components/eui-breadcrumb',\n selectors: {\n 'eui-breadcrumb': 'EuiBreadcrumbComponent',\n },\n },\n EuiButtonModule: {\n importPath: '@eui/components/eui-button',\n selectors: {\n euiButton: 'EuiButtonComponent',\n },\n },\n EuiButtonGroupModule: {\n importPath: '@eui/components/eui-button-group',\n selectors: {\n 'eui-button-group': 'EuiButtonGroupComponent',\n },\n },\n EuiCardModule: {\n importPath: '@eui/components/eui-card',\n selectors: {\n 'eui-card': 'EuiCardComponent',\n 'eui-card-header': 'EuiCardHeaderComponent',\n 'eui-card-header-title': 'EuiCardHeaderTitleComponent',\n 'eui-card-content': 'EuiCardContentComponent',\n 'eui-card-footer': 'EuiCardFooterComponent',\n 'eui-card-media': 'EuiCardMediaComponent',\n },\n },\n EuiChipModule: {\n importPath: '@eui/components/eui-chip',\n selectors: {\n 'eui-chip': 'EuiChipComponent',\n euiChip: 'EuiChipComponent',\n },\n },\n EuiChipListModule: {\n importPath: '@eui/components/eui-chip-list',\n selectors: {\n 'eui-chip-list': 'EuiChipListComponent',\n },\n },\n EuiChipGroupModule: {\n importPath: '@eui/components/eui-chip-group',\n selectors: {\n 'eui-chip-group': 'EuiChipGroupComponent',\n },\n },\n EuiDashboardCardModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDashboardButtonModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDatepickerModule: {\n importPath: '@eui/components/eui-datepicker',\n selectors: {\n 'eui-datepicker': 'EuiDatepickerComponent',\n },\n },\n EuiDateRangeSelectorModule: {\n importPath: '@eui/components/eui-date-range-selector',\n selectors: {\n 'eui-date-range-selector': 'EuiDateRangeSelectorComponent',\n },\n },\n EuiDialogModule: {\n importPath: '@eui/components/eui-dialog',\n selectors: {\n 'eui-dialog': 'EuiDialogComponent',\n 'eui-dialog-header': 'EuiDialogHeaderDirective',\n 'eui-dialog-footer': 'EuiDialogFooterDirective',\n 'eui-dialog-container': 'EuiDialogContainerComponent',\n },\n },\n EuiDisableContentModule: {\n importPath: '@eui/components/eui-disable-content',\n selectors: {\n 'eui-disable-content': 'EuiDisableContentComponent',\n },\n },\n EuiDiscussionThreadModule: {\n importPath: '@eui/components/eui-discussion-thread',\n selectors: {\n 'eui-discussion-thread': 'EuiDiscussionThreadComponent',\n 'eui-discussion-thread-item': 'EuiDiscussionThreadItemComponent',\n },\n },\n EuiDropdownModule: {\n importPath: '@eui/components/eui-dropdown',\n selectors: {\n 'eui-dropdown': 'EuiDropdownComponent',\n },\n },\n EuiFeedbackMessageModule: {\n importPath: '@eui/components/eui-feedback-message',\n selectors: {\n 'eui-feedback-message': 'EuiFeedbackMessageComponent',\n },\n },\n EuiFieldsetModule: {\n importPath: '@eui/components/eui-fieldset',\n selectors: {\n 'eui-fieldset': 'EuiFieldsetComponent',\n euiFieldsetLabelRightContent: 'EuiFieldsetLabelRightContentTagDirective',\n euiFieldsetLabelExtraContent: 'EuiFieldsetLabelExtraContentTagDirective',\n },\n },\n EuiFileUploadModule: {\n importPath: '@eui/components/eui-file-upload',\n selectors: {\n 'eui-file-upload': 'EuiFileUploadComponent',\n },\n },\n EuiGrowlModule: {\n importPath: '@eui/components/eui-growl',\n selectors: {\n 'eui-growl': 'EuiGrowlComponent',\n },\n },\n EuiIconModule: {\n importPath: '@eui/components/eui-icon',\n selectors: {\n 'eui-icon-svg': 'EuiIconSvgComponent',\n euiIconSvg: 'EuiIconSvgComponent',\n },\n },\n EuiIconButtonModule: {\n importPath: '@eui/components/eui-icon-button',\n selectors: {\n 'eui-icon-button': 'EuiIconButtonComponent',\n },\n },\n EuiIconToggleModule: {\n importPath: '@eui/components/eui-icon-toggle',\n selectors: {\n 'eui-icon-toggle': 'EuiIconToggleComponent',\n },\n },\n EuiInputCheckboxModule: {\n importPath: '@eui/components/eui-input-checkbox',\n selectors: {\n euiInputCheckBox: 'EuiInputCheckboxComponent',\n },\n },\n EuiInputGroupModule: {\n importPath: '@eui/components/eui-input-group',\n selectors: {\n euiInputGroup: 'EuiInputGroupComponent',\n 'eui-input-group-addon': 'EuiInputGroupAddOnComponent',\n euiInputGroupAddOn: 'EuiInputGroupAddOnComponent',\n 'eui-input-group-addon-item': 'EuiInputGroupAddOnItemComponent',\n euiInputGroupAddOnItem: 'EuiInputGroupAddOnItemComponent',\n },\n },\n EuiInputNumberModule: {\n importPath: '@eui/components/eui-input-number',\n selectors: {\n euiInputNumber: 'EuiInputNumberComponent',\n },\n },\n EuiInputRadioModule: {\n importPath: '@eui/components/eui-input-radio',\n selectors: {\n euiInputRadio: 'EuiInputRadioComponent',\n },\n },\n EuiInputTextModule: {\n importPath: '@eui/components/eui-input-text',\n selectors: {\n euiInputText: 'EuiInputTextComponent',\n },\n },\n EuiLabelModule: {\n importPath: '@eui/components/eui-label',\n selectors: {\n 'eui-label': 'EuiLabelComponent',\n euiLabel: 'EuiLabelComponent',\n },\n },\n EuiListModule: {\n importPath: '@eui/components/eui-list',\n selectors: {\n 'eui-list': 'EuiListComponent',\n euiList: 'EuiListComponent',\n 'eui-list-item': 'EuiListItemComponent',\n euiListItem: 'EuiListItemComponent',\n },\n },\n EuiMenuModule: {\n importPath: '@eui/components/eui-menu',\n selectors: {\n 'eui-menu': 'EuiMenuComponent',\n 'eui-menu-item': 'EuiMenuItemComponent',\n },\n },\n EuiMessageBoxModule: {\n importPath: '@eui/components/eui-message-box',\n selectors: {\n 'eui-message-box': 'EuiMessageBoxComponent',\n 'eui-message-box-footer': 'EuiMessageBoxFooterDirective',\n },\n },\n EuiOverlayModule: {\n importPath: '@eui/components/eui-overlay',\n selectors: {\n 'eui-overlay': 'EuiOverlayComponent',\n },\n },\n EuiPageModule: {\n importPath: '@eui/components/eui-page',\n selectors: {\n 'eui-page': 'EuiPageComponent',\n },\n },\n EuiPaginatorModule: {\n importPath: '@eui/components/eui-paginator',\n selectors: {\n 'eui-paginator': 'EuiPaginatorComponent',\n },\n },\n EuiPopoverModule: {\n importPath: '@eui/components/eui-popover',\n selectors: {\n 'eui-popover': 'EuiPopoverComponent',\n },\n },\n EuiProgressBarModule: {\n importPath: '@eui/components/eui-progress-bar',\n selectors: {\n 'eui-progress-bar': 'EuiProgressBarComponent',\n },\n },\n EuiProgressCircleModule: {\n importPath: '@eui/components/eui-progress-circle',\n selectors: {\n 'eui-progress-circle': 'EuiProgressCircleComponent',\n },\n },\n EuiSelectModule: {\n importPath: '@eui/components/eui-select',\n selectors: {\n euiSelect: 'EuiSelectComponent',\n },\n },\n EuiSidebarMenuModule: {\n importPath: '@eui/components/eui-sidebar-menu',\n selectors: {\n 'eui-sidebar-menu': 'EuiSidebarMenuComponent',\n },\n },\n EuiSkeletonModule: {\n importPath: '@eui/components/eui-skeleton',\n selectors: {\n 'eui-skeleton': 'EuiSkeletonComponent',\n },\n },\n EuiSlideToggleModule: {\n importPath: '@eui/components/eui-slide-toggle',\n selectors: {\n 'eui-slide-toggle': 'EuiSlideToggleComponent',\n },\n },\n EuiTableModule: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTableV2Module: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTabsModule: {\n importPath: '@eui/components/eui-tabs',\n selectors: {\n 'eui-tabs': 'EuiTabsComponent',\n 'eui-tab': 'EuiTabComponent',\n 'eui-tab-header': 'EuiTabHeaderComponent',\n 'eui-tab-body': 'EuiTabBodyComponent',\n },\n },\n EuiTextAreaModule: {\n importPath: '@eui/components/eui-textarea',\n selectors: {\n euiTextArea: 'EuiTextareaComponent',\n },\n },\n EuiTimelineModule: {\n importPath: '@eui/components/eui-timeline',\n selectors: {\n 'eui-timeline': 'EuiTimelineComponent',\n 'eui-timeline-item': 'EuiTimelineItemComponent',\n },\n },\n EuiTimepickerModule: {\n importPath: '@eui/components/eui-timepicker',\n selectors: {\n 'eui-timepicker': 'EuiTimepickerComponent',\n },\n },\n EuiTreeModule: {\n importPath: '@eui/components/eui-tree',\n selectors: {\n 'eui-tree': 'EuiTreeComponent',\n },\n },\n EuiTreeListModule: {\n importPath: '@eui/components/eui-tree-list',\n selectors: {\n 'eui-tree-list': 'EuiTreeListComponent',\n 'eui-tree-list-item': 'EuiTreeListItemComponent',\n },\n },\n EuiUserProfileModule: {\n importPath: '@eui/components/eui-user-profile',\n selectors: {\n 'eui-user-profile': 'EuiUserProfileComponent',\n },\n },\n EuiWizardModule: {\n importPath: '@eui/components/eui-wizard',\n selectors: {\n 'eui-wizard': 'EuiWizardComponent',\n 'eui-wizard-step': 'EuiWizardStepComponent',\n },\n },\n EuiTooltipDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTooltip: 'EuiTooltipDirective',\n },\n },\n EuiTemplateDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTemplate: 'EuiTemplateDirective',\n },\n },\n EuiResizableDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiResizable: 'EuiResizableDirective',\n 'eui-resizable': 'EuiResizableComponent',\n },\n },\n EuiMaxLengthDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiEditorMaxlength: 'EuiMaxLengthDirective',\n },\n },\n EuiTruncatePipeModule: {\n importPath: '@eui/components/pipes',\n selectors: {\n euiTruncate: 'EuiTruncatePipe',\n },\n },\n EuiLayoutModule: {\n importPath: '@eui/components/layout',\n selectors: {\n 'eui-app': 'EuiAppComponent',\n 'eui-header': 'EuiHeaderComponent',\n 'eui-footer': 'EuiFooterComponent',\n 'eui-toolbar': 'EuiToolbarComponent',\n 'eui-sidebar-toggle': 'EuiSidebarToggleComponent',\n },\n },\n};\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nexport function migrateToStandalone(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n const allModuleNames = Object.keys(MODULE_MAPPINGS);\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const source = buffer.toString('utf-8');\n if (!allModuleNames.some((m) => source.includes(m))) return;\n\n const sourceFile = ts.createSourceFile(path, source, ts.ScriptTarget.Latest, true);\n const componentDecorators = findComponentDecorators(sourceFile);\n\n for (const decorator of componentDecorators) {\n const importsNode = findImportsArrayNode(decorator);\n if (!importsNode) continue;\n\n const currentSource = tree.read(path)!.toString('utf-8');\n const modulesInArray = allModuleNames.filter((m) => hasModuleInArray(importsNode, m, source));\n if (modulesInArray.length === 0) continue;\n\n const templateSelectors = getTemplateSelectors(tree, path, decorator, source);\n const replacements = buildReplacements(modulesInArray, templateSelectors);\n if (replacements.size === 0) continue;\n\n const result = applyReplacements(currentSource, path, replacements);\n if (options.dryRun) {\n logDryRun(context, `Would replace module imports with standalone imports in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n }\n });\n\n context.logger.info('Migration to standalone imports complete.');\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n\nfunction buildReplacements(moduleNames: string[], templateSelectors: Set<string>): Map<string, { components: string[]; importPath: string }> {\n const map = new Map<string, { components: string[]; importPath: string }>();\n\n for (const moduleName of moduleNames) {\n const mapping = MODULE_MAPPINGS[moduleName];\n const components: string[] = [];\n\n for (const [selector, component] of Object.entries(mapping.selectors)) {\n if (templateSelectors.has(selector)) {\n components.push(component);\n }\n }\n\n if (components.length > 0) {\n map.set(moduleName, { components: [...new Set(components)].sort(), importPath: mapping.importPath });\n }\n }\n\n return map;\n}\n\nfunction findComponentDecorators(sourceFile: ts.SourceFile): ts.Decorator[] {\n const decorators: ts.Decorator[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (decs) {\n for (const dec of decs) {\n if (ts.isCallExpression(dec.expression) && ts.isIdentifier(dec.expression.expression) && dec.expression.expression.text === 'Component') {\n decorators.push(dec);\n }\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return decorators;\n}\n\nfunction findImportsArrayNode(decorator: ts.Decorator): ts.ArrayLiteralExpression | undefined {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) return undefined;\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'imports') {\n if (ts.isArrayLiteralExpression(prop.initializer)) {\n return prop.initializer;\n }\n }\n }\n return undefined;\n}\n\nfunction hasModuleInArray(array: ts.ArrayLiteralExpression, moduleName: string, source: string): boolean {\n return array.elements.some((el) => source.slice(el.getStart(), el.getEnd()).trim() === moduleName);\n}\n\nfunction getTemplateSelectors(tree: Tree, tsPath: string, decorator: ts.Decorator, source: string): Set<string> {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0] as ts.ObjectLiteralExpression;\n const allSelectors = Object.values(MODULE_MAPPINGS).flatMap((m) => Object.keys(m.selectors));\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'template') {\n const init = prop.initializer;\n if (ts.isStringLiteral(init) || ts.isNoSubstitutionTemplateLiteral(init)) {\n return findSelectorsInTemplate(init.text, allSelectors);\n }\n }\n }\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'templateUrl') {\n if (ts.isStringLiteral(prop.initializer)) {\n const dir = tsPath.substring(0, tsPath.lastIndexOf('/'));\n const templateBuffer = tree.read(`${dir}/${prop.initializer.text}`);\n if (templateBuffer) {\n return findSelectorsInTemplate(templateBuffer.toString('utf-8'), allSelectors);\n }\n }\n }\n }\n\n return new Set();\n}\n\nfunction findSelectorsInTemplate(html: string, knownSelectors: string[]): Set<string> {\n const selectors = new Set<string>();\n const parsed = parseTemplate(html, '', { preserveWhitespaces: true });\n\n forEachElement(parsed.nodes, (node) => {\n if (knownSelectors.includes(node.name)) selectors.add(node.name);\n for (const attr of node.attributes) {\n if (knownSelectors.includes(attr.name)) selectors.add(attr.name);\n }\n });\n return selectors;\n}\n\nfunction applyReplacements(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n let result = replaceInImportsArray(source, sourceFile, replacements);\n result = updateEsImports(result, filePath, replacements);\n return result;\n}\n\nfunction replaceInImportsArray(source: string, sourceFile: ts.SourceFile, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (!decs) return;\n for (const dec of decs) {\n if (!ts.isCallExpression(dec.expression) || !ts.isIdentifier(dec.expression.expression) || dec.expression.expression.text !== 'Component') continue;\n const metadata = dec.expression.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) continue;\n for (const prop of metadata.properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name) || prop.name.text !== 'imports') continue;\n if (!ts.isArrayLiteralExpression(prop.initializer)) continue;\n const newElements = prop.initializer.elements\n .map((el) => {\n const text = result.slice(el.getStart(sourceFile), el.getEnd()).trim();\n const replacement = replacements.get(text);\n return replacement ? replacement.components.join(', ') : text;\n })\n .join(', ');\n result = result.slice(0, prop.initializer.getStart(sourceFile) + 1) + newElements + result.slice(prop.initializer.getEnd() - 1);\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return result;\n}\n\nfunction updateEsImports(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n\n for (const [moduleName, { components, importPath }] of replacements) {\n const sf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n\n for (const stmt of sf.statements) {\n if (!ts.isImportDeclaration(stmt) || !stmt.importClause?.namedBindings || !ts.isNamedImports(stmt.importClause.namedBindings)) continue;\n const namedBindings = stmt.importClause.namedBindings;\n const importNames = namedBindings.elements.map((el) => el.name.text);\n if (!importNames.includes(moduleName)) continue;\n\n const moduleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const remaining = importNames.filter((n) => n !== moduleName);\n const toAdd = components.filter((c) => !importNames.includes(c));\n\n if (moduleSpecifier === importPath) {\n const newNames = [...remaining, ...toAdd].sort();\n const newClause = `{ ${newNames.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n if (remaining.length > 0) {\n const newClause = `{ ${remaining.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n result = result.slice(0, stmt.getStart(sf)) + result.slice(stmt.getEnd()).replace(/^\\r?\\n/, '');\n }\n\n if (toAdd.length > 0) {\n const updatedSf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n const existing = updatedSf.statements.find(\n (s) => ts.isImportDeclaration(s) && ts.isStringLiteral(s.moduleSpecifier) && s.moduleSpecifier.text === importPath,\n ) as ts.ImportDeclaration | undefined;\n\n if (existing?.importClause?.namedBindings && ts.isNamedImports(existing.importClause.namedBindings)) {\n const existingNames = existing.importClause.namedBindings.elements.map((el) => el.name.text);\n const allNames = [...new Set([...existingNames, ...toAdd])].sort();\n const newClause = `{ ${allNames.join(', ')} }`;\n result = result.slice(0, existing.importClause.namedBindings.getStart(updatedSf)) + newClause + result.slice(existing.importClause.namedBindings.getEnd());\n } else {\n const newImport = `import { ${toAdd.join(', ')} } from '${importPath}';\\n`;\n result = newImport + result;\n }\n }\n }\n break;\n }\n }\n\n return result;\n}\n",
6020
6020
  "displayName": "Schema",
6021
6021
  "properties": [
6022
6022
  {
@@ -6028,7 +6028,7 @@
6028
6028
  "indexKey": "",
6029
6029
  "optional": true,
6030
6030
  "description": "",
6031
- "line": 56,
6031
+ "line": 461,
6032
6032
  "rawdescription": "\n"
6033
6033
  },
6034
6034
  {
@@ -6040,7 +6040,7 @@
6040
6040
  "indexKey": "",
6041
6041
  "optional": true,
6042
6042
  "description": "",
6043
- "line": 55,
6043
+ "line": 460,
6044
6044
  "rawdescription": "\n"
6045
6045
  }
6046
6046
  ],
@@ -31465,7 +31465,7 @@
31465
31465
  },
31466
31466
  {
31467
31467
  "name": "applyEdits",
31468
- "file": "packages/core/schematics/utils/tooltip-message.ts",
31468
+ "file": "packages/core/schematics/migrate-to-signals/index.ts",
31469
31469
  "ctype": "miscellaneous",
31470
31470
  "subtype": "function",
31471
31471
  "coverageIgnore": false,
@@ -31510,7 +31510,7 @@
31510
31510
  },
31511
31511
  {
31512
31512
  "name": "applyEdits",
31513
- "file": "packages/core/schematics/migrate-to-signals/index.ts",
31513
+ "file": "packages/core/schematics/utils/tooltip-message.ts",
31514
31514
  "ctype": "miscellaneous",
31515
31515
  "subtype": "function",
31516
31516
  "coverageIgnore": false,
@@ -56363,7 +56363,7 @@
56363
56363
  },
56364
56364
  {
56365
56365
  "name": "visitDir",
56366
- "file": "packages/core/schematics/migrate-to-standalone/index.ts",
56366
+ "file": "packages/core/schematics/migrate-to-signals/index.ts",
56367
56367
  "ctype": "miscellaneous",
56368
56368
  "subtype": "function",
56369
56369
  "coverageIgnore": false,
@@ -56408,7 +56408,7 @@
56408
56408
  },
56409
56409
  {
56410
56410
  "name": "visitDir",
56411
- "file": "packages/core/schematics/migrate-to-signals/index.ts",
56411
+ "file": "packages/core/schematics/migrate-to-standalone/index.ts",
56412
56412
  "ctype": "miscellaneous",
56413
56413
  "subtype": "function",
56414
56414
  "coverageIgnore": false,