@angular/core 19.1.2 → 19.1.3

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 (36) hide show
  1. package/fesm2022/core.mjs +306 -192
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  4. package/fesm2022/primitives/signals.mjs +87 -2
  5. package/fesm2022/primitives/signals.mjs.map +1 -1
  6. package/fesm2022/rxjs-interop.mjs +1 -1
  7. package/fesm2022/testing.mjs +4 -4
  8. package/index.d.ts +1 -1
  9. package/package.json +1 -1
  10. package/primitives/event-dispatch/index.d.ts +1 -1
  11. package/primitives/signals/index.d.ts +42 -1
  12. package/rxjs-interop/index.d.ts +1 -1
  13. package/schematics/bundles/{apply_import_manager-bb1a82ec.js → apply_import_manager-40cd5384.js} +3 -3
  14. package/schematics/bundles/{checker-aa999c96.js → checker-ca858016.js} +40 -7
  15. package/schematics/bundles/cleanup-unused-imports.js +54 -21
  16. package/schematics/bundles/{compiler_host-f0b570c8.js → compiler_host-68e159d5.js} +2 -2
  17. package/schematics/bundles/control-flow-migration.js +3 -3
  18. package/schematics/bundles/explicit-standalone-flag.js +5 -5
  19. package/schematics/bundles/{imports-31a38653.js → imports-abe29092.js} +1 -1
  20. package/schematics/bundles/{index-4830663b.js → index-761b9f6f.js} +4 -4
  21. package/schematics/bundles/{index-4e3d512c.js → index-d05029f9.js} +4 -4
  22. package/schematics/bundles/inject-migration.js +6 -6
  23. package/schematics/bundles/{leading_space-6e7a8ec6.js → leading_space-d190b83b.js} +1 -1
  24. package/schematics/bundles/{migrate_ts_type_references-21d5d831.js → migrate_ts_type_references-8d015538.js} +6 -6
  25. package/schematics/bundles/{nodes-88c2157f.js → nodes-a9f0b985.js} +2 -2
  26. package/schematics/bundles/output-migration.js +6 -6
  27. package/schematics/bundles/pending-tasks.js +5 -5
  28. package/schematics/bundles/{program-57240d08.js → program-8e222816.js} +34 -15
  29. package/schematics/bundles/{project_tsconfig_paths-6c9cde78.js → project_tsconfig_paths-e9ccccbf.js} +1 -1
  30. package/schematics/bundles/provide-initializer.js +5 -5
  31. package/schematics/bundles/route-lazy-loading.js +4 -4
  32. package/schematics/bundles/signal-input-migration.js +8 -8
  33. package/schematics/bundles/signal-queries-migration.js +8 -8
  34. package/schematics/bundles/signals.js +8 -8
  35. package/schematics/bundles/standalone-migration.js +8 -8
  36. package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.1.2
2
+ * @license Angular v19.1.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -12267,6 +12267,55 @@ function nativeRemoveNode(renderer, rNode, isHostElement) {
12267
12267
  function clearElementContents(rElement) {
12268
12268
  rElement.textContent = '';
12269
12269
  }
12270
+ /**
12271
+ * Write `cssText` to `RElement`.
12272
+ *
12273
+ * This function does direct write without any reconciliation. Used for writing initial values, so
12274
+ * that static styling values do not pull in the style parser.
12275
+ *
12276
+ * @param renderer Renderer to use
12277
+ * @param element The element which needs to be updated.
12278
+ * @param newValue The new class list to write.
12279
+ */
12280
+ function writeDirectStyle(renderer, element, newValue) {
12281
+ ngDevMode && assertString(newValue, "'newValue' should be a string");
12282
+ renderer.setAttribute(element, 'style', newValue);
12283
+ ngDevMode && ngDevMode.rendererSetStyle++;
12284
+ }
12285
+ /**
12286
+ * Write `className` to `RElement`.
12287
+ *
12288
+ * This function does direct write without any reconciliation. Used for writing initial values, so
12289
+ * that static styling values do not pull in the style parser.
12290
+ *
12291
+ * @param renderer Renderer to use
12292
+ * @param element The element which needs to be updated.
12293
+ * @param newValue The new class list to write.
12294
+ */
12295
+ function writeDirectClass(renderer, element, newValue) {
12296
+ ngDevMode && assertString(newValue, "'newValue' should be a string");
12297
+ if (newValue === '') {
12298
+ // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
12299
+ renderer.removeAttribute(element, 'class');
12300
+ }
12301
+ else {
12302
+ renderer.setAttribute(element, 'class', newValue);
12303
+ }
12304
+ ngDevMode && ngDevMode.rendererSetClassName++;
12305
+ }
12306
+ /** Sets up the static DOM attributes on an `RNode`. */
12307
+ function setupStaticAttributes(renderer, element, tNode) {
12308
+ const { mergedAttrs, classes, styles } = tNode;
12309
+ if (mergedAttrs !== null) {
12310
+ setUpAttributes(renderer, element, mergedAttrs);
12311
+ }
12312
+ if (classes !== null) {
12313
+ writeDirectClass(renderer, element, classes);
12314
+ }
12315
+ if (styles !== null) {
12316
+ writeDirectStyle(renderer, element, styles);
12317
+ }
12318
+ }
12270
12319
 
12271
12320
  function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
12272
12321
  const lView = tView.blueprint.slice();
@@ -12301,67 +12350,6 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, enviro
12301
12350
  tView.type == 2 /* TViewType.Embedded */ ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
12302
12351
  return lView;
12303
12352
  }
