static-injector 1.0.8
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/index.js +1248 -0
- package/import/es2015/decorator/injectable.js +14 -0
- package/import/es2015/decorator/interface/provider.js +8 -0
- package/import/es2015/di/forward_ref.js +53 -0
- package/import/es2015/di/inject_switch.js +31 -0
- package/import/es2015/di/injection_token.js +71 -0
- package/import/es2015/di/injector.js +63 -0
- package/import/es2015/di/injector_compatibility.js +172 -0
- package/import/es2015/di/injector_marker.js +8 -0
- package/import/es2015/di/injector_token.js +21 -0
- package/import/es2015/di/interface/defs.js +72 -0
- package/import/es2015/di/interface/injector.js +25 -0
- package/import/es2015/di/interface/provider.js +8 -0
- package/import/es2015/di/metadata.js +49 -0
- package/import/es2015/di/null_injector.js +19 -0
- package/import/es2015/di/provider_token.js +8 -0
- package/import/es2015/di/r3_injector.js +382 -0
- package/import/es2015/di/scope.js +14 -0
- package/import/es2015/index.js +11 -0
- package/import/es2015/interface/lifecycle_hooks.js +8 -0
- package/import/es2015/interface/type.js +8 -0
- package/import/es2015/render3/definition_factory.js +15 -0
- package/import/es2015/render3/error_code.js +29 -0
- package/import/es2015/render3/errors_di.js +14 -0
- package/import/es2015/render3/fields.js +11 -0
- package/import/es2015/render3/instructions/di.js +23 -0
- package/import/es2015/render3/util/stringify_utils.js +37 -0
- package/import/es2015/util/array_utils.js +17 -0
- package/import/es2015/util/closure.js +19 -0
- package/import/es2015/util/decorators.js +30 -0
- package/import/es2015/util/empty.js +14 -0
- package/import/es2015/util/property.js +15 -0
- package/import/es2015/util/stringify.js +30 -0
- package/import/fesm2015/index.js +1211 -0
- package/import/typings/decorator/injectable.d.ts +82 -0
- package/import/typings/decorator/interface/provider.d.ts +312 -0
- package/import/typings/di/forward_ref.d.ts +49 -0
- package/import/typings/di/inject_switch.d.ts +17 -0
- package/import/typings/di/injection_token.d.ts +57 -0
- package/import/typings/di/injector.d.ts +76 -0
- package/import/typings/di/injector_compatibility.d.ts +77 -0
- package/import/typings/di/injector_marker.d.ts +23 -0
- package/import/typings/di/injector_token.d.ts +18 -0
- package/import/typings/di/interface/defs.d.ts +155 -0
- package/import/typings/di/interface/injector.d.ts +48 -0
- package/import/typings/di/interface/provider.d.ts +312 -0
- package/import/typings/di/metadata.d.ts +176 -0
- package/import/typings/di/null_injector.d.ts +11 -0
- package/import/typings/di/provider_token.d.ts +17 -0
- package/import/typings/di/r3_injector.d.ts +92 -0
- package/import/typings/di/scope.d.ts +14 -0
- package/import/typings/index.d.ts +11 -0
- package/import/typings/interface/lifecycle_hooks.d.ts +28 -0
- package/import/typings/interface/type.d.ts +21 -0
- package/import/typings/render3/definition_factory.d.ts +24 -0
- package/import/typings/render3/error_code.d.ts +24 -0
- package/import/typings/render3/errors_di.d.ts +2 -0
- package/import/typings/render3/fields.d.ts +8 -0
- package/import/typings/render3/instructions/di.d.ts +20 -0
- package/import/typings/render3/util/stringify_utils.d.ts +20 -0
- package/import/typings/util/array_utils.d.ts +10 -0
- package/import/typings/util/closure.d.ts +17 -0
- package/import/typings/util/decorators.d.ts +27 -0
- package/import/typings/util/empty.d.ts +14 -0
- package/import/typings/util/property.d.ts +8 -0
- package/import/typings/util/stringify.d.ts +8 -0
- package/package.json +34 -0
- package/readme.md +27 -0
- package/transform/compiler/index.d.ts +5 -0
- package/transform/compiler/index.js +17 -0
- package/transform/compiler/src/core.d.ts +19 -0
- package/transform/compiler/src/core.js +9 -0
- package/transform/compiler/src/injectable_compiler_2.d.ts +53 -0
- package/transform/compiler/src/injectable_compiler_2.js +159 -0
- package/transform/compiler/src/output/output_ast.d.ts +534 -0
- package/transform/compiler/src/output/output_ast.js +986 -0
- package/transform/compiler/src/parse_util.d.ts +50 -0
- package/transform/compiler/src/parse_util.js +61 -0
- package/transform/compiler/src/render3/partial/api.d.ts +166 -0
- package/transform/compiler/src/render3/partial/api.js +11 -0
- package/transform/compiler/src/render3/partial/util.d.ts +16 -0
- package/transform/compiler/src/render3/partial/util.js +44 -0
- package/transform/compiler/src/render3/r3_factory.d.ts +97 -0
- package/transform/compiler/src/render3/r3_factory.js +239 -0
- package/transform/compiler/src/render3/r3_identifiers.d.ts +20 -0
- package/transform/compiler/src/render3/r3_identifiers.js +51 -0
- package/transform/compiler/src/render3/util.d.ts +21 -0
- package/transform/compiler/src/render3/util.js +41 -0
- package/transform/compiler/src/render3/view/util.d.ts +30 -0
- package/transform/compiler/src/render3/view/util.js +57 -0
- package/transform/compiler-cli/src/ngtsc/annotations/src/factory.d.ts +11 -0
- package/transform/compiler-cli/src/ngtsc/annotations/src/factory.js +21 -0
- package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.d.ts +42 -0
- package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +278 -0
- package/transform/compiler-cli/src/ngtsc/annotations/src/util.d.ts +91 -0
- package/transform/compiler-cli/src/ngtsc/annotations/src/util.js +370 -0
- package/transform/compiler-cli/src/ngtsc/diagnostics/error.d.ts +24 -0
- package/transform/compiler-cli/src/ngtsc/diagnostics/error.js +76 -0
- package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.d.ts +188 -0
- package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.js +206 -0
- package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +2 -0
- package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +14 -0
- package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +1 -0
- package/transform/compiler-cli/src/ngtsc/imports/index.js +13 -0
- package/transform/compiler-cli/src/ngtsc/imports/src/core.d.ts +36 -0
- package/transform/compiler-cli/src/ngtsc/imports/src/core.js +25 -0
- package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +3 -0
- package/transform/compiler-cli/src/ngtsc/reflection/index.js +15 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +667 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +98 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +24 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +271 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +50 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +396 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/util.d.ts +12 -0
- package/transform/compiler-cli/src/ngtsc/reflection/src/util.js +45 -0
- package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +2 -0
- package/transform/compiler-cli/src/ngtsc/transform/index.js +14 -0
- package/transform/compiler-cli/src/ngtsc/transform/src/api.d.ts +115 -0
- package/transform/compiler-cli/src/ngtsc/transform/src/api.js +30 -0
- package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +15 -0
- package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +84 -0
- package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +5 -0
- package/transform/compiler-cli/src/ngtsc/translator/index.js +17 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +274 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.js +9 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.d.ts +27 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.js +9 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/context.d.ts +18 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/context.js +27 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +29 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +70 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/translator.d.ts +58 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +270 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts +54 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +245 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.d.ts +13 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.js +21 -0
- package/transform/compiler-cli/src/ngtsc/util/src/typescript.d.ts +11 -0
- package/transform/compiler-cli/src/ngtsc/util/src/typescript.js +39 -0
- package/transform/index.d.ts +1 -0
- package/transform/index.js +13 -0
- package/transform/injectable-transform.d.ts +41 -0
- package/transform/injectable-transform.js +195 -0
- package/transform/node-Iteration.d.ts +2 -0
- package/transform/node-Iteration.js +12 -0
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
export declare class ParseLocation {
|
|
9
|
+
file: ParseSourceFile;
|
|
10
|
+
offset: number;
|
|
11
|
+
line: number;
|
|
12
|
+
col: number;
|
|
13
|
+
constructor(file: ParseSourceFile, offset: number, line: number, col: number);
|
|
14
|
+
}
|
|
15
|
+
export declare class ParseSourceFile {
|
|
16
|
+
content: string;
|
|
17
|
+
url: string;
|
|
18
|
+
constructor(content: string, url: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class ParseSourceSpan {
|
|
21
|
+
start: ParseLocation;
|
|
22
|
+
end: ParseLocation;
|
|
23
|
+
fullStart: ParseLocation;
|
|
24
|
+
details: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Create an object that holds information about spans of tokens/nodes captured during
|
|
27
|
+
* lexing/parsing of text.
|
|
28
|
+
*
|
|
29
|
+
* @param start
|
|
30
|
+
* The location of the start of the span (having skipped leading trivia).
|
|
31
|
+
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
|
|
32
|
+
* elements will appear to begin at the start of the opening tag, rather than at the start of any
|
|
33
|
+
* leading trivia, which could include newlines.
|
|
34
|
+
*
|
|
35
|
+
* @param end
|
|
36
|
+
* The location of the end of the span.
|
|
37
|
+
*
|
|
38
|
+
* @param fullStart
|
|
39
|
+
* The start of the token without skipping the leading trivia.
|
|
40
|
+
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
|
|
41
|
+
* from text tokens. Such tooling creates new source-spans relative to the original token's
|
|
42
|
+
* source-span. If leading trivia characters have been skipped then the new source-spans may be
|
|
43
|
+
* incorrectly offset.
|
|
44
|
+
*
|
|
45
|
+
* @param details
|
|
46
|
+
* Additional information (such as identifier names) that should be associated with the span.
|
|
47
|
+
*/
|
|
48
|
+
constructor(start: ParseLocation, end: ParseLocation, fullStart?: ParseLocation, details?: string | null);
|
|
49
|
+
toString(): string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.ParseSourceSpan = exports.ParseSourceFile = exports.ParseLocation = void 0;
|
|
11
|
+
class ParseLocation {
|
|
12
|
+
constructor(file, offset, line, col) {
|
|
13
|
+
this.file = file;
|
|
14
|
+
this.offset = offset;
|
|
15
|
+
this.line = line;
|
|
16
|
+
this.col = col;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ParseLocation = ParseLocation;
|
|
20
|
+
class ParseSourceFile {
|
|
21
|
+
constructor(content, url) {
|
|
22
|
+
this.content = content;
|
|
23
|
+
this.url = url;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ParseSourceFile = ParseSourceFile;
|
|
27
|
+
class ParseSourceSpan {
|
|
28
|
+
/**
|
|
29
|
+
* Create an object that holds information about spans of tokens/nodes captured during
|
|
30
|
+
* lexing/parsing of text.
|
|
31
|
+
*
|
|
32
|
+
* @param start
|
|
33
|
+
* The location of the start of the span (having skipped leading trivia).
|
|
34
|
+
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
|
|
35
|
+
* elements will appear to begin at the start of the opening tag, rather than at the start of any
|
|
36
|
+
* leading trivia, which could include newlines.
|
|
37
|
+
*
|
|
38
|
+
* @param end
|
|
39
|
+
* The location of the end of the span.
|
|
40
|
+
*
|
|
41
|
+
* @param fullStart
|
|
42
|
+
* The start of the token without skipping the leading trivia.
|
|
43
|
+
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
|
|
44
|
+
* from text tokens. Such tooling creates new source-spans relative to the original token's
|
|
45
|
+
* source-span. If leading trivia characters have been skipped then the new source-spans may be
|
|
46
|
+
* incorrectly offset.
|
|
47
|
+
*
|
|
48
|
+
* @param details
|
|
49
|
+
* Additional information (such as identifier names) that should be associated with the span.
|
|
50
|
+
*/
|
|
51
|
+
constructor(start, end, fullStart = start, details = null) {
|
|
52
|
+
this.start = start;
|
|
53
|
+
this.end = end;
|
|
54
|
+
this.fullStart = fullStart;
|
|
55
|
+
this.details = details;
|
|
56
|
+
}
|
|
57
|
+
toString() {
|
|
58
|
+
return this.start.file.content.substring(this.start.offset, this.end.offset);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ParseSourceSpan = ParseSourceSpan;
|
|
@@ -0,0 +1,166 @@
|
|
|
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 * as o from '../../output/output_ast';
|
|
9
|
+
export interface R3PartialDeclaration {
|
|
10
|
+
/**
|
|
11
|
+
* The minimum version of the compiler that can process this partial declaration.
|
|
12
|
+
*/
|
|
13
|
+
minVersion: string;
|
|
14
|
+
/**
|
|
15
|
+
* Version number of the Angular compiler that was used to compile this declaration. The linker
|
|
16
|
+
* will be able to detect which version a library is using and interpret its metadata accordingly.
|
|
17
|
+
*/
|
|
18
|
+
version: string;
|
|
19
|
+
/**
|
|
20
|
+
* A reference to the `static-injector` ES module, which allows access
|
|
21
|
+
* to all Angular exports, including Ivy instructions.
|
|
22
|
+
*/
|
|
23
|
+
ngImport: o.Expression;
|
|
24
|
+
/**
|
|
25
|
+
* Reference to the decorated class, which is subject to this partial declaration.
|
|
26
|
+
*/
|
|
27
|
+
type: o.Expression;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Describes the shape of the objects that the `ɵɵngDeclareInjector()` accepts.
|
|
31
|
+
*/
|
|
32
|
+
export interface R3DeclareInjectorMetadata extends R3PartialDeclaration {
|
|
33
|
+
/**
|
|
34
|
+
* The list of providers provided by the injector.
|
|
35
|
+
*/
|
|
36
|
+
providers?: o.Expression;
|
|
37
|
+
/**
|
|
38
|
+
* The list of imports into the injector.
|
|
39
|
+
*/
|
|
40
|
+
imports?: o.Expression[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Describes the shape of the object that the `ɵɵngDeclareFactory()` function accepts.
|
|
44
|
+
*
|
|
45
|
+
* This interface serves primarily as documentation, as conformance to this interface is not
|
|
46
|
+
* enforced during linking.
|
|
47
|
+
*/
|
|
48
|
+
export interface R3DeclareFactoryMetadata extends R3PartialDeclaration {
|
|
49
|
+
/**
|
|
50
|
+
* A collection of dependencies that this factory relies upon.
|
|
51
|
+
*
|
|
52
|
+
* If this is `null`, then the type's constructor is nonexistent and will be inherited from an
|
|
53
|
+
* ancestor of the type.
|
|
54
|
+
*
|
|
55
|
+
* If this is `'invalid'`, then one or more of the parameters wasn't resolvable and any attempt to
|
|
56
|
+
* use these deps will result in a runtime error.
|
|
57
|
+
*/
|
|
58
|
+
deps: R3DeclareDependencyMetadata[] | 'invalid' | null;
|
|
59
|
+
/**
|
|
60
|
+
* Type of the target being created by the factory.
|
|
61
|
+
*/
|
|
62
|
+
target: FactoryTarget;
|
|
63
|
+
}
|
|
64
|
+
export declare enum FactoryTarget {
|
|
65
|
+
Directive = 0,
|
|
66
|
+
Component = 1,
|
|
67
|
+
Injectable = 2,
|
|
68
|
+
Pipe = 3,
|
|
69
|
+
NgModule = 4
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Describes the shape of the object that the `ɵɵngDeclareInjectable()` function accepts.
|
|
73
|
+
*
|
|
74
|
+
* This interface serves primarily as documentation, as conformance to this interface is not
|
|
75
|
+
* enforced during linking.
|
|
76
|
+
*/
|
|
77
|
+
export interface R3DeclareInjectableMetadata extends R3PartialDeclaration {
|
|
78
|
+
/**
|
|
79
|
+
* If provided, specifies that the declared injectable belongs to a particular injector:
|
|
80
|
+
* - `InjectorType` such as `NgModule`,
|
|
81
|
+
* - `'root'` the root injector
|
|
82
|
+
* - `'any'` all injectors.
|
|
83
|
+
* If not provided, then it does not belong to any injector. Must be explicitly listed in the
|
|
84
|
+
* providers of an injector.
|
|
85
|
+
*/
|
|
86
|
+
providedIn?: o.Expression;
|
|
87
|
+
/**
|
|
88
|
+
* If provided, an expression that evaluates to a class to use when creating an instance of this
|
|
89
|
+
* injectable.
|
|
90
|
+
*/
|
|
91
|
+
useClass?: o.Expression;
|
|
92
|
+
/**
|
|
93
|
+
* If provided, an expression that evaluates to a function to use when creating an instance of
|
|
94
|
+
* this injectable.
|
|
95
|
+
*/
|
|
96
|
+
useFactory?: o.Expression;
|
|
97
|
+
/**
|
|
98
|
+
* If provided, an expression that evaluates to a token of another injectable that this injectable
|
|
99
|
+
* aliases.
|
|
100
|
+
*/
|
|
101
|
+
useExisting?: o.Expression;
|
|
102
|
+
/**
|
|
103
|
+
* If provided, an expression that evaluates to the value of the instance of this injectable.
|
|
104
|
+
*/
|
|
105
|
+
useValue?: o.Expression;
|
|
106
|
+
/**
|
|
107
|
+
* An array of dependencies to support instantiating this injectable via `useClass` or
|
|
108
|
+
* `useFactory`.
|
|
109
|
+
*/
|
|
110
|
+
deps?: R3DeclareDependencyMetadata[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Metadata indicating how a dependency should be injected into a factory.
|
|
114
|
+
*/
|
|
115
|
+
export interface R3DeclareDependencyMetadata {
|
|
116
|
+
/**
|
|
117
|
+
* An expression representing the token or value to be injected, or `null` if the dependency is
|
|
118
|
+
* not valid.
|
|
119
|
+
*
|
|
120
|
+
* If this dependency is due to the `@Attribute()` decorator, then this is an expression
|
|
121
|
+
* evaluating to the name of the attribute.
|
|
122
|
+
*/
|
|
123
|
+
token: o.Expression | null;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the dependency is injecting an attribute value.
|
|
126
|
+
* Default: false.
|
|
127
|
+
*/
|
|
128
|
+
attribute?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the dependency has an @Optional qualifier.
|
|
131
|
+
* Default: false,
|
|
132
|
+
*/
|
|
133
|
+
optional?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the dependency has an @Self qualifier.
|
|
136
|
+
* Default: false,
|
|
137
|
+
*/
|
|
138
|
+
self?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether the dependency has an @SkipSelf qualifier.
|
|
141
|
+
* Default: false,
|
|
142
|
+
*/
|
|
143
|
+
skipSelf?: boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Describes the shape of the object that the `ɵɵngDeclareClassMetadata()` function accepts.
|
|
147
|
+
*
|
|
148
|
+
* This interface serves primarily as documentation, as conformance to this interface is not
|
|
149
|
+
* enforced during linking.
|
|
150
|
+
*/
|
|
151
|
+
export interface R3DeclareClassMetadata extends R3PartialDeclaration {
|
|
152
|
+
/**
|
|
153
|
+
* The Angular decorators of the class.
|
|
154
|
+
*/
|
|
155
|
+
decorators: o.Expression;
|
|
156
|
+
/**
|
|
157
|
+
* Optionally specifies the constructor parameters, their types and the Angular decorators of each
|
|
158
|
+
* parameter. This property is omitted if the class does not have a constructor.
|
|
159
|
+
*/
|
|
160
|
+
ctorParameters?: o.Expression;
|
|
161
|
+
/**
|
|
162
|
+
* Optionally specifies the Angular decorators applied to the class properties. This property is
|
|
163
|
+
* omitted if no properties have any decorators.
|
|
164
|
+
*/
|
|
165
|
+
propDecorators?: o.Expression;
|
|
166
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FactoryTarget = void 0;
|
|
4
|
+
var FactoryTarget;
|
|
5
|
+
(function (FactoryTarget) {
|
|
6
|
+
FactoryTarget[FactoryTarget["Directive"] = 0] = "Directive";
|
|
7
|
+
FactoryTarget[FactoryTarget["Component"] = 1] = "Component";
|
|
8
|
+
FactoryTarget[FactoryTarget["Injectable"] = 2] = "Injectable";
|
|
9
|
+
FactoryTarget[FactoryTarget["Pipe"] = 3] = "Pipe";
|
|
10
|
+
FactoryTarget[FactoryTarget["NgModule"] = 4] = "NgModule";
|
|
11
|
+
})(FactoryTarget = exports.FactoryTarget || (exports.FactoryTarget = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
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 * as o from "../../output/output_ast";
|
|
9
|
+
/**
|
|
10
|
+
* Generate an expression that has the given `expr` wrapped in the following form:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* forwardRef(() => expr)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateForwardRef(expr: o.Expression): o.Expression;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.generateForwardRef = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright Google LLC All Rights Reserved.
|
|
26
|
+
*
|
|
27
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
28
|
+
* found in the LICENSE file at https://angular.io/license
|
|
29
|
+
*/
|
|
30
|
+
const o = __importStar(require("../../output/output_ast"));
|
|
31
|
+
const r3_identifiers_1 = require("../r3_identifiers");
|
|
32
|
+
/**
|
|
33
|
+
* Generate an expression that has the given `expr` wrapped in the following form:
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* forwardRef(() => expr)
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function generateForwardRef(expr) {
|
|
40
|
+
return o
|
|
41
|
+
.importExpr(r3_identifiers_1.Identifiers.forwardRef)
|
|
42
|
+
.callFn([o.fn([], [new o.ReturnStatement(expr)])]);
|
|
43
|
+
}
|
|
44
|
+
exports.generateForwardRef = generateForwardRef;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 * as outputAst from '../output/output_ast';
|
|
9
|
+
import { R3CompiledExpression, R3Reference } from './util';
|
|
10
|
+
/**
|
|
11
|
+
* Metadata required by the factory generator to generate a `factory` function for a type.
|
|
12
|
+
*/
|
|
13
|
+
export interface R3ConstructorFactoryMetadata {
|
|
14
|
+
/**
|
|
15
|
+
* String name of the type being generated (used to name the factory function).
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* An expression representing the interface type being constructed.
|
|
20
|
+
*/
|
|
21
|
+
type: R3Reference;
|
|
22
|
+
/**
|
|
23
|
+
* An expression representing the constructor type, intended for use within a class definition
|
|
24
|
+
* itself.
|
|
25
|
+
*
|
|
26
|
+
* This can differ from the outer `type` if the class is being compiled by ngcc and is inside
|
|
27
|
+
* an IIFE structure that uses a different name internally.
|
|
28
|
+
*/
|
|
29
|
+
internalType: outputAst.Expression;
|
|
30
|
+
/** Number of arguments for the `type`. */
|
|
31
|
+
typeArgumentCount: number;
|
|
32
|
+
/**
|
|
33
|
+
* Regardless of whether `fnOrClass` is a constructor function or a user-defined factory, it
|
|
34
|
+
* may have 0 or more parameters, which will be injected according to the `R3DependencyMetadata`
|
|
35
|
+
* for those parameters. If this is `null`, then the type's constructor is nonexistent and will
|
|
36
|
+
* be inherited from `fnOrClass` which is interpreted as the current type. If this is `'invalid'`,
|
|
37
|
+
* then one or more of the parameters wasn't resolvable and any attempt to use these deps will
|
|
38
|
+
* result in a runtime error.
|
|
39
|
+
*/
|
|
40
|
+
deps: R3DependencyMetadata[] | 'invalid' | null;
|
|
41
|
+
/**
|
|
42
|
+
* Type of the target being created by the factory.
|
|
43
|
+
*/
|
|
44
|
+
target: FactoryTarget;
|
|
45
|
+
}
|
|
46
|
+
export declare enum R3FactoryDelegateType {
|
|
47
|
+
Class = 0,
|
|
48
|
+
Function = 1
|
|
49
|
+
}
|
|
50
|
+
export interface R3DelegatedFnOrClassMetadata extends R3ConstructorFactoryMetadata {
|
|
51
|
+
delegate: outputAst.Expression;
|
|
52
|
+
delegateType: R3FactoryDelegateType;
|
|
53
|
+
delegateDeps: R3DependencyMetadata[];
|
|
54
|
+
}
|
|
55
|
+
export interface R3ExpressionFactoryMetadata extends R3ConstructorFactoryMetadata {
|
|
56
|
+
expression: outputAst.Expression;
|
|
57
|
+
}
|
|
58
|
+
export declare type R3FactoryMetadata = R3ConstructorFactoryMetadata | R3DelegatedFnOrClassMetadata | R3ExpressionFactoryMetadata;
|
|
59
|
+
export declare enum FactoryTarget {
|
|
60
|
+
Directive = 0,
|
|
61
|
+
Component = 1,
|
|
62
|
+
Injectable = 2,
|
|
63
|
+
Pipe = 3,
|
|
64
|
+
NgModule = 4
|
|
65
|
+
}
|
|
66
|
+
export interface R3DependencyMetadata {
|
|
67
|
+
/**
|
|
68
|
+
* An expression representing the token or value to be injected.
|
|
69
|
+
* Or `null` if the dependency could not be resolved - making it invalid.
|
|
70
|
+
*/
|
|
71
|
+
token: outputAst.Expression | null;
|
|
72
|
+
/**
|
|
73
|
+
* If an @Attribute decorator is present, this is the literal type of the attribute name, or
|
|
74
|
+
* the unknown type if no literal type is available (e.g. the attribute name is an expression).
|
|
75
|
+
* Otherwise it is null;
|
|
76
|
+
*/
|
|
77
|
+
attributeNameType: outputAst.Expression | null;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the dependency has an @Optional qualifier.
|
|
80
|
+
*/
|
|
81
|
+
optional: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the dependency has an @Self qualifier.
|
|
84
|
+
*/
|
|
85
|
+
self: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the dependency has an @SkipSelf qualifier.
|
|
88
|
+
*/
|
|
89
|
+
skipSelf: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Construct a factory function expression for the given `R3FactoryMetadata`.
|
|
93
|
+
*/
|
|
94
|
+
export declare function compileFactoryFunction(meta: R3FactoryMetadata): R3CompiledExpression;
|
|
95
|
+
export declare function createFactoryType(meta: R3FactoryMetadata): outputAst.ExpressionType;
|
|
96
|
+
export declare function isDelegatedFactoryMetadata(meta: R3FactoryMetadata): meta is R3DelegatedFnOrClassMetadata;
|
|
97
|
+
export declare function isExpressionFactoryMetadata(meta: R3FactoryMetadata): meta is R3ExpressionFactoryMetadata;
|