@angular/core 17.1.0-next.4 → 17.1.0-rc.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/esm2022/primitives/signals/index.mjs +2 -2
- package/esm2022/primitives/signals/src/signal.mjs +2 -10
- package/esm2022/src/application/application_ref.mjs +24 -12
- package/esm2022/src/application/create_application.mjs +2 -2
- package/esm2022/src/authoring/input.mjs +12 -5
- package/esm2022/src/authoring/input_signal.mjs +28 -1
- package/esm2022/src/authoring/input_signal_node.mjs +22 -0
- package/esm2022/src/authoring.mjs +1 -4
- package/esm2022/src/change_detection/flags.mjs +16 -0
- package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +164 -0
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +13 -0
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +56 -0
- package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
- package/esm2022/src/core.mjs +3 -3
- package/esm2022/src/core_private_export.mjs +5 -2
- package/esm2022/src/core_render3_private_export.mjs +2 -2
- package/esm2022/src/defer/dom_triggers.mjs +1 -5
- package/esm2022/src/di/inject_switch.mjs +2 -3
- package/esm2022/src/di/r3_injector.mjs +8 -6
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/event_emitter.mjs +1 -2
- package/esm2022/src/hydration/utils.mjs +2 -2
- package/esm2022/src/hydration/views.mjs +2 -2
- package/esm2022/src/linker/view_container_ref.mjs +2 -2
- package/esm2022/src/metadata/directives.mjs +1 -1
- package/esm2022/src/pending_tasks.mjs +57 -0
- package/esm2022/src/platform/platform_ref.mjs +2 -2
- package/esm2022/src/render3/after_render_hooks.mjs +16 -34
- package/esm2022/src/render3/apply_value_input_field.mjs +16 -0
- package/esm2022/src/render3/collect_native_nodes.mjs +2 -3
- package/esm2022/src/render3/component_ref.mjs +24 -13
- package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
- package/esm2022/src/render3/definition.mjs +27 -68
- package/esm2022/src/render3/errors_di.mjs +4 -3
- package/esm2022/src/render3/features/host_directives_feature.mjs +2 -3
- package/esm2022/src/render3/features/inherit_definition_feature.mjs +31 -9
- package/esm2022/src/render3/features/input_transforms_feature.mjs +4 -5
- package/esm2022/src/render3/features/ng_onchanges_feature.mjs +4 -3
- package/esm2022/src/render3/instructions/advance.mjs +2 -2
- package/esm2022/src/render3/instructions/change_detection.mjs +1 -6
- package/esm2022/src/render3/instructions/control_flow.mjs +5 -3
- package/esm2022/src/render3/instructions/listener.mjs +1 -1
- package/esm2022/src/render3/instructions/mark_view_dirty.mjs +4 -3
- package/esm2022/src/render3/instructions/shared.mjs +63 -59
- package/esm2022/src/render3/instructions/write_to_directive_input.mjs +43 -0
- package/esm2022/src/render3/interfaces/container.mjs +1 -6
- package/esm2022/src/render3/interfaces/definition.mjs +8 -2
- package/esm2022/src/render3/interfaces/node.mjs +1 -1
- package/esm2022/src/render3/interfaces/view.mjs +1 -1
- package/esm2022/src/render3/jit/environment.mjs +3 -1
- package/esm2022/src/render3/node_manipulation.mjs +8 -8
- package/esm2022/src/render3/reactivity/effect.mjs +8 -6
- package/esm2022/src/render3/reactivity/signal.mjs +1 -1
- package/esm2022/src/render3/styling/style_binding_list.mjs +4 -4
- package/esm2022/src/render3/util/discovery_utils.mjs +37 -5
- package/esm2022/src/render3/util/global_utils.mjs +28 -28
- package/esm2022/src/render3/util/injector_discovery_utils.mjs +1 -1
- package/esm2022/src/render3/util/injector_utils.mjs +6 -5
- package/esm2022/src/render3/util/view_traversal_utils.mjs +3 -12
- package/esm2022/src/render3/util/view_utils.mjs +36 -19
- package/esm2022/src/render3/view_ref.mjs +2 -1
- package/esm2022/src/testability/testability.mjs +3 -15
- package/esm2022/src/util/empty.mjs +1 -1
- package/esm2022/src/version.mjs +6 -5
- package/esm2022/src/zone/ng_zone.mjs +1 -61
- package/esm2022/testing/src/component_fixture.mjs +62 -58
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +699 -542
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +2 -10
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +62 -58
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +677 -252
- package/package.json +1 -1
- package/primitives/signals/index.d.ts +3 -4
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/block-template-entities/bundle.js +497 -392
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +663 -459
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +816 -616
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +6 -2
- package/esm2022/src/change_detection/scheduling.mjs +0 -103
- package/esm2022/src/initial_render_pending_tasks.mjs +0 -49
|
@@ -694,6 +694,12 @@ var ChangeDetectionStrategy;
|
|
|
694
694
|
ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush";
|
|
695
695
|
ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default";
|
|
696
696
|
})(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
|
|
697
|
+
var InputFlags;
|
|
698
|
+
(function(InputFlags2) {
|
|
699
|
+
InputFlags2[InputFlags2["None"] = 0] = "None";
|
|
700
|
+
InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased";
|
|
701
|
+
InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
|
|
702
|
+
})(InputFlags || (InputFlags = {}));
|
|
697
703
|
var CUSTOM_ELEMENTS_SCHEMA = {
|
|
698
704
|
name: "custom-elements"
|
|
699
705
|
};
|
|
@@ -1172,12 +1178,13 @@ var BinaryOperator;
|
|
|
1172
1178
|
BinaryOperator2[BinaryOperator2["Modulo"] = 8] = "Modulo";
|
|
1173
1179
|
BinaryOperator2[BinaryOperator2["And"] = 9] = "And";
|
|
1174
1180
|
BinaryOperator2[BinaryOperator2["Or"] = 10] = "Or";
|
|
1175
|
-
BinaryOperator2[BinaryOperator2["
|
|
1176
|
-
BinaryOperator2[BinaryOperator2["
|
|
1177
|
-
BinaryOperator2[BinaryOperator2["
|
|
1178
|
-
BinaryOperator2[BinaryOperator2["
|
|
1179
|
-
BinaryOperator2[BinaryOperator2["
|
|
1180
|
-
BinaryOperator2[BinaryOperator2["
|
|
1181
|
+
BinaryOperator2[BinaryOperator2["BitwiseOr"] = 11] = "BitwiseOr";
|
|
1182
|
+
BinaryOperator2[BinaryOperator2["BitwiseAnd"] = 12] = "BitwiseAnd";
|
|
1183
|
+
BinaryOperator2[BinaryOperator2["Lower"] = 13] = "Lower";
|
|
1184
|
+
BinaryOperator2[BinaryOperator2["LowerEquals"] = 14] = "LowerEquals";
|
|
1185
|
+
BinaryOperator2[BinaryOperator2["Bigger"] = 15] = "Bigger";
|
|
1186
|
+
BinaryOperator2[BinaryOperator2["BiggerEquals"] = 16] = "BiggerEquals";
|
|
1187
|
+
BinaryOperator2[BinaryOperator2["NullishCoalesce"] = 17] = "NullishCoalesce";
|
|
1181
1188
|
})(BinaryOperator || (BinaryOperator = {}));
|
|
1182
1189
|
function nullSafeIsEquivalent(base, other) {
|
|
1183
1190
|
if (base == null || other == null) {
|
|
@@ -1250,6 +1257,9 @@ var Expression = class {
|
|
|
1250
1257
|
and(rhs, sourceSpan) {
|
|
1251
1258
|
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
|
|
1252
1259
|
}
|
|
1260
|
+
bitwiseOr(rhs, sourceSpan, parens = true) {
|
|
1261
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan, parens);
|
|
1262
|
+
}
|
|
1253
1263
|
bitwiseAnd(rhs, sourceSpan, parens = true) {
|
|
1254
1264
|
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens);
|
|
1255
1265
|
}
|
|
@@ -2369,7 +2379,7 @@ var ConstantPool = class {
|
|
|
2369
2379
|
}))));
|
|
2370
2380
|
}
|
|
2371
2381
|
}
|
|
2372
|
-
getSharedFunctionReference(fn2, prefix) {
|
|
2382
|
+
getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
|
|
2373
2383
|
var _a2;
|
|
2374
2384
|
const isArrow = fn2 instanceof ArrowFunctionExpr;
|
|
2375
2385
|
for (const current of this.statements) {
|
|
@@ -2380,7 +2390,7 @@ var ConstantPool = class {
|
|
|
2380
2390
|
return variable(current.name);
|
|
2381
2391
|
}
|
|
2382
2392
|
}
|
|
2383
|
-
const name = this.uniqueName(prefix);
|
|
2393
|
+
const name = useUniqueName ? this.uniqueName(prefix) : prefix;
|
|
2384
2394
|
this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
|
|
2385
2395
|
return variable(name);
|
|
2386
2396
|
}
|
|
@@ -3054,6 +3064,12 @@ var Identifiers = _Identifiers;
|
|
|
3054
3064
|
moduleName: CORE
|
|
3055
3065
|
};
|
|
3056
3066
|
})();
|
|
3067
|
+
(() => {
|
|
3068
|
+
_Identifiers.InputFlags = {
|
|
3069
|
+
name: "\u0275\u0275InputFlags",
|
|
3070
|
+
moduleName: CORE
|
|
3071
|
+
};
|
|
3072
|
+
})();
|
|
3057
3073
|
(() => {
|
|
3058
3074
|
_Identifiers.sanitizeHtml = { name: "\u0275\u0275sanitizeHtml", moduleName: CORE };
|
|
3059
3075
|
})();
|
|
@@ -3653,6 +3669,9 @@ var AbstractEmitterVisitor = class {
|
|
|
3653
3669
|
case BinaryOperator.And:
|
|
3654
3670
|
opStr = "&&";
|
|
3655
3671
|
break;
|
|
3672
|
+
case BinaryOperator.BitwiseOr:
|
|
3673
|
+
opStr = "|";
|
|
3674
|
+
break;
|
|
3656
3675
|
case BinaryOperator.BitwiseAnd:
|
|
3657
3676
|
opStr = "&";
|
|
3658
3677
|
break;
|
|
@@ -4010,13 +4029,17 @@ var TagContentType;
|
|
|
4010
4029
|
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
4011
4030
|
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
4012
4031
|
})(TagContentType || (TagContentType = {}));
|
|
4013
|
-
function splitNsName(elementName) {
|
|
4032
|
+
function splitNsName(elementName, fatal = true) {
|
|
4014
4033
|
if (elementName[0] != ":") {
|
|
4015
4034
|
return [null, elementName];
|
|
4016
4035
|
}
|
|
4017
4036
|
const colonIndex = elementName.indexOf(":", 1);
|
|
4018
4037
|
if (colonIndex === -1) {
|
|
4019
|
-
|
|
4038
|
+
if (fatal) {
|
|
4039
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
4040
|
+
} else {
|
|
4041
|
+
return [null, elementName];
|
|
4042
|
+
}
|
|
4020
4043
|
}
|
|
4021
4044
|
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
4022
4045
|
}
|
|
@@ -5166,7 +5189,7 @@ function asLiteral(value) {
|
|
|
5166
5189
|
}
|
|
5167
5190
|
return literal(value, INFERRED_TYPE);
|
|
5168
5191
|
}
|
|
5169
|
-
function conditionallyCreateDirectiveBindingLiteral(map,
|
|
5192
|
+
function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
|
|
5170
5193
|
const keys = Object.getOwnPropertyNames(map);
|
|
5171
5194
|
if (keys.length === 0) {
|
|
5172
5195
|
return null;
|
|
@@ -5186,12 +5209,25 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
|
|
|
5186
5209
|
minifiedName = key;
|
|
5187
5210
|
declaredName = value.classPropertyName;
|
|
5188
5211
|
publicName = value.bindingPropertyName;
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5212
|
+
const differentDeclaringName = publicName !== declaredName;
|
|
5213
|
+
const hasDecoratorInputTransform = value.transformFunction !== null;
|
|
5214
|
+
let flags = null;
|
|
5215
|
+
if (value.isSignal) {
|
|
5216
|
+
flags = bitwiseOrInputFlagsExpr(InputFlags.SignalBased, flags);
|
|
5217
|
+
}
|
|
5218
|
+
if (hasDecoratorInputTransform) {
|
|
5219
|
+
flags = bitwiseOrInputFlagsExpr(InputFlags.HasDecoratorInputTransform, flags);
|
|
5220
|
+
}
|
|
5221
|
+
if (forInputs && (differentDeclaringName || hasDecoratorInputTransform || flags !== null)) {
|
|
5222
|
+
const flagsExpr = flags != null ? flags : importExpr(Identifiers.InputFlags).prop(InputFlags[InputFlags.None]);
|
|
5223
|
+
const result = [flagsExpr, asLiteral(publicName)];
|
|
5224
|
+
if (differentDeclaringName || hasDecoratorInputTransform) {
|
|
5225
|
+
result.push(asLiteral(declaredName));
|
|
5226
|
+
if (hasDecoratorInputTransform) {
|
|
5227
|
+
result.push(value.transformFunction);
|
|
5228
|
+
}
|
|
5193
5229
|
}
|
|
5194
|
-
expressionValue = literalArr(
|
|
5230
|
+
expressionValue = literalArr(result);
|
|
5195
5231
|
} else {
|
|
5196
5232
|
expressionValue = asLiteral(publicName);
|
|
5197
5233
|
}
|
|
@@ -5203,6 +5239,15 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
|
|
|
5203
5239
|
};
|
|
5204
5240
|
}));
|
|
5205
5241
|
}
|
|
5242
|
+
function getInputFlagExpr(flag) {
|
|
5243
|
+
return importExpr(Identifiers.InputFlags).prop(InputFlags[flag]);
|
|
5244
|
+
}
|
|
5245
|
+
function bitwiseOrInputFlagsExpr(flag, expr) {
|
|
5246
|
+
if (expr === null) {
|
|
5247
|
+
return getInputFlagExpr(flag);
|
|
5248
|
+
}
|
|
5249
|
+
return getInputFlagExpr(flag).bitwiseOr(expr);
|
|
5250
|
+
}
|
|
5206
5251
|
function trimTrailingNulls(parameters) {
|
|
5207
5252
|
while (isNull(parameters[parameters.length - 1])) {
|
|
5208
5253
|
parameters.pop();
|
|
@@ -7978,8 +8023,9 @@ var OpKind;
|
|
|
7978
8023
|
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
7979
8024
|
OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
|
|
7980
8025
|
OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
|
|
7981
|
-
OpKind2[OpKind2["
|
|
7982
|
-
OpKind2[OpKind2["
|
|
8026
|
+
OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
|
|
8027
|
+
OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
|
|
8028
|
+
OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
|
|
7983
8029
|
})(OpKind || (OpKind = {}));
|
|
7984
8030
|
var ExpressionKind;
|
|
7985
8031
|
(function(ExpressionKind2) {
|
|
@@ -8077,13 +8123,6 @@ var DeferTriggerKind;
|
|
|
8077
8123
|
DeferTriggerKind2[DeferTriggerKind2["Interaction"] = 4] = "Interaction";
|
|
8078
8124
|
DeferTriggerKind2[DeferTriggerKind2["Viewport"] = 5] = "Viewport";
|
|
8079
8125
|
})(DeferTriggerKind || (DeferTriggerKind = {}));
|
|
8080
|
-
var DerivedRepeaterVarIdentity;
|
|
8081
|
-
(function(DerivedRepeaterVarIdentity2) {
|
|
8082
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["First"] = 0] = "First";
|
|
8083
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Last"] = 1] = "Last";
|
|
8084
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Even"] = 2] = "Even";
|
|
8085
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Odd"] = 3] = "Odd";
|
|
8086
|
-
})(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
|
|
8087
8126
|
var I18nContextKind;
|
|
8088
8127
|
(function(I18nContextKind2) {
|
|
8089
8128
|
I18nContextKind2[I18nContextKind2["RootI18n"] = 0] = "RootI18n";
|
|
@@ -8238,10 +8277,11 @@ function createClassMapOp(xref, expression, sourceSpan) {
|
|
|
8238
8277
|
sourceSpan
|
|
8239
8278
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
8240
8279
|
}
|
|
8241
|
-
function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
8280
|
+
function createAttributeOp(target, namespace, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
8242
8281
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8243
8282
|
kind: OpKind.Attribute,
|
|
8244
8283
|
target,
|
|
8284
|
+
namespace,
|
|
8245
8285
|
name,
|
|
8246
8286
|
expression,
|
|
8247
8287
|
securityContext,
|
|
@@ -8283,15 +8323,15 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
|
8283
8323
|
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
8284
8324
|
}
|
|
8285
8325
|
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
8286
|
-
return __spreadValues(__spreadValues({
|
|
8326
|
+
return __spreadValues(__spreadValues(__spreadValues({
|
|
8287
8327
|
kind: OpKind.DeferWhen,
|
|
8288
8328
|
target,
|
|
8289
8329
|
expr,
|
|
8290
8330
|
prefetch,
|
|
8291
8331
|
sourceSpan
|
|
8292
|
-
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
8332
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
|
|
8293
8333
|
}
|
|
8294
|
-
function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
|
|
8334
|
+
function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
|
|
8295
8335
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8296
8336
|
kind: OpKind.I18nExpression,
|
|
8297
8337
|
context,
|
|
@@ -8299,6 +8339,7 @@ function createI18nExpressionOp(context, target, i18nOwner, handle, expression,
|
|
|
8299
8339
|
i18nOwner,
|
|
8300
8340
|
handle,
|
|
8301
8341
|
expression,
|
|
8342
|
+
icuPlaceholder,
|
|
8302
8343
|
i18nPlaceholder,
|
|
8303
8344
|
resolutionTime,
|
|
8304
8345
|
usage,
|
|
@@ -8895,27 +8936,6 @@ var ConditionalCaseExpr = class extends ExpressionBase {
|
|
|
8895
8936
|
}
|
|
8896
8937
|
}
|
|
8897
8938
|
};
|
|
8898
|
-
var DerivedRepeaterVarExpr = class extends ExpressionBase {
|
|
8899
|
-
constructor(xref, identity) {
|
|
8900
|
-
super();
|
|
8901
|
-
this.xref = xref;
|
|
8902
|
-
this.identity = identity;
|
|
8903
|
-
this.kind = ExpressionKind.DerivedRepeaterVar;
|
|
8904
|
-
}
|
|
8905
|
-
transformInternalExpressions(transform2, flags) {
|
|
8906
|
-
}
|
|
8907
|
-
visitExpression(visitor, context) {
|
|
8908
|
-
}
|
|
8909
|
-
isEquivalent(e) {
|
|
8910
|
-
return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity && e.xref === this.xref;
|
|
8911
|
-
}
|
|
8912
|
-
isConstant() {
|
|
8913
|
-
return false;
|
|
8914
|
-
}
|
|
8915
|
-
clone() {
|
|
8916
|
-
return new DerivedRepeaterVarExpr(this.xref, this.identity);
|
|
8917
|
-
}
|
|
8918
|
-
};
|
|
8919
8939
|
var ConstCollectedExpr = class extends ExpressionBase {
|
|
8920
8940
|
constructor(expr) {
|
|
8921
8941
|
super();
|
|
@@ -9031,6 +9051,9 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9031
9051
|
if (op.placeholderConfig !== null) {
|
|
9032
9052
|
op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
|
|
9033
9053
|
}
|
|
9054
|
+
if (op.resolverFn !== null) {
|
|
9055
|
+
op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
|
|
9056
|
+
}
|
|
9034
9057
|
break;
|
|
9035
9058
|
case OpKind.I18nMessage:
|
|
9036
9059
|
for (const [placeholder, expr] of op.params) {
|
|
@@ -9067,6 +9090,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9067
9090
|
case OpKind.Template:
|
|
9068
9091
|
case OpKind.Text:
|
|
9069
9092
|
case OpKind.I18nAttributes:
|
|
9093
|
+
case OpKind.IcuPlaceholder:
|
|
9070
9094
|
break;
|
|
9071
9095
|
default:
|
|
9072
9096
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
@@ -9124,6 +9148,14 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9124
9148
|
} else if (expr instanceof TaggedTemplateExpr) {
|
|
9125
9149
|
expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
|
|
9126
9150
|
expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
|
|
9151
|
+
} else if (expr instanceof ArrowFunctionExpr) {
|
|
9152
|
+
if (Array.isArray(expr.body)) {
|
|
9153
|
+
for (let i = 0; i < expr.body.length; i++) {
|
|
9154
|
+
transformExpressionsInStatement(expr.body[i], transform2, flags);
|
|
9155
|
+
}
|
|
9156
|
+
} else {
|
|
9157
|
+
expr.body = transformExpressionsInExpression(expr.body, transform2, flags);
|
|
9158
|
+
}
|
|
9127
9159
|
} else if (expr instanceof WrappedNodeExpr) {
|
|
9128
9160
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
9129
9161
|
} else {
|
|
@@ -9366,7 +9398,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
|
|
|
9366
9398
|
function isElementOrContainerOp(op) {
|
|
9367
9399
|
return elementContainerOpKinds.has(op.kind);
|
|
9368
9400
|
}
|
|
9369
|
-
function createElementStartOp(tag, xref, namespace, i18nPlaceholder,
|
|
9401
|
+
function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
9370
9402
|
return __spreadValues(__spreadValues({
|
|
9371
9403
|
kind: OpKind.ElementStart,
|
|
9372
9404
|
xref,
|
|
@@ -9377,10 +9409,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
|
|
|
9377
9409
|
nonBindable: false,
|
|
9378
9410
|
namespace,
|
|
9379
9411
|
i18nPlaceholder,
|
|
9380
|
-
|
|
9412
|
+
startSourceSpan,
|
|
9413
|
+
wholeSourceSpan
|
|
9381
9414
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
9382
9415
|
}
|
|
9383
|
-
function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder,
|
|
9416
|
+
function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
9384
9417
|
return __spreadValues(__spreadValues({
|
|
9385
9418
|
kind: OpKind.Template,
|
|
9386
9419
|
xref,
|
|
@@ -9395,11 +9428,12 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
|
|
|
9395
9428
|
nonBindable: false,
|
|
9396
9429
|
namespace,
|
|
9397
9430
|
i18nPlaceholder,
|
|
9398
|
-
|
|
9431
|
+
startSourceSpan,
|
|
9432
|
+
wholeSourceSpan
|
|
9399
9433
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
9400
9434
|
}
|
|
9401
|
-
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder,
|
|
9402
|
-
return __spreadProps(__spreadValues(__spreadValues({
|
|
9435
|
+
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
9436
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
9403
9437
|
kind: OpKind.RepeaterCreate,
|
|
9404
9438
|
attributes: null,
|
|
9405
9439
|
xref: primaryView,
|
|
@@ -9408,6 +9442,8 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i1
|
|
|
9408
9442
|
track,
|
|
9409
9443
|
trackByFn: null,
|
|
9410
9444
|
tag,
|
|
9445
|
+
emptyTag,
|
|
9446
|
+
emptyAttributes: null,
|
|
9411
9447
|
functionNameSuffix: "For",
|
|
9412
9448
|
namespace: Namespace.HTML,
|
|
9413
9449
|
nonBindable: false,
|
|
@@ -9418,8 +9454,9 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i1
|
|
|
9418
9454
|
usesComponentInstance: false,
|
|
9419
9455
|
i18nPlaceholder,
|
|
9420
9456
|
emptyI18nPlaceholder,
|
|
9421
|
-
|
|
9422
|
-
|
|
9457
|
+
startSourceSpan,
|
|
9458
|
+
wholeSourceSpan
|
|
9459
|
+
}, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
|
|
9423
9460
|
numSlotsUsed: emptyView === null ? 2 : 3
|
|
9424
9461
|
});
|
|
9425
9462
|
}
|
|
@@ -9442,12 +9479,13 @@ function createEnableBindingsOp(xref) {
|
|
|
9442
9479
|
xref
|
|
9443
9480
|
}, NEW_OP);
|
|
9444
9481
|
}
|
|
9445
|
-
function createTextOp(xref, initialValue, sourceSpan) {
|
|
9482
|
+
function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
|
|
9446
9483
|
return __spreadValues(__spreadValues({
|
|
9447
9484
|
kind: OpKind.Text,
|
|
9448
9485
|
xref,
|
|
9449
9486
|
handle: new SlotHandle(),
|
|
9450
9487
|
initialValue,
|
|
9488
|
+
icuPlaceholder,
|
|
9451
9489
|
sourceSpan
|
|
9452
9490
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
9453
9491
|
}
|
|
@@ -9490,7 +9528,7 @@ function createProjectionDefOp(def) {
|
|
|
9490
9528
|
def
|
|
9491
9529
|
}, NEW_OP);
|
|
9492
9530
|
}
|
|
9493
|
-
function createProjectionOp(xref, selector, i18nPlaceholder,
|
|
9531
|
+
function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
|
|
9494
9532
|
return __spreadValues(__spreadValues({
|
|
9495
9533
|
kind: OpKind.Projection,
|
|
9496
9534
|
xref,
|
|
@@ -9498,16 +9536,17 @@ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceS
|
|
|
9498
9536
|
selector,
|
|
9499
9537
|
i18nPlaceholder,
|
|
9500
9538
|
projectionSlotIndex: 0,
|
|
9501
|
-
attributes,
|
|
9539
|
+
attributes: null,
|
|
9502
9540
|
localRefs: [],
|
|
9503
9541
|
sourceSpan
|
|
9504
9542
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
9505
9543
|
}
|
|
9506
|
-
function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
9544
|
+
function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
9507
9545
|
return __spreadValues({
|
|
9508
9546
|
kind: OpKind.ExtractedAttribute,
|
|
9509
9547
|
target,
|
|
9510
9548
|
bindingKind,
|
|
9549
|
+
namespace,
|
|
9511
9550
|
name,
|
|
9512
9551
|
expression,
|
|
9513
9552
|
i18nContext,
|
|
@@ -9564,7 +9603,7 @@ function createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlace
|
|
|
9564
9603
|
subMessages: []
|
|
9565
9604
|
}, NEW_OP);
|
|
9566
9605
|
}
|
|
9567
|
-
function createI18nStartOp(xref, message, root) {
|
|
9606
|
+
function createI18nStartOp(xref, message, root, sourceSpan) {
|
|
9568
9607
|
return __spreadValues(__spreadValues({
|
|
9569
9608
|
kind: OpKind.I18nStart,
|
|
9570
9609
|
xref,
|
|
@@ -9573,13 +9612,15 @@ function createI18nStartOp(xref, message, root) {
|
|
|
9573
9612
|
message,
|
|
9574
9613
|
messageIndex: null,
|
|
9575
9614
|
subTemplateIndex: null,
|
|
9576
|
-
context: null
|
|
9615
|
+
context: null,
|
|
9616
|
+
sourceSpan
|
|
9577
9617
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
9578
9618
|
}
|
|
9579
|
-
function createI18nEndOp(xref) {
|
|
9619
|
+
function createI18nEndOp(xref, sourceSpan) {
|
|
9580
9620
|
return __spreadValues({
|
|
9581
9621
|
kind: OpKind.I18nEnd,
|
|
9582
|
-
xref
|
|
9622
|
+
xref,
|
|
9623
|
+
sourceSpan
|
|
9583
9624
|
}, NEW_OP);
|
|
9584
9625
|
}
|
|
9585
9626
|
function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
|
|
@@ -9598,6 +9639,15 @@ function createIcuEndOp(xref) {
|
|
|
9598
9639
|
xref
|
|
9599
9640
|
}, NEW_OP);
|
|
9600
9641
|
}
|
|
9642
|
+
function createIcuPlaceholderOp(xref, name, strings) {
|
|
9643
|
+
return __spreadValues({
|
|
9644
|
+
kind: OpKind.IcuPlaceholder,
|
|
9645
|
+
xref,
|
|
9646
|
+
name,
|
|
9647
|
+
strings,
|
|
9648
|
+
expressionPlaceholders: []
|
|
9649
|
+
}, NEW_OP);
|
|
9650
|
+
}
|
|
9601
9651
|
function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
|
|
9602
9652
|
if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
|
|
9603
9653
|
throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
|
|
@@ -9861,6 +9911,9 @@ function createOpXrefMap(unit) {
|
|
|
9861
9911
|
continue;
|
|
9862
9912
|
}
|
|
9863
9913
|
map.set(op.xref, op);
|
|
9914
|
+
if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
|
|
9915
|
+
map.set(op.emptyView, op);
|
|
9916
|
+
}
|
|
9864
9917
|
}
|
|
9865
9918
|
return map;
|
|
9866
9919
|
}
|
|
@@ -9888,6 +9941,7 @@ function extractAttributes(job) {
|
|
|
9888
9941
|
createExtractedAttributeOp(
|
|
9889
9942
|
op.target,
|
|
9890
9943
|
bindingKind,
|
|
9944
|
+
null,
|
|
9891
9945
|
op.name,
|
|
9892
9946
|
null,
|
|
9893
9947
|
null,
|
|
@@ -9904,6 +9958,7 @@ function extractAttributes(job) {
|
|
|
9904
9958
|
OpList.insertBefore(createExtractedAttributeOp(
|
|
9905
9959
|
op.target,
|
|
9906
9960
|
BindingKind.Property,
|
|
9961
|
+
null,
|
|
9907
9962
|
op.name,
|
|
9908
9963
|
null,
|
|
9909
9964
|
null,
|
|
@@ -9917,6 +9972,7 @@ function extractAttributes(job) {
|
|
|
9917
9972
|
const extractedAttributeOp = createExtractedAttributeOp(
|
|
9918
9973
|
op.target,
|
|
9919
9974
|
BindingKind.Property,
|
|
9975
|
+
null,
|
|
9920
9976
|
op.name,
|
|
9921
9977
|
null,
|
|
9922
9978
|
null,
|
|
@@ -9924,6 +9980,9 @@ function extractAttributes(job) {
|
|
|
9924
9980
|
SecurityContext.NONE
|
|
9925
9981
|
);
|
|
9926
9982
|
if (job.kind === CompilationJobKind.Host) {
|
|
9983
|
+
if (job.compatibility) {
|
|
9984
|
+
break;
|
|
9985
|
+
}
|
|
9927
9986
|
unit.create.push(extractedAttributeOp);
|
|
9928
9987
|
} else {
|
|
9929
9988
|
OpList.insertBefore(extractedAttributeOp, lookupElement(elements, op.target));
|
|
@@ -9945,18 +10004,12 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
9945
10004
|
if (op.expression instanceof Interpolation2) {
|
|
9946
10005
|
return;
|
|
9947
10006
|
}
|
|
9948
|
-
let extractable = op.expression.isConstant();
|
|
10007
|
+
let extractable = op.isTextAttribute || op.expression.isConstant();
|
|
9949
10008
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
9950
|
-
extractable =
|
|
9951
|
-
if (op.name === "style" || op.name === "class") {
|
|
9952
|
-
extractable && (extractable = op.isTextAttribute);
|
|
9953
|
-
}
|
|
9954
|
-
if (unit.job.kind === CompilationJobKind.Host) {
|
|
9955
|
-
extractable && (extractable = op.isTextAttribute);
|
|
9956
|
-
}
|
|
10009
|
+
extractable && (extractable = op.isTextAttribute);
|
|
9957
10010
|
}
|
|
9958
10011
|
if (extractable) {
|
|
9959
|
-
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
10012
|
+
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
9960
10013
|
if (unit.job.kind === CompilationJobKind.Host) {
|
|
9961
10014
|
unit.create.push(extractedAttributeOp);
|
|
9962
10015
|
} else {
|
|
@@ -9997,7 +10050,8 @@ function specializeBindings(job) {
|
|
|
9997
10050
|
const target = lookupElement2(elements, op.target);
|
|
9998
10051
|
target.nonBindable = true;
|
|
9999
10052
|
} else {
|
|
10000
|
-
|
|
10053
|
+
const [namespace, name] = splitNsName(op.name);
|
|
10054
|
+
OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
10001
10055
|
}
|
|
10002
10056
|
break;
|
|
10003
10057
|
case BindingKind.Property:
|
|
@@ -10137,6 +10191,7 @@ var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
|
10137
10191
|
["&&", BinaryOperator.And],
|
|
10138
10192
|
[">", BinaryOperator.Bigger],
|
|
10139
10193
|
[">=", BinaryOperator.BiggerEquals],
|
|
10194
|
+
["|", BinaryOperator.BitwiseOr],
|
|
10140
10195
|
["&", BinaryOperator.BitwiseAnd],
|
|
10141
10196
|
["/", BinaryOperator.Divide],
|
|
10142
10197
|
["==", BinaryOperator.Equals],
|
|
@@ -10188,9 +10243,9 @@ function collectElementConsts(job) {
|
|
|
10188
10243
|
for (const unit of job.units) {
|
|
10189
10244
|
for (const op of unit.create) {
|
|
10190
10245
|
if (op.kind === OpKind.ExtractedAttribute) {
|
|
10191
|
-
const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
|
|
10246
|
+
const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
|
|
10192
10247
|
allElementAttributes.set(op.target, attributes);
|
|
10193
|
-
attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
|
|
10248
|
+
attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);
|
|
10194
10249
|
OpList.remove(op);
|
|
10195
10250
|
}
|
|
10196
10251
|
}
|
|
@@ -10198,14 +10253,19 @@ function collectElementConsts(job) {
|
|
|
10198
10253
|
if (job instanceof ComponentCompilationJob) {
|
|
10199
10254
|
for (const unit of job.units) {
|
|
10200
10255
|
for (const op of unit.create) {
|
|
10201
|
-
if (
|
|
10256
|
+
if (op.kind == OpKind.Projection) {
|
|
10202
10257
|
const attributes = allElementAttributes.get(op.xref);
|
|
10203
10258
|
if (attributes !== void 0) {
|
|
10204
10259
|
const attrArray = serializeAttributes(attributes);
|
|
10205
10260
|
if (attrArray.entries.length > 0) {
|
|
10206
|
-
op.attributes =
|
|
10261
|
+
op.attributes = attrArray;
|
|
10207
10262
|
}
|
|
10208
10263
|
}
|
|
10264
|
+
} else if (isElementOrContainerOp(op)) {
|
|
10265
|
+
op.attributes = getConstIndex(job, allElementAttributes, op.xref);
|
|
10266
|
+
if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
|
|
10267
|
+
op.emptyAttributes = getConstIndex(job, allElementAttributes, op.emptyView);
|
|
10268
|
+
}
|
|
10209
10269
|
}
|
|
10210
10270
|
}
|
|
10211
10271
|
}
|
|
@@ -10221,13 +10281,18 @@ function collectElementConsts(job) {
|
|
|
10221
10281
|
}
|
|
10222
10282
|
}
|
|
10223
10283
|
}
|
|
10284
|
+
function getConstIndex(job, allElementAttributes, xref) {
|
|
10285
|
+
const attributes = allElementAttributes.get(xref);
|
|
10286
|
+
if (attributes !== void 0) {
|
|
10287
|
+
const attrArray = serializeAttributes(attributes);
|
|
10288
|
+
if (attrArray.entries.length > 0) {
|
|
10289
|
+
return job.addConst(attrArray);
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
return null;
|
|
10293
|
+
}
|
|
10224
10294
|
var FLYWEIGHT_ARRAY = Object.freeze([]);
|
|
10225
10295
|
var ElementAttributes = class {
|
|
10226
|
-
constructor() {
|
|
10227
|
-
this.known = /* @__PURE__ */ new Set();
|
|
10228
|
-
this.byKind = /* @__PURE__ */ new Map();
|
|
10229
|
-
this.projectAs = null;
|
|
10230
|
-
}
|
|
10231
10296
|
get attributes() {
|
|
10232
10297
|
var _a2;
|
|
10233
10298
|
return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
@@ -10252,12 +10317,28 @@ var ElementAttributes = class {
|
|
|
10252
10317
|
var _a2;
|
|
10253
10318
|
return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
10254
10319
|
}
|
|
10255
|
-
|
|
10320
|
+
constructor(compatibility) {
|
|
10321
|
+
this.compatibility = compatibility;
|
|
10322
|
+
this.known = /* @__PURE__ */ new Map();
|
|
10323
|
+
this.byKind = /* @__PURE__ */ new Map();
|
|
10324
|
+
this.projectAs = null;
|
|
10325
|
+
}
|
|
10326
|
+
isKnown(kind, name, value) {
|
|
10256
10327
|
var _a2;
|
|
10257
|
-
|
|
10328
|
+
const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
|
|
10329
|
+
this.known.set(kind, nameToValue);
|
|
10330
|
+
if (nameToValue.has(name)) {
|
|
10331
|
+
return true;
|
|
10332
|
+
}
|
|
10333
|
+
nameToValue.add(name);
|
|
10334
|
+
return false;
|
|
10335
|
+
}
|
|
10336
|
+
add(kind, name, value, namespace, trustedValueFn) {
|
|
10337
|
+
var _a2;
|
|
10338
|
+
const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
|
|
10339
|
+
if (!allowDuplicates && this.isKnown(kind, name, value)) {
|
|
10258
10340
|
return;
|
|
10259
10341
|
}
|
|
10260
|
-
this.known.add(name);
|
|
10261
10342
|
if (name === "ngProjectAs") {
|
|
10262
10343
|
if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
|
|
10263
10344
|
throw Error("ngProjectAs must have a string literal value");
|
|
@@ -10265,7 +10346,7 @@ var ElementAttributes = class {
|
|
|
10265
10346
|
this.projectAs = value.value.toString();
|
|
10266
10347
|
}
|
|
10267
10348
|
const array = this.arrayFor(kind);
|
|
10268
|
-
array.push(...getAttributeNameLiterals(name));
|
|
10349
|
+
array.push(...getAttributeNameLiterals(namespace, name));
|
|
10269
10350
|
if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
|
|
10270
10351
|
if (value === null) {
|
|
10271
10352
|
throw Error("Attribute, i18n attribute, & style element attributes must have a value");
|
|
@@ -10287,15 +10368,10 @@ var ElementAttributes = class {
|
|
|
10287
10368
|
return this.byKind.get(kind);
|
|
10288
10369
|
}
|
|
10289
10370
|
};
|
|
10290
|
-
function getAttributeNameLiterals(name) {
|
|
10291
|
-
const
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
return [
|
|
10295
|
-
literal(0),
|
|
10296
|
-
literal(attributeNamespace),
|
|
10297
|
-
nameLiteral
|
|
10298
|
-
];
|
|
10371
|
+
function getAttributeNameLiterals(namespace, name) {
|
|
10372
|
+
const nameLiteral = literal(name);
|
|
10373
|
+
if (namespace) {
|
|
10374
|
+
return [literal(0), literal(namespace), nameLiteral];
|
|
10299
10375
|
}
|
|
10300
10376
|
return [nameLiteral];
|
|
10301
10377
|
}
|
|
@@ -10355,7 +10431,7 @@ function convertI18nBindings(job) {
|
|
|
10355
10431
|
if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
|
|
10356
10432
|
throw new Error(`AssertionError: An i18n attribute binding instruction requires the same number of expressions and placeholders, but found ${op.expression.i18nPlaceholders.length} placeholders and ${op.expression.expressions.length} expressions`);
|
|
10357
10433
|
}
|
|
10358
|
-
ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
|
|
10434
|
+
ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, null, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
|
|
10359
10435
|
}
|
|
10360
10436
|
OpList.replaceWithMany(op, ops);
|
|
10361
10437
|
break;
|
|
@@ -10386,7 +10462,11 @@ function createDeferDepsFns(job) {
|
|
|
10386
10462
|
if (op.handle.slot === null) {
|
|
10387
10463
|
throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
|
|
10388
10464
|
}
|
|
10389
|
-
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
10465
|
+
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
10466
|
+
depsFnExpr,
|
|
10467
|
+
`${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
|
|
10468
|
+
false
|
|
10469
|
+
);
|
|
10390
10470
|
}
|
|
10391
10471
|
}
|
|
10392
10472
|
}
|
|
@@ -10394,62 +10474,99 @@ function createDeferDepsFns(job) {
|
|
|
10394
10474
|
|
|
10395
10475
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
|
|
10396
10476
|
function createI18nContexts(job) {
|
|
10397
|
-
const
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10477
|
+
const attrContextByMessage = /* @__PURE__ */ new Map();
|
|
10478
|
+
for (const unit of job.units) {
|
|
10479
|
+
for (const op of unit.ops()) {
|
|
10480
|
+
switch (op.kind) {
|
|
10481
|
+
case OpKind.Binding:
|
|
10482
|
+
case OpKind.Property:
|
|
10483
|
+
case OpKind.Attribute:
|
|
10484
|
+
case OpKind.ExtractedAttribute:
|
|
10485
|
+
if (op.i18nMessage === null) {
|
|
10486
|
+
continue;
|
|
10487
|
+
}
|
|
10488
|
+
if (!attrContextByMessage.has(op.i18nMessage)) {
|
|
10489
|
+
const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
|
|
10490
|
+
unit.create.push(i18nContext);
|
|
10491
|
+
attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
|
|
10492
|
+
}
|
|
10493
|
+
op.i18nContext = attrContextByMessage.get(op.i18nMessage);
|
|
10494
|
+
break;
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
}
|
|
10498
|
+
const blockContextByI18nBlock = /* @__PURE__ */ new Map();
|
|
10401
10499
|
for (const unit of job.units) {
|
|
10402
10500
|
for (const op of unit.create) {
|
|
10403
10501
|
switch (op.kind) {
|
|
10404
10502
|
case OpKind.I18nStart:
|
|
10405
|
-
currentI18nOp = op;
|
|
10406
10503
|
if (op.xref === op.root) {
|
|
10407
|
-
|
|
10408
|
-
unit.create.push(
|
|
10409
|
-
op.context = xref;
|
|
10410
|
-
|
|
10504
|
+
const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
|
|
10505
|
+
unit.create.push(contextOp);
|
|
10506
|
+
op.context = contextOp.xref;
|
|
10507
|
+
blockContextByI18nBlock.set(op.xref, contextOp);
|
|
10411
10508
|
}
|
|
10412
10509
|
break;
|
|
10510
|
+
}
|
|
10511
|
+
}
|
|
10512
|
+
}
|
|
10513
|
+
for (const unit of job.units) {
|
|
10514
|
+
for (const op of unit.create) {
|
|
10515
|
+
if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
|
|
10516
|
+
const rootContext = blockContextByI18nBlock.get(op.root);
|
|
10517
|
+
if (rootContext === void 0) {
|
|
10518
|
+
throw Error("AssertionError: Root i18n block i18n context should have been created.");
|
|
10519
|
+
}
|
|
10520
|
+
op.context = rootContext.xref;
|
|
10521
|
+
blockContextByI18nBlock.set(op.xref, rootContext);
|
|
10522
|
+
}
|
|
10523
|
+
}
|
|
10524
|
+
}
|
|
10525
|
+
let currentI18nOp = null;
|
|
10526
|
+
for (const unit of job.units) {
|
|
10527
|
+
for (const op of unit.create) {
|
|
10528
|
+
switch (op.kind) {
|
|
10529
|
+
case OpKind.I18nStart:
|
|
10530
|
+
currentI18nOp = op;
|
|
10531
|
+
break;
|
|
10413
10532
|
case OpKind.I18nEnd:
|
|
10414
10533
|
currentI18nOp = null;
|
|
10415
10534
|
break;
|
|
10416
10535
|
case OpKind.IcuStart:
|
|
10417
10536
|
if (currentI18nOp === null) {
|
|
10418
|
-
throw Error("Unexpected ICU outside of an i18n block.");
|
|
10537
|
+
throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
|
|
10419
10538
|
}
|
|
10420
10539
|
if (op.message.id !== currentI18nOp.message.id) {
|
|
10421
|
-
|
|
10422
|
-
unit.create.push(
|
|
10423
|
-
op.context = xref;
|
|
10540
|
+
const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
|
|
10541
|
+
unit.create.push(contextOp);
|
|
10542
|
+
op.context = contextOp.xref;
|
|
10424
10543
|
} else {
|
|
10425
10544
|
op.context = currentI18nOp.context;
|
|
10545
|
+
blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
|
|
10426
10546
|
}
|
|
10427
10547
|
break;
|
|
10428
10548
|
}
|
|
10429
10549
|
}
|
|
10430
|
-
for (const op of unit.ops()) {
|
|
10431
|
-
switch (op.kind) {
|
|
10432
|
-
case OpKind.Binding:
|
|
10433
|
-
case OpKind.Property:
|
|
10434
|
-
case OpKind.Attribute:
|
|
10435
|
-
case OpKind.ExtractedAttribute:
|
|
10436
|
-
if (!op.i18nMessage) {
|
|
10437
|
-
continue;
|
|
10438
|
-
}
|
|
10439
|
-
if (!messageToContext.has(op.i18nMessage)) {
|
|
10440
|
-
const i18nContext = job.allocateXrefId();
|
|
10441
|
-
unit.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, op.i18nMessage, null));
|
|
10442
|
-
messageToContext.set(op.i18nMessage, i18nContext);
|
|
10443
|
-
}
|
|
10444
|
-
op.i18nContext = messageToContext.get(op.i18nMessage);
|
|
10445
|
-
break;
|
|
10446
|
-
}
|
|
10447
|
-
}
|
|
10448
10550
|
}
|
|
10551
|
+
}
|
|
10552
|
+
|
|
10553
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/deduplicate_text_bindings.mjs
|
|
10554
|
+
function deduplicateTextBindings(job) {
|
|
10555
|
+
const seen = /* @__PURE__ */ new Map();
|
|
10449
10556
|
for (const unit of job.units) {
|
|
10450
|
-
for (const op of unit.
|
|
10451
|
-
if (op.kind === OpKind.
|
|
10452
|
-
|
|
10557
|
+
for (const op of unit.update.reversed()) {
|
|
10558
|
+
if (op.kind === OpKind.Binding && op.isTextAttribute) {
|
|
10559
|
+
const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
|
|
10560
|
+
if (seenForElement.has(op.name)) {
|
|
10561
|
+
if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
10562
|
+
if (op.name === "style" || op.name === "class") {
|
|
10563
|
+
OpList.remove(op);
|
|
10564
|
+
}
|
|
10565
|
+
} else {
|
|
10566
|
+
}
|
|
10567
|
+
}
|
|
10568
|
+
seenForElement.add(op.name);
|
|
10569
|
+
seen.set(op.target, seenForElement);
|
|
10453
10570
|
}
|
|
10454
10571
|
}
|
|
10455
10572
|
}
|
|
@@ -10739,12 +10856,16 @@ var LIST_START_MARKER = "[";
|
|
|
10739
10856
|
var LIST_END_MARKER = "]";
|
|
10740
10857
|
var LIST_DELIMITER = "|";
|
|
10741
10858
|
function extractI18nMessages(job) {
|
|
10742
|
-
const
|
|
10859
|
+
const i18nMessagesByContext = /* @__PURE__ */ new Map();
|
|
10743
10860
|
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
10861
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
10744
10862
|
for (const unit of job.units) {
|
|
10745
10863
|
for (const op of unit.create) {
|
|
10746
10864
|
switch (op.kind) {
|
|
10747
10865
|
case OpKind.I18nContext:
|
|
10866
|
+
const i18nMessageOp = createI18nMessage(job, op);
|
|
10867
|
+
unit.create.push(i18nMessageOp);
|
|
10868
|
+
i18nMessagesByContext.set(op.xref, i18nMessageOp);
|
|
10748
10869
|
i18nContexts.set(op.xref, op);
|
|
10749
10870
|
break;
|
|
10750
10871
|
case OpKind.I18nStart:
|
|
@@ -10753,49 +10874,40 @@ function extractI18nMessages(job) {
|
|
|
10753
10874
|
}
|
|
10754
10875
|
}
|
|
10755
10876
|
}
|
|
10756
|
-
|
|
10757
|
-
for (const op of unit.create) {
|
|
10758
|
-
if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
|
|
10759
|
-
continue;
|
|
10760
|
-
}
|
|
10761
|
-
const i18nMessageOp = createI18nMessage(job, op);
|
|
10762
|
-
unit.create.push(i18nMessageOp);
|
|
10763
|
-
}
|
|
10764
|
-
}
|
|
10765
|
-
const i18nBlockMessages = /* @__PURE__ */ new Map();
|
|
10766
|
-
for (const unit of job.units) {
|
|
10767
|
-
for (const op of unit.create) {
|
|
10768
|
-
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
10769
|
-
if (!op.context) {
|
|
10770
|
-
throw Error("I18n start op should have its context set.");
|
|
10771
|
-
}
|
|
10772
|
-
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
10773
|
-
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
10774
|
-
unit.create.push(i18nMessageOp);
|
|
10775
|
-
}
|
|
10776
|
-
}
|
|
10777
|
-
}
|
|
10877
|
+
let currentIcu = null;
|
|
10778
10878
|
for (const unit of job.units) {
|
|
10779
10879
|
for (const op of unit.create) {
|
|
10780
10880
|
switch (op.kind) {
|
|
10781
10881
|
case OpKind.IcuStart:
|
|
10782
|
-
|
|
10783
|
-
|
|
10882
|
+
currentIcu = op;
|
|
10883
|
+
OpList.remove(op);
|
|
10884
|
+
const icuContext = i18nContexts.get(op.context);
|
|
10885
|
+
if (icuContext.contextKind !== I18nContextKind.Icu) {
|
|
10886
|
+
continue;
|
|
10784
10887
|
}
|
|
10785
|
-
const
|
|
10786
|
-
if (
|
|
10787
|
-
|
|
10788
|
-
throw Error("ICU context should have its i18n block set.");
|
|
10789
|
-
}
|
|
10790
|
-
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
10791
|
-
unit.create.push(subMessage);
|
|
10792
|
-
const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
|
|
10793
|
-
const parentMessage = i18nBlockMessages.get(rootI18nId);
|
|
10794
|
-
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
10888
|
+
const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
|
|
10889
|
+
if (i18nBlock.context === icuContext.xref) {
|
|
10890
|
+
continue;
|
|
10795
10891
|
}
|
|
10796
|
-
|
|
10892
|
+
const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
|
|
10893
|
+
const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
|
|
10894
|
+
if (rootMessage === void 0) {
|
|
10895
|
+
throw Error("AssertionError: ICU sub-message should belong to a root message.");
|
|
10896
|
+
}
|
|
10897
|
+
const subMessage = i18nMessagesByContext.get(icuContext.xref);
|
|
10898
|
+
subMessage.messagePlaceholder = op.messagePlaceholder;
|
|
10899
|
+
rootMessage.subMessages.push(subMessage.xref);
|
|
10797
10900
|
break;
|
|
10798
10901
|
case OpKind.IcuEnd:
|
|
10902
|
+
currentIcu = null;
|
|
10903
|
+
OpList.remove(op);
|
|
10904
|
+
break;
|
|
10905
|
+
case OpKind.IcuPlaceholder:
|
|
10906
|
+
if (currentIcu === null || currentIcu.context == null) {
|
|
10907
|
+
throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
|
|
10908
|
+
}
|
|
10909
|
+
const msg = i18nMessagesByContext.get(currentIcu.context);
|
|
10910
|
+
msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
|
|
10799
10911
|
OpList.remove(op);
|
|
10800
10912
|
break;
|
|
10801
10913
|
}
|
|
@@ -10805,14 +10917,16 @@ function extractI18nMessages(job) {
|
|
|
10805
10917
|
function createI18nMessage(job, context, messagePlaceholder) {
|
|
10806
10918
|
let formattedParams = formatParams(context.params);
|
|
10807
10919
|
const formattedPostprocessingParams = formatParams(context.postprocessingParams);
|
|
10808
|
-
let needsPostprocessing =
|
|
10809
|
-
for (const values of context.params.values()) {
|
|
10810
|
-
if (values.length > 1) {
|
|
10811
|
-
needsPostprocessing = true;
|
|
10812
|
-
}
|
|
10813
|
-
}
|
|
10920
|
+
let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
|
|
10814
10921
|
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
10815
10922
|
}
|
|
10923
|
+
function formatIcuPlaceholder(op) {
|
|
10924
|
+
if (op.strings.length !== op.expressionPlaceholders.length + 1) {
|
|
10925
|
+
throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
|
|
10926
|
+
}
|
|
10927
|
+
const values = op.expressionPlaceholders.map(formatValue);
|
|
10928
|
+
return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
|
|
10929
|
+
}
|
|
10816
10930
|
function formatParams(params) {
|
|
10817
10931
|
const formattedParams = /* @__PURE__ */ new Map();
|
|
10818
10932
|
for (const [placeholder, placeholderValues] of params) {
|
|
@@ -11039,7 +11153,7 @@ var CLASS_BANG = "class!";
|
|
|
11039
11153
|
var BANG_IMPORTANT = "!important";
|
|
11040
11154
|
function parseHostStyleProperties(job) {
|
|
11041
11155
|
for (const op of job.root.update) {
|
|
11042
|
-
if (op.kind
|
|
11156
|
+
if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
|
|
11043
11157
|
continue;
|
|
11044
11158
|
}
|
|
11045
11159
|
if (op.name.endsWith(BANG_IMPORTANT)) {
|
|
@@ -11048,7 +11162,7 @@ function parseHostStyleProperties(job) {
|
|
|
11048
11162
|
if (op.name.startsWith(STYLE_DOT)) {
|
|
11049
11163
|
op.bindingKind = BindingKind.StyleProperty;
|
|
11050
11164
|
op.name = op.name.substring(STYLE_DOT.length);
|
|
11051
|
-
if (isCssCustomProperty(op.name)) {
|
|
11165
|
+
if (!isCssCustomProperty(op.name)) {
|
|
11052
11166
|
op.name = hyphenate(op.name);
|
|
11053
11167
|
}
|
|
11054
11168
|
const { property: property2, suffix } = parseProperty(op.name);
|
|
@@ -17140,7 +17254,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
|
17140
17254
|
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
17141
17255
|
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
17142
17256
|
let transformFn = void 0;
|
|
17143
|
-
if (messageOp.needsPostprocessing) {
|
|
17257
|
+
if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
|
|
17144
17258
|
const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
|
|
17145
17259
|
const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
|
|
17146
17260
|
const extraTransformFnParams = [];
|
|
@@ -17159,7 +17273,6 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
|
|
|
17159
17273
|
} else {
|
|
17160
17274
|
messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
|
|
17161
17275
|
messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
|
|
17162
|
-
messageOp.needsPostprocessing = true;
|
|
17163
17276
|
}
|
|
17164
17277
|
}
|
|
17165
17278
|
}
|
|
@@ -17193,12 +17306,13 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
17193
17306
|
|
|
17194
17307
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
|
|
17195
17308
|
function convertI18nText(job) {
|
|
17196
|
-
var _a2;
|
|
17309
|
+
var _a2, _b2, _c2;
|
|
17197
17310
|
for (const unit of job.units) {
|
|
17198
17311
|
let currentI18n = null;
|
|
17199
17312
|
let currentIcu = null;
|
|
17200
17313
|
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
17201
17314
|
const textNodeIcus = /* @__PURE__ */ new Map();
|
|
17315
|
+
const icuPlaceholderByText = /* @__PURE__ */ new Map();
|
|
17202
17316
|
for (const op of unit.create) {
|
|
17203
17317
|
switch (op.kind) {
|
|
17204
17318
|
case OpKind.I18nStart:
|
|
@@ -17223,7 +17337,13 @@ function convertI18nText(job) {
|
|
|
17223
17337
|
if (currentI18n !== null) {
|
|
17224
17338
|
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
17225
17339
|
textNodeIcus.set(op.xref, currentIcu);
|
|
17226
|
-
|
|
17340
|
+
if (op.icuPlaceholder !== null) {
|
|
17341
|
+
const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
|
|
17342
|
+
OpList.replace(op, icuPlaceholderOp);
|
|
17343
|
+
icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
|
|
17344
|
+
} else {
|
|
17345
|
+
OpList.remove(op);
|
|
17346
|
+
}
|
|
17227
17347
|
}
|
|
17228
17348
|
break;
|
|
17229
17349
|
}
|
|
@@ -17236,14 +17356,18 @@ function convertI18nText(job) {
|
|
|
17236
17356
|
}
|
|
17237
17357
|
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
17238
17358
|
const icuOp = textNodeIcus.get(op.target);
|
|
17359
|
+
const icuPlaceholder = icuPlaceholderByText.get(op.target);
|
|
17239
17360
|
const contextId = icuOp ? icuOp.context : i18nOp.context;
|
|
17240
17361
|
const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
|
|
17241
17362
|
const ops = [];
|
|
17242
17363
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
17243
17364
|
const expr = op.interpolation.expressions[i];
|
|
17244
|
-
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, op.interpolation.i18nPlaceholders[i], resolutionTime, I18nExpressionFor.I18nText, "", (
|
|
17365
|
+
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, (_a2 = icuPlaceholder == null ? void 0 : icuPlaceholder.xref) != null ? _a2 : null, (_b2 = op.interpolation.i18nPlaceholders[i]) != null ? _b2 : null, resolutionTime, I18nExpressionFor.I18nText, "", (_c2 = expr.sourceSpan) != null ? _c2 : op.sourceSpan));
|
|
17245
17366
|
}
|
|
17246
17367
|
OpList.replaceWithMany(op, ops);
|
|
17368
|
+
if (icuPlaceholder !== void 0) {
|
|
17369
|
+
icuPlaceholder.strings = op.interpolation.strings;
|
|
17370
|
+
}
|
|
17247
17371
|
break;
|
|
17248
17372
|
}
|
|
17249
17373
|
}
|
|
@@ -17394,7 +17518,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
17394
17518
|
op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
|
|
17395
17519
|
break;
|
|
17396
17520
|
case OpKind.Variable:
|
|
17397
|
-
varNames.set(op.xref, getVariableName(op.variable, state));
|
|
17521
|
+
varNames.set(op.xref, getVariableName(unit, op.variable, state));
|
|
17398
17522
|
break;
|
|
17399
17523
|
case OpKind.RepeaterCreate:
|
|
17400
17524
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
@@ -17445,14 +17569,19 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
17445
17569
|
});
|
|
17446
17570
|
}
|
|
17447
17571
|
}
|
|
17448
|
-
function getVariableName(variable2, state) {
|
|
17572
|
+
function getVariableName(unit, variable2, state) {
|
|
17449
17573
|
if (variable2.name === null) {
|
|
17450
17574
|
switch (variable2.kind) {
|
|
17451
17575
|
case SemanticVariableKind.Context:
|
|
17452
17576
|
variable2.name = `ctx_r${state.index++}`;
|
|
17453
17577
|
break;
|
|
17454
17578
|
case SemanticVariableKind.Identifier:
|
|
17455
|
-
|
|
17579
|
+
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
17580
|
+
const compatPrefix = variable2.identifier === "ctx" ? "i" : "";
|
|
17581
|
+
variable2.name = `${variable2.identifier}_${compatPrefix}r${++state.index}`;
|
|
17582
|
+
} else {
|
|
17583
|
+
variable2.name = `${variable2.identifier}_i${state.index++}`;
|
|
17584
|
+
}
|
|
17456
17585
|
break;
|
|
17457
17586
|
default:
|
|
17458
17587
|
variable2.name = `_r${++state.index}`;
|
|
@@ -17595,17 +17724,24 @@ var CREATE_ORDERING = [
|
|
|
17595
17724
|
{ test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
|
|
17596
17725
|
];
|
|
17597
17726
|
var UPDATE_ORDERING = [
|
|
17598
|
-
{ test: kindWithInterpolationTest(OpKind.HostProperty, true) },
|
|
17599
|
-
{ test: kindWithInterpolationTest(OpKind.HostProperty, false) },
|
|
17600
17727
|
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
17601
17728
|
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
17602
17729
|
{ test: kindTest(OpKind.StyleProp) },
|
|
17603
17730
|
{ test: kindTest(OpKind.ClassProp) },
|
|
17604
|
-
{ test: kindWithInterpolationTest(OpKind.Property, true) },
|
|
17605
17731
|
{ test: kindWithInterpolationTest(OpKind.Attribute, true) },
|
|
17732
|
+
{ test: kindWithInterpolationTest(OpKind.Property, true) },
|
|
17606
17733
|
{ test: kindWithInterpolationTest(OpKind.Property, false) },
|
|
17607
17734
|
{ test: kindWithInterpolationTest(OpKind.Attribute, false) }
|
|
17608
17735
|
];
|
|
17736
|
+
var UPDATE_HOST_ORDERING = [
|
|
17737
|
+
{ test: kindWithInterpolationTest(OpKind.HostProperty, true) },
|
|
17738
|
+
{ test: kindWithInterpolationTest(OpKind.HostProperty, false) },
|
|
17739
|
+
{ test: kindTest(OpKind.Attribute) },
|
|
17740
|
+
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
17741
|
+
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
17742
|
+
{ test: kindTest(OpKind.StyleProp) },
|
|
17743
|
+
{ test: kindTest(OpKind.ClassProp) }
|
|
17744
|
+
];
|
|
17609
17745
|
var handledOpKinds = /* @__PURE__ */ new Set([
|
|
17610
17746
|
OpKind.Listener,
|
|
17611
17747
|
OpKind.StyleMap,
|
|
@@ -17619,7 +17755,8 @@ var handledOpKinds = /* @__PURE__ */ new Set([
|
|
|
17619
17755
|
function orderOps(job) {
|
|
17620
17756
|
for (const unit of job.units) {
|
|
17621
17757
|
orderWithin(unit.create, CREATE_ORDERING);
|
|
17622
|
-
|
|
17758
|
+
const ordering = unit.job.kind === CompilationJobKind.Host ? UPDATE_HOST_ORDERING : UPDATE_ORDERING;
|
|
17759
|
+
orderWithin(unit.update, ordering);
|
|
17623
17760
|
}
|
|
17624
17761
|
}
|
|
17625
17762
|
function orderWithin(opList, ordering) {
|
|
@@ -17657,19 +17794,31 @@ function keepLast(ops) {
|
|
|
17657
17794
|
|
|
17658
17795
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
|
|
17659
17796
|
function parseExtractedStyles(job) {
|
|
17797
|
+
const elements = /* @__PURE__ */ new Map();
|
|
17798
|
+
for (const unit of job.units) {
|
|
17799
|
+
for (const op of unit.create) {
|
|
17800
|
+
if (isElementOrContainerOp(op)) {
|
|
17801
|
+
elements.set(op.xref, op);
|
|
17802
|
+
}
|
|
17803
|
+
}
|
|
17804
|
+
}
|
|
17660
17805
|
for (const unit of job.units) {
|
|
17661
17806
|
for (const op of unit.create) {
|
|
17662
17807
|
if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
|
|
17808
|
+
const target = elements.get(op.target);
|
|
17809
|
+
if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
|
|
17810
|
+
continue;
|
|
17811
|
+
}
|
|
17663
17812
|
if (op.name === "style") {
|
|
17664
17813
|
const parsedStyles = parse(op.expression.value);
|
|
17665
17814
|
for (let i = 0; i < parsedStyles.length - 1; i += 2) {
|
|
17666
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
17815
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
17667
17816
|
}
|
|
17668
17817
|
OpList.remove(op);
|
|
17669
17818
|
} else if (op.name === "class") {
|
|
17670
17819
|
const parsedClasses = op.expression.value.trim().split(/\s+/g);
|
|
17671
17820
|
for (const parsedClass of parsedClasses) {
|
|
17672
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
17821
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, null, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
17673
17822
|
}
|
|
17674
17823
|
OpList.remove(op);
|
|
17675
17824
|
}
|
|
@@ -17690,13 +17839,6 @@ function removeContentSelectors(job) {
|
|
|
17690
17839
|
OpList.remove(op);
|
|
17691
17840
|
}
|
|
17692
17841
|
break;
|
|
17693
|
-
case OpKind.Projection:
|
|
17694
|
-
for (let i = op.attributes.length - 2; i >= 0; i -= 2) {
|
|
17695
|
-
if (isSelectAttribute(op.attributes[i])) {
|
|
17696
|
-
op.attributes.splice(i, 2);
|
|
17697
|
-
}
|
|
17698
|
-
}
|
|
17699
|
-
break;
|
|
17700
17842
|
}
|
|
17701
17843
|
}
|
|
17702
17844
|
}
|
|
@@ -17823,8 +17965,11 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
17823
17965
|
var _a2;
|
|
17824
17966
|
if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
|
|
17825
17967
|
const id = unit.job.allocateXrefId();
|
|
17826
|
-
OpList.insertAfter(
|
|
17827
|
-
|
|
17968
|
+
OpList.insertAfter(
|
|
17969
|
+
createI18nStartOp(id, parentI18n.message, parentI18n.root, null),
|
|
17970
|
+
unit.create.head
|
|
17971
|
+
);
|
|
17972
|
+
OpList.insertBefore(createI18nEndOp(id, null), unit.create.tail);
|
|
17828
17973
|
}
|
|
17829
17974
|
}
|
|
17830
17975
|
|
|
@@ -17999,9 +18144,7 @@ function namespaceMath() {
|
|
|
17999
18144
|
return call(Identifiers.namespaceMathML, [], null);
|
|
18000
18145
|
}
|
|
18001
18146
|
function advance(delta, sourceSpan) {
|
|
18002
|
-
return call(Identifiers.advance, [
|
|
18003
|
-
literal(delta)
|
|
18004
|
-
], sourceSpan);
|
|
18147
|
+
return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
|
|
18005
18148
|
}
|
|
18006
18149
|
function reference(slot) {
|
|
18007
18150
|
return importExpr(Identifiers.reference).callFn([
|
|
@@ -18079,22 +18222,22 @@ function projectionDef(def) {
|
|
|
18079
18222
|
}
|
|
18080
18223
|
function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
|
|
18081
18224
|
const args = [literal(slot)];
|
|
18082
|
-
if (projectionSlotIndex !== 0 || attributes
|
|
18225
|
+
if (projectionSlotIndex !== 0 || attributes !== null) {
|
|
18083
18226
|
args.push(literal(projectionSlotIndex));
|
|
18084
|
-
if (attributes
|
|
18085
|
-
args.push(
|
|
18227
|
+
if (attributes !== null) {
|
|
18228
|
+
args.push(attributes);
|
|
18086
18229
|
}
|
|
18087
18230
|
}
|
|
18088
18231
|
return call(Identifiers.projection, args, sourceSpan);
|
|
18089
18232
|
}
|
|
18090
|
-
function i18nStart(slot, constIndex, subTemplateIndex) {
|
|
18233
|
+
function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
18091
18234
|
const args = [literal(slot), literal(constIndex)];
|
|
18092
18235
|
if (subTemplateIndex !== null) {
|
|
18093
18236
|
args.push(literal(subTemplateIndex));
|
|
18094
18237
|
}
|
|
18095
|
-
return call(Identifiers.i18nStart, args,
|
|
18238
|
+
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
18096
18239
|
}
|
|
18097
|
-
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, sourceSpan) {
|
|
18240
|
+
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
18098
18241
|
const args = [
|
|
18099
18242
|
literal(slot),
|
|
18100
18243
|
variable(viewFnName),
|
|
@@ -18108,6 +18251,12 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
18108
18251
|
args.push(literal(trackByUsesComponentInstance));
|
|
18109
18252
|
if (emptyViewFnName !== null) {
|
|
18110
18253
|
args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
|
|
18254
|
+
if (emptyTag !== null || emptyConstIndex !== null) {
|
|
18255
|
+
args.push(literal(emptyTag));
|
|
18256
|
+
}
|
|
18257
|
+
if (emptyConstIndex !== null) {
|
|
18258
|
+
args.push(literal(emptyConstIndex));
|
|
18259
|
+
}
|
|
18111
18260
|
}
|
|
18112
18261
|
}
|
|
18113
18262
|
return call(Identifiers.repeaterCreate, args, sourceSpan);
|
|
@@ -18118,15 +18267,15 @@ function repeater(collection, sourceSpan) {
|
|
|
18118
18267
|
function deferWhen(prefetch, expr, sourceSpan) {
|
|
18119
18268
|
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
18120
18269
|
}
|
|
18121
|
-
function i18n(slot, constIndex, subTemplateIndex) {
|
|
18270
|
+
function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
18122
18271
|
const args = [literal(slot), literal(constIndex)];
|
|
18123
18272
|
if (subTemplateIndex) {
|
|
18124
18273
|
args.push(literal(subTemplateIndex));
|
|
18125
18274
|
}
|
|
18126
|
-
return call(Identifiers.i18n, args,
|
|
18275
|
+
return call(Identifiers.i18n, args, sourceSpan);
|
|
18127
18276
|
}
|
|
18128
|
-
function i18nEnd() {
|
|
18129
|
-
return call(Identifiers.i18nEnd, [],
|
|
18277
|
+
function i18nEnd(endSourceSpan) {
|
|
18278
|
+
return call(Identifiers.i18nEnd, [], endSourceSpan);
|
|
18130
18279
|
}
|
|
18131
18280
|
function i18nAttributes(slot, i18nAttributesConfig) {
|
|
18132
18281
|
const args = [literal(slot), literal(i18nAttributesConfig)];
|
|
@@ -18139,10 +18288,13 @@ function property(name, expression, sanitizer, sourceSpan) {
|
|
|
18139
18288
|
}
|
|
18140
18289
|
return call(Identifiers.property, args, sourceSpan);
|
|
18141
18290
|
}
|
|
18142
|
-
function attribute(name, expression, sanitizer) {
|
|
18291
|
+
function attribute(name, expression, sanitizer, namespace) {
|
|
18143
18292
|
const args = [literal(name), expression];
|
|
18144
|
-
if (sanitizer !== null) {
|
|
18145
|
-
args.push(sanitizer);
|
|
18293
|
+
if (sanitizer !== null || namespace !== null) {
|
|
18294
|
+
args.push(sanitizer != null ? sanitizer : literal(null));
|
|
18295
|
+
}
|
|
18296
|
+
if (namespace !== null) {
|
|
18297
|
+
args.push(literal(namespace));
|
|
18146
18298
|
}
|
|
18147
18299
|
return call(Identifiers.attribute, args, null);
|
|
18148
18300
|
}
|
|
@@ -18453,31 +18605,31 @@ function reifyCreateOperations(unit, ops) {
|
|
|
18453
18605
|
OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
|
|
18454
18606
|
break;
|
|
18455
18607
|
case OpKind.ElementStart:
|
|
18456
|
-
OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.
|
|
18608
|
+
OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
18457
18609
|
break;
|
|
18458
18610
|
case OpKind.Element:
|
|
18459
|
-
OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.
|
|
18611
|
+
OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
|
|
18460
18612
|
break;
|
|
18461
18613
|
case OpKind.ElementEnd:
|
|
18462
18614
|
OpList.replace(op, elementEnd(op.sourceSpan));
|
|
18463
18615
|
break;
|
|
18464
18616
|
case OpKind.ContainerStart:
|
|
18465
|
-
OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.
|
|
18617
|
+
OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
|
|
18466
18618
|
break;
|
|
18467
18619
|
case OpKind.Container:
|
|
18468
|
-
OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.
|
|
18620
|
+
OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
|
|
18469
18621
|
break;
|
|
18470
18622
|
case OpKind.ContainerEnd:
|
|
18471
18623
|
OpList.replace(op, elementContainerEnd());
|
|
18472
18624
|
break;
|
|
18473
18625
|
case OpKind.I18nStart:
|
|
18474
|
-
OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
18626
|
+
OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
|
|
18475
18627
|
break;
|
|
18476
18628
|
case OpKind.I18nEnd:
|
|
18477
|
-
OpList.replace(op, i18nEnd());
|
|
18629
|
+
OpList.replace(op, i18nEnd(op.sourceSpan));
|
|
18478
18630
|
break;
|
|
18479
18631
|
case OpKind.I18n:
|
|
18480
|
-
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
18632
|
+
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
|
|
18481
18633
|
break;
|
|
18482
18634
|
case OpKind.I18nAttributes:
|
|
18483
18635
|
if (op.i18nAttributesConfig === null) {
|
|
@@ -18493,7 +18645,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
18493
18645
|
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
18494
18646
|
}
|
|
18495
18647
|
const childView = unit.job.views.get(op.xref);
|
|
18496
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.
|
|
18648
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
18497
18649
|
break;
|
|
18498
18650
|
case OpKind.DisableBindings:
|
|
18499
18651
|
OpList.replace(op, disableBindings2());
|
|
@@ -18508,7 +18660,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
18508
18660
|
const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
18509
18661
|
const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
|
|
18510
18662
|
if (eventTargetResolver === void 0) {
|
|
18511
|
-
throw new Error(`
|
|
18663
|
+
throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
|
|
18512
18664
|
}
|
|
18513
18665
|
OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
|
|
18514
18666
|
break;
|
|
@@ -18595,7 +18747,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
18595
18747
|
emptyDecls = emptyView.decls;
|
|
18596
18748
|
emptyVars = emptyView.vars;
|
|
18597
18749
|
}
|
|
18598
|
-
OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.
|
|
18750
|
+
OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.emptyTag, op.emptyAttributes, op.wholeSourceSpan));
|
|
18599
18751
|
break;
|
|
18600
18752
|
case OpKind.Statement:
|
|
18601
18753
|
break;
|
|
@@ -18655,7 +18807,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
18655
18807
|
if (op.expression instanceof Interpolation2) {
|
|
18656
18808
|
OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
|
|
18657
18809
|
} else {
|
|
18658
|
-
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer));
|
|
18810
|
+
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
|
|
18659
18811
|
}
|
|
18660
18812
|
break;
|
|
18661
18813
|
case OpKind.HostProperty:
|
|
@@ -18824,38 +18976,6 @@ function removeUnusedI18nAttributesOps(job) {
|
|
|
18824
18976
|
}
|
|
18825
18977
|
}
|
|
18826
18978
|
|
|
18827
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
|
|
18828
|
-
function generateRepeaterDerivedVars(job) {
|
|
18829
|
-
const repeaters = /* @__PURE__ */ new Map();
|
|
18830
|
-
for (const unit of job.units) {
|
|
18831
|
-
for (const op of unit.ops()) {
|
|
18832
|
-
if (op.kind === OpKind.RepeaterCreate) {
|
|
18833
|
-
repeaters.set(op.xref, op);
|
|
18834
|
-
}
|
|
18835
|
-
}
|
|
18836
|
-
}
|
|
18837
|
-
for (const unit of job.units) {
|
|
18838
|
-
for (const op of unit.ops()) {
|
|
18839
|
-
transformExpressionsInOp(op, (expr) => {
|
|
18840
|
-
if (!(expr instanceof DerivedRepeaterVarExpr)) {
|
|
18841
|
-
return expr;
|
|
18842
|
-
}
|
|
18843
|
-
const repeaterOp = repeaters.get(expr.xref);
|
|
18844
|
-
switch (expr.identity) {
|
|
18845
|
-
case DerivedRepeaterVarIdentity.First:
|
|
18846
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
|
|
18847
|
-
case DerivedRepeaterVarIdentity.Last:
|
|
18848
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
|
|
18849
|
-
case DerivedRepeaterVarIdentity.Even:
|
|
18850
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
|
|
18851
|
-
case DerivedRepeaterVarIdentity.Odd:
|
|
18852
|
-
return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
|
|
18853
|
-
}
|
|
18854
|
-
}, VisitorContextFlag.None);
|
|
18855
|
-
}
|
|
18856
|
-
}
|
|
18857
|
-
}
|
|
18858
|
-
|
|
18859
18979
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
|
|
18860
18980
|
function resolveContexts(job) {
|
|
18861
18981
|
for (const unit of job.units) {
|
|
@@ -19102,6 +19222,7 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
19102
19222
|
var _a2;
|
|
19103
19223
|
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
19104
19224
|
const i18nContexts = /* @__PURE__ */ new Map();
|
|
19225
|
+
const icuPlaceholders = /* @__PURE__ */ new Map();
|
|
19105
19226
|
for (const unit of job.units) {
|
|
19106
19227
|
for (const op of unit.create) {
|
|
19107
19228
|
switch (op.kind) {
|
|
@@ -19111,6 +19232,9 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
19111
19232
|
case OpKind.I18nContext:
|
|
19112
19233
|
i18nContexts.set(op.xref, op);
|
|
19113
19234
|
break;
|
|
19235
|
+
case OpKind.IcuPlaceholder:
|
|
19236
|
+
icuPlaceholders.set(op.xref, op);
|
|
19237
|
+
break;
|
|
19114
19238
|
}
|
|
19115
19239
|
}
|
|
19116
19240
|
}
|
|
@@ -19119,66 +19243,32 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
19119
19243
|
for (const unit of job.units) {
|
|
19120
19244
|
for (const op of unit.update) {
|
|
19121
19245
|
if (op.kind === OpKind.I18nExpression) {
|
|
19122
|
-
const i18nContext = i18nContexts.get(op.context);
|
|
19123
19246
|
const index = expressionIndices.get(referenceIndex(op)) || 0;
|
|
19124
19247
|
const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
|
|
19125
|
-
const
|
|
19126
|
-
const values = params.get(op.i18nPlaceholder) || [];
|
|
19127
|
-
values.push({
|
|
19248
|
+
const value = {
|
|
19128
19249
|
value: index,
|
|
19129
19250
|
subTemplateIndex,
|
|
19130
19251
|
flags: I18nParamValueFlags.ExpressionIndex
|
|
19131
|
-
}
|
|
19132
|
-
|
|
19252
|
+
};
|
|
19253
|
+
updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
|
|
19133
19254
|
expressionIndices.set(referenceIndex(op), index + 1);
|
|
19134
19255
|
}
|
|
19135
19256
|
}
|
|
19136
19257
|
}
|
|
19137
19258
|
}
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
|
|
19146
|
-
}
|
|
19147
|
-
}
|
|
19148
|
-
}
|
|
19149
|
-
}
|
|
19150
|
-
}
|
|
19151
|
-
var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
|
|
19152
|
-
constructor(params) {
|
|
19153
|
-
super();
|
|
19154
|
-
this.params = params;
|
|
19259
|
+
function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
|
|
19260
|
+
if (op.i18nPlaceholder !== null) {
|
|
19261
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
19262
|
+
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
19263
|
+
const values = params.get(op.i18nPlaceholder) || [];
|
|
19264
|
+
values.push(value);
|
|
19265
|
+
params.set(op.i18nPlaceholder, values);
|
|
19155
19266
|
}
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
this.params.set(placeholder.startName, [{
|
|
19160
|
-
value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
|
|
19161
|
-
subTemplateIndex: null,
|
|
19162
|
-
flags: I18nParamValueFlags.None
|
|
19163
|
-
}]);
|
|
19164
|
-
}
|
|
19165
|
-
if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
|
|
19166
|
-
this.params.set(placeholder.closeName, [{
|
|
19167
|
-
value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
|
|
19168
|
-
subTemplateIndex: null,
|
|
19169
|
-
flags: I18nParamValueFlags.None
|
|
19170
|
-
}]);
|
|
19171
|
-
}
|
|
19172
|
-
}
|
|
19173
|
-
visitTagPlaceholder(placeholder) {
|
|
19174
|
-
super.visitTagPlaceholder(placeholder);
|
|
19175
|
-
this.visitContainerPlaceholder(placeholder);
|
|
19267
|
+
if (op.icuPlaceholder !== null) {
|
|
19268
|
+
const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
|
|
19269
|
+
icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
|
|
19176
19270
|
}
|
|
19177
|
-
|
|
19178
|
-
super.visitBlockPlaceholder(placeholder);
|
|
19179
|
-
this.visitContainerPlaceholder(placeholder);
|
|
19180
|
-
}
|
|
19181
|
-
};
|
|
19271
|
+
}
|
|
19182
19272
|
|
|
19183
19273
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
|
|
19184
19274
|
function resolveNames(job) {
|
|
@@ -19484,6 +19574,9 @@ function generateTrackFns(job) {
|
|
|
19484
19574
|
}
|
|
19485
19575
|
let usesComponentContext = false;
|
|
19486
19576
|
op.track = transformExpressionsInExpression(op.track, (expr) => {
|
|
19577
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
19578
|
+
throw new Error(`Illegal State: Pipes are not allowed in this context`);
|
|
19579
|
+
}
|
|
19487
19580
|
if (expr instanceof TrackContextExpr) {
|
|
19488
19581
|
usesComponentContext = true;
|
|
19489
19582
|
return variable("this");
|
|
@@ -19648,7 +19741,10 @@ function varsUsedByOp(op) {
|
|
|
19648
19741
|
return op.interpolation.expressions.length;
|
|
19649
19742
|
case OpKind.I18nExpression:
|
|
19650
19743
|
case OpKind.Conditional:
|
|
19744
|
+
case OpKind.DeferWhen:
|
|
19651
19745
|
return 1;
|
|
19746
|
+
case OpKind.RepeaterCreate:
|
|
19747
|
+
return op.emptyView ? 1 : 0;
|
|
19652
19748
|
default:
|
|
19653
19749
|
throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
|
|
19654
19750
|
}
|
|
@@ -19941,12 +20037,12 @@ function wrapI18nIcus(job) {
|
|
|
19941
20037
|
case OpKind.IcuStart:
|
|
19942
20038
|
if (currentI18nOp === null) {
|
|
19943
20039
|
addedI18nId = job.allocateXrefId();
|
|
19944
|
-
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
|
|
20040
|
+
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message, void 0, null), op);
|
|
19945
20041
|
}
|
|
19946
20042
|
break;
|
|
19947
20043
|
case OpKind.IcuEnd:
|
|
19948
20044
|
if (addedI18nId !== null) {
|
|
19949
|
-
OpList.insertAfter(createI18nEndOp(addedI18nId), op);
|
|
20045
|
+
OpList.insertAfter(createI18nEndOp(addedI18nId, null), op);
|
|
19950
20046
|
addedI18nId = null;
|
|
19951
20047
|
}
|
|
19952
20048
|
break;
|
|
@@ -19962,6 +20058,7 @@ var phases = [
|
|
|
19962
20058
|
{ kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
|
|
19963
20059
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
19964
20060
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
20061
|
+
{ kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
|
|
19965
20062
|
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
19966
20063
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
19967
20064
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
@@ -19985,7 +20082,6 @@ var phases = [
|
|
|
19985
20082
|
{ kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
|
|
19986
20083
|
{ kind: CompilationJobKind.Both, fn: deleteAnyCasts },
|
|
19987
20084
|
{ kind: CompilationJobKind.Both, fn: resolveDollarEvent },
|
|
19988
|
-
{ kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
|
|
19989
20085
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
|
|
19990
20086
|
{ kind: CompilationJobKind.Both, fn: resolveNames },
|
|
19991
20087
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
@@ -20000,7 +20096,6 @@ var phases = [
|
|
|
20000
20096
|
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
20001
20097
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
20002
20098
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
20003
|
-
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
|
|
20004
20099
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
20005
20100
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
20006
20101
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
@@ -20143,7 +20238,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
20143
20238
|
bindingKind = BindingKind.Animation;
|
|
20144
20239
|
}
|
|
20145
20240
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
|
|
20146
|
-
ingestHostProperty(job, property2, bindingKind,
|
|
20241
|
+
ingestHostProperty(job, property2, bindingKind, securityContexts);
|
|
20147
20242
|
}
|
|
20148
20243
|
for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
|
|
20149
20244
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
|
|
@@ -20154,7 +20249,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
20154
20249
|
}
|
|
20155
20250
|
return job;
|
|
20156
20251
|
}
|
|
20157
|
-
function ingestHostProperty(job, property2, bindingKind,
|
|
20252
|
+
function ingestHostProperty(job, property2, bindingKind, securityContexts) {
|
|
20158
20253
|
let expression;
|
|
20159
20254
|
const ast = property2.expression.ast;
|
|
20160
20255
|
if (ast instanceof Interpolation) {
|
|
@@ -20162,7 +20257,7 @@ function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securi
|
|
|
20162
20257
|
} else {
|
|
20163
20258
|
expression = convertAst(ast, job, property2.sourceSpan);
|
|
20164
20259
|
}
|
|
20165
|
-
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts,
|
|
20260
|
+
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
|
|
20166
20261
|
}
|
|
20167
20262
|
function ingestHostAttribute(job, name, value, securityContexts) {
|
|
20168
20263
|
const attrBinding = createBindingOp(
|
|
@@ -20176,14 +20271,13 @@ function ingestHostAttribute(job, name, value, securityContexts) {
|
|
|
20176
20271
|
false,
|
|
20177
20272
|
null,
|
|
20178
20273
|
null,
|
|
20179
|
-
|
|
20274
|
+
value.sourceSpan
|
|
20180
20275
|
);
|
|
20181
20276
|
job.root.update.push(attrBinding);
|
|
20182
20277
|
}
|
|
20183
20278
|
function ingestHostEvent(job, event) {
|
|
20184
20279
|
const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
|
|
20185
|
-
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null,
|
|
20186
|
-
eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
|
|
20280
|
+
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
|
|
20187
20281
|
job.root.create.push(eventBinding);
|
|
20188
20282
|
}
|
|
20189
20283
|
function ingestNodes(unit, template2) {
|
|
@@ -20195,9 +20289,9 @@ function ingestNodes(unit, template2) {
|
|
|
20195
20289
|
} else if (node instanceof Content) {
|
|
20196
20290
|
ingestContent(unit, node);
|
|
20197
20291
|
} else if (node instanceof Text) {
|
|
20198
|
-
ingestText(unit, node);
|
|
20292
|
+
ingestText(unit, node, null);
|
|
20199
20293
|
} else if (node instanceof BoundText) {
|
|
20200
|
-
ingestBoundText(unit, node);
|
|
20294
|
+
ingestBoundText(unit, node, null);
|
|
20201
20295
|
} else if (node instanceof IfBlock) {
|
|
20202
20296
|
ingestIfBlock(unit, node);
|
|
20203
20297
|
} else if (node instanceof SwitchBlock) {
|
|
@@ -20214,29 +20308,30 @@ function ingestNodes(unit, template2) {
|
|
|
20214
20308
|
}
|
|
20215
20309
|
}
|
|
20216
20310
|
function ingestElement(unit, element2) {
|
|
20217
|
-
var _a2;
|
|
20311
|
+
var _a2, _b2;
|
|
20218
20312
|
if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
|
|
20219
20313
|
throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
|
|
20220
20314
|
}
|
|
20221
20315
|
const id = unit.job.allocateXrefId();
|
|
20222
20316
|
const [namespaceKey, elementName] = splitNsName(element2.name);
|
|
20223
|
-
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
|
|
20317
|
+
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
|
|
20224
20318
|
unit.create.push(startOp);
|
|
20225
20319
|
ingestElementBindings(unit, startOp, element2);
|
|
20226
20320
|
ingestReferences(startOp, element2);
|
|
20227
20321
|
let i18nBlockId = null;
|
|
20228
20322
|
if (element2.i18n instanceof Message) {
|
|
20229
20323
|
i18nBlockId = unit.job.allocateXrefId();
|
|
20230
|
-
unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n));
|
|
20324
|
+
unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n, void 0, element2.startSourceSpan));
|
|
20231
20325
|
}
|
|
20232
20326
|
ingestNodes(unit, element2.children);
|
|
20233
20327
|
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
20234
20328
|
unit.create.push(endOp);
|
|
20235
20329
|
if (i18nBlockId !== null) {
|
|
20236
|
-
OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
|
|
20330
|
+
OpList.insertBefore(createI18nEndOp(i18nBlockId, (_b2 = element2.endSourceSpan) != null ? _b2 : element2.startSourceSpan), endOp);
|
|
20237
20331
|
}
|
|
20238
20332
|
}
|
|
20239
20333
|
function ingestTemplate(unit, tmpl) {
|
|
20334
|
+
var _a2;
|
|
20240
20335
|
if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
|
|
20241
20336
|
throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
|
|
20242
20337
|
}
|
|
@@ -20250,7 +20345,7 @@ function ingestTemplate(unit, tmpl) {
|
|
|
20250
20345
|
const namespace = namespaceForKey(namespacePrefix);
|
|
20251
20346
|
const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
|
|
20252
20347
|
const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
|
|
20253
|
-
const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
|
|
20348
|
+
const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
|
|
20254
20349
|
unit.create.push(templateOp);
|
|
20255
20350
|
ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
|
|
20256
20351
|
ingestReferences(templateOp, tmpl);
|
|
@@ -20260,26 +20355,25 @@ function ingestTemplate(unit, tmpl) {
|
|
|
20260
20355
|
}
|
|
20261
20356
|
if (templateKind === TemplateKind.NgTemplate && tmpl.i18n instanceof Message) {
|
|
20262
20357
|
const id = unit.job.allocateXrefId();
|
|
20263
|
-
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
|
|
20264
|
-
OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
|
|
20358
|
+
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n, void 0, tmpl.startSourceSpan), childView.create.head);
|
|
20359
|
+
OpList.insertBefore(createI18nEndOp(id, (_a2 = tmpl.endSourceSpan) != null ? _a2 : tmpl.startSourceSpan), childView.create.tail);
|
|
20265
20360
|
}
|
|
20266
20361
|
}
|
|
20267
20362
|
function ingestContent(unit, content) {
|
|
20268
20363
|
if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
|
|
20269
20364
|
throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
|
|
20270
20365
|
}
|
|
20271
|
-
const
|
|
20272
|
-
const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, attrs, content.sourceSpan);
|
|
20366
|
+
const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
|
|
20273
20367
|
for (const attr of content.attributes) {
|
|
20274
20368
|
const securityContext = domSchema.securityContext(content.name, attr.name, true);
|
|
20275
20369
|
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
20276
20370
|
}
|
|
20277
20371
|
unit.create.push(op);
|
|
20278
20372
|
}
|
|
20279
|
-
function ingestText(unit, text2) {
|
|
20280
|
-
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
|
|
20373
|
+
function ingestText(unit, text2, icuPlaceholder) {
|
|
20374
|
+
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
|
|
20281
20375
|
}
|
|
20282
|
-
function ingestBoundText(unit, text2,
|
|
20376
|
+
function ingestBoundText(unit, text2, icuPlaceholder) {
|
|
20283
20377
|
var _a2;
|
|
20284
20378
|
let value = text2.value;
|
|
20285
20379
|
if (value instanceof ASTWithSource) {
|
|
@@ -20291,14 +20385,12 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
|
|
|
20291
20385
|
if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
|
|
20292
20386
|
throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
20293
20387
|
}
|
|
20294
|
-
|
|
20295
|
-
i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
20296
|
-
}
|
|
20388
|
+
const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
20297
20389
|
if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
|
|
20298
20390
|
throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
|
|
20299
20391
|
}
|
|
20300
20392
|
const textXref = unit.job.allocateXrefId();
|
|
20301
|
-
unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
|
|
20393
|
+
unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
|
|
20302
20394
|
const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
|
|
20303
20395
|
unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
|
|
20304
20396
|
}
|
|
@@ -20324,7 +20416,7 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
20324
20416
|
}
|
|
20325
20417
|
ifCaseI18nMeta = ifCase.i18n;
|
|
20326
20418
|
}
|
|
20327
|
-
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
|
|
20419
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
20328
20420
|
unit.create.push(templateOp);
|
|
20329
20421
|
if (firstXref === null) {
|
|
20330
20422
|
firstXref = cView.xref;
|
|
@@ -20340,6 +20432,9 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
20340
20432
|
}
|
|
20341
20433
|
function ingestSwitchBlock(unit, switchBlock) {
|
|
20342
20434
|
var _a2;
|
|
20435
|
+
if (switchBlock.cases.length === 0) {
|
|
20436
|
+
return;
|
|
20437
|
+
}
|
|
20343
20438
|
let firstXref = null;
|
|
20344
20439
|
let firstSlotHandle = null;
|
|
20345
20440
|
let conditions = [];
|
|
@@ -20352,7 +20447,7 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
20352
20447
|
}
|
|
20353
20448
|
switchCaseI18nMeta = switchCase.i18n;
|
|
20354
20449
|
}
|
|
20355
|
-
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
|
|
20450
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
20356
20451
|
unit.create.push(templateOp);
|
|
20357
20452
|
if (firstXref === null) {
|
|
20358
20453
|
firstXref = cView.xref;
|
|
@@ -20375,7 +20470,7 @@ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
|
|
|
20375
20470
|
}
|
|
20376
20471
|
const secondaryView = unit.job.allocateView(unit.xref);
|
|
20377
20472
|
ingestNodes(secondaryView, children);
|
|
20378
|
-
const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan);
|
|
20473
|
+
const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
|
|
20379
20474
|
unit.create.push(templateOp);
|
|
20380
20475
|
return templateOp;
|
|
20381
20476
|
}
|
|
@@ -20449,6 +20544,9 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
20449
20544
|
deferOnOps.push(deferOnOp);
|
|
20450
20545
|
}
|
|
20451
20546
|
if (triggers.when !== void 0) {
|
|
20547
|
+
if (triggers.when.value instanceof Interpolation) {
|
|
20548
|
+
throw new Error(`Unexpected interpolation in defer block when trigger`);
|
|
20549
|
+
}
|
|
20452
20550
|
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
20453
20551
|
deferWhenOps.push(deferOnOp);
|
|
20454
20552
|
}
|
|
@@ -20468,9 +20566,9 @@ function ingestIcu(unit, icu) {
|
|
|
20468
20566
|
unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
|
|
20469
20567
|
for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
|
|
20470
20568
|
if (text2 instanceof BoundText) {
|
|
20471
|
-
ingestBoundText(unit, text2,
|
|
20569
|
+
ingestBoundText(unit, text2, placeholder);
|
|
20472
20570
|
} else {
|
|
20473
|
-
ingestText(unit, text2);
|
|
20571
|
+
ingestText(unit, text2, placeholder);
|
|
20474
20572
|
}
|
|
20475
20573
|
}
|
|
20476
20574
|
unit.create.push(createIcuEndOp(xref));
|
|
@@ -20481,28 +20579,46 @@ function ingestIcu(unit, icu) {
|
|
|
20481
20579
|
function ingestForBlock(unit, forBlock) {
|
|
20482
20580
|
var _a2, _b2, _c2;
|
|
20483
20581
|
const repeaterView = unit.job.allocateView(unit.xref);
|
|
20484
|
-
const createRepeaterAlias = (ident, repeaterVar) => {
|
|
20485
|
-
repeaterView.aliases.add({
|
|
20486
|
-
kind: SemanticVariableKind.Alias,
|
|
20487
|
-
name: null,
|
|
20488
|
-
identifier: ident,
|
|
20489
|
-
expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar)
|
|
20490
|
-
});
|
|
20491
|
-
};
|
|
20492
20582
|
repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
|
|
20493
20583
|
repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
|
|
20494
20584
|
repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
|
|
20495
|
-
|
|
20496
|
-
|
|
20497
|
-
|
|
20498
|
-
|
|
20585
|
+
const indexName = `\u0275${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
|
|
20586
|
+
const countName = `\u0275${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
|
|
20587
|
+
repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
|
|
20588
|
+
repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
|
|
20589
|
+
repeaterView.aliases.add({
|
|
20590
|
+
kind: SemanticVariableKind.Alias,
|
|
20591
|
+
name: null,
|
|
20592
|
+
identifier: forBlock.contextVariables.$first.name,
|
|
20593
|
+
expression: new LexicalReadExpr(indexName).identical(literal(0))
|
|
20594
|
+
});
|
|
20595
|
+
repeaterView.aliases.add({
|
|
20596
|
+
kind: SemanticVariableKind.Alias,
|
|
20597
|
+
name: null,
|
|
20598
|
+
identifier: forBlock.contextVariables.$last.name,
|
|
20599
|
+
expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
|
|
20600
|
+
});
|
|
20601
|
+
repeaterView.aliases.add({
|
|
20602
|
+
kind: SemanticVariableKind.Alias,
|
|
20603
|
+
name: null,
|
|
20604
|
+
identifier: forBlock.contextVariables.$even.name,
|
|
20605
|
+
expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
|
|
20606
|
+
});
|
|
20607
|
+
repeaterView.aliases.add({
|
|
20608
|
+
kind: SemanticVariableKind.Alias,
|
|
20609
|
+
name: null,
|
|
20610
|
+
identifier: forBlock.contextVariables.$odd.name,
|
|
20611
|
+
expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
|
|
20612
|
+
});
|
|
20499
20613
|
const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
|
|
20500
20614
|
const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
|
|
20501
20615
|
ingestNodes(repeaterView, forBlock.children);
|
|
20502
20616
|
let emptyView = null;
|
|
20617
|
+
let emptyTagName = null;
|
|
20503
20618
|
if (forBlock.empty !== null) {
|
|
20504
20619
|
emptyView = unit.job.allocateView(unit.xref);
|
|
20505
20620
|
ingestNodes(emptyView, forBlock.empty.children);
|
|
20621
|
+
emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
|
|
20506
20622
|
}
|
|
20507
20623
|
const varNames = {
|
|
20508
20624
|
$index: forBlock.contextVariables.$index.name,
|
|
@@ -20522,7 +20638,7 @@ function ingestForBlock(unit, forBlock) {
|
|
|
20522
20638
|
const i18nPlaceholder = forBlock.i18n;
|
|
20523
20639
|
const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
|
|
20524
20640
|
const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
|
|
20525
|
-
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.sourceSpan);
|
|
20641
|
+
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, emptyTagName, i18nPlaceholder, emptyI18nPlaceholder, forBlock.startSourceSpan, forBlock.sourceSpan);
|
|
20526
20642
|
unit.create.push(repeaterCreate2);
|
|
20527
20643
|
const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
|
|
20528
20644
|
const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
|
|
@@ -20532,7 +20648,10 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
20532
20648
|
if (ast instanceof ASTWithSource) {
|
|
20533
20649
|
return convertAst(ast.ast, job, baseSourceSpan);
|
|
20534
20650
|
} else if (ast instanceof PropertyRead) {
|
|
20535
|
-
|
|
20651
|
+
const isThisReceiver = ast.receiver instanceof ThisReceiver;
|
|
20652
|
+
const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
|
|
20653
|
+
const isSpecialNode = ast.name === "$any" || ast.name === "$event";
|
|
20654
|
+
if (isImplicitReceiver || isThisReceiver && !isSpecialNode) {
|
|
20536
20655
|
return new LexicalReadExpr(ast.name);
|
|
20537
20656
|
} else {
|
|
20538
20657
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -20610,13 +20729,13 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
20610
20729
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
20611
20730
|
}
|
|
20612
20731
|
}
|
|
20613
|
-
function convertAstWithInterpolation(job, value, i18nMeta) {
|
|
20732
|
+
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
20614
20733
|
var _a2, _b2;
|
|
20615
20734
|
let expression;
|
|
20616
20735
|
if (value instanceof Interpolation) {
|
|
20617
|
-
expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
|
|
20736
|
+
expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, sourceSpan != null ? sourceSpan : null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
|
|
20618
20737
|
} else if (value instanceof AST) {
|
|
20619
|
-
expression = convertAst(value, job, null);
|
|
20738
|
+
expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
|
|
20620
20739
|
} else {
|
|
20621
20740
|
expression = literal(value);
|
|
20622
20741
|
}
|
|
@@ -20692,7 +20811,7 @@ function ingestTemplateBindings(unit, op, template2, templateKind) {
|
|
|
20692
20811
|
}
|
|
20693
20812
|
if (templateKind === TemplateKind.Structural && output.type !== 1) {
|
|
20694
20813
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
|
|
20695
|
-
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
|
|
20814
|
+
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
|
|
20696
20815
|
}
|
|
20697
20816
|
}
|
|
20698
20817
|
if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
|
|
@@ -20703,7 +20822,7 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
|
|
|
20703
20822
|
const isTextBinding = typeof value === "string";
|
|
20704
20823
|
if (templateKind === TemplateKind.Structural) {
|
|
20705
20824
|
if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
|
|
20706
|
-
return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
|
|
20825
|
+
return createExtractedAttributeOp(xref, BindingKind.Property, null, name, null, null, i18nMessage, securityContext);
|
|
20707
20826
|
}
|
|
20708
20827
|
if (!isTextBinding && (type === 1 || type === 4)) {
|
|
20709
20828
|
return null;
|
|
@@ -23562,6 +23681,9 @@ var TemplateDefinitionBuilder = class {
|
|
|
23562
23681
|
this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
|
|
23563
23682
|
}
|
|
23564
23683
|
visitSwitchBlock(block) {
|
|
23684
|
+
if (block.cases.length === 0) {
|
|
23685
|
+
return;
|
|
23686
|
+
}
|
|
23565
23687
|
const caseData = block.cases.map((currentCase) => {
|
|
23566
23688
|
const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
|
|
23567
23689
|
const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
|
|
@@ -23711,7 +23833,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
23711
23833
|
});
|
|
23712
23834
|
const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
|
|
23713
23835
|
let emptyData = null;
|
|
23836
|
+
let emptyTagName = null;
|
|
23837
|
+
let emptyAttrsExprs;
|
|
23714
23838
|
if (block.empty !== null) {
|
|
23839
|
+
const emptyInferred = this.inferProjectionDataFromInsertionPoint(block.empty);
|
|
23840
|
+
emptyTagName = emptyInferred.tagName;
|
|
23841
|
+
emptyAttrsExprs = emptyInferred.attrsExprs;
|
|
23715
23842
|
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
|
|
23716
23843
|
this.allocateBindingSlots(null);
|
|
23717
23844
|
}
|
|
@@ -23727,11 +23854,11 @@ var TemplateDefinitionBuilder = class {
|
|
|
23727
23854
|
trackByExpression
|
|
23728
23855
|
];
|
|
23729
23856
|
if (emptyData !== null) {
|
|
23730
|
-
params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()));
|
|
23857
|
+
params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()), literal(emptyTagName), this.addAttrsToConsts(emptyAttrsExprs || null));
|
|
23731
23858
|
} else if (trackByUsesComponentInstance) {
|
|
23732
23859
|
params.push(literal(trackByUsesComponentInstance));
|
|
23733
23860
|
}
|
|
23734
|
-
return params;
|
|
23861
|
+
return trimTrailingNulls(params);
|
|
23735
23862
|
});
|
|
23736
23863
|
const value = block.expression.visit(this._valueConverter);
|
|
23737
23864
|
this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
|
|
@@ -23884,7 +24011,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
23884
24011
|
if (delta < 1) {
|
|
23885
24012
|
throw new Error("advance instruction can only go forwards");
|
|
23886
24013
|
}
|
|
23887
|
-
this.instructionFn(this._updateCodeFns, span, Identifiers.advance, [literal(delta)]);
|
|
24014
|
+
this.instructionFn(this._updateCodeFns, span, Identifiers.advance, delta > 1 ? [literal(delta)] : []);
|
|
23888
24015
|
this._currentIndex = nodeIndex;
|
|
23889
24016
|
}
|
|
23890
24017
|
}
|
|
@@ -24294,12 +24421,15 @@ var BindingScope = class {
|
|
|
24294
24421
|
}
|
|
24295
24422
|
};
|
|
24296
24423
|
var TrackByBindingScope = class extends BindingScope {
|
|
24297
|
-
constructor(parentScope,
|
|
24424
|
+
constructor(parentScope, globalOverrides) {
|
|
24298
24425
|
super(parentScope.bindingLevel + 1, parentScope);
|
|
24299
|
-
this.
|
|
24426
|
+
this.globalOverrides = globalOverrides;
|
|
24300
24427
|
this.componentAccessCount = 0;
|
|
24301
24428
|
}
|
|
24302
24429
|
get(name) {
|
|
24430
|
+
if (this.globalOverrides.hasOwnProperty(name)) {
|
|
24431
|
+
return variable(this.globalOverrides[name]);
|
|
24432
|
+
}
|
|
24303
24433
|
let current = this.parent;
|
|
24304
24434
|
while (current) {
|
|
24305
24435
|
if (current.hasLocal(name)) {
|
|
@@ -24307,9 +24437,6 @@ var TrackByBindingScope = class extends BindingScope {
|
|
|
24307
24437
|
}
|
|
24308
24438
|
current = current.parent;
|
|
24309
24439
|
}
|
|
24310
|
-
if (this.globalAliases[name]) {
|
|
24311
|
-
return variable(this.globalAliases[name]);
|
|
24312
|
-
}
|
|
24313
24440
|
this.componentAccessCount++;
|
|
24314
24441
|
return variable("this").prop(name);
|
|
24315
24442
|
}
|
|
@@ -25974,7 +26101,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
25974
26101
|
bindingPropertyName: ann.alias || field,
|
|
25975
26102
|
classPropertyName: field,
|
|
25976
26103
|
required: ann.required || false,
|
|
25977
|
-
isSignal:
|
|
26104
|
+
isSignal: !!ann.isSignal,
|
|
25978
26105
|
transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null
|
|
25979
26106
|
};
|
|
25980
26107
|
} else if (isOutput(ann)) {
|
|
@@ -26328,7 +26455,7 @@ function publishFacade(global) {
|
|
|
26328
26455
|
}
|
|
26329
26456
|
|
|
26330
26457
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
26331
|
-
var VERSION2 = new Version("17.1.0-
|
|
26458
|
+
var VERSION2 = new Version("17.1.0-rc.0");
|
|
26332
26459
|
|
|
26333
26460
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
26334
26461
|
var _I18N_ATTR = "i18n";
|
|
@@ -27394,7 +27521,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
27394
27521
|
function compileDeclareClassMetadata(metadata) {
|
|
27395
27522
|
const definitionMap = new DefinitionMap();
|
|
27396
27523
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
27397
|
-
definitionMap.set("version", literal("17.1.0-
|
|
27524
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27398
27525
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27399
27526
|
definitionMap.set("type", metadata.type);
|
|
27400
27527
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -27463,7 +27590,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
27463
27590
|
const definitionMap = new DefinitionMap();
|
|
27464
27591
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
27465
27592
|
definitionMap.set("minVersion", literal(minVersion));
|
|
27466
|
-
definitionMap.set("version", literal("17.1.0-
|
|
27593
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27467
27594
|
definitionMap.set("type", meta.type.value);
|
|
27468
27595
|
if (meta.isStandalone) {
|
|
27469
27596
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -27501,8 +27628,8 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
27501
27628
|
}
|
|
27502
27629
|
function getMinimumVersionForPartialOutput(meta) {
|
|
27503
27630
|
let minVersion = "14.0.0";
|
|
27504
|
-
const
|
|
27505
|
-
if (
|
|
27631
|
+
const hasDecoratorTransformFunctions = Object.values(meta.inputs).some((input) => input.transformFunction !== null);
|
|
27632
|
+
if (hasDecoratorTransformFunctions) {
|
|
27506
27633
|
minVersion = "16.1.0";
|
|
27507
27634
|
}
|
|
27508
27635
|
if (needsNewInputPartialOutput(meta)) {
|
|
@@ -27756,7 +27883,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION2 = "12.0.0";
|
|
|
27756
27883
|
function compileDeclareFactoryFunction(meta) {
|
|
27757
27884
|
const definitionMap = new DefinitionMap();
|
|
27758
27885
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
|
|
27759
|
-
definitionMap.set("version", literal("17.1.0-
|
|
27886
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27760
27887
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27761
27888
|
definitionMap.set("type", meta.type.value);
|
|
27762
27889
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -27779,7 +27906,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
27779
27906
|
function createInjectableDefinitionMap(meta) {
|
|
27780
27907
|
const definitionMap = new DefinitionMap();
|
|
27781
27908
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
27782
|
-
definitionMap.set("version", literal("17.1.0-
|
|
27909
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27783
27910
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27784
27911
|
definitionMap.set("type", meta.type.value);
|
|
27785
27912
|
if (meta.providedIn !== void 0) {
|
|
@@ -27817,7 +27944,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
27817
27944
|
function createInjectorDefinitionMap(meta) {
|
|
27818
27945
|
const definitionMap = new DefinitionMap();
|
|
27819
27946
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
27820
|
-
definitionMap.set("version", literal("17.1.0-
|
|
27947
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27821
27948
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27822
27949
|
definitionMap.set("type", meta.type.value);
|
|
27823
27950
|
definitionMap.set("providers", meta.providers);
|
|
@@ -27841,7 +27968,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
27841
27968
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
27842
27969
|
}
|
|
27843
27970
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
27844
|
-
definitionMap.set("version", literal("17.1.0-
|
|
27971
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27845
27972
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27846
27973
|
definitionMap.set("type", meta.type.value);
|
|
27847
27974
|
if (meta.bootstrap.length > 0) {
|
|
@@ -27876,7 +28003,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
27876
28003
|
function createPipeDefinitionMap(meta) {
|
|
27877
28004
|
const definitionMap = new DefinitionMap();
|
|
27878
28005
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
27879
|
-
definitionMap.set("version", literal("17.1.0-
|
|
28006
|
+
definitionMap.set("version", literal("17.1.0-rc.0"));
|
|
27880
28007
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27881
28008
|
definitionMap.set("type", meta.type.value);
|
|
27882
28009
|
if (meta.isStandalone) {
|
|
@@ -27893,7 +28020,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
27893
28020
|
publishFacade(_global);
|
|
27894
28021
|
|
|
27895
28022
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
27896
|
-
var VERSION3 = new Version("17.1.0-
|
|
28023
|
+
var VERSION3 = new Version("17.1.0-rc.0");
|
|
27897
28024
|
|
|
27898
28025
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
27899
28026
|
var EmitFlags;
|
|
@@ -28030,6 +28157,9 @@ var ErrorCode;
|
|
|
28030
28157
|
ErrorCode2[ErrorCode2["DECORATOR_COLLISION"] = 1006] = "DECORATOR_COLLISION";
|
|
28031
28158
|
ErrorCode2[ErrorCode2["VALUE_HAS_WRONG_TYPE"] = 1010] = "VALUE_HAS_WRONG_TYPE";
|
|
28032
28159
|
ErrorCode2[ErrorCode2["VALUE_NOT_LITERAL"] = 1011] = "VALUE_NOT_LITERAL";
|
|
28160
|
+
ErrorCode2[ErrorCode2["SIGNAL_INPUT_AND_DISALLOWED_DECORATOR"] = 1050] = "SIGNAL_INPUT_AND_DISALLOWED_DECORATOR";
|
|
28161
|
+
ErrorCode2[ErrorCode2["SIGNAL_INPUT_AND_INPUTS_ARRAY_COLLISION"] = 1051] = "SIGNAL_INPUT_AND_INPUTS_ARRAY_COLLISION";
|
|
28162
|
+
ErrorCode2[ErrorCode2["INPUT_DECLARED_ON_STATIC_MEMBER"] = 1100] = "INPUT_DECLARED_ON_STATIC_MEMBER";
|
|
28033
28163
|
ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE";
|
|
28034
28164
|
ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME";
|
|
28035
28165
|
ErrorCode2[ErrorCode2["PARAM_MISSING_TOKEN"] = 2003] = "PARAM_MISSING_TOKEN";
|
|
@@ -30309,7 +30439,7 @@ var DtsMetadataReader = class {
|
|
|
30309
30439
|
const inputs = ClassPropertyMapping.fromMappedObject(readInputsType(def.type.typeArguments[3]));
|
|
30310
30440
|
const outputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[4], readStringType));
|
|
30311
30441
|
const hostDirectives = def.type.typeArguments.length > 8 ? readHostDirectivesType(this.checker, def.type.typeArguments[8], ref.bestGuessOwningModule) : null;
|
|
30312
|
-
const
|
|
30442
|
+
const isSignal2 = def.type.typeArguments.length > 9 && ((_b2 = readBooleanType(def.type.typeArguments[9])) != null ? _b2 : false);
|
|
30313
30443
|
return __spreadProps(__spreadValues({
|
|
30314
30444
|
kind: MetaKind.Directive,
|
|
30315
30445
|
matchSource: MatchSource.Selector,
|
|
@@ -30329,7 +30459,7 @@ var DtsMetadataReader = class {
|
|
|
30329
30459
|
animationTriggerNames: null,
|
|
30330
30460
|
ngContentSelectors,
|
|
30331
30461
|
isStandalone,
|
|
30332
|
-
isSignal,
|
|
30462
|
+
isSignal: isSignal2,
|
|
30333
30463
|
imports: null,
|
|
30334
30464
|
schemas: null,
|
|
30335
30465
|
decorator: null,
|
|
@@ -33623,15 +33753,16 @@ var Context = class {
|
|
|
33623
33753
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager.mjs
|
|
33624
33754
|
var import_typescript41 = __toESM(require("typescript"), 1);
|
|
33625
33755
|
var ImportManager = class {
|
|
33626
|
-
constructor(rewriter = new NoopImportRewriter(), prefix = "i") {
|
|
33756
|
+
constructor(rewriter = new NoopImportRewriter(), prefix = "i", factory9 = import_typescript41.default.factory) {
|
|
33627
33757
|
this.rewriter = rewriter;
|
|
33628
33758
|
this.prefix = prefix;
|
|
33759
|
+
this.factory = factory9;
|
|
33629
33760
|
this.specifierToIdentifier = /* @__PURE__ */ new Map();
|
|
33630
33761
|
this.nextIndex = 0;
|
|
33631
33762
|
}
|
|
33632
33763
|
generateNamespaceImport(moduleName) {
|
|
33633
33764
|
if (!this.specifierToIdentifier.has(moduleName)) {
|
|
33634
|
-
this.specifierToIdentifier.set(moduleName,
|
|
33765
|
+
this.specifierToIdentifier.set(moduleName, this.factory.createIdentifier(`${this.prefix}${this.nextIndex++}`));
|
|
33635
33766
|
}
|
|
33636
33767
|
return this.specifierToIdentifier.get(moduleName);
|
|
33637
33768
|
}
|
|
@@ -33666,6 +33797,7 @@ var BINARY_OPERATORS3 = /* @__PURE__ */ new Map([
|
|
|
33666
33797
|
[BinaryOperator.Bigger, ">"],
|
|
33667
33798
|
[BinaryOperator.BiggerEquals, ">="],
|
|
33668
33799
|
[BinaryOperator.BitwiseAnd, "&"],
|
|
33800
|
+
[BinaryOperator.BitwiseOr, "|"],
|
|
33669
33801
|
[BinaryOperator.Divide, "/"],
|
|
33670
33802
|
[BinaryOperator.Equals, "=="],
|
|
33671
33803
|
[BinaryOperator.Identical, "==="],
|
|
@@ -34212,6 +34344,7 @@ var BINARY_OPERATORS4 = {
|
|
|
34212
34344
|
">": import_typescript45.default.SyntaxKind.GreaterThanToken,
|
|
34213
34345
|
">=": import_typescript45.default.SyntaxKind.GreaterThanEqualsToken,
|
|
34214
34346
|
"&": import_typescript45.default.SyntaxKind.AmpersandToken,
|
|
34347
|
+
"|": import_typescript45.default.SyntaxKind.BarToken,
|
|
34215
34348
|
"/": import_typescript45.default.SyntaxKind.SlashToken,
|
|
34216
34349
|
"==": import_typescript45.default.SyntaxKind.EqualsEqualsToken,
|
|
34217
34350
|
"===": import_typescript45.default.SyntaxKind.EqualsEqualsEqualsToken,
|
|
@@ -34401,18 +34534,18 @@ function translateStatement(statement, imports, options = {}) {
|
|
|
34401
34534
|
|
|
34402
34535
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
|
|
34403
34536
|
var import_typescript46 = __toESM(require("typescript"), 1);
|
|
34404
|
-
function addImports(importManager, sf, extraStatements = []) {
|
|
34537
|
+
function addImports(factory9 = import_typescript46.default.factory, importManager, sf, extraStatements = []) {
|
|
34405
34538
|
const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
|
|
34406
|
-
const qualifier =
|
|
34407
|
-
const importClause =
|
|
34539
|
+
const qualifier = factory9.createIdentifier(i.qualifier.text);
|
|
34540
|
+
const importClause = factory9.createImportClause(
|
|
34408
34541
|
false,
|
|
34409
34542
|
void 0,
|
|
34410
|
-
|
|
34543
|
+
factory9.createNamespaceImport(qualifier)
|
|
34411
34544
|
);
|
|
34412
|
-
const decl =
|
|
34545
|
+
const decl = factory9.createImportDeclaration(
|
|
34413
34546
|
void 0,
|
|
34414
34547
|
importClause,
|
|
34415
|
-
|
|
34548
|
+
factory9.createStringLiteral(i.specifier)
|
|
34416
34549
|
);
|
|
34417
34550
|
import_typescript46.default.setOriginalNode(i.qualifier, decl);
|
|
34418
34551
|
return decl;
|
|
@@ -34420,8 +34553,8 @@ function addImports(importManager, sf, extraStatements = []) {
|
|
|
34420
34553
|
const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
|
|
34421
34554
|
const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
|
|
34422
34555
|
if (addedImports.length > 0) {
|
|
34423
|
-
const fileoverviewAnchorStmt =
|
|
34424
|
-
return
|
|
34556
|
+
const fileoverviewAnchorStmt = factory9.createNotEmittedStatement(sf);
|
|
34557
|
+
return factory9.updateSourceFile(sf, factory9.createNodeArray([
|
|
34425
34558
|
fileoverviewAnchorStmt,
|
|
34426
34559
|
...existingImports,
|
|
34427
34560
|
...addedImports,
|
|
@@ -34494,7 +34627,7 @@ var DtsTransformer = class {
|
|
|
34494
34627
|
}
|
|
34495
34628
|
};
|
|
34496
34629
|
sf = import_typescript47.default.visitNode(sf, visitor, import_typescript47.default.isSourceFile) || sf;
|
|
34497
|
-
return addImports(imports, sf);
|
|
34630
|
+
return addImports(this.ctx.factory, imports, sf);
|
|
34498
34631
|
}
|
|
34499
34632
|
transformClassDeclaration(clazz, transforms, imports) {
|
|
34500
34633
|
let elements = clazz.members;
|
|
@@ -34804,7 +34937,7 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
34804
34937
|
annotateForClosureCompiler: isClosureCompilerEnabled
|
|
34805
34938
|
}));
|
|
34806
34939
|
const fileOverviewMeta = isClosureCompilerEnabled ? getFileOverviewComment(sf.statements) : null;
|
|
34807
|
-
sf = addImports(importManager, sf, constants);
|
|
34940
|
+
sf = addImports(context.factory, importManager, sf, constants);
|
|
34808
34941
|
if (fileOverviewMeta !== null) {
|
|
34809
34942
|
setFileOverviewComment(sf, fileOverviewMeta);
|
|
34810
34943
|
}
|
|
@@ -34884,7 +35017,7 @@ function tryParseInputInitializerAndOptions(member, reflector, coreModule) {
|
|
|
34884
35017
|
if (target === null) {
|
|
34885
35018
|
return null;
|
|
34886
35019
|
}
|
|
34887
|
-
if (target.text === "input"
|
|
35020
|
+
if (target.text === "input") {
|
|
34888
35021
|
if (!isReferenceToInputFunction(target, coreModule, reflector)) {
|
|
34889
35022
|
return null;
|
|
34890
35023
|
}
|
|
@@ -34915,14 +35048,46 @@ function extractPropertyTarget(node) {
|
|
|
34915
35048
|
return null;
|
|
34916
35049
|
}
|
|
34917
35050
|
function isReferenceToInputFunction(target, coreModule, reflector) {
|
|
34918
|
-
|
|
34919
|
-
if (
|
|
34920
|
-
|
|
35051
|
+
let targetImport = reflector.getImportOfIdentifier(target);
|
|
35052
|
+
if (targetImport === null) {
|
|
35053
|
+
if (coreModule !== void 0) {
|
|
35054
|
+
return false;
|
|
35055
|
+
}
|
|
35056
|
+
targetImport = { name: target.text };
|
|
34921
35057
|
}
|
|
34922
|
-
|
|
34923
|
-
|
|
35058
|
+
return targetImport.name === "input";
|
|
35059
|
+
}
|
|
35060
|
+
function parseAndValidateOptions(optionsNode) {
|
|
35061
|
+
if (!import_typescript50.default.isObjectLiteralExpression(optionsNode)) {
|
|
35062
|
+
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, optionsNode, "Argument needs to be an object literal that is statically analyzable.");
|
|
35063
|
+
}
|
|
35064
|
+
const options = reflectObjectLiteral(optionsNode);
|
|
35065
|
+
let alias = void 0;
|
|
35066
|
+
if (options.has("alias")) {
|
|
35067
|
+
const aliasExpr = options.get("alias");
|
|
35068
|
+
if (!import_typescript50.default.isStringLiteralLike(aliasExpr)) {
|
|
35069
|
+
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, aliasExpr, "Alias needs to be a string that is statically analyzable.");
|
|
35070
|
+
}
|
|
35071
|
+
alias = aliasExpr.text;
|
|
34924
35072
|
}
|
|
34925
|
-
return
|
|
35073
|
+
return { alias };
|
|
35074
|
+
}
|
|
35075
|
+
function tryParseSignalInputMapping(member, reflector, coreModule) {
|
|
35076
|
+
var _a2;
|
|
35077
|
+
const signalInput = tryParseInputInitializerAndOptions(member, reflector, coreModule);
|
|
35078
|
+
if (signalInput === null) {
|
|
35079
|
+
return null;
|
|
35080
|
+
}
|
|
35081
|
+
const optionsNode = signalInput.optionsNode;
|
|
35082
|
+
const options = optionsNode !== void 0 ? parseAndValidateOptions(optionsNode) : null;
|
|
35083
|
+
const classPropertyName = member.name;
|
|
35084
|
+
return {
|
|
35085
|
+
isSignal: true,
|
|
35086
|
+
classPropertyName,
|
|
35087
|
+
bindingPropertyName: (_a2 = options == null ? void 0 : options.alias) != null ? _a2 : classPropertyName,
|
|
35088
|
+
required: signalInput.isRequired,
|
|
35089
|
+
transform: null
|
|
35090
|
+
};
|
|
34926
35091
|
}
|
|
34927
35092
|
|
|
34928
35093
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
|
|
@@ -34935,7 +35100,7 @@ var QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
|
34935
35100
|
]);
|
|
34936
35101
|
function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector = null) {
|
|
34937
35102
|
let directive;
|
|
34938
|
-
if (decorator
|
|
35103
|
+
if (decorator.args === null || decorator.args.length === 0) {
|
|
34939
35104
|
directive = /* @__PURE__ */ new Map();
|
|
34940
35105
|
} else if (decorator.args.length !== 1) {
|
|
34941
35106
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
@@ -34952,8 +35117,8 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
34952
35117
|
const members = reflector.getMembersOfClass(clazz);
|
|
34953
35118
|
const decoratedElements = members.filter((member) => !member.isStatic && member.decorators !== null);
|
|
34954
35119
|
const coreModule = isCore ? void 0 : "@angular/core";
|
|
34955
|
-
const inputsFromMeta = parseInputsArray2(clazz, directive, evaluator, reflector, refEmitter);
|
|
34956
|
-
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, refEmitter, coreModule);
|
|
35120
|
+
const inputsFromMeta = parseInputsArray2(clazz, directive, evaluator, reflector, refEmitter, compilationMode);
|
|
35121
|
+
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, refEmitter, coreModule, compilationMode, inputsFromMeta, decorator);
|
|
34957
35122
|
const inputs = ClassPropertyMapping.fromMappedObject(__spreadValues(__spreadValues({}, inputsFromMeta), inputsFromFields));
|
|
34958
35123
|
const outputsFromMeta = parseOutputsArray(directive, evaluator);
|
|
34959
35124
|
const outputsFromFields = parseOutputFields(filterToMembersWithDecorator(decoratedElements, "Output", coreModule), evaluator);
|
|
@@ -35005,14 +35170,14 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
35005
35170
|
}
|
|
35006
35171
|
isStandalone = resolved;
|
|
35007
35172
|
}
|
|
35008
|
-
let
|
|
35173
|
+
let isSignal2 = false;
|
|
35009
35174
|
if (directive.has("signals")) {
|
|
35010
35175
|
const expr = directive.get("signals");
|
|
35011
35176
|
const resolved = evaluator.evaluate(expr);
|
|
35012
35177
|
if (typeof resolved !== "boolean") {
|
|
35013
35178
|
throw createValueHasWrongTypeError(expr, resolved, `signals flag must be a boolean`);
|
|
35014
35179
|
}
|
|
35015
|
-
|
|
35180
|
+
isSignal2 = resolved;
|
|
35016
35181
|
}
|
|
35017
35182
|
const usesInheritance = reflector.hasBaseClass(clazz);
|
|
35018
35183
|
const sourceFile = clazz.getSourceFile();
|
|
@@ -35042,7 +35207,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
35042
35207
|
exportAs,
|
|
35043
35208
|
providers,
|
|
35044
35209
|
isStandalone,
|
|
35045
|
-
isSignal,
|
|
35210
|
+
isSignal: isSignal2,
|
|
35046
35211
|
hostDirectives: (hostDirectives == null ? void 0 : hostDirectives.map((hostDir) => toHostDirectiveMetadata(hostDir, sourceFile, refEmitter))) || null
|
|
35047
35212
|
};
|
|
35048
35213
|
return {
|
|
@@ -35290,7 +35455,7 @@ function parseDecoratedFields(fields, evaluator, callback) {
|
|
|
35290
35455
|
}
|
|
35291
35456
|
}
|
|
35292
35457
|
}
|
|
35293
|
-
function parseInputsArray2(clazz, decoratorMetadata, evaluator, reflector, refEmitter) {
|
|
35458
|
+
function parseInputsArray2(clazz, decoratorMetadata, evaluator, reflector, refEmitter, compilationMode) {
|
|
35294
35459
|
const inputsField = decoratorMetadata.get("inputs");
|
|
35295
35460
|
if (inputsField === void 0) {
|
|
35296
35461
|
return {};
|
|
@@ -35324,7 +35489,7 @@ function parseInputsArray2(clazz, decoratorMetadata, evaluator, reflector, refEm
|
|
|
35324
35489
|
if (!(transformValue instanceof DynamicValue) && !(transformValue instanceof Reference2)) {
|
|
35325
35490
|
throw createValueHasWrongTypeError(inputsField, transformValue, `Transform of value at position ${i} of @Directive.inputs array must be a function`);
|
|
35326
35491
|
}
|
|
35327
|
-
transform2 = parseDecoratorInputTransformFunction(clazz, name, transformValue, reflector, refEmitter);
|
|
35492
|
+
transform2 = parseDecoratorInputTransformFunction(clazz, name, transformValue, reflector, refEmitter, compilationMode);
|
|
35328
35493
|
}
|
|
35329
35494
|
inputs[name] = {
|
|
35330
35495
|
classPropertyName: name,
|
|
@@ -35354,9 +35519,13 @@ function tryGetDecoratorOnMember(member, decoratorName, coreModule) {
|
|
|
35354
35519
|
}
|
|
35355
35520
|
return null;
|
|
35356
35521
|
}
|
|
35357
|
-
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModule, refEmitter) {
|
|
35522
|
+
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModule, refEmitter, compilationMode) {
|
|
35358
35523
|
const classPropertyName = member.name;
|
|
35359
35524
|
const decorator = tryGetDecoratorOnMember(member, "Input", coreModule);
|
|
35525
|
+
const signalInputMapping = tryParseSignalInputMapping(member, reflector, coreModule);
|
|
35526
|
+
if (decorator !== null && signalInputMapping !== null) {
|
|
35527
|
+
throw new FatalDiagnosticError(ErrorCode.SIGNAL_INPUT_AND_DISALLOWED_DECORATOR, decorator.node, `Using @Input with a signal input is not allowed.`);
|
|
35528
|
+
}
|
|
35360
35529
|
if (decorator !== null) {
|
|
35361
35530
|
if (decorator.args !== null && decorator.args.length > 1) {
|
|
35362
35531
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `@${decorator.name} can have at most one argument, got ${decorator.args.length} argument(s)`);
|
|
@@ -35380,7 +35549,7 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModu
|
|
|
35380
35549
|
if (!(transformValue instanceof DynamicValue) && !(transformValue instanceof Reference2)) {
|
|
35381
35550
|
throw createValueHasWrongTypeError(optionsNode, transformValue, `Input transform must be a function`);
|
|
35382
35551
|
}
|
|
35383
|
-
transform2 = parseDecoratorInputTransformFunction(clazz, classPropertyName, transformValue, reflector, refEmitter);
|
|
35552
|
+
transform2 = parseDecoratorInputTransformFunction(clazz, classPropertyName, transformValue, reflector, refEmitter, compilationMode);
|
|
35384
35553
|
}
|
|
35385
35554
|
return {
|
|
35386
35555
|
isSignal: false,
|
|
@@ -35390,40 +35559,42 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModu
|
|
|
35390
35559
|
required
|
|
35391
35560
|
};
|
|
35392
35561
|
}
|
|
35393
|
-
|
|
35394
|
-
|
|
35395
|
-
const optionsNode = signalInput.optionsNode;
|
|
35396
|
-
const options = optionsNode !== void 0 ? evaluator.evaluate(optionsNode) : null;
|
|
35397
|
-
let bindingPropertyName = classPropertyName;
|
|
35398
|
-
if (options instanceof Map && typeof options.get("alias") === "string") {
|
|
35399
|
-
bindingPropertyName = options.get("alias");
|
|
35400
|
-
}
|
|
35401
|
-
return {
|
|
35402
|
-
isSignal: true,
|
|
35403
|
-
classPropertyName,
|
|
35404
|
-
bindingPropertyName,
|
|
35405
|
-
required: signalInput.isRequired,
|
|
35406
|
-
transform: null
|
|
35407
|
-
};
|
|
35562
|
+
if (signalInputMapping !== null) {
|
|
35563
|
+
return signalInputMapping;
|
|
35408
35564
|
}
|
|
35409
35565
|
return null;
|
|
35410
35566
|
}
|
|
35411
|
-
function parseInputFields(clazz, members, evaluator, reflector, refEmitter, coreModule) {
|
|
35567
|
+
function parseInputFields(clazz, members, evaluator, reflector, refEmitter, coreModule, compilationMode, inputsFromClassDecorator, classDecorator) {
|
|
35568
|
+
var _a2, _b2;
|
|
35412
35569
|
const inputs = {};
|
|
35413
35570
|
for (const member of members) {
|
|
35414
|
-
|
|
35571
|
+
const classPropertyName = member.name;
|
|
35572
|
+
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, coreModule, refEmitter, compilationMode);
|
|
35573
|
+
if (inputMapping === null) {
|
|
35415
35574
|
continue;
|
|
35416
35575
|
}
|
|
35417
|
-
|
|
35418
|
-
|
|
35419
|
-
|
|
35420
|
-
|
|
35576
|
+
if (member.isStatic) {
|
|
35577
|
+
throw new FatalDiagnosticError(ErrorCode.INPUT_DECLARED_ON_STATIC_MEMBER, (_a2 = member.node) != null ? _a2 : clazz, `Input "${member.name}" is incorrectly declared as static member of "${clazz.name.text}".`);
|
|
35578
|
+
}
|
|
35579
|
+
if (inputMapping.isSignal && inputsFromClassDecorator.hasOwnProperty(classPropertyName)) {
|
|
35580
|
+
throw new FatalDiagnosticError(ErrorCode.SIGNAL_INPUT_AND_INPUTS_ARRAY_COLLISION, (_b2 = member.node) != null ? _b2 : clazz, `Input "${member.name}" is also declared as non-signal in @${classDecorator.name}.`);
|
|
35421
35581
|
}
|
|
35582
|
+
inputs[classPropertyName] = inputMapping;
|
|
35422
35583
|
}
|
|
35423
35584
|
return inputs;
|
|
35424
35585
|
}
|
|
35425
|
-
function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, reflector, refEmitter) {
|
|
35586
|
+
function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, reflector, refEmitter, compilationMode) {
|
|
35426
35587
|
var _a2;
|
|
35588
|
+
if (compilationMode === CompilationMode.LOCAL) {
|
|
35589
|
+
const node2 = value instanceof Reference2 ? value.getIdentityIn(clazz.getSourceFile()) : value.node;
|
|
35590
|
+
if (node2 === null) {
|
|
35591
|
+
throw createValueHasWrongTypeError(value.node, value, "Input transform function could not be referenced");
|
|
35592
|
+
}
|
|
35593
|
+
return {
|
|
35594
|
+
node: node2,
|
|
35595
|
+
type: new Reference2(import_typescript51.default.factory.createKeywordTypeNode(import_typescript51.default.SyntaxKind.UnknownKeyword))
|
|
35596
|
+
};
|
|
35597
|
+
}
|
|
35427
35598
|
const definition = reflector.getDefinitionOfFunction(value.node);
|
|
35428
35599
|
if (definition === null) {
|
|
35429
35600
|
throw createValueHasWrongTypeError(value.node, value, "Input transform must be a function");
|
|
@@ -41221,8 +41392,8 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
41221
41392
|
const plainKeys = [];
|
|
41222
41393
|
const coercedKeys = [];
|
|
41223
41394
|
const signalInputKeys = [];
|
|
41224
|
-
for (const { classPropertyName, transform: transform2, isSignal } of meta.fields.inputs) {
|
|
41225
|
-
if (
|
|
41395
|
+
for (const { classPropertyName, transform: transform2, isSignal: isSignal2 } of meta.fields.inputs) {
|
|
41396
|
+
if (isSignal2) {
|
|
41226
41397
|
signalInputKeys.push(import_typescript85.default.factory.createLiteralTypeNode(import_typescript85.default.factory.createStringLiteral(classPropertyName)));
|
|
41227
41398
|
} else if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
41228
41399
|
plainKeys.push(import_typescript85.default.factory.createLiteralTypeNode(import_typescript85.default.factory.createStringLiteral(classPropertyName)));
|
|
@@ -41505,7 +41676,14 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
|
|
|
41505
41676
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, import_typescript87.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
|
|
41506
41677
|
}
|
|
41507
41678
|
controlFlowPreventingContentProjection(templateId, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
|
|
41508
|
-
|
|
41679
|
+
let blockName;
|
|
41680
|
+
if (controlFlowNode instanceof ForLoopBlockEmpty) {
|
|
41681
|
+
blockName = "@empty";
|
|
41682
|
+
} else if (controlFlowNode instanceof ForLoopBlock) {
|
|
41683
|
+
blockName = "@for";
|
|
41684
|
+
} else {
|
|
41685
|
+
blockName = "@if";
|
|
41686
|
+
}
|
|
41509
41687
|
const lines = [
|
|
41510
41688
|
`Node matches the "${slotSelector}" slot of the "${componentName}" component, but will not be projected into the specific slot because the surrounding ${blockName} has more than one node at its root. To project the node in the right slot, you can:
|
|
41511
41689
|
`,
|
|
@@ -42302,7 +42480,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
42302
42480
|
for (const attr of boundAttrs) {
|
|
42303
42481
|
const expr = widenBinding(translateInput(attr.attribute, this.tcb, this.scope), this.tcb);
|
|
42304
42482
|
let assignment = wrapForDiagnostics(expr);
|
|
42305
|
-
for (const { fieldName, required, transformType, isSignal } of attr.inputs) {
|
|
42483
|
+
for (const { fieldName, required, transformType, isSignal: isSignal2 } of attr.inputs) {
|
|
42306
42484
|
let target;
|
|
42307
42485
|
if (required) {
|
|
42308
42486
|
seenRequiredInputs.add(fieldName);
|
|
@@ -42342,7 +42520,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
42342
42520
|
}
|
|
42343
42521
|
target = this.dir.stringLiteralInputFields.has(fieldName) ? import_typescript91.default.factory.createElementAccessExpression(dirId, import_typescript91.default.factory.createStringLiteral(fieldName)) : import_typescript91.default.factory.createPropertyAccessExpression(dirId, import_typescript91.default.factory.createIdentifier(fieldName));
|
|
42344
42522
|
}
|
|
42345
|
-
if (
|
|
42523
|
+
if (isSignal2) {
|
|
42346
42524
|
const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(Identifiers.InputSignalBrandWriteType.moduleName, Identifiers.InputSignalBrandWriteType.name);
|
|
42347
42525
|
if (!import_typescript91.default.isIdentifier(inputSignalBrandWriteSymbol) && !import_typescript91.default.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
|
|
42348
42526
|
throw new Error(`Expected identifier or property access for reference to ${Identifiers.InputSignalBrandWriteType.name}`);
|
|
@@ -42460,7 +42638,12 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
42460
42638
|
for (const child of this.element.children) {
|
|
42461
42639
|
let eligibleNode = null;
|
|
42462
42640
|
if (child instanceof ForLoopBlock) {
|
|
42463
|
-
|
|
42641
|
+
if (this.shouldCheck(child)) {
|
|
42642
|
+
result.push(child);
|
|
42643
|
+
}
|
|
42644
|
+
if (child.empty !== null && this.shouldCheck(child.empty)) {
|
|
42645
|
+
result.push(child.empty);
|
|
42646
|
+
}
|
|
42464
42647
|
} else if (child instanceof IfBlock) {
|
|
42465
42648
|
eligibleNode = child.branches[0];
|
|
42466
42649
|
}
|
|
@@ -42479,6 +42662,18 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
|
42479
42662
|
}
|
|
42480
42663
|
return result;
|
|
42481
42664
|
}
|
|
42665
|
+
shouldCheck(node) {
|
|
42666
|
+
if (node.children.length < 2) {
|
|
42667
|
+
return false;
|
|
42668
|
+
}
|
|
42669
|
+
const rootNodeCount = node.children.reduce((count, node2) => {
|
|
42670
|
+
if (!(node2 instanceof Text) || this.tcb.hostPreserveWhitespaces || node2.value.trim().length > 0) {
|
|
42671
|
+
count++;
|
|
42672
|
+
}
|
|
42673
|
+
return count;
|
|
42674
|
+
}, 0);
|
|
42675
|
+
return rootNodeCount > 1;
|
|
42676
|
+
}
|
|
42482
42677
|
};
|
|
42483
42678
|
var ATTR_TO_PROP = new Map(Object.entries({
|
|
42484
42679
|
"class": "className",
|
|
@@ -45105,10 +45300,12 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
|
|
|
45105
45300
|
return [];
|
|
45106
45301
|
}
|
|
45107
45302
|
};
|
|
45303
|
+
function isSignal(symbol) {
|
|
45304
|
+
return ((symbol == null ? void 0 : symbol.escapedName) === "WritableSignal" || (symbol == null ? void 0 : symbol.escapedName) === "Signal") && symbol.parent.escapedName.includes("@angular/core");
|
|
45305
|
+
}
|
|
45108
45306
|
function buildDiagnosticForSignal(ctx, node, component) {
|
|
45109
|
-
var _a2, _b2;
|
|
45110
45307
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
45111
|
-
if ((symbol == null ? void 0 : symbol.kind) === SymbolKind.Expression && ((
|
|
45308
|
+
if ((symbol == null ? void 0 : symbol.kind) === SymbolKind.Expression && (isSignal(symbol.tsType.symbol) || isSignal(symbol.tsType.aliasSymbol))) {
|
|
45112
45309
|
const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbol.tcbLocation);
|
|
45113
45310
|
const errorString = `${node.name} is a function and should be invoked: ${node.name}()`;
|
|
45114
45311
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
@@ -46578,9 +46775,12 @@ var import_typescript106 = __toESM(require("typescript"), 1);
|
|
|
46578
46775
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
46579
46776
|
var import_typescript105 = __toESM(require("typescript"), 1);
|
|
46580
46777
|
|
|
46581
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/
|
|
46778
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/jit_transforms/downlevel_decorators_transform.mjs
|
|
46582
46779
|
var import_typescript107 = __toESM(require("typescript"), 1);
|
|
46583
46780
|
|
|
46781
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/jit_transforms/signal_inputs_metadata_transform.mjs
|
|
46782
|
+
var import_typescript108 = __toESM(require("typescript"), 1);
|
|
46783
|
+
|
|
46584
46784
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/private/tooling.mjs
|
|
46585
46785
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
46586
46786
|
ngDevMode: false,
|
|
@@ -46614,14 +46814,14 @@ setFileSystem(new NodeJSFileSystem());
|
|
|
46614
46814
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/index.mjs
|
|
46615
46815
|
var import_fs2 = require("fs");
|
|
46616
46816
|
var import_path8 = require("path");
|
|
46617
|
-
var
|
|
46817
|
+
var import_typescript121 = __toESM(require("typescript"), 1);
|
|
46618
46818
|
|
|
46619
46819
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
46620
|
-
var
|
|
46820
|
+
var import_typescript110 = __toESM(require("typescript"), 1);
|
|
46621
46821
|
|
|
46622
46822
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
|
|
46623
46823
|
var import_path4 = require("path");
|
|
46624
|
-
var
|
|
46824
|
+
var import_typescript109 = __toESM(require("typescript"), 1);
|
|
46625
46825
|
var ImportManager2 = class {
|
|
46626
46826
|
constructor(getUpdateRecorder, printer) {
|
|
46627
46827
|
__publicField(this, "getUpdateRecorder");
|
|
@@ -46644,7 +46844,7 @@ var ImportManager2 = class {
|
|
|
46644
46844
|
}
|
|
46645
46845
|
for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
|
|
46646
46846
|
const statement = sourceFile.statements[i];
|
|
46647
|
-
if (!
|
|
46847
|
+
if (!import_typescript109.default.isImportDeclaration(statement) || !import_typescript109.default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) {
|
|
46648
46848
|
continue;
|
|
46649
46849
|
}
|
|
46650
46850
|
if (importStartIndex === 0) {
|
|
@@ -46656,9 +46856,9 @@ var ImportManager2 = class {
|
|
|
46656
46856
|
}
|
|
46657
46857
|
if (statement.importClause.namedBindings) {
|
|
46658
46858
|
const namedBindings = statement.importClause.namedBindings;
|
|
46659
|
-
if (
|
|
46660
|
-
return
|
|
46661
|
-
} else if (
|
|
46859
|
+
if (import_typescript109.default.isNamespaceImport(namedBindings) && !typeImport) {
|
|
46860
|
+
return import_typescript109.default.factory.createPropertyAccessExpression(import_typescript109.default.factory.createIdentifier(namedBindings.name.text), import_typescript109.default.factory.createIdentifier(alias || symbolName || "default"));
|
|
46861
|
+
} else if (import_typescript109.default.isNamedImports(namedBindings) && symbolName) {
|
|
46662
46862
|
const existingElement = namedBindings.elements.find((e) => {
|
|
46663
46863
|
if (alias) {
|
|
46664
46864
|
return e.propertyName && e.name.text === alias && e.propertyName.text === symbolName;
|
|
@@ -46666,12 +46866,12 @@ var ImportManager2 = class {
|
|
|
46666
46866
|
return e.propertyName ? e.propertyName.text === symbolName : e.name.text === symbolName;
|
|
46667
46867
|
});
|
|
46668
46868
|
if (existingElement) {
|
|
46669
|
-
return
|
|
46869
|
+
return import_typescript109.default.factory.createIdentifier(existingElement.name.text);
|
|
46670
46870
|
}
|
|
46671
46871
|
existingImport = statement;
|
|
46672
46872
|
}
|
|
46673
46873
|
} else if (statement.importClause.name && !symbolName) {
|
|
46674
|
-
return
|
|
46874
|
+
return import_typescript109.default.factory.createIdentifier(statement.importClause.name.text);
|
|
46675
46875
|
}
|
|
46676
46876
|
}
|
|
46677
46877
|
if (existingImport) {
|
|
@@ -46695,7 +46895,7 @@ var ImportManager2 = class {
|
|
|
46695
46895
|
if (!importMap.has(moduleName)) {
|
|
46696
46896
|
importMap.set(moduleName, []);
|
|
46697
46897
|
}
|
|
46698
|
-
importMap.get(moduleName).push(
|
|
46898
|
+
importMap.get(moduleName).push(import_typescript109.default.factory.createImportSpecifier(false, propertyName, name));
|
|
46699
46899
|
} else {
|
|
46700
46900
|
const importMap = this.newImports.get(sourceFile).defaultImports;
|
|
46701
46901
|
identifier = this._getUniqueIdentifier(sourceFile, "defaultExport");
|
|
@@ -46709,19 +46909,19 @@ var ImportManager2 = class {
|
|
|
46709
46909
|
const sourceFile = importDecl.getSourceFile();
|
|
46710
46910
|
const recorder = this.getUpdateRecorder(sourceFile);
|
|
46711
46911
|
const namedBindings = importDecl.importClause.namedBindings;
|
|
46712
|
-
const newNamedBindings =
|
|
46713
|
-
const newNamedBindingsText = this.printer.printNode(
|
|
46912
|
+
const newNamedBindings = import_typescript109.default.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, importName }) => import_typescript109.default.factory.createImportSpecifier(false, propertyName, importName))));
|
|
46913
|
+
const newNamedBindingsText = this.printer.printNode(import_typescript109.default.EmitHint.Unspecified, newNamedBindings, sourceFile);
|
|
46714
46914
|
recorder.updateExistingImport(namedBindings, newNamedBindingsText);
|
|
46715
46915
|
});
|
|
46716
46916
|
this.newImports.forEach(({ importStartIndex, defaultImports, namedImports }, sourceFile) => {
|
|
46717
46917
|
const recorder = this.getUpdateRecorder(sourceFile);
|
|
46718
46918
|
const useSingleQuotes = this._getQuoteStyle(sourceFile) === 0;
|
|
46719
46919
|
defaultImports.forEach((identifier, moduleName) => {
|
|
46720
|
-
const newImport =
|
|
46920
|
+
const newImport = import_typescript109.default.factory.createImportDeclaration(void 0, import_typescript109.default.factory.createImportClause(false, identifier, void 0), import_typescript109.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
46721
46921
|
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
46722
46922
|
});
|
|
46723
46923
|
namedImports.forEach((specifiers, moduleName) => {
|
|
46724
|
-
const newImport =
|
|
46924
|
+
const newImport = import_typescript109.default.factory.createImportDeclaration(void 0, import_typescript109.default.factory.createImportClause(false, void 0, import_typescript109.default.factory.createNamedImports(specifiers)), import_typescript109.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
46725
46925
|
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
46726
46926
|
});
|
|
46727
46927
|
});
|
|
@@ -46729,7 +46929,7 @@ var ImportManager2 = class {
|
|
|
46729
46929
|
_getUniqueIdentifier(sourceFile, baseName) {
|
|
46730
46930
|
if (this.isUniqueIdentifierName(sourceFile, baseName)) {
|
|
46731
46931
|
this._recordUsedIdentifier(sourceFile, baseName);
|
|
46732
|
-
return
|
|
46932
|
+
return import_typescript109.default.factory.createIdentifier(baseName);
|
|
46733
46933
|
}
|
|
46734
46934
|
let name = null;
|
|
46735
46935
|
let counter = 1;
|
|
@@ -46737,7 +46937,7 @@ var ImportManager2 = class {
|
|
|
46737
46937
|
name = `${baseName}_${counter++}`;
|
|
46738
46938
|
} while (!this.isUniqueIdentifierName(sourceFile, name));
|
|
46739
46939
|
this._recordUsedIdentifier(sourceFile, name);
|
|
46740
|
-
return
|
|
46940
|
+
return import_typescript109.default.factory.createIdentifier(name);
|
|
46741
46941
|
}
|
|
46742
46942
|
isUniqueIdentifierName(sourceFile, name) {
|
|
46743
46943
|
if (this.usedIdentifierNames.has(sourceFile) && this.usedIdentifierNames.get(sourceFile).indexOf(name) !== -1) {
|
|
@@ -46746,7 +46946,7 @@ var ImportManager2 = class {
|
|
|
46746
46946
|
const nodeQueue = [sourceFile];
|
|
46747
46947
|
while (nodeQueue.length) {
|
|
46748
46948
|
const node = nodeQueue.shift();
|
|
46749
|
-
if (
|
|
46949
|
+
if (import_typescript109.default.isIdentifier(node) && node.text === name && (!import_typescript109.default.isImportSpecifier(node.parent) || node.parent.propertyName !== node)) {
|
|
46750
46950
|
return false;
|
|
46751
46951
|
}
|
|
46752
46952
|
nodeQueue.push(...node.getChildren());
|
|
@@ -46758,21 +46958,21 @@ var ImportManager2 = class {
|
|
|
46758
46958
|
}
|
|
46759
46959
|
_getEndPositionOfNode(node) {
|
|
46760
46960
|
const nodeEndPos = node.getEnd();
|
|
46761
|
-
const commentRanges =
|
|
46961
|
+
const commentRanges = import_typescript109.default.getTrailingCommentRanges(node.getSourceFile().text, nodeEndPos);
|
|
46762
46962
|
if (!commentRanges || !commentRanges.length) {
|
|
46763
46963
|
return nodeEndPos;
|
|
46764
46964
|
}
|
|
46765
46965
|
return commentRanges[commentRanges.length - 1].end;
|
|
46766
46966
|
}
|
|
46767
46967
|
_getNewImportText(importStartIndex, newImport, sourceFile) {
|
|
46768
|
-
const text2 = this.printer.printNode(
|
|
46968
|
+
const text2 = this.printer.printNode(import_typescript109.default.EmitHint.Unspecified, newImport, sourceFile);
|
|
46769
46969
|
return importStartIndex === 0 ? `${text2}
|
|
46770
46970
|
` : `
|
|
46771
46971
|
${text2}`;
|
|
46772
46972
|
}
|
|
46773
46973
|
_getImportParts(sourceFile, symbolName, alias, keepSymbolName) {
|
|
46774
|
-
const symbolIdentifier =
|
|
46775
|
-
const aliasIdentifier = alias ?
|
|
46974
|
+
const symbolIdentifier = import_typescript109.default.factory.createIdentifier(symbolName);
|
|
46975
|
+
const aliasIdentifier = alias ? import_typescript109.default.factory.createIdentifier(alias) : null;
|
|
46776
46976
|
const generatedUniqueIdentifier = this._getUniqueIdentifier(sourceFile, alias || symbolName);
|
|
46777
46977
|
const needsGeneratedUniqueName = generatedUniqueIdentifier.text !== (alias || symbolName);
|
|
46778
46978
|
let propertyName;
|
|
@@ -46792,7 +46992,7 @@ ${text2}`;
|
|
|
46792
46992
|
if (!this.quoteStyles.hasOwnProperty(sourceFile.fileName)) {
|
|
46793
46993
|
let quoteStyle;
|
|
46794
46994
|
for (const statement of sourceFile.statements) {
|
|
46795
|
-
if (
|
|
46995
|
+
if (import_typescript109.default.isImportDeclaration(statement) && import_typescript109.default.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
46796
46996
|
quoteStyle = statement.moduleSpecifier.getText().trim().startsWith('"') ? 1 : 0;
|
|
46797
46997
|
break;
|
|
46798
46998
|
}
|
|
@@ -46823,7 +47023,7 @@ var ChangeTracker = class {
|
|
|
46823
47023
|
replaceText(sourceFile, start, removeLength, text2) {
|
|
46824
47024
|
this._trackChange(sourceFile, { start, removeLength, text: text2 });
|
|
46825
47025
|
}
|
|
46826
|
-
replaceNode(oldNode, newNode, emitHint =
|
|
47026
|
+
replaceNode(oldNode, newNode, emitHint = import_typescript110.default.EmitHint.Unspecified, sourceFileWhenPrinting) {
|
|
46827
47027
|
const sourceFile = oldNode.getSourceFile();
|
|
46828
47028
|
this.replaceText(sourceFile, oldNode.getStart(), oldNode.getWidth(), this._printer.printNode(emitHint, newNode, sourceFileWhenPrinting || sourceFile));
|
|
46829
47029
|
}
|
|
@@ -46863,7 +47063,7 @@ function normalizePath(path4) {
|
|
|
46863
47063
|
}
|
|
46864
47064
|
|
|
46865
47065
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
|
|
46866
|
-
var
|
|
47066
|
+
var import_core19 = require("@angular-devkit/core");
|
|
46867
47067
|
function getProjectTsConfigPaths(tree) {
|
|
46868
47068
|
return __async(this, null, function* () {
|
|
46869
47069
|
const buildPaths = /* @__PURE__ */ new Set();
|
|
@@ -46880,9 +47080,9 @@ function getProjectTsConfigPaths(tree) {
|
|
|
46880
47080
|
continue;
|
|
46881
47081
|
}
|
|
46882
47082
|
if (name === "build") {
|
|
46883
|
-
buildPaths.add((0,
|
|
47083
|
+
buildPaths.add((0, import_core19.normalize)(tsConfig));
|
|
46884
47084
|
} else {
|
|
46885
|
-
testPaths.add((0,
|
|
47085
|
+
testPaths.add((0, import_core19.normalize)(tsConfig));
|
|
46886
47086
|
}
|
|
46887
47087
|
}
|
|
46888
47088
|
}
|
|
@@ -46914,7 +47114,7 @@ function createHost(tree) {
|
|
|
46914
47114
|
if (!data) {
|
|
46915
47115
|
throw new Error("File not found.");
|
|
46916
47116
|
}
|
|
46917
|
-
return
|
|
47117
|
+
return import_core19.virtualFs.fileBufferToString(data);
|
|
46918
47118
|
});
|
|
46919
47119
|
},
|
|
46920
47120
|
writeFile(path4, data) {
|
|
@@ -46937,30 +47137,30 @@ function createHost(tree) {
|
|
|
46937
47137
|
function getWorkspace(tree) {
|
|
46938
47138
|
return __async(this, null, function* () {
|
|
46939
47139
|
const host = createHost(tree);
|
|
46940
|
-
const { workspace } = yield
|
|
47140
|
+
const { workspace } = yield import_core19.workspaces.readWorkspace("/", host);
|
|
46941
47141
|
return workspace;
|
|
46942
47142
|
});
|
|
46943
47143
|
}
|
|
46944
47144
|
|
|
46945
47145
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
46946
47146
|
var import_path5 = require("path");
|
|
46947
|
-
var
|
|
47147
|
+
var import_typescript112 = __toESM(require("typescript"), 1);
|
|
46948
47148
|
|
|
46949
47149
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
|
|
46950
47150
|
var path3 = __toESM(require("path"), 1);
|
|
46951
|
-
var
|
|
47151
|
+
var import_typescript111 = __toESM(require("typescript"), 1);
|
|
46952
47152
|
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
46953
|
-
const { config } =
|
|
47153
|
+
const { config } = import_typescript111.default.readConfigFile(tsconfigPath, import_typescript111.default.sys.readFile);
|
|
46954
47154
|
const parseConfigHost = {
|
|
46955
|
-
useCaseSensitiveFileNames:
|
|
46956
|
-
fileExists:
|
|
46957
|
-
readDirectory:
|
|
46958
|
-
readFile:
|
|
47155
|
+
useCaseSensitiveFileNames: import_typescript111.default.sys.useCaseSensitiveFileNames,
|
|
47156
|
+
fileExists: import_typescript111.default.sys.fileExists,
|
|
47157
|
+
readDirectory: import_typescript111.default.sys.readDirectory,
|
|
47158
|
+
readFile: import_typescript111.default.sys.readFile
|
|
46959
47159
|
};
|
|
46960
47160
|
if (!path3.isAbsolute(basePath)) {
|
|
46961
47161
|
throw Error("Unexpected relative base path has been specified.");
|
|
46962
47162
|
}
|
|
46963
|
-
return
|
|
47163
|
+
return import_typescript111.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
46964
47164
|
}
|
|
46965
47165
|
|
|
46966
47166
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
@@ -46972,7 +47172,7 @@ function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additi
|
|
|
46972
47172
|
return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
|
|
46973
47173
|
}
|
|
46974
47174
|
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
46975
|
-
const host =
|
|
47175
|
+
const host = import_typescript112.default.createCompilerHost(options, true);
|
|
46976
47176
|
const defaultReadFile = host.readFile;
|
|
46977
47177
|
host.readFile = (fileName) => {
|
|
46978
47178
|
var _a2;
|
|
@@ -46993,24 +47193,24 @@ function canMigrateFile(basePath, sourceFile, program) {
|
|
|
46993
47193
|
}
|
|
46994
47194
|
|
|
46995
47195
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/prune-modules.mjs
|
|
46996
|
-
var
|
|
47196
|
+
var import_typescript117 = __toESM(require("typescript"), 1);
|
|
46997
47197
|
|
|
46998
47198
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
46999
|
-
var
|
|
47199
|
+
var import_typescript114 = __toESM(require("typescript"), 1);
|
|
47000
47200
|
|
|
47001
47201
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
47002
|
-
var
|
|
47202
|
+
var import_typescript113 = __toESM(require("typescript"), 1);
|
|
47003
47203
|
function getImportOfIdentifier(typeChecker, node) {
|
|
47004
47204
|
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
47005
47205
|
if (!symbol || symbol.declarations === void 0 || !symbol.declarations.length) {
|
|
47006
47206
|
return null;
|
|
47007
47207
|
}
|
|
47008
47208
|
const decl = symbol.declarations[0];
|
|
47009
|
-
if (!
|
|
47209
|
+
if (!import_typescript113.default.isImportSpecifier(decl)) {
|
|
47010
47210
|
return null;
|
|
47011
47211
|
}
|
|
47012
47212
|
const importDecl = decl.parent.parent.parent;
|
|
47013
|
-
if (!
|
|
47213
|
+
if (!import_typescript113.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
47014
47214
|
return null;
|
|
47015
47215
|
}
|
|
47016
47216
|
return {
|
|
@@ -47027,10 +47227,10 @@ function getImportSpecifiers(sourceFile, moduleName, specifierNames) {
|
|
|
47027
47227
|
var _a2;
|
|
47028
47228
|
const matches = [];
|
|
47029
47229
|
for (const node of sourceFile.statements) {
|
|
47030
|
-
if (
|
|
47230
|
+
if (import_typescript113.default.isImportDeclaration(node) && import_typescript113.default.isStringLiteral(node.moduleSpecifier)) {
|
|
47031
47231
|
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
47032
47232
|
const namedBindings = (_a2 = node.importClause) == null ? void 0 : _a2.namedBindings;
|
|
47033
|
-
if (isMatch && namedBindings &&
|
|
47233
|
+
if (isMatch && namedBindings && import_typescript113.default.isNamedImports(namedBindings)) {
|
|
47034
47234
|
for (const specifierName of specifierNames) {
|
|
47035
47235
|
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
47036
47236
|
if (match) {
|
|
@@ -47051,7 +47251,7 @@ function findImportSpecifier(nodes, specifierName) {
|
|
|
47051
47251
|
|
|
47052
47252
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
47053
47253
|
function getCallDecoratorImport(typeChecker, decorator) {
|
|
47054
|
-
if (!
|
|
47254
|
+
if (!import_typescript114.default.isCallExpression(decorator.expression) || !import_typescript114.default.isIdentifier(decorator.expression.expression)) {
|
|
47055
47255
|
return null;
|
|
47056
47256
|
}
|
|
47057
47257
|
const identifier = decorator.expression.expression;
|
|
@@ -47069,10 +47269,10 @@ function getAngularDecorators(typeChecker, decorators) {
|
|
|
47069
47269
|
}
|
|
47070
47270
|
|
|
47071
47271
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
|
|
47072
|
-
var
|
|
47272
|
+
var import_typescript115 = __toESM(require("typescript"), 1);
|
|
47073
47273
|
function closestNode(node, predicate) {
|
|
47074
47274
|
let current = node.parent;
|
|
47075
|
-
while (current && !
|
|
47275
|
+
while (current && !import_typescript115.default.isSourceFile(current)) {
|
|
47076
47276
|
if (predicate(current)) {
|
|
47077
47277
|
return current;
|
|
47078
47278
|
}
|
|
@@ -47083,7 +47283,7 @@ function closestNode(node, predicate) {
|
|
|
47083
47283
|
|
|
47084
47284
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/util.mjs
|
|
47085
47285
|
var import_path6 = require("path");
|
|
47086
|
-
var
|
|
47286
|
+
var import_typescript116 = __toESM(require("typescript"), 1);
|
|
47087
47287
|
var UniqueItemTracker = class {
|
|
47088
47288
|
constructor() {
|
|
47089
47289
|
__publicField(this, "_nodes", /* @__PURE__ */ new Map());
|
|
@@ -47132,7 +47332,7 @@ var ReferenceResolver = class {
|
|
|
47132
47332
|
const results = /* @__PURE__ */ new Map();
|
|
47133
47333
|
for (const symbol of referencedSymbols) {
|
|
47134
47334
|
for (const ref of symbol.references) {
|
|
47135
|
-
if (!ref.isDefinition || symbol.definition.kind ===
|
|
47335
|
+
if (!ref.isDefinition || symbol.definition.kind === import_typescript116.default.ScriptElementKind.alias) {
|
|
47136
47336
|
if (!results.has(ref.fileName)) {
|
|
47137
47337
|
results.set(ref.fileName, []);
|
|
47138
47338
|
}
|
|
@@ -47156,7 +47356,7 @@ var ReferenceResolver = class {
|
|
|
47156
47356
|
for (const file of highlights) {
|
|
47157
47357
|
if (file.fileName === fileName) {
|
|
47158
47358
|
for (const { textSpan: { start, length }, kind } of file.highlightSpans) {
|
|
47159
|
-
if (kind !==
|
|
47359
|
+
if (kind !== import_typescript116.default.HighlightSpanKind.none) {
|
|
47160
47360
|
results.push([start, start + length]);
|
|
47161
47361
|
}
|
|
47162
47362
|
}
|
|
@@ -47182,19 +47382,19 @@ var ReferenceResolver = class {
|
|
|
47182
47382
|
rootFileNames.push(fileName);
|
|
47183
47383
|
}
|
|
47184
47384
|
});
|
|
47185
|
-
this._languageService =
|
|
47385
|
+
this._languageService = import_typescript116.default.createLanguageService({
|
|
47186
47386
|
getCompilationSettings: () => this._program.getTsProgram().getCompilerOptions(),
|
|
47187
47387
|
getScriptFileNames: () => rootFileNames,
|
|
47188
47388
|
getScriptVersion: () => "0",
|
|
47189
47389
|
getScriptSnapshot: (path4) => {
|
|
47190
47390
|
const content = this._readFile(path4);
|
|
47191
|
-
return content ?
|
|
47391
|
+
return content ? import_typescript116.default.ScriptSnapshot.fromString(content) : void 0;
|
|
47192
47392
|
},
|
|
47193
47393
|
getCurrentDirectory: () => this._basePath,
|
|
47194
|
-
getDefaultLibFileName: (options) =>
|
|
47394
|
+
getDefaultLibFileName: (options) => import_typescript116.default.getDefaultLibFilePath(options),
|
|
47195
47395
|
readFile: (path4) => this._readFile(path4),
|
|
47196
47396
|
fileExists: (path4) => this._host.fileExists(path4)
|
|
47197
|
-
},
|
|
47397
|
+
}, import_typescript116.default.createDocumentRegistry(), import_typescript116.default.LanguageServiceMode.PartialSemantic);
|
|
47198
47398
|
}
|
|
47199
47399
|
return this._languageService;
|
|
47200
47400
|
}
|
|
@@ -47224,10 +47424,10 @@ function offsetsToNodes(lookup, offsets, results) {
|
|
|
47224
47424
|
}
|
|
47225
47425
|
function findClassDeclaration(reference2, typeChecker) {
|
|
47226
47426
|
var _a2, _b2;
|
|
47227
|
-
return ((_b2 = (_a2 = typeChecker.getTypeAtLocation(reference2).getSymbol()) == null ? void 0 : _a2.declarations) == null ? void 0 : _b2.find(
|
|
47427
|
+
return ((_b2 = (_a2 = typeChecker.getTypeAtLocation(reference2).getSymbol()) == null ? void 0 : _a2.declarations) == null ? void 0 : _b2.find(import_typescript116.default.isClassDeclaration)) || null;
|
|
47228
47428
|
}
|
|
47229
47429
|
function findLiteralProperty(literal3, name) {
|
|
47230
|
-
return literal3.properties.find((prop) => prop.name &&
|
|
47430
|
+
return literal3.properties.find((prop) => prop.name && import_typescript116.default.isIdentifier(prop.name) && prop.name.text === name);
|
|
47231
47431
|
}
|
|
47232
47432
|
function getRelativeImportPath(fromFile, toFile) {
|
|
47233
47433
|
let path4 = (0, import_path6.relative)((0, import_path6.dirname)(fromFile), toFile).replace(/\.ts$/, "");
|
|
@@ -47248,9 +47448,9 @@ function isClassReferenceInAngularModule(node, className, moduleName, typeChecke
|
|
|
47248
47448
|
const externalName = `@angular/${moduleName}`;
|
|
47249
47449
|
const internalName = `angular2/rc/packages/${moduleName}`;
|
|
47250
47450
|
return !!((_a2 = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a2.some((decl) => {
|
|
47251
|
-
const closestClass = closestOrSelf(decl,
|
|
47451
|
+
const closestClass = closestOrSelf(decl, import_typescript116.default.isClassDeclaration);
|
|
47252
47452
|
const closestClassFileName = closestClass == null ? void 0 : closestClass.getSourceFile().fileName;
|
|
47253
|
-
if (!closestClass || !closestClassFileName || !closestClass.name || !
|
|
47453
|
+
if (!closestClass || !closestClassFileName || !closestClass.name || !import_typescript116.default.isIdentifier(closestClass.name) || !closestClassFileName.includes(externalName) && !closestClassFileName.includes(internalName)) {
|
|
47254
47454
|
return false;
|
|
47255
47455
|
}
|
|
47256
47456
|
return typeof className === "string" ? closestClass.name.text === className : className.test(closestClass.name.text);
|
|
@@ -47275,10 +47475,10 @@ function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, pri
|
|
|
47275
47475
|
const nodesToRemove = /* @__PURE__ */ new Set();
|
|
47276
47476
|
sourceFiles.forEach(function walk(node) {
|
|
47277
47477
|
var _a2, _b2;
|
|
47278
|
-
if (
|
|
47478
|
+
if (import_typescript117.default.isClassDeclaration(node) && canRemoveClass(node, typeChecker)) {
|
|
47279
47479
|
collectRemovalLocations(node, removalLocations, referenceResolver, program);
|
|
47280
47480
|
classesToRemove.add(node);
|
|
47281
|
-
} else if (
|
|
47481
|
+
} else if (import_typescript117.default.isExportDeclaration(node) && !node.exportClause && node.moduleSpecifier && import_typescript117.default.isStringLiteralLike(node.moduleSpecifier) && node.moduleSpecifier.text.startsWith(".")) {
|
|
47282
47482
|
const exportedSourceFile = (_b2 = (_a2 = typeChecker.getSymbolAtLocation(node.moduleSpecifier)) == null ? void 0 : _a2.valueDeclaration) == null ? void 0 : _b2.getSourceFile();
|
|
47283
47483
|
if (exportedSourceFile) {
|
|
47284
47484
|
barrelExports.track(exportedSourceFile, node);
|
|
@@ -47324,17 +47524,17 @@ function collectRemovalLocations(ngModule, removalLocations, referenceResolver,
|
|
|
47324
47524
|
}
|
|
47325
47525
|
}
|
|
47326
47526
|
for (const node of nodes) {
|
|
47327
|
-
const closestArray = closestNode(node,
|
|
47527
|
+
const closestArray = closestNode(node, import_typescript117.default.isArrayLiteralExpression);
|
|
47328
47528
|
if (closestArray) {
|
|
47329
47529
|
removalLocations.arrays.track(closestArray, node);
|
|
47330
47530
|
continue;
|
|
47331
47531
|
}
|
|
47332
|
-
const closestImport = closestNode(node,
|
|
47532
|
+
const closestImport = closestNode(node, import_typescript117.default.isNamedImports);
|
|
47333
47533
|
if (closestImport) {
|
|
47334
47534
|
removalLocations.imports.track(closestImport, node);
|
|
47335
47535
|
continue;
|
|
47336
47536
|
}
|
|
47337
|
-
const closestExport = closestNode(node,
|
|
47537
|
+
const closestExport = closestNode(node, import_typescript117.default.isNamedExports);
|
|
47338
47538
|
if (closestExport) {
|
|
47339
47539
|
removalLocations.exports.track(closestExport, node);
|
|
47340
47540
|
continue;
|
|
@@ -47345,24 +47545,24 @@ function collectRemovalLocations(ngModule, removalLocations, referenceResolver,
|
|
|
47345
47545
|
function removeArrayReferences(locations, tracker) {
|
|
47346
47546
|
for (const [array, toRemove] of locations.getEntries()) {
|
|
47347
47547
|
const newElements = filterRemovedElements(array.elements, toRemove);
|
|
47348
|
-
tracker.replaceNode(array,
|
|
47548
|
+
tracker.replaceNode(array, import_typescript117.default.factory.updateArrayLiteralExpression(array, import_typescript117.default.factory.createNodeArray(newElements, array.elements.hasTrailingComma)));
|
|
47349
47549
|
}
|
|
47350
47550
|
}
|
|
47351
47551
|
function removeImportReferences(locations, tracker) {
|
|
47352
47552
|
for (const [namedImports, toRemove] of locations.getEntries()) {
|
|
47353
47553
|
const newElements = filterRemovedElements(namedImports.elements, toRemove);
|
|
47354
47554
|
if (newElements.length === 0) {
|
|
47355
|
-
const importClause = closestNode(namedImports,
|
|
47555
|
+
const importClause = closestNode(namedImports, import_typescript117.default.isImportClause);
|
|
47356
47556
|
if (importClause && importClause.name) {
|
|
47357
|
-
tracker.replaceNode(importClause,
|
|
47557
|
+
tracker.replaceNode(importClause, import_typescript117.default.factory.updateImportClause(importClause, importClause.isTypeOnly, importClause.name, void 0));
|
|
47358
47558
|
} else {
|
|
47359
|
-
const declaration = closestNode(namedImports,
|
|
47559
|
+
const declaration = closestNode(namedImports, import_typescript117.default.isImportDeclaration);
|
|
47360
47560
|
if (declaration) {
|
|
47361
47561
|
tracker.removeNode(declaration);
|
|
47362
47562
|
}
|
|
47363
47563
|
}
|
|
47364
47564
|
} else {
|
|
47365
|
-
tracker.replaceNode(namedImports,
|
|
47565
|
+
tracker.replaceNode(namedImports, import_typescript117.default.factory.updateNamedImports(namedImports, newElements));
|
|
47366
47566
|
}
|
|
47367
47567
|
}
|
|
47368
47568
|
}
|
|
@@ -47370,22 +47570,22 @@ function removeExportReferences(locations, tracker) {
|
|
|
47370
47570
|
for (const [namedExports, toRemove] of locations.getEntries()) {
|
|
47371
47571
|
const newElements = filterRemovedElements(namedExports.elements, toRemove);
|
|
47372
47572
|
if (newElements.length === 0) {
|
|
47373
|
-
const declaration = closestNode(namedExports,
|
|
47573
|
+
const declaration = closestNode(namedExports, import_typescript117.default.isExportDeclaration);
|
|
47374
47574
|
if (declaration) {
|
|
47375
47575
|
tracker.removeNode(declaration);
|
|
47376
47576
|
}
|
|
47377
47577
|
} else {
|
|
47378
|
-
tracker.replaceNode(namedExports,
|
|
47578
|
+
tracker.replaceNode(namedExports, import_typescript117.default.factory.updateNamedExports(namedExports, newElements));
|
|
47379
47579
|
}
|
|
47380
47580
|
}
|
|
47381
47581
|
}
|
|
47382
47582
|
function canRemoveClass(node, typeChecker) {
|
|
47383
47583
|
var _a2;
|
|
47384
47584
|
const decorator = (_a2 = findNgModuleDecorator(node, typeChecker)) == null ? void 0 : _a2.node;
|
|
47385
|
-
if (!decorator || !
|
|
47585
|
+
if (!decorator || !import_typescript117.default.isCallExpression(decorator.expression)) {
|
|
47386
47586
|
return false;
|
|
47387
47587
|
}
|
|
47388
|
-
if (decorator.expression.arguments.length > 0 && !
|
|
47588
|
+
if (decorator.expression.arguments.length > 0 && !import_typescript117.default.isObjectLiteralExpression(decorator.expression.arguments[0])) {
|
|
47389
47589
|
return false;
|
|
47390
47590
|
}
|
|
47391
47591
|
if (node.members.length > 0 && node.members.some((member) => !isEmptyConstructor(member))) {
|
|
@@ -47398,7 +47598,7 @@ function canRemoveClass(node, typeChecker) {
|
|
|
47398
47598
|
const imports = findLiteralProperty(literal3, "imports");
|
|
47399
47599
|
if (imports && isNonEmptyNgModuleProperty(imports)) {
|
|
47400
47600
|
for (const dep of imports.initializer.elements) {
|
|
47401
|
-
if (!
|
|
47601
|
+
if (!import_typescript117.default.isIdentifier(dep)) {
|
|
47402
47602
|
return false;
|
|
47403
47603
|
}
|
|
47404
47604
|
const depDeclaration = findClassDeclaration(dep, typeChecker);
|
|
@@ -47416,15 +47616,15 @@ function canRemoveClass(node, typeChecker) {
|
|
|
47416
47616
|
return true;
|
|
47417
47617
|
}
|
|
47418
47618
|
function isNonEmptyNgModuleProperty(node) {
|
|
47419
|
-
return
|
|
47619
|
+
return import_typescript117.default.isPropertyAssignment(node) && import_typescript117.default.isIdentifier(node.name) && import_typescript117.default.isArrayLiteralExpression(node.initializer) && node.initializer.elements.length > 0;
|
|
47420
47620
|
}
|
|
47421
47621
|
function canRemoveFile(sourceFile, nodesToBeRemoved) {
|
|
47422
47622
|
var _a2;
|
|
47423
47623
|
for (const node of sourceFile.statements) {
|
|
47424
|
-
if (
|
|
47624
|
+
if (import_typescript117.default.isImportDeclaration(node) || nodesToBeRemoved.has(node)) {
|
|
47425
47625
|
continue;
|
|
47426
47626
|
}
|
|
47427
|
-
if (
|
|
47627
|
+
if (import_typescript117.default.isExportDeclaration(node) || import_typescript117.default.canHaveModifiers(node) && ((_a2 = import_typescript117.default.getModifiers(node)) == null ? void 0 : _a2.some((m) => m.kind === import_typescript117.default.SyntaxKind.ExportKeyword))) {
|
|
47428
47628
|
return false;
|
|
47429
47629
|
}
|
|
47430
47630
|
}
|
|
@@ -47444,7 +47644,7 @@ function filterRemovedElements(elements, toRemove) {
|
|
|
47444
47644
|
});
|
|
47445
47645
|
}
|
|
47446
47646
|
function isEmptyConstructor(node) {
|
|
47447
|
-
return
|
|
47647
|
+
return import_typescript117.default.isConstructorDeclaration(node) && node.parameters.length === 0 && (node.body == null || node.body.statements.length === 0);
|
|
47448
47648
|
}
|
|
47449
47649
|
function addRemovalTodos(nodes, tracker) {
|
|
47450
47650
|
for (const node of nodes) {
|
|
@@ -47452,19 +47652,19 @@ function addRemovalTodos(nodes, tracker) {
|
|
|
47452
47652
|
}
|
|
47453
47653
|
}
|
|
47454
47654
|
function findNgModuleDecorator(node, typeChecker) {
|
|
47455
|
-
const decorators = getAngularDecorators(typeChecker,
|
|
47655
|
+
const decorators = getAngularDecorators(typeChecker, import_typescript117.default.getDecorators(node) || []);
|
|
47456
47656
|
return decorators.find((decorator) => decorator.name === "NgModule") || null;
|
|
47457
47657
|
}
|
|
47458
47658
|
|
|
47459
47659
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/standalone-bootstrap.mjs
|
|
47460
47660
|
var import_path7 = require("path");
|
|
47461
|
-
var
|
|
47661
|
+
var import_typescript120 = __toESM(require("typescript"), 1);
|
|
47462
47662
|
|
|
47463
47663
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/to-standalone.mjs
|
|
47464
|
-
var
|
|
47664
|
+
var import_typescript119 = __toESM(require("typescript"), 1);
|
|
47465
47665
|
|
|
47466
47666
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/symbol.mjs
|
|
47467
|
-
var
|
|
47667
|
+
var import_typescript118 = __toESM(require("typescript"), 1);
|
|
47468
47668
|
function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
47469
47669
|
var _a2, _b2;
|
|
47470
47670
|
const nodeSymbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
@@ -47511,8 +47711,8 @@ function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker,
|
|
|
47511
47711
|
const importsToAdd = getComponentImportExpressions(decl, allDeclarations, tracker, typeChecker, importRemapper);
|
|
47512
47712
|
if (importsToAdd.length > 0) {
|
|
47513
47713
|
const hasTrailingComma = importsToAdd.length > 2 && !!((_a2 = extractMetadataLiteral(directiveMeta.decorator)) == null ? void 0 : _a2.properties.hasTrailingComma);
|
|
47514
|
-
decorator = addPropertyToAngularDecorator(decorator,
|
|
47515
|
-
|
|
47714
|
+
decorator = addPropertyToAngularDecorator(decorator, import_typescript119.default.factory.createPropertyAssignment("imports", import_typescript119.default.factory.createArrayLiteralExpression(
|
|
47715
|
+
import_typescript119.default.factory.createNodeArray(importsToAdd, hasTrailingComma),
|
|
47516
47716
|
hasTrailingComma
|
|
47517
47717
|
)));
|
|
47518
47718
|
}
|
|
@@ -47544,11 +47744,11 @@ function getComponentImportExpressions(decl, allDeclarations, tracker, typeCheck
|
|
|
47544
47744
|
const identifier = tracker.addImport(decl.getSourceFile(), importLocation.symbolName, importLocation.moduleSpecifier);
|
|
47545
47745
|
imports.push(identifier);
|
|
47546
47746
|
} else {
|
|
47547
|
-
const identifier =
|
|
47747
|
+
const identifier = import_typescript119.default.factory.createIdentifier(importLocation.symbolName);
|
|
47548
47748
|
if (importLocation.isForwardReference) {
|
|
47549
47749
|
const forwardRefExpression = tracker.addImport(decl.getSourceFile(), "forwardRef", "@angular/core");
|
|
47550
|
-
const arrowFunction =
|
|
47551
|
-
imports.push(
|
|
47750
|
+
const arrowFunction = import_typescript119.default.factory.createArrowFunction(void 0, void 0, [], void 0, void 0, identifier);
|
|
47751
|
+
imports.push(import_typescript119.default.factory.createCallExpression(forwardRefExpression, void 0, [arrowFunction]));
|
|
47552
47752
|
} else {
|
|
47553
47753
|
imports.push(identifier);
|
|
47554
47754
|
}
|
|
@@ -47573,11 +47773,11 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
47573
47773
|
const declarationsToCopy = [];
|
|
47574
47774
|
const properties = [];
|
|
47575
47775
|
const importsProp = findLiteralProperty(literal3, "imports");
|
|
47576
|
-
const hasAnyArrayTrailingComma = literal3.properties.some((prop) =>
|
|
47577
|
-
if (
|
|
47578
|
-
if (
|
|
47776
|
+
const hasAnyArrayTrailingComma = literal3.properties.some((prop) => import_typescript119.default.isPropertyAssignment(prop) && import_typescript119.default.isArrayLiteralExpression(prop.initializer) && prop.initializer.elements.hasTrailingComma);
|
|
47777
|
+
if (import_typescript119.default.isPropertyAssignment(declarationsProp)) {
|
|
47778
|
+
if (import_typescript119.default.isArrayLiteralExpression(declarationsProp.initializer)) {
|
|
47579
47779
|
for (const el of declarationsProp.initializer.elements) {
|
|
47580
|
-
if (
|
|
47780
|
+
if (import_typescript119.default.isIdentifier(el)) {
|
|
47581
47781
|
const correspondingClass = findClassDeclaration(el, typeChecker);
|
|
47582
47782
|
if (!correspondingClass || isStandaloneDeclaration(correspondingClass, allDeclarations, templateTypeChecker)) {
|
|
47583
47783
|
declarationsToCopy.push(el);
|
|
@@ -47589,11 +47789,11 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
47589
47789
|
}
|
|
47590
47790
|
}
|
|
47591
47791
|
} else {
|
|
47592
|
-
declarationsToCopy.push(
|
|
47792
|
+
declarationsToCopy.push(import_typescript119.default.factory.createSpreadElement(declarationsProp.initializer));
|
|
47593
47793
|
}
|
|
47594
47794
|
}
|
|
47595
47795
|
if (!importsProp && declarationsToCopy.length > 0) {
|
|
47596
|
-
properties.push(
|
|
47796
|
+
properties.push(import_typescript119.default.factory.createPropertyAssignment("imports", import_typescript119.default.factory.createArrayLiteralExpression(import_typescript119.default.factory.createNodeArray(declarationsToCopy, hasAnyArrayTrailingComma && declarationsToCopy.length > 2))));
|
|
47597
47797
|
}
|
|
47598
47798
|
for (const prop of literal3.properties) {
|
|
47599
47799
|
if (!isNamedPropertyAssignment(prop)) {
|
|
@@ -47602,49 +47802,49 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
47602
47802
|
}
|
|
47603
47803
|
if (prop === declarationsProp) {
|
|
47604
47804
|
if (declarationsToPreserve.length > 0) {
|
|
47605
|
-
const hasTrailingComma =
|
|
47606
|
-
properties.push(
|
|
47805
|
+
const hasTrailingComma = import_typescript119.default.isArrayLiteralExpression(prop.initializer) ? prop.initializer.elements.hasTrailingComma : hasAnyArrayTrailingComma;
|
|
47806
|
+
properties.push(import_typescript119.default.factory.updatePropertyAssignment(prop, prop.name, import_typescript119.default.factory.createArrayLiteralExpression(import_typescript119.default.factory.createNodeArray(declarationsToPreserve, hasTrailingComma && declarationsToPreserve.length > 2))));
|
|
47607
47807
|
}
|
|
47608
47808
|
continue;
|
|
47609
47809
|
}
|
|
47610
47810
|
if (prop === importsProp && declarationsToCopy.length > 0) {
|
|
47611
47811
|
let initializer;
|
|
47612
|
-
if (
|
|
47613
|
-
initializer =
|
|
47812
|
+
if (import_typescript119.default.isArrayLiteralExpression(prop.initializer)) {
|
|
47813
|
+
initializer = import_typescript119.default.factory.updateArrayLiteralExpression(prop.initializer, import_typescript119.default.factory.createNodeArray([...prop.initializer.elements, ...declarationsToCopy], prop.initializer.elements.hasTrailingComma));
|
|
47614
47814
|
} else {
|
|
47615
|
-
initializer =
|
|
47616
|
-
[
|
|
47815
|
+
initializer = import_typescript119.default.factory.createArrayLiteralExpression(import_typescript119.default.factory.createNodeArray(
|
|
47816
|
+
[import_typescript119.default.factory.createSpreadElement(prop.initializer), ...declarationsToCopy],
|
|
47617
47817
|
hasAnyArrayTrailingComma && declarationsToCopy.length > 1
|
|
47618
47818
|
));
|
|
47619
47819
|
}
|
|
47620
|
-
properties.push(
|
|
47820
|
+
properties.push(import_typescript119.default.factory.updatePropertyAssignment(prop, prop.name, initializer));
|
|
47621
47821
|
continue;
|
|
47622
47822
|
}
|
|
47623
47823
|
properties.push(prop);
|
|
47624
47824
|
}
|
|
47625
|
-
tracker.replaceNode(literal3,
|
|
47825
|
+
tracker.replaceNode(literal3, import_typescript119.default.factory.updateObjectLiteralExpression(literal3, import_typescript119.default.factory.createNodeArray(properties, literal3.properties.hasTrailingComma)), import_typescript119.default.EmitHint.Expression);
|
|
47626
47826
|
}
|
|
47627
47827
|
function addStandaloneToDecorator(node) {
|
|
47628
|
-
return addPropertyToAngularDecorator(node,
|
|
47828
|
+
return addPropertyToAngularDecorator(node, import_typescript119.default.factory.createPropertyAssignment("standalone", import_typescript119.default.factory.createToken(import_typescript119.default.SyntaxKind.TrueKeyword)));
|
|
47629
47829
|
}
|
|
47630
47830
|
function addPropertyToAngularDecorator(node, property2) {
|
|
47631
|
-
if (!
|
|
47831
|
+
if (!import_typescript119.default.isCallExpression(node.expression) || node.expression.arguments.length > 1) {
|
|
47632
47832
|
return node;
|
|
47633
47833
|
}
|
|
47634
47834
|
let literalProperties;
|
|
47635
47835
|
let hasTrailingComma = false;
|
|
47636
47836
|
if (node.expression.arguments.length === 0) {
|
|
47637
47837
|
literalProperties = [property2];
|
|
47638
|
-
} else if (
|
|
47838
|
+
} else if (import_typescript119.default.isObjectLiteralExpression(node.expression.arguments[0])) {
|
|
47639
47839
|
hasTrailingComma = node.expression.arguments[0].properties.hasTrailingComma;
|
|
47640
47840
|
literalProperties = [...node.expression.arguments[0].properties, property2];
|
|
47641
47841
|
} else {
|
|
47642
47842
|
return node;
|
|
47643
47843
|
}
|
|
47644
|
-
return
|
|
47844
|
+
return import_typescript119.default.factory.createDecorator(import_typescript119.default.factory.createCallExpression(node.expression.expression, node.expression.typeArguments, [import_typescript119.default.factory.createObjectLiteralExpression(import_typescript119.default.factory.createNodeArray(literalProperties, hasTrailingComma), literalProperties.length > 1)]));
|
|
47645
47845
|
}
|
|
47646
47846
|
function isNamedPropertyAssignment(node) {
|
|
47647
|
-
return
|
|
47847
|
+
return import_typescript119.default.isPropertyAssignment(node) && node.name && import_typescript119.default.isIdentifier(node.name);
|
|
47648
47848
|
}
|
|
47649
47849
|
function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
47650
47850
|
const importLocations = typeChecker.getPotentialImportsFor(target, inComponent, importMode);
|
|
@@ -47664,14 +47864,14 @@ function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
|
47664
47864
|
return firstSameFileImport || firstModuleImport || importLocations[0] || null;
|
|
47665
47865
|
}
|
|
47666
47866
|
function hasNgModuleMetadataElements(node) {
|
|
47667
|
-
return
|
|
47867
|
+
return import_typescript119.default.isPropertyAssignment(node) && (!import_typescript119.default.isArrayLiteralExpression(node.initializer) || node.initializer.elements.length > 0);
|
|
47668
47868
|
}
|
|
47669
47869
|
function findNgModuleClassesToMigrate(sourceFile, typeChecker) {
|
|
47670
47870
|
const modules = [];
|
|
47671
47871
|
if (getImportSpecifier(sourceFile, "@angular/core", "NgModule")) {
|
|
47672
47872
|
sourceFile.forEachChild(function walk(node) {
|
|
47673
|
-
if (
|
|
47674
|
-
const decorator = getAngularDecorators(typeChecker,
|
|
47873
|
+
if (import_typescript119.default.isClassDeclaration(node)) {
|
|
47874
|
+
const decorator = getAngularDecorators(typeChecker, import_typescript119.default.getDecorators(node) || []).find((current) => current.name === "NgModule");
|
|
47675
47875
|
const metadata = decorator ? extractMetadataLiteral(decorator.node) : null;
|
|
47676
47876
|
if (metadata) {
|
|
47677
47877
|
const declarations = findLiteralProperty(metadata, "declarations");
|
|
@@ -47691,8 +47891,8 @@ function findTestObjectsToMigrate(sourceFile, typeChecker) {
|
|
|
47691
47891
|
const catalystImport = getImportSpecifier(sourceFile, /testing\/catalyst$/, "setupModule");
|
|
47692
47892
|
if (testBedImport || catalystImport) {
|
|
47693
47893
|
sourceFile.forEachChild(function walk(node) {
|
|
47694
|
-
if (
|
|
47695
|
-
if (testBedImport &&
|
|
47894
|
+
if (import_typescript119.default.isCallExpression(node) && node.arguments.length > 0 && import_typescript119.default.isObjectLiteralExpression(node.arguments[0])) {
|
|
47895
|
+
if (testBedImport && import_typescript119.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "configureTestingModule" && isReferenceToImport(typeChecker, node.expression.expression, testBedImport) || catalystImport && import_typescript119.default.isIdentifier(node.expression) && isReferenceToImport(typeChecker, node.expression, catalystImport)) {
|
|
47696
47896
|
testObjects.push(node.arguments[0]);
|
|
47697
47897
|
}
|
|
47698
47898
|
}
|
|
@@ -47707,7 +47907,7 @@ function findTemplateDependencies(decl, typeChecker) {
|
|
|
47707
47907
|
const usedPipes = typeChecker.getUsedPipes(decl);
|
|
47708
47908
|
if (usedDirectives !== null) {
|
|
47709
47909
|
for (const dir of usedDirectives) {
|
|
47710
|
-
if (
|
|
47910
|
+
if (import_typescript119.default.isClassDeclaration(dir.ref.node)) {
|
|
47711
47911
|
results.push(dir.ref);
|
|
47712
47912
|
}
|
|
47713
47913
|
}
|
|
@@ -47715,7 +47915,7 @@ function findTemplateDependencies(decl, typeChecker) {
|
|
|
47715
47915
|
if (usedPipes !== null) {
|
|
47716
47916
|
const potentialPipes = typeChecker.getPotentialPipes(decl);
|
|
47717
47917
|
for (const pipe2 of potentialPipes) {
|
|
47718
|
-
if (
|
|
47918
|
+
if (import_typescript119.default.isClassDeclaration(pipe2.ref.node) && usedPipes.some((current) => pipe2.name === current)) {
|
|
47719
47919
|
results.push(pipe2.ref);
|
|
47720
47920
|
}
|
|
47721
47921
|
}
|
|
@@ -47729,12 +47929,12 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
47729
47929
|
if (!bootstrapProp) {
|
|
47730
47930
|
return declarations;
|
|
47731
47931
|
}
|
|
47732
|
-
if (!
|
|
47932
|
+
if (!import_typescript119.default.isPropertyAssignment(bootstrapProp) || !import_typescript119.default.isArrayLiteralExpression(bootstrapProp.initializer)) {
|
|
47733
47933
|
return [];
|
|
47734
47934
|
}
|
|
47735
47935
|
const bootstrappedClasses = /* @__PURE__ */ new Set();
|
|
47736
47936
|
for (const el of bootstrapProp.initializer.elements) {
|
|
47737
|
-
const referencedClass =
|
|
47937
|
+
const referencedClass = import_typescript119.default.isIdentifier(el) ? findClassDeclaration(el, typeChecker) : null;
|
|
47738
47938
|
if (referencedClass) {
|
|
47739
47939
|
bootstrappedClasses.add(referencedClass);
|
|
47740
47940
|
} else {
|
|
@@ -47745,14 +47945,14 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
47745
47945
|
}
|
|
47746
47946
|
function extractDeclarationsFromModule(ngModule, templateTypeChecker) {
|
|
47747
47947
|
const metadata = templateTypeChecker.getNgModuleMetadata(ngModule);
|
|
47748
|
-
return metadata ? metadata.declarations.filter((decl) =>
|
|
47948
|
+
return metadata ? metadata.declarations.filter((decl) => import_typescript119.default.isClassDeclaration(decl.node)).map((decl) => decl.node) : [];
|
|
47749
47949
|
}
|
|
47750
47950
|
function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tracker, templateTypeChecker, typeChecker) {
|
|
47751
47951
|
var _a2;
|
|
47752
47952
|
const { decorators, componentImports } = analyzeTestingModules(testObjects, typeChecker);
|
|
47753
47953
|
const allDeclarations = new Set(declarationsOutsideOfTestFiles);
|
|
47754
47954
|
for (const decorator of decorators) {
|
|
47755
|
-
const closestClass = closestNode(decorator.node,
|
|
47955
|
+
const closestClass = closestNode(decorator.node, import_typescript119.default.isClassDeclaration);
|
|
47756
47956
|
if (decorator.name === "Pipe" || decorator.name === "Directive") {
|
|
47757
47957
|
tracker.replaceNode(decorator.node, addStandaloneToDecorator(decorator.node));
|
|
47758
47958
|
if (closestClass) {
|
|
@@ -47766,8 +47966,8 @@ function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tr
|
|
|
47766
47966
|
}
|
|
47767
47967
|
if (importsToAdd && importsToAdd.size > 0) {
|
|
47768
47968
|
const hasTrailingComma = importsToAdd.size > 2 && !!((_a2 = extractMetadataLiteral(decorator.node)) == null ? void 0 : _a2.properties.hasTrailingComma);
|
|
47769
|
-
const importsArray =
|
|
47770
|
-
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator,
|
|
47969
|
+
const importsArray = import_typescript119.default.factory.createNodeArray(Array.from(importsToAdd), hasTrailingComma);
|
|
47970
|
+
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator, import_typescript119.default.factory.createPropertyAssignment("imports", import_typescript119.default.factory.createArrayLiteralExpression(importsArray))));
|
|
47771
47971
|
} else {
|
|
47772
47972
|
tracker.replaceNode(decorator.node, newDecorator);
|
|
47773
47973
|
}
|
|
@@ -47788,13 +47988,13 @@ function analyzeTestingModules(testObjects, typeChecker) {
|
|
|
47788
47988
|
}
|
|
47789
47989
|
const importsProp = findLiteralProperty(obj, "imports");
|
|
47790
47990
|
const importElements = importsProp && hasNgModuleMetadataElements(importsProp) ? importsProp.initializer.elements.filter((el) => {
|
|
47791
|
-
return !
|
|
47991
|
+
return !import_typescript119.default.isCallExpression(el) && !isClassReferenceInAngularModule(el, /^BrowserAnimationsModule|NoopAnimationsModule$/, "platform-browser/animations", typeChecker);
|
|
47792
47992
|
}) : null;
|
|
47793
47993
|
for (const decl of declarations) {
|
|
47794
47994
|
if (seenDeclarations.has(decl)) {
|
|
47795
47995
|
continue;
|
|
47796
47996
|
}
|
|
47797
|
-
const [decorator] = getAngularDecorators(typeChecker,
|
|
47997
|
+
const [decorator] = getAngularDecorators(typeChecker, import_typescript119.default.getDecorators(decl) || []);
|
|
47798
47998
|
if (decorator) {
|
|
47799
47999
|
seenDeclarations.add(decl);
|
|
47800
48000
|
decorators.push(decorator);
|
|
@@ -47825,7 +48025,7 @@ function extractDeclarationsFromTestObject(obj, typeChecker) {
|
|
|
47825
48025
|
return results;
|
|
47826
48026
|
}
|
|
47827
48027
|
function extractMetadataLiteral(decorator) {
|
|
47828
|
-
return
|
|
48028
|
+
return import_typescript119.default.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && import_typescript119.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
|
|
47829
48029
|
}
|
|
47830
48030
|
function isStandaloneDeclaration(node, declarationsInMigration, templateTypeChecker) {
|
|
47831
48031
|
if (declarationsInMigration.has(node)) {
|
|
@@ -47847,7 +48047,7 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
47847
48047
|
const additionalProviders = hasImport(program, rootFileNames, "protractor") ? /* @__PURE__ */ new Map([["provideProtractorTestingSupport", "@angular/platform-browser"]]) : null;
|
|
47848
48048
|
for (const sourceFile of sourceFiles) {
|
|
47849
48049
|
sourceFile.forEachChild(function walk(node) {
|
|
47850
|
-
if (
|
|
48050
|
+
if (import_typescript120.default.isCallExpression(node) && import_typescript120.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "bootstrapModule" && isClassReferenceInAngularModule(node.expression, "PlatformRef", "core", typeChecker)) {
|
|
47851
48051
|
const call2 = analyzeBootstrapCall(node, typeChecker, templateTypeChecker);
|
|
47852
48052
|
if (call2) {
|
|
47853
48053
|
bootstrapCalls.push(call2);
|
|
@@ -47868,24 +48068,24 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
47868
48068
|
return tracker.recordChanges();
|
|
47869
48069
|
}
|
|
47870
48070
|
function analyzeBootstrapCall(call2, typeChecker, templateTypeChecker) {
|
|
47871
|
-
if (call2.arguments.length === 0 || !
|
|
48071
|
+
if (call2.arguments.length === 0 || !import_typescript120.default.isIdentifier(call2.arguments[0])) {
|
|
47872
48072
|
return null;
|
|
47873
48073
|
}
|
|
47874
48074
|
const declaration = findClassDeclaration(call2.arguments[0], typeChecker);
|
|
47875
48075
|
if (!declaration) {
|
|
47876
48076
|
return null;
|
|
47877
48077
|
}
|
|
47878
|
-
const decorator = getAngularDecorators(typeChecker,
|
|
47879
|
-
if (!decorator || decorator.node.expression.arguments.length === 0 || !
|
|
48078
|
+
const decorator = getAngularDecorators(typeChecker, import_typescript120.default.getDecorators(declaration) || []).find((decorator2) => decorator2.name === "NgModule");
|
|
48079
|
+
if (!decorator || decorator.node.expression.arguments.length === 0 || !import_typescript120.default.isObjectLiteralExpression(decorator.node.expression.arguments[0])) {
|
|
47880
48080
|
return null;
|
|
47881
48081
|
}
|
|
47882
48082
|
const metadata = decorator.node.expression.arguments[0];
|
|
47883
48083
|
const bootstrapProp = findLiteralProperty(metadata, "bootstrap");
|
|
47884
|
-
if (!bootstrapProp || !
|
|
48084
|
+
if (!bootstrapProp || !import_typescript120.default.isPropertyAssignment(bootstrapProp) || !import_typescript120.default.isArrayLiteralExpression(bootstrapProp.initializer) || bootstrapProp.initializer.elements.length === 0 || !import_typescript120.default.isIdentifier(bootstrapProp.initializer.elements[0])) {
|
|
47885
48085
|
return null;
|
|
47886
48086
|
}
|
|
47887
48087
|
const component = findClassDeclaration(bootstrapProp.initializer.elements[0], typeChecker);
|
|
47888
|
-
if (component && component.name &&
|
|
48088
|
+
if (component && component.name && import_typescript120.default.isIdentifier(component.name)) {
|
|
47889
48089
|
return {
|
|
47890
48090
|
module: declaration,
|
|
47891
48091
|
metadata,
|
|
@@ -47907,22 +48107,22 @@ function migrateBootstrapCall(analysis, tracker, additionalProviders, referenceR
|
|
|
47907
48107
|
let nodeLookup = null;
|
|
47908
48108
|
tracker.insertText(moduleSourceFile, analysis.metadata.getStart(), "/* TODO(standalone-migration): clean up removed NgModule class manually. \n");
|
|
47909
48109
|
tracker.insertText(moduleSourceFile, analysis.metadata.getEnd(), " */");
|
|
47910
|
-
if (providers &&
|
|
48110
|
+
if (providers && import_typescript120.default.isPropertyAssignment(providers)) {
|
|
47911
48111
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
47912
|
-
if (
|
|
48112
|
+
if (import_typescript120.default.isArrayLiteralExpression(providers.initializer)) {
|
|
47913
48113
|
providersInNewCall.push(...providers.initializer.elements);
|
|
47914
48114
|
} else {
|
|
47915
|
-
providersInNewCall.push(
|
|
48115
|
+
providersInNewCall.push(import_typescript120.default.factory.createSpreadElement(providers.initializer));
|
|
47916
48116
|
}
|
|
47917
48117
|
addNodesToCopy(sourceFile, providers, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
47918
48118
|
}
|
|
47919
|
-
if (imports &&
|
|
48119
|
+
if (imports && import_typescript120.default.isPropertyAssignment(imports)) {
|
|
47920
48120
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
47921
48121
|
migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, moduleImportsInNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker);
|
|
47922
48122
|
}
|
|
47923
48123
|
if (additionalProviders) {
|
|
47924
48124
|
additionalProviders.forEach((moduleSpecifier, name) => {
|
|
47925
|
-
providersInNewCall.push(
|
|
48125
|
+
providersInNewCall.push(import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, name, moduleSpecifier), void 0, void 0));
|
|
47926
48126
|
});
|
|
47927
48127
|
}
|
|
47928
48128
|
if (nodesToCopy.size > 0) {
|
|
@@ -47932,7 +48132,7 @@ function migrateBootstrapCall(analysis, tracker, additionalProviders, referenceR
|
|
|
47932
48132
|
if (transformedNode === node) {
|
|
47933
48133
|
text2 += transformedNode.getText() + "\n";
|
|
47934
48134
|
} else {
|
|
47935
|
-
text2 += printer.printNode(
|
|
48135
|
+
text2 += printer.printNode(import_typescript120.default.EmitHint.Unspecified, transformedNode, node.getSourceFile());
|
|
47936
48136
|
}
|
|
47937
48137
|
});
|
|
47938
48138
|
text2 += "\n";
|
|
@@ -47949,31 +48149,31 @@ function replaceBootstrapCallExpression(analysis, providers, modules, tracker) {
|
|
|
47949
48149
|
const combinedProviders = [];
|
|
47950
48150
|
if (modules.length > 0) {
|
|
47951
48151
|
const importProvidersExpression = tracker.addImport(sourceFile, "importProvidersFrom", "@angular/core");
|
|
47952
|
-
combinedProviders.push(
|
|
48152
|
+
combinedProviders.push(import_typescript120.default.factory.createCallExpression(importProvidersExpression, [], modules));
|
|
47953
48153
|
}
|
|
47954
48154
|
combinedProviders.push(...providers);
|
|
47955
|
-
const providersArray =
|
|
47956
|
-
const initializer = remapDynamicImports(sourceFile.fileName,
|
|
47957
|
-
args.push(
|
|
48155
|
+
const providersArray = import_typescript120.default.factory.createNodeArray(combinedProviders, analysis.metadata.properties.hasTrailingComma && combinedProviders.length > 2);
|
|
48156
|
+
const initializer = remapDynamicImports(sourceFile.fileName, import_typescript120.default.factory.createArrayLiteralExpression(providersArray, combinedProviders.length > 1));
|
|
48157
|
+
args.push(import_typescript120.default.factory.createObjectLiteralExpression([import_typescript120.default.factory.createPropertyAssignment("providers", initializer)], true));
|
|
47958
48158
|
}
|
|
47959
48159
|
tracker.replaceNode(
|
|
47960
48160
|
analysis.call,
|
|
47961
|
-
|
|
48161
|
+
import_typescript120.default.factory.createCallExpression(bootstrapExpression, [], args),
|
|
47962
48162
|
void 0,
|
|
47963
48163
|
analysis.metadata.getSourceFile()
|
|
47964
48164
|
);
|
|
47965
48165
|
}
|
|
47966
48166
|
function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, importsForNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker) {
|
|
47967
|
-
if (!
|
|
48167
|
+
if (!import_typescript120.default.isArrayLiteralExpression(imports.initializer)) {
|
|
47968
48168
|
importsForNewCall.push(imports.initializer);
|
|
47969
48169
|
return;
|
|
47970
48170
|
}
|
|
47971
48171
|
for (const element2 of imports.initializer.elements) {
|
|
47972
|
-
if (
|
|
48172
|
+
if (import_typescript120.default.isCallExpression(element2) && import_typescript120.default.isPropertyAccessExpression(element2.expression) && element2.arguments.length > 0 && element2.expression.name.text === "forRoot" && isClassReferenceInAngularModule(element2.expression.expression, "RouterModule", "router", typeChecker)) {
|
|
47973
48173
|
const options = element2.arguments[1];
|
|
47974
48174
|
const features = options ? getRouterModuleForRootFeatures(sourceFile, options, tracker) : [];
|
|
47975
48175
|
if (features !== null) {
|
|
47976
|
-
providersInNewCall.push(
|
|
48176
|
+
providersInNewCall.push(import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideRouter", "@angular/router"), [], [element2.arguments[0], ...features]));
|
|
47977
48177
|
addNodesToCopy(sourceFile, element2.arguments[0], nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
47978
48178
|
if (options) {
|
|
47979
48179
|
addNodesToCopy(sourceFile, options, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
@@ -47981,30 +48181,30 @@ function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, imports
|
|
|
47981
48181
|
continue;
|
|
47982
48182
|
}
|
|
47983
48183
|
}
|
|
47984
|
-
if (
|
|
48184
|
+
if (import_typescript120.default.isIdentifier(element2)) {
|
|
47985
48185
|
const animationsModule = "platform-browser/animations";
|
|
47986
48186
|
const animationsImport = `@angular/${animationsModule}`;
|
|
47987
48187
|
if (isClassReferenceInAngularModule(element2, "BrowserAnimationsModule", animationsModule, typeChecker)) {
|
|
47988
|
-
providersInNewCall.push(
|
|
48188
|
+
providersInNewCall.push(import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideAnimations", animationsImport), [], []));
|
|
47989
48189
|
continue;
|
|
47990
48190
|
}
|
|
47991
48191
|
if (isClassReferenceInAngularModule(element2, "NoopAnimationsModule", animationsModule, typeChecker)) {
|
|
47992
|
-
providersInNewCall.push(
|
|
48192
|
+
providersInNewCall.push(import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideNoopAnimations", animationsImport), [], []));
|
|
47993
48193
|
continue;
|
|
47994
48194
|
}
|
|
47995
48195
|
const httpClientModule = "common/http";
|
|
47996
48196
|
const httpClientImport = `@angular/${httpClientModule}`;
|
|
47997
48197
|
if (isClassReferenceInAngularModule(element2, "HttpClientModule", httpClientModule, typeChecker)) {
|
|
47998
48198
|
const callArgs = [
|
|
47999
|
-
|
|
48199
|
+
import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, "withInterceptorsFromDi", httpClientImport), [], [])
|
|
48000
48200
|
];
|
|
48001
|
-
providersInNewCall.push(
|
|
48201
|
+
providersInNewCall.push(import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideHttpClient", httpClientImport), [], callArgs));
|
|
48002
48202
|
continue;
|
|
48003
48203
|
}
|
|
48004
48204
|
}
|
|
48005
|
-
const target =
|
|
48205
|
+
const target = import_typescript120.default.isCallExpression(element2) && import_typescript120.default.isPropertyAccessExpression(element2.expression) ? element2.expression.expression : element2;
|
|
48006
48206
|
const classDeclaration = findClassDeclaration(target, typeChecker);
|
|
48007
|
-
const decorators = classDeclaration ? getAngularDecorators(typeChecker,
|
|
48207
|
+
const decorators = classDeclaration ? getAngularDecorators(typeChecker, import_typescript120.default.getDecorators(classDeclaration) || []) : void 0;
|
|
48008
48208
|
if (!decorators || decorators.length === 0 || decorators.every(({ name }) => name !== "Directive" && name !== "Component" && name !== "Pipe")) {
|
|
48009
48209
|
importsForNewCall.push(element2);
|
|
48010
48210
|
addNodesToCopy(sourceFile, element2, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
@@ -48012,7 +48212,7 @@ function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, imports
|
|
|
48012
48212
|
}
|
|
48013
48213
|
}
|
|
48014
48214
|
function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
48015
|
-
if (!
|
|
48215
|
+
if (!import_typescript120.default.isObjectLiteralExpression(options)) {
|
|
48016
48216
|
return null;
|
|
48017
48217
|
}
|
|
48018
48218
|
const featureExpressions = [];
|
|
@@ -48020,7 +48220,7 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
48020
48220
|
const inMemoryScrollingOptions = [];
|
|
48021
48221
|
const features = new UniqueItemTracker();
|
|
48022
48222
|
for (const prop of options.properties) {
|
|
48023
|
-
if (!
|
|
48223
|
+
if (!import_typescript120.default.isPropertyAssignment(prop) || !import_typescript120.default.isIdentifier(prop.name) && !import_typescript120.default.isStringLiteralLike(prop.name)) {
|
|
48024
48224
|
return null;
|
|
48025
48225
|
}
|
|
48026
48226
|
switch (prop.name.text) {
|
|
@@ -48028,12 +48228,12 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
48028
48228
|
features.track("withPreloading", prop.initializer);
|
|
48029
48229
|
break;
|
|
48030
48230
|
case "enableTracing":
|
|
48031
|
-
if (prop.initializer.kind ===
|
|
48231
|
+
if (prop.initializer.kind === import_typescript120.default.SyntaxKind.TrueKeyword) {
|
|
48032
48232
|
features.track("withDebugTracing", null);
|
|
48033
48233
|
}
|
|
48034
48234
|
break;
|
|
48035
48235
|
case "initialNavigation":
|
|
48036
|
-
if (!
|
|
48236
|
+
if (!import_typescript120.default.isStringLiteralLike(prop.initializer)) {
|
|
48037
48237
|
return null;
|
|
48038
48238
|
}
|
|
48039
48239
|
if (prop.initializer.text === "enabledBlocking" || prop.initializer.text === "enabled") {
|
|
@@ -48043,7 +48243,7 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
48043
48243
|
}
|
|
48044
48244
|
break;
|
|
48045
48245
|
case "useHash":
|
|
48046
|
-
if (prop.initializer.kind ===
|
|
48246
|
+
if (prop.initializer.kind === import_typescript120.default.SyntaxKind.TrueKeyword) {
|
|
48047
48247
|
features.track("withHashLocation", null);
|
|
48048
48248
|
}
|
|
48049
48249
|
break;
|
|
@@ -48060,10 +48260,10 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
48060
48260
|
}
|
|
48061
48261
|
}
|
|
48062
48262
|
if (inMemoryScrollingOptions.length > 0) {
|
|
48063
|
-
features.track("withInMemoryScrolling",
|
|
48263
|
+
features.track("withInMemoryScrolling", import_typescript120.default.factory.createObjectLiteralExpression(inMemoryScrollingOptions));
|
|
48064
48264
|
}
|
|
48065
48265
|
if (configOptions.length > 0) {
|
|
48066
|
-
features.track("withRouterConfig",
|
|
48266
|
+
features.track("withRouterConfig", import_typescript120.default.factory.createObjectLiteralExpression(configOptions));
|
|
48067
48267
|
}
|
|
48068
48268
|
for (const [feature, featureArgs] of features.getEntries()) {
|
|
48069
48269
|
const callArgs = [];
|
|
@@ -48072,25 +48272,25 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
48072
48272
|
callArgs.push(arg);
|
|
48073
48273
|
}
|
|
48074
48274
|
});
|
|
48075
|
-
featureExpressions.push(
|
|
48275
|
+
featureExpressions.push(import_typescript120.default.factory.createCallExpression(tracker.addImport(sourceFile, feature, "@angular/router"), [], callArgs));
|
|
48076
48276
|
}
|
|
48077
48277
|
return featureExpressions;
|
|
48078
48278
|
}
|
|
48079
48279
|
function addNodesToCopy(targetFile, rootNode, nodeLookup, tracker, nodesToCopy, referenceResolver) {
|
|
48080
48280
|
const refs = findAllSameFileReferences(rootNode, nodeLookup, referenceResolver);
|
|
48081
48281
|
for (const ref of refs) {
|
|
48082
|
-
const importSpecifier = closestOrSelf(ref,
|
|
48083
|
-
const importDeclaration = importSpecifier ? closestNode(importSpecifier,
|
|
48084
|
-
if (importDeclaration && importSpecifier &&
|
|
48282
|
+
const importSpecifier = closestOrSelf(ref, import_typescript120.default.isImportSpecifier);
|
|
48283
|
+
const importDeclaration = importSpecifier ? closestNode(importSpecifier, import_typescript120.default.isImportDeclaration) : null;
|
|
48284
|
+
if (importDeclaration && importSpecifier && import_typescript120.default.isStringLiteralLike(importDeclaration.moduleSpecifier)) {
|
|
48085
48285
|
const moduleName = importDeclaration.moduleSpecifier.text.startsWith(".") ? remapRelativeImport(targetFile.fileName, importDeclaration.moduleSpecifier) : importDeclaration.moduleSpecifier.text;
|
|
48086
48286
|
const symbolName = importSpecifier.propertyName ? importSpecifier.propertyName.text : importSpecifier.name.text;
|
|
48087
48287
|
const alias = importSpecifier.propertyName ? importSpecifier.name.text : null;
|
|
48088
48288
|
tracker.addImport(targetFile, symbolName, moduleName, alias);
|
|
48089
48289
|
continue;
|
|
48090
48290
|
}
|
|
48091
|
-
const variableDeclaration = closestOrSelf(ref,
|
|
48092
|
-
const variableStatement = variableDeclaration ? closestNode(variableDeclaration,
|
|
48093
|
-
if (variableDeclaration && variableStatement &&
|
|
48291
|
+
const variableDeclaration = closestOrSelf(ref, import_typescript120.default.isVariableDeclaration);
|
|
48292
|
+
const variableStatement = variableDeclaration ? closestNode(variableDeclaration, import_typescript120.default.isVariableStatement) : null;
|
|
48293
|
+
if (variableDeclaration && variableStatement && import_typescript120.default.isIdentifier(variableDeclaration.name)) {
|
|
48094
48294
|
if (isExported(variableStatement)) {
|
|
48095
48295
|
tracker.addImport(targetFile, variableDeclaration.name.text, getRelativeImportPath(targetFile.fileName, ref.getSourceFile().fileName));
|
|
48096
48296
|
} else {
|
|
@@ -48131,7 +48331,7 @@ function findAllSameFileReferences(rootNode, nodeLookup, referenceResolver) {
|
|
|
48131
48331
|
if (!closestTopLevel || traversedTopLevelNodes.has(closestTopLevel)) {
|
|
48132
48332
|
continue;
|
|
48133
48333
|
}
|
|
48134
|
-
if (!
|
|
48334
|
+
if (!import_typescript120.default.isImportDeclaration(closestTopLevel) && isOutsideRange(excludeStart, excludeEnd, closestTopLevel.getStart(), closestTopLevel.getEnd())) {
|
|
48135
48335
|
traversedTopLevelNodes.add(closestTopLevel);
|
|
48136
48336
|
walk(closestTopLevel);
|
|
48137
48337
|
}
|
|
@@ -48152,25 +48352,25 @@ function referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeE
|
|
|
48152
48352
|
function remapDynamicImports(targetFileName, rootNode) {
|
|
48153
48353
|
let hasChanged = false;
|
|
48154
48354
|
const transformer = (context) => {
|
|
48155
|
-
return (sourceFile) =>
|
|
48156
|
-
if (
|
|
48355
|
+
return (sourceFile) => import_typescript120.default.visitNode(sourceFile, function walk(node) {
|
|
48356
|
+
if (import_typescript120.default.isCallExpression(node) && node.expression.kind === import_typescript120.default.SyntaxKind.ImportKeyword && node.arguments.length > 0 && import_typescript120.default.isStringLiteralLike(node.arguments[0]) && node.arguments[0].text.startsWith(".")) {
|
|
48157
48357
|
hasChanged = true;
|
|
48158
48358
|
return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
48159
48359
|
context.factory.createStringLiteral(remapRelativeImport(targetFileName, node.arguments[0])),
|
|
48160
48360
|
...node.arguments.slice(1)
|
|
48161
48361
|
]);
|
|
48162
48362
|
}
|
|
48163
|
-
return
|
|
48363
|
+
return import_typescript120.default.visitEachChild(node, walk, context);
|
|
48164
48364
|
});
|
|
48165
48365
|
};
|
|
48166
|
-
const result =
|
|
48366
|
+
const result = import_typescript120.default.transform(rootNode, [transformer]).transformed[0];
|
|
48167
48367
|
return hasChanged ? result : rootNode;
|
|
48168
48368
|
}
|
|
48169
48369
|
function isTopLevelStatement(node) {
|
|
48170
|
-
return node.parent != null &&
|
|
48370
|
+
return node.parent != null && import_typescript120.default.isSourceFile(node.parent);
|
|
48171
48371
|
}
|
|
48172
48372
|
function isReferenceIdentifier(node) {
|
|
48173
|
-
return
|
|
48373
|
+
return import_typescript120.default.isIdentifier(node) && (!import_typescript120.default.isPropertyAssignment(node.parent) && !import_typescript120.default.isParameter(node.parent) || node.parent.name !== node);
|
|
48174
48374
|
}
|
|
48175
48375
|
function isOutsideRange(excludeStart, excludeEnd, start, end) {
|
|
48176
48376
|
return start < excludeStart && end < excludeStart || start > excludeEnd;
|
|
@@ -48179,15 +48379,15 @@ function remapRelativeImport(targetFileName, specifier) {
|
|
|
48179
48379
|
return getRelativeImportPath(targetFileName, (0, import_path7.join)((0, import_path7.dirname)(specifier.getSourceFile().fileName), specifier.text));
|
|
48180
48380
|
}
|
|
48181
48381
|
function isExported(node) {
|
|
48182
|
-
return
|
|
48382
|
+
return import_typescript120.default.canHaveModifiers(node) && node.modifiers ? node.modifiers.some((modifier) => modifier.kind === import_typescript120.default.SyntaxKind.ExportKeyword) : false;
|
|
48183
48383
|
}
|
|
48184
48384
|
function isExportableDeclaration(node) {
|
|
48185
|
-
return
|
|
48385
|
+
return import_typescript120.default.isEnumDeclaration(node) || import_typescript120.default.isClassDeclaration(node) || import_typescript120.default.isFunctionDeclaration(node) || import_typescript120.default.isInterfaceDeclaration(node) || import_typescript120.default.isTypeAliasDeclaration(node);
|
|
48186
48386
|
}
|
|
48187
48387
|
function getLastImportEnd(sourceFile) {
|
|
48188
48388
|
let index = 0;
|
|
48189
48389
|
for (const statement of sourceFile.statements) {
|
|
48190
|
-
if (
|
|
48390
|
+
if (import_typescript120.default.isImportDeclaration(statement)) {
|
|
48191
48391
|
index = Math.max(index, statement.getEnd());
|
|
48192
48392
|
} else {
|
|
48193
48393
|
break;
|
|
@@ -48204,7 +48404,7 @@ function hasImport(program, rootFileNames, moduleName) {
|
|
|
48204
48404
|
continue;
|
|
48205
48405
|
}
|
|
48206
48406
|
for (const statement of sourceFile.statements) {
|
|
48207
|
-
if (
|
|
48407
|
+
if (import_typescript120.default.isImportDeclaration(statement) && import_typescript120.default.isStringLiteralLike(statement.moduleSpecifier) && (statement.moduleSpecifier.text === moduleName || statement.moduleSpecifier.text.startsWith(deepImportStart))) {
|
|
48208
48408
|
return true;
|
|
48209
48409
|
}
|
|
48210
48410
|
}
|
|
@@ -48252,7 +48452,7 @@ function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schema
|
|
|
48252
48452
|
});
|
|
48253
48453
|
const referenceLookupExcludedFiles = /node_modules|\.ngtypecheck\.ts/;
|
|
48254
48454
|
const program = createProgram({ rootNames, host, options, oldProgram });
|
|
48255
|
-
const printer =
|
|
48455
|
+
const printer = import_typescript121.default.createPrinter();
|
|
48256
48456
|
if ((0, import_fs2.existsSync)(pathToMigrate) && !(0, import_fs2.statSync)(pathToMigrate).isDirectory()) {
|
|
48257
48457
|
throw new import_schematics.SchematicsException(`Migration path ${pathToMigrate} has to be a directory. Cannot run the standalone migration.`);
|
|
48258
48458
|
}
|