@angular-modernizer/api 0.1.0

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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +507 -0
  3. package/dist/analysis/complexity-metrics-calculator.d.ts +99 -0
  4. package/dist/analysis/complexity-metrics-calculator.d.ts.map +1 -0
  5. package/dist/analysis/complexity-metrics-calculator.js +195 -0
  6. package/dist/analysis/complexity-metrics-calculator.js.map +1 -0
  7. package/dist/analysis/dependency-analyzer.d.ts +227 -0
  8. package/dist/analysis/dependency-analyzer.d.ts.map +1 -0
  9. package/dist/analysis/dependency-analyzer.js +451 -0
  10. package/dist/analysis/dependency-analyzer.js.map +1 -0
  11. package/dist/analysis/external-template-loader.d.ts +44 -0
  12. package/dist/analysis/external-template-loader.d.ts.map +1 -0
  13. package/dist/analysis/external-template-loader.js +69 -0
  14. package/dist/analysis/external-template-loader.js.map +1 -0
  15. package/dist/analysis/selector-mapper.d.ts +77 -0
  16. package/dist/analysis/selector-mapper.d.ts.map +1 -0
  17. package/dist/analysis/selector-mapper.js +146 -0
  18. package/dist/analysis/selector-mapper.js.map +1 -0
  19. package/dist/analysis/service-detector.d.ts +164 -0
  20. package/dist/analysis/service-detector.d.ts.map +1 -0
  21. package/dist/analysis/service-detector.js +231 -0
  22. package/dist/analysis/service-detector.js.map +1 -0
  23. package/dist/analysis/service-pattern-recognizer.d.ts +247 -0
  24. package/dist/analysis/service-pattern-recognizer.d.ts.map +1 -0
  25. package/dist/analysis/service-pattern-recognizer.js +444 -0
  26. package/dist/analysis/service-pattern-recognizer.js.map +1 -0
  27. package/dist/analysis/symbol-locator.d.ts +81 -0
  28. package/dist/analysis/symbol-locator.d.ts.map +1 -0
  29. package/dist/analysis/symbol-locator.js +128 -0
  30. package/dist/analysis/symbol-locator.js.map +1 -0
  31. package/dist/analysis/template-analyzer-usage.d.ts +144 -0
  32. package/dist/analysis/template-analyzer-usage.d.ts.map +1 -0
  33. package/dist/analysis/template-analyzer-usage.js +474 -0
  34. package/dist/analysis/template-analyzer-usage.js.map +1 -0
  35. package/dist/analysis/template-analyzer.d.ts +80 -0
  36. package/dist/analysis/template-analyzer.d.ts.map +1 -0
  37. package/dist/analysis/template-analyzer.js +146 -0
  38. package/dist/analysis/template-analyzer.js.map +1 -0
  39. package/dist/index.d.ts +23 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +22 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/investigation/angular-symbol-finder.d.ts +76 -0
  44. package/dist/investigation/angular-symbol-finder.d.ts.map +1 -0
  45. package/dist/investigation/angular-symbol-finder.js +199 -0
  46. package/dist/investigation/angular-symbol-finder.js.map +1 -0
  47. package/dist/investigation/call-graph-builder.d.ts +85 -0
  48. package/dist/investigation/call-graph-builder.d.ts.map +1 -0
  49. package/dist/investigation/call-graph-builder.js +196 -0
  50. package/dist/investigation/call-graph-builder.js.map +1 -0
  51. package/dist/investigation/codebase-searcher.d.ts +99 -0
  52. package/dist/investigation/codebase-searcher.d.ts.map +1 -0
  53. package/dist/investigation/codebase-searcher.js +201 -0
  54. package/dist/investigation/codebase-searcher.js.map +1 -0
  55. package/dist/investigation/stack-trace-parser.d.ts +70 -0
  56. package/dist/investigation/stack-trace-parser.d.ts.map +1 -0
  57. package/dist/investigation/stack-trace-parser.js +117 -0
  58. package/dist/investigation/stack-trace-parser.js.map +1 -0
  59. package/dist/investigation/type-resolver.d.ts +59 -0
  60. package/dist/investigation/type-resolver.d.ts.map +1 -0
  61. package/dist/investigation/type-resolver.js +111 -0
  62. package/dist/investigation/type-resolver.js.map +1 -0
  63. package/dist/investigation/usage-finder.d.ts +69 -0
  64. package/dist/investigation/usage-finder.d.ts.map +1 -0
  65. package/dist/investigation/usage-finder.js +132 -0
  66. package/dist/investigation/usage-finder.js.map +1 -0
  67. package/dist/metrics/complexity-metrics.d.ts +196 -0
  68. package/dist/metrics/complexity-metrics.d.ts.map +1 -0
  69. package/dist/metrics/complexity-metrics.js +445 -0
  70. package/dist/metrics/complexity-metrics.js.map +1 -0
  71. package/dist/public-api.d.ts +77 -0
  72. package/dist/public-api.d.ts.map +1 -0
  73. package/dist/public-api.js +50 -0
  74. package/dist/public-api.js.map +1 -0
  75. package/dist/transformation/import-manager.d.ts +276 -0
  76. package/dist/transformation/import-manager.d.ts.map +1 -0
  77. package/dist/transformation/import-manager.js +488 -0
  78. package/dist/transformation/import-manager.js.map +1 -0
  79. package/dist/transformation/ng-morph-adapter.d.ts +111 -0
  80. package/dist/transformation/ng-morph-adapter.d.ts.map +1 -0
  81. package/dist/transformation/ng-morph-adapter.js +179 -0
  82. package/dist/transformation/ng-morph-adapter.js.map +1 -0
  83. package/dist/transformation/ngmodule-manager.d.ts +145 -0
  84. package/dist/transformation/ngmodule-manager.d.ts.map +1 -0
  85. package/dist/transformation/ngmodule-manager.js +356 -0
  86. package/dist/transformation/ngmodule-manager.js.map +1 -0
  87. package/package.json +62 -0
  88. package/src/analysis/complexity-metrics-calculator.ts +253 -0
  89. package/src/analysis/dependency-analyzer.ts +720 -0
  90. package/src/analysis/external-template-loader.ts +79 -0
  91. package/src/analysis/selector-mapper.ts +186 -0
  92. package/src/analysis/service-detector.ts +280 -0
  93. package/src/analysis/service-pattern-recognizer.ts +545 -0
  94. package/src/analysis/symbol-locator.ts +170 -0
  95. package/src/analysis/template-analyzer-usage.ts +614 -0
  96. package/src/analysis/template-analyzer.ts +208 -0
  97. package/src/index.ts +51 -0
  98. package/src/investigation/angular-symbol-finder.ts +263 -0
  99. package/src/investigation/call-graph-builder.ts +298 -0
  100. package/src/investigation/codebase-searcher.ts +286 -0
  101. package/src/investigation/stack-trace-parser.ts +166 -0
  102. package/src/investigation/type-resolver.ts +144 -0
  103. package/src/investigation/usage-finder.ts +198 -0
  104. package/src/metrics/complexity-metrics.ts +617 -0
  105. package/src/public-api.ts +119 -0
  106. package/src/transformation/import-manager.ts +626 -0
  107. package/src/transformation/ng-morph-adapter.ts +252 -0
  108. package/src/transformation/ngmodule-manager.ts +450 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-pattern-recognizer.js","sourceRoot":"","sources":["../../src/analysis/service-pattern-recognizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;GAEG;AACH,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,wCAAwC;IACxC,2CAAyB,CAAA;IAEzB,0CAA0C;IAC1C,qCAAmB,CAAA;IAEnB,wDAAwD;IACxD,2CAAyB,CAAA;IAEzB,4CAA4C;IAC5C,uCAAqB,CAAA;IAErB,gDAAgD;IAChD,mCAAiB,CAAA;IAEjB,yDAAyD;IACzD,iCAAe,CAAA;IAEf,wCAAwC;IACxC,mCAAiB,CAAA;IAEjB,kDAAkD;IAClD,qCAAmB,CAAA;IAEnB,kDAAkD;IAClD,qCAAmB,CAAA;AACrB,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAuCD;;;;;;;;;GASG;AACH,MAAM,OAAO,wBAAwB;IAClB,cAAc,CAAkB;IAEjD;;;;;;OAMG;IACH,YAAY,cAA+B;QACzC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,UAAsB;QACpC,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QAE1C,0CAA0C;QAC1C,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,eAAe,GAAG,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC;YACpE,IAAI,eAAe,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC,yBAAyB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAED,mDAAmD;QACnD,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;OAcG;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,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @angular-modernizer/api - Symbol Locator
