static-injector 4.0.2 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{import/commonjs → commonjs}/index.js +29 -197
- package/{import/es2022 → es2022}/di/interface/defs.js +5 -1
- package/{import/es2022 → es2022}/index.js +0 -1
- package/{transform/compiler/index.d.ts → es2022/interface/lifecycle_hooks.js} +1 -1
- package/{transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.js → es2022/render3/definition_factory.js} +3 -2
- package/es2022/util/decorators.js +31 -0
- package/{import/fesm2022 → fesm2022}/index.js +30 -196
- package/package.json +17 -14
- package/readme.md +32 -12
- package/{import/typings → typings}/di/injectable.d.ts +0 -7
- package/{import/typings → typings}/index.d.ts +0 -1
- package/import/es2022/di/injectable.js +0 -14
- package/import/es2022/error_details_base_url.js +0 -19
- package/import/es2022/render3/definition_factory.js +0 -14
- package/import/es2022/render3/di.js +0 -49
- package/import/es2022/render3/error_code.js +0 -30
- package/import/es2022/util/array_utils.js +0 -17
- package/import/es2022/util/decorators.js +0 -53
- package/import/typings/error_details_base_url.d.ts +0 -19
- package/import/typings/render3/di.d.ts +0 -12
- package/import/typings/render3/error_code.d.ts +0 -24
- package/import/typings/util/array_utils.d.ts +0 -25
- package/transform/compiler/compiler.d.ts +0 -8
- package/transform/compiler/compiler.js +0 -28
- package/transform/compiler/index.js +0 -28
- package/transform/compiler/public_api.d.ts +0 -13
- package/transform/compiler/public_api.js +0 -30
- package/transform/compiler/src/compiler.d.ts +0 -5
- package/transform/compiler/src/compiler.js +0 -21
- package/transform/compiler/src/core.d.ts +0 -25
- package/transform/compiler/src/core.js +0 -22
- package/transform/compiler/src/injectable_compiler_2.d.ts +0 -23
- package/transform/compiler/src/injectable_compiler_2.js +0 -171
- package/transform/compiler/src/output/output_ast.d.ts +0 -512
- package/transform/compiler/src/output/output_ast.js +0 -1109
- package/transform/compiler/src/parse_util.d.ts +0 -50
- package/transform/compiler/src/parse_util.js +0 -71
- package/transform/compiler/src/render3/partial/api.d.ts +0 -171
- package/transform/compiler/src/render3/partial/api.js +0 -18
- package/transform/compiler/src/render3/r3_factory.d.ts +0 -82
- package/transform/compiler/src/render3/r3_factory.js +0 -225
- package/transform/compiler/src/render3/r3_identifiers.d.ts +0 -20
- package/transform/compiler/src/render3/r3_identifiers.js +0 -55
- package/transform/compiler/src/render3/util.d.ts +0 -85
- package/transform/compiler/src/render3/util.js +0 -82
- package/transform/compiler/src/render3/view/util.d.ts +0 -24
- package/transform/compiler/src/render3/view/util.js +0 -59
- package/transform/compiler-cli/src/ngtsc/annotations/common/index.d.ts +0 -3
- package/transform/compiler-cli/src/ngtsc/annotations/common/index.js +0 -19
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.d.ts +0 -37
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.js +0 -195
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/factory.d.ts +0 -11
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/factory.js +0 -22
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.d.ts +0 -64
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.js +0 -189
- package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.d.ts +0 -43
- package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +0 -277
- package/transform/compiler-cli/src/ngtsc/diagnostics/error.d.ts +0 -24
- package/transform/compiler-cli/src/ngtsc/diagnostics/error.js +0 -84
- package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.d.ts +0 -188
- package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.js +0 -206
- package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +0 -2
- package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +0 -18
- package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +0 -1
- package/transform/compiler-cli/src/ngtsc/imports/index.js +0 -17
- package/transform/compiler-cli/src/ngtsc/imports/src/core.d.ts +0 -36
- package/transform/compiler-cli/src/ngtsc/imports/src/core.js +0 -25
- package/transform/compiler-cli/src/ngtsc/imports/src/default.d.ts +0 -19
- package/transform/compiler-cli/src/ngtsc/imports/src/default.js +0 -27
- package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +0 -3
- package/transform/compiler-cli/src/ngtsc/reflection/index.js +0 -19
- package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +0 -522
- package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +0 -34
- package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +0 -25
- package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +0 -271
- package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +0 -53
- package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +0 -393
- package/transform/compiler-cli/src/ngtsc/reflection/src/util.d.ts +0 -12
- package/transform/compiler-cli/src/ngtsc/reflection/src/util.js +0 -29
- package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +0 -2
- package/transform/compiler-cli/src/ngtsc/transform/index.js +0 -18
- package/transform/compiler-cli/src/ngtsc/transform/src/api.d.ts +0 -115
- package/transform/compiler-cli/src/ngtsc/transform/src/api.js +0 -29
- package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +0 -15
- package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +0 -79
- package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +0 -5
- package/transform/compiler-cli/src/ngtsc/translator/index.js +0 -21
- package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +0 -289
- package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.d.ts +0 -27
- package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.js +0 -9
- package/transform/compiler-cli/src/ngtsc/translator/src/context.d.ts +0 -18
- package/transform/compiler-cli/src/ngtsc/translator/src/context.js +0 -28
- package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +0 -47
- package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +0 -66
- package/transform/compiler-cli/src/ngtsc/translator/src/translator.d.ts +0 -56
- package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +0 -270
- package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.d.ts +0 -12
- package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.js +0 -27
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts +0 -53
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +0 -250
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.d.ts +0 -13
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.js +0 -21
- package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.d.ts +0 -8
- package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.js +0 -24
- package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.d.ts +0 -45
- package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.js +0 -86
- package/transform/compiler-cli/src/ngtsc/util/src/typescript.d.ts +0 -4
- package/transform/compiler-cli/src/ngtsc/util/src/typescript.js +0 -16
- package/transform/index.d.ts +0 -1
- package/transform/index.js +0 -17
- package/transform/injectable-transform.d.ts +0 -41
- package/transform/injectable-transform.js +0 -245
- package/transform/node-Iteration.d.ts +0 -2
- package/transform/node-Iteration.js +0 -12
- /package/{import/es2022 → es2022}/di/create_injector.js +0 -0
- /package/{import/es2022 → es2022}/di/forward_ref.js +0 -0
- /package/{import/es2022 → es2022}/di/index.js +0 -0
- /package/{import/es2022 → es2022}/di/initializer_token.js +0 -0
- /package/{import/es2022 → es2022}/di/inject_switch.js +0 -0
- /package/{import/es2022/di/injector_marker.js → es2022/di/injectable.js} +0 -0
- /package/{import/es2022 → es2022}/di/injection_token.js +0 -0
- /package/{import/es2022 → es2022}/di/injector.js +0 -0
- /package/{import/es2022 → es2022}/di/injector_compatibility.js +0 -0
- /package/{import/es2022/di/provider_token.js → es2022/di/injector_marker.js} +0 -0
- /package/{import/es2022 → es2022}/di/injector_token.js +0 -0
- /package/{import/es2022 → es2022}/di/interface/injector.js +0 -0
- /package/{import/es2022 → es2022}/di/interface/provider.js +0 -0
- /package/{import/es2022 → es2022}/di/internal_tokens.js +0 -0
- /package/{import/es2022 → es2022}/di/metadata.js +0 -0
- /package/{import/es2022 → es2022}/di/null_injector.js +0 -0
- /package/{import/es2022 → es2022}/di/provider_collection.js +0 -0
- /package/{import/es2022/interface/lifecycle_hooks.js → es2022/di/provider_token.js} +0 -0
- /package/{import/es2022 → es2022}/di/r3_injector.js +0 -0
- /package/{import/es2022 → es2022}/di/scope.js +0 -0
- /package/{import/es2022 → es2022}/di.js +0 -0
- /package/{import/es2022 → es2022}/errors.js +0 -0
- /package/{import/es2022 → es2022}/interface/type.js +0 -0
- /package/{import/es2022 → es2022}/render3/errors_di.js +0 -0
- /package/{import/es2022 → es2022}/render3/fields.js +0 -0
- /package/{import/es2022 → es2022}/render3/instructions/di.js +0 -0
- /package/{import/es2022 → es2022}/render3/util/stringify_utils.js +0 -0
- /package/{import/es2022 → es2022}/util/closure.js +0 -0
- /package/{import/es2022 → es2022}/util/empty.js +0 -0
- /package/{import/es2022 → es2022}/util/property.js +0 -0
- /package/{import/es2022 → es2022}/util/stringify.js +0 -0
- /package/{import/typings → typings}/di/create_injector.d.ts +0 -0
- /package/{import/typings → typings}/di/forward_ref.d.ts +0 -0
- /package/{import/typings → typings}/di/index.d.ts +0 -0
- /package/{import/typings → typings}/di/initializer_token.d.ts +0 -0
- /package/{import/typings → typings}/di/inject_switch.d.ts +0 -0
- /package/{import/typings → typings}/di/injection_token.d.ts +0 -0
- /package/{import/typings → typings}/di/injector.d.ts +0 -0
- /package/{import/typings → typings}/di/injector_compatibility.d.ts +0 -0
- /package/{import/typings → typings}/di/injector_marker.d.ts +0 -0
- /package/{import/typings → typings}/di/injector_token.d.ts +0 -0
- /package/{import/typings → typings}/di/interface/defs.d.ts +0 -0
- /package/{import/typings → typings}/di/interface/injector.d.ts +0 -0
- /package/{import/typings → typings}/di/interface/provider.d.ts +0 -0
- /package/{import/typings → typings}/di/internal_tokens.d.ts +0 -0
- /package/{import/typings → typings}/di/metadata.d.ts +0 -0
- /package/{import/typings → typings}/di/null_injector.d.ts +0 -0
- /package/{import/typings → typings}/di/provider_collection.d.ts +0 -0
- /package/{import/typings → typings}/di/provider_token.d.ts +0 -0
- /package/{import/typings → typings}/di/r3_injector.d.ts +0 -0
- /package/{import/typings → typings}/di/scope.d.ts +0 -0
- /package/{import/typings → typings}/di.d.ts +0 -0
- /package/{import/typings → typings}/errors.d.ts +0 -0
- /package/{import/typings → typings}/interface/lifecycle_hooks.d.ts +0 -0
- /package/{import/typings → typings}/interface/type.d.ts +0 -0
- /package/{import/typings → typings}/render3/definition_factory.d.ts +0 -0
- /package/{import/typings → typings}/render3/errors_di.d.ts +0 -0
- /package/{import/typings → typings}/render3/fields.d.ts +0 -0
- /package/{import/typings → typings}/render3/instructions/di.d.ts +0 -0
- /package/{import/typings → typings}/render3/util/stringify_utils.d.ts +0 -0
- /package/{import/typings → typings}/util/closure.d.ts +0 -0
- /package/{import/typings → typings}/util/decorators.d.ts +0 -0
- /package/{import/typings → typings}/util/empty.d.ts +0 -0
- /package/{import/typings → typings}/util/property.d.ts +0 -0
- /package/{import/typings → typings}/util/stringify.d.ts +0 -0
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.getContainingImportDeclaration = exports.reflectObjectLiteral = exports.TypeScriptReflectionHost = void 0;
|
|
14
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
15
|
-
const host_1 = require("./host");
|
|
16
|
-
const type_to_value_1 = require("./type_to_value");
|
|
17
|
-
const util_1 = require("./util");
|
|
18
|
-
/**
|
|
19
|
-
* reflector.ts implements static reflection of declarations using the TypeScript `ts.TypeChecker`.
|
|
20
|
-
*/
|
|
21
|
-
class TypeScriptReflectionHost {
|
|
22
|
-
checker;
|
|
23
|
-
isLocalCompilation;
|
|
24
|
-
constructor(checker, isLocalCompilation = false) {
|
|
25
|
-
this.checker = checker;
|
|
26
|
-
this.isLocalCompilation = isLocalCompilation;
|
|
27
|
-
}
|
|
28
|
-
getDecoratorsOfDeclaration(declaration) {
|
|
29
|
-
const decorators = typescript_1.default.canHaveDecorators(declaration)
|
|
30
|
-
? typescript_1.default.getDecorators(declaration)
|
|
31
|
-
: undefined;
|
|
32
|
-
return decorators !== undefined && decorators.length
|
|
33
|
-
? decorators
|
|
34
|
-
.map((decorator) => this._reflectDecorator(decorator))
|
|
35
|
-
.filter((dec) => dec !== null)
|
|
36
|
-
: null;
|
|
37
|
-
}
|
|
38
|
-
getMembersOfClass(clazz) {
|
|
39
|
-
const tsClazz = castDeclarationToClassOrDie(clazz);
|
|
40
|
-
return tsClazz.members
|
|
41
|
-
.map((member) => this._reflectMember(member))
|
|
42
|
-
.filter((member) => member !== null);
|
|
43
|
-
}
|
|
44
|
-
getConstructorParameters(clazz) {
|
|
45
|
-
const tsClazz = castDeclarationToClassOrDie(clazz);
|
|
46
|
-
const isDeclaration = tsClazz.getSourceFile().isDeclarationFile;
|
|
47
|
-
// For non-declaration files, we want to find the constructor with a `body`. The constructors
|
|
48
|
-
// without a `body` are overloads whereas we want the implementation since it's the one that'll
|
|
49
|
-
// be executed and which can have decorators. For declaration files, we take the first one that
|
|
50
|
-
// we get.
|
|
51
|
-
const ctor = tsClazz.members.find((member) => typescript_1.default.isConstructorDeclaration(member) &&
|
|
52
|
-
(isDeclaration || member.body !== undefined));
|
|
53
|
-
if (ctor === undefined) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return ctor.parameters.map((node) => {
|
|
57
|
-
// The name of the parameter is easy.
|
|
58
|
-
const name = parameterName(node.name);
|
|
59
|
-
const decorators = this.getDecoratorsOfDeclaration(node);
|
|
60
|
-
// It may or may not be possible to write an expression that refers to the value side of the
|
|
61
|
-
// type named for the parameter.
|
|
62
|
-
let originalTypeNode = node.type || null;
|
|
63
|
-
let typeNode = originalTypeNode;
|
|
64
|
-
// Check if we are dealing with a simple nullable union type e.g. `foo: Foo|null`
|
|
65
|
-
// and extract the type. More complex union types e.g. `foo: Foo|Bar` are not supported.
|
|
66
|
-
// We also don't need to support `foo: Foo|undefined` because Angular's DI injects `null` for
|
|
67
|
-
// optional tokes that don't have providers.
|
|
68
|
-
if (typeNode && typescript_1.default.isUnionTypeNode(typeNode)) {
|
|
69
|
-
let childTypeNodes = typeNode.types.filter((childTypeNode) => !(typescript_1.default.isLiteralTypeNode(childTypeNode) &&
|
|
70
|
-
childTypeNode.literal.kind === typescript_1.default.SyntaxKind.NullKeyword));
|
|
71
|
-
if (childTypeNodes.length === 1) {
|
|
72
|
-
typeNode = childTypeNodes[0];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const typeValueReference = (0, type_to_value_1.typeToValue)(typeNode, this.checker, this.isLocalCompilation);
|
|
76
|
-
return {
|
|
77
|
-
name,
|
|
78
|
-
nameNode: node.name,
|
|
79
|
-
typeValueReference,
|
|
80
|
-
typeNode: originalTypeNode,
|
|
81
|
-
decorators,
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
getImportOfIdentifier(id) {
|
|
86
|
-
const directImport = this.getDirectImportOfIdentifier(id);
|
|
87
|
-
if (directImport !== null) {
|
|
88
|
-
return directImport;
|
|
89
|
-
}
|
|
90
|
-
else if (typescript_1.default.isQualifiedName(id.parent) && id.parent.right === id) {
|
|
91
|
-
return this.getImportOfNamespacedIdentifier(id, getQualifiedNameRoot(id.parent));
|
|
92
|
-
}
|
|
93
|
-
else if (typescript_1.default.isPropertyAccessExpression(id.parent) &&
|
|
94
|
-
id.parent.name === id) {
|
|
95
|
-
return this.getImportOfNamespacedIdentifier(id, getFarLeftIdentifier(id.parent));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
isClass(node) {
|
|
102
|
-
// For our purposes, classes are "named" ts.ClassDeclarations;
|
|
103
|
-
// (`node.name` can be undefined in unnamed default exports: `default export class { ... }`).
|
|
104
|
-
return (0, util_1.isNamedClassDeclaration)(node);
|
|
105
|
-
}
|
|
106
|
-
hasBaseClass(clazz) {
|
|
107
|
-
return this.getBaseClassExpression(clazz) !== null;
|
|
108
|
-
}
|
|
109
|
-
getBaseClassExpression(clazz) {
|
|
110
|
-
if (!(typescript_1.default.isClassDeclaration(clazz) || typescript_1.default.isClassExpression(clazz)) ||
|
|
111
|
-
clazz.heritageClauses === undefined) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
const extendsClause = clazz.heritageClauses.find((clause) => clause.token === typescript_1.default.SyntaxKind.ExtendsKeyword);
|
|
115
|
-
if (extendsClause === undefined) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
const extendsType = extendsClause.types[0];
|
|
119
|
-
if (extendsType === undefined) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
return extendsType.expression;
|
|
123
|
-
}
|
|
124
|
-
getGenericArityOfClass(clazz) {
|
|
125
|
-
if (!typescript_1.default.isClassDeclaration(clazz)) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return clazz.typeParameters !== undefined ? clazz.typeParameters.length : 0;
|
|
129
|
-
}
|
|
130
|
-
getDirectImportOfIdentifier(id) {
|
|
131
|
-
const symbol = this.checker.getSymbolAtLocation(id);
|
|
132
|
-
if (symbol === undefined ||
|
|
133
|
-
symbol.declarations === undefined ||
|
|
134
|
-
symbol.declarations.length !== 1) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
const decl = symbol.declarations[0];
|
|
138
|
-
const importDecl = getContainingImportDeclaration(decl);
|
|
139
|
-
// Ignore declarations that are defined locally (not imported).
|
|
140
|
-
if (importDecl === null) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
// The module specifier is guaranteed to be a string literal, so this should always pass.
|
|
144
|
-
if (!typescript_1.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
145
|
-
// Not allowed to happen in TypeScript ASTs.
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
from: importDecl.moduleSpecifier.text,
|
|
150
|
-
name: getExportedName(decl, id),
|
|
151
|
-
node: importDecl,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Try to get the import info for this identifier as though it is a namespaced import.
|
|
156
|
-
*
|
|
157
|
-
* For example, if the identifier is the `Directive` part of a qualified type chain like:
|
|
158
|
-
*
|
|
159
|
-
* ```
|
|
160
|
-
* core.Directive
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
|
-
* then it might be that `core` is a namespace import such as:
|
|
164
|
-
*
|
|
165
|
-
* ```
|
|
166
|
-
* import * as core from 'tslib';
|
|
167
|
-
* ```
|
|
168
|
-
*
|
|
169
|
-
* @param id the TypeScript identifier to find the import info for.
|
|
170
|
-
* @returns The import info if this is a namespaced import or `null`.
|
|
171
|
-
*/
|
|
172
|
-
getImportOfNamespacedIdentifier(id, namespaceIdentifier) {
|
|
173
|
-
if (namespaceIdentifier === null) {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
const namespaceSymbol = this.checker.getSymbolAtLocation(namespaceIdentifier);
|
|
177
|
-
if (!namespaceSymbol || namespaceSymbol.declarations === undefined) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
const declaration = namespaceSymbol.declarations.length === 1
|
|
181
|
-
? namespaceSymbol.declarations[0]
|
|
182
|
-
: null;
|
|
183
|
-
if (!declaration) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
const namespaceDeclaration = typescript_1.default.isNamespaceImport(declaration)
|
|
187
|
-
? declaration
|
|
188
|
-
: null;
|
|
189
|
-
if (!namespaceDeclaration) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
const importDeclaration = namespaceDeclaration.parent.parent;
|
|
193
|
-
if (!typescript_1.default.isStringLiteral(importDeclaration.moduleSpecifier)) {
|
|
194
|
-
// Should not happen as this would be invalid TypesScript
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
return {
|
|
198
|
-
from: importDeclaration.moduleSpecifier.text,
|
|
199
|
-
name: id.text,
|
|
200
|
-
node: namespaceDeclaration.parent.parent,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
_reflectDecorator(node) {
|
|
204
|
-
// Attempt to resolve the decorator expression into a reference to a concrete Identifier. The
|
|
205
|
-
// expression may contain a call to a function which returns the decorator function, in which
|
|
206
|
-
// case we want to return the arguments.
|
|
207
|
-
let decoratorExpr = node.expression;
|
|
208
|
-
let args = null;
|
|
209
|
-
// Check for call expressions.
|
|
210
|
-
if (typescript_1.default.isCallExpression(decoratorExpr)) {
|
|
211
|
-
args = Array.from(decoratorExpr.arguments);
|
|
212
|
-
decoratorExpr = decoratorExpr.expression;
|
|
213
|
-
}
|
|
214
|
-
// The final resolved decorator should be a `ts.Identifier` - if it's not, then something is
|
|
215
|
-
// wrong and the decorator can't be resolved statically.
|
|
216
|
-
if (!(0, host_1.isDecoratorIdentifier)(decoratorExpr)) {
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
const decoratorIdentifier = typescript_1.default.isIdentifier(decoratorExpr)
|
|
220
|
-
? decoratorExpr
|
|
221
|
-
: decoratorExpr.name;
|
|
222
|
-
const importDecl = this.getImportOfIdentifier(decoratorIdentifier);
|
|
223
|
-
return {
|
|
224
|
-
name: decoratorIdentifier.text,
|
|
225
|
-
identifier: decoratorExpr,
|
|
226
|
-
import: importDecl,
|
|
227
|
-
node,
|
|
228
|
-
args,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
_reflectMember(node) {
|
|
232
|
-
let kind = null;
|
|
233
|
-
let value = null;
|
|
234
|
-
let name = null;
|
|
235
|
-
let nameNode = null;
|
|
236
|
-
if (typescript_1.default.isPropertyDeclaration(node)) {
|
|
237
|
-
kind = host_1.ClassMemberKind.Property;
|
|
238
|
-
value = node.initializer || null;
|
|
239
|
-
}
|
|
240
|
-
else if (typescript_1.default.isGetAccessorDeclaration(node)) {
|
|
241
|
-
kind = host_1.ClassMemberKind.Getter;
|
|
242
|
-
}
|
|
243
|
-
else if (typescript_1.default.isSetAccessorDeclaration(node)) {
|
|
244
|
-
kind = host_1.ClassMemberKind.Setter;
|
|
245
|
-
}
|
|
246
|
-
else if (typescript_1.default.isMethodDeclaration(node)) {
|
|
247
|
-
kind = host_1.ClassMemberKind.Method;
|
|
248
|
-
}
|
|
249
|
-
else if (typescript_1.default.isConstructorDeclaration(node)) {
|
|
250
|
-
kind = host_1.ClassMemberKind.Constructor;
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
if (typescript_1.default.isConstructorDeclaration(node)) {
|
|
256
|
-
name = 'constructor';
|
|
257
|
-
}
|
|
258
|
-
else if (typescript_1.default.isIdentifier(node.name)) {
|
|
259
|
-
name = node.name.text;
|
|
260
|
-
nameNode = node.name;
|
|
261
|
-
}
|
|
262
|
-
else if (typescript_1.default.isStringLiteral(node.name)) {
|
|
263
|
-
name = node.name.text;
|
|
264
|
-
nameNode = node.name;
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
const decorators = this.getDecoratorsOfDeclaration(node);
|
|
270
|
-
const modifiers = typescript_1.default.getModifiers(node);
|
|
271
|
-
const isStatic = modifiers !== undefined &&
|
|
272
|
-
modifiers.some((mod) => mod.kind === typescript_1.default.SyntaxKind.StaticKeyword);
|
|
273
|
-
return {
|
|
274
|
-
node,
|
|
275
|
-
implementation: node,
|
|
276
|
-
kind,
|
|
277
|
-
type: node.type || null,
|
|
278
|
-
name,
|
|
279
|
-
nameNode,
|
|
280
|
-
decorators,
|
|
281
|
-
value,
|
|
282
|
-
isStatic,
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
_viaModule(declaration, originalId, importInfo) {
|
|
286
|
-
if (importInfo === null &&
|
|
287
|
-
originalId !== null &&
|
|
288
|
-
declaration.getSourceFile() !== originalId.getSourceFile()) {
|
|
289
|
-
return host_1.AmbientImport;
|
|
290
|
-
}
|
|
291
|
-
return importInfo !== null &&
|
|
292
|
-
importInfo.from !== null &&
|
|
293
|
-
!importInfo.from.startsWith('.')
|
|
294
|
-
? importInfo.from
|
|
295
|
-
: null;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
exports.TypeScriptReflectionHost = TypeScriptReflectionHost;
|
|
299
|
-
function reflectObjectLiteral(node) {
|
|
300
|
-
const map = new Map();
|
|
301
|
-
node.properties.forEach((prop) => {
|
|
302
|
-
if (typescript_1.default.isPropertyAssignment(prop)) {
|
|
303
|
-
const name = propertyNameToString(prop.name);
|
|
304
|
-
if (name === null) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
map.set(name, prop.initializer);
|
|
308
|
-
}
|
|
309
|
-
else if (typescript_1.default.isShorthandPropertyAssignment(prop)) {
|
|
310
|
-
map.set(prop.name.text, prop.name);
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
return map;
|
|
317
|
-
}
|
|
318
|
-
exports.reflectObjectLiteral = reflectObjectLiteral;
|
|
319
|
-
function castDeclarationToClassOrDie(declaration) {
|
|
320
|
-
if (!typescript_1.default.isClassDeclaration(declaration)) {
|
|
321
|
-
throw new Error(`Reflecting on a ${typescript_1.default.SyntaxKind[declaration.kind]} instead of a ClassDeclaration.`);
|
|
322
|
-
}
|
|
323
|
-
return declaration;
|
|
324
|
-
}
|
|
325
|
-
function parameterName(name) {
|
|
326
|
-
if (typescript_1.default.isIdentifier(name)) {
|
|
327
|
-
return name.text;
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
function propertyNameToString(node) {
|
|
334
|
-
if (typescript_1.default.isIdentifier(node) ||
|
|
335
|
-
typescript_1.default.isStringLiteral(node) ||
|
|
336
|
-
typescript_1.default.isNumericLiteral(node)) {
|
|
337
|
-
return node.text;
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
return null;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Compute the left most identifier in a qualified type chain. E.g. the `a` of `a.b.c.SomeType`.
|
|
345
|
-
* @param qualifiedName The starting property access expression from which we want to compute
|
|
346
|
-
* the left most identifier.
|
|
347
|
-
* @returns the left most identifier in the chain or `null` if it is not an identifier.
|
|
348
|
-
*/
|
|
349
|
-
function getQualifiedNameRoot(qualifiedName) {
|
|
350
|
-
while (typescript_1.default.isQualifiedName(qualifiedName.left)) {
|
|
351
|
-
qualifiedName = qualifiedName.left;
|
|
352
|
-
}
|
|
353
|
-
return typescript_1.default.isIdentifier(qualifiedName.left) ? qualifiedName.left : null;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Compute the left most identifier in a property access chain. E.g. the `a` of `a.b.c.d`.
|
|
357
|
-
* @param propertyAccess The starting property access expression from which we want to compute
|
|
358
|
-
* the left most identifier.
|
|
359
|
-
* @returns the left most identifier in the chain or `null` if it is not an identifier.
|
|
360
|
-
*/
|
|
361
|
-
function getFarLeftIdentifier(propertyAccess) {
|
|
362
|
-
while (typescript_1.default.isPropertyAccessExpression(propertyAccess.expression)) {
|
|
363
|
-
propertyAccess = propertyAccess.expression;
|
|
364
|
-
}
|
|
365
|
-
return typescript_1.default.isIdentifier(propertyAccess.expression)
|
|
366
|
-
? propertyAccess.expression
|
|
367
|
-
: null;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Gets the closest ancestor `ImportDeclaration` to a node.
|
|
371
|
-
*/
|
|
372
|
-
function getContainingImportDeclaration(node) {
|
|
373
|
-
let parent = node.parent;
|
|
374
|
-
while (parent && !typescript_1.default.isSourceFile(parent)) {
|
|
375
|
-
if (typescript_1.default.isImportDeclaration(parent)) {
|
|
376
|
-
return parent;
|
|
377
|
-
}
|
|
378
|
-
parent = parent.parent;
|
|
379
|
-
}
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
exports.getContainingImportDeclaration = getContainingImportDeclaration;
|
|
383
|
-
/**
|
|
384
|
-
* Compute the name by which the `decl` was exported, not imported.
|
|
385
|
-
* If no such declaration can be found (e.g. it is a namespace import)
|
|
386
|
-
* then fallback to the `originalId`.
|
|
387
|
-
*/
|
|
388
|
-
function getExportedName(decl, originalId) {
|
|
389
|
-
return typescript_1.default.isImportSpecifier(decl)
|
|
390
|
-
? (decl.propertyName !== undefined ? decl.propertyName : decl.name).text
|
|
391
|
-
: originalId.text;
|
|
392
|
-
}
|
|
393
|
-
const LocalExportedDeclarations = Symbol('LocalExportedDeclarations');
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
import ts from 'typescript';
|
|
9
|
-
import { ClassDeclaration } from './host';
|
|
10
|
-
export declare function isNamedClassDeclaration(node: ts.Node): node is ClassDeclaration<ts.ClassDeclaration>;
|
|
11
|
-
export declare function isNamedFunctionDeclaration(node: ts.Node): node is ClassDeclaration<ts.FunctionDeclaration>;
|
|
12
|
-
export declare function isNamedVariableDeclaration(node: ts.Node): node is ClassDeclaration<ts.VariableDeclaration>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.isNamedVariableDeclaration = exports.isNamedFunctionDeclaration = exports.isNamedClassDeclaration = void 0;
|
|
14
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
15
|
-
function isNamedClassDeclaration(node) {
|
|
16
|
-
return typescript_1.default.isClassDeclaration(node) && isIdentifier(node.name);
|
|
17
|
-
}
|
|
18
|
-
exports.isNamedClassDeclaration = isNamedClassDeclaration;
|
|
19
|
-
function isNamedFunctionDeclaration(node) {
|
|
20
|
-
return typescript_1.default.isFunctionDeclaration(node) && isIdentifier(node.name);
|
|
21
|
-
}
|
|
22
|
-
exports.isNamedFunctionDeclaration = isNamedFunctionDeclaration;
|
|
23
|
-
function isNamedVariableDeclaration(node) {
|
|
24
|
-
return typescript_1.default.isVariableDeclaration(node) && isIdentifier(node.name);
|
|
25
|
-
}
|
|
26
|
-
exports.isNamedVariableDeclaration = isNamedVariableDeclaration;
|
|
27
|
-
function isIdentifier(node) {
|
|
28
|
-
return node !== undefined && typescript_1.default.isIdentifier(node);
|
|
29
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./src/api"), exports);
|
|
18
|
-
__exportStar(require("./src/utils"), exports);
|
|
@@ -1,115 +0,0 @@
|
|
|
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
|
-
import { Expression, Statement, Type } from 'static-injector/transform/compiler';
|
|
9
|
-
import ts from 'typescript';
|
|
10
|
-
import { ClassDeclaration, Decorator } from '../../reflection';
|
|
11
|
-
/**
|
|
12
|
-
* Specifies the compilation mode that is used for the compilation.
|
|
13
|
-
*/
|
|
14
|
-
export declare enum CompilationMode {
|
|
15
|
-
/**
|
|
16
|
-
* Generates fully AOT compiled code using Ivy instructions.
|
|
17
|
-
*/
|
|
18
|
-
FULL = 0,
|
|
19
|
-
/**
|
|
20
|
-
* Generates code using a stable, but intermediate format suitable to be published to NPM.
|
|
21
|
-
*/
|
|
22
|
-
PARTIAL = 1,
|
|
23
|
-
/**
|
|
24
|
-
* Generates code based on each individual source file without using its
|
|
25
|
-
* dependencies (suitable for local dev edit/refresh workflow).
|
|
26
|
-
*/
|
|
27
|
-
LOCAL = 2
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Provides the interface between a decorator compiler from @angular/compiler and the Typescript
|
|
31
|
-
* compiler/transform.
|
|
32
|
-
*
|
|
33
|
-
* The decorator compilers in @angular/compiler do not depend on Typescript. The handler is
|
|
34
|
-
* responsible for extracting the information required to perform compilation from the decorators
|
|
35
|
-
* and Typescript source, invoking the decorator compiler, and returning the result.
|
|
36
|
-
*
|
|
37
|
-
* @param `D` The type of decorator metadata produced by `detect`.
|
|
38
|
-
* @param `A` The type of analysis metadata produced by `analyze`.
|
|
39
|
-
* @param `R` The type of resolution metadata produced by `resolve`.
|
|
40
|
-
*/
|
|
41
|
-
export interface DecoratorHandler<D, A, R> {
|
|
42
|
-
/**
|
|
43
|
-
* Scan a set of reflected decorators and determine if this handler is responsible for compilation
|
|
44
|
-
* of one of them.
|
|
45
|
-
*/
|
|
46
|
-
detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<D> | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Asynchronously perform pre-analysis on the decorator/class combination.
|
|
49
|
-
*
|
|
50
|
-
* `preanalyze` is optional and is not guaranteed to be called through all compilation flows. It
|
|
51
|
-
* will only be called if asynchronicity is supported in the CompilerHost.
|
|
52
|
-
*/
|
|
53
|
-
preanalyze?(node: ClassDeclaration, metadata: Readonly<D>): Promise<void> | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Perform analysis on the decorator/class combination, extracting information from the class
|
|
56
|
-
* required for compilation.
|
|
57
|
-
*
|
|
58
|
-
* Returns analyzed metadata if successful, or an array of diagnostic messages if the analysis
|
|
59
|
-
* fails or the decorator isn't valid.
|
|
60
|
-
*
|
|
61
|
-
* Analysis should always be a "pure" operation, with no side effects. This is because the
|
|
62
|
-
* detect/analysis steps might be skipped for files which have not changed during incremental
|
|
63
|
-
* builds. Any side effects required for compilation (e.g. registration of metadata) should happen
|
|
64
|
-
* in the `register` phase, which is guaranteed to run even for incremental builds.
|
|
65
|
-
*/
|
|
66
|
-
analyze(node: ClassDeclaration, metadata: Readonly<D>): AnalysisOutput<A>;
|
|
67
|
-
/**
|
|
68
|
-
* Generate a description of the field which should be added to the class, including any
|
|
69
|
-
* initialization code to be generated.
|
|
70
|
-
*
|
|
71
|
-
* If the compilation mode is configured as other than full but an implementation of the
|
|
72
|
-
* corresponding method is not provided, then this method is called as a fallback.
|
|
73
|
-
*/
|
|
74
|
-
compileFull(node: ClassDeclaration, analysis: Readonly<A>): CompileResult | CompileResult[];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* The output of detecting a trait for a declaration as the result of the first phase of the
|
|
78
|
-
* compilation pipeline.
|
|
79
|
-
*/
|
|
80
|
-
export interface DetectResult<M> {
|
|
81
|
-
/**
|
|
82
|
-
* The node that triggered the match, which is typically a decorator.
|
|
83
|
-
*/
|
|
84
|
-
trigger: ts.Node | null;
|
|
85
|
-
/**
|
|
86
|
-
* Refers to the decorator that was recognized for this detection, if any. This can be a concrete
|
|
87
|
-
* decorator that is actually present in a file, or a synthetic decorator as inserted
|
|
88
|
-
* programmatically.
|
|
89
|
-
*/
|
|
90
|
-
decorator: Decorator | null;
|
|
91
|
-
/**
|
|
92
|
-
* An arbitrary object to carry over from the detection phase into the analysis phase.
|
|
93
|
-
*/
|
|
94
|
-
metadata: Readonly<M>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* The output of an analysis operation, consisting of possibly an arbitrary analysis object (used as
|
|
98
|
-
* the input to code generation) and potentially diagnostics if there were errors uncovered during
|
|
99
|
-
* analysis.
|
|
100
|
-
*/
|
|
101
|
-
export interface AnalysisOutput<A> {
|
|
102
|
-
analysis?: Readonly<A>;
|
|
103
|
-
diagnostics?: ts.Diagnostic[];
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* A description of the static field to add to a class, including an initialization expression
|
|
107
|
-
* and a type for the .d.ts file.
|
|
108
|
-
*/
|
|
109
|
-
export interface CompileResult {
|
|
110
|
-
name: string;
|
|
111
|
-
initializer: Expression | null;
|
|
112
|
-
statements: Statement[];
|
|
113
|
-
type: Type;
|
|
114
|
-
deferrableImports: Set<ts.ImportDeclaration> | null;
|
|
115
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.CompilationMode = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Specifies the compilation mode that is used for the compilation.
|
|
13
|
-
*/
|
|
14
|
-
var CompilationMode;
|
|
15
|
-
(function (CompilationMode) {
|
|
16
|
-
/**
|
|
17
|
-
* Generates fully AOT compiled code using Ivy instructions.
|
|
18
|
-
*/
|
|
19
|
-
CompilationMode[CompilationMode["FULL"] = 0] = "FULL";
|
|
20
|
-
/**
|
|
21
|
-
* Generates code using a stable, but intermediate format suitable to be published to NPM.
|
|
22
|
-
*/
|
|
23
|
-
CompilationMode[CompilationMode["PARTIAL"] = 1] = "PARTIAL";
|
|
24
|
-
/**
|
|
25
|
-
* Generates code based on each individual source file without using its
|
|
26
|
-
* dependencies (suitable for local dev edit/refresh workflow).
|
|
27
|
-
*/
|
|
28
|
-
CompilationMode[CompilationMode["LOCAL"] = 2] = "LOCAL";
|
|
29
|
-
})(CompilationMode || (exports.CompilationMode = CompilationMode = {}));
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
import ts from 'typescript';
|
|
9
|
-
import { ImportManager } from '../../translator';
|
|
10
|
-
/**
|
|
11
|
-
* Adds extra imports in the import manage for this source file, after the existing imports
|
|
12
|
-
* and before the module body.
|
|
13
|
-
* Can optionally add extra statements (e.g. new constants) before the body as well.
|
|
14
|
-
*/
|
|
15
|
-
export declare function addImports(factory: ts.NodeFactory | undefined, importManager: ImportManager, sf: ts.SourceFile, extraStatements?: ts.Statement[]): ts.SourceFile;
|