12304
- function getOrCreateTNode(tView, index, type, name, attrs) {
12305
- ngDevMode &&
12306
- index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
12307
- // `view_engine_compatibility` for additional context.
12308
- assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
12309
- // Keep this function short, so that the VM will inline it.
12310
- ngDevMode && assertPureTNodeType(type);
12311
- let tNode = tView.data[index];
12312
- if (tNode === null) {
12313
- tNode = createTNodeAtIndex(tView, index, type, name, attrs);
12314
- if (isInI18nBlock()) {
12315
- // If we are in i18n block then all elements should be pre declared through `Placeholder`
12316
- // See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
12317
- // If the `TNode` was not pre-declared than it means it was not mentioned which means it was
12318
- // removed, so we mark it as detached.
12319
- tNode.flags |= 32 /* TNodeFlags.isDetached */;
12320
- }
12321
- }
12322
- else if (tNode.type & 64 /* TNodeType.Placeholder */) {
12323
- tNode.type = type;
12324
- tNode.value = name;
12325
- tNode.attrs = attrs;
12326
- const parent = getCurrentParentTNode();
12327
- tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex;
12328
- ngDevMode && assertTNodeForTView(tNode, tView);
12329
- ngDevMode && assertEqual(index, tNode.index, 'Expecting same index');
12330
- }
12331
- setCurrentTNode(tNode, true);
12332
- return tNode;
12333
- }
12334
- function createTNodeAtIndex(tView, index, type, name, attrs) {
12335
- const currentTNode = getCurrentTNodePlaceholderOk();
12336
- const isParent = isCurrentTNodeParent();
12337
- const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
12338
- // Parents cannot cross component boundaries because components will be used in multiple places.
12339
- const tNode = (tView.data[index] = createTNode(tView, parent, type, index, name, attrs));
12340
- // Assign a pointer to the first child node of a given view. The first node is not always the one
12341
- // at index 0, in case of i18n, index 0 can be the instruction `i18nStart` and the first node has
12342
- // the index 1 or more, so we can't just check node index.
12343
- if (tView.firstChild === null) {
12344
- tView.firstChild = tNode;
12345
- }
12346
- if (currentTNode !== null) {
12347
- if (isParent) {
12348
- // FIXME(misko): This logic looks unnecessarily complicated. Could we simplify?
12349
- if (currentTNode.child == null && tNode.parent !== null) {
12350
- // We are in the same view, which means we are adding content node to the parent view.
12351
- currentTNode.child = tNode;
12352
- }
12353
- }
12354
- else {
12355
- if (currentTNode.next === null) {
12356
- // In the case of i18n the `currentTNode` may already be linked, in which case we don't want
12357
- // to break the links which i18n created.
12358
- currentTNode.next = tNode;
12359
- tNode.prev = currentTNode;
12360
- }
12361
- }
12362
- }
12363
- return tNode;
12364
- }
12365
12353
  /**
12366
12354
  * When elements are created dynamically after a view blueprint is created (e.g. through
12367
12355
  * i18nApply()), we need to adjust the blueprint for future
@@ -12595,62 +12583,6 @@ function applyRootElementTransformImpl(rootElement) {
12595
12583
  function enableApplyRootElementTransformImpl() {
12596
12584
  _applyRootElementTransformImpl = applyRootElementTransformImpl;
12597
12585
  }
12598
- function createTNode(tView, tParent, type, index, value, attrs) {
12599
- ngDevMode &&
12600
- index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
12601
- // `view_engine_compatibility` for additional context.
12602
- assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
12603
- ngDevMode && assertNotSame(attrs, undefined, "'undefined' is not valid value for 'attrs'");
12604
- ngDevMode && ngDevMode.tNode++;
12605
- ngDevMode && tParent && assertTNodeForTView(tParent, tView);
12606
- let injectorIndex = tParent ? tParent.injectorIndex : -1;
12607
- let flags = 0;
12608
- if (isInSkipHydrationBlock$1()) {
12609
- flags |= 128 /* TNodeFlags.inSkipHydrationBlock */;
12610
- }
12611
- const tNode = {
12612
- type,
12613
- index,
12614
- insertBeforeIndex: null,
12615
- injectorIndex,
12616
- directiveStart: -1,
12617
- directiveEnd: -1,
12618
- directiveStylingLast: -1,
12619
- componentOffset: -1,
12620
- propertyBindings: null,
12621
- flags,
12622
- providerIndexes: 0,
12623
- value: value,
12624
- attrs: attrs,
12625
- mergedAttrs: null,
12626
- localNames: null,
12627
- initialInputs: undefined,
12628
- inputs: null,
12629
- outputs: null,
12630
- tView: null,
12631
- next: null,
12632
- prev: null,
12633
- projectionNext: null,
12634
- child: null,
12635
- parent: tParent,
12636
- projection: null,
12637
- styles: null,
12638
- stylesWithoutHost: null,
12639
- residualStyles: undefined,
12640
- classes: null,
12641
- classesWithoutHost: null,
12642
- residualClasses: undefined,
12643
- classBindings: 0,
12644
- styleBindings: 0,
12645
- };
12646
- if (ngDevMode) {
12647
- // For performance reasons it is important that the tNode retains the same shape during runtime.
12648
- // (To make sure that all of the code is monomorphic.) For this reason we seal the object to
12649
- // prevent class transitions.
12650
- Object.seal(tNode);
12651
- }
12652
- return tNode;
12653
- }
12654
12586
  function captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) {
12655
12587
  for (let publicName in aliasMap) {
12656
12588
  if (!aliasMap.hasOwnProperty(publicName)) {
@@ -14436,55 +14368,6 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
14436
14368
  }
14437
14369
  }
14438
14370
  }
