@angular/core 18.0.2 → 18.0.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.
package/fesm2022/core.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v18.0.2
2
+ * @license Angular v18.0.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1, consumerDestroy as consumerDestroy$1, REACTIVE_NODE as REACTIVE_NODE$1, consumerBeforeComputation as consumerBeforeComputation$1, consumerAfterComputation as consumerAfterComputation$1, consumerPollProducersForChange as consumerPollProducersForChange$1, createSignal as createSignal$1, signalUpdateFn as signalUpdateFn$1, createComputed as createComputed$1, setThrowInvalidWriteToSignalError as setThrowInvalidWriteToSignalError$1, createWatch as createWatch$1 } from '@angular/core/primitives/signals';
8
- import { Subject, Subscription, BehaviorSubject } from 'rxjs';
8
+ import { BehaviorSubject, Subject, Subscription } from 'rxjs';
9
9
  import { map, first } from 'rxjs/operators';
10
10
  import * as Attributes from '@angular/core/primitives/event-dispatch';
11
11
  import { EventContract, EventContractContainer, EventDispatcher, registerDispatcher, isSupportedEvent, isCaptureEvent } from '@angular/core/primitives/event-dispatch';
@@ -6917,15 +6917,102 @@ function unwrapElementRef(value) {
6917
6917
  return value instanceof ElementRef ? value.nativeElement : value;
6918
6918
  }
6919
6919
 
