@angular-modernizer/adapter-mcp 0.1.4 → 0.3.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.
- package/README.md +125 -35
- package/dist/cli.js +65 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-watcher.d.ts.map +1 -1
- package/dist/mcp-watcher.js +3 -0
- package/dist/mcp-watcher.js.map +1 -1
- package/dist/server/json-rpc-handler.d.ts +41 -0
- package/dist/server/json-rpc-handler.d.ts.map +1 -1
- package/dist/server/json-rpc-handler.js +85 -6
- package/dist/server/json-rpc-handler.js.map +1 -1
- package/dist/server/mcp-server.d.ts +31 -0
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +76 -23
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/stdio-guard.d.ts +20 -0
- package/dist/server/stdio-guard.d.ts.map +1 -0
- package/dist/server/stdio-guard.js +48 -0
- package/dist/server/stdio-guard.js.map +1 -0
- package/dist/tools/analyze-build-impact.d.ts +169 -12
- package/dist/tools/analyze-build-impact.d.ts.map +1 -1
- package/dist/tools/analyze-build-impact.js +221 -36
- package/dist/tools/analyze-build-impact.js.map +1 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +1 -1
- package/dist/tools/analyze-parser-performance.js +6 -4
- package/dist/tools/analyze-parser-performance.js.map +1 -1
- package/dist/tools/collect-feedback.d.ts +112 -1
- package/dist/tools/collect-feedback.d.ts.map +1 -1
- package/dist/tools/collect-feedback.js +240 -11
- package/dist/tools/collect-feedback.js.map +1 -1
- package/dist/tools/extract-libraries.d.ts +4 -0
- package/dist/tools/extract-libraries.d.ts.map +1 -1
- package/dist/tools/extract-libraries.js +40 -8
- package/dist/tools/extract-libraries.js.map +1 -1
- package/dist/tools/find-angular-symbol.d.ts +29 -6
- package/dist/tools/find-angular-symbol.d.ts.map +1 -1
- package/dist/tools/find-angular-symbol.js +51 -6
- package/dist/tools/find-angular-symbol.js.map +1 -1
- package/dist/tools/find-component-hosts.d.ts +114 -0
- package/dist/tools/find-component-hosts.d.ts.map +1 -0
- package/dist/tools/find-component-hosts.js +240 -0
- package/dist/tools/find-component-hosts.js.map +1 -0
- package/dist/tools/find-usages.d.ts +33 -4
- package/dist/tools/find-usages.d.ts.map +1 -1
- package/dist/tools/find-usages.js +102 -11
- package/dist/tools/find-usages.js.map +1 -1
- package/dist/tools/get-bootstrap-execution.d.ts +108 -0
- package/dist/tools/get-bootstrap-execution.d.ts.map +1 -0
- package/dist/tools/get-bootstrap-execution.js +243 -0
- package/dist/tools/get-bootstrap-execution.js.map +1 -0
- package/dist/tools/get-call-graph.d.ts +33 -4
- package/dist/tools/get-call-graph.d.ts.map +1 -1
- package/dist/tools/get-call-graph.js +76 -13
- package/dist/tools/get-call-graph.js.map +1 -1
- package/dist/tools/helpers/compact-output.d.ts +61 -0
- package/dist/tools/helpers/compact-output.d.ts.map +1 -0
- package/dist/tools/helpers/compact-output.js +83 -0
- package/dist/tools/helpers/compact-output.js.map +1 -0
- package/dist/tools/helpers/find-ts-config.d.ts +24 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +1 -1
- package/dist/tools/helpers/find-ts-config.js +213 -7
- package/dist/tools/helpers/find-ts-config.js.map +1 -1
- package/dist/tools/helpers/project-cache.d.ts +177 -0
- package/dist/tools/helpers/project-cache.d.ts.map +1 -0
- package/dist/tools/helpers/project-cache.js +313 -0
- package/dist/tools/helpers/project-cache.js.map +1 -0
- package/dist/tools/helpers/rule-runner.d.ts +67 -0
- package/dist/tools/helpers/rule-runner.d.ts.map +1 -0
- package/dist/tools/helpers/rule-runner.js +117 -0
- package/dist/tools/helpers/rule-runner.js.map +1 -0
- package/dist/tools/helpers/scan-plan.d.ts +45 -0
- package/dist/tools/helpers/scan-plan.d.ts.map +1 -0
- package/dist/tools/helpers/scan-plan.js +151 -0
- package/dist/tools/helpers/scan-plan.js.map +1 -0
- package/dist/tools/helpers/stack-frame-file-index.d.ts +10 -0
- package/dist/tools/helpers/stack-frame-file-index.d.ts.map +1 -0
- package/dist/tools/helpers/stack-frame-file-index.js +71 -0
- package/dist/tools/helpers/stack-frame-file-index.js.map +1 -0
- package/dist/tools/helpers/suggestion-generator.d.ts +1 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +1 -1
- package/dist/tools/helpers/suggestion-generator.js.map +1 -1
- package/dist/tools/inspect-form-group.d.ts +93 -0
- package/dist/tools/inspect-form-group.d.ts.map +1 -0
- package/dist/tools/inspect-form-group.js +161 -0
- package/dist/tools/inspect-form-group.js.map +1 -0
- package/dist/tools/inspect-i18n.d.ts +85 -0
- package/dist/tools/inspect-i18n.d.ts.map +1 -0
- package/dist/tools/inspect-i18n.js +203 -0
- package/dist/tools/inspect-i18n.js.map +1 -0
- package/dist/tools/inspect-template.d.ts +89 -0
- package/dist/tools/inspect-template.d.ts.map +1 -0
- package/dist/tools/inspect-template.js +166 -0
- package/dist/tools/inspect-template.js.map +1 -0
- package/dist/tools/list-imports.d.ts +119 -0
- package/dist/tools/list-imports.d.ts.map +1 -0
- package/dist/tools/list-imports.js +171 -0
- package/dist/tools/list-imports.js.map +1 -0
- package/dist/tools/orchestrate-migration.d.ts +1 -0
- package/dist/tools/orchestrate-migration.d.ts.map +1 -1
- package/dist/tools/orchestrate-migration.js +33 -1
- package/dist/tools/orchestrate-migration.js.map +1 -1
- package/dist/tools/parse-stack-trace.d.ts +3 -1
- package/dist/tools/parse-stack-trace.d.ts.map +1 -1
- package/dist/tools/parse-stack-trace.js +18 -4
- package/dist/tools/parse-stack-trace.js.map +1 -1
- package/dist/tools/plan-migration.d.ts +89 -1
- package/dist/tools/plan-migration.d.ts.map +1 -1
- package/dist/tools/plan-migration.js +203 -7
- package/dist/tools/plan-migration.js.map +1 -1
- package/dist/tools/resolve-type.d.ts +3 -0
- package/dist/tools/resolve-type.d.ts.map +1 -1
- package/dist/tools/resolve-type.js +6 -2
- package/dist/tools/resolve-type.js.map +1 -1
- package/dist/tools/review-feedback.d.ts +7 -0
- package/dist/tools/review-feedback.d.ts.map +1 -1
- package/dist/tools/review-feedback.js +68 -16
- package/dist/tools/review-feedback.js.map +1 -1
- package/dist/tools/scan-all.d.ts +6 -6
- package/dist/tools/scan-all.d.ts.map +1 -1
- package/dist/tools/scan-all.js +7 -7
- package/dist/tools/scan-all.js.map +1 -1
- package/dist/tools/scan-angular.d.ts +1 -1
- package/dist/tools/scan-angular.js +1 -1
- package/dist/tools/scan-architecture.d.ts +25 -4
- package/dist/tools/scan-architecture.d.ts.map +1 -1
- package/dist/tools/scan-architecture.js +115 -134
- package/dist/tools/scan-architecture.js.map +1 -1
- package/dist/tools/scan-solid.d.ts +1 -1
- package/dist/tools/scan-solid.js +1 -1
- package/dist/tools/search-codebase.d.ts +32 -6
- package/dist/tools/search-codebase.d.ts.map +1 -1
- package/dist/tools/search-codebase.js +60 -14
- package/dist/tools/search-codebase.js.map +1 -1
- package/dist/tools/server-status.d.ts +96 -0
- package/dist/tools/server-status.d.ts.map +1 -0
- package/dist/tools/server-status.js +195 -0
- package/dist/tools/server-status.js.map +1 -0
- package/dist/tools/suggest-improvements.d.ts +3 -1
- package/dist/tools/suggest-improvements.d.ts.map +1 -1
- package/dist/tools/suggest-improvements.js +47 -10
- package/dist/tools/suggest-improvements.js.map +1 -1
- package/dist/tools/trace-output-flow.d.ts +111 -0
- package/dist/tools/trace-output-flow.d.ts.map +1 -0
- package/dist/tools/trace-output-flow.js +308 -0
- package/dist/tools/trace-output-flow.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +13 -12
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Inspect i18n Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
5
|
+
* language, with file, line and value), where they are used in templates and
|
|
6
|
+
* code, in which language they are missing, which used keys are defined
|
|
7
|
+
* nowhere and which defined keys have no static usage. Sources are found
|
|
8
|
+
* without configuration (setTranslation, TranslateHttpLoader, TranslocoLoader,
|
|
9
|
+
* assets/i18n convention).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* await tool.execute({ projectRoot: '/app', key: 'ERRORS.NO_ACCESS' });
|
|
14
|
+
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { type MCPTool } from '../types.js';
|
|
18
|
+
import { type I18nReport, type I18nSourceSummary } from '@angular-modernizer/api';
|
|
19
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
20
|
+
type ListField = 'keys' | 'undefinedKeys' | 'missingTranslations' | 'unused' | 'dynamicPrefixes' | 'unresolvedUsages';
|
|
21
|
+
/** Source fields only the full output carries. */
|
|
22
|
+
type DetailField = 'registeredAt' | 'discoveredBy' | 'kind' | 'conditionReason';
|
|
23
|
+
/** A source; `summaryOnly` keeps file, lang, app, conditional, group and keyCount. */
|
|
24
|
+
type SourceOutput = Omit<I18nSourceSummary, DetailField> & Partial<Pick<I18nSourceSummary, DetailField>>;
|
|
25
|
+
/**
|
|
26
|
+
* Output of the inspect-i18n tool.
|
|
27
|
+
*/
|
|
28
|
+
type InspectI18nOutput = Omit<I18nReport, ListField | 'sources'> & Partial<Pick<I18nReport, ListField>> & {
|
|
29
|
+
sources: SourceOutput[];
|
|
30
|
+
/** `true` when `maxResults` cut a list. */
|
|
31
|
+
truncated: boolean;
|
|
32
|
+
summary: string;
|
|
33
|
+
tsConfigPath: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* MCP tool that reports translation key definitions and usages.
|
|
37
|
+
*/
|
|
38
|
+
export declare class InspectI18nTool implements MCPTool {
|
|
39
|
+
private readonly projects;
|
|
40
|
+
readonly name = "inspect-i18n";
|
|
41
|
+
constructor(projects?: ProjectCache);
|
|
42
|
+
readonly description: string;
|
|
43
|
+
readonly inputSchema: {
|
|
44
|
+
type: string;
|
|
45
|
+
properties: {
|
|
46
|
+
summaryOnly: {
|
|
47
|
+
readonly type: "boolean";
|
|
48
|
+
readonly description: "Return counts and the text summary only, without the result list. Default: false.";
|
|
49
|
+
readonly default: false;
|
|
50
|
+
};
|
|
51
|
+
maxResults: {
|
|
52
|
+
readonly type: "number";
|
|
53
|
+
readonly description: string;
|
|
54
|
+
};
|
|
55
|
+
projectRoot: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
key: {
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
prefix: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
i18nNames: {
|
|
68
|
+
type: string;
|
|
69
|
+
items: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
required: string[];
|
|
76
|
+
};
|
|
77
|
+
execute(args: Record<string, unknown>): Promise<InspectI18nOutput>;
|
|
78
|
+
private parseText;
|
|
79
|
+
private parseI18nNames;
|
|
80
|
+
private shape;
|
|
81
|
+
private buildSummary;
|
|
82
|
+
private keyLines;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=inspect-i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-i18n.d.ts","sourceRoot":"","sources":["../../src/tools/inspect-i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,iB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@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Inspect i18n Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
5
|
+
* language, with file, line and value), where they are used in templates and
|
|
6
|
+
* code, in which language they are missing, which used keys are defined
|
|
7
|
+
* nowhere and which defined keys have no static usage. Sources are found
|
|
8
|
+
* without configuration (setTranslation, TranslateHttpLoader, TranslocoLoader,
|
|
9
|
+
* assets/i18n convention).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* await tool.execute({ projectRoot: '/app', key: 'ERRORS.NO_ACCESS' });
|
|
14
|
+
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { I18nInspector, } from '@angular-modernizer/api';
|
|
18
|
+
import { existsSync } from 'node:fs';
|
|
19
|
+
import { relative } from 'node:path';
|
|
20
|
+
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
21
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
22
|
+
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
23
|
+
/**
|
|
24
|
+
* MCP tool that reports translation key definitions and usages.
|
|
25
|
+
*/
|
|
26
|
+
export class InspectI18nTool {
|
|
27
|
+
projects;
|
|
28
|
+
name = 'inspect-i18n';
|
|
29
|
+
constructor(projects = new ProjectCache()) {
|
|
30
|
+
this.projects = projects;
|
|
31
|
+
}
|
|
32
|
+
description = 'Translation keys (ngx-translate, transloco) of a project: where a key is defined per language ' +
|
|
33
|
+
'(file, line, value), where it is used (templates: translate pipe/directive, i18n="@@id"; code: ' +
|
|
34
|
+
'TranslateService instant/get/stream, TranslocoService translate/selectTranslate, keys resolved through ' +
|
|
35
|
+
'constants, ternaries and helpers), and which languages lack it. Sources are found without ' +
|
|
36
|
+
'configuration: objects passed to setTranslation (followed through variables, imports, rest parameters, ' +
|
|
37
|
+
'forEach and lookups like MAP[customer]), JSON folders of TranslateHttpLoader or a TranslocoLoader URL, ' +
|
|
38
|
+
'else assets/i18n/*.json. Sources reached through a runtime lookup or a branch are conditional ' +
|
|
39
|
+
'(customer overlays, grouped by lookup key). Each app of a workspace (folder with tsconfig.app.json) ' +
|
|
40
|
+
'has its own layers (languages: base, groups, "<app>:base"); missingIn compares a key with the ' +
|
|
41
|
+
'languages of each layer defining it, never an overlay key against the base; overlay values of base ' +
|
|
42
|
+
'keys are marked overrides. A usage counts as defined only by sources of its own app (library code: ' +
|
|
43
|
+
'any app). With key or prefix: keys[] with definitions, usages, missingIn, coveredBy, ' +
|
|
44
|
+
'referencedAt. Without: project report with undefinedKeys (used, defined nowhere), missingTranslations, ' +
|
|
45
|
+
'unused, dynamicPrefixes (\'A.\' + x, `A.${x}`) and unresolvedUsages (key fully dynamic). "Unused" cannot ' +
|
|
46
|
+
'be proven statically: status covered-by-dynamic (a dynamic prefix covers it), referenced-as-literal (the ' +
|
|
47
|
+
'key text appears as a string elsewhere, e.g. a menu config) or no-static-usage. For a project report ' +
|
|
48
|
+
'start with summaryOnly (drops the lists and the source details registeredAt, discoveredBy, kind, ' +
|
|
49
|
+
'conditionReason); maxResults caps every list and the usages per key, counts cover everything.';
|
|
50
|
+
inputSchema = {
|
|
51
|
+
type: 'object',
|
|
52
|
+
properties: {
|
|
53
|
+
projectRoot: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Absolute path to the project root. Must contain a tsconfig.json.',
|
|
56
|
+
},
|
|
57
|
+
key: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Report this translation key only, e.g. "ERRORS.NO_ACCESS_TITLE". Optional.',
|
|
60
|
+
},
|
|
61
|
+
prefix: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'Report the keys starting with this text, e.g. "ERRORS.". Optional; not with key.',
|
|
64
|
+
},
|
|
65
|
+
i18nNames: {
|
|
66
|
+
type: 'array',
|
|
67
|
+
items: { type: 'string' },
|
|
68
|
+
description: 'Pipe and attribute-directive names that take a translation key. Default: ["translate", "transloco"].',
|
|
69
|
+
},
|
|
70
|
+
...COMPACT_OUTPUT_SCHEMA,
|
|
71
|
+
},
|
|
72
|
+
required: ['projectRoot'],
|
|
73
|
+
};
|
|
74
|
+
async execute(args) {
|
|
75
|
+
const params = args;
|
|
76
|
+
if (!params.projectRoot || typeof params.projectRoot !== 'string') {
|
|
77
|
+
throw new Error('projectRoot is required');
|
|
78
|
+
}
|
|
79
|
+
const compact = parseCompactOptions(args);
|
|
80
|
+
const key = this.parseText(params.key, 'key');
|
|
81
|
+
const prefix = this.parseText(params.prefix, 'prefix');
|
|
82
|
+
if (key !== undefined && prefix !== undefined) {
|
|
83
|
+
throw new Error('Give key or prefix, not both');
|
|
84
|
+
}
|
|
85
|
+
const i18nNames = this.parseI18nNames(params.i18nNames);
|
|
86
|
+
if (!existsSync(params.projectRoot)) {
|
|
87
|
+
throw new Error(`projectRoot does not exist: ${params.projectRoot}`);
|
|
88
|
+
}
|
|
89
|
+
const tsConfigPath = findTsConfig(params.projectRoot);
|
|
90
|
+
if (!tsConfigPath) {
|
|
91
|
+
throw new Error(`tsconfig.json not found in projectRoot: ${params.projectRoot}`);
|
|
92
|
+
}
|
|
93
|
+
const project = this.projects.get(tsConfigPath);
|
|
94
|
+
const report = new I18nInspector(project, {
|
|
95
|
+
rootDir: params.projectRoot,
|
|
96
|
+
...(key === undefined ? {} : { key }),
|
|
97
|
+
...(prefix === undefined ? {} : { prefix }),
|
|
98
|
+
...(i18nNames === undefined ? {} : { i18nNames }),
|
|
99
|
+
}).inspect();
|
|
100
|
+
return {
|
|
101
|
+
...this.shape(report, compact.summaryOnly, compact.maxResults),
|
|
102
|
+
summary: this.buildSummary(report, params.projectRoot, key ?? prefix),
|
|
103
|
+
tsConfigPath,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
parseText(value, name) {
|
|
107
|
+
if (value === undefined) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
if (typeof value !== 'string' || value === '') {
|
|
111
|
+
throw new Error(`${name} must be a non-empty string`);
|
|
112
|
+
}
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
parseI18nNames(value) {
|
|
116
|
+
if (value === undefined) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
const valid = Array.isArray(value) && value.every((v) => typeof v === 'string');
|
|
120
|
+
if (!valid) {
|
|
121
|
+
throw new Error('i18nNames must be an array of strings');
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
shape(report, summaryOnly, maxResults) {
|
|
126
|
+
const { keys, undefinedKeys, missingTranslations, unused, dynamicPrefixes, unresolvedUsages, ...rest } = report;
|
|
127
|
+
if (summaryOnly) {
|
|
128
|
+
// details stay in the full output; keeps a 14-source workspace under 5 KB
|
|
129
|
+
const sources = rest.sources.map(({ registeredAt: _site, discoveredBy: _by, kind: _kind, conditionReason: _reason, ...source }) => source);
|
|
130
|
+
return { ...rest, sources, truncated: false };
|
|
131
|
+
}
|
|
132
|
+
let truncated = false;
|
|
133
|
+
const cap = (items) => {
|
|
134
|
+
const shown = limitList(items, maxResults);
|
|
135
|
+
truncated ||= shown.truncated;
|
|
136
|
+
return shown.items;
|
|
137
|
+
};
|
|
138
|
+
const capKey = (k) => ({ ...k, usages: cap(k.usages) });
|
|
139
|
+
return {
|
|
140
|
+
...rest,
|
|
141
|
+
unresolvedRegistrations: cap(rest.unresolvedRegistrations),
|
|
142
|
+
...(keys === undefined ? {} : { keys: cap(keys).map(capKey) }),
|
|
143
|
+
undefinedKeys: cap(undefinedKeys).map((u) => ({ ...u, usages: cap(u.usages) })),
|
|
144
|
+
missingTranslations: cap(missingTranslations),
|
|
145
|
+
unused: cap(unused),
|
|
146
|
+
dynamicPrefixes: cap(dynamicPrefixes).map((p) => ({ ...p, usages: cap(p.usages) })),
|
|
147
|
+
unresolvedUsages: cap(unresolvedUsages),
|
|
148
|
+
truncated,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
buildSummary(report, root, filter) {
|
|
152
|
+
const rel = (file) => relative(root, file) || file;
|
|
153
|
+
const c = report.counts;
|
|
154
|
+
if (report.sources.length === 0) {
|
|
155
|
+
return ('No translation sources found: no setTranslation call on TranslateService/TranslocoService that ' +
|
|
156
|
+
'could be followed to an object, no TranslateHttpLoader/TranslocoLoader folder, no assets/i18n/*.json. ' +
|
|
157
|
+
`${c.usages} static usages of ${c.usedKeys} keys found.`);
|
|
158
|
+
}
|
|
159
|
+
const apps = [...new Set(report.sources.map((s) => s.app))];
|
|
160
|
+
const lines = [
|
|
161
|
+
`Sources: ${report.sources.length}${apps.length > 1 ? ` in ${apps.length} apps` : ''}.`,
|
|
162
|
+
...apps.map((app) => {
|
|
163
|
+
const inApp = report.sources.filter((s) => s.app === app);
|
|
164
|
+
const base = inApp.filter((s) => !s.conditional);
|
|
165
|
+
const groups = [...new Set(inApp.filter((s) => s.conditional).map((s) => s.group ?? rel(s.file)))];
|
|
166
|
+
return (` ${app === '.' ? 'App .' : `App ${app}`}: base ${base.map((s) => `${s.lang} ${rel(s.file)} (${s.keyCount} keys)`).join(', ') || 'none'}` +
|
|
167
|
+
(groups.length > 0
|
|
168
|
+
? `; ${inApp.length - base.length} conditional in ${groups.length} group(s): ${groups.join(', ')}`
|
|
169
|
+
: '') +
|
|
170
|
+
'.');
|
|
171
|
+
}),
|
|
172
|
+
];
|
|
173
|
+
if (report.unresolvedRegistrations.length > 0) {
|
|
174
|
+
lines.push(`${report.unresolvedRegistrations.length} registration(s) not followed to an object: ` +
|
|
175
|
+
report.unresolvedRegistrations.map((u) => `${rel(u.file)}:${u.line}`).join(', ') + '.');
|
|
176
|
+
}
|
|
177
|
+
if (report.keys !== undefined) {
|
|
178
|
+
lines.push(...this.keyLines(report.keys, filter ?? '', rel));
|
|
179
|
+
}
|
|
180
|
+
lines.push(`${filter === undefined ? 'Keys' : `Keys matching '${filter}'`}: ${c.definedKeys} defined, ${c.usedKeys} used statically ` +
|
|
181
|
+
`(${c.usages} usage(s); ${c.templatesScanned} templates and the code scanned).`, `Used but defined nowhere: ${c.undefinedKeys}. Missing translations: ${c.missingTranslations}.`, `No static usage found: ${c.noStaticUsage} (not proof of being unused: keys can be built at runtime or come ` +
|
|
182
|
+
`from data); covered by a dynamic prefix: ${c.coveredByDynamic}; referenced as a string elsewhere: ${c.referencedAsLiteral}.`, `Dynamic usages: ${c.dynamicUsages} (${c.dynamicPrefixes} prefix(es)` +
|
|
183
|
+
(filter === undefined ? `, ${c.unresolvedUsages} without a static prefix` : '') +
|
|
184
|
+
').');
|
|
185
|
+
return lines.join('\n');
|
|
186
|
+
}
|
|
187
|
+
keyLines(keys, filter, rel) {
|
|
188
|
+
if (keys.length === 0) {
|
|
189
|
+
return [`No key '${filter}' is defined or used.`];
|
|
190
|
+
}
|
|
191
|
+
return keys.slice(0, 5).map((k) => {
|
|
192
|
+
const defs = k.definitions.map((d) => `${d.lang}${d.group === undefined ? '' : `/${d.group}`} ${rel(d.file)}:${d.line}`);
|
|
193
|
+
const inTemplates = k.usages.filter((u) => u.source !== 'code').length;
|
|
194
|
+
const missing = k.missingIn.map((gap) => `${gap.languages.join('/')} (${gap.layer})`);
|
|
195
|
+
return (`${k.key} [${k.status}]: defined in ${defs.length > 0 ? defs.join(', ') : 'no source'}; ` +
|
|
196
|
+
`used ${k.usages.length}x (${inTemplates} template, ${k.usages.length - inTemplates} code)` +
|
|
197
|
+
(missing.length > 0 ? `; missing in ${missing.join(', ')}` : '') +
|
|
198
|
+
(k.coveredBy === undefined ? '' : `; covered by ${k.coveredBy.join(', ')}`) +
|
|
199
|
+
'.');
|
|
200
|
+
}).concat(keys.length > 5 ? [`... ${keys.length - 5} more key(s) in keys[].`] : []);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=inspect-i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-i18n.js","sourceRoot":"","sources":["../../src/tools/inspect-i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,aAAa,GAId,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAmDrC;;GAEG;AACH,MAAM,OAAO,eAAe;IAGG;IAFpB,IAAI,GAAG,cAAc,CAAC;IAE/B,YAA6B,WAAyB,IAAI,YAAY,EAAE;QAA3C,aAAQ,GAAR,QAAQ,CAAmC;IAAG,CAAC;IAEnE,WAAW,GAClB,gGAAgG;QAChG,iGAAiG;QACjG,yGAAyG;QACzG,4FAA4F;QAC5F,yGAAyG;QACzG,yGAAyG;QACzG,gGAAgG;QAChG,sGAAsG;QACtG,gGAAgG;QAChG,qGAAqG;QACrG,qGAAqG;QACrG,uFAAuF;QACvF,yGAAyG;QACzG,2GAA2G;QAC3G,2GAA2G;QAC3G,uGAAuG;QACvG,mGAAmG;QACnG,+FAA+F,CAAC;IAEzF,WAAW,GAAG;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kEAAkE;aAChF;YACD,GAAG,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4EAA4E;aAC1F;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kFAAkF;aAChG;YACD,SAAS,E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AC,CAAC,WAAW,IAAI;gBACzF,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,MAAM,WAAW,cAAc,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,WAAW,QAAQ;gBAC3F,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3E,GAAG,CACJ,CAAC;QACJ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;CACF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Inspect Template Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool that returns the structure of an Angular component template:
|
|
5
|
+
* elements with their bindings, the project components/directives and
|
|
6
|
+
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Logic lives in `TemplateInspector` (`@angular-modernizer/api`); this tool
|
|
10
|
+
* only resolves the project, validates arguments and applies the compact
|
|
11
|
+
* output contract. Accepts the `.html` template or the component `.ts` file.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Via MCP:
|
|
16
|
+
* // tool: inspect-template
|
|
17
|
+
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { type MCPTool } from '../types.js';
|
|
21
|
+
import { type ComponentTemplateReport } from '@angular-modernizer/api';
|
|
22
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
23
|
+
/** A report shaped by the compact options. */
|
|
24
|
+
type ListField = 'elements' | 'i18nKeys' | 'dynamicI18nPrefixes';
|
|
25
|
+
type TemplateReportOutput = Omit<ComponentTemplateReport, ListField> & Partial<Pick<ComponentTemplateReport, ListField>> & {
|
|
26
|
+
truncated: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Output of the inspect-template tool.
|
|
30
|
+
*/
|
|
31
|
+
interface InspectTemplateOutput {
|
|
32
|
+
templates: TemplateReportOutput[];
|
|
33
|
+
summary: string;
|
|
34
|
+
tsConfigPath: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* MCP tool that inspects the structure of component templates.
|
|
38
|
+
*/
|
|
39
|
+
export declare class InspectTemplateTool implements MCPTool {
|
|
40
|
+
private readonly projects;
|
|
41
|
+
readonly name = "inspect-template";
|
|
42
|
+
constructor(projects?: ProjectCache);
|
|
43
|
+
readonly description: string;
|
|
44
|
+
readonly inputSchema: {
|
|
45
|
+
type: string;
|
|
46
|
+
properties: {
|
|
47
|
+
summaryOnly: {
|
|
48
|
+
readonly type: "boolean";
|
|
49
|
+
readonly description: "Return counts and the text summary only, without the result list. Default: false.";
|
|
50
|
+
readonly default: false;
|
|
51
|
+
};
|
|
52
|
+
maxResults: {
|
|
53
|
+
readonly type: "number";
|
|
54
|
+
readonly description: string;
|
|
55
|
+
};
|
|
56
|
+
file: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
projectRoot: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
className: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
includePlainElements: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
default: boolean;
|
|
72
|
+
};
|
|
73
|
+
i18nNames: {
|
|
74
|
+
type: string;
|
|
75
|
+
items: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
required: string[];
|
|
82
|
+
};
|
|
83
|
+
execute(args: Record<string, unknown>): Promise<InspectTemplateOutput>;
|
|
84
|
+
private parseI18nNames;
|
|
85
|
+
private shape;
|
|
86
|
+
private buildSummary;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=inspect-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-template.d.ts","sourceRoot":"","sources":["../../src/tools/inspect-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAiC1D,8CAA8C;AAC9C,KAAK,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,qBAAqB,CAAC;AACjE,KAAK,oBAAoB,GAAG,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAClE,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC,GAAG;IAClD,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ;;GAEG;AACH,UAAU,qBAAqB;IAC7B,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,mBAAoB,YAAW,OAAO;IAGrC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,QAAQ,CAAC,IAAI,sBAAsB;gBAEN,QAAQ,GAAE,YAAiC;IAExE,QAAQ,CAAC,WAAW,SAWqC;IAEzD,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BlB;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA4C5E,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,KAAK;IAqBb,OAAO,CAAC,YAAY;CA4BrB"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Inspect Template Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool that returns the structure of an Angular component template:
|
|
5
|
+
* elements with their bindings, the project components/directives and
|
|
6
|
+
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Logic lives in `TemplateInspector` (`@angular-modernizer/api`); this tool
|
|
10
|
+
* only resolves the project, validates arguments and applies the compact
|
|
11
|
+
* output contract. Accepts the `.html` template or the component `.ts` file.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Via MCP:
|
|
16
|
+
* // tool: inspect-template
|
|
17
|
+
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { TemplateInspector, } from '@angular-modernizer/api';
|
|
21
|
+
import { existsSync } from 'node:fs';
|
|
22
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
23
|
+
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
24
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
25
|
+
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
26
|
+
/**
|
|
27
|
+
* MCP tool that inspects the structure of component templates.
|
|
28
|
+
*/
|
|
29
|
+
export class InspectTemplateTool {
|
|
30
|
+
projects;
|
|
31
|
+
name = 'inspect-template';
|
|
32
|
+
constructor(projects = new ProjectCache()) {
|
|
33
|
+
this.projects = projects;
|
|
34
|
+
}
|
|
35
|
+
description = 'Inspect an Angular component template (.html file, or the component .ts for inline templates). ' +
|
|
36
|
+
'Per element: tag, line, control-flow depth, bindings (input, output, two-way, attribute, ' +
|
|
37
|
+
'structural, reference with their expressions) and the project components/directives whose ' +
|
|
38
|
+
'selector matches it. Per template: components/directives used (with files), pipes (resolved to ' +
|
|
39
|
+
'project pipe classes when declared in the project), custom elements without a project match ' +
|
|
40
|
+
'(library components), control-flow blocks, structural directives and max nesting depth, and ' +
|
|
41
|
+
'static i18n keys (translate pipe/directive, i18n="@@id"), plus the static prefixes of dynamic ' +
|
|
42
|
+
"keys ('A.' + x, `A.${x}`) in dynamicI18nPrefixes (definitions and project-wide usages of a key: " +
|
|
43
|
+
'inspect-i18n). Plain elements without bindings are ' +
|
|
44
|
+
'omitted unless includePlainElements; counts always cover all elements. summaryOnly drops the ' +
|
|
45
|
+
'element, key and prefix lists, maxResults caps them.';
|
|
46
|
+
inputSchema = {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
file: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Template .html file or component .ts file (absolute, or relative to projectRoot).',
|
|
52
|
+
},
|
|
53
|
+
projectRoot: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Absolute path to the project root. Must contain a tsconfig.json.',
|
|
56
|
+
},
|
|
57
|
+
className: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Only inspect this component class of a .ts file. Optional.',
|
|
60
|
+
},
|
|
61
|
+
includePlainElements: {
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
description: 'Also list elements without bindings, references or directive matches. Default: false.',
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
i18nNames: {
|
|
67
|
+
type: 'array',
|
|
68
|
+
items: { type: 'string' },
|
|
69
|
+
description: 'Pipe and directive names that take a translation key. Default: ["translate", "transloco"].',
|
|
70
|
+
},
|
|
71
|
+
...COMPACT_OUTPUT_SCHEMA,
|
|
72
|
+
},
|
|
73
|
+
required: ['file', 'projectRoot'],
|
|
74
|
+
};
|
|
75
|
+
async execute(args) {
|
|
76
|
+
const params = args;
|
|
77
|
+
if (!params.file || typeof params.file !== 'string') {
|
|
78
|
+
throw new Error('file is required');
|
|
79
|
+
}
|
|
80
|
+
if (!params.projectRoot) {
|
|
81
|
+
throw new Error('projectRoot is required');
|
|
82
|
+
}
|
|
83
|
+
const compact = parseCompactOptions(args);
|
|
84
|
+
const i18nNames = this.parseI18nNames(params.i18nNames);
|
|
85
|
+
if (!existsSync(params.projectRoot)) {
|
|
86
|
+
throw new Error(`projectRoot does not exist: ${params.projectRoot}`);
|
|
87
|
+
}
|
|
88
|
+
const filePath = isAbsolute(params.file)
|
|
89
|
+
? params.file
|
|
90
|
+
: resolve(params.projectRoot, params.file);
|
|
91
|
+
if (!existsSync(filePath)) {
|
|
92
|
+
throw new Error(`file does not exist: ${filePath}`);
|
|
93
|
+
}
|
|
94
|
+
const tsConfigPath = findTsConfig(params.projectRoot);
|
|
95
|
+
if (!tsConfigPath) {
|
|
96
|
+
throw new Error(`tsconfig.json not found in projectRoot: ${params.projectRoot}`);
|
|
97
|
+
}
|
|
98
|
+
const project = this.projects.get(tsConfigPath);
|
|
99
|
+
if (!filePath.endsWith('.html') && !project.getSourceFile(filePath)) {
|
|
100
|
+
throw new Error(`file is not part of the tsconfig program: ${filePath}`);
|
|
101
|
+
}
|
|
102
|
+
const inspector = new TemplateInspector(project, {
|
|
103
|
+
includePlainElements: params.includePlainElements === true,
|
|
104
|
+
...(i18nNames === undefined ? {} : { i18nNames }),
|
|
105
|
+
});
|
|
106
|
+
const reports = inspector.inspectFile(filePath, params.className);
|
|
107
|
+
return {
|
|
108
|
+
templates: reports.map((r) => this.shape(r, compact.summaryOnly, compact.maxResults)),
|
|
109
|
+
summary: this.buildSummary(filePath, reports),
|
|
110
|
+
tsConfigPath,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
parseI18nNames(value) {
|
|
114
|
+
if (value === undefined) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const valid = Array.isArray(value) && value.every((v) => typeof v === 'string');
|
|
118
|
+
if (!valid) {
|
|
119
|
+
throw new Error('i18nNames must be an array of strings');
|
|
120
|
+
}
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
shape(report, summaryOnly, maxResults) {
|
|
124
|
+
const { elements, i18nKeys, dynamicI18nPrefixes, ...rest } = report;
|
|
125
|
+
if (summaryOnly) {
|
|
126
|
+
return { ...rest, truncated: false };
|
|
127
|
+
}
|
|
128
|
+
const shownElements = limitList(elements, maxResults);
|
|
129
|
+
const shownKeys = limitList(i18nKeys, maxResults);
|
|
130
|
+
const shownPrefixes = limitList(dynamicI18nPrefixes, maxResults);
|
|
131
|
+
return {
|
|
132
|
+
...rest,
|
|
133
|
+
elements: shownElements.items,
|
|
134
|
+
i18nKeys: shownKeys.items,
|
|
135
|
+
dynamicI18nPrefixes: shownPrefixes.items,
|
|
136
|
+
truncated: shownElements.truncated || shownKeys.truncated || shownPrefixes.truncated,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
buildSummary(filePath, reports) {
|
|
140
|
+
if (reports.length === 0) {
|
|
141
|
+
return (`No component template found for ${filePath}. For an .html file no component in the ` +
|
|
142
|
+
'program declares it as templateUrl; for a .ts file no class has a template or templateUrl.');
|
|
143
|
+
}
|
|
144
|
+
return reports
|
|
145
|
+
.map((r) => {
|
|
146
|
+
const c = r.counts;
|
|
147
|
+
const flow = r.controlFlow;
|
|
148
|
+
const blocks = Object.entries(flow.blocks)
|
|
149
|
+
.concat(Object.entries(flow.structuralDirectives).map(([n, k]) => [`*${n}`, k]))
|
|
150
|
+
.map(([n, k]) => `${n} ${k}`)
|
|
151
|
+
.join(', ');
|
|
152
|
+
const unresolved = r.unresolvedElements.map((u) => u.tag).join(', ');
|
|
153
|
+
return [
|
|
154
|
+
`${r.component} (${r.templateFile}${r.inline ? ', inline' : ''}): ${c.elements} elements, ` +
|
|
155
|
+
`${c.bindings} bindings (${c.inputs} in, ${c.outputs} out), ${c.directives} project ` +
|
|
156
|
+
`components/directives, ${c.pipes} pipes, ${c.i18nKeys} i18n keys` +
|
|
157
|
+
(r.dynamicI18nCount > 0 ? ` (+${r.dynamicI18nCount} dynamic)` : '') +
|
|
158
|
+
`, max depth ${flow.maxDepth}${blocks ? ` (${blocks})` : ''}.`,
|
|
159
|
+
...(unresolved ? [` Not in project: ${unresolved}.`] : []),
|
|
160
|
+
...(r.parseErrors.length > 0 ? [` ${r.parseErrors.length} parse error(s).`] : []),
|
|
161
|
+
].join('\n');
|
|
162
|
+
})
|
|
163
|
+
.join('\n');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=inspect-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-template.js","sourceRoot":"","sources":["../../src/tools/inspect-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EACL,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AA4CrC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAGD;IAFpB,IAAI,GAAG,kBAAkB,CAAC;IAEnC,YAA6B,WAAyB,IAAI,YAAY,EAAE;QAA3C,aAAQ,GAAR,QAAQ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