source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/host/commonjs_umd_utils.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: 5.6 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_umd_utils" />
9import * as ts from 'typescript';
10import { Declaration } from '../../../src/ngtsc/reflection';
11export interface ExportDeclaration {
12 name: string;
13 declaration: Declaration;
14}
15/**
16 * A CommonJS or UMD wildcard re-export statement.
17 *
18 * The CommonJS or UMD version of `export * from 'blah';`.
19 *
20 * These statements can have several forms (depending, for example, on whether
21 * the TypeScript helpers are imported or emitted inline). The expression can have one of the
22 * following forms:
23 * - `__export(firstArg)`
24 * - `__exportStar(firstArg)`
25 * - `tslib.__export(firstArg, exports)`
26 * - `tslib.__exportStar(firstArg, exports)`
27 *
28 * In all cases, we only care about `firstArg`, which is the first argument of the re-export call
29 * expression and can be either a `require('...')` call or an identifier (initialized via a
30 * `require('...')` call).
31 */
32export interface WildcardReexportStatement extends ts.ExpressionStatement {
33 expression: ts.CallExpression;
34}
35/**
36 * A CommonJS or UMD re-export statement using an `Object.defineProperty()` call.
37 * For example:
38 *
39 * ```
40 * Object.defineProperty(exports, "<exported-id>",
41 * { enumerable: true, get: function () { return <imported-id>; } });
42 * ```
43 */
44export interface DefinePropertyReexportStatement extends ts.ExpressionStatement {
45 expression: ts.CallExpression & {
46 arguments: [ts.Identifier, ts.StringLiteral, ts.ObjectLiteralExpression];
47 };
48}
49/**
50 * A call expression that has a string literal for its first argument.
51 */
52export interface RequireCall extends ts.CallExpression {
53 arguments: ts.CallExpression['arguments'] & [ts.StringLiteral];
54}
55/**
56 * Return the "namespace" of the specified `ts.Identifier` if the identifier is the RHS of a
57 * property access expression, i.e. an expression of the form `<namespace>.<id>` (in which case a
58 * `ts.Identifier` corresponding to `<namespace>` will be returned). Otherwise return `null`.
59 */
60export declare function findNamespaceOfIdentifier(id: ts.Identifier): ts.Identifier | null;
61/**
62 * Return the `RequireCall` that is used to initialize the specified `ts.Identifier`, if the
63 * specified indentifier was indeed initialized with a require call in a declaration of the form:
64 * `var <id> = require('...')`
65 */
66export declare function findRequireCallReference(id: ts.Identifier, checker: ts.TypeChecker): RequireCall | null;
67/**
68 * Check whether the specified `ts.Statement` is a wildcard re-export statement.
69 * I.E. an expression statement of one of the following forms:
70 * - `__export(<foo>)`
71 * - `__exportStar(<foo>)`
72 * - `tslib.__export(<foo>, exports)`
73 * - `tslib.__exportStar(<foo>, exports)`
74 */
75export declare function isWildcardReexportStatement(stmt: ts.Statement): stmt is WildcardReexportStatement;
76/**
77 * Check whether the statement is a re-export of the form:
78 *
79 * ```
80 * Object.defineProperty(exports, "<export-name>",
81 * { enumerable: true, get: function () { return <import-name>; } });
82 * ```
83 */
84export declare function isDefinePropertyReexportStatement(stmt: ts.Statement): stmt is DefinePropertyReexportStatement;
85/**
86 * Extract the "value" of the getter in a `defineProperty` statement.
87 *
88 * This will return the `ts.Expression` value of a single `return` statement in the `get` method
89 * of the property definition object, or `null` if that is not possible.
90 */
91export declare function extractGetterFnExpression(statement: DefinePropertyReexportStatement): ts.Expression | null;
92/**
93 * Check whether the specified `ts.Node` represents a `require()` call, i.e. an call expression of
94 * the form: `require('<foo>')`
95 */
96export declare function isRequireCall(node: ts.Node): node is RequireCall;
97/**
98 * Check whether the specified `path` is an "external" import.
99 * In other words, that it comes from a entry-point outside the current one.
100 */
101export declare function isExternalImport(path: string): boolean;
102/**
103 * A UMD/CommonJS style export declaration of the form `exports.<name>`.
104 */
105export interface ExportsDeclaration extends ts.PropertyAccessExpression {
106 name: ts.Identifier;
107 expression: ts.Identifier;
108 parent: ExportsAssignment;
109}
110/**
111 * Check whether the specified `node` is a property access expression of the form
112 * `exports.<foo>`.
113 */
114export declare function isExportsDeclaration(expr: ts.Node): expr is ExportsDeclaration;
115/**
116 * A UMD/CommonJS style export assignment of the form `exports.<foo> = <bar>`.
117 */
118export interface ExportsAssignment extends ts.BinaryExpression {
119 left: ExportsDeclaration;
120}
121/**
122 * Check whether the specified `node` is an assignment expression of the form
123 * `exports.<foo> = <bar>`.
124 */
125export declare function isExportsAssignment(expr: ts.Node): expr is ExportsAssignment;
126/**
127 * An expression statement of the form `exports.<foo> = <bar>;`.
128 */
129export interface ExportsStatement extends ts.ExpressionStatement {
130 expression: ExportsAssignment;
131}
132/**
133 * Check whether the specified `stmt` is an expression statement of the form
134 * `exports.<foo> = <bar>;`.
135 */
136export declare function isExportsStatement(stmt: ts.Node): stmt is ExportsStatement;
137/**
138 * Find the far right hand side of a sequence of aliased assignements of the form
139 *
140 * ```
141 * exports.MyClass = alias1 = alias2 = <<declaration>>
142 * ```
143 *
144 * @param node the expression to parse
145 * @returns the original `node` or the far right expression of a series of assignments.
146 */
147export declare function skipAliases(node: ts.Expression): ts.Expression;
Note: See TracBrowser for help on using the repository browser.