6920
+ /**
6921
+ * Internal implementation of the pending tasks service.
6922
+ */
6923
+ class PendingTasks {
6924
+ constructor() {
6925
+ this.taskId = 0;
6926
+ this.pendingTasks = new Set();
6927
+ this.hasPendingTasks = new BehaviorSubject(false);
6928
+ }
6929
+ get _hasPendingTasks() {
6930
+ return this.hasPendingTasks.value;
6931
+ }
6932
+ add() {
6933
+ if (!this._hasPendingTasks) {
6934
+ this.hasPendingTasks.next(true);
6935
+ }
6936
+ const taskId = this.taskId++;
6937
+ this.pendingTasks.add(taskId);
6938
+ return taskId;
6939
+ }
6940
+ remove(taskId) {
6941
+ this.pendingTasks.delete(taskId);
6942
+ if (this.pendingTasks.size === 0 && this._hasPendingTasks) {
6943
+ this.hasPendingTasks.next(false);
6944
+ }
6945
+ }
6946
+ ngOnDestroy() {
6947
+ this.pendingTasks.clear();
6948
+ if (this._hasPendingTasks) {
6949
+ this.hasPendingTasks.next(false);
6950
+ }
6951
+ }
6952
+ /** @nocollapse */
6953
+ static { this.ɵprov = ɵɵdefineInjectable({
6954
+ token: PendingTasks,
6955
+ providedIn: 'root',
6956
+ factory: () => new PendingTasks(),
6957
+ }); }
6958
+ }
6959
+ /**
6960
+ * Experimental service that keeps track of pending tasks contributing to the stableness of Angular
6961
+ * application. While several existing Angular services (ex.: `HttpClient`) will internally manage
6962
+ * tasks influencing stability, this API gives control over stability to library and application
6963
+ * developers for specific cases not covered by Angular internals.
6964
+ *
6965
+ * The concept of stability comes into play in several important scenarios:
6966
+ * - SSR process needs to wait for the application stability before serializing and sending rendered
6967
+ * HTML;
6968
+ * - tests might want to delay assertions until the application becomes stable;
6969
+ *
6970
+ * @usageNotes
6971
+ * ```typescript
6972
+ * const pendingTasks = inject(ExperimentalPendingTasks);
6973
+ * const taskCleanup = pendingTasks.add();
6974
+ * // do work that should block application's stability and then:
6975
+ * taskCleanup();
6976
+ * ```
6977
+ *
6978
+ * This API is experimental. Neither the shape, nor the underlying behavior is stable and can change
6979
+ * in patch versions. We will iterate on the exact API based on the feedback and our understanding
6980
+ * of the problem and solution space.
6981
+ *
6982
+ * @publicApi
6983
+ * @experimental
6984
+ */
6985
+ class ExperimentalPendingTasks {
6986
+ constructor() {
6987
+ this.internalPendingTasks = inject(PendingTasks);
6988
+ }
6989
+ /**
6990
+ * Adds a new task that should block application's stability.
6991
+ * @returns A cleanup function that removes a task when called.
6992
+ */
6993
+ add() {
6994
+ const taskId = this.internalPendingTasks.add();
6995
+ return () => this.internalPendingTasks.remove(taskId);
6996
+ }
6997
+ /** @nocollapse */
6998
+ static { this.ɵprov = ɵɵdefineInjectable({
6999
+ token: ExperimentalPendingTasks,
7000
+ providedIn: 'root',
7001
+ factory: () => new ExperimentalPendingTasks(),
7002
+ }); }
7003
+ }
7004
+
6920
7005
  class EventEmitter_ extends Subject {
6921
7006
  constructor(isAsync = false) {
6922
7007
  super();
6923
7008
  this.destroyRef = undefined;
7009
+ this.pendingTasks = undefined;
6924
7010
  this.__isAsync = isAsync;
6925
- // Attempt to retrieve a `DestroyRef` optionally.
6926
- // For backwards compatibility reasons, this cannot be required
7011
+ // Attempt to retrieve a `DestroyRef` and `PendingTasks` optionally.
7012
+ // For backwards compatibility reasons, this cannot be required.
6927
7013
  if (isInInjectionContext()) {
6928
7014
  this.destroyRef = inject(DestroyRef, { optional: true }) ?? undefined;
7015
+ this.pendingTasks = inject(PendingTasks, { optional: true }) ?? undefined;
6929
7016
  }
6930
7017
  }
6931
7018
  emit(value) {
@@ -6948,12 +7035,12 @@ class EventEmitter_ extends Subject {
6948
7035
  completeFn = observer.complete?.bind(observer);
6949
7036
  }
6950
7037
  if (this.__isAsync) {
6951
- errorFn = _wrapInTimeout(errorFn);
7038
+ errorFn = this.wrapInTimeout(errorFn);
6952
7039
  if (nextFn) {
6953
- nextFn = _wrapInTimeout(nextFn);
7040
+ nextFn = this.wrapInTimeout(nextFn);
6954
7041
  }
6955
7042
  if (completeFn) {
6956
- completeFn = _wrapInTimeout(completeFn);
7043
+ completeFn = this.wrapInTimeout(completeFn);
6957
7044
  }
6958
7045
  }
6959
7046
  const sink = super.subscribe({ next: nextFn, error: errorFn, complete: completeFn });
@@ -6962,11 +7049,17 @@ class EventEmitter_ extends Subject {
6962
7049
  }
6963
7050
  return sink;
6964
7051
  }
6965
- }
6966
- function _wrapInTimeout(fn) {
6967
- return (value) => {
6968
- setTimeout(fn, undefined, value);
6969
- };
7052
+ wrapInTimeout(fn) {
7053
+ return (value) => {
7054
+ const taskId = this.pendingTasks?.add();
7055
+ setTimeout(() => {
7056
+ fn(value);
7057
+ if (taskId !== undefined) {
7058
+ this.pendingTasks?.remove(taskId);
7059
+ }
7060
+ });
7061
+ };
7062
+ }
6970
7063
  }
