@angular/core 16.1.0-next.0 → 16.1.0-next.2
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/esm2022/src/change_detection/change_detector_ref.mjs +2 -2
- package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
- package/esm2022/src/core_private_export.mjs +1 -2
- package/esm2022/src/core_render3_private_export.mjs +2 -2
- package/esm2022/src/di/forward_ref.mjs +29 -2
- package/esm2022/src/di/r3_injector.mjs +6 -3
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/hydration/api.mjs +31 -3
- package/esm2022/src/i18n/locale_data_api.mjs +2 -2
- package/esm2022/src/interface/lifecycle_hooks.mjs +1 -1
- package/esm2022/src/render3/bindings.mjs +2 -2
- package/esm2022/src/render3/component.mjs +4 -4
- package/esm2022/src/render3/definition.mjs +6 -6
- package/esm2022/src/render3/di.mjs +5 -2
- package/esm2022/src/render3/errors.mjs +24 -3
- package/esm2022/src/render3/features/host_directives_feature.mjs +2 -2
- package/esm2022/src/render3/features/input_transforms_feature.mjs +13 -0
- package/esm2022/src/render3/index.mjs +3 -2
- package/esm2022/src/render3/instructions/listener.mjs +1 -3
- package/esm2022/src/render3/jit/environment.mjs +2 -1
- package/esm2022/src/render3/jit/module.mjs +11 -11
- package/esm2022/src/render3/node_manipulation.mjs +4 -2
- package/esm2022/src/signals/src/api.mjs +5 -3
- package/esm2022/src/transfer_state.mjs +7 -23
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed_common.mjs +1 -1
- package/fesm2022/core.mjs +133 -60
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +5 -3
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +99 -53
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +56 -18
- package/package.json +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/ng-generate/standalone-migration/bundle.js +362 -60
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +5 -5
|
@@ -744,6 +744,91 @@ function parseSelectorToR3Selector(selector) {
|
|
|
744
744
|
return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/output/output_ast.mjs
|
|
748
|
+
var output_ast_exports = {};
|
|
749
|
+
__export(output_ast_exports, {
|
|
750
|
+
ArrayType: () => ArrayType,
|
|
751
|
+
BOOL_TYPE: () => BOOL_TYPE,
|
|
752
|
+
BinaryOperator: () => BinaryOperator,
|
|
753
|
+
BinaryOperatorExpr: () => BinaryOperatorExpr,
|
|
754
|
+
BuiltinType: () => BuiltinType,
|
|
755
|
+
BuiltinTypeName: () => BuiltinTypeName,
|
|
756
|
+
CommaExpr: () => CommaExpr,
|
|
757
|
+
ConditionalExpr: () => ConditionalExpr,
|
|
758
|
+
DYNAMIC_TYPE: () => DYNAMIC_TYPE,
|
|
759
|
+
DeclareFunctionStmt: () => DeclareFunctionStmt,
|
|
760
|
+
DeclareVarStmt: () => DeclareVarStmt,
|
|
761
|
+
Expression: () => Expression,
|
|
762
|
+
ExpressionStatement: () => ExpressionStatement,
|
|
763
|
+
ExpressionType: () => ExpressionType,
|
|
764
|
+
ExternalExpr: () => ExternalExpr,
|
|
765
|
+
ExternalReference: () => ExternalReference,
|
|
766
|
+
FUNCTION_TYPE: () => FUNCTION_TYPE,
|
|
767
|
+
FnParam: () => FnParam,
|
|
768
|
+
FunctionExpr: () => FunctionExpr,
|
|
769
|
+
INFERRED_TYPE: () => INFERRED_TYPE,
|
|
770
|
+
INT_TYPE: () => INT_TYPE,
|
|
771
|
+
IfStmt: () => IfStmt,
|
|
772
|
+
InstantiateExpr: () => InstantiateExpr,
|
|
773
|
+
InvokeFunctionExpr: () => InvokeFunctionExpr,
|
|
774
|
+
JSDocComment: () => JSDocComment,
|
|
775
|
+
LeadingComment: () => LeadingComment,
|
|
776
|
+
LiteralArrayExpr: () => LiteralArrayExpr,
|
|
777
|
+
LiteralExpr: () => LiteralExpr,
|
|
778
|
+
LiteralMapEntry: () => LiteralMapEntry,
|
|
779
|
+
LiteralMapExpr: () => LiteralMapExpr,
|
|
780
|
+
LiteralPiece: () => LiteralPiece,
|
|
781
|
+
LocalizedString: () => LocalizedString,
|
|
782
|
+
MapType: () => MapType,
|
|
783
|
+
NONE_TYPE: () => NONE_TYPE,
|
|
784
|
+
NULL_EXPR: () => NULL_EXPR,
|
|
785
|
+
NUMBER_TYPE: () => NUMBER_TYPE,
|
|
786
|
+
NotExpr: () => NotExpr,
|
|
787
|
+
PlaceholderPiece: () => PlaceholderPiece,
|
|
788
|
+
ReadKeyExpr: () => ReadKeyExpr,
|
|
789
|
+
ReadPropExpr: () => ReadPropExpr,
|
|
790
|
+
ReadVarExpr: () => ReadVarExpr,
|
|
791
|
+
RecursiveAstVisitor: () => RecursiveAstVisitor,
|
|
792
|
+
ReturnStatement: () => ReturnStatement,
|
|
793
|
+
STRING_TYPE: () => STRING_TYPE,
|
|
794
|
+
Statement: () => Statement,
|
|
795
|
+
StmtModifier: () => StmtModifier,
|
|
796
|
+
TYPED_NULL_EXPR: () => TYPED_NULL_EXPR,
|
|
797
|
+
TaggedTemplateExpr: () => TaggedTemplateExpr,
|
|
798
|
+
TemplateLiteral: () => TemplateLiteral,
|
|
799
|
+
TemplateLiteralElement: () => TemplateLiteralElement,
|
|
800
|
+
TransplantedType: () => TransplantedType,
|
|
801
|
+
Type: () => Type,
|
|
802
|
+
TypeModifier: () => TypeModifier,
|
|
803
|
+
TypeofExpr: () => TypeofExpr,
|
|
804
|
+
UnaryOperator: () => UnaryOperator,
|
|
805
|
+
UnaryOperatorExpr: () => UnaryOperatorExpr,
|
|
806
|
+
WrappedNodeExpr: () => WrappedNodeExpr,
|
|
807
|
+
WriteKeyExpr: () => WriteKeyExpr,
|
|
808
|
+
WritePropExpr: () => WritePropExpr,
|
|
809
|
+
WriteVarExpr: () => WriteVarExpr,
|
|
810
|
+
areAllEquivalent: () => areAllEquivalent,
|
|
811
|
+
expressionType: () => expressionType,
|
|
812
|
+
fn: () => fn,
|
|
813
|
+
ifStmt: () => ifStmt,
|
|
814
|
+
importExpr: () => importExpr,
|
|
815
|
+
importType: () => importType,
|
|
816
|
+
isNull: () => isNull,
|
|
817
|
+
jsDocComment: () => jsDocComment,
|
|
818
|
+
leadingComment: () => leadingComment,
|
|
819
|
+
literal: () => literal,
|
|
820
|
+
literalArr: () => literalArr,
|
|
821
|
+
literalMap: () => literalMap,
|
|
822
|
+
localizedString: () => localizedString,
|
|
823
|
+
not: () => not,
|
|
824
|
+
nullSafeIsEquivalent: () => nullSafeIsEquivalent,
|
|
825
|
+
taggedTemplate: () => taggedTemplate,
|
|
826
|
+
transplantedType: () => transplantedType,
|
|
827
|
+
typeofExpr: () => typeofExpr,
|
|
828
|
+
unary: () => unary,
|
|
829
|
+
variable: () => variable
|
|
830
|
+
});
|
|
831
|
+
|
|
747
832
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/big_integer.mjs
|
|
748
833
|
var BigInteger = class {
|
|
749
834
|
static zero() {
|
|
@@ -1143,6 +1228,33 @@ var ExpressionType = class extends Type {
|
|
|
1143
1228
|
return visitor.visitExpressionType(this, context);
|
|
1144
1229
|
}
|
|
1145
1230
|
};
|
|
1231
|
+
var ArrayType = class extends Type {
|
|
1232
|
+
constructor(of, modifiers) {
|
|
1233
|
+
super(modifiers);
|
|
1234
|
+
this.of = of;
|
|
1235
|
+
}
|
|
1236
|
+
visitType(visitor, context) {
|
|
1237
|
+
return visitor.visitArrayType(this, context);
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
var MapType = class extends Type {
|
|
1241
|
+
constructor(valueType, modifiers) {
|
|
1242
|
+
super(modifiers);
|
|
1243
|
+
this.valueType = valueType || null;
|
|
1244
|
+
}
|
|
1245
|
+
visitType(visitor, context) {
|
|
1246
|
+
return visitor.visitMapType(this, context);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
var TransplantedType = class extends Type {
|
|
1250
|
+
constructor(type, modifiers) {
|
|
1251
|
+
super(modifiers);
|
|
1252
|
+
this.type = type;
|
|
1253
|
+
}
|
|
1254
|
+
visitType(visitor, context) {
|
|
1255
|
+
return visitor.visitTransplantedType(this, context);
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1146
1258
|
var DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic);
|
|
1147
1259
|
var INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);
|
|
1148
1260
|
var BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool);
|
|
@@ -1744,6 +1856,21 @@ var LiteralMapExpr = class extends Expression {
|
|
|
1744
1856
|
return visitor.visitLiteralMapExpr(this, context);
|
|
1745
1857
|
}
|
|
1746
1858
|
};
|
|
1859
|
+
var CommaExpr = class extends Expression {
|
|
1860
|
+
constructor(parts, sourceSpan) {
|
|
1861
|
+
super(parts[parts.length - 1].type, sourceSpan);
|
|
1862
|
+
this.parts = parts;
|
|
1863
|
+
}
|
|
1864
|
+
isEquivalent(e) {
|
|
1865
|
+
return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);
|
|
1866
|
+
}
|
|
1867
|
+
isConstant() {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
visitExpression(visitor, context) {
|
|
1871
|
+
return visitor.visitCommaExpr(this, context);
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1747
1874
|
var NULL_EXPR = new LiteralExpr(null, null, null);
|
|
1748
1875
|
var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
|
1749
1876
|
var StmtModifier;
|
|
@@ -2016,6 +2143,9 @@ var RecursiveAstVisitor = class {
|
|
|
2016
2143
|
stmts.forEach((stmt) => stmt.visitStatement(this, context));
|
|
2017
2144
|
}
|
|
2018
2145
|
};
|
|
2146
|
+
function leadingComment(text2, multiline = false, trailingNewline = true) {
|
|
2147
|
+
return new LeadingComment(text2, multiline, trailingNewline);
|
|
2148
|
+
}
|
|
2019
2149
|
function jsDocComment(tags = []) {
|
|
2020
2150
|
return new JSDocComment(tags);
|
|
2021
2151
|
}
|
|
@@ -2025,9 +2155,15 @@ function variable(name, type, sourceSpan) {
|
|
|
2025
2155
|
function importExpr(id, typeParams = null, sourceSpan) {
|
|
2026
2156
|
return new ExternalExpr(id, null, typeParams, sourceSpan);
|
|
2027
2157
|
}
|
|
2158
|
+
function importType(id, typeParams, typeModifiers) {
|
|
2159
|
+
return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null;
|
|
2160
|
+
}
|
|
2028
2161
|
function expressionType(expr, typeModifiers, typeParams) {
|
|
2029
2162
|
return new ExpressionType(expr, typeModifiers, typeParams);
|
|
2030
2163
|
}
|
|
2164
|
+
function transplantedType(type, typeModifiers) {
|
|
2165
|
+
return new TransplantedType(type, typeModifiers);
|
|
2166
|
+
}
|
|
2031
2167
|
function typeofExpr(expr) {
|
|
2032
2168
|
return new TypeofExpr(expr);
|
|
2033
2169
|
}
|
|
@@ -2037,6 +2173,9 @@ function literalArr(values, type, sourceSpan) {
|
|
|
2037
2173
|
function literalMap(values, type = null) {
|
|
2038
2174
|
return new LiteralMapExpr(values.map((e) => new LiteralMapEntry(e.key, e.value, e.quoted)), type, null);
|
|
2039
2175
|
}
|
|
2176
|
+
function unary(operator, expr, type, sourceSpan) {
|
|
2177
|
+
return new UnaryOperatorExpr(operator, expr, type, sourceSpan);
|
|
2178
|
+
}
|
|
2040
2179
|
function not(expr, sourceSpan) {
|
|
2041
2180
|
return new NotExpr(expr, sourceSpan);
|
|
2042
2181
|
}
|
|
@@ -2774,6 +2913,9 @@ var Identifiers = _Identifiers;
|
|
|
2774
2913
|
(() => {
|
|
2775
2914
|
_Identifiers.HostDirectivesFeature = { name: "\u0275\u0275HostDirectivesFeature", moduleName: CORE };
|
|
2776
2915
|
})();
|
|
2916
|
+
(() => {
|
|
2917
|
+
_Identifiers.InputTransformsFeatureFeature = { name: "\u0275\u0275InputTransformsFeature", moduleName: CORE };
|
|
2918
|
+
})();
|
|
2777
2919
|
(() => {
|
|
2778
2920
|
_Identifiers.listener = { name: "\u0275\u0275listener", moduleName: CORE };
|
|
2779
2921
|
})();
|
|
@@ -4582,22 +4724,30 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
|
|
|
4582
4724
|
let declaredName;
|
|
4583
4725
|
let publicName;
|
|
4584
4726
|
let minifiedName;
|
|
4585
|
-
let
|
|
4727
|
+
let expressionValue;
|
|
4586
4728
|
if (typeof value === "string") {
|
|
4587
4729
|
declaredName = key;
|
|
4588
4730
|
minifiedName = key;
|
|
4589
4731
|
publicName = value;
|
|
4590
|
-
|
|
4732
|
+
expressionValue = asLiteral(publicName);
|
|
4591
4733
|
} else {
|
|
4592
4734
|
minifiedName = key;
|
|
4593
4735
|
declaredName = value.classPropertyName;
|
|
4594
4736
|
publicName = value.bindingPropertyName;
|
|
4595
|
-
|
|
4737
|
+
if (keepDeclared && (publicName !== declaredName || value.transformFunction != null)) {
|
|
4738
|
+
const expressionKeys = [asLiteral(publicName), asLiteral(declaredName)];
|
|
4739
|
+
if (value.transformFunction != null) {
|
|
4740
|
+
expressionKeys.push(value.transformFunction);
|
|
4741
|
+
}
|
|
4742
|
+
expressionValue = literalArr(expressionKeys);
|
|
4743
|
+
} else {
|
|
4744
|
+
expressionValue = asLiteral(publicName);
|
|
4745
|
+
}
|
|
4596
4746
|
}
|
|
4597
4747
|
return {
|
|
4598
4748
|
key: minifiedName,
|
|
4599
4749
|
quoted: UNSAFE_OBJECT_KEY_NAME_REGEXP.test(minifiedName),
|
|
4600
|
-
value:
|
|
4750
|
+
value: expressionValue
|
|
4601
4751
|
};
|
|
4602
4752
|
}));
|
|
4603
4753
|
}
|
|
@@ -17656,6 +17806,7 @@ function addFeatures(definitionMap, meta) {
|
|
|
17656
17806
|
const features = [];
|
|
17657
17807
|
const providers = meta.providers;
|
|
17658
17808
|
const viewProviders = meta.viewProviders;
|
|
17809
|
+
const inputKeys = Object.keys(meta.inputs);
|
|
17659
17810
|
if (providers || viewProviders) {
|
|
17660
17811
|
const args = [providers || new LiteralArrayExpr([])];
|
|
17661
17812
|
if (viewProviders) {
|
|
@@ -17678,6 +17829,12 @@ function addFeatures(definitionMap, meta) {
|
|
|
17678
17829
|
if ((_a2 = meta.hostDirectives) == null ? void 0 : _a2.length) {
|
|
17679
17830
|
features.push(importExpr(Identifiers.HostDirectivesFeature).callFn([createHostDirectivesFeatureArg(meta.hostDirectives)]));
|
|
17680
17831
|
}
|
|
17832
|
+
for (const key of inputKeys) {
|
|
17833
|
+
if (meta.inputs[key].transformFunction !== null) {
|
|
17834
|
+
features.push(importExpr(Identifiers.InputTransformsFeatureFeature));
|
|
17835
|
+
break;
|
|
17836
|
+
}
|
|
17837
|
+
}
|
|
17681
17838
|
if (features.length) {
|
|
17682
17839
|
definitionMap.set("features", literalArr(features));
|
|
17683
17840
|
}
|
|
@@ -18383,7 +18540,8 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
18383
18540
|
inputsFromType[field] = {
|
|
18384
18541
|
bindingPropertyName: ann.alias || field,
|
|
18385
18542
|
classPropertyName: field,
|
|
18386
|
-
required: ann.required || false
|
|
18543
|
+
required: ann.required || false,
|
|
18544
|
+
transformFunction: null
|
|
18387
18545
|
};
|
|
18388
18546
|
} else if (isOutput(ann)) {
|
|
18389
18547
|
outputsFromType[field] = ann.alias || field;
|
|
@@ -18619,7 +18777,21 @@ function isOutput(value) {
|
|
|
18619
18777
|
function inputsMappingToInputMetadata(inputs) {
|
|
18620
18778
|
return Object.keys(inputs).reduce((result, key) => {
|
|
18621
18779
|
const value = inputs[key];
|
|
18622
|
-
|
|
18780
|
+
if (typeof value === "string") {
|
|
18781
|
+
result[key] = {
|
|
18782
|
+
bindingPropertyName: value,
|
|
18783
|
+
classPropertyName: value,
|
|
18784
|
+
required: false,
|
|
18785
|
+
transformFunction: null
|
|
18786
|
+
};
|
|
18787
|
+
} else {
|
|
18788
|
+
result[key] = {
|
|
18789
|
+
bindingPropertyName: value[0],
|
|
18790
|
+
classPropertyName: value[1],
|
|
18791
|
+
required: false,
|
|
18792
|
+
transformFunction: null
|
|
18793
|
+
};
|
|
18794
|
+
}
|
|
18623
18795
|
return result;
|
|
18624
18796
|
}, {});
|
|
18625
18797
|
}
|
|
@@ -18627,12 +18799,13 @@ function parseInputsArray(values) {
|
|
|
18627
18799
|
return values.reduce((results, value) => {
|
|
18628
18800
|
if (typeof value === "string") {
|
|
18629
18801
|
const [bindingPropertyName, classPropertyName] = parseMappingString(value);
|
|
18630
|
-
results[classPropertyName] = { bindingPropertyName, classPropertyName, required: false };
|
|
18802
|
+
results[classPropertyName] = { bindingPropertyName, classPropertyName, required: false, transformFunction: null };
|
|
18631
18803
|
} else {
|
|
18632
18804
|
results[value.name] = {
|
|
18633
18805
|
bindingPropertyName: value.alias || value.name,
|
|
18634
18806
|
classPropertyName: value.name,
|
|
18635
|
-
required: value.required || false
|
|
18807
|
+
required: value.required || false,
|
|
18808
|
+
transformFunction: null
|
|
18636
18809
|
};
|
|
18637
18810
|
}
|
|
18638
18811
|
return results;
|
|
@@ -18675,7 +18848,7 @@ function publishFacade(global2) {
|
|
|
18675
18848
|
}
|
|
18676
18849
|
|
|
18677
18850
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
|
|
18678
|
-
var VERSION2 = new Version("16.1.0-next.
|
|
18851
|
+
var VERSION2 = new Version("16.1.0-next.2");
|
|
18679
18852
|
|
|
18680
18853
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
18681
18854
|
var _I18N_ATTR = "i18n";
|
|
@@ -19994,7 +20167,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
19994
20167
|
function compileDeclareClassMetadata(metadata) {
|
|
19995
20168
|
const definitionMap = new DefinitionMap();
|
|
19996
20169
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
19997
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20170
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
19998
20171
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19999
20172
|
definitionMap.set("type", metadata.type);
|
|
20000
20173
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -20063,7 +20236,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
20063
20236
|
var _a2;
|
|
20064
20237
|
const definitionMap = new DefinitionMap();
|
|
20065
20238
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
|
|
20066
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20239
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
20067
20240
|
definitionMap.set("type", meta.type.value);
|
|
20068
20241
|
if (meta.isStandalone) {
|
|
20069
20242
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -20248,7 +20421,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
|
|
|
20248
20421
|
function compileDeclareFactoryFunction(meta) {
|
|
20249
20422
|
const definitionMap = new DefinitionMap();
|
|
20250
20423
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
20251
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20424
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
20252
20425
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
20253
20426
|
definitionMap.set("type", meta.type.value);
|
|
20254
20427
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -20271,7 +20444,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
20271
20444
|
function createInjectableDefinitionMap(meta) {
|
|
20272
20445
|
const definitionMap = new DefinitionMap();
|
|
20273
20446
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
20274
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20447
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
20275
20448
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
20276
20449
|
definitionMap.set("type", meta.type.value);
|
|
20277
20450
|
if (meta.providedIn !== void 0) {
|
|
@@ -20309,7 +20482,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
20309
20482
|
function createInjectorDefinitionMap(meta) {
|
|
20310
20483
|
const definitionMap = new DefinitionMap();
|
|
20311
20484
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
20312
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20485
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
20313
20486
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
20314
20487
|
definitionMap.set("type", meta.type.value);
|
|
20315
20488
|
definitionMap.set("providers", meta.providers);
|
|
@@ -20330,7 +20503,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
20330
20503
|
function createNgModuleDefinitionMap(meta) {
|
|
20331
20504
|
const definitionMap = new DefinitionMap();
|
|
20332
20505
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
20333
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20506
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
20334
20507
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
20335
20508
|
definitionMap.set("type", meta.type.value);
|
|
20336
20509
|
if (meta.bootstrap.length > 0) {
|
|
@@ -20365,7 +20538,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
20365
20538
|
function createPipeDefinitionMap(meta) {
|
|
20366
20539
|
const definitionMap = new DefinitionMap();
|
|
20367
20540
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
|
|
20368
|
-
definitionMap.set("version", literal("16.1.0-next.
|
|
20541
|
+
definitionMap.set("version", literal("16.1.0-next.2"));
|
|
20369
20542
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
20370
20543
|
definitionMap.set("type", meta.type.value);
|
|
20371
20544
|
if (meta.isStandalone) {
|
|
@@ -20382,7 +20555,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
20382
20555
|
publishFacade(_global);
|
|
20383
20556
|
|
|
20384
20557
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
20385
|
-
var VERSION3 = new Version("16.1.0-next.
|
|
20558
|
+
var VERSION3 = new Version("16.1.0-next.2");
|
|
20386
20559
|
|
|
20387
20560
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
20388
20561
|
var EmitFlags;
|
|
@@ -20538,6 +20711,7 @@ var ErrorCode;
|
|
|
20538
20711
|
ErrorCode2[ErrorCode2["HOST_DIRECTIVE_UNDEFINED_BINDING"] = 2017] = "HOST_DIRECTIVE_UNDEFINED_BINDING";
|
|
20539
20712
|
ErrorCode2[ErrorCode2["HOST_DIRECTIVE_CONFLICTING_ALIAS"] = 2018] = "HOST_DIRECTIVE_CONFLICTING_ALIAS";
|
|
20540
20713
|
ErrorCode2[ErrorCode2["HOST_DIRECTIVE_MISSING_REQUIRED_BINDING"] = 2019] = "HOST_DIRECTIVE_MISSING_REQUIRED_BINDING";
|
|
20714
|
+
ErrorCode2[ErrorCode2["CONFLICTING_INPUT_TRANSFORM"] = 2020] = "CONFLICTING_INPUT_TRANSFORM";
|
|
20541
20715
|
ErrorCode2[ErrorCode2["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED";
|
|
20542
20716
|
ErrorCode2[ErrorCode2["IMPORT_CYCLE_DETECTED"] = 3003] = "IMPORT_CYCLE_DETECTED";
|
|
20543
20717
|
ErrorCode2[ErrorCode2["IMPORT_GENERATION_FAILURE"] = 3004] = "IMPORT_GENERATION_FAILURE";
|
|
@@ -21496,12 +21670,12 @@ function createSourceSpan(node) {
|
|
|
21496
21670
|
const parseSf = new ParseSourceFile(sf.getFullText(), sf.fileName);
|
|
21497
21671
|
return new ParseSourceSpan(new ParseLocation(parseSf, startOffset, startLine + 1, startCol + 1), new ParseLocation(parseSf, endOffset, endLine + 1, endCol + 1));
|
|
21498
21672
|
}
|
|
21499
|
-
function compileResults(fac, def, metadataStmt, propName) {
|
|
21673
|
+
function compileResults(fac, def, metadataStmt, propName, additionalFields) {
|
|
21500
21674
|
const statements = def.statements;
|
|
21501
21675
|
if (metadataStmt !== null) {
|
|
21502
21676
|
statements.push(metadataStmt);
|
|
21503
21677
|
}
|
|
21504
|
-
|
|
21678
|
+
const results = [
|
|
21505
21679
|
fac,
|
|
21506
21680
|
{
|
|
21507
21681
|
name: propName,
|
|
@@ -21510,6 +21684,10 @@ function compileResults(fac, def, metadataStmt, propName) {
|
|
|
21510
21684
|
type: def.type
|
|
21511
21685
|
}
|
|
21512
21686
|
];
|
|
21687
|
+
if (additionalFields !== null) {
|
|
21688
|
+
results.push(...additionalFields);
|
|
21689
|
+
}
|
|
21690
|
+
return results;
|
|
21513
21691
|
}
|
|
21514
21692
|
function toFactoryMetadata(meta, target) {
|
|
21515
21693
|
return {
|
|
@@ -22000,9 +22178,12 @@ var TypeScriptReflectionHost = class {
|
|
|
22000
22178
|
if (node.body !== void 0) {
|
|
22001
22179
|
body = import_typescript18.default.isBlock(node.body) ? Array.from(node.body.statements) : [import_typescript18.default.factory.createReturnStatement(node.body)];
|
|
22002
22180
|
}
|
|
22181
|
+
const type = this.checker.getTypeAtLocation(node);
|
|
22182
|
+
const signatures = this.checker.getSignaturesOfType(type, import_typescript18.default.SignatureKind.Call);
|
|
22003
22183
|
return {
|
|
22004
22184
|
node,
|
|
22005
22185
|
body,
|
|
22186
|
+
signatureCount: signatures.length,
|
|
22006
22187
|
typeParameters: node.typeParameters === void 0 ? null : Array.from(node.typeParameters),
|
|
22007
22188
|
parameters: node.parameters.map((param) => {
|
|
22008
22189
|
const name = parameterName(param.name);
|
|
@@ -22375,10 +22556,10 @@ var ClassPropertyMapping = class {
|
|
|
22375
22556
|
}
|
|
22376
22557
|
return obj;
|
|
22377
22558
|
}
|
|
22378
|
-
toJointMappedObject() {
|
|
22559
|
+
toJointMappedObject(transform) {
|
|
22379
22560
|
const obj = {};
|
|
22380
22561
|
for (const [classPropertyName, inputOrOutput] of this.forwardMap) {
|
|
22381
|
-
obj[classPropertyName] = inputOrOutput;
|
|
22562
|
+
obj[classPropertyName] = transform(inputOrOutput);
|
|
22382
22563
|
}
|
|
22383
22564
|
return obj;
|
|
22384
22565
|
}
|
|
@@ -22481,7 +22662,7 @@ function extractDirectiveTypeCheckMeta(node, inputs, reflector) {
|
|
|
22481
22662
|
const restrictedInputFields = /* @__PURE__ */ new Set();
|
|
22482
22663
|
const stringLiteralInputFields = /* @__PURE__ */ new Set();
|
|
22483
22664
|
const undeclaredInputFields = /* @__PURE__ */ new Set();
|
|
22484
|
-
for (const classPropertyName of inputs
|
|
22665
|
+
for (const { classPropertyName, transform } of inputs) {
|
|
22485
22666
|
const field = members.find((member) => member.name === classPropertyName);
|
|
22486
22667
|
if (field === void 0 || field.node === null) {
|
|
22487
22668
|
undeclaredInputFields.add(classPropertyName);
|
|
@@ -22493,6 +22674,9 @@ function extractDirectiveTypeCheckMeta(node, inputs, reflector) {
|
|
|
22493
22674
|
if (field.nameNode !== null && import_typescript20.default.isStringLiteral(field.nameNode)) {
|
|
22494
22675
|
stringLiteralInputFields.add(classPropertyName);
|
|
22495
22676
|
}
|
|
22677
|
+
if (transform !== null) {
|
|
22678
|
+
coercedInputFields.add(classPropertyName);
|
|
22679
|
+
}
|
|
22496
22680
|
}
|
|
22497
22681
|
const arity = reflector.getGenericArityOfClass(node);
|
|
22498
22682
|
return {
|
|
@@ -22686,21 +22870,24 @@ function readInputsType(type) {
|
|
|
22686
22870
|
continue;
|
|
22687
22871
|
}
|
|
22688
22872
|
const stringValue = readStringType(member.type);
|
|
22873
|
+
const classPropertyName = member.name.text;
|
|
22689
22874
|
if (stringValue != null) {
|
|
22690
|
-
inputsMap[
|
|
22875
|
+
inputsMap[classPropertyName] = {
|
|
22691
22876
|
bindingPropertyName: stringValue,
|
|
22692
|
-
classPropertyName
|
|
22693
|
-
required: false
|
|
22877
|
+
classPropertyName,
|
|
22878
|
+
required: false,
|
|
22879
|
+
transform: null
|
|
22694
22880
|
};
|
|
22695
22881
|
} else {
|
|
22696
22882
|
const config = readMapType(member.type, (innerValue) => {
|
|
22697
22883
|
var _a2;
|
|
22698
22884
|
return (_a2 = readStringType(innerValue)) != null ? _a2 : readBooleanType(innerValue);
|
|
22699
22885
|
});
|
|
22700
|
-
inputsMap[
|
|
22701
|
-
classPropertyName
|
|
22886
|
+
inputsMap[classPropertyName] = {
|
|
22887
|
+
classPropertyName,
|
|
22702
22888
|
bindingPropertyName: config.alias,
|
|
22703
|
-
required: config.required
|
|
22889
|
+
required: config.required,
|
|
22890
|
+
transform: null
|
|
22704
22891
|
};
|
|
22705
22892
|
}
|
|
22706
22893
|
}
|
|
@@ -23029,7 +23216,8 @@ function resolveInput(bindingName, binding) {
|
|
|
23029
23216
|
return {
|
|
23030
23217
|
bindingPropertyName: bindingName,
|
|
23031
23218
|
classPropertyName: binding.classPropertyName,
|
|
23032
|
-
required: binding.required
|
|
23219
|
+
required: binding.required,
|
|
23220
|
+
transform: binding.transform
|
|
23033
23221
|
};
|
|
23034
23222
|
}
|
|
23035
23223
|
function resolveOutput(bindingName) {
|
|
@@ -24331,6 +24519,22 @@ function extractSchemas(rawExpr, evaluator, context) {
|
|
|
24331
24519
|
return schemas;
|
|
24332
24520
|
}
|
|
24333
24521
|
|
|
24522
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/input_transforms.mjs
|
|
24523
|
+
function compileInputTransformFields(inputs) {
|
|
24524
|
+
const extraFields = [];
|
|
24525
|
+
for (const input of inputs) {
|
|
24526
|
+
if (input.transform) {
|
|
24527
|
+
extraFields.push({
|
|
24528
|
+
name: `ngAcceptInputType_${input.classPropertyName}`,
|
|
24529
|
+
type: output_ast_exports.transplantedType(input.transform.type),
|
|
24530
|
+
statements: [],
|
|
24531
|
+
initializer: null
|
|
24532
|
+
});
|
|
24533
|
+
}
|
|
24534
|
+
}
|
|
24535
|
+
return extraFields;
|
|
24536
|
+
}
|
|
24537
|
+
|
|
24334
24538
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
24335
24539
|
var import_typescript51 = __toESM(require("typescript"), 1);
|
|
24336
24540
|
|
|
@@ -25629,7 +25833,7 @@ var TraitCompiler = class {
|
|
|
25629
25833
|
}
|
|
25630
25834
|
resolve() {
|
|
25631
25835
|
var _a2, _b;
|
|
25632
|
-
const classes =
|
|
25836
|
+
const classes = this.classes.keys();
|
|
25633
25837
|
for (const clazz of classes) {
|
|
25634
25838
|
const record = this.classes.get(clazz);
|
|
25635
25839
|
for (let trait of record.traits) {
|
|
@@ -26814,6 +27018,9 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
26814
27018
|
const statements = [];
|
|
26815
27019
|
const members = [...node.members];
|
|
26816
27020
|
for (const field of this.classCompilationMap.get(node)) {
|
|
27021
|
+
if (field.initializer === null) {
|
|
27022
|
+
continue;
|
|
27023
|
+
}
|
|
26817
27024
|
const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
|
|
26818
27025
|
const property2 = import_typescript45.default.factory.createPropertyDeclaration([import_typescript45.default.factory.createToken(import_typescript45.default.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
|
|
26819
27026
|
if (this.isClosureCompilerEnabled) {
|
|
@@ -27002,8 +27209,8 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
27002
27209
|
const members = reflector.getMembersOfClass(clazz);
|
|
27003
27210
|
const decoratedElements = members.filter((member) => !member.isStatic && member.decorators !== null);
|
|
27004
27211
|
const coreModule = isCore ? void 0 : "@angular/core";
|
|
27005
|
-
const inputsFromMeta = parseInputsArray2(directive, evaluator);
|
|
27006
|
-
const inputsFromFields = parseInputFields(filterToMembersWithDecorator(decoratedElements, "Input", coreModule), evaluator);
|
|
27212
|
+
const inputsFromMeta = parseInputsArray2(clazz, directive, evaluator, reflector, refEmitter);
|
|
27213
|
+
const inputsFromFields = parseInputFields(clazz, filterToMembersWithDecorator(decoratedElements, "Input", coreModule), evaluator, reflector, refEmitter);
|
|
27007
27214
|
const inputs = ClassPropertyMapping.fromMappedObject(__spreadValues(__spreadValues({}, inputsFromMeta), inputsFromFields));
|
|
27008
27215
|
const outputsFromMeta = parseOutputsArray(directive, evaluator);
|
|
27009
27216
|
const outputsFromFields = parseOutputFields(filterToMembersWithDecorator(decoratedElements, "Output", coreModule), evaluator);
|
|
@@ -27079,7 +27286,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
27079
27286
|
lifecycle: {
|
|
27080
27287
|
usesOnChanges
|
|
27081
27288
|
},
|
|
27082
|
-
inputs: inputs.toJointMappedObject(),
|
|
27289
|
+
inputs: inputs.toJointMappedObject(toR3InputMetadata),
|
|
27083
27290
|
outputs: outputs.toDirectMappedObject(),
|
|
27084
27291
|
queries,
|
|
27085
27292
|
viewQueries,
|
|
@@ -27315,7 +27522,7 @@ function parseDecoratedFields(fields, evaluator, callback) {
|
|
|
27315
27522
|
}
|
|
27316
27523
|
}
|
|
27317
27524
|
}
|
|
27318
|
-
function parseInputsArray2(decoratorMetadata, evaluator) {
|
|
27525
|
+
function parseInputsArray2(clazz, decoratorMetadata, evaluator, reflector, refEmitter) {
|
|
27319
27526
|
const inputsField = decoratorMetadata.get("inputs");
|
|
27320
27527
|
if (inputsField === void 0) {
|
|
27321
27528
|
return {};
|
|
@@ -27329,18 +27536,32 @@ function parseInputsArray2(decoratorMetadata, evaluator) {
|
|
|
27329
27536
|
const value = inputsArray[i];
|
|
27330
27537
|
if (typeof value === "string") {
|
|
27331
27538
|
const [bindingPropertyName, classPropertyName] = parseMappingString2(value);
|
|
27332
|
-
inputs[classPropertyName] = {
|
|
27539
|
+
inputs[classPropertyName] = {
|
|
27540
|
+
bindingPropertyName,
|
|
27541
|
+
classPropertyName,
|
|
27542
|
+
required: false,
|
|
27543
|
+
transform: null
|
|
27544
|
+
};
|
|
27333
27545
|
} else if (value instanceof Map) {
|
|
27334
27546
|
const name = value.get("name");
|
|
27335
27547
|
const alias = value.get("alias");
|
|
27336
27548
|
const required = value.get("required");
|
|
27549
|
+
let transform = null;
|
|
27337
27550
|
if (typeof name !== "string") {
|
|
27338
27551
|
throw createValueHasWrongTypeError(inputsField, name, `Value at position ${i} of @Directive.inputs array must have a "name" property`);
|
|
27339
27552
|
}
|
|
27553
|
+
if (value.has("transform")) {
|
|
27554
|
+
const transformValue = value.get("transform");
|
|
27555
|
+
if (!(transformValue instanceof DynamicValue) && !(transformValue instanceof Reference2)) {
|
|
27556
|
+
throw createValueHasWrongTypeError(inputsField, transformValue, `Transform of value at position ${i} of @Directive.inputs array must be a function`);
|
|
27557
|
+
}
|
|
27558
|
+
transform = parseInputTransformFunction(clazz, name, transformValue, reflector, refEmitter);
|
|
27559
|
+
}
|
|
27340
27560
|
inputs[name] = {
|
|
27341
27561
|
classPropertyName: name,
|
|
27342
27562
|
bindingPropertyName: typeof alias === "string" ? alias : name,
|
|
27343
|
-
required: required === true
|
|
27563
|
+
required: required === true,
|
|
27564
|
+
transform
|
|
27344
27565
|
};
|
|
27345
27566
|
} else {
|
|
27346
27567
|
throw createValueHasWrongTypeError(inputsField, value, `@Directive.inputs array can only contain strings or object literals`);
|
|
@@ -27348,11 +27569,12 @@ function parseInputsArray2(decoratorMetadata, evaluator) {
|
|
|
27348
27569
|
}
|
|
27349
27570
|
return inputs;
|
|
27350
27571
|
}
|
|
27351
|
-
function parseInputFields(inputMembers, evaluator) {
|
|
27572
|
+
function parseInputFields(clazz, inputMembers, evaluator, reflector, refEmitter) {
|
|
27352
27573
|
const inputs = {};
|
|
27353
27574
|
parseDecoratedFields(inputMembers, evaluator, (classPropertyName, options, decorator) => {
|
|
27354
27575
|
let bindingPropertyName;
|
|
27355
27576
|
let required = false;
|
|
27577
|
+
let transform = null;
|
|
27356
27578
|
if (options === null) {
|
|
27357
27579
|
bindingPropertyName = classPropertyName;
|
|
27358
27580
|
} else if (typeof options === "string") {
|
|
@@ -27361,13 +27583,72 @@ function parseInputFields(inputMembers, evaluator) {
|
|
|
27361
27583
|
const aliasInConfig = options.get("alias");
|
|
27362
27584
|
bindingPropertyName = typeof aliasInConfig === "string" ? aliasInConfig : classPropertyName;
|
|
27363
27585
|
required = options.get("required") === true;
|
|
27586
|
+
if (options.has("transform")) {
|
|
27587
|
+
const transformValue = options.get("transform");
|
|
27588
|
+
if (!(transformValue instanceof DynamicValue) && !(transformValue instanceof Reference2)) {
|
|
27589
|
+
throw createValueHasWrongTypeError(decorator.node, transformValue, `Input transform must be a function`);
|
|
27590
|
+
}
|
|
27591
|
+
transform = parseInputTransformFunction(clazz, classPropertyName, transformValue, reflector, refEmitter);
|
|
27592
|
+
}
|
|
27364
27593
|
} else {
|
|
27365
27594
|
throw createValueHasWrongTypeError(decorator.node, options, `@${decorator.name} decorator argument must resolve to a string or an object literal`);
|
|
27366
27595
|
}
|
|
27367
|
-
inputs[classPropertyName] = { bindingPropertyName, classPropertyName, required };
|
|
27596
|
+
inputs[classPropertyName] = { bindingPropertyName, classPropertyName, required, transform };
|
|
27368
27597
|
});
|
|
27369
27598
|
return inputs;
|
|
27370
27599
|
}
|
|
27600
|
+
function parseInputTransformFunction(clazz, classPropertyName, value, reflector, refEmitter) {
|
|
27601
|
+
var _a2;
|
|
27602
|
+
const definition = reflector.getDefinitionOfFunction(value.node);
|
|
27603
|
+
if (definition === null) {
|
|
27604
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform must be a function");
|
|
27605
|
+
}
|
|
27606
|
+
if (definition.typeParameters !== null && definition.typeParameters.length > 0) {
|
|
27607
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform function cannot be generic");
|
|
27608
|
+
}
|
|
27609
|
+
if (definition.signatureCount > 1) {
|
|
27610
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform function cannot have multiple signatures");
|
|
27611
|
+
}
|
|
27612
|
+
const members = reflector.getMembersOfClass(clazz);
|
|
27613
|
+
for (const member of members) {
|
|
27614
|
+
const conflictingName = `ngAcceptInputType_${classPropertyName}`;
|
|
27615
|
+
if (member.name === conflictingName && member.isStatic) {
|
|
27616
|
+
throw new FatalDiagnosticError(ErrorCode.CONFLICTING_INPUT_TRANSFORM, value.node, `Class cannot have both a transform function on Input ${classPropertyName} and a static member called ${conflictingName}`);
|
|
27617
|
+
}
|
|
27618
|
+
}
|
|
27619
|
+
const node = value instanceof Reference2 ? value.getIdentityIn(clazz.getSourceFile()) : value.node;
|
|
27620
|
+
if (node === null) {
|
|
27621
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform function could not be referenced");
|
|
27622
|
+
}
|
|
27623
|
+
const firstParam = ((_a2 = definition.parameters[0]) == null ? void 0 : _a2.name) === "this" ? definition.parameters[1] : definition.parameters[0];
|
|
27624
|
+
if (!firstParam) {
|
|
27625
|
+
return { node, type: import_typescript46.default.factory.createKeywordTypeNode(import_typescript46.default.SyntaxKind.UnknownKeyword) };
|
|
27626
|
+
}
|
|
27627
|
+
if (!firstParam.type) {
|
|
27628
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform function first parameter must have a type");
|
|
27629
|
+
}
|
|
27630
|
+
if (firstParam.node.dotDotDotToken) {
|
|
27631
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform function first parameter cannot be a spread parameter");
|
|
27632
|
+
}
|
|
27633
|
+
assertEmittableInputType(firstParam.type, clazz.getSourceFile(), reflector, refEmitter);
|
|
27634
|
+
return { node, type: firstParam.type };
|
|
27635
|
+
}
|
|
27636
|
+
function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
|
|
27637
|
+
(function walk(node) {
|
|
27638
|
+
if (import_typescript46.default.isTypeReferenceNode(node) && import_typescript46.default.isIdentifier(node.typeName)) {
|
|
27639
|
+
const declaration = reflector.getDeclarationOfIdentifier(node.typeName);
|
|
27640
|
+
if (declaration !== null) {
|
|
27641
|
+
if (declaration.node.getSourceFile() !== contextFile) {
|
|
27642
|
+
const emittedType = refEmitter.emit(new Reference2(declaration.node), contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports);
|
|
27643
|
+
assertSuccessfulReferenceEmit(emittedType, node, "type");
|
|
27644
|
+
} else if (!reflector.isStaticallyExported(declaration.node)) {
|
|
27645
|
+
throw new FatalDiagnosticError(ErrorCode.SYMBOL_NOT_EXPORTED, type, `Symbol must be exported in order to be used as the type of an Input transform function`, [makeRelatedInformation(declaration.node, `The symbol is declared here.`)]);
|
|
27646
|
+
}
|
|
27647
|
+
}
|
|
27648
|
+
}
|
|
27649
|
+
node.forEachChild(walk);
|
|
27650
|
+
})(type);
|
|
27651
|
+
}
|
|
27371
27652
|
function parseOutputsArray(directive, evaluator) {
|
|
27372
27653
|
const metaValues = parseFieldStringArrayValue(directive, "outputs", evaluator);
|
|
27373
27654
|
return metaValues ? parseMappingStringArray2(metaValues) : EMPTY_OBJECT;
|
|
@@ -27454,6 +27735,14 @@ function toHostDirectiveMetadata(hostDirective, context, refEmitter) {
|
|
|
27454
27735
|
outputs: hostDirective.outputs || null
|
|
27455
27736
|
};
|
|
27456
27737
|
}
|
|
27738
|
+
function toR3InputMetadata(mapping) {
|
|
27739
|
+
return {
|
|
27740
|
+
classPropertyName: mapping.classPropertyName,
|
|
27741
|
+
bindingPropertyName: mapping.bindingPropertyName,
|
|
27742
|
+
required: mapping.required,
|
|
27743
|
+
transformFunction: mapping.transform !== null ? new WrappedNodeExpr(mapping.transform.node) : null
|
|
27744
|
+
};
|
|
27745
|
+
}
|
|
27457
27746
|
|
|
27458
27747
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.mjs
|
|
27459
27748
|
var DirectiveSymbol = class extends SemanticSymbol {
|
|
@@ -27674,14 +27963,16 @@ var DirectiveDecoratorHandler = class {
|
|
|
27674
27963
|
compileFull(node, analysis, resolution, pool) {
|
|
27675
27964
|
const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
|
|
27676
27965
|
const def = compileDirectiveFromMetadata(analysis.meta, pool, makeBindingParser());
|
|
27966
|
+
const inputTransformFields = compileInputTransformFields(analysis.inputs);
|
|
27677
27967
|
const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
|
|
27678
|
-
return compileResults(fac, def, classMetadata, "\u0275dir");
|
|
27968
|
+
return compileResults(fac, def, classMetadata, "\u0275dir", inputTransformFields);
|
|
27679
27969
|
}
|
|
27680
27970
|
compilePartial(node, analysis, resolution) {
|
|
27681
27971
|
const fac = compileDeclareFactory(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
|
|
27682
27972
|
const def = compileDeclareDirectiveFromMetadata(analysis.meta);
|
|
27973
|
+
const inputTransformFields = compileInputTransformFields(analysis.inputs);
|
|
27683
27974
|
const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
|
|
27684
|
-
return compileResults(fac, def, classMetadata, "\u0275dir");
|
|
27975
|
+
return compileResults(fac, def, classMetadata, "\u0275dir", inputTransformFields);
|
|
27685
27976
|
}
|
|
27686
27977
|
findClassFieldWithAngularFeatures(node) {
|
|
27687
27978
|
return this.reflector.getMembersOfClass(node).find((member) => {
|
|
@@ -29321,8 +29612,9 @@ var ComponentDecoratorHandler = class {
|
|
|
29321
29612
|
const meta = __spreadValues(__spreadValues({}, analysis.meta), resolution);
|
|
29322
29613
|
const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget.Component));
|
|
29323
29614
|
const def = compileComponentFromMetadata(meta, pool, makeBindingParser());
|
|
29615
|
+
const inputTransformFields = compileInputTransformFields(analysis.inputs);
|
|
29324
29616
|
const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
|
|
29325
|
-
return compileResults(fac, def, classMetadata, "\u0275cmp");
|
|
29617
|
+
return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields);
|
|
29326
29618
|
}
|
|
29327
29619
|
compilePartial(node, analysis, resolution) {
|
|
29328
29620
|
if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
|
|
@@ -29336,9 +29628,10 @@ var ComponentDecoratorHandler = class {
|
|
|
29336
29628
|
};
|
|
29337
29629
|
const meta = __spreadValues(__spreadValues({}, analysis.meta), resolution);
|
|
29338
29630
|
const fac = compileDeclareFactory(toFactoryMetadata(meta, FactoryTarget.Component));
|
|
29631
|
+
const inputTransformFields = compileInputTransformFields(analysis.inputs);
|
|
29339
29632
|
const def = compileDeclareComponentFromMetadata(meta, analysis.template, templateInfo);
|
|
29340
29633
|
const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
|
|
29341
|
-
return compileResults(fac, def, classMetadata, "\u0275cmp");
|
|
29634
|
+
return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields);
|
|
29342
29635
|
}
|
|
29343
29636
|
_checkForCyclicImport(importedFile, expr, origin) {
|
|
29344
29637
|
const imported = resolveImportedFile(this.moduleResolver, importedFile, expr, origin);
|
|
@@ -29728,13 +30021,13 @@ var PipeDecoratorHandler = class {
|
|
|
29728
30021
|
const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Pipe));
|
|
29729
30022
|
const def = compilePipeFromMetadata(analysis.meta);
|
|
29730
30023
|
const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
|
|
29731
|
-
return compileResults(fac, def, classMetadata, "\u0275pipe");
|
|
30024
|
+
return compileResults(fac, def, classMetadata, "\u0275pipe", null);
|
|
29732
30025
|
}
|
|
29733
30026
|
compilePartial(node, analysis) {
|
|
29734
30027
|
const fac = compileDeclareFactory(toFactoryMetadata(analysis.meta, FactoryTarget.Pipe));
|
|
29735
30028
|
const def = compileDeclarePipeFromMetadata(analysis.meta);
|
|
29736
30029
|
const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
|
|
29737
|
-
return compileResults(fac, def, classMetadata, "\u0275pipe");
|
|
30030
|
+
return compileResults(fac, def, classMetadata, "\u0275pipe", null);
|
|
29738
30031
|
}
|
|
29739
30032
|
};
|
|
29740
30033
|
|
|
@@ -32196,18 +32489,17 @@ function generateInlineTypeCtor(node, meta) {
|
|
|
32196
32489
|
}
|
|
32197
32490
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
32198
32491
|
let initType = null;
|
|
32199
|
-
const keys = meta.fields.inputs;
|
|
32200
32492
|
const plainKeys = [];
|
|
32201
32493
|
const coercedKeys = [];
|
|
32202
|
-
for (const
|
|
32203
|
-
if (!meta.coercedInputFields.has(
|
|
32204
|
-
plainKeys.push(import_typescript75.default.factory.createLiteralTypeNode(import_typescript75.default.factory.createStringLiteral(
|
|
32494
|
+
for (const { classPropertyName, transform } of meta.fields.inputs) {
|
|
32495
|
+
if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
32496
|
+
plainKeys.push(import_typescript75.default.factory.createLiteralTypeNode(import_typescript75.default.factory.createStringLiteral(classPropertyName)));
|
|
32205
32497
|
} else {
|
|
32206
32498
|
coercedKeys.push(import_typescript75.default.factory.createPropertySignature(
|
|
32207
32499
|
void 0,
|
|
32208
|
-
|
|
32500
|
+
classPropertyName,
|
|
32209
32501
|
void 0,
|
|
32210
|
-
tsCreateTypeQueryForCoercedInput(rawType.typeName,
|
|
32502
|
+
transform == null ? tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName) : transform.type
|
|
32211
32503
|
));
|
|
32212
32504
|
}
|
|
32213
32505
|
}
|
|
@@ -32288,8 +32580,7 @@ var Environment = class {
|
|
|
32288
32580
|
fnName,
|
|
32289
32581
|
body: true,
|
|
32290
32582
|
fields: {
|
|
32291
|
-
inputs: dir.inputs
|
|
32292
|
-
outputs: dir.outputs.classPropertyNames,
|
|
32583
|
+
inputs: dir.inputs,
|
|
32293
32584
|
queries: dir.queries
|
|
32294
32585
|
},
|
|
32295
32586
|
coercedInputFields: dir.coercedInputFields
|
|
@@ -33250,18 +33541,23 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
33250
33541
|
for (const attr of boundAttrs) {
|
|
33251
33542
|
const expr = widenBinding(translateInput(attr.attribute, this.tcb, this.scope), this.tcb);
|
|
33252
33543
|
let assignment = wrapForDiagnostics(expr);
|
|
33253
|
-
for (const { fieldName, required } of attr.inputs) {
|
|
33544
|
+
for (const { fieldName, required, transformType } of attr.inputs) {
|
|
33254
33545
|
let target;
|
|
33255
33546
|
if (required) {
|
|
33256
33547
|
seenRequiredInputs.add(fieldName);
|
|
33257
33548
|
}
|
|
33258
33549
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
33259
|
-
|
|
33260
|
-
if (
|
|
33261
|
-
|
|
33550
|
+
let type;
|
|
33551
|
+
if (transformType) {
|
|
33552
|
+
type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
|
|
33553
|
+
} else {
|
|
33554
|
+
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
33555
|
+
if (!import_typescript81.default.isTypeReferenceNode(dirTypeRef)) {
|
|
33556
|
+
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
33557
|
+
}
|
|
33558
|
+
type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
33262
33559
|
}
|
|
33263
33560
|
const id = this.tcb.allocateId();
|
|
33264
|
-
const type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
33265
33561
|
this.scope.addStatement(tsDeclareVariable(id, type));
|
|
33266
33562
|
target = id;
|
|
33267
33563
|
} else if (this.dir.undeclaredInputFields.has(fieldName)) {
|
|
@@ -33918,7 +34214,14 @@ function getBoundAttributes(directive, node) {
|
|
|
33918
34214
|
if (inputs !== null) {
|
|
33919
34215
|
boundInputs.push({
|
|
33920
34216
|
attribute: attr,
|
|
33921
|
-
inputs: inputs.map((input) =>
|
|
34217
|
+
inputs: inputs.map((input) => {
|
|
34218
|
+
var _a2;
|
|
34219
|
+
return {
|
|
34220
|
+
fieldName: input.classPropertyName,
|
|
34221
|
+
required: input.required,
|
|
34222
|
+
transformType: ((_a2 = input.transform) == null ? void 0 : _a2.type) || null
|
|
34223
|
+
};
|
|
34224
|
+
})
|
|
33922
34225
|
});
|
|
33923
34226
|
}
|
|
33924
34227
|
};
|
|
@@ -34097,8 +34400,7 @@ var TypeCheckContextImpl = class {
|
|
|
34097
34400
|
fnName: "ngTypeCtor",
|
|
34098
34401
|
body: !dirNode.getSourceFile().isDeclarationFile,
|
|
34099
34402
|
fields: {
|
|
34100
|
-
inputs: dir.inputs
|
|
34101
|
-
outputs: dir.outputs.classPropertyNames,
|
|
34403
|
+
inputs: dir.inputs,
|
|
34102
34404
|
queries: dir.queries
|
|
34103
34405
|
},
|
|
34104
34406
|
coercedInputFields: dir.coercedInputFields
|