@angular/core 18.0.0-next.2 → 18.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 (87) hide show
  1. package/esm2022/rxjs-interop/src/take_until_destroyed.mjs +2 -2
  2. package/esm2022/rxjs-interop/src/to_observable.mjs +1 -1
  3. package/esm2022/rxjs-interop/src/to_signal.mjs +2 -2
  4. package/esm2022/src/application/application_init.mjs +2 -2
  5. package/esm2022/src/application/application_ref.mjs +10 -15
  6. package/esm2022/src/application/application_tokens.mjs +3 -3
  7. package/esm2022/src/change_detection/change_detector_ref.mjs +3 -3
  8. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +31 -4
  9. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +7 -15
  10. package/esm2022/src/core_private_export.mjs +3 -3
  11. package/esm2022/src/core_render3_private_export.mjs +1 -2
  12. package/esm2022/src/debug/debug_node.mjs +5 -5
  13. package/esm2022/src/defer/instructions.mjs +2 -2
  14. package/esm2022/src/di/contextual.mjs +3 -3
  15. package/esm2022/src/di/injectable.mjs +1 -1
  16. package/esm2022/src/di/injector.mjs +4 -4
  17. package/esm2022/src/di/injector_compatibility.mjs +3 -3
  18. package/esm2022/src/di/interface/provider.mjs +1 -1
  19. package/esm2022/src/di/metadata.mjs +1 -1
  20. package/esm2022/src/di/provider_collection.mjs +2 -2
  21. package/esm2022/src/event_emitter.mjs +1 -1
  22. package/esm2022/src/hydration/annotate.mjs +35 -49
  23. package/esm2022/src/hydration/api.mjs +37 -15
  24. package/esm2022/src/hydration/cleanup.mjs +4 -18
  25. package/esm2022/src/hydration/i18n.mjs +378 -0
  26. package/esm2022/src/hydration/interfaces.mjs +2 -1
  27. package/esm2022/src/hydration/node_lookup_utils.mjs +24 -10
  28. package/esm2022/src/hydration/utils.mjs +61 -2
  29. package/esm2022/src/i18n/locale_data_api.mjs +4 -4
  30. package/esm2022/src/i18n/tokens.mjs +6 -6
  31. package/esm2022/src/interface/lifecycle_hooks.mjs +1 -1
  32. package/esm2022/src/linker/compiler.mjs +1 -7
  33. package/esm2022/src/linker/component_factory.mjs +1 -1
  34. package/esm2022/src/linker/ng_module_factory.mjs +2 -3
  35. package/esm2022/src/linker/template_ref.mjs +1 -2
  36. package/esm2022/src/linker/view_container_ref.mjs +2 -2
  37. package/esm2022/src/linker/view_ref.mjs +4 -4
  38. package/esm2022/src/metadata/directives.mjs +1 -1
  39. package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
  40. package/esm2022/src/metadata/ng_module.mjs +1 -1
  41. package/esm2022/src/render3/component.mjs +3 -4
  42. package/esm2022/src/render3/component_ref.mjs +1 -1
  43. package/esm2022/src/render3/definition.mjs +2 -2
  44. package/esm2022/src/render3/i18n/i18n_apply.mjs +28 -6
  45. package/esm2022/src/render3/i18n/i18n_parse.mjs +2 -5
  46. package/esm2022/src/render3/i18n/i18n_util.mjs +6 -1
  47. package/esm2022/src/render3/instructions/change_detection.mjs +3 -6
  48. package/esm2022/src/render3/instructions/i18n.mjs +3 -1
  49. package/esm2022/src/render3/jit/environment.mjs +1 -3
  50. package/esm2022/src/render3/ng_module_ref.mjs +1 -4
  51. package/esm2022/src/render3/node_manipulation.mjs +19 -15
  52. package/esm2022/src/render3/reactivity/effect.mjs +1 -1
  53. package/esm2022/src/render3/util/injector_discovery_utils.mjs +12 -8
  54. package/esm2022/src/render3/util/view_utils.mjs +4 -14
  55. package/esm2022/src/render3/view_ref.mjs +14 -4
  56. package/esm2022/src/util/callback_scheduler.mjs +23 -33
  57. package/esm2022/src/version.mjs +1 -1
  58. package/esm2022/src/zone/ng_zone.mjs +3 -3
  59. package/esm2022/testing/src/component_fixture.mjs +2 -2
  60. package/esm2022/testing/src/fake_async.mjs +6 -1
  61. package/esm2022/testing/src/logger.mjs +3 -3
  62. package/esm2022/testing/src/private_export.mjs +9 -0
  63. package/esm2022/testing/src/test_hooks.mjs +3 -3
  64. package/esm2022/testing/src/testing.mjs +3 -2
  65. package/fesm2022/core.mjs +1186 -753
  66. package/fesm2022/core.mjs.map +1 -1
  67. package/fesm2022/primitives/signals.mjs +2 -2
  68. package/fesm2022/rxjs-interop.mjs +4 -4
  69. package/fesm2022/rxjs-interop.mjs.map +1 -1
  70. package/fesm2022/testing.mjs +42 -37
  71. package/fesm2022/testing.mjs.map +1 -1
  72. package/index.d.ts +168 -134
  73. package/package.json +1 -1
  74. package/primitives/signals/index.d.ts +2 -2
  75. package/rxjs-interop/index.d.ts +6 -6
  76. package/schematics/migrations/block-template-entities/bundle.js +6 -22
  77. package/schematics/migrations/block-template-entities/bundle.js.map +2 -2
  78. package/schematics/migrations/compiler-options/bundle.js.map +1 -1
  79. package/schematics/migrations/invalid-two-way-bindings/bundle.js +6 -22
  80. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +2 -2
  81. package/schematics/migrations/transfer-state/bundle.js.map +1 -1
  82. package/schematics/ng-generate/control-flow-migration/bundle.js +29 -33
  83. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  84. package/schematics/ng-generate/standalone-migration/bundle.js +49 -72
  85. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  86. package/testing/index.d.ts +8 -2
  87. package/esm2022/src/change_detection/flags.mjs +0 -17
