@angular/core 16.2.5 → 16.2.6

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.2.5
2
+ * @license Angular v16.2.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -3556,7 +3556,7 @@ function getFactoryDef(type, throwNotFound) {
3556
3556
  *
3557
3557
  * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
3558
3558
  */
3559
- const SIGNAL = Symbol('SIGNAL');
3559
+ const SIGNAL = /* @__PURE__ */ Symbol('SIGNAL');
3560
3560
  /**
3561
3561
  * Checks if the given `value` is a reactive `Signal`.
3562
3562
  *
@@ -3734,7 +3734,9 @@ function consumerAfterComputation(node, prevConsumer) {
3734
3734
  }
3735
3735
  }
3736
3736
  // Truncate the producer tracking arrays.
3737
- for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
3737
+ // Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but
3738
+ // benchmarking has shown that individual pop operations are faster.
3739
+ while (node.producerNode.length > node.nextProducerIndex) {
3738
3740
  node.producerNode.pop();
3739
3741
  node.producerLastReadVersion.pop();
3740
3742
  node.producerIndexOfThis.pop();
@@ -3808,6 +3810,9 @@ function producerAddLiveConsumer(node, consumer, indexOfThis) {
3808
3810
  function producerRemoveLiveConsumerAtIndex(node, idx) {
3809
3811
  assertProducerNode(node);
3810
3812
  assertConsumerNode(node);
3813
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {
3814
+ throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
3815
+ }
3811
3816
  if (node.liveConsumerNode.length === 1) {
3812
3817
  // When removing the last live consumer, we will no longer be live. We need to remove
3813
3818
  // ourselves from our producers' tracking (which may cause consumer-producers to lose
@@ -3872,60 +3877,65 @@ function computed(computation, options) {
3872
3877
  * A dedicated symbol used before a computed value has been calculated for the first time.
3873
3878
  * Explicitly typed as `any` so we can use it as signal's value.
3874
3879
  */
3875
- const UNSET = Symbol('UNSET');
3880
+ const UNSET = /* @__PURE__ */ Symbol('UNSET');
3876
3881
  /**
3877
3882
  * A dedicated symbol used in place of a computed signal value to indicate that a given computation
3878
3883
  * is in progress. Used to detect cycles in computation chains.
3879
3884
  * Explicitly typed as `any` so we can use it as signal's value.
3880
3885
  */
3881
- const COMPUTING = Symbol('COMPUTING');
3886
+ const COMPUTING = /* @__PURE__ */ Symbol('COMPUTING');
3882
3887
  /**
3883
3888
  * A dedicated symbol used in place of a computed signal value to indicate that a given computation
3884
3889
  * failed. The thrown error is cached until the computation gets dirty again.
3885
3890
  * Explicitly typed as `any` so we can use it as signal's value.
3886
3891
  */
3887
- const ERRORED = Symbol('ERRORED');
3888
- const COMPUTED_NODE = {
3889
- ...REACTIVE_NODE,
3890
- value: UNSET,
3891
- dirty: true,
3892
- error: null,
3893
- equal: defaultEquals,
3894
- producerMustRecompute(node) {
3895
- // Force a recomputation if there's no current value, or if the current value is in the process
3896
- // of being calculated (which should throw an error).
3897
- return node.value === UNSET || node.value === COMPUTING;
3898
- },
3899
- producerRecomputeValue(node) {
3900
- if (node.value === COMPUTING) {
3901
- // Our computation somehow led to a cyclic read of itself.
3902
- throw new Error('Detected cycle in computations.');
3903
- }
3904
- const oldValue = node.value;
3905
- node.value = COMPUTING;
3906
- const prevConsumer = consumerBeforeComputation(node);
3907
- let newValue;
3908
- try {
3909
- newValue = node.computation();
3910
- }
3911
- catch (err) {
3912
- newValue = ERRORED;
3913
- node.error = err;
3914
- }
3915
- finally {
3916
- consumerAfterComputation(node, prevConsumer);
3917
- }
3918
- if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED &&
3919
- node.equal(oldValue, newValue)) {
3920
- // No change to `valueVersion` - old and new values are
3921
- // semantically equivalent.
3922
- node.value = oldValue;
3923
- return;
3924
- }
3925
- node.value = newValue;
3926
- node.version++;
3927
- },
3928
- };
3892
+ const ERRORED = /* @__PURE__ */ Symbol('ERRORED');
3893
+ // Note: Using an IIFE here to ensure that the spread assignment is not considered
3894
+ // a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
3895
+ // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
3896
+ const COMPUTED_NODE = /* @__PURE__ */ (() => {
3897
+ return {
3898
+ ...REACTIVE_NODE,
3899
+ value: UNSET,
3900
+ dirty: true,
3901
+ error: null,
3902
+ equal: defaultEquals,
3903
+ producerMustRecompute(node) {
3904
+ // Force a recomputation if there's no current value, or if the current value is in the
3905
+ // process of being calculated (which should throw an error).
3906
+ return node.value === UNSET || node.value === COMPUTING;
3907
+ },
3908
+ producerRecomputeValue(node) {
3909
+ if (node.value === COMPUTING) {
3910
+ // Our computation somehow led to a cyclic read of itself.
3911
+ throw new Error('Detected cycle in computations.');
3912
+ }
3913
+ const oldValue = node.value;
3914
+ node.value = COMPUTING;
3915
+ const prevConsumer = consumerBeforeComputation(node);
3916
+ let newValue;
3917
+ try {
3918
+ newValue = node.computation();
3919
+ }
3920
+ catch (err) {
3921
+ newValue = ERRORED;
3922
+ node.error = err;
3923
+ }
3924
+ finally {
3925
+ consumerAfterComputation(node, prevConsumer);
3926
+ }
3927
+ if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED &&
3928
+ node.equal(oldValue, newValue)) {
3929
+ // No change to `valueVersion` - old and new values are
3930
+ // semantically equivalent.
3931
+ node.value = oldValue;
3932
+ return;
3933
+ }
3934
+ node.value = newValue;
3935
+ node.version++;
3936
+ },
3937
+ };
3938
+ })();
3929
3939
 
