source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/host/ngcc_host.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/// <amd-module name="@angular/compiler-cli/ngcc/src/host/ngcc_host" />
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9import * as ts from 'typescript';
10import { ClassDeclaration, Declaration, Decorator, ReflectionHost } from '../../../src/ngtsc/reflection';
11import { SymbolWithValueDeclaration } from '../../../src/ngtsc/util/src/typescript';
12export declare const PRE_R3_MARKER = "__PRE_R3__";
13export declare const POST_R3_MARKER = "__POST_R3__";
14export declare type SwitchableVariableDeclaration = ts.VariableDeclaration & {
15 initializer: ts.Identifier;
16};
17export declare function isSwitchableVariableDeclaration(node: ts.Node): node is SwitchableVariableDeclaration;
18/**
19 * The symbol corresponding to a "class" declaration. I.e. a `ts.Symbol` whose `valueDeclaration` is
20 * a `ClassDeclaration`.
21 */
22export declare type ClassSymbol = ts.Symbol & {
23 valueDeclaration: ClassDeclaration;
24};
25/**
26 * A representation of a class that accounts for the potential existence of two `ClassSymbol`s for a
27 * given class, as the compiled JavaScript bundles that ngcc reflects on can have two declarations.
28 */
29export interface NgccClassSymbol {
30 /**
31 * The name of the class.
32 */
33 name: string;
34 /**
35 * Represents the symbol corresponding with the outer declaration of the class. This should be
36 * considered the public class symbol, i.e. its declaration is visible to the rest of the program.
37 */
38 declaration: ClassSymbol;
39 /**
40 * Represents the symbol corresponding with the inner declaration of the class, referred to as its
41 * "implementation". This is not necessarily a `ClassSymbol` but rather just a `ts.Symbol`, as the
42 * inner declaration does not need to satisfy the requirements imposed on a publicly visible class
43 * declaration.
44 */
45 implementation: SymbolWithValueDeclaration;
46 /**
47 * Represents the symbol corresponding to a variable within a class IIFE that may be used to
48 * attach static properties or decorated.
49 */
50 adjacent?: SymbolWithValueDeclaration;
51}
52/**
53 * A reflection host that has extra methods for looking at non-Typescript package formats
54 */
55export interface NgccReflectionHost extends ReflectionHost {
56 /**
57 * Find a symbol for a declaration that we think is a class.
58 * @param declaration The declaration whose symbol we are finding
59 * @returns the symbol for the declaration or `undefined` if it is not
60 * a "class" or has no symbol.
61 */
62 getClassSymbol(declaration: ts.Node): NgccClassSymbol | undefined;
63 /**
64 * Search the given module for variable declarations in which the initializer
65 * is an identifier marked with the `PRE_R3_MARKER`.
66 * @param module The module in which to search for switchable declarations.
67 * @returns An array of variable declarations that match.
68 */
69 getSwitchableDeclarations(module: ts.Node): SwitchableVariableDeclaration[];
70 /**
71 * Retrieves all decorators of a given class symbol.
72 * @param symbol Class symbol that can refer to a declaration which can hold decorators.
73 * @returns An array of decorators or null if none are declared.
74 */
75 getDecoratorsOfSymbol(symbol: NgccClassSymbol): Decorator[] | null;
76 /**
77 * Retrieves all class symbols of a given source file.
78 * @param sourceFile The source file to search for classes.
79 * @returns An array of found class symbols.
80 */
81 findClassSymbols(sourceFile: ts.SourceFile): NgccClassSymbol[];
82 /**
83 * Find the last node that is relevant to the specified class.
84 *
85 * As well as the main declaration, classes can have additional statements such as static
86 * properties (`SomeClass.staticProp = ...;`) and decorators (`__decorate(SomeClass, ...);`).
87 * It is useful to know exactly where the class "ends" so that we can inject additional
88 * statements after that point.
89 *
90 * @param classSymbol The class whose statements we want.
91 */
92 getEndOfClass(classSymbol: NgccClassSymbol): ts.Node;
93 /**
94 * Check whether a `Declaration` corresponds with a known declaration and set its `known` property
95 * to the appropriate `KnownDeclaration`.
96 *
97 * @param decl The `Declaration` to check.
98 * @return The passed in `Declaration` (potentially enhanced with a `KnownDeclaration`).
99 */
100 detectKnownDeclaration<T extends Declaration>(decl: T): T;
101}
Note: See TracBrowser for help on using the repository browser.