@@ -5528,12 +5528,6 @@ var Identifiers = _Identifiers;
5528
5528
  moduleName: CORE
5529
5529
  };
5530
5530
  })();
5531
- (() => {
5532
- _Identifiers.InputFlags = {
5533
- name: "\u0275\u0275InputFlags",
5534
- moduleName: CORE
5535
- };
5536
- })();
5537
5531
  (() => {
5538
5532
  _Identifiers.sanitizeHtml = { name: "\u0275\u0275sanitizeHtml", moduleName: CORE };
5539
5533
  })();
@@ -7968,16 +7962,15 @@ function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
7968
7962
  publicName = value.bindingPropertyName;
7969
7963
  const differentDeclaringName = publicName !== declaredName;
7970
7964
  const hasDecoratorInputTransform = value.transformFunction !== null;
7971
- let flags = null;
7965
+ let flags = InputFlags.None;
7972
7966
  if (value.isSignal) {
7973
- flags = bitwiseOrInputFlagsExpr(InputFlags.SignalBased, flags);
7967
+ flags |= InputFlags.SignalBased;
7974
7968
  }
7975
7969
  if (hasDecoratorInputTransform) {
7976
- flags = bitwiseOrInputFlagsExpr(InputFlags.HasDecoratorInputTransform, flags);
7970
+ flags |= InputFlags.HasDecoratorInputTransform;
7977
7971
  }
7978
- if (forInputs && (differentDeclaringName || hasDecoratorInputTransform || flags !== null)) {
7979
- const flagsExpr = flags != null ? flags : importExpr(Identifiers.InputFlags).prop(InputFlags[InputFlags.None]);
7980
- const result = [flagsExpr, asLiteral(publicName)];
7972
+ if (forInputs && (differentDeclaringName || hasDecoratorInputTransform || flags !== InputFlags.None)) {
7973
+ const result = [literal(flags), asLiteral(publicName)];
7981
7974
  if (differentDeclaringName || hasDecoratorInputTransform) {
7982
7975
  result.push(asLiteral(declaredName));
7983
7976
  if (hasDecoratorInputTransform) {
@@ -7996,15 +7989,6 @@ function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
7996
7989
  };
7997
7990
  }));
7998
7991
  }
