source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/host/commonjs_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: 3.4 KB
Line 
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/compiler-cli/ngcc/src/host/commonjs_host" />
9import * as ts from 'typescript';
10import { Logger } from '../../../src/ngtsc/logging';
11import { Declaration, Import } from '../../../src/ngtsc/reflection';
12import { BundleProgram } from '../packages/bundle_program';
13import { FactoryMap } from '../utils';
14import { Esm5ReflectionHost } from './esm5_host';
15import { NgccClassSymbol } from './ngcc_host';
16export declare class CommonJsReflectionHost extends Esm5ReflectionHost {
17 protected commonJsExports: FactoryMap<ts.SourceFile, Map<string, Declaration<ts.Declaration>> | null>;
18 protected topLevelHelperCalls: FactoryMap<string, FactoryMap<ts.SourceFile, ts.CallExpression[]>>;
19 protected program: ts.Program;
20 protected compilerHost: ts.CompilerHost;
21 constructor(logger: Logger, isCore: boolean, src: BundleProgram, dts?: BundleProgram | null);
22 getImportOfIdentifier(id: ts.Identifier): Import | null;
23 getDeclarationOfIdentifier(id: ts.Identifier): Declaration | null;
24 getExportsOfModule(module: ts.Node): Map<string, Declaration> | null;
25 /**
26 * Search statements related to the given class for calls to the specified helper.
27 *
28 * In CommonJS these helper calls can be outside the class's IIFE at the top level of the
29 * source file. Searching the top level statements for helpers can be expensive, so we
30 * try to get helpers from the IIFE first and only fall back on searching the top level if
31 * no helpers are found.
32 *
33 * @param classSymbol the class whose helper calls we are interested in.
34 * @param helperNames the names of the helpers (e.g. `__decorate`) whose calls we are interested
35 * in.
36 * @returns an array of nodes of calls to the helper with the given name.
37 */
38 protected getHelperCallsForClass(classSymbol: NgccClassSymbol, helperNames: string[]): ts.CallExpression[];
39 /**
40 * Find all the helper calls at the top level of a source file.
41 *
42 * We cache the helper calls per source file so that we don't have to keep parsing the code for
43 * each class in a file.
44 *
45 * @param sourceFile the source who may contain helper calls.
46 * @param helperNames the names of the helpers (e.g. `__decorate`) whose calls we are interested
47 * in.
48 * @returns an array of nodes of calls to the helper with the given name.
49 */
50 private getTopLevelHelperCalls;
51 private computeExportsOfCommonJsModule;
52 private extractBasicCommonJsExportDeclaration;
53 private extractCommonJsWildcardReexports;
54 private extractCommonJsDefinePropertyExportDeclaration;
55 private findCommonJsImport;
56 /**
57 * Handle the case where the identifier represents a reference to a whole CommonJS
58 * module, i.e. the result of a call to `require(...)`.
59 *
60 * @param id the identifier whose declaration we are looking for.
61 * @returns a declaration if `id` refers to a CommonJS module, or `null` otherwise.
62 */
63 private getCommonJsModuleDeclaration;
64 /**
65 * If this is an IFE then try to grab the outer and inner classes otherwise fallback on the super
66 * class.
67 */
68 protected getDeclarationOfExpression(expression: ts.Expression): Declaration | null;
69 private resolveModuleName;
70}
Note: See TracBrowser for help on using the repository browser.