14439
- /**
14440
- * Write `cssText` to `RElement`.
14441
- *
14442
- * This function does direct write without any reconciliation. Used for writing initial values, so
14443
- * that static styling values do not pull in the style parser.
14444
- *
14445
- * @param renderer Renderer to use
14446
- * @param element The element which needs to be updated.
14447
- * @param newValue The new class list to write.
14448
- */
14449
- function writeDirectStyle(renderer, element, newValue) {
14450
- ngDevMode && assertString(newValue, "'newValue' should be a string");
14451
- renderer.setAttribute(element, 'style', newValue);
14452
- ngDevMode && ngDevMode.rendererSetStyle++;
14453
- }
14454
- /**
14455
- * Write `className` to `RElement`.
14456
- *
14457
- * This function does direct write without any reconciliation. Used for writing initial values, so
14458
- * that static styling values do not pull in the style parser.
14459
- *
14460
- * @param renderer Renderer to use
14461
- * @param element The element which needs to be updated.
14462
- * @param newValue The new class list to write.
14463
- */
14464
- function writeDirectClass(renderer, element, newValue) {
14465
- ngDevMode && assertString(newValue, "'newValue' should be a string");
14466
- if (newValue === '') {
14467
- // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
14468
- renderer.removeAttribute(element, 'class');
14469
- }
14470
- else {
14471
- renderer.setAttribute(element, 'class', newValue);
14472
- }
14473
- ngDevMode && ngDevMode.rendererSetClassName++;
14474
- }
14475
- /** Sets up the static DOM attributes on an `RNode`. */
14476
- function setupStaticAttributes(renderer, element, tNode) {
14477
- const { mergedAttrs, classes, styles } = tNode;
14478
- if (mergedAttrs !== null) {
14479
- setUpAttributes(renderer, element, mergedAttrs);
14480
- }
14481
- if (classes !== null) {
14482
- writeDirectClass(renderer, element, classes);
14483
- }
14484
- if (styles !== null) {
14485
- writeDirectStyle(renderer, element, styles);
14486
- }
14487
- }
14488
14371
 
