@angular/core 17.0.0-next.2 → 17.0.0-next.4

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.
Files changed (62) hide show
  1. package/esm2022/src/core_reactivity_export_internal.mjs +3 -3
  2. package/esm2022/src/core_render3_private_export.mjs +2 -2
  3. package/esm2022/src/di/initializer_token.mjs +1 -1
  4. package/esm2022/src/di/internal_tokens.mjs +1 -1
  5. package/esm2022/src/di/r3_injector.mjs +3 -4
  6. package/esm2022/src/hydration/annotate.mjs +9 -6
  7. package/esm2022/src/hydration/cleanup.mjs +2 -2
  8. package/esm2022/src/linker/template_ref.mjs +3 -3
  9. package/esm2022/src/linker/view_container_ref.mjs +80 -25
  10. package/esm2022/src/metadata/directives.mjs +1 -1
  11. package/esm2022/src/metadata/resource_loading.mjs +27 -14
  12. package/esm2022/src/render3/after_render_hooks.mjs +83 -49
  13. package/esm2022/src/render3/component.mjs +4 -3
  14. package/esm2022/src/render3/component_ref.mjs +3 -4
  15. package/esm2022/src/render3/di.mjs +1 -1
  16. package/esm2022/src/render3/index.mjs +2 -2
  17. package/esm2022/src/render3/instructions/all.mjs +2 -1
  18. package/esm2022/src/render3/instructions/change_detection.mjs +7 -8
  19. package/esm2022/src/render3/instructions/component_instance.mjs +23 -0
  20. package/esm2022/src/render3/instructions/control_flow.mjs +20 -4
  21. package/esm2022/src/render3/instructions/defer.mjs +100 -39
  22. package/esm2022/src/render3/instructions/shared.mjs +20 -14
  23. package/esm2022/src/render3/interfaces/defer.mjs +1 -1
  24. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  25. package/esm2022/src/render3/interfaces/injector.mjs +1 -1
  26. package/esm2022/src/render3/interfaces/node.mjs +16 -1
  27. package/esm2022/src/render3/interfaces/styling.mjs +4 -7
  28. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  29. package/esm2022/src/render3/jit/directive.mjs +6 -2
  30. package/esm2022/src/render3/jit/environment.mjs +2 -1
  31. package/esm2022/src/render3/node_manipulation.mjs +4 -3
  32. package/esm2022/src/render3/pipe.mjs +2 -1
  33. package/esm2022/src/render3/reactive_lview_consumer.mjs +25 -45
  34. package/esm2022/src/render3/reactivity/effect.mjs +147 -44
  35. package/esm2022/src/render3/util/injector_utils.mjs +1 -1
  36. package/esm2022/src/render3/view_manipulation.mjs +13 -2
  37. package/esm2022/src/signals/index.mjs +4 -4
  38. package/esm2022/src/signals/src/api.mjs +2 -11
  39. package/esm2022/src/signals/src/computed.mjs +43 -93
  40. package/esm2022/src/signals/src/graph.mjs +241 -162
  41. package/esm2022/src/signals/src/signal.mjs +59 -79
  42. package/esm2022/src/signals/src/watch.mjs +38 -52
  43. package/esm2022/src/signals/src/weak_ref.mjs +2 -29
  44. package/esm2022/src/util/security/trusted_type_defs.mjs +1 -1
  45. package/esm2022/src/util/security/trusted_types.mjs +1 -1
  46. package/esm2022/src/version.mjs +1 -1
  47. package/esm2022/src/zone/ng_zone.mjs +16 -1
  48. package/esm2022/testing/src/component_fixture.mjs +4 -2
  49. package/esm2022/testing/src/logger.mjs +3 -3
  50. package/esm2022/testing/src/test_bed.mjs +14 -3
  51. package/esm2022/testing/src/test_bed_compiler.mjs +3 -3
  52. package/fesm2022/core.mjs +6654 -6366
  53. package/fesm2022/core.mjs.map +1 -1
  54. package/fesm2022/rxjs-interop.mjs +1 -1
  55. package/fesm2022/testing.mjs +19 -6
  56. package/fesm2022/testing.mjs.map +1 -1
  57. package/index.d.ts +201 -142
  58. package/package.json +1 -1
  59. package/rxjs-interop/index.d.ts +1 -1
  60. package/schematics/ng-generate/standalone-migration/bundle.js +264 -201
  61. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  62. package/testing/index.d.ts +10 -2
@@ -832,98 +832,6 @@ __export(output_ast_exports, {
832
832
  variable: () => variable
833
833
  });
834
834
 
835
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/big_integer.mjs
836
- var BigInteger = class {
837
- static zero() {
838
- return new BigInteger([0]);
839
- }
840
- static one() {
841
- return new BigInteger([1]);
842
- }
843
- constructor(digits) {
844
- this.digits = digits;
845
- }
846
- clone() {
847
- return new BigInteger(this.digits.slice());
848
- }
849
- add(other) {
850
- const result = this.clone();
851
- result.addToSelf(other);
852
- return result;
853
- }
854
- addToSelf(other) {
855
- const maxNrOfDigits = Math.max(this.digits.length, other.digits.length);
856
- let carry = 0;
857
- for (let i = 0; i < maxNrOfDigits; i++) {
858
- let digitSum = carry;
859
- if (i < this.digits.length) {
860
- digitSum += this.digits[i];
861
- }
862
- if (i < other.digits.length) {
863
- digitSum += other.digits[i];
864
- }
865
- if (digitSum >= 10) {
866
- this.digits[i] = digitSum - 10;
867
- carry = 1;
868
- } else {
869
- this.digits[i] = digitSum;
870
- carry = 0;
871
- }
872
- }
873
- if (carry > 0) {
874
- this.digits[maxNrOfDigits] = 1;
875
- }
876
- }
877
- toString() {
878
- let res = "";
879
- for (let i = this.digits.length - 1; i >= 0; i--) {
880
- res += this.digits[i];
881
- }
882
- return res;
883
- }
884
- };
885
- var BigIntForMultiplication = class {
886
- constructor(value) {
887
- this.powerOfTwos = [value];
888
- }
889
- getValue() {
890
- return this.powerOfTwos[0];
891
- }
892
- multiplyBy(num) {
893
- const product = BigInteger.zero();
894
- this.multiplyByAndAddTo(num, product);
895
- return product;
896
- }
897
- multiplyByAndAddTo(num, result) {
898
- for (let exponent = 0; num !== 0; num = num >>> 1, exponent++) {
899
- if (num & 1) {
900
- const value = this.getMultipliedByPowerOfTwo(exponent);
901
- result.addToSelf(value);
902
- }
903
- }
904
- }
905
- getMultipliedByPowerOfTwo(exponent) {
906
- for (let i = this.powerOfTwos.length; i <= exponent; i++) {
907
- const previousPower = this.powerOfTwos[i - 1];
908
- this.powerOfTwos[i] = previousPower.add(previousPower);
909
- }
910
- return this.powerOfTwos[exponent];
911
- }
912
- };
913
- var BigIntExponentiation = class {
914
- constructor(base) {
915
- this.base = base;
916
- this.exponents = [new BigIntForMultiplication(BigInteger.one())];
917
- }
918
- toThePowerOf(exponent) {
919
- for (let i = this.exponents.length; i <= exponent; i++) {
920
- const value = this.exponents[i - 1].multiplyBy(this.base);
921
- this.exponents[i] = new BigIntForMultiplication(value);
922
- }
923
- return this.exponents[exponent];
924
- }
925
- };
926
-
927
835
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/digest.mjs
928
836
  var textEncoder;
