static-injector 2.2.1 → 4.0.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/index.js +94 -50
- package/import/es2022/di/index.js +1 -0
- package/import/es2022/di/initializer_token.js +1 -1
- package/import/es2022/di/inject_switch.js +1 -2
- package/import/es2022/di/injection_token.js +13 -6
- package/import/es2022/di/injector.js +3 -3
- package/import/es2022/di/injector_compatibility.js +23 -0
- package/import/es2022/di/injector_token.js +2 -3
- package/import/es2022/di/internal_tokens.js +1 -1
- package/import/es2022/di/r3_injector.js +19 -16
- package/import/es2022/di/scope.js +1 -1
- package/import/es2022/di.js +24 -0
- package/import/es2022/render3/errors_di.js +2 -2
- package/import/es2022/render3/instructions/di.js +7 -0
- package/import/es2022/render3/util/stringify_utils.js +1 -0
- package/import/es2022/util/array_utils.js +7 -0
- package/import/es2022/util/stringify.js +15 -0
- package/import/fesm2022/index.js +88 -44
- package/import/typings/di/create_injector.d.ts +2 -2
- package/import/typings/di/forward_ref.d.ts +1 -1
- package/import/typings/di/index.d.ts +1 -0
- package/import/typings/di/initializer_token.d.ts +1 -1
- package/import/typings/di/injection_token.d.ts +11 -6
- package/import/typings/di/injector.d.ts +3 -3
- package/import/typings/di/injector_compatibility.d.ts +2 -1
- package/import/typings/di/injector_token.d.ts +1 -1
- package/import/typings/di/interface/provider.d.ts +12 -12
- package/import/typings/di/internal_tokens.d.ts +1 -1
- package/import/typings/di/metadata.d.ts +2 -2
- package/import/typings/di/null_injector.d.ts +1 -1
- package/import/typings/di/r3_injector.d.ts +1 -1
- package/import/typings/di.d.ts +24 -0
- package/import/typings/errors.d.ts +11 -3
- package/import/typings/render3/errors_di.d.ts +2 -1
- package/import/typings/render3/instructions/di.d.ts +7 -0
- package/import/typings/render3/util/stringify_utils.d.ts +1 -0
- package/import/typings/util/array_utils.d.ts +7 -0
- package/import/typings/util/empty.d.ts +1 -1
- package/import/typings/util/stringify.d.ts +8 -0
- package/package.json +7 -5
- package/readme.md +2 -2
- package/transform/compiler/src/compiler.d.ts +0 -22
- package/transform/compiler/src/compiler.js +0 -26
- package/transform/compiler/src/core.d.ts +6 -0
- package/transform/compiler/src/core.js +13 -0
- package/transform/compiler/src/injectable_compiler_2.js +2 -2
- package/transform/compiler/src/output/output_ast.d.ts +21 -7
- package/transform/compiler/src/output/output_ast.js +55 -9
- package/transform/compiler/src/render3/partial/api.d.ts +5 -0
- package/transform/compiler/src/render3/r3_factory.js +1 -1
- package/transform/compiler/src/render3/r3_identifiers.js +4 -0
- package/transform/compiler/src/render3/util.js +1 -3
- package/transform/compiler/src/render3/view/util.d.ts +2 -0
- package/transform/compiler/src/render3/view/util.js +10 -2
- package/transform/compiler-cli/src/ngtsc/annotations/common/index.d.ts +0 -7
- package/transform/compiler-cli/src/ngtsc/annotations/common/index.js +0 -7
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.d.ts +3 -0
- package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.js +14 -2
- package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.d.ts +3 -2
- package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +3 -1
- package/transform/compiler-cli/src/ngtsc/diagnostics/error.d.ts +2 -2
- package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.js +2 -2
- package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +0 -7
- package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +0 -7
- package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +0 -7
- package/transform/compiler-cli/src/ngtsc/imports/index.js +0 -7
- package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +0 -7
- package/transform/compiler-cli/src/ngtsc/reflection/index.js +0 -7
- package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +7 -2
- package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +3 -1
- package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +2 -1
- package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +16 -5
- package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +4 -3
- package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +25 -9
- package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +0 -7
- package/transform/compiler-cli/src/ngtsc/transform/index.js +0 -7
- package/transform/compiler-cli/src/ngtsc/transform/src/api.d.ts +18 -0
- package/transform/compiler-cli/src/ngtsc/transform/src/api.js +20 -0
- package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +1 -1
- package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +35 -24
- package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +0 -7
- package/transform/compiler-cli/src/ngtsc/translator/index.js +0 -7
- package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +9 -1
- package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +21 -3
- package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +13 -3
- package/transform/compiler-cli/src/ngtsc/translator/src/translator.d.ts +1 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +6 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.d.ts +12 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.js +27 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts +1 -0
- package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +9 -1
- package/transform/index.d.ts +1 -1
- package/transform/injectable-transform.js +2 -2
|
@@ -6,3 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
export declare function stringify(token: any): string;
|
|
9
|
+
/**
|
|
10
|
+
* Ellipses the string in the middle when longer than the max length
|
|
11
|
+
*
|
|
12
|
+
* @param string
|
|
13
|
+
* @param maxLength of the output string
|
|
14
|
+
* @returns ellipsed string with ... in the middle
|
|
15
|
+
*/
|
|
16
|
+
export declare function truncateMiddle(str: string, maxLength?: number): string;
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "static-injector",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Angular
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Angular 依赖注入独立版本;Angular dependency injection standalone version",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
7
|
+
"angular 17.3.1",
|
|
7
8
|
"injector",
|
|
8
9
|
"typescript",
|
|
9
|
-
"typescript 5.
|
|
10
|
+
"typescript 5.4.2",
|
|
10
11
|
"injectable",
|
|
11
|
-
"static-inject"
|
|
12
|
+
"static-inject",
|
|
13
|
+
"dependency injection"
|
|
12
14
|
],
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
@@ -33,4 +35,4 @@
|
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {},
|
|
35
37
|
"sideEffects": false
|
|
36
|
-
}
|
|
38
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
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
|
-
/**
|
|
9
|
-
* @module
|
|
10
|
-
* @description
|
|
11
|
-
* Entry point for all APIs of the compiler package.
|
|
12
|
-
*
|
|
13
|
-
* <div class="callout is-critical">
|
|
14
|
-
* <header>Unstable APIs</header>
|
|
15
|
-
* <p>
|
|
16
|
-
* All compiler apis are currently considered experimental and private!
|
|
17
|
-
* </p>
|
|
18
|
-
* <p>
|
|
19
|
-
* We expect the APIs in this package to keep on changing. Do not rely on them.
|
|
20
|
-
* </p>
|
|
21
|
-
* </div>
|
|
22
|
-
*/
|
|
23
1
|
export * from './injectable_compiler_2';
|
|
24
2
|
export * from './render3/r3_factory';
|
|
25
3
|
export * from './output/output_ast';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
3
|
if (k2 === undefined) k2 = k;
|
|
11
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -21,25 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
15
|
};
|
|
23
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
//////////////////////////////////////
|
|
25
|
-
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
26
|
-
// (see bottom of file) //
|
|
27
|
-
//////////////////////////////////////
|
|
28
|
-
/**
|
|
29
|
-
* @module
|
|
30
|
-
* @description
|
|
31
|
-
* Entry point for all APIs of the compiler package.
|
|
32
|
-
*
|
|
33
|
-
* <div class="callout is-critical">
|
|
34
|
-
* <header>Unstable APIs</header>
|
|
35
|
-
* <p>
|
|
36
|
-
* All compiler apis are currently considered experimental and private!
|
|
37
|
-
* </p>
|
|
38
|
-
* <p>
|
|
39
|
-
* We expect the APIs in this package to keep on changing. Do not rely on them.
|
|
40
|
-
* </p>
|
|
41
|
-
* </div>
|
|
42
|
-
*/
|
|
43
17
|
__exportStar(require("./injectable_compiler_2"), exports);
|
|
44
18
|
__exportStar(require("./render3/r3_factory"), exports);
|
|
45
19
|
__exportStar(require("./output/output_ast"), exports);
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
/** Flags describing an input for a directive. */
|
|
9
|
+
export declare enum InputFlags {
|
|
10
|
+
None = 0,
|
|
11
|
+
SignalBased = 1,
|
|
12
|
+
HasDecoratorInputTransform = 2
|
|
13
|
+
}
|
|
8
14
|
/**
|
|
9
15
|
* Injection flags for DI.
|
|
10
16
|
*/
|
|
@@ -7,3 +7,16 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.InputFlags = void 0;
|
|
11
|
+
// Attention:
|
|
12
|
+
// This file duplicates types and values from @angular/core
|
|
13
|
+
// so that we are able to make @angular/compiler independent of @angular/core.
|
|
14
|
+
// This is important to prevent a build cycle, as @angular/core needs to
|
|
15
|
+
// be compiled with the compiler.
|
|
16
|
+
/** Flags describing an input for a directive. */
|
|
17
|
+
var InputFlags;
|
|
18
|
+
(function (InputFlags) {
|
|
19
|
+
InputFlags[InputFlags["None"] = 0] = "None";
|
|
20
|
+
InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
|
|
21
|
+
InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
|
|
22
|
+
})(InputFlags || (exports.InputFlags = InputFlags = {}));
|
|
@@ -88,7 +88,7 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
|
88
88
|
else {
|
|
89
89
|
result = {
|
|
90
90
|
statements: [],
|
|
91
|
-
expression: o.
|
|
91
|
+
expression: o.arrowFn([], meta.useFactory.callFn([])),
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -167,5 +167,5 @@ function delegateToFactory(type, useType, unwrapForwardRefs) {
|
|
|
167
167
|
return createFactoryFunction(unwrappedType);
|
|
168
168
|
}
|
|
169
169
|
function createFactoryFunction(type) {
|
|
170
|
-
return o.
|
|
170
|
+
return o.arrowFn([new o.FnParam('t', o.DYNAMIC_TYPE)], type.prop('ɵfac').callFn([o.variable('t')]));
|
|
171
171
|
}
|
|
@@ -83,12 +83,13 @@ export declare enum BinaryOperator {
|
|
|
83
83
|
Modulo = 8,
|
|
84
84
|
And = 9,
|
|
85
85
|
Or = 10,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
BitwiseOr = 11,
|
|
87
|
+
BitwiseAnd = 12,
|
|
88
|
+
Lower = 13,
|
|
89
|
+
LowerEquals = 14,
|
|
90
|
+
Bigger = 15,
|
|
91
|
+
BiggerEquals = 16,
|
|
92
|
+
NullishCoalesce = 17
|
|
92
93
|
}
|
|
93
94
|
export declare function nullSafeIsEquivalent<T extends {
|
|
94
95
|
isEquivalent(other: T): boolean;
|
|
@@ -114,6 +115,7 @@ export declare abstract class Expression {
|
|
|
114
115
|
prop(name: string, sourceSpan?: ParseSourceSpan | null): ReadPropExpr;
|
|
115
116
|
key(index: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null): ReadKeyExpr;
|
|
116
117
|
callFn(params: Expression[], sourceSpan?: ParseSourceSpan | null, pure?: boolean): InvokeFunctionExpr;
|
|
118
|
+
bitwiseOr(rhs: Expression, sourceSpan?: ParseSourceSpan | null, parens?: boolean): BinaryOperatorExpr;
|
|
117
119
|
toStmt(): Statement;
|
|
118
120
|
}
|
|
119
121
|
export declare class ReadVarExpr extends Expression {
|
|
@@ -280,12 +282,22 @@ export declare class FunctionExpr extends Expression {
|
|
|
280
282
|
statements: Statement[];
|
|
281
283
|
name?: string | null | undefined;
|
|
282
284
|
constructor(params: FnParam[], statements: Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null, name?: string | null | undefined);
|
|
283
|
-
isEquivalent(e: Expression): boolean;
|
|
285
|
+
isEquivalent(e: Expression | Statement): boolean;
|
|
284
286
|
isConstant(): boolean;
|
|
285
287
|
visitExpression(visitor: ExpressionVisitor, context: any): any;
|
|
286
288
|
toDeclStmt(name: string, modifiers?: StmtModifier): DeclareFunctionStmt;
|
|
287
289
|
clone(): FunctionExpr;
|
|
288
290
|
}
|
|
291
|
+
export declare class ArrowFunctionExpr extends Expression {
|
|
292
|
+
params: FnParam[];
|
|
293
|
+
body: Expression | Statement[];
|
|
294
|
+
constructor(params: FnParam[], body: Expression | Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null);
|
|
295
|
+
isEquivalent(e: Expression): boolean;
|
|
296
|
+
isConstant(): boolean;
|
|
297
|
+
visitExpression(visitor: ExpressionVisitor, context: any): any;
|
|
298
|
+
clone(): Expression;
|
|
299
|
+
toDeclStmt(name: string, modifiers?: StmtModifier): DeclareVarStmt;
|
|
300
|
+
}
|
|
289
301
|
export declare class UnaryOperatorExpr extends Expression {
|
|
290
302
|
operator: UnaryOperator;
|
|
291
303
|
expr: Expression;
|
|
@@ -383,6 +395,7 @@ export interface ExpressionVisitor {
|
|
|
383
395
|
visitCommaExpr(ast: CommaExpr, context: any): any;
|
|
384
396
|
visitWrappedNodeExpr(ast: WrappedNodeExpr<any>, context: any): any;
|
|
385
397
|
visitTypeofExpr(ast: TypeofExpr, context: any): any;
|
|
398
|
+
visitArrowFunctionExpr(ast: ArrowFunctionExpr, context: any): any;
|
|
386
399
|
}
|
|
387
400
|
export declare const NULL_EXPR: LiteralExpr;
|
|
388
401
|
export declare const TYPED_NULL_EXPR: LiteralExpr;
|
|
@@ -480,6 +493,7 @@ export declare function literalMap(values: {
|
|
|
480
493
|
export declare function unary(operator: UnaryOperator, expr: Expression, type?: Type, sourceSpan?: ParseSourceSpan | null): UnaryOperatorExpr;
|
|
481
494
|
export declare function not(expr: Expression, sourceSpan?: ParseSourceSpan | null): NotExpr;
|
|
482
495
|
export declare function fn(params: FnParam[], body: Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null, name?: string | null): FunctionExpr;
|
|
496
|
+
export declare function arrowFn(params: FnParam[], body: Expression | Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null): ArrowFunctionExpr;
|
|
483
497
|
export declare function ifStmt(condition: Expression, thenClause: Statement[], elseClause?: Statement[], sourceSpan?: ParseSourceSpan, leadingComments?: LeadingComment[]): IfStmt;
|
|
484
498
|
export declare function literal(value: any, type?: Type | null, sourceSpan?: ParseSourceSpan | null): LiteralExpr;
|
|
485
499
|
export declare function isNull(exp: Expression): boolean;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
exports.isNull = exports.literal = exports.ifStmt = exports.fn = exports.not = exports.unary = exports.literalMap = exports.literalArr = exports.typeofExpr = exports.transplantedType = exports.expressionType = exports.importType = exports.importExpr = exports.variable = exports.jsDocComment = exports.leadingComment = exports.IfStmt = exports.ReturnStatement = exports.ExpressionStatement = exports.DeclareFunctionStmt = exports.DeclareVarStmt = exports.Statement = exports.JSDocComment = exports.LeadingComment = exports.StmtModifier = void 0;
|
|
10
|
+
exports.NULL_EXPR = exports.CommaExpr = exports.LiteralMapExpr = exports.LiteralMapEntry = exports.LiteralArrayExpr = exports.ReadKeyExpr = exports.ReadPropExpr = exports.BinaryOperatorExpr = exports.UnaryOperatorExpr = exports.ArrowFunctionExpr = exports.FunctionExpr = exports.FnParam = exports.NotExpr = exports.DynamicImportExpr = exports.ConditionalExpr = exports.ExternalReference = exports.ExternalExpr = exports.LiteralPiece = exports.TemplateLiteralElement = exports.TemplateLiteral = exports.LiteralExpr = exports.InstantiateExpr = exports.InvokeFunctionExpr = exports.WritePropExpr = exports.WriteKeyExpr = exports.WriteVarExpr = exports.WrappedNodeExpr = exports.TypeofExpr = exports.ReadVarExpr = exports.Expression = exports.areAllEquivalent = exports.nullSafeIsEquivalent = exports.BinaryOperator = exports.UnaryOperator = exports.NONE_TYPE = exports.FUNCTION_TYPE = exports.STRING_TYPE = exports.NUMBER_TYPE = exports.INT_TYPE = exports.BOOL_TYPE = exports.INFERRED_TYPE = exports.DYNAMIC_TYPE = exports.TransplantedType = exports.MapType = exports.ArrayType = exports.ExpressionType = exports.BuiltinType = exports.BuiltinTypeName = exports.Type = exports.TypeModifier = void 0;
|
|
11
|
+
exports.isNull = exports.literal = exports.ifStmt = exports.arrowFn = exports.fn = exports.not = exports.unary = exports.literalMap = exports.literalArr = exports.typeofExpr = exports.transplantedType = exports.expressionType = exports.importType = exports.importExpr = exports.variable = exports.jsDocComment = exports.leadingComment = exports.IfStmt = exports.ReturnStatement = exports.ExpressionStatement = exports.DeclareFunctionStmt = exports.DeclareVarStmt = exports.Statement = exports.JSDocComment = exports.LeadingComment = exports.StmtModifier = exports.TYPED_NULL_EXPR = void 0;
|
|
12
12
|
//// Types
|
|
13
13
|
var TypeModifier;
|
|
14
14
|
(function (TypeModifier) {
|
|
@@ -120,12 +120,13 @@ var BinaryOperator;
|
|
|
120
120
|
BinaryOperator[BinaryOperator["Modulo"] = 8] = "Modulo";
|
|
121
121
|
BinaryOperator[BinaryOperator["And"] = 9] = "And";
|
|
122
122
|
BinaryOperator[BinaryOperator["Or"] = 10] = "Or";
|
|
123
|
-
BinaryOperator[BinaryOperator["
|
|
124
|
-
BinaryOperator[BinaryOperator["
|
|
125
|
-
BinaryOperator[BinaryOperator["
|
|
126
|
-
BinaryOperator[BinaryOperator["
|
|
127
|
-
BinaryOperator[BinaryOperator["
|
|
128
|
-
BinaryOperator[BinaryOperator["
|
|
123
|
+
BinaryOperator[BinaryOperator["BitwiseOr"] = 11] = "BitwiseOr";
|
|
124
|
+
BinaryOperator[BinaryOperator["BitwiseAnd"] = 12] = "BitwiseAnd";
|
|
125
|
+
BinaryOperator[BinaryOperator["Lower"] = 13] = "Lower";
|
|
126
|
+
BinaryOperator[BinaryOperator["LowerEquals"] = 14] = "LowerEquals";
|
|
127
|
+
BinaryOperator[BinaryOperator["Bigger"] = 15] = "Bigger";
|
|
128
|
+
BinaryOperator[BinaryOperator["BiggerEquals"] = 16] = "BiggerEquals";
|
|
129
|
+
BinaryOperator[BinaryOperator["NullishCoalesce"] = 17] = "NullishCoalesce";
|
|
129
130
|
})(BinaryOperator || (exports.BinaryOperator = BinaryOperator = {}));
|
|
130
131
|
function nullSafeIsEquivalent(base, other) {
|
|
131
132
|
if (base == null || other == null) {
|
|
@@ -166,6 +167,9 @@ class Expression {
|
|
|
166
167
|
callFn(params, sourceSpan, pure) {
|
|
167
168
|
return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
|
|
168
169
|
}
|
|
170
|
+
bitwiseOr(rhs, sourceSpan, parens = true) {
|
|
171
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan, parens);
|
|
172
|
+
}
|
|
169
173
|
toStmt() {
|
|
170
174
|
return new ExpressionStatement(this, null);
|
|
171
175
|
}
|
|
@@ -600,7 +604,7 @@ class FunctionExpr extends Expression {
|
|
|
600
604
|
this.name = name;
|
|
601
605
|
}
|
|
602
606
|
isEquivalent(e) {
|
|
603
|
-
return (e instanceof FunctionExpr &&
|
|
607
|
+
return ((e instanceof FunctionExpr || e instanceof DeclareFunctionStmt) &&
|
|
604
608
|
areAllEquivalent(this.params, e.params) &&
|
|
605
609
|
areAllEquivalent(this.statements, e.statements));
|
|
606
610
|
}
|
|
@@ -619,6 +623,44 @@ class FunctionExpr extends Expression {
|
|
|
619
623
|
}
|
|
620
624
|
}
|
|
621
625
|
exports.FunctionExpr = FunctionExpr;
|
|
626
|
+
class ArrowFunctionExpr extends Expression {
|
|
627
|
+
params;
|
|
628
|
+
body;
|
|
629
|
+
// Note that `body: Expression` represents `() => expr` whereas
|
|
630
|
+
// `body: Statement[]` represents `() => { expr }`.
|
|
631
|
+
constructor(params, body, type, sourceSpan) {
|
|
632
|
+
super(type, sourceSpan);
|
|
633
|
+
this.params = params;
|
|
634
|
+
this.body = body;
|
|
635
|
+
}
|
|
636
|
+
isEquivalent(e) {
|
|
637
|
+
if (!(e instanceof ArrowFunctionExpr) ||
|
|
638
|
+
!areAllEquivalent(this.params, e.params)) {
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
641
|
+
if (this.body instanceof Expression && e.body instanceof Expression) {
|
|
642
|
+
return this.body.isEquivalent(e.body);
|
|
643
|
+
}
|
|
644
|
+
if (Array.isArray(this.body) && Array.isArray(e.body)) {
|
|
645
|
+
return areAllEquivalent(this.body, e.body);
|
|
646
|
+
}
|
|
647
|
+
return false;
|
|
648
|
+
}
|
|
649
|
+
isConstant() {
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
visitExpression(visitor, context) {
|
|
653
|
+
return visitor.visitArrowFunctionExpr(this, context);
|
|
654
|
+
}
|
|
655
|
+
clone() {
|
|
656
|
+
// TODO: Should we deep clone statements?
|
|
657
|
+
return new ArrowFunctionExpr(this.params.map((p) => p.clone()), Array.isArray(this.body) ? this.body : this.body.clone(), this.type, this.sourceSpan);
|
|
658
|
+
}
|
|
659
|
+
toDeclStmt(name, modifiers) {
|
|
660
|
+
return new DeclareVarStmt(name, this, exports.INFERRED_TYPE, modifiers, this.sourceSpan);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
exports.ArrowFunctionExpr = ArrowFunctionExpr;
|
|
622
664
|
class UnaryOperatorExpr extends Expression {
|
|
623
665
|
operator;
|
|
624
666
|
expr;
|
|
@@ -1015,6 +1057,10 @@ function fn(params, body, type, sourceSpan, name) {
|
|
|
1015
1057
|
return new FunctionExpr(params, body, type, sourceSpan, name);
|
|
1016
1058
|
}
|
|
1017
1059
|
exports.fn = fn;
|
|
1060
|
+
function arrowFn(params, body, type, sourceSpan) {
|
|
1061
|
+
return new ArrowFunctionExpr(params, body, type, sourceSpan);
|
|
1062
|
+
}
|
|
1063
|
+
exports.arrowFn = arrowFn;
|
|
1018
1064
|
function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments) {
|
|
1019
1065
|
return new IfStmt(condition, thenClause, elseClause, sourceSpan, leadingComments);
|
|
1020
1066
|
}
|
|
@@ -26,6 +26,11 @@ export interface R3PartialDeclaration {
|
|
|
26
26
|
*/
|
|
27
27
|
type: o.Expression;
|
|
28
28
|
}
|
|
29
|
+
export type LegacyInputPartialMapping = string | [
|
|
30
|
+
bindingPropertyName: string,
|
|
31
|
+
classPropertyName: string,
|
|
32
|
+
transformFunction?: o.Expression
|
|
33
|
+
];
|
|
29
34
|
/**
|
|
30
35
|
* Describes the shape of the objects that the `ɵɵngDeclareInjector()` accepts.
|
|
31
36
|
*/
|
|
@@ -116,7 +116,7 @@ function compileFactoryFunction(meta) {
|
|
|
116
116
|
// There is a base factory variable so wrap its declaration along with the factory function into
|
|
117
117
|
// an IIFE.
|
|
118
118
|
factoryFn = o
|
|
119
|
-
.
|
|
119
|
+
.arrowFn([], [
|
|
120
120
|
new o.DeclareVarStmt(baseFactoryVar.name),
|
|
121
121
|
new o.ReturnStatement(factoryFn),
|
|
122
122
|
])
|
|
@@ -10,6 +10,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.Identifiers = void 0;
|
|
11
11
|
const CORE = 'static-injector';
|
|
12
12
|
class Identifiers {
|
|
13
|
+
/* Methods */
|
|
14
|
+
/* Instructions */
|
|
13
15
|
static inject = { name: 'ɵɵinject', moduleName: CORE };
|
|
14
16
|
static directiveInject = {
|
|
15
17
|
name: 'ɵɵdirectiveInject',
|
|
@@ -43,6 +45,8 @@ class Identifiers {
|
|
|
43
45
|
name: 'ɵɵFactoryDeclaration',
|
|
44
46
|
moduleName: CORE,
|
|
45
47
|
};
|
|
48
|
+
// Signal queries
|
|
49
|
+
// Two-way bindings
|
|
46
50
|
static getInheritedFactory = {
|
|
47
51
|
name: 'ɵɵgetInheritedFactory',
|
|
48
52
|
moduleName: CORE,
|
|
@@ -77,8 +77,6 @@ exports.convertFromMaybeForwardRefExpression = convertFromMaybeForwardRefExpress
|
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
function generateForwardRef(expr) {
|
|
80
|
-
return o
|
|
81
|
-
.importExpr(r3_identifiers_1.Identifiers.forwardRef)
|
|
82
|
-
.callFn([o.fn([], [new o.ReturnStatement(expr)])]);
|
|
80
|
+
return o.importExpr(r3_identifiers_1.Identifiers.forwardRef).callFn([o.arrowFn([], expr)]);
|
|
83
81
|
}
|
|
84
82
|
exports.generateForwardRef = generateForwardRef;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import * as o from '../../output/output_ast';
|
|
9
|
+
/** Special value representing a direct access to a template's context. */
|
|
10
|
+
export declare const DIRECT_CONTEXT_REFERENCE = "#context";
|
|
9
11
|
/**
|
|
10
12
|
* A representation for an object literal used during codegen of definition objects. The generic
|
|
11
13
|
* type `T` allows to reference a documented type of the generated structure, such that the
|
|
@@ -30,8 +30,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.DefinitionMap = void 0;
|
|
33
|
+
exports.DefinitionMap = exports.DIRECT_CONTEXT_REFERENCE = void 0;
|
|
34
34
|
const o = __importStar(require("../../output/output_ast"));
|
|
35
|
+
/** Special value representing a direct access to a template's context. */
|
|
36
|
+
exports.DIRECT_CONTEXT_REFERENCE = '#context';
|
|
35
37
|
/**
|
|
36
38
|
* A representation for an object literal used during codegen of definition objects. The generic
|
|
37
39
|
* type `T` allows to reference a documented type of the generated structure, such that the
|
|
@@ -41,7 +43,13 @@ class DefinitionMap {
|
|
|
41
43
|
values = [];
|
|
42
44
|
set(key, value) {
|
|
43
45
|
if (value) {
|
|
44
|
-
this.values.
|
|
46
|
+
const existing = this.values.find((value) => value.key === key);
|
|
47
|
+
if (existing) {
|
|
48
|
+
existing.value = value;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.values.push({ key: key, value, quoted: false });
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
toLiteralMap() {
|
|
@@ -1,10 +1,3 @@
|
|
|
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
1
|
export * from './src/di';
|
|
9
2
|
export * from './src/factory';
|
|
10
3
|
export * from './src/util';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
3
|
if (k2 === undefined) k2 = k;
|
|
11
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import { Expression, FactoryTarget, R3FactoryMetadata, R3Reference } from 'static-injector/transform/compiler';
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { ClassDeclaration, Decorator, Import, ImportedTypeValueReference, LocalTypeValueReference, ReflectionHost, TypeValueReference } from '../../../reflection';
|
|
11
|
+
/** Module name of the framework core. */
|
|
12
|
+
export declare const CORE_MODULE = "static-injector";
|
|
11
13
|
/**
|
|
12
14
|
* Convert a `TypeValueReference` to an `Expression` which refers to the type as a value.
|
|
13
15
|
*
|
|
@@ -22,6 +24,7 @@ export declare function isAngularCore(decorator: Decorator): decorator is Decora
|
|
|
22
24
|
};
|
|
23
25
|
export declare function findAngularDecorator(decorators: Decorator[], name: string, isCore: boolean): Decorator | undefined;
|
|
24
26
|
export declare function isAngularDecorator(decorator: Decorator, name: string, isCore: boolean): boolean;
|
|
27
|
+
export declare function getAngularDecorators(decorators: Decorator[], names: readonly string[], isCore: boolean): Decorator[];
|
|
25
28
|
/**
|
|
26
29
|
* Unwrap a `ts.Expression`, removing outer type-casts or parentheses until the expression is in its
|
|
27
30
|
* lowest level form.
|
|
@@ -10,9 +10,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.isAbstractClassDeclaration = exports.toFactoryMetadata = exports.wrapTypeReference = exports.wrapFunctionExpressionsInParens = exports.tryUnwrapForwardRef = exports.unwrapExpression = exports.isAngularDecorator = exports.findAngularDecorator = exports.isAngularCore = exports.valueReferenceToExpression = void 0;
|
|
13
|
+
exports.isAbstractClassDeclaration = exports.toFactoryMetadata = exports.wrapTypeReference = exports.wrapFunctionExpressionsInParens = exports.tryUnwrapForwardRef = exports.unwrapExpression = exports.getAngularDecorators = exports.isAngularDecorator = exports.findAngularDecorator = exports.isAngularCore = exports.valueReferenceToExpression = exports.CORE_MODULE = void 0;
|
|
14
14
|
const compiler_1 = require("static-injector/transform/compiler");
|
|
15
15
|
const typescript_1 = __importDefault(require("typescript"));
|
|
16
|
+
/** Module name of the framework core. */
|
|
17
|
+
exports.CORE_MODULE = 'static-injector';
|
|
16
18
|
function valueReferenceToExpression(valueRef) {
|
|
17
19
|
if (valueRef.kind === 2 /* TypeValueReferenceKind.UNAVAILABLE */) {
|
|
18
20
|
return null;
|
|
@@ -36,7 +38,7 @@ function valueReferenceToExpression(valueRef) {
|
|
|
36
38
|
}
|
|
37
39
|
exports.valueReferenceToExpression = valueReferenceToExpression;
|
|
38
40
|
function isAngularCore(decorator) {
|
|
39
|
-
return
|
|
41
|
+
return decorator.import !== null && decorator.import.from === exports.CORE_MODULE;
|
|
40
42
|
}
|
|
41
43
|
exports.isAngularCore = isAngularCore;
|
|
42
44
|
function findAngularDecorator(decorators, name, isCore) {
|
|
@@ -53,6 +55,16 @@ function isAngularDecorator(decorator, name, isCore) {
|
|
|
53
55
|
return false;
|
|
54
56
|
}
|
|
55
57
|
exports.isAngularDecorator = isAngularDecorator;
|
|
58
|
+
function getAngularDecorators(decorators, names, isCore) {
|
|
59
|
+
return decorators.filter((decorator) => {
|
|
60
|
+
const name = isCore ? decorator.name : decorator.import?.name;
|
|
61
|
+
if (name === undefined || !names.includes(name)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return isCore || isAngularCore(decorator);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.getAngularDecorators = getAngularDecorators;
|
|
56
68
|
/**
|
|
57
69
|
* Unwrap a `ts.Expression`, removing outer type-casts or parentheses until the expression is in its
|
|
58
70
|
* lowest level form.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { R3DependencyMetadata, R3InjectableMetadata } from 'static-injector/transform/compiler';
|
|
9
9
|
import { ClassDeclaration, Decorator, ReflectionHost } from '../../reflection';
|
|
10
|
-
import { AnalysisOutput, CompileResult, DecoratorHandler, DetectResult } from '../../transform';
|
|
10
|
+
import { AnalysisOutput, CompilationMode, CompileResult, DecoratorHandler, DetectResult } from '../../transform';
|
|
11
11
|
export interface InjectableHandlerData {
|
|
12
12
|
meta: R3InjectableMetadata;
|
|
13
13
|
ctorDeps: R3DependencyMetadata[] | 'invalid' | null;
|
|
@@ -20,6 +20,7 @@ export declare class InjectableDecoratorHandler implements DecoratorHandler<Deco
|
|
|
20
20
|
private isCore;
|
|
21
21
|
private strictCtorDeps;
|
|
22
22
|
private includeClassMetadata;
|
|
23
|
+
private readonly compilationMode;
|
|
23
24
|
/**
|
|
24
25
|
* What to do if the injectable already contains a ɵprov property.
|
|
25
26
|
*
|
|
@@ -27,7 +28,7 @@ export declare class InjectableDecoratorHandler implements DecoratorHandler<Deco
|
|
|
27
28
|
* If false then there is no error and a new ɵprov property is not added.
|
|
28
29
|
*/
|
|
29
30
|
private errorOnDuplicateProv;
|
|
30
|
-
constructor(reflector: ReflectionHost, isCore: boolean, strictCtorDeps: boolean, includeClassMetadata: boolean,
|
|
31
|
+
constructor(reflector: ReflectionHost, isCore: boolean, strictCtorDeps: boolean, includeClassMetadata: boolean, compilationMode: CompilationMode,
|
|
31
32
|
/**
|
|
32
33
|
* What to do if the injectable already contains a ɵprov property.
|
|
33
34
|
*
|
|
@@ -25,8 +25,9 @@ class InjectableDecoratorHandler {
|
|
|
25
25
|
isCore;
|
|
26
26
|
strictCtorDeps;
|
|
27
27
|
includeClassMetadata;
|
|
28
|
+
compilationMode;
|
|
28
29
|
errorOnDuplicateProv;
|
|
29
|
-
constructor(reflector, isCore, strictCtorDeps, includeClassMetadata,
|
|
30
|
+
constructor(reflector, isCore, strictCtorDeps, includeClassMetadata, compilationMode,
|
|
30
31
|
/**
|
|
31
32
|
* What to do if the injectable already contains a ɵprov property.
|
|
32
33
|
*
|
|
@@ -38,6 +39,7 @@ class InjectableDecoratorHandler {
|
|
|
38
39
|
this.isCore = isCore;
|
|
39
40
|
this.strictCtorDeps = strictCtorDeps;
|
|
40
41
|
this.includeClassMetadata = includeClassMetadata;
|
|
42
|
+
this.compilationMode = compilationMode;
|
|
41
43
|
this.errorOnDuplicateProv = errorOnDuplicateProv;
|
|
42
44
|
}
|
|
43
45
|
detect(node, decorators) {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import * as ts from
|
|
9
|
-
import { ErrorCode } from
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import { ErrorCode } from './error_code';
|
|
10
10
|
export declare class FatalDiagnosticError {
|
|
11
11
|
readonly code: ErrorCode;
|
|
12
12
|
readonly node: ts.Node;
|
|
@@ -182,7 +182,7 @@ var ErrorCode;
|
|
|
182
182
|
* Keep this value in sync with a similar const in
|
|
183
183
|
* `packages/core/src/render3/error_code.ts`.
|
|
184
184
|
*/
|
|
185
|
-
exports.ERROR_DETAILS_PAGE_BASE_URL =
|
|
185
|
+
exports.ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
|
|
186
186
|
/**
|
|
187
187
|
* @internal
|
|
188
188
|
* Contains a set of error messages that have detailed guides at angular.io.
|
|
@@ -201,6 +201,6 @@ exports.COMPILER_ERRORS_WITH_GUIDES = new Set([
|
|
|
201
201
|
* @internal
|
|
202
202
|
*/
|
|
203
203
|
function ngErrorCode(code) {
|
|
204
|
-
return parseInt(
|
|
204
|
+
return parseInt('-99' + code);
|
|
205
205
|
}
|
|
206
206
|
exports.ngErrorCode = ngErrorCode;
|
|
@@ -1,9 +1,2 @@
|
|
|
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
1
|
export * from './error';
|
|
9
2
|
export * from './error_code';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
3
|
if (k2 === undefined) k2 = k;
|
|
11
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,11 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
3
|
if (k2 === undefined) k2 = k;
|
|
11
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,10 +1,3 @@
|
|
|
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
1
|
export * from './src/host';
|
|
9
2
|
export * from './src/typescript';
|
|
10
3
|
export * from './src/util';
|