14489
14372
  function createAndRenderEmbeddedLView(declarationLView, templateTNode, context, options) {
14490
14373
  const prevConsumer = setActiveConsumer$1(null);
@@ -15996,6 +15879,128 @@ function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parent
15996
15879
  }
15997
15880
  }
15998
15881
 
15882
+ function getOrCreateTNode(tView, index, type, name, attrs) {
15883
+ ngDevMode &&
15884
+ index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
15885
+ // `view_engine_compatibility` for additional context.
15886
+ assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
15887
+ // Keep this function short, so that the VM will inline it.
15888
+ ngDevMode && assertPureTNodeType(type);
15889
+ let tNode = tView.data[index];
15890
+ if (tNode === null) {
15891
+ tNode = createTNodeAtIndex(tView, index, type, name, attrs);
15892
+ if (isInI18nBlock()) {
15893
+ // If we are in i18n block then all elements should be pre declared through `Placeholder`
15894
+ // See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
15895
+ // If the `TNode` was not pre-declared than it means it was not mentioned which means it was
15896
+ // removed, so we mark it as detached.
15897
+ tNode.flags |= 32 /* TNodeFlags.isDetached */;
15898
+ }
15899
+ }
15900
+ else if (tNode.type & 64 /* TNodeType.Placeholder */) {
15901
+ tNode.type = type;
15902
+ tNode.value = name;
15903
+ tNode.attrs = attrs;
15904
+ const parent = getCurrentParentTNode();
15905
+ tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex;
15906
+ ngDevMode && assertTNodeForTView(tNode, tView);
15907
+ ngDevMode && assertEqual(index, tNode.index, 'Expecting same index');
15908
+ }
15909
+ setCurrentTNode(tNode, true);
15910
+ return tNode;
15911
+ }
15912
+ function createTNodeAtIndex(tView, index, type, name, attrs) {
15913
+ const currentTNode = getCurrentTNodePlaceholderOk();
15914
+ const isParent = isCurrentTNodeParent();
15915
+ const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
15916
+ // Parents cannot cross component boundaries because components will be used in multiple places.
15917
+ const tNode = (tView.data[index] = createTNode(tView, parent, type, index, name, attrs));
15918
+ // Assign a pointer to the first child node of a given view. The first node is not always the one
15919
+ // at index 0, in case of i18n, index 0 can be the instruction `i18nStart` and the first node has
15920
+ // the index 1 or more, so we can't just check node index.
15921
+ linkTNodeInTView(tView, tNode, currentTNode, isParent);
15922
+ return tNode;
15923
+ }
15924
+ function linkTNodeInTView(tView, tNode, currentTNode, isParent) {
15925
+ if (tView.firstChild === null) {
15926
+ tView.firstChild = tNode;
15927
+ }
15928
+ if (currentTNode !== null) {
15929
+ if (isParent) {
15930
+ // FIXME(misko): This logic looks unnecessarily complicated. Could we simplify?
15931
+ if (currentTNode.child == null && tNode.parent !== null) {
15932
+ // We are in the same view, which means we are adding content node to the parent view.
15933
+ currentTNode.child = tNode;
15934
+ }
15935
+ }
15936
+ else {
15937
+ if (currentTNode.next === null) {
15938
+ // In the case of i18n the `currentTNode` may already be linked, in which case we don't want
15939
+ // to break the links which i18n created.
15940
+ currentTNode.next = tNode;
15941
+ tNode.prev = currentTNode;
15942
+ }
15943
+ }
15944
+ }
15945
+ }
15946
+ function createTNode(tView, tParent, type, index, value, attrs) {
15947
+ ngDevMode &&
15948
+ index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
15949
+ // `view_engine_compatibility` for additional context.
15950
+ assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
15951
+ ngDevMode && assertNotSame(attrs, undefined, "'undefined' is not valid value for 'attrs'");
15952
+ ngDevMode && ngDevMode.tNode++;
15953
+ ngDevMode && tParent && assertTNodeForTView(tParent, tView);
15954
+ let injectorIndex = tParent ? tParent.injectorIndex : -1;
15955
+ let flags = 0;
15956
+ if (isInSkipHydrationBlock$1()) {
15957
+ flags |= 128 /* TNodeFlags.inSkipHydrationBlock */;
15958
+ }
15959
+ // TODO: would it be helpful to use a prototypal inheritance here, similar to the way we do so with signals?
15960
+ const tNode = {
15961
+ type,
15962
+ index,
15963
+ insertBeforeIndex: null,
15964
+ injectorIndex,
15965
+ directiveStart: -1,
15966
+ directiveEnd: -1,
15967
+ directiveStylingLast: -1,
15968
+ componentOffset: -1,
15969
+ propertyBindings: null,
15970
+ flags,
15971
+ providerIndexes: 0,
15972
+ value: value,
15973
+ attrs: attrs,
15974
+ mergedAttrs: null,
15975
+ localNames: null,
15976
+ initialInputs: undefined,
15977
+ inputs: null,
15978
+ outputs: null,
15979
+ tView: null,
15980
+ next: null,
15981
+ prev: null,
15982
+ projectionNext: null,
15983
+ child: null,
15984
+ parent: tParent,
15985
+ projection: null,
15986
+ styles: null,
15987
+ stylesWithoutHost: null,
15988
+ residualStyles: undefined,
15989
+ classes: null,
15990
+ classesWithoutHost: null,
15991
+ residualClasses: undefined,
15992
+ classBindings: 0,
15993
+ styleBindings: 0,
15994
+ };
15995
+ if (ngDevMode) {
15996
+ // For performance reasons it is important that the tNode retains the same shape during runtime.
15997
+ // (To make sure that all of the code is monomorphic.) For this reason we seal the object to
15998
+ // prevent class transitions.
15999
+ Object.seal(tNode);
16000
+ }
16001
+ return tNode;
16002
+ }
16003
+
15999
16004
  /**
16000
16005
  * Add `tNode` to `previousTNodes` list and update relevant `TNode`s in `previousTNodes` list
16001
16006
  * `tNode.insertBeforeIndex`.
@@ -17917,6 +17922,7 @@ class ComponentFactory extends ComponentFactory$1 {
17917
17922
  // Create the root view. Uses empty TView and ContentTemplate.
17918
17923
  const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null, null);
17919
17924
  const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, hydrationInfo);
17925
+ rootLView[HEADER_OFFSET] = hostRNode;
17920
17926
  // rootView is the parent when bootstrapping
17921
17927
  // TODO(misko): it looks like we are entering view here but we don't really need to as
17922
17928
  // `renderView` does that. However as the code is written it is needed because
@@ -17924,7 +17930,6 @@ class ComponentFactory extends ComponentFactory$1 {
17924
17930
  // issues would allow us to drop this.
17925
17931
  enterView(rootLView);
17926
17932
  let component;
17927
- let tElementNode;
17928
17933
  let componentView = null;
17929
17934
  try {
17930
17935
  const rootComponentDef = this.componentDef;
@@ -17940,12 +17945,13 @@ class ComponentFactory extends ComponentFactory$1 {
17940
17945
  else {
17941
17946
  rootDirectives = [rootComponentDef];
17942
17947
  }
17943
- const hostTNode = createRootComponentTNode(rootLView, hostRNode);
17944
17948
  // If host dom element is created (instead of being provided as part of the dynamic component creation), also apply attributes and classes extracted from component selector.
17945
17949
  const tAttributes = rootSelectorOrNode
17946
- ? ['ng-version', '19.1.2']
17950
+ ? ['ng-version', '19.1.3']
17947
17951
  : // Extract attributes and classes from the first selector only to match VE behavior.
17948
17952
  getRootTAttributesFromSelector(this.componentDef.selectors[0]);
17953
+ // TODO: this logic is shared with the element instruction first create pass
17954
+ const hostTNode = getOrCreateTNode(rootTView, HEADER_OFFSET, 2 /* TNodeType.Element */, '#host', tAttributes);
17949
17955
  for (const def of rootDirectives) {
17950
17956
  hostTNode.mergedAttrs = mergeHostAttrs(hostTNode.mergedAttrs, def.hostAttrs);
17951
17957
  }