6971
7064
  /**
6972
7065
  * @publicApi
@@ -12895,6 +12988,59 @@ const REACTIVE_LVIEW_CONSUMER_NODE = {
12895
12988
  this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
12896
12989
  },
12897
12990
  };
12991
+ /**
12992
+ * Creates a temporary consumer for use with `LView`s that should not have consumers.
12993
+ * If the LView already has a consumer, returns the existing one instead.
12994
+ *
12995
+ * This is necessary because some APIs may cause change detection directly on an LView
12996
+ * that we do not want to have a consumer (Embedded views today). As a result, there
12997
+ * would be no active consumer from running change detection on its host component
12998
+ * and any signals in the LView template would be untracked. Instead, we create
12999
+ * this temporary consumer that marks the first parent that _should_ have a consumer
13000
+ * for refresh. Once change detection runs as part of that refresh, we throw away
13001
+ * this consumer because its signals will then be tracked by the parent's consumer.
13002
+ */
13003
+ function getOrCreateTemporaryConsumer(lView) {
13004
+ const consumer = lView[REACTIVE_TEMPLATE_CONSUMER] ?? Object.create(TEMPORARY_CONSUMER_NODE);
13005
+ consumer.lView = lView;
13006
+ return consumer;
13007
+ }
13008
+ const TEMPORARY_CONSUMER_NODE = {
13009
+ ...REACTIVE_NODE$1,
13010
+ consumerIsAlwaysLive: true,
13011
+ consumerMarkedDirty: (node) => {
13012
+ let parent = getLViewParent(node.lView);
13013
+ while (parent && !viewShouldHaveReactiveConsumer(parent[TVIEW])) {
13014
+ parent = getLViewParent(parent);
13015
+ }
13016
+ if (!parent) {
13017
+ // If we can't find an appropriate parent that should have a consumer, we
13018
+ // don't have a way of appropriately refreshing this LView as part of application synchronization.
13019
+ return;
13020
+ }
13021
+ markViewForRefresh(parent);
13022
+ },
13023
+ consumerOnSignalRead() {
13024
+ this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
13025
+ },
13026
+ };
13027
+ /**
13028
+ * Indicates if the view should get its own reactive consumer node.
13029
+ *
13030
+ * In the current design, all embedded views share a consumer with the component view. This allows
13031
+ * us to refresh at the component level rather than at a per-view level. In addition, root views get
13032
+ * their own reactive node because root component will have a host view that executes the
13033
+ * component's host bindings. This needs to be tracked in a consumer as well.
13034
+ *
13035
+ * To get a more granular change detection than per-component, all we would just need to update the
13036
+ * condition here so that a given view gets a reactive consumer which can become dirty independently
13037
+ * from its parent component. For example embedded views for signal components could be created with
13038
+ * a new type "SignalEmbeddedView" and the condition here wouldn't even need updating in order to
13039
+ * get granular per-view change detection for signal components.
13040
+ */
13041
+ function viewShouldHaveReactiveConsumer(tView) {
13042
+ return tView.type !== 2 /* TViewType.Embedded */;
13043
+ }
12898
13044
 