3
+ *
4
+ * Service for locating symbols (classes, functions, etc.) across the entire project.
5
+ * Builds a project-wide index of exported classes for fast lookups.
6
+ *
7
+ * This enables resolving project-local dependencies (components, directives, pipes)
8
+ * and calculating the correct import paths for them.
9
+ */
10
+ import type { Project, SourceFile } from 'ts-morph';
11
+ /**
12
+ * Symbol information from the project-wide index.
13
+ */
14
+ export interface SymbolInfo {
15
+ /**
16
+ * The class name
17
+ */
18
+ className: string;
19
+ /**
20
+ * The source file where this class is declared
21
+ */
22
+ sourceFile: SourceFile;
23
+ /**
24
+ * Whether this is an exported class
25
+ */
26
+ isExported: boolean;
27
+ }
28
+ /**
29
+ * Symbol Locator - builds and maintains a project-wide symbol index.
30
+ *
31
+ * This service scans the entire project to create a comprehensive map of all
32
+ * exported classes, enabling fast lookup of where any symbol is defined.
33
+ */
34
+ export declare class SymbolLocator {
35
+ /**
36
+ * Build a project-wide symbol map.
37
+ *
38
+ * This method scans every source file in the project and indexes all exported
39
+ * classes by their name. The resulting map can be used to quickly find where
40
+ * any class is defined, which is essential for generating correct import paths.
41
+ *
42
+ * @param project - The ts-morph Project instance
43
+ * @returns Map from class name to SymbolInfo
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const symbolMap = symbolLocator.buildProjectSymbolMap(project);
48
+ * const symbol = symbolMap.get('AdduserEntryComponent');
49
+ * if (symbol) {
50
+ * console.info(`Found at: ${symbol.sourceFile.getFilePath()}`);
51
+ * }
52
+ * ```
53
+ */
54
+ buildProjectSymbolMap(project: Project): Map<string, SymbolInfo>;
55
+ /**
56
+ * Check if a class declaration is exported.
57
+ *
58
+ * @param classDecl - The class declaration to check
59
+ * @returns true if the class is exported
60
+ */
61
+ private isClassExported;
62
+ /**
63
+ * Calculate the relative import path from one file to another.
64
+ *
65
+ * Given a source file and a target file, this calculates the correct
66
+ * relative import path (e.g., '../dialogs/xyz.component').
67
+ *
68
+ * @param fromFile - The file that will contain the import statement
69
+ * @param toFile - The file to import from
70
+ * @returns The relative import path (without extension)
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * // From: /project/src/app/user/user.component.ts
75
+ * // To: /project/src/app/dialogs/xyz.component.ts
76
+ * // Result: '../dialogs/xyz.component'
77
+ * ```
78
+ */
79
+ calculateRelativeImportPath(fromFile: SourceFile, toFile: SourceFile): string;
80
+ }
81
+ //# sourceMappingURL=symbol-locator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-locator.d.ts","sourceRoot":"","sources":["../../src/analysis/symbol-locator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAoB,MAAM,UAAU,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;;;;;OAkBG;IACH,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;IA4ChE;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAIvB;;;;;;;;;;;;;;;;OAgBG;IACH,2BAA2B,CACzB,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,UAAU,GACjB,MAAM;CAqCV"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @angular-modernizer/api - Symbol Locator
3
+ *
4
+ * Service for locating symbols (classes, functions, etc.) across the entire project.
5
+ * Builds a project-wide index of exported classes for fast lookups.
6
+ *
7
+ * This enables resolving project-local dependencies (components, directives, pipes)
8
+ * and calculating the correct import paths for them.
9
+ */
10
+ /**
11
+ * Symbol Locator - builds and maintains a project-wide symbol index.
12
+ *
13
+ * This service scans the entire project to create a comprehensive map of all
14
+ * exported classes, enabling fast lookup of where any symbol is defined.
15
+ */
16
+ export class SymbolLocator {
17
+ /**
18
+ * Build a project-wide symbol map.
19
+ *
20
+ * This method scans every source file in the project and indexes all exported
21
+ * classes by their name. The resulting map can be used to quickly find where
22
+ * any class is defined, which is essential for generating correct import paths.
23
+ *
24
+ * @param project - The ts-morph Project instance
25
+ * @returns Map from class name to SymbolInfo
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const symbolMap = symbolLocator.buildProjectSymbolMap(project);
30
+ * const symbol = symbolMap.get('AdduserEntryComponent');
31
+ * if (symbol) {
32
+ * console.info(`Found at: ${symbol.sourceFile.getFilePath()}`);
33
+ * }
34
+ * ```
35
+ */
36
+ buildProjectSymbolMap(project) {
37
+ const symbolMap = new Map();
38
+ // Get all source files in the project
39
+ const sourceFiles = project.getSourceFiles();
40
+ for (const sourceFile of sourceFiles) {
41
+ // Skip declaration files and node_modules
42
+ const filePath = sourceFile.getFilePath();
43
+ if (filePath.includes('node_modules') || filePath.endsWith('.d.ts')) {
44
+ continue;
45
+ }
46
+ // Find all classes in this file
47
+ const classes = sourceFile.getClasses();
48
+ for (const classDecl of classes) {
49
+ const className = classDecl.getName();
50
+ if (!className) {
51
+ continue; // Skip anonymous classes
52
+ }
53
+ // Check if the class is exported
54
+ const isExported = this.isClassExported(classDecl);
55
+ // Only index exported classes (or all classes - configurable)
56
+ if (isExported) {
57
+ // If a class with this name already exists, keep the first occurrence
58
+ // (In real projects, same names in different modules are possible,
59
+ // but for standalone migration, we prioritize the first match)
60
+ if (!symbolMap.has(className)) {
61
+ symbolMap.set(className, {
62
+ className,
63
+ sourceFile,
64
+ isExported,
65
+ });
66
+ }
67
+ }
68
+ }
69
+ }
70
+ return symbolMap;
71
+ }
72
+ /**
73
+ * Check if a class declaration is exported.
74
+ *
75
+ * @param classDecl - The class declaration to check
76
+ * @returns true if the class is exported
77
+ */
78
+ isClassExported(classDecl) {
79
+ return classDecl.isExported();
80
+ }
81
+ /**
82
+ * Calculate the relative import path from one file to another.
83
+ *
84
+ * Given a source file and a target file, this calculates the correct
85
+ * relative import path (e.g., '../dialogs/xyz.component').
86
+ *
87
+ * @param fromFile - The file that will contain the import statement
88
+ * @param toFile - The file to import from
89
+ * @returns The relative import path (without extension)
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * // From: /project/src/app/user/user.component.ts
94
+ * // To: /project/src/app/dialogs/xyz.component.ts
95
+ * // Result: '../dialogs/xyz.component'
96
+ * ```
97
+ */
98
+ calculateRelativeImportPath(fromFile, toFile) {
99
+ const fromPath = fromFile.getFilePath();
100
+ const toPath = toFile.getFilePath();
101
+ // Get directory paths
102
+ const fromDir = fromPath.substring(0, fromPath.lastIndexOf('/'));
103
+ const toPathWithoutExt = toPath.replace(/\.ts$/, '');
104
+ // Calculate relative path
105
+ const fromParts = fromDir.split('/');
106
+ const toParts = toPathWithoutExt.split('/');
107
+ // Find common ancestor
108
+ let commonLength = 0;
109
+ while (commonLength < fromParts.length &&
110
+ commonLength < toParts.length &&
111
+ fromParts[commonLength] === toParts[commonLength]) {
112
+ commonLength++;
113
+ }
114
+ // Build relative path
115
+ const upLevels = fromParts.length - commonLength;
116
+ const downPath = toParts.slice(commonLength).join('/');
117
+ let relativePath = '';
118
+ if (upLevels > 0) {
119
+ relativePath = '../'.repeat(upLevels);
120
+ }
121
+ else {
122
+ relativePath = './';
123
+ }
124
+ relativePath += downPath;
125
+ return relativePath;
126
+ }
127
+ }
128
+ //# sourceMappingURL=symbol-locator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-locator.js","sourceRoot":"","sources":["../../src/analysis/symbol-locator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwBH;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACxB;;;;;;;;;;;;;;;;;;OAkBG;IACH,qBAAqB,CAAC,OAAgB;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+ * Three-tier strategy: Fast path → Angular Compiler → Conservative fallback
6
+ *
7
+ * Philosophy: "Only Import What You Use"
8
+ * - Tier 1 (80%): String analysis for simple templates (~2ms)
9
+ * - Tier 2 (15%): Angular Compiler for complex templates (~15ms)
10
+ * - Tier 3 (5%): Conservative fallback (include all imports)
11
+ *
12
+ * Average overhead: ~15% (vs 30% single-tier approach)
13
+ */
14
+ import type { ClassDeclaration, Project } from 'ts-morph';
15
+ /**
16
+ * Template Usage Analyzer with Three-Tier Strategy.
17
+ *
18
+ * Analyzes Angular templates to determine which imports are actually used.
19
+ * Uses a progressive enhancement approach for optimal performance.
20
+ */
21
+ export declare class TemplateUsageAnalyzer {
22
+ private readonly templateParseCache;
23
+ private readonly selectorMapper;
24
+ private readonly templateLoader;
25
+ /**
26
+ * Analyze template and return ONLY what's actually used.
27
+ *
28
+ * Uses three-tier strategy for optimal performance:
29
+ * - Tier 1: Fast path for simple templates (80% of cases, ~2ms)
30
+ * - Tier 2: Angular Compiler for complex templates (15% of cases, ~15ms)
31
+ * - Tier 3: Conservative fallback (5% of cases, include all imports)
32
+ *
33
+ * @param component - Component class declaration
34
+ * @param templateContent - Template HTML content
35
+ * @param availableImports - All imports from parent NgModule
36
+ * @param project - ts-morph Project (for selector mapping)
37
+ * @returns Array of actually-used import names
38
+ */
39
+ analyzeTemplateUsage(component: ClassDeclaration, templateContent: string, availableImports: string[], project: Project): string[];
40
+ /**
41
+ * Analyze external template (from templateUrl) and return ONLY what's used.
42
+ *
43
+ * Loads the external template file and analyzes it using the three-tier strategy.
44
+ *
45
+ * @param component - Component class declaration
46
+ * @param templateUrl - Template URL from `` metadata (e.g., './user.component.html')
47
+ * @param componentPath - Absolute path to the component file
48
+ * @param availableImports - All imports from parent NgModule
49
+ * @param project - ts-morph Project (for selector mapping)
50
+ * @returns Array of actually-used import names
51
+ */
52
+ analyzeExternalTemplate(component: ClassDeclaration, templateUrl: string, componentPath: string, availableImports: string[], project: Project): Promise<string[]>;
53
+ /**
54
+ * Determine if template is simple (can use fast path).
55
+ *
56
+ * Simple templates:
57
+ * - No interpolation: {{ }}
58
+ * - No structural directives: *ngIf, *ngFor, *ngSwitch
59
+ * - No property/event bindings: [], ()
60
+ * - Short content (< 500 chars)
61
+ */
62
+ private isSimpleTemplate;
63
+ /**
64
+ * Fast path: String-based analysis for simple templates.
65
+ *
66
+ * Uses regex to extract element selectors only.
67
+ * ~2ms per template (very fast).
68
+ */
69
+ private fastPathAnalysis;
70
+ /**
71
+ * Angular compiler-based analysis for complex templates.
72
+ *
73
+ * Parses template AST and extracts:
74
+ * - Element nodes (components)
75
+ * - Pipe nodes (pipes)
76
+ * - Attribute directives
77
+ * - Structural directives
78
+ *
79
+ * ~15ms per template (slower but accurate).
80
+ */
81
+ private extractImportsFromParsed;
82
+ /**
83
+ * ⭐ CRITICAL: Selector-to-Class mapping using Phase 3 selector map.
84
+ *
85
+ * Reuses Phase 3's cached selector map for O(1) lookup.
86
+ *
87
+ * Example: 'app-user-profile' → 'UserProfileComponent'
88
+ */
89
+ private mapSelectorToClassName;
90
+ /**
91
+ * Map pipe name to class name.
92
+ *
93
+ * Examples:
94
+ * - 'ngxMask' → 'NgxMaskPipe'
95
+ * - 'currency' → 'CurrencyPipe' (CommonModule)
96
+ * - 'uppercase' → 'UpperCasePipe' (CommonModule)
97
+ */
98
+ private mapPipeToClassName;
99
+ /**
100
+ * Map directive name to class name.
101
+ *
102
+ * Examples:
103
+ * - 'ngModel' → 'NgModel'
104
+ * - 'ngIf' → 'NgIf' (CommonModule)
105
+ * - 'myDirective' → 'MyDirectiveDirective'
106
+ */
107
+ private mapDirectiveToClassName;
108
+ /**
109
+ * Conservative fallback: Include all imports (safe).
110
+ *
111
+ * Used when:
112
+ * - Template parsing fails
113
+ * - Template is invalid
114
+ * - Compilation errors
115
+ *
116
+ * Better to include too much than break the application.
117
+ */
118
+ private conservativeFallback;
119
+ /**
120
+ * Check if element is a standard HTML element.
121
+ */
122
+ private isStandardHtmlElement;
123
+ /**
124
+ * Generate cache key for template parsing.
125
+ */
126
+ private getCacheKey;
127
+ /**
128
+ * Simple hash function for cache keys.
129
+ */
130
+ private simpleHash;
131
+ /**
132
+ * Extract element selectors from Angular Compiler AST.
133
+ */
134
+ private extractElementsFromAST;
135
+ /**
136
+ * Extract pipe names from Angular Compiler AST.
137
+ */
138
+ private extractPipesFromAST;
139
+ /**
140
+ * Extract directive names from Angular Compiler AST.
141
+ */
142
+ private extractDirectivesFromAST;
143
+ }
144
+ //# sourceMappingURL=template-analyzer-usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-analyzer-usage.d.ts","sourceRoot":"","sources":["../../src/analysis/template-analyzer-usage.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AA4E1D;;;;;GAKG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAGhC;IAEH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwB;IACvD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgC;IAE/D;;;;;;;;;;;;;OAaG;IACH,oBAAoB,CAClB,SAAS,EAAE,gBAAgB,EAC3B,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,OAAO,EAAE,OAAO,GACf,MAAM,EAAE;IA0CX;;;;;;;;;;;OAWG;IACG,uBAAuB,CAC3B,SAAS,EAAE,gBAAgB,EAC3B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,EAAE,CAAC;IA6BpB;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAyCxB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,wBAAwB;IA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