@@ -17958,7 +17964,6 @@ class ComponentFactory extends ComponentFactory$1 {
17958
17964
  setupStaticAttributes(hostRenderer, hostRNode, hostTNode);
17959
17965
  }
17960
17966
  componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, environment);
17961
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
17962
17967
  if (projectableNodes !== undefined) {
17963
17968
  projectNodes(hostTNode, this.ngContentSelectors, projectableNodes);
17964
17969
  }
@@ -17979,7 +17984,8 @@ class ComponentFactory extends ComponentFactory$1 {
17979
17984
  finally {
17980
17985
  leaveView();
17981
17986
  }
17982
- return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
17987
+ const hostTNode = getTNode(rootTView, HEADER_OFFSET);
17988
+ return new ComponentRef(this.componentType, component, createElementRef(hostTNode, rootLView), rootLView, hostTNode);
17983
17989
  }
17984
17990
  finally {
17985
17991
  setActiveConsumer$1(prevConsumer);
@@ -18048,17 +18054,6 @@ class ComponentRef extends ComponentRef$1 {
18048
18054
  this.hostView.onDestroy(callback);
18049
18055
  }
18050
18056
  }
18051
- /** Creates a TNode that can be used to instantiate a root component. */
18052
- function createRootComponentTNode(lView, rNode) {
18053
- const tView = lView[TVIEW];
18054
- const index = HEADER_OFFSET;
18055
- ngDevMode && assertIndexInRange(lView, index);
18056
- lView[index] = rNode;
18057
- // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
18058
- // the same time we want to communicate the debug `TNode` that this is a special `TNode`
18059
- // representing a host element.
18060
- return getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
18061
- }
18062
18057
  /**
18063
18058
  * Creates the root component view and the root component node.
18064
18059
  *
@@ -20072,7 +20067,11 @@ function getComponentId(componentDef) {
20072
20067
  // 2147483647 = equivalent of Integer.MAX_VALUE.
20073
20068
  hash += 2147483647 + 1;
20074
20069
  const compId = 'c' + hash;
20075
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
20070
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
20071
+ // Skip the check on the server since we can't guarantee the same component instance between
20072
+ // requests. Note that we can't use DI to check if we're on the server, because the component
20073
+ // hasn't been instantiated yet.
20074
+ (typeof ngServerMode === 'undefined' || !ngServerMode)) {
20076
20075
  if (GENERATED_COMP_IDS.has(compId)) {
20077
20076
  const previousCompDefType = GENERATED_COMP_IDS.get(compId);
20078
20077
  if (previousCompDefType !== componentDef.type) {
@@ -33413,13 +33412,18 @@ function ɵsetClassDebugInfo(type, debugInfo) {
33413
33412
  */