12899
13045
  /**
12900
13046
  * The maximum number of times the change detection traversal will rerun before throwing an error.
@@ -12993,11 +13139,29 @@ function refreshView(tView, lView, templateFn, context) {
12993
13139
  // - We might already be in a reactive context if this is an embedded view of the host.
12994
13140
  // - We might be descending into a view that needs a consumer.
12995
13141
  enterView(lView);
13142
+ let returnConsumerToPool = true;
12996
13143
  let prevConsumer = null;
12997
13144
  let currentConsumer = null;
12998
- if (!isInCheckNoChangesPass && viewShouldHaveReactiveConsumer(tView)) {
12999
- currentConsumer = getOrBorrowReactiveLViewConsumer(lView);
13000
- prevConsumer = consumerBeforeComputation$1(currentConsumer);
13145
+ if (!isInCheckNoChangesPass) {
13146
+ if (viewShouldHaveReactiveConsumer(tView)) {
13147
+ currentConsumer = getOrBorrowReactiveLViewConsumer(lView);
13148
+ prevConsumer = consumerBeforeComputation$1(currentConsumer);
13149
+ }
13150
+ else if (getActiveConsumer$1() === null) {
13151
+ // If the current view should not have a reactive consumer but we don't have an active consumer,
13152
+ // we still need to create a temporary consumer to track any signal reads in this template.
13153
+ // This is a rare case that can happen with `viewContainerRef.createEmbeddedView(...).detectChanges()`.
13154
+ // This temporary consumer marks the first parent that _should_ have a consumer for refresh.
13155
+ // Once that refresh happens, the signals will be tracked in the parent consumer and we can destroy
13156
+ // the temporary one.
13157
+ returnConsumerToPool = false;
13158
+ currentConsumer = getOrCreateTemporaryConsumer(lView);
13159
+ prevConsumer = consumerBeforeComputation$1(currentConsumer);
13160
+ }
13161
+ else if (lView[REACTIVE_TEMPLATE_CONSUMER]) {
13162
+ consumerDestroy$1(lView[REACTIVE_TEMPLATE_CONSUMER]);
13163
+ lView[REACTIVE_TEMPLATE_CONSUMER] = null;
13164
+ }
13001
13165
  }
13002
13166
  try {
13003
13167
  resetPreOrderHookFlags(lView);
@@ -13123,28 +13287,13 @@ function refreshView(tView, lView, templateFn, context) {
13123
13287
  finally {
13124
13288
  if (currentConsumer !== null) {
13125
13289
  consumerAfterComputation$1(currentConsumer, prevConsumer);
13126
- maybeReturnReactiveLViewConsumer(currentConsumer);
13290
+ if (returnConsumerToPool) {
13291
+ maybeReturnReactiveLViewConsumer(currentConsumer);
13292
+ }
13127
13293
  }
13128
13294
  leaveView();
13129
13295
  }
13130
13296
  }
13131
- /**
13132
- * Indicates if the view should get its own reactive consumer node.
13133
- *
13134
- * In the current design, all embedded views share a consumer with the component view. This allows
13135
- * us to refresh at the component level rather than at a per-view level. In addition, root views get
13136
- * their own reactive node because root component will have a host view that executes the
13137
- * component's host bindings. This needs to be tracked in a consumer as well.
13138
- *
13139
- * To get a more granular change detection than per-component, all we would just need to update the
13140
- * condition here so that a given view gets a reactive consumer which can become dirty independently
13141
- * from its parent component. For example embedded views for signal components could be created with
13142
- * a new type "SignalEmbeddedView" and the condition here wouldn't even need updating in order to
13143
- * get granular per-view change detection for signal components.
13144
- */
13145
- function viewShouldHaveReactiveConsumer(tView) {
13146
- return tView.type !== 2 /* TViewType.Embedded */;
13147
- }
13148
13297
  /**
13149
13298
  * Goes over embedded views (ones created through ViewContainerRef APIs) and refreshes
13150
13299
  * them by executing an associated template function.
@@ -16906,7 +17055,7 @@ function createRootComponent(componentView, rootComponentDef, rootDirectives, ho
16906
17055
  function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
16907
17056
  if (rootSelectorOrNode) {
16908
17057
  // The placeholder will be replaced with the actual version at build time.
16909
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', '18.0.2']);
17058
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', '18.0.3']);
16910
17059
  }
16911
17060
  else {
16912
17061
  // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
@@ -19048,190 +19197,6 @@ class CachedInjectorService {
19048
19197
  }); }
19049
19198
  }
19050
19199
 
19051
- /**
19052
- * The name of a field that Angular monkey-patches onto a component
19053
- * class to store a function that loads defer-loadable dependencies
19054
- * and applies metadata to a class.
19055
- */
19056
- const ASYNC_COMPONENT_METADATA_FN = '__ngAsyncComponentMetadataFn__';
19057
- /**
19058
- * If a given component has unresolved async metadata - returns a reference
19059
- * to a function that applies component metadata after resolving defer-loadable
19060
- * dependencies. Otherwise - this function returns `null`.
19061
- */
19062
- function getAsyncClassMetadataFn(type) {
19063
- const componentClass = type; // cast to `any`, so that we can read a monkey-patched field
19064
- return componentClass[ASYNC_COMPONENT_METADATA_FN] ?? null;
19065
- }
19066
- /**
19067
- * Handles the process of applying metadata info to a component class in case
19068
- * component template has defer blocks (thus some dependencies became deferrable).
19069
- *
19070
- * @param type Component class where metadata should be added
19071
- * @param dependencyLoaderFn Function that loads dependencies
19072
- * @param metadataSetterFn Function that forms a scope in which the `setClassMetadata` is invoked
19073
- */
19074
- function setClassMetadataAsync(type, dependencyLoaderFn, metadataSetterFn) {
19075
- const componentClass = type; // cast to `any`, so that we can monkey-patch it
19076
- componentClass[ASYNC_COMPONENT_METADATA_FN] = () => Promise.all(dependencyLoaderFn()).then((dependencies) => {
19077
- metadataSetterFn(...dependencies);
19078
- // Metadata is now set, reset field value to indicate that this component
19079
- // can by used/compiled synchronously.
19080
- componentClass[ASYNC_COMPONENT_METADATA_FN] = null;
19081
- return dependencies;
19082
- });
19083
- return componentClass[ASYNC_COMPONENT_METADATA_FN];
19084
- }
19085
- /**
19086
- * Adds decorator, constructor, and property metadata to a given type via static metadata fields
19087
- * on the type.
19088
- *
19089
- * These metadata fields can later be read with Angular's `ReflectionCapabilities` API.
19090
- *
19091
- * Calls to `setClassMetadata` can be guarded by ngDevMode, resulting in the metadata assignments
19092
- * being tree-shaken away during production builds.
19093
- */
19094
- function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
19095
- return noSideEffects(() => {
19096
- const clazz = type;
19097
- if (decorators !== null) {
19098
- if (clazz.hasOwnProperty('decorators') && clazz.decorators !== undefined) {
19099
- clazz.decorators.push(...decorators);
19100
- }
19101
- else {
19102
- clazz.decorators = decorators;
19103
- }
19104
- }
19105
- if (ctorParameters !== null) {
19106
- // Rather than merging, clobber the existing parameters. If other projects exist which
19107
- // use tsickle-style annotations and reflect over them in the same way, this could
19108
- // cause issues, but that is vanishingly unlikely.
19109
- clazz.ctorParameters = ctorParameters;
19110
- }
19111
- if (propDecorators !== null) {
19112
- // The property decorator objects are merged as it is possible different fields have
19113
- // different decorator types. Decorators on individual fields are not merged, as it's
19114
- // also incredibly unlikely that a field will be decorated both with an Angular
19115
- // decorator and a non-Angular decorator that's also been downleveled.
19116
- if (clazz.hasOwnProperty('propDecorators') && clazz.propDecorators !== undefined) {
19117
- clazz.propDecorators = { ...clazz.propDecorators, ...propDecorators };
19118
- }
19119
- else {
19120
- clazz.propDecorators = propDecorators;
19121
- }
19122
- }
19123
- });
19124
- }
19125
-
19126
- /*
19127
- * This file exists to support compilation of @angular/core in Ivy mode.
19128
- *
19129
- * When the Angular compiler processes a compilation unit, it normally writes imports to
19130
- * @angular/core. When compiling the core package itself this strategy isn't usable. Instead, the
19131
- * compiler writes imports to this file.
19132
- *
19133
- * Only a subset of such imports are supported - core is not allowed to declare components or pipes.
19134
- * A check in ngtsc's `R3SymbolsImportRewriter` validates this condition. The rewriter is only used
19135
- * when compiling @angular/core and is responsible for translating an external name (prefixed with
19136
- * ɵ) to the internal symbol name as exported below.
19137
- *
19138
- * The below symbols are used for @Injectable and @NgModule compilation.
19139
- */
19140
- /**
19141
- * The existence of this constant (in this particular file) informs the Angular compiler that the
19142
- * current program is actually @angular/core, which needs to be compiled specially.
19143
- */
19144
- const ITS_JUST_ANGULAR = true;
19145
-
19146
- /**
19147
- * Internal implementation of the pending tasks service.
19148
- */
19149
- class PendingTasks {
19150
- constructor() {
19151
- this.taskId = 0;
19152
- this.pendingTasks = new Set();
19153
- this.hasPendingTasks = new BehaviorSubject(false);
19154
- }
19155
- get _hasPendingTasks() {
19156
- return this.hasPendingTasks.value;
19157
- }
19158
- add() {
19159
- if (!this._hasPendingTasks) {
19160
- this.hasPendingTasks.next(true);
19161
- }
19162
- const taskId = this.taskId++;
19163
- this.pendingTasks.add(taskId);
19164
- return taskId;
19165
- }
19166
- remove(taskId) {
19167
- this.pendingTasks.delete(taskId);
19168
- if (this.pendingTasks.size === 0 && this._hasPendingTasks) {
19169
- this.hasPendingTasks.next(false);
19170
- }
19171
- }
19172
- ngOnDestroy() {
19173
- this.pendingTasks.clear();
19174
- if (this._hasPendingTasks) {
19175
- this.hasPendingTasks.next(false);
19176
- }
19177
- }
19178
- static { this.ɵfac = function PendingTasks_Factory(t) { return new (t || PendingTasks)(); }; }
19179
- static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PendingTasks, factory: PendingTasks.ɵfac, providedIn: 'root' }); }
19180
- }
19181
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PendingTasks, [{
19182
- type: Injectable,
19183
- args: [{
19184
- providedIn: 'root',
19185
- }]
19186
- }], null, null); })();
19187
- /**
19188
- * Experimental service that keeps track of pending tasks contributing to the stableness of Angular
19189
- * application. While several existing Angular services (ex.: `HttpClient`) will internally manage
19190
- * tasks influencing stability, this API gives control over stability to library and application
19191
- * developers for specific cases not covered by Angular internals.
19192
- *
19193
- * The concept of stability comes into play in several important scenarios:
19194
- * - SSR process needs to wait for the application stability before serializing and sending rendered
19195
- * HTML;
19196
- * - tests might want to delay assertions until the application becomes stable;
19197
- *
19198
- * @usageNotes
19199
- * ```typescript
19200
- * const pendingTasks = inject(ExperimentalPendingTasks);
19201
- * const taskCleanup = pendingTasks.add();
19202
- * // do work that should block application's stability and then:
19203
- * taskCleanup();
19204
- * ```
19205
- *
19206
- * This API is experimental. Neither the shape, nor the underlying behavior is stable and can change
19207
- * in patch versions. We will iterate on the exact API based on the feedback and our understanding
19208
- * of the problem and solution space.
19209
- *
19210
- * @publicApi
19211
- * @experimental
19212
- */
19213
- class ExperimentalPendingTasks {
19214
- constructor() {
19215
- this.internalPendingTasks = inject(PendingTasks);
19216
- }
19217
- /**
19218
- * Adds a new task that should block application's stability.
19219
- * @returns A cleanup function that removes a task when called.
19220
- */
19221
- add() {
19222
- const taskId = this.internalPendingTasks.add();
19223
- return () => this.internalPendingTasks.remove(taskId);
19224
- }
19225
- static { this.ɵfac = function ExperimentalPendingTasks_Factory(t) { return new (t || ExperimentalPendingTasks)(); }; }
19226
- static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ExperimentalPendingTasks, factory: ExperimentalPendingTasks.ɵfac, providedIn: 'root' }); }
19227
- }
19228
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ExperimentalPendingTasks, [{
19229
- type: Injectable,
19230
- args: [{
19231
- providedIn: 'root',
19232
- }]
19233
- }], null, null); })();
19234
-
19235
19200
  function isIterable(obj) {
19236
19201
  return obj !== null && typeof obj === 'object' && obj[Symbol.iterator] !== undefined;
19237
19202
  }
