1 | /// <amd-module name="@angular/compiler-cli/ngcc/src/rendering/renderer" />
|
---|
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 | */
|
---|
9 | import { ConstantPool } from '@angular/compiler';
|
---|
10 | import * as ts from 'typescript';
|
---|
11 | import { ReadonlyFileSystem } from '../../../src/ngtsc/file_system';
|
---|
12 | import { Logger } from '../../../src/ngtsc/logging';
|
---|
13 | import { ImportManager } from '../../../src/ngtsc/translator';
|
---|
14 | import { ParsedConfiguration } from '../../../src/perform_compile';
|
---|
15 | import { PrivateDeclarationsAnalyses } from '../analysis/private_declarations_analyzer';
|
---|
16 | import { SwitchMarkerAnalyses, SwitchMarkerAnalysis } from '../analysis/switch_marker_analyzer';
|
---|
17 | import { CompiledFile, DecorationAnalyses } from '../analysis/types';
|
---|
18 | import { NgccReflectionHost } from '../host/ngcc_host';
|
---|
19 | import { EntryPointBundle } from '../packages/entry_point_bundle';
|
---|
20 | import { RenderingFormatter } from './rendering_formatter';
|
---|
21 | import { FileToWrite } from './utils';
|
---|
22 | /**
|
---|
23 | * A base-class for rendering an `AnalyzedFile`.
|
---|
24 | *
|
---|
25 | * Package formats have output files that must be rendered differently. Concrete sub-classes must
|
---|
26 | * implement the `addImports`, `addDefinitions` and `removeDecorators` abstract methods.
|
---|
27 | */
|
---|
28 | export declare class Renderer {
|
---|
29 | private host;
|
---|
30 | private srcFormatter;
|
---|
31 | private fs;
|
---|
32 | private logger;
|
---|
33 | private bundle;
|
---|
34 | private tsConfig;
|
---|
35 | constructor(host: NgccReflectionHost, srcFormatter: RenderingFormatter, fs: ReadonlyFileSystem, logger: Logger, bundle: EntryPointBundle, tsConfig?: ParsedConfiguration | null);
|
---|
36 | renderProgram(decorationAnalyses: DecorationAnalyses, switchMarkerAnalyses: SwitchMarkerAnalyses, privateDeclarationsAnalyses: PrivateDeclarationsAnalyses): FileToWrite[];
|
---|
37 | /**
|
---|
38 | * Render the source code and source-map for an Analyzed file.
|
---|
39 | * @param compiledFile The analyzed file to render.
|
---|
40 | * @param targetPath The absolute path where the rendered file will be written.
|
---|
41 | */
|
---|
42 | renderFile(sourceFile: ts.SourceFile, compiledFile: CompiledFile | undefined, switchMarkerAnalysis: SwitchMarkerAnalysis | undefined, privateDeclarationsAnalyses: PrivateDeclarationsAnalyses): FileToWrite[];
|
---|
43 | /**
|
---|
44 | * From the given list of classes, computes a map of decorators that should be removed.
|
---|
45 | * The decorators to remove are keyed by their container node, such that we can tell if
|
---|
46 | * we should remove the entire decorator property.
|
---|
47 | * @param classes The list of classes that may have decorators to remove.
|
---|
48 | * @returns A map of decorators to remove, keyed by their container node.
|
---|
49 | */
|
---|
50 | private computeDecoratorsToRemove;
|
---|
51 | /**
|
---|
52 | * Render the definitions as source code for the given class.
|
---|
53 | * @param sourceFile The file containing the class to process.
|
---|
54 | * @param clazz The class whose definitions are to be rendered.
|
---|
55 | * @param compilation The results of analyzing the class - this is used to generate the rendered
|
---|
56 | * definitions.
|
---|
57 | * @param imports An object that tracks the imports that are needed by the rendered definitions.
|
---|
58 | */
|
---|
59 | private renderDefinitions;
|
---|
60 | /**
|
---|
61 | * Render the adjacent statements as source code for the given class.
|
---|
62 | * @param sourceFile The file containing the class to process.
|
---|
63 | * @param clazz The class whose statements are to be rendered.
|
---|
64 | * @param compilation The results of analyzing the class - this is used to generate the rendered
|
---|
65 | * definitions.
|
---|
66 | * @param imports An object that tracks the imports that are needed by the rendered definitions.
|
---|
67 | */
|
---|
68 | private renderAdjacentStatements;
|
---|
69 | private renderStatements;
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Render the constant pool as source code for the given class.
|
---|
73 | */
|
---|
74 | export declare function renderConstantPool(formatter: RenderingFormatter, sourceFile: ts.SourceFile, constantPool: ConstantPool, imports: ImportManager): string;
|
---|