929
837
  function digest(message) {
@@ -1031,17 +939,15 @@ function fingerprint(str) {
1031
939
  hi = hi ^ 319790063;
1032
940
  lo = lo ^ -1801410264;
1033
941
  }
1034
- return [hi, lo];
942
+ return BigInt.asUintN(32, BigInt(hi)) << BigInt(32) | BigInt.asUintN(32, BigInt(lo));
1035
943
  }
1036
944
  function computeMsgId(msg, meaning = "") {
1037
945
  let msgFingerprint = fingerprint(msg);
1038
946
  if (meaning) {
1039
- const meaningFingerprint = fingerprint(meaning);
1040
- msgFingerprint = add64(rol64(msgFingerprint, 1), meaningFingerprint);
947
+ msgFingerprint = BigInt.asUintN(64, msgFingerprint << BigInt(1)) | msgFingerprint >> BigInt(63) & BigInt(1);
948
+ msgFingerprint += fingerprint(meaning);
1041
949
  }
1042
- const hi = msgFingerprint[0];
1043
- const lo = msgFingerprint[1];
1044
- return wordsToDecimalString(hi & 2147483647, lo);
950
+ return BigInt.asUintN(63, msgFingerprint).toString();
1045
951
  }
1046
952
  function hash32(view, length, c) {
1047
953
  let a = 2654435769, b = 2654435769;
@@ -1138,24 +1044,9 @@ function add32to64(a, b) {
1138
1044
  const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
1139
1045
  return [high >>> 16, high << 16 | low & 65535];
1140
1046
  }
1141
- function add64(a, b) {
1142
- const ah = a[0], al = a[1];
1143
- const bh = b[0], bl = b[1];
1144
- const result = add32to64(al, bl);
1145
- const carry = result[0];
1146
- const l = result[1];
1147
- const h = add32(add32(ah, bh), carry);
1148
- return [h, l];
1149
- }
1150
1047
  function rol32(a, count) {
1151
1048
  return a << count | a >>> 32 - count;
1152
1049
  }
1153
- function rol64(num, count) {
1154
- const hi = num[0], lo = num[1];
1155
- const h = hi << count | lo >>> 32 - count;
1156
- const l = lo << count | hi >>> 32 - count;
1157
- return [h, l];
1158
- }
1159
1050
  function bytesToWords32(bytes, endian) {
1160
1051
  const size = bytes.length + 3 >>> 2;
1161
1052
  const words32 = [];
@@ -1180,12 +1071,6 @@ function wordAt(bytes, index, endian) {
1180
1071
  }
1181
1072
  return word;
1182
1073
  }
1183
- var base256 = new BigIntExponentiation(256);
1184
- function wordsToDecimalString(hi, lo) {
1185
- const decimal = base256.toThePowerOf(0).multiplyBy(lo);
1186
- base256.toThePowerOf(4).multiplyByAndAddTo(hi, decimal);
1187
- return decimal.toString();
1188
- }
1189
1074
 
1190
1075
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/output_ast.mjs
1191
1076
  var TypeModifier;
@@ -1803,7 +1688,7 @@ var FunctionExpr = class extends Expression {
1803
1688
  this.name = name;
1804
1689
  }
1805
1690
  isEquivalent(e) {
1806
- return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) && areAllEquivalent(this.statements, e.statements);
1691
+ return (e instanceof FunctionExpr || e instanceof DeclareFunctionStmt) && areAllEquivalent(this.params, e.params) && areAllEquivalent(this.statements, e.statements);
1807
1692
  }
1808
1693
  isConstant() {
1809
1694
  return false;
@@ -1845,6 +1730,9 @@ var ArrowFunctionExpr = class extends Expression {
1845
1730
  clone() {
1846
1731
  return new ArrowFunctionExpr(this.params.map((p2) => p2.clone()), Array.isArray(this.body) ? this.body : this.body.clone(), this.type, this.sourceSpan);
1847
1732
  }
1733
+ toDeclStmt(name, modifiers) {
1734
+ return new DeclareVarStmt(name, this, INFERRED_TYPE, modifiers, this.sourceSpan);
1735
+ }
1848
1736
  };
1849
1737
  var UnaryOperatorExpr = class extends Expression {
1850
1738
  constructor(operator, expr, type, sourceSpan, parens = true) {
@@ -2478,13 +2366,28 @@ var ConstantPool = class {
2478
2366
  }))));
2479
2367
  }
2480
2368
  }