7999
- function getInputFlagExpr(flag) {
8000
- return importExpr(Identifiers.InputFlags).prop(InputFlags[flag]);
8001
- }
8002
- function bitwiseOrInputFlagsExpr(flag, expr) {
8003
- if (expr === null) {
8004
- return getInputFlagExpr(flag);
8005
- }
8006
- return getInputFlagExpr(flag).bitwiseOr(expr);
8007
- }
8008
7992
  var DefinitionMap = class {
8009
7993
  constructor() {
8010
7994
  this.values = [];
@@ -25985,7 +25969,7 @@ function publishFacade(global) {
25985
25969
  }
25986
25970
 
25987
25971
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
25988
- var VERSION2 = new Version("18.0.0-next.2");
25972
+ var VERSION2 = new Version("18.0.0-next.4");
25989
25973
 
25990
25974
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25991
25975
  var _I18N_ATTR = "i18n";
@@ -27048,7 +27032,7 @@ var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
27048
27032
  function compileDeclareClassMetadata(metadata) {
27049
27033
  const definitionMap = new DefinitionMap();
27050
27034
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
27051
- definitionMap.set("version", literal("18.0.0-next.2"));
27035
+ definitionMap.set("version", literal("18.0.0-next.4"));
27052
27036
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27053
27037
  definitionMap.set("type", metadata.type);
27054
27038
  definitionMap.set("decorators", metadata.decorators);
@@ -27067,7 +27051,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
27067
27051
  callbackReturnDefinitionMap.set("ctorParameters", (_a2 = metadata.ctorParameters) != null ? _a2 : literal(null));
27068
27052
  callbackReturnDefinitionMap.set("propDecorators", (_b2 = metadata.propDecorators) != null ? _b2 : literal(null));
27069
27053
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
27070
- definitionMap.set("version", literal("18.0.0-next.2"));
27054
+ definitionMap.set("version", literal("18.0.0-next.4"));
27071
27055
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27072
27056
  definitionMap.set("type", metadata.type);
27073
27057
  definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
@@ -27135,7 +27119,7 @@ function createDirectiveDefinitionMap(meta) {
27135
27119
  const definitionMap = new DefinitionMap();
27136
27120
  const minVersion = getMinimumVersionForPartialOutput(meta);
27137
27121
  definitionMap.set("minVersion", literal(minVersion));
27138
- definitionMap.set("version", literal("18.0.0-next.2"));
27122
+ definitionMap.set("version", literal("18.0.0-next.4"));
27139
27123
  definitionMap.set("type", meta.type.value);
27140
27124
  if (meta.isStandalone) {
27141
27125
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -27451,7 +27435,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION2 = "12.0.0";
27451
27435
  function compileDeclareFactoryFunction(meta) {
27452
27436
  const definitionMap = new DefinitionMap();
27453
27437
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
27454
- definitionMap.set("version", literal("18.0.0-next.2"));
27438
+ definitionMap.set("version", literal("18.0.0-next.4"));
27455
27439
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27456
27440
  definitionMap.set("type", meta.type.value);
27457
27441
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -27474,7 +27458,7 @@ function compileDeclareInjectableFromMetadata(meta) {
27474
27458
  function createInjectableDefinitionMap(meta) {
27475
27459
  const definitionMap = new DefinitionMap();
27476
27460
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
27477
- definitionMap.set("version", literal("18.0.0-next.2"));
27461
+ definitionMap.set("version", literal("18.0.0-next.4"));
27478
27462
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27479
27463
  definitionMap.set("type", meta.type.value);
27480
27464
  if (meta.providedIn !== void 0) {
@@ -27512,7 +27496,7 @@ function compileDeclareInjectorFromMetadata(meta) {
27512
27496
  function createInjectorDefinitionMap(meta) {
27513
27497
  const definitionMap = new DefinitionMap();
27514
27498
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
27515
- definitionMap.set("version", literal("18.0.0-next.2"));
27499
+ definitionMap.set("version", literal("18.0.0-next.4"));
27516
27500
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27517
27501
  definitionMap.set("type", meta.type.value);
27518
27502
  definitionMap.set("providers", meta.providers);
@@ -27536,7 +27520,7 @@ function createNgModuleDefinitionMap(meta) {
27536
27520
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
27537
27521
  }
27538
27522
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
27539
- definitionMap.set("version", literal("18.0.0-next.2"));
27523
+ definitionMap.set("version", literal("18.0.0-next.4"));
27540
27524
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27541
27525
  definitionMap.set("type", meta.type.value);
27542
27526
  if (meta.bootstrap.length > 0) {
@@ -27571,7 +27555,7 @@ function compileDeclarePipeFromMetadata(meta) {
27571
27555
  function createPipeDefinitionMap(meta) {
27572
27556
  const definitionMap = new DefinitionMap();
27573
27557
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
27574
- definitionMap.set("version", literal("18.0.0-next.2"));
27558
+ definitionMap.set("version", literal("18.0.0-next.4"));
27575
27559
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27576
27560
  definitionMap.set("type", meta.type.value);
27577
27561
  if (meta.isStandalone) {
@@ -27588,7 +27572,7 @@ function createPipeDefinitionMap(meta) {
27588
27572
  publishFacade(_global);
27589
27573
 
27590
27574
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
27591
- var VERSION3 = new Version("18.0.0-next.2");
27575
+ var VERSION3 = new Version("18.0.0-next.4");
27592
27576
 
27593
27577
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
27594
27578
  var import_typescript5 = __toESM(require("typescript"), 1);
@@ -27711,7 +27695,6 @@ var FatalDiagnosticError = class extends Error {
27711
27695
  this.node = node;
27712
27696
  this.diagnosticMessage = diagnosticMessage;
27713
27697
  this.relatedInformation = relatedInformation;
27714
- this.message = this.message;
27715
27698
  this._isFatalDiagnosticError = true;
27716
27699
  Object.setPrototypeOf(this, new.target.prototype);
27717
27700
  }
@@ -42988,21 +42971,29 @@ var MagicString = class {
42988
42971
  if (searchValue.global) {
42989
42972
  const matches = matchAll(searchValue, this.original);
42990
42973
  matches.forEach((match) => {
42991
- if (match.index != null)
42974
+ if (match.index != null) {
42975
+ const replacement2 = getReplacement(match, this.original);
42976
+ if (replacement2 !== match[0]) {
42977
+ this.overwrite(
42978
+ match.index,
42979
+ match.index + match[0].length,
42980
+ replacement2
42981
+ );
42982
+ }
42983
+ }
42984
+ });
42985
+ } else {
42986
+ const match = this.original.match(searchValue);
42987
+ if (match && match.index != null) {
42988
+ const replacement2 = getReplacement(match, this.original);
42989
+ if (replacement2 !== match[0]) {
42992
42990
  this.overwrite(
42993
42991
  match.index,
42994
42992
  match.index + match[0].length,
42995
- getReplacement(match, this.original)
42993
+ replacement2
42996
42994
  );
42997
- });
42998
- } else {
42999
- const match = this.original.match(searchValue);
43000
- if (match && match.index != null)
43001
- this.overwrite(
43002
- match.index,
43003
- match.index + match[0].length,
43004
- getReplacement(match, this.original)
43005
- );
42995
+ }
42996
+ }
43006
42997
  }
43007
42998
  return this;
43008
42999
  }
@@ -43024,7 +43015,9 @@ var MagicString = class {
43024
43015
  const { original } = this;
43025
43016
  const stringLength = string.length;
43026
43017
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
43027
- this.overwrite(index, index + stringLength, replacement);
43018
+ const previous = original.slice(index, index + stringLength);
43019
+ if (previous !== replacement)
43020
+ this.overwrite(index, index + stringLength, replacement);
43028
43021
  }
43029
43022
  return this;
43030
43023
  }
@@ -43687,7 +43680,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
43687
43680
  splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
43688
43681
  const mapping = this.resolver.getSourceMapping(templateId);
43689
43682
  const errorMsg = `The property and event halves of the two-way binding '${input.name}' are not bound to the same target.
43690
- Find more at https://angular.io/guide/two-way-binding#how-two-way-binding-works`;
43683
+ Find more at https://angular.dev/guide/templates/two-way-binding#how-two-way-binding-works`;
43691
43684
  const relatedMessages = [];
43692
43685
  relatedMessages.push({
43693
43686
  text: `The property half of the binding is to the '${inputConsumer.name.text}' component.`,
@@ -44975,31 +44968,15 @@ var TcbSwitchOp = class extends TcbOp {
44975
44968
  return false;
44976
44969
  }
44977
44970
  execute() {
44978
- const comparisonExpression = tcbExpression(this.block.expression, this.tcb, this.scope);
44979
- markIgnoreDiagnostics(comparisonExpression);
44980
- const expression = import_typescript107.default.factory.createParenthesizedExpression(comparisonExpression);
44981
- const root = this.generateCase(0, expression, null);
44982
- if (root !== void 0) {
44983
- this.scope.addStatement(root);
44984
- }
44971
+ const switchExpression = tcbExpression(this.block.expression, this.tcb, this.scope);
44972
+ const clauses = this.block.cases.map((current) => {
44973
+ const clauseScope = Scope3.forNodes(this.tcb, this.scope, null, current.children, this.generateGuard(current, switchExpression));
44974
+ const statements = [...clauseScope.render(), import_typescript107.default.factory.createBreakStatement()];
44975
+ return current.expression === null ? import_typescript107.default.factory.createDefaultClause(statements) : import_typescript107.default.factory.createCaseClause(tcbExpression(current.expression, this.tcb, clauseScope), statements);
44976
+ });
44977
+ this.scope.addStatement(import_typescript107.default.factory.createSwitchStatement(switchExpression, import_typescript107.default.factory.createCaseBlock(clauses)));
44985
44978
  return null;
44986
44979
  }
44987
- generateCase(index, switchValue, defaultCase) {
44988
- if (index >= this.block.cases.length) {
44989
- if (defaultCase !== null) {
44990
- const defaultScope = Scope3.forNodes(this.tcb, this.scope, null, defaultCase.children, this.generateGuard(defaultCase, switchValue));
44991
- return import_typescript107.default.factory.createBlock(defaultScope.render());
44992
- }
44993
- return void 0;
44994
- }
44995
- const current = this.block.cases[index];
44996
- if (current.expression === null) {
44997
- return this.generateCase(index + 1, switchValue, current);
44998
- }
44999
- const caseScope = Scope3.forNodes(this.tcb, this.scope, null, current.children, this.generateGuard(current, switchValue));
45000
- const caseValue = tcbExpression(current.expression, this.tcb, caseScope);
45001
- return import_typescript107.default.factory.createIfStatement(import_typescript107.default.factory.createBinaryExpression(switchValue, import_typescript107.default.SyntaxKind.EqualsEqualsEqualsToken, caseValue), import_typescript107.default.factory.createBlock(caseScope.render()), this.generateCase(index + 1, switchValue, defaultCase));
45002
- }
45003
44980
  generateGuard(node, switchValue) {
45004
44981
  if (node.expression !== null) {
45005
44982
  const expression = tcbExpression(node.expression, this.tcb, this.scope);
@@ -45242,7 +45219,7 @@ var _Scope = class {
45242
45219
  } else if (node instanceof IfBlock) {
45243
45220
  this.opQueue.push(new TcbIfOp(this.tcb, this, node));
45244
45221
  } else if (node instanceof SwitchBlock) {
45245
- this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.expression), new TcbSwitchOp(this.tcb, this, node));
45222
+ this.opQueue.push(new TcbSwitchOp(this.tcb, this, node));
45246
45223
  } else if (node instanceof ForLoopBlock) {
45247
45224
  this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
45248
45225
  node.empty && this.appendChildren(node.empty);
@@ -47493,7 +47470,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
47493
47470
  const boundSyntax = node.sourceSpan.toString();
47494
47471
  const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
47495
47472
  const diagnostic = ctx.makeTemplateDiagnostic(node.sourceSpan, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
47496
- Find more at https://angular.io/guide/two-way-binding`);
47473
+ Find more at https://angular.dev/guide/templates/two-way-binding`);
47497
47474
  return [diagnostic];
47498
47475
  }
47499
47476
  };
@@ -48666,7 +48643,7 @@ One of the following actions is required:
48666
48643
  2. Remove "strictTemplates" or set it to 'false'.
48667
48644
 
48668
48645
  More information about the template type checking compiler options can be found in the documentation:
48669
- https://angular.io/guide/template-typecheck
48646
+ https://angular.dev/tools/cli/template-typecheck
48670
48647
  `.trim()
48671
48648
  });
48672
48649
  }
@@ -50820,7 +50797,7 @@ function standalone_migration_default(options) {
50820
50797
  }
50821
50798
  context.logger.info("\u{1F389} Automated migration step has finished! \u{1F389}");
50822
50799
  context.logger.info("IMPORTANT! Please verify manually that your application builds and behaves as expected.");
50823
- context.logger.info(`See https://angular.io/guide/standalone-migration for more information.`);
50800
+ context.logger.info(`See https://angular.dev/reference/migrations/standalone for more information.`);
50824
50801
  });
50825
50802
  }
50826
50803
  function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schematicOptions, oldProgram) {