3930
3940
  function defaultThrowError() {
3931
3941
  throw new Error();
@@ -3970,11 +3980,16 @@ function setPostSignalSetFn(fn) {
3970
3980
  postSignalSetFn = fn;
3971
3981
  return prev;
3972
3982
  }
3973
- const SIGNAL_NODE = {
3974
- ...REACTIVE_NODE,
3975
- equal: defaultEquals,
3976
- readonlyFn: undefined,
3977
- };
3983
+ // Note: Using an IIFE here to ensure that the spread assignment is not considered
3984
+ // a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
3985
+ // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
3986
+ const SIGNAL_NODE = /* @__PURE__ */ (() => {
3987
+ return {
3988
+ ...REACTIVE_NODE,
3989
+ equal: defaultEquals,
3990
+ readonlyFn: undefined,
3991
+ };
3992
+ })();
3978
3993
  function signalValueChanged(node) {
3979
3994
  node.version++;
3980
3995
  producerNotifyConsumers(node);
@@ -4067,16 +4082,21 @@ function watch(fn, schedule, allowSignalWrites) {
4067
4082
  return node.ref;
4068
4083
  }
4069
4084
  const NOOP_CLEANUP_FN = () => { };
4070
- const WATCH_NODE = {
4071
- ...REACTIVE_NODE,
4072
- consumerIsAlwaysLive: true,
4073
- consumerAllowSignalWrites: false,
4074
- consumerMarkedDirty: (node) => {
4075
- node.schedule(node.ref);
4076
- },
4077
- hasRun: false,
4078
- cleanupFn: NOOP_CLEANUP_FN,
4079
- };
4085
+ // Note: Using an IIFE here to ensure that the spread assignment is not considered
4086
+ // a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
4087
+ // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
4088
+ const WATCH_NODE = /* @__PURE__ */ (() => {
4089
+ return {
4090
+ ...REACTIVE_NODE,
4091
+ consumerIsAlwaysLive: true,
4092
+ consumerAllowSignalWrites: false,
4093
+ consumerMarkedDirty: (node) => {
4094
+ node.schedule(node.ref);
4095
+ },
4096
+ hasRun: false,
4097
+ cleanupFn: NOOP_CLEANUP_FN,
4098
+ };
4099
+ })();
4080
4100
 
4081
4101
  function setAlternateWeakRefImpl(impl) {
4082
4102
  // TODO: remove this function
@@ -10905,7 +10925,7 @@ class Version {
10905
10925
  /**
10906
10926
  * @publicApi
10907
10927
  */
10908
- const VERSION = new Version('16.2.5');
10928
+ const VERSION = new Version('16.2.6');
10909
10929
 
10910
10930
  // This default value is when checking the hierarchy for a token.
10911
10931
  //