33414
33413
  function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals) {
33415
33414
  ngDevMode && assertComponentDef(type);
33416
- const oldDef = getComponentDef(type);
33415
+ const currentDef = getComponentDef(type);
33417
33416
  // The reason `applyMetadata` is a callback that is invoked (almost) immediately is because
33418
33417
  // the compiler usually produces more code than just the component definition, e.g. there
33419
33418
  // can be functions for embedded views, the variables for the constant pool and `setClassMetadata`
33420
33419
  // calls. The callback allows us to keep them isolate from the rest of the app and to invoke
33421
33420
  // them at the right time.
33422
33421
  applyMetadata.apply(null, [type, namespaces, ...locals]);
33422
+ const { newDef, oldDef } = mergeWithExistingDefinition(currentDef, getComponentDef(type));
33423
+ // TODO(crisbeto): the `applyMetadata` call above will replace the definition on the type.
33424
+ // Ideally we should adjust the compiler output so the metadata is returned, however that'll
33425
+ // require some internal changes. We re-add the metadata here manually.
33426
+ type[NG_COMP_DEF] = newDef;
33423
33427
  // If a `tView` hasn't been created yet, it means that this component hasn't been instantianted
33424
33428
  // before. In this case there's nothing left for us to do aside from patching it in.
33425
33429
  if (oldDef.tView) {
@@ -33428,17 +33432,42 @@ function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals) {
33428
33432
  // Note: we have the additional check, because `IsRoot` can also indicate
33429
33433
  // a component created through something like `createComponent`.
33430
33434
  if (root[FLAGS] & 512 /* LViewFlags.IsRoot */ && root[PARENT] === null) {
33431
- recreateMatchingLViews(oldDef, root);
33435
+ recreateMatchingLViews(newDef, oldDef, root);
33432
33436
  }
33433
33437
  }
33434
33438
  }