2369
+ getSharedFunctionReference(fn2, prefix) {
2370
+ var _a2;
2371
+ const isArrow = fn2 instanceof ArrowFunctionExpr;
2372
+ for (const current of this.statements) {
2373
+ if (isArrow && current instanceof DeclareVarStmt && ((_a2 = current.value) == null ? void 0 : _a2.isEquivalent(fn2))) {
2374
+ return variable(current.name);
2375
+ }
2376
+ if (!isArrow && current instanceof DeclareFunctionStmt && fn2.isEquivalent(current)) {
2377
+ return variable(current.name);
2378
+ }
2379
+ }
2380
+ const name = this.uniqueName(prefix);
2381
+ this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
2382
+ return variable(name);
2383
+ }
2481
2384
  _getLiteralFactory(key, values, resultMap) {
2482
2385
  let literalFactory = this.literalFactories.get(key);
2483
2386
  const literalFactoryArguments = values.filter((e) => !e.isConstant());
2484
2387
  if (!literalFactory) {
2485
2388
  const resultExpressions = values.map((e, index) => e.isConstant() ? this.getConstLiteral(e, true) : variable(`a${index}`));
2486
2389
  const parameters = resultExpressions.filter(isVariable).map((e) => new FnParam(e.name, DYNAMIC_TYPE));
2487
- const pureFunctionDeclaration = fn(parameters, [new ReturnStatement(resultMap(resultExpressions))], INFERRED_TYPE);
2390
+ const pureFunctionDeclaration = arrowFn(parameters, resultMap(resultExpressions), INFERRED_TYPE);
2488
2391
  const name = this.freshName();
2489
2392
  this.statements.push(variable(name).set(pureFunctionDeclaration).toDeclStmt(INFERRED_TYPE, StmtModifier.Final));
2490
2393
  literalFactory = variable(name);
@@ -2788,6 +2691,9 @@ var Identifiers = _Identifiers;
2788
2691
  (() => {
2789
2692
  _Identifiers.repeaterTrackByIdentity = { name: "\u0275\u0275repeaterTrackByIdentity", moduleName: CORE };
2790
2693
  })();
2694
+ (() => {
2695
+ _Identifiers.componentInstance = { name: "\u0275\u0275componentInstance", moduleName: CORE };
2696
+ })();
2791
2697
  (() => {
2792
2698
  _Identifiers.text = { name: "\u0275\u0275text", moduleName: CORE };
2793
2699
  })();
@@ -5725,10 +5631,11 @@ var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
5725
5631
  var policy;
5726
5632
  function getPolicy() {
5727
5633
  if (policy === void 0) {
5634
+ const trustedTypes = _global["trustedTypes"];
5728
5635
  policy = null;
5729
- if (_global.trustedTypes) {
5636
+ if (trustedTypes) {
5730
5637
  try {
5731
- policy = _global.trustedTypes.createPolicy("angular#unsafe-jit", {
5638
+ policy = trustedTypes.createPolicy("angular#unsafe-jit", {
5732
5639
  createScript: (s) => s
5733
5640
  });
5734
5641
  } catch (e) {
@@ -5742,7 +5649,7 @@ function trustedScriptFromString(script) {
5742
5649
  return ((_a2 = getPolicy()) == null ? void 0 : _a2.createScript(script)) || script;
5743
5650
  }
5744
5651
  function newTrustedFunctionForJIT(...args) {
5745
- if (!_global.trustedTypes) {
5652
+ if (!_global["trustedTypes"]) {
5746
5653
  return new Function(...args);
5747
5654
  }
5748
5655
  const fnArgs = args.slice(0, -1).join(",");
@@ -6787,6 +6694,25 @@ function convertPropertyBinding(localResolver, implicitReceiver, expressionWitho
6787
6694
  }
6788
6695
  return new ConvertPropertyBindingResult(stmts, outputExpr);
6789
6696
  }
6697
+ function convertPureComponentScopeFunction(ast, localResolver, implicitReceiver, bindingId) {
6698
+ const converted = convertPropertyBindingBuiltins({
6699
+ createLiteralArrayConverter: () => (args) => literalArr(args),
6700
+ createLiteralMapConverter: (keys) => (values) => literalMap(keys.map((key, index) => {
6701
+ return {
6702
+ key: key.key,
6703
+ value: values[index],
6704
+ quoted: key.quoted
6705
+ };
6706
+ })),
6707
+ createPipeConverter: () => {
6708
+ throw new Error("Illegal State: Pipes are not allowed in this context");
6709
+ }
6710
+ }, ast);
6711
+ const visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, false);
6712
+ const statements = [];
6713
+ flattenStatements(converted.visit(visitor, _Mode.Statement), statements);
6714
+ return statements;
6715
+ }
6790
6716
  function convertUpdateArguments(localResolver, contextVariableExpression, expressionWithArgumentsToExtract, bindingId) {
6791
6717
  const visitor = new _AstToIrVisitor(localResolver, contextVariableExpression, bindingId, true);
6792
6718
  const outputExpr = visitor.visitInterpolation(expressionWithArgumentsToExtract, _Mode.Expression);
@@ -9402,6 +9328,7 @@ function phaseAlignPipeVariadicVarOffset(job) {
9402
9328
  }
9403
9329
  expr.varOffset = expr.args.varOffset;
9404
9330
  expr.args.varOffset = expr.varOffset + varsUsedByIrExpression(expr);
9331
+ return void 0;
9405
9332
  });
9406
9333
  }
9407
9334
  }
@@ -15555,7 +15482,7 @@ var _TreeBuilder = class {
15555
15482
  const parent = this._getContainer();
15556
15483
  if (parent instanceof BlockGroup) {
15557
15484
  this.errors.push(TreeError.create(null, startSpan, "Text cannot be placed directly inside of a block group."));
15558
- return null;
15485
+ return;
15559
15486
  }
15560
15487
  if (parent != null && parent.children.length === 0 && this.getTagDefinition(parent.name).ignoreFirstLf) {
15561
15488
  text2 = text2.substring(1);
@@ -16448,6 +16375,7 @@ function mergeNextContextsInOps(ops) {
16448
16375
  tryToMerge = false;
16449
16376
  break;
16450
16377
  }
16378
+ return;
16451
16379
  });
16452
16380
  }
16453
16381
  }
@@ -19433,7 +19361,10 @@ function validateSwitchBlock(ast) {
19433
19361
  const [primaryBlock, ...secondaryBlocks] = ast.blocks;
19434
19362
  const errors = [];
19435
19363
  let hasDefault = false;
19436
- if (primaryBlock.children.length > 0) {
19364
+ const hasPrimary = primaryBlock.children.length > 0 && primaryBlock.children.some((child) => {
19365
+ return !(child instanceof Text4) || child.value.trim().length > 0;
19366
+ });
19367
+ if (hasPrimary) {
19437
19368
  errors.push(new ParseError(primaryBlock.sourceSpan, 'Switch block can only contain "case" and "default" blocks'));
19438
19369
  }
19439
19370
  if (primaryBlock.parameters.length !== 1) {
@@ -20505,9 +20436,10 @@ function createComponentDefConsts() {
20505
20436
  };
20506
20437
  }
20507
20438
  var TemplateData = class {
20508
- constructor(name, index, visitor) {
20439
+ constructor(name, index, scope, visitor) {
20509
20440
  this.name = name;
20510
20441
  this.index = index;
20442
+ this.scope = scope;
20511
20443
  this.visitor = visitor;
20512
20444
  }
20513
20445
  getConstCount() {
@@ -20999,7 +20931,7 @@ var TemplateDefinitionBuilder = class {
20999
20931
  this._ngContentReservedSlots.push(...visitor._ngContentReservedSlots);
21000
20932
  }
21001
20933
  });
21002
- return new TemplateData(name, index, visitor);
20934
+ return new TemplateData(name, index, visitor._bindingScope, visitor);
21003
20935
  }
21004
20936
  createEmbeddedTemplateFn(tagName, children, contextNameSuffix, sourceSpan, variables = [], attrsExprs, references, i18n2) {
21005
20937
  const data = this.prepareEmbeddedTemplateFn(children, contextNameSuffix, variables, i18n2);
@@ -21194,15 +21126,15 @@ var TemplateDefinitionBuilder = class {
21194
21126
  const dependencyExp = [];
21195
21127
  for (const deferredDep of deferredDeps) {
21196
21128
  if (deferredDep.isDeferrable) {
21197
- const innerFn = fn([new FnParam("m", DYNAMIC_TYPE)], [new ReturnStatement(variable("m").prop(deferredDep.symbolName))]);
21129
+ const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(deferredDep.symbolName));
21198
21130
  const importExpr2 = new DynamicImportExpr(deferredDep.importPath).prop("then").callFn([innerFn]);
21199
21131
  dependencyExp.push(importExpr2);
21200
21132
  } else {
21201
21133
  dependencyExp.push(deferredDep.type);
21202
21134
  }
21203
21135
  }
21204
- const depsFnExpr = fn([], [new ReturnStatement(literalArr(dependencyExp))], INFERRED_TYPE, null, name);
21205
- this.constantPool.statements.push(depsFnExpr.toDeclStmt(name));
21136
+ const depsFnExpr = arrowFn([], literalArr(dependencyExp));
21137
+ this.constantPool.statements.push(depsFnExpr.toDeclStmt(name, StmtModifier.Final));
21206
21138
  return variable(name);
21207
21139
  }
21208
21140
  createDeferTriggerInstructions(deferredIndex, triggers, prefetch) {
@@ -21236,55 +21168,95 @@ var TemplateDefinitionBuilder = class {
21236
21168
  }
21237
21169
  visitForLoopBlock(block) {
21238
21170
  const blockIndex = this.allocateDataSlot();
21239
- const templateVariables = this.createForLoopVariables(block);
21240
- const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", templateVariables);
21171
+ const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [
21172
+ new Variable(block.itemName, "$implicit", block.sourceSpan, block.sourceSpan),
21173
+ new Variable(getLoopLocalName(block, "$index"), "$index", block.sourceSpan, block.sourceSpan),
21174
+ new Variable(getLoopLocalName(block, "$count"), "$count", block.sourceSpan, block.sourceSpan)
21175
+ ]);
21241
21176
  const emptyData = block.empty === null ? null : this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
21242
- const trackByFn = this.createTrackByFunction(block);
21177
+ const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
21243
21178
  const value = block.expression.visit(this._valueConverter);
21244
21179
  this.allocateBindingSlots(value);
21180
+ this.registerComputedLoopVariables(block, primaryData.scope);
21245
21181
  this.creationInstruction(block.sourceSpan, Identifiers.repeaterCreate, () => {
21246
21182
  const params = [
21247
21183
  literal(blockIndex),
21248
21184
  variable(primaryData.name),
21249
21185
  literal(primaryData.getConstCount()),
21250
21186
  literal(primaryData.getVarCount()),
21251
- trackByFn
21187
+ trackByExpression
21252
21188
  ];
21253
21189
  if (emptyData !== null) {
21254
- params.push(variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()));
21190
+ params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()));
21191
+ } else if (trackByUsesComponentInstance) {
21192
+ params.push(literal(trackByUsesComponentInstance));
21255
21193
  }
21256
21194
  return params;
21257
21195
  });
21258
21196
  this.updateInstruction(block.sourceSpan, Identifiers.repeater, () => [literal(blockIndex), this.convertPropertyBinding(value)]);
21259
21197
  }
21260
- createForLoopVariables(block) {
21198
+ registerComputedLoopVariables(block, bindingScope) {
21261
21199
  const indexLocalName = getLoopLocalName(block, "$index");
21262
21200
  const countLocalName = getLoopLocalName(block, "$count");
21263
- this._bindingScope.set(this.level, getLoopLocalName(block, "$odd"), (scope) => scope.get(indexLocalName).modulo(literal(2)).notIdentical(literal(0)));
21264
- this._bindingScope.set(this.level, getLoopLocalName(block, "$even"), (scope) => scope.get(indexLocalName).modulo(literal(2)).identical(literal(0)));
21265
- this._bindingScope.set(this.level, getLoopLocalName(block, "$first"), (scope) => scope.get(indexLocalName).identical(literal(0)));
21266
- this._bindingScope.set(this.level, getLoopLocalName(block, "$last"), (scope) => scope.get(indexLocalName).identical(scope.get(countLocalName).minus(literal(1))));
21267
- return [
21268
- new Variable(block.itemName, "$implicit", block.sourceSpan, block.sourceSpan),
21269
- new Variable(indexLocalName, "$index", block.sourceSpan, block.sourceSpan),
21270
- new Variable(countLocalName, "$count", block.sourceSpan, block.sourceSpan)
21271
- ];
21201
+ const level = bindingScope.bindingLevel;
21202
+ bindingScope.set(level, getLoopLocalName(block, "$odd"), (scope) => scope.get(indexLocalName).modulo(literal(2)).notIdentical(literal(0)));
21203
+ bindingScope.set(level, getLoopLocalName(block, "$even"), (scope) => scope.get(indexLocalName).modulo(literal(2)).identical(literal(0)));
21204
+ bindingScope.set(level, getLoopLocalName(block, "$first"), (scope) => scope.get(indexLocalName).identical(literal(0)));
21205
+ bindingScope.set(level, getLoopLocalName(block, "$last"), (scope) => scope.get(indexLocalName).identical(scope.get(countLocalName).minus(literal(1))));
21272
21206
  }
21273
- createTrackByFunction(block) {
21207
+ optimizeTrackByFunction(block) {
21274
21208
  const ast = block.trackBy.ast;
21275
21209
  if (ast instanceof PropertyRead && ast.receiver instanceof ImplicitReceiver && ast.name === getLoopLocalName(block, "$index")) {
21276
- return importExpr(Identifiers.repeaterTrackByIndex);
21210
+ return { expression: importExpr(Identifiers.repeaterTrackByIndex), usesComponentInstance: false };
21277
21211
  }
21278
21212
  if (ast instanceof PropertyRead && ast.receiver instanceof ImplicitReceiver && ast.name === block.itemName) {
21279
- return importExpr(Identifiers.repeaterTrackByIdentity);
21213
+ return { expression: importExpr(Identifiers.repeaterTrackByIdentity), usesComponentInstance: false };
21214
+ }
21215
+ if (ast instanceof Call && ast.receiver instanceof PropertyRead && ast.receiver.receiver instanceof ImplicitReceiver && ast.args.length === 2) {
21216
+ const firstIsIndex = ast.args[0] instanceof PropertyRead && ast.args[0].receiver instanceof ImplicitReceiver && ast.args[0].name === getLoopLocalName(block, "$index");
21217
+ const secondIsItem = ast.args[1] instanceof PropertyRead && ast.args[1].receiver instanceof ImplicitReceiver && ast.args[1].name === block.itemName;
21218
+ if (firstIsIndex && secondIsItem) {
21219
+ const receiver = this.level === 0 ? variable(CONTEXT_NAME) : new ExternalExpr(Identifiers.componentInstance).callFn([]);
21220
+ return { expression: receiver.prop(ast.receiver.name), usesComponentInstance: false };
21221
+ }
21280
21222
  }
21281
- if (ast instanceof PropertyRead && ast.receiver instanceof PropertyRead && ast.receiver.receiver instanceof ImplicitReceiver && ast.receiver.name === block.itemName) {
21282
- const params = [getLoopLocalName(block, "$index"), block.itemName];
21283
- const scope = this._bindingScope.nestedScope(this.level + 1, new Set(params));
21284
- const binding = convertPropertyBinding(scope, variable(CONTEXT_NAME), block.trackBy, "trackBy");
21285
- return arrowFn(params.map((param) => new FnParam(param)), binding.currValExpr);
21223
+ return null;
21224
+ }
21225
+ createTrackByFunction(block) {
21226
+ const optimizedFn = this.optimizeTrackByFunction(block);
21227
+ if (optimizedFn !== null) {
21228
+ return optimizedFn;
21229
+ }
21230
+ const bannedGlobals = /* @__PURE__ */ new Set([
21231
+ getLoopLocalName(block, "$count"),
21232
+ getLoopLocalName(block, "$first"),
21233
+ getLoopLocalName(block, "$last"),
21234
+ getLoopLocalName(block, "$even"),
21235
+ getLoopLocalName(block, "$odd")
21236
+ ]);
21237
+ const scope = new TrackByBindingScope(this._bindingScope, {
21238
+ [getLoopLocalName(block, "$index")]: "$index",
21239
+ [block.itemName]: "$item"
21240
+ }, bannedGlobals);
21241
+ const params = [new FnParam("$index"), new FnParam("$item")];
21242
+ const stmts = convertPureComponentScopeFunction(block.trackBy.ast, scope, variable(CONTEXT_NAME), "track");
21243
+ const usesComponentInstance = scope.getComponentAccessCount() > 0;
21244
+ let fn2;
21245
+ if (!usesComponentInstance && stmts.length === 1 && stmts[0] instanceof ExpressionStatement) {
21246
+ fn2 = arrowFn(params, stmts[0].expr);
21247
+ } else {
21248
+ if (stmts.length > 0) {
21249
+ const lastStatement = stmts[stmts.length - 1];
21250
+ if (lastStatement instanceof ExpressionStatement) {
21251
+ stmts[stmts.length - 1] = new ReturnStatement(lastStatement.expr);
21252
+ }
21253
+ }
21254
+ fn2 = fn(params, stmts);
21286
21255
  }
21287
- throw new Error("Unsupported track expression");
21256
+ return {
21257
+ expression: this.constantPool.getSharedFunctionReference(fn2, "_forTrack"),
21258
+ usesComponentInstance
21259
+ };
21288
21260
  }
21289
21261
  getConstCount() {
21290
21262
  return this._dataIndex;
@@ -21645,6 +21617,9 @@ var BindingScope = class {
21645
21617
  }
21646
21618
  return this.bindingLevel === 0 ? null : this.getComponentProperty(name);
21647
21619
  }
21620
+ hasLocal(name) {
21621
+ return this.map.has(name);
21622
+ }
21648
21623
  set(retrievalLevel, name, lhs, priority = 0, declareLocalCallback, localRef) {
21649
21624
  if (this.map.has(name)) {
21650
21625
  if (localRef) {
@@ -21761,6 +21736,37 @@ var BindingScope = class {
21761
21736
  this.usesRestoredViewContext = true;
21762
21737
  }
21763
21738
  };
21739
+ var TrackByBindingScope = class extends BindingScope {
21740
+ constructor(parentScope, globalAliases, bannedGlobals) {
21741
+ super(parentScope.bindingLevel + 1, parentScope);
21742
+ this.globalAliases = globalAliases;
21743
+ this.bannedGlobals = bannedGlobals;
21744
+ this.componentAccessCount = 0;
21745
+ }
21746
+ get(name) {
21747
+ let current = this.parent;
21748
+ while (current) {
21749
+ if (current.hasLocal(name)) {
21750
+ this.forbiddenAccessError(name);
21751
+ }
21752
+ current = current.parent;
21753
+ }
21754
+ if (this.bannedGlobals.has(name)) {
21755
+ this.forbiddenAccessError(name);
21756
+ }
21757
+ if (this.globalAliases[name]) {
21758
+ return variable(this.globalAliases[name]);
21759
+ }
21760
+ this.componentAccessCount++;
21761
+ return variable("this").prop(name);
21762
+ }
21763
+ getComponentAccessCount() {
21764
+ return this.componentAccessCount;
21765
+ }
21766
+ forbiddenAccessError(propertyName) {
21767
+ throw new Error(`Accessing ${propertyName} inside of a track expression is not allowed. Tracking expressions can only access the item, $index and properties on the containing component.`);
21768
+ }
21769
+ };
21764
21770
  function createCssSelector(elementName, attributes) {
21765
21771
  const cssSelector = new CssSelector();
21766
21772
  const elementNameNoNs = splitNsName(elementName)[1];
@@ -22303,10 +22309,10 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
22303
22309
  const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, typeSourceSpan);
22304
22310
  if (USE_TEMPLATE_PIPELINE) {
22305
22311
  if (hostBindingsMetadata.specialAttributes.styleAttr) {
22306
- hostBindingsMetadata.attributes.style = literal(hostBindingsMetadata.specialAttributes.styleAttr);
22312
+ hostBindingsMetadata.attributes["style"] = literal(hostBindingsMetadata.specialAttributes.styleAttr);
22307
22313
  }
22308
22314
  if (hostBindingsMetadata.specialAttributes.classAttr) {
22309
- hostBindingsMetadata.attributes.class = literal(hostBindingsMetadata.specialAttributes.classAttr);
22315
+ hostBindingsMetadata.attributes["class"] = literal(hostBindingsMetadata.specialAttributes.classAttr);
22310
22316
  }
22311
22317
  const hostJob = ingestHostBinding({
22312
22318
  componentName: name,
@@ -23125,7 +23131,7 @@ function publishFacade(global) {
23125
23131
  }
23126
23132
 
23127
23133
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
23128
- var VERSION2 = new Version("17.0.0-next.2");
23134
+ var VERSION2 = new Version("17.0.0-next.4");
23129
23135
 
23130
23136
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
23131
23137
  var _I18N_ATTR = "i18n";
@@ -24662,7 +24668,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
24662
24668
  function compileDeclareClassMetadata(metadata) {
24663
24669
  const definitionMap = new DefinitionMap();
24664
24670
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
24665
- definitionMap.set("version", literal("17.0.0-next.2"));
24671
+ definitionMap.set("version", literal("17.0.0-next.4"));
24666
24672
  definitionMap.set("ngImport", importExpr(Identifiers.core));
24667
24673
  definitionMap.set("type", metadata.type);
24668
24674
  definitionMap.set("decorators", metadata.decorators);
@@ -24733,7 +24739,7 @@ function createDirectiveDefinitionMap(meta) {
24733
24739
  const hasTransformFunctions = Object.values(meta.inputs).some((input) => input.transformFunction !== null);
24734
24740
  const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION2 : "14.0.0";
24735
24741
  definitionMap.set("minVersion", literal(minVersion));
24736
- definitionMap.set("version", literal("17.0.0-next.2"));
24742
+ definitionMap.set("version", literal("17.0.0-next.4"));
24737
24743
  definitionMap.set("type", meta.type.value);
24738
24744
  if (meta.isStandalone) {
24739
24745
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -24921,7 +24927,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
24921
24927
  function compileDeclareFactoryFunction(meta) {
24922
24928
  const definitionMap = new DefinitionMap();
24923
24929
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
24924
- definitionMap.set("version", literal("17.0.0-next.2"));
24930
+ definitionMap.set("version", literal("17.0.0-next.4"));
24925
24931
  definitionMap.set("ngImport", importExpr(Identifiers.core));
24926
24932
  definitionMap.set("type", meta.type.value);
24927
24933
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -24944,7 +24950,7 @@ function compileDeclareInjectableFromMetadata(meta) {
24944
24950
  function createInjectableDefinitionMap(meta) {
24945
24951
  const definitionMap = new DefinitionMap();
24946
24952
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
24947
- definitionMap.set("version", literal("17.0.0-next.2"));
24953
+ definitionMap.set("version", literal("17.0.0-next.4"));
24948
24954
  definitionMap.set("ngImport", importExpr(Identifiers.core));
24949
24955
  definitionMap.set("type", meta.type.value);
24950
24956
  if (meta.providedIn !== void 0) {
@@ -24982,7 +24988,7 @@ function compileDeclareInjectorFromMetadata(meta) {
24982
24988
  function createInjectorDefinitionMap(meta) {
24983
24989
  const definitionMap = new DefinitionMap();
24984
24990
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
24985
- definitionMap.set("version", literal("17.0.0-next.2"));
24991
+ definitionMap.set("version", literal("17.0.0-next.4"));
24986
24992
  definitionMap.set("ngImport", importExpr(Identifiers.core));
24987
24993
  definitionMap.set("type", meta.type.value);
24988
24994
  definitionMap.set("providers", meta.providers);
@@ -25006,7 +25012,7 @@ function createNgModuleDefinitionMap(meta) {
25006
25012
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
25007
25013
  }
25008
25014
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
25009
- definitionMap.set("version", literal("17.0.0-next.2"));
25015
+ definitionMap.set("version", literal("17.0.0-next.4"));
25010
25016
  definitionMap.set("ngImport", importExpr(Identifiers.core));
25011
25017
  definitionMap.set("type", meta.type.value);
25012
25018
  if (meta.bootstrap.length > 0) {
@@ -25041,7 +25047,7 @@ function compileDeclarePipeFromMetadata(meta) {
25041
25047
  function createPipeDefinitionMap(meta) {
25042
25048
  const definitionMap = new DefinitionMap();
25043
25049
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
25044
- definitionMap.set("version", literal("17.0.0-next.2"));
25050
+ definitionMap.set("version", literal("17.0.0-next.4"));
25045
25051
  definitionMap.set("ngImport", importExpr(Identifiers.core));
25046
25052
  definitionMap.set("type", meta.type.value);
25047
25053
  if (meta.isStandalone) {
@@ -25058,7 +25064,7 @@ function createPipeDefinitionMap(meta) {
25058
25064
  publishFacade(_global);
25059
25065
 
25060
25066
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
25061
- var VERSION3 = new Version("17.0.0-next.2");
25067
+ var VERSION3 = new Version("17.0.0-next.4");
25062
25068
 
25063
25069
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
25064
25070
  var EmitFlags;
@@ -25215,6 +25221,7 @@ var ErrorCode;
25215
25221
  ErrorCode2[ErrorCode2["HOST_DIRECTIVE_CONFLICTING_ALIAS"] = 2018] = "HOST_DIRECTIVE_CONFLICTING_ALIAS";
25216
25222
  ErrorCode2[ErrorCode2["HOST_DIRECTIVE_MISSING_REQUIRED_BINDING"] = 2019] = "HOST_DIRECTIVE_MISSING_REQUIRED_BINDING";
25217
25223
  ErrorCode2[ErrorCode2["CONFLICTING_INPUT_TRANSFORM"] = 2020] = "CONFLICTING_INPUT_TRANSFORM";
25224
+ ErrorCode2[ErrorCode2["COMPONENT_INVALID_STYLE_URLS"] = 2021] = "COMPONENT_INVALID_STYLE_URLS";
25218
25225
  ErrorCode2[ErrorCode2["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED";
25219
25226
  ErrorCode2[ErrorCode2["IMPORT_CYCLE_DETECTED"] = 3003] = "IMPORT_CYCLE_DETECTED";
25220
25227
  ErrorCode2[ErrorCode2["IMPORT_GENERATION_FAILURE"] = 3004] = "IMPORT_GENERATION_FAILURE";
@@ -25235,7 +25242,6 @@ var ErrorCode;
25235
25242
  ErrorCode2[ErrorCode2["NGMODULE_DECLARATION_IS_STANDALONE"] = 6008] = "NGMODULE_DECLARATION_IS_STANDALONE";
25236
25243
  ErrorCode2[ErrorCode2["NGMODULE_BOOTSTRAP_IS_STANDALONE"] = 6009] = "NGMODULE_BOOTSTRAP_IS_STANDALONE";
25237
25244
  ErrorCode2[ErrorCode2["WARN_NGMODULE_ID_UNNECESSARY"] = 6100] = "WARN_NGMODULE_ID_UNNECESSARY";
25238
- ErrorCode2[ErrorCode2["NGMODULE_VE_DEPENDENCY_ON_IVY_LIB"] = 6999] = "NGMODULE_VE_DEPENDENCY_ON_IVY_LIB";
25239
25245
  ErrorCode2[ErrorCode2["SCHEMA_INVALID_ELEMENT"] = 8001] = "SCHEMA_INVALID_ELEMENT";
25240
25246
  ErrorCode2[ErrorCode2["SCHEMA_INVALID_ATTRIBUTE"] = 8002] = "SCHEMA_INVALID_ATTRIBUTE";
25241
25247
  ErrorCode2[ErrorCode2["MISSING_REFERENCE_TARGET"] = 8003] = "MISSING_REFERENCE_TARGET";
@@ -29171,10 +29177,9 @@ function readMapType(type, valueTransform) {
29171
29177
  return;
29172
29178
  }
29173
29179
  const value = valueTransform(member.type);
29174
- if (value === null) {
29175
- return null;
29180
+ if (value !== null) {
29181
+ obj[member.name.text] = value;
29176
29182
  }
29177
- obj[member.name.text] = value;
29178
29183
  });
29179
29184
  return obj;
29180
29185
  }
@@ -32143,13 +32148,14 @@ function parseDirectiveStyles(directive, evaluator, compilationMode) {
32143
32148
  if (!expression) {
32144
32149
  return null;
32145
32150
  }
32146
- const value = evaluator.evaluate(expression);
32151
+ const evaluated = evaluator.evaluate(expression);
32152
+ const value = typeof evaluated === "string" ? [evaluated] : evaluated;
32147
32153
  if (compilationMode === CompilationMode.LOCAL && Array.isArray(value)) {
32148
32154
  for (const entry of value) {
32149
32155
  if (entry instanceof DynamicValue && entry.isFromUnknownIdentifier()) {
32150
32156
  const relatedInformation = traceDynamicValue(expression, entry);
32151
32157
  const chain = {
32152
- messageText: `Unknown identifier used as styles string: ${entry.node.getText()} (did you import this string from another file? This is not allowed in local compilation mode. Please either inline it or move it to a separate file and include it using'styleUrls')`,
32158
+ messageText: `Unknown identifier used as styles string: ${entry.node.getText()} (did you import this string from another file? This is not allowed in local compilation mode. Please either inline it or move it to a separate file and include it using 'styleUrl')`,
32153
32159
  category: import_typescript48.default.DiagnosticCategory.Error,
32154
32160
  code: 0
32155
32161
  };
@@ -32158,7 +32164,7 @@ function parseDirectiveStyles(directive, evaluator, compilationMode) {
32158
32164
  }
32159
32165
  }
32160
32166
  if (!isStringArrayOrDie(value, "styles", expression)) {
32161
- throw createValueHasWrongTypeError(expression, value, `Failed to resolve @Directive.styles to a string array`);
32167
+ throw createValueHasWrongTypeError(expression, value, `Failed to resolve @Component.styles to a string or an array of strings`);
32162
32168
  }
32163
32169
  return value;
32164
32170
  }
@@ -33452,7 +33458,8 @@ function parseExtractedTemplate(template2, sourceStr, sourceParseRange, escapedS
33452
33458
  enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat,
33453
33459
  i18nNormalizeLineEndingsInICUs,
33454
33460
  leadingTriviaChars: [],
33455
- alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData
33461
+ alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData,
33462
+ enabledBlockTypes: options.enabledBlockTypes
33456
33463
  });
33457
33464
  return __spreadProps(__spreadValues({}, parsedTemplate), {
33458
33465
  diagNodes,
@@ -33575,7 +33582,7 @@ function transformDecoratorResources(dec, component, styles, template2) {
33575
33582
  if (dec.name !== "Component") {
33576
33583
  return dec;
33577
33584
  }
33578
- if (!component.has("templateUrl") && !component.has("styleUrls") && !component.has("styles")) {
33585
+ if (!component.has("templateUrl") && !component.has("styleUrls") && !component.has("styleUrl") && !component.has("styles")) {
33579
33586
  return dec;
33580
33587
  }
33581
33588
  const metadata = new Map(component);
@@ -33583,9 +33590,10 @@ function transformDecoratorResources(dec, component, styles, template2) {
33583
33590
  metadata.delete("templateUrl");
33584
33591
  metadata.set("template", import_typescript52.default.factory.createStringLiteral(template2.content));
33585
33592
  }
33586
- if (metadata.has("styleUrls") || metadata.has("styles")) {
33593
+ if (metadata.has("styleUrls") || metadata.has("styleUrl") || metadata.has("styles")) {
33587
33594
  metadata.delete("styles");
33588
33595
  metadata.delete("styleUrls");
33596
+ metadata.delete("styleUrl");
33589
33597
  if (styles.length > 0) {
33590
33598
  const styleNodes = styles.reduce((result, style) => {
33591
33599
  if (style.trim().length > 0) {
@@ -33605,10 +33613,26 @@ function transformDecoratorResources(dec, component, styles, template2) {
33605
33613
  return __spreadProps(__spreadValues({}, dec), { args: [import_typescript52.default.factory.createObjectLiteralExpression(newMetadataFields)] });
33606
33614
  }
33607
33615
  function extractComponentStyleUrls(evaluator, component) {
33608
- if (!component.has("styleUrls")) {
33609
- return [];
33616
+ const styleUrlsExpr = component.get("styleUrls");
33617
+ const styleUrlExpr = component.get("styleUrl");
33618
+ if (styleUrlsExpr !== void 0 && styleUrlExpr !== void 0) {
33619
+ throw new FatalDiagnosticError(ErrorCode.COMPONENT_INVALID_STYLE_URLS, styleUrlExpr, "@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple");
33620
+ }
33621
+ if (styleUrlsExpr !== void 0) {
33622
+ return extractStyleUrlsFromExpression(evaluator, component.get("styleUrls"));
33623
+ }
33624
+ if (styleUrlExpr !== void 0) {
33625
+ const styleUrl = evaluator.evaluate(styleUrlExpr);
33626
+ if (typeof styleUrl !== "string") {
33627
+ throw createValueHasWrongTypeError(styleUrlExpr, styleUrl, "styleUrl must be a string");
33628
+ }
33629
+ return [{
33630
+ url: styleUrl,
33631
+ source: 2,
33632
+ nodeForError: styleUrlExpr
33633
+ }];
33610
33634
  }
33611
- return extractStyleUrlsFromExpression(evaluator, component.get("styleUrls"));
33635
+ return [];
33612
33636
  }
33613
33637
  function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
33614
33638
  const styleUrls = [];
@@ -33648,24 +33672,41 @@ function extractStyleResources(resourceLoader, component, containingFile) {
33648
33672
  function stringLiteralElements(array) {
33649
33673
  return array.elements.filter((e) => import_typescript52.default.isStringLiteralLike(e));
33650
33674
  }
33675
+ const styleUrlExpr = component.get("styleUrl");
33651
33676
  const styleUrlsExpr = component.get("styleUrls");
33652
33677
  if (styleUrlsExpr !== void 0 && import_typescript52.default.isArrayLiteralExpression(styleUrlsExpr)) {
33653
33678
  for (const expression of stringLiteralElements(styleUrlsExpr)) {
33654
- try {
33655
- const resourceUrl = resourceLoader.resolve(expression.text, containingFile);
33656
- styles.add({ path: absoluteFrom(resourceUrl), expression });
33657
- } catch (e) {
33679
+ const resource = stringLiteralUrlToResource(resourceLoader, expression, containingFile);
33680
+ if (resource !== null) {
33681
+ styles.add(resource);
33658
33682
  }
33659
33683
  }
33684
+ } else if (styleUrlExpr !== void 0 && import_typescript52.default.isStringLiteralLike(styleUrlExpr)) {
33685
+ const resource = stringLiteralUrlToResource(resourceLoader, styleUrlExpr, containingFile);
33686
+ if (resource !== null) {
33687
+ styles.add(resource);
33688
+ }
33660
33689
  }
33661
33690
  const stylesExpr = component.get("styles");
33662
- if (stylesExpr !== void 0 && import_typescript52.default.isArrayLiteralExpression(stylesExpr)) {
33663
- for (const expression of stringLiteralElements(stylesExpr)) {
33664
- styles.add({ path: null, expression });
33691
+ if (stylesExpr !== void 0) {
33692
+ if (import_typescript52.default.isArrayLiteralExpression(stylesExpr)) {
33693
+ for (const expression of stringLiteralElements(stylesExpr)) {
33694
+ styles.add({ path: null, expression });
33695
+ }
33696
+ } else if (import_typescript52.default.isStringLiteralLike(stylesExpr)) {
33697
+ styles.add({ path: null, expression: stylesExpr });
33665
33698
  }
33666
33699
  }
33667
33700
  return styles;
33668
33701
  }
33702
+ function stringLiteralUrlToResource(resourceLoader, expression, containingFile) {
33703
+ try {
33704
+ const resourceUrl = resourceLoader.resolve(expression.text, containingFile);
33705
+ return { path: absoluteFrom(resourceUrl), expression };
33706
+ } catch (e) {
33707
+ return null;
33708
+ }
33709
+ }
33669
33710
  function _extractTemplateStyleUrls(template2) {
33670
33711
  if (template2.styleUrls === null) {
33671
33712
  return [];
@@ -34156,6 +34197,7 @@ var ComponentDecoratorHandler = class {
34156
34197
  file: analysis.template.file
34157
34198
  }
34158
34199
  });
34200
+ return null;
34159
34201
  }
34160
34202
  typeCheck(ctx, node, meta) {
34161
34203
  if (this.typeCheckScopeRegistry === null || !import_typescript53.default.isClassDeclaration(node)) {
@@ -38324,18 +38366,18 @@ var TcbTemplateBodyOp = class extends TcbOp {
38324
38366
  return null;
38325
38367
  }
38326
38368
  };
38327
- var TcbTextInterpolationOp = class extends TcbOp {
38328
- constructor(tcb, scope, binding) {
38369
+ var TcbExpressionOp = class extends TcbOp {
38370
+ constructor(tcb, scope, expression) {
38329
38371
  super();
38330
38372
  this.tcb = tcb;
38331
38373
  this.scope = scope;
38332
- this.binding = binding;
38374
+ this.expression = expression;
38333
38375
  }
38334
38376
  get optional() {
38335
38377
  return false;
38336
38378
  }
38337
38379
  execute() {
38338
- const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
38380
+ const expr = tcbExpression(this.expression, this.tcb, this.scope);
38339
38381
  this.scope.addStatement(import_typescript83.default.factory.createExpressionStatement(expr));
38340
38382
  return null;
38341
38383
  }
@@ -38912,9 +38954,7 @@ var Scope2 = class {
38912
38954
  this.elementOpMap.set(node, opIndex);
38913
38955
  this.appendDirectivesAndInputsOfNode(node);
38914
38956
  this.appendOutputsOfNode(node);
38915
- for (const child of node.children) {
38916
- this.appendNode(child);
38917
- }
38957
+ this.appendChildren(node);
38918
38958
  this.checkAndAppendReferencesOfNode(node);
38919
38959
  } else if (node instanceof Template) {
38920
38960
  this.appendDirectivesAndInputsOfNode(node);
@@ -38927,12 +38967,35 @@ var Scope2 = class {
38927
38967
  this.appendDeepSchemaChecks(node.children);
38928
38968
  }
38929
38969
  this.checkAndAppendReferencesOfNode(node);
38970
+ } else if (node instanceof DeferredBlock) {
38971
+ node.triggers.when !== void 0 && this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.triggers.when.value));
38972
+ node.prefetchTriggers.when !== void 0 && this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.prefetchTriggers.when.value));
38973
+ this.appendChildren(node);
38974
+ node.placeholder !== null && this.appendChildren(node.placeholder);
38975
+ node.loading !== null && this.appendChildren(node.loading);
38976
+ node.error !== null && this.appendChildren(node.error);
38977
+ } else if (node instanceof IfBlock) {
38978
+ for (const branch of node.branches) {
38979
+ this.appendChildren(branch);
38980
+ }
38981
+ } else if (node instanceof SwitchBlock) {
38982
+ for (const currentCase of node.cases) {
38983
+ this.appendChildren(currentCase);
38984
+ }
38985
+ } else if (node instanceof ForLoopBlock) {
38986
+ this.appendChildren(node);
38987
+ node.empty && this.appendChildren(node.empty);
38930
38988
  } else if (node instanceof BoundText) {
38931
- this.opQueue.push(new TcbTextInterpolationOp(this.tcb, this, node));
38989
+ this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.value));
38932
38990
  } else if (node instanceof Icu) {
38933
38991
  this.appendIcuExpressions(node);
38934
38992
  }
38935
38993
  }
38994
+ appendChildren(node) {
38995
+ for (const child of node.children) {
38996
+ this.appendNode(child);
38997
+ }
38998
+ }
38936
38999
  checkAndAppendReferencesOfNode(node) {
38937
39000
  for (const ref of node.references) {
38938
39001
  const target = this.tcb.boundTarget.getReferenceTarget(ref);
@@ -39033,11 +39096,11 @@ var Scope2 = class {
39033
39096
  }
39034
39097
  appendIcuExpressions(node) {
39035
39098
  for (const variable2 of Object.values(node.vars)) {
39036
- this.opQueue.push(new TcbTextInterpolationOp(this.tcb, this, variable2));
39099
+ this.opQueue.push(new TcbExpressionOp(this.tcb, this, variable2.value));
39037
39100
  }
39038
39101
  for (const placeholder of Object.values(node.placeholders)) {
39039
39102
  if (placeholder instanceof BoundText) {
39040
- this.opQueue.push(new TcbTextInterpolationOp(this.tcb, this, placeholder));
39103
+ this.opQueue.push(new TcbExpressionOp(this.tcb, this, placeholder.value));
39041
39104
  }
39042
39105
  }
39043
39106
  }
@@ -41315,8 +41378,8 @@ var NgCompiler = class {
41315
41378
  this.constructionDiagnostics = [];
41316
41379
  this.nonTemplateDiagnostics = null;
41317
41380
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
41318
- this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a2 = options._enableTemplateTypeChecker) != null ? _a2 : false);
41319
- this.enabledBlockTypes = new Set((_b2 = options._enabledBlockTypes) != null ? _b2 : []);
41381
+ this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a2 = options["_enableTemplateTypeChecker"]) != null ? _a2 : false);
41382
+ this.enabledBlockTypes = new Set((_b2 = options["_enabledBlockTypes"]) != null ? _b2 : []);
41320
41383
  this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
41321
41384
  this.currentProgram = inputProgram;
41322
41385
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
@@ -41709,7 +41772,7 @@ var NgCompiler = class {
41709
41772
  const reflector = new TypeScriptReflectionHost(checker);
41710
41773
  let refEmitter;
41711
41774
  let aliasingHost = null;
41712
- if (this.adapter.unifiedModulesHost === null || !this.options._useHostForImportGeneration) {
41775
+ if (this.adapter.unifiedModulesHost === null || !this.options["_useHostForImportGeneration"]) {
41713
41776
  let localImportStrategy;
41714
41777
  if (this.options.rootDir !== void 0 || this.options.rootDirs !== void 0 && this.options.rootDirs.length > 0) {
41715
41778
  localImportStrategy = new LogicalProjectStrategy(reflector, new LogicalFileSystem([...this.adapter.rootDirs], this.adapter));
@@ -41776,8 +41839,8 @@ var NgCompiler = class {
41776
41839
  }
41777
41840
  const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
41778
41841
  const strictCtorDeps = this.options.strictInjectionParameters || false;
41779
- const supportJitMode = (_a2 = this.options.supportJitMode) != null ? _a2 : true;
41780
- const supportTestBed = (_b2 = this.options.supportTestBed) != null ? _b2 : true;
41842
+ const supportJitMode = (_a2 = this.options["supportJitMode"]) != null ? _a2 : true;
41843
+ const supportTestBed = (_b2 = this.options["supportTestBed"]) != null ? _b2 : true;
41781
41844
  if (supportTestBed === false && compilationMode === CompilationMode.PARTIAL) {
41782
41845
  throw new Error('TestBed support ("supportTestBed" option) cannot be disabled in partial compilation mode.');
41783
41846
  }