1 | /**
|
2 | * @license
|
3 | * Copyright Google LLC All Rights Reserved.
|
4 | *
|
5 | * Use of this source code is governed by an MIT-style license that can be
|
6 | * found in the LICENSE file at https://angular.io/license
|
7 | */
|
8 | /// <amd-module name="@angular/core/schematics/utils/ng_component_template" />
|
9 | import { Tree } from '@angular-devkit/schematics';
|
10 | import ts from 'typescript';
|
11 | export interface ResolvedTemplate {
|
12 | /** Class declaration that contains this template. */
|
13 | container: ts.ClassDeclaration;
|
14 | /** File content of the given template. */
|
15 | content: string;
|
16 | /** Start offset of the template content (e.g. in the inline source file) */
|
17 | start: number;
|
18 | /** Whether the given template is inline or not. */
|
19 | inline: boolean;
|
20 | /** Path to the file that contains this template. */
|
21 | filePath: string;
|
22 | /**
|
23 | * Gets the character and line of a given position index in the template.
|
24 | * If the template is declared inline within a TypeScript source file, the line and
|
25 | * character are based on the full source file content.
|
26 | */
|
27 | getCharacterAndLineOfPosition: (pos: number) => {
|
28 | character: number;
|
29 | line: number;
|
30 | };
|
31 | }
|
32 | /**
|
33 | * Visitor that can be used to determine Angular templates referenced within given
|
34 | * TypeScript source files (inline templates or external referenced templates)
|
35 | */
|
36 | export declare class NgComponentTemplateVisitor {
|
37 | typeChecker: ts.TypeChecker;
|
38 | private _basePath;
|
39 | private _tree;
|
40 | resolvedTemplates: ResolvedTemplate[];
|
41 | constructor(typeChecker: ts.TypeChecker, _basePath: string, _tree: Tree);
|
42 | visitNode(node: ts.Node): void;
|
43 | private visitClassDeclaration;
|
44 | }
|