33435
33439
  }
33440
+ /**
33441
+ * Merges two component definitions while preseving the original one in place.
33442
+ * @param currentDef Definition that should receive the new metadata.
33443
+ * @param newDef Source of the new metadata.
33444
+ */
33445
+ function mergeWithExistingDefinition(currentDef, newDef) {
33446
+ // Clone the current definition since we reference its original data further
33447
+ // down in the replacement process (e.g. when destroying the renderer).
33448
+ const clone = { ...currentDef };
33449
+ // Assign the new metadata in place while preserving the object literal. It's important to
33450
+ // Keep the object in place, because there can be references to it, for example in the
33451
+ // `directiveDefs` of another definition.
33452
+ const replacement = Object.assign(currentDef, newDef, {
33453
+ // We need to keep the existing directive and pipe defs, because they can get patched on
33454
+ // by a call to `setComponentScope` from a module file. That call won't make it into the
33455
+ // HMR replacement function, because it lives in an entirely different file.
33456
+ directiveDefs: clone.directiveDefs,
33457
+ pipeDefs: clone.pipeDefs,
33458
+ // Preserve the old `setInput` function, because it has some state.
33459
+ // This is fine, because the component instance is preserved as well.
33460
+ setInput: clone.setInput,
33461
+ });
33462
+ ngDevMode && assertEqual(replacement, currentDef, 'Expected definition to be merged in place');
33463
+ return { newDef: replacement, oldDef: clone };
33464
+ }
33436
33465
  /**
33437
33466
  * Finds all LViews matching a specific component definition and recreates them.
33438
33467
  * @param oldDef Component definition to search for.
33439
33468
  * @param rootLView View from which to start the search.
33440
33469
  */
