source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/migrations/migration.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: 3.0 KB
Line 
1/// <amd-module name="@angular/compiler-cli/ngcc/src/migrations/migration" />
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 { MetadataReader } from '../../../src/ngtsc/metadata';
11import { PartialEvaluator } from '../../../src/ngtsc/partial_evaluator';
12import { ClassDeclaration, Decorator } from '../../../src/ngtsc/reflection';
13import { HandlerFlags } from '../../../src/ngtsc/transform';
14import { NgccReflectionHost } from '../host/ngcc_host';
15/**
16 * Implement this interface and add it to the `DecorationAnalyzer.migrations` collection to get ngcc
17 * to modify the analysis of the decorators in the program in order to migrate older code to work
18 * with Ivy.
19 *
20 * `Migration.apply()` is called for every class in the program being compiled by ngcc.
21 *
22 * Note that the underlying program could be in a variety of different formats, e.g. ES2015, ES5,
23 * UMD, CommonJS etc. This means that an author of a `Migration` should not attempt to navigate and
24 * manipulate the AST nodes directly. Instead, the `MigrationHost` interface, passed to the
25 * `Migration`, provides access to a `MetadataReader`, `ReflectionHost` and `PartialEvaluator`
26 * interfaces, which should be used.
27 */
28export interface Migration {
29 apply(clazz: ClassDeclaration, host: MigrationHost): ts.Diagnostic | null;
30}
31export interface MigrationHost {
32 /** Provides access to the decorator information associated with classes. */
33 readonly metadata: MetadataReader;
34 /** Provides access to navigate the AST in a format-agnostic manner. */
35 readonly reflectionHost: NgccReflectionHost;
36 /** Enables expressions to be statically evaluated in the context of the program. */
37 readonly evaluator: PartialEvaluator;
38 /**
39 * Associate a new synthesized decorator, which did not appear in the original source, with a
40 * given class.
41 * @param clazz the class to receive the new decorator.
42 * @param decorator the decorator to inject.
43 * @param flags optional bitwise flag to influence the compilation of the decorator.
44 */
45 injectSyntheticDecorator(clazz: ClassDeclaration, decorator: Decorator, flags?: HandlerFlags): void;
46 /**
47 * Retrieves all decorators that are associated with the class, including synthetic decorators
48 * that have been injected before.
49 * @param clazz the class for which all decorators are retrieved.
50 * @returns the list of the decorators, or null if the class was not decorated.
51 */
52 getAllDecorators(clazz: ClassDeclaration): Decorator[] | null;
53 /**
54 * Determines whether the provided class in within scope of the entry-point that is currently
55 * being compiled.
56 * @param clazz the class for which to determine whether it is within the current entry-point.
57 * @returns true if the file is part of the compiled entry-point, false otherwise.
58 */
59 isInScope(clazz: ClassDeclaration): boolean;
60}
Note: See TracBrowser for help on using the repository browser.