@@ -28858,6 +28823,81 @@ function maybeUnwrapModuleWithProviders(value) {
28858
28823
  return isModuleWithProviders(value) ? value.ngModule : value;
28859
28824
  }
28860
28825
 
28826
+ /**
28827
+ * The name of a field that Angular monkey-patches onto a component
28828
+ * class to store a function that loads defer-loadable dependencies
28829
+ * and applies metadata to a class.
28830
+ */
28831
+ const ASYNC_COMPONENT_METADATA_FN = '__ngAsyncComponentMetadataFn__';
28832
+ /**
28833
+ * If a given component has unresolved async metadata - returns a reference
28834
+ * to a function that applies component metadata after resolving defer-loadable
28835
+ * dependencies. Otherwise - this function returns `null`.
28836
+ */
28837
+ function getAsyncClassMetadataFn(type) {
28838
+ const componentClass = type; // cast to `any`, so that we can read a monkey-patched field
28839
+ return componentClass[ASYNC_COMPONENT_METADATA_FN] ?? null;
28840
+ }
28841
+ /**
28842
+ * Handles the process of applying metadata info to a component class in case
28843
+ * component template has defer blocks (thus some dependencies became deferrable).
28844
+ *
28845
+ * @param type Component class where metadata should be added
28846
+ * @param dependencyLoaderFn Function that loads dependencies
28847
+ * @param metadataSetterFn Function that forms a scope in which the `setClassMetadata` is invoked
28848
+ */
28849
+ function setClassMetadataAsync(type, dependencyLoaderFn, metadataSetterFn) {
28850
+ const componentClass = type; // cast to `any`, so that we can monkey-patch it
28851
+ componentClass[ASYNC_COMPONENT_METADATA_FN] = () => Promise.all(dependencyLoaderFn()).then((dependencies) => {
28852
+ metadataSetterFn(...dependencies);
28853
+ // Metadata is now set, reset field value to indicate that this component
28854
+ // can by used/compiled synchronously.
28855
+ componentClass[ASYNC_COMPONENT_METADATA_FN] = null;
28856
+ return dependencies;
28857
+ });
28858
+ return componentClass[ASYNC_COMPONENT_METADATA_FN];
28859
+ }
28860
+ /**
28861
+ * Adds decorator, constructor, and property metadata to a given type via static metadata fields
28862
+ * on the type.
28863
+ *
28864
+ * These metadata fields can later be read with Angular's `ReflectionCapabilities` API.
28865
+ *
28866
+ * Calls to `setClassMetadata` can be guarded by ngDevMode, resulting in the metadata assignments
28867
+ * being tree-shaken away during production builds.
28868
+ */
28869
+ function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
28870
+ return noSideEffects(() => {
28871
+ const clazz = type;
28872
+ if (decorators !== null) {
28873
+ if (clazz.hasOwnProperty('decorators') && clazz.decorators !== undefined) {
28874
+ clazz.decorators.push(...decorators);
28875
+ }
28876
+ else {
28877
+ clazz.decorators = decorators;
28878
+ }
28879
+ }
28880
+ if (ctorParameters !== null) {
28881
+ // Rather than merging, clobber the existing parameters. If other projects exist which
28882
+ // use tsickle-style annotations and reflect over them in the same way, this could
28883
+ // cause issues, but that is vanishingly unlikely.
28884
+ clazz.ctorParameters = ctorParameters;
28885
+ }
28886
+ if (propDecorators !== null) {
28887
+ // The property decorator objects are merged as it is possible different fields have
28888
+ // different decorator types. Decorators on individual fields are not merged, as it's
28889
+ // also incredibly unlikely that a field will be decorated both with an Angular
28890
+ // decorator and a non-Angular decorator that's also been downleveled.
28891
+ if (clazz.hasOwnProperty('propDecorators') && clazz.propDecorators !== undefined) {
28892
+ clazz.propDecorators = { ...clazz.propDecorators, ...propDecorators };
28893
+ }
28894
+ else {
28895
+ clazz.propDecorators = propDecorators;
28896
+ }
28897
+ }
28898
+ });
28899
+ }
28900
+
28861
28901
  /**
28862
28902
  * Bindings for pure functions are stored after regular bindings.
28863
28903
  *
@@ -30815,7 +30855,27 @@ class Version {
30815
30855
  /**
30816
30856
  * @publicApi
30817
30857
  */
30818
- const VERSION = new Version('18.0.2');
30858
+ const VERSION = new Version('18.0.3');
30859
+
30860
+ /*
30861
+ * This file exists to support compilation of @angular/core in Ivy mode.
30862
+ *
30863
+ * When the Angular compiler processes a compilation unit, it normally writes imports to
30864
+ * @angular/core. When compiling the core package itself this strategy isn't usable. Instead, the
30865
+ * compiler writes imports to this file.
30866
+ *
30867
+ * Only a subset of such imports are supported - core is not allowed to declare components or pipes.
30868
+ * A check in ngtsc's `R3SymbolsImportRewriter` validates this condition. The rewriter is only used
30869
+ * when compiling @angular/core and is responsible for translating an external name (prefixed with
30870
+ * ɵ) to the internal symbol name as exported below.
30871
+ *
30872
+ * The below symbols are used for @Injectable and @NgModule compilation.
30873
+ */
30874
+ /**
30875
+ * The existence of this constant (in this particular file) informs the Angular compiler that the
30876
+ * current program is actually @angular/core, which needs to be compiled specially.
30877
+ */
30878
+ const ITS_JUST_ANGULAR = true;
30819
30879
 
30820
30880
  class Console {
30821
30881
  log(message) {