33441
- function recreateMatchingLViews(oldDef, rootLView) {
33470
+ function recreateMatchingLViews(newDef, oldDef, rootLView) {
33442
33471
  ngDevMode &&
33443
33472
  assertDefined(oldDef.tView, 'Expected a component definition that has been instantiated at least once');
33444
33473
  const tView = rootLView[TVIEW];
@@ -33446,7 +33475,7 @@ function recreateMatchingLViews(oldDef, rootLView) {
33446
33475
  // produce false positives when using inheritance.
33447
33476
  if (tView === oldDef.tView) {
33448
33477
  ngDevMode && assertComponentDef(oldDef.type);
33449
- recreateLView(getComponentDef(oldDef.type), oldDef, rootLView);
33478
+ recreateLView(newDef, oldDef, rootLView);
33450
33479
  return;
33451
33480
  }
33452
33481
  for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
@@ -33454,14 +33483,14 @@ function recreateMatchingLViews(oldDef, rootLView) {
33454
33483
  if (isLContainer(current)) {
33455
33484
  // The host can be an LView if a component is injecting `ViewContainerRef`.
33456
33485
  if (isLView(current[HOST])) {
33457
- recreateMatchingLViews(oldDef, current[HOST]);
33486
+ recreateMatchingLViews(newDef, oldDef, current[HOST]);
33458
33487
  }
33459
33488
  for (let j = CONTAINER_HEADER_OFFSET; j < current.length; j++) {
33460
- recreateMatchingLViews(oldDef, current[j]);
33489
+ recreateMatchingLViews(newDef, oldDef, current[j]);
33461
33490
  }
33462
33491
  }
33463
33492
  else if (isLView(current)) {
33464
- recreateMatchingLViews(oldDef, current);
33493
+ recreateMatchingLViews(newDef, oldDef, current);
33465
33494
  }
33466
33495
  }
33467
33496
  }
@@ -34967,7 +34996,7 @@ class Version {
34967
34996
  /**
34968
34997
  * @publicApi
34969
34998
  */
34970
- const VERSION = new Version('19.1.2');
34999
+ const VERSION = new Version('19.1.3');
34971
35000
 
34972
35001
  /**
34973
35002
  * Combination of NgModuleFactory and ComponentFactories.
@@ -38875,6 +38904,91 @@ function signalValueChanged(node) {
38875
38904
  postSignalSetFn?.();
38876
38905
  }
38877
38906
 
38907
+ function createLinkedSignal$1(sourceFn, computationFn, equalityFn) {
38908
+ const node = Object.create(LINKED_SIGNAL_NODE$1);
38909
+ node.source = sourceFn;
38910
+ node.computation = computationFn;
38911
+ if (equalityFn != undefined) {
38912
+ node.equal = equalityFn;
38913
+ }
38914
+ const linkedSignalGetter = () => {
38915
+ // Check if the value needs updating before returning it.
38916
+ producerUpdateValueVersion(node);
38917
+ // Record that someone looked at this signal.
38918
+ producerAccessed(node);
38919
+ if (node.value === ERRORED$1) {
38920
+ throw node.error;
38921
+ }
38922
+ return node.value;
38923
+ };
38924
+ const getter = linkedSignalGetter;
38925
+ getter[SIGNAL] = node;
38926
+ return getter;
38927
+ }
38928
+ function linkedSignalSetFn(node, newValue) {
38929
+ producerUpdateValueVersion(node);
38930
+ signalSetFn(node, newValue);
38931
+ producerMarkClean(node);
38932
+ }
38933
+ function linkedSignalUpdateFn(node, updater) {
38934
+ producerUpdateValueVersion(node);
38935
+ signalUpdateFn(node, updater);
38936
+ producerMarkClean(node);
38937
+ }
38938
+ // Note: Using an IIFE here to ensure that the spread assignment is not considered
38939
+ // a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.
38940
+ // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
38941
+ const LINKED_SIGNAL_NODE$1 = /* @__PURE__ */ (() => {
38942
+ return {
38943
+ ...REACTIVE_NODE,
38944
+ value: UNSET$1,
38945
+ dirty: true,
38946
+ error: null,
38947
+ equal: defaultEquals,
38948
+ producerMustRecompute(node) {
38949
+ // Force a recomputation if there's no current value, or if the current value is in the
38950
+ // process of being calculated (which should throw an error).
38951
+ return node.value === UNSET$1 || node.value === COMPUTING$1;
38952
+ },
38953
+ producerRecomputeValue(node) {
38954
+ if (node.value === COMPUTING$1) {
38955
+ // Our computation somehow led to a cyclic read of itself.
38956
+ throw new Error('Detected cycle in computations.');
38957
+ }
38958
+ const oldValue = node.value;
38959
+ node.value = COMPUTING$1;
38960
+ const prevConsumer = consumerBeforeComputation(node);
38961
+ let newValue;
38962
+ try {
38963
+ const newSourceValue = node.source();
38964
+ const prev = oldValue === UNSET$1 || oldValue === ERRORED$1
38965
+ ? undefined
38966
+ : {
38967
+ source: node.sourceValue,
38968
+ value: oldValue,
38969
+ };
38970
+ newValue = node.computation(newSourceValue, prev);
38971
+ node.sourceValue = newSourceValue;
38972
+ }
38973
+ catch (err) {
38974
+ newValue = ERRORED$1;
38975
+ node.error = err;
38976
+ }
38977
+ finally {
38978
+ consumerAfterComputation(node, prevConsumer);
38979
+ }
38980
+ if (oldValue !== UNSET$1 && newValue !== ERRORED$1 && node.equal(oldValue, newValue)) {
38981
+ // No change to `valueVersion` - old and new values are
38982
+ // semantically equivalent.
38983
+ node.value = oldValue;
38984
+ return;
38985
+ }
38986
+ node.value = newValue;
38987
+ node.version++;
38988
+ },
38989
+ };
38990
+ })();
38991
+
38878
38992
  function createWatch(fn, schedule, allowSignalWrites) {
38879
38993
  const node = Object.create(WATCH_NODE);
38880
38994
  if (allowSignalWrites) {