@angular/core 14.0.1 → 14.0.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 (35) hide show
  1. package/esm2020/src/application_ref.mjs +31 -35
  2. package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +3 -5
  3. package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +3 -5
  4. package/esm2020/src/change_detection/differs/iterable_differs.mjs +3 -5
  5. package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +2 -5
  6. package/esm2020/src/di/injector_compatibility.mjs +6 -16
  7. package/esm2020/src/di/jit/util.mjs +3 -2
  8. package/esm2020/src/di/reflective_key.mjs +3 -2
  9. package/esm2020/src/errors.mjs +1 -1
  10. package/esm2020/src/i18n/locale_data_api.mjs +3 -2
  11. package/esm2020/src/render3/component.mjs +3 -2
  12. package/esm2020/src/render3/features/inherit_definition_feature.mjs +3 -5
  13. package/esm2020/src/render3/interfaces/renderer.mjs +10 -1
  14. package/esm2020/src/render3/jit/directive.mjs +20 -3
  15. package/esm2020/src/render3/jit/module.mjs +2 -1
  16. package/esm2020/src/render3/view_ref.mjs +3 -5
  17. package/esm2020/src/sanitization/sanitization.mjs +4 -9
  18. package/esm2020/src/version.mjs +1 -1
  19. package/esm2020/src/zone/ng_zone.mjs +5 -4
  20. package/esm2020/testing/src/logger.mjs +3 -3
  21. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  22. package/esm2020/testing/src/r3_test_bed_compiler.mjs +30 -25
  23. package/fesm2015/core.mjs +87 -90
  24. package/fesm2015/core.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +122 -125
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/core.mjs +87 -90
  28. package/fesm2020/core.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +122 -125
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/index.d.ts +6 -6
  32. package/package.json +1 -1
  33. package/testing/index.d.ts +1 -1
  34. package/schematics/utils/schematics_prompt.d.ts +0 -17
  35. package/schematics/utils/schematics_prompt.js +0 -45
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.1
2
+ * @license Angular v14.0.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1665,8 +1665,17 @@ var RendererStyleFlags3;
1665
1665
  function isProceduralRenderer(renderer) {
1666
1666
  return !!(renderer.listen);
1667
1667
  }
1668
+ let renderer3Enabled = false;
1669
+ function enableRenderer3() {
1670
+ renderer3Enabled = true;
1671
+ }
1668
1672
  const domRendererFactory3 = {
1669
1673
  createRenderer: (hostElement, rendererType) => {
1674
+ if (!renderer3Enabled) {
1675
+ throw new Error(ngDevMode ?
1676
+ `Renderer3 is not supported. This problem is likely caused by some component in the hierarchy was constructed without a correct parent injector.` :
1677
+ 'Renderer3 disabled');
1678
+ }
1670
1679
  return getDocument();
1671
1680
  }
1672
1681
  };
@@ -4858,10 +4867,8 @@ function setCurrentInjector(injector) {
4858
4867
  }
4859
4868
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4860
4869
  if (_currentInjector === undefined) {
4861
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4862
- `inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
4863
- '';
4864
- throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4870
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4871
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
4865
4872
  }
4866
4873
  else if (_currentInjector === null) {
4867
4874
  return injectRootLimpMode(token, undefined, flags);
@@ -4877,22 +4884,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
4877
4884
  * Throws an error indicating that a factory function could not be generated by the compiler for a
4878
4885
  * particular class.
4879
4886
  *
4880
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
4881
- * off, saving bytes of generated code while still providing a good experience in dev mode.
4882
- *
4883
4887
  * The name of the class is not mentioned here, but will be in the generated factory function name
4884
4888
  * and thus in the stack trace.
4885
4889
  *
4886
4890
  * @codeGenApi
4887
4891
  */
4888
4892
  function ɵɵinvalidFactoryDep(index) {
4889
- const msg = ngDevMode ?
4893
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4890
4894
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4891
4895
  This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
4892
4896
 
4893
- Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.` :
4894
- 'invalid';
4895
- throw new Error(msg);
4897
+ Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
4896
4898
  }
4897
4899
  /**
4898
4900
  * Injects a token from the currently active injector.
@@ -4967,10 +4969,7 @@ function injectArgs(types) {
4967
4969
  const arg = resolveForwardRef(types[i]);
4968
4970
  if (Array.isArray(arg)) {
4969
4971
  if (arg.length === 0) {
4970
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4971
- 'Arguments array must have arguments.' :
4972
- '';
4973
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
4972
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4974
4973
  }
4975
4974
  let type = undefined;
4976
4975
  let flags = InjectFlags.Default;
@@ -5159,7 +5158,7 @@ function reflectDependency(dep) {
5159
5158
  }
5160
5159
  else if (param instanceof Attribute) {
5161
5160
  if (param.attributeName === undefined) {
5162
- throw new Error(`Attribute name must be defined.`);
5161
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5163
5162
  }
5164
5163
  meta.attribute = param.attributeName;
5165
5164
  }
@@ -6215,10 +6214,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6215
6214
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
6216
6215
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6217
6216
  }
6218
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6219
- 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6220
- '';
6221
- throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6217
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
6218
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6222
6219
  }
6223
6220
  /**
6224
6221
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6240,10 +6237,7 @@ function ɵɵsanitizeScript(unsafeScript) {
6240
6237
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
6241
6238
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6242
6239
  }
6243
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6244
- 'unsafe value used in a script context' :
6245
- '';
6246
- throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6240
+ throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
6247
6241
  }
6248
6242
  /**
6249
6243
  * A template tag function for promoting the associated constant literal to a
@@ -9828,7 +9822,7 @@ class ReflectiveKey {
9828
9822
  this.token = token;
9829
9823
  this.id = id;
9830
9824
  if (!token) {
9831
- throw new Error('Token must be defined!');
9825
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
9832
9826
  }
9833
9827
  this.displayName = stringify(this.token);
9834
9828
  }
@@ -13898,6 +13892,7 @@ const NULL_INJECTOR = {
13898
13892
  function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13899
13893
  ngDevMode && publishDefaultGlobalUtils$1();
13900
13894
  ngDevMode && assertComponentType(componentType);
13895
+ enableRenderer3();
13901
13896
  const rendererFactory = opts.rendererFactory || domRendererFactory3;
13902
13897
  const sanitizer = opts.sanitizer || null;
13903
13898
  const componentDef = getComponentDef(componentType);
@@ -14085,10 +14080,8 @@ function ɵɵInheritDefinitionFeature(definition) {
14085
14080
  }
14086
14081
  else {
14087
14082
  if (superType.ɵcmp) {
14088
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
14089
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}` :
14090
- '';
14091
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, errorMessage);
14083
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14084
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14092
14085
  }
14093
14086
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14094
14087
  superDef = superType.ɵdir;
@@ -19209,7 +19202,7 @@ function findLocaleData(locale) {
19209
19202
  if (parentLocale === 'en') {
19210
19203
  return localeEn;
19211
19204
  }
19212
- throw new Error(`Missing locale data for the locale "${locale}".`);
19205
+ throw new RuntimeError(701 /* RuntimeErrorCode.MISSING_LOCALE_DATA */, ngDevMode && `Missing locale data for the locale "${locale}".`);
19213
19206
  }
19214
19207
  /**
19215
19208
  * Retrieves the default currency code for the given locale.
@@ -21785,7 +21778,7 @@ class Version {
21785
21778
  /**
21786
21779
  * @publicApi
21787
21780
  */
21788
- const VERSION = new Version('14.0.1');
21781
+ const VERSION = new Version('14.0.4');
21789
21782
 
21790
21783
  /**
21791
21784
  * @license
@@ -22123,8 +22116,7 @@ class ViewRef$1 {
22123
22116
  }
22124
22117
  attachToViewContainerRef() {
22125
22118
  if (this._appRef) {
22126
- const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
22127
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22119
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
22128
22120
  }
22129
22121
  this._attachedToViewContainer = true;
22130
22122
  }
@@ -22134,8 +22126,7 @@ class ViewRef$1 {
22134
22126
  }
22135
22127
  attachToAppRef(appRef) {
22136
22128
  if (this._attachedToViewContainer) {
22137
- const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
22138
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22129
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
22139
22130
  }
22140
22131
  this._appRef = appRef;
22141
22132
  }
@@ -24825,6 +24816,7 @@ function setScopeOnDeclaredComponents(moduleType, ngModule) {
24825
24816
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
24826
24817
  const transitiveScopes = transitiveScopesFor(moduleType);
24827
24818
  declarations.forEach(declaration => {
24819
+ declaration = resolveForwardRef(declaration);
24828
24820
  if (declaration.hasOwnProperty(NG_COMP_DEF)) {
24829
24821
  // A `ɵcmp` field exists - go ahead and patch the component directly.
24830
24822
  const component = declaration;
@@ -25176,14 +25168,20 @@ function getStandaloneDefFunctions(type, imports) {
25176
25168
  // Standalone components are always able to self-reference, so include the component's own
25177
25169
  // definition in its `directiveDefs`.
25178
25170
  cachedDirectiveDefs = [getComponentDef(type)];
25171
+ const seen = new Set();
25179
25172
  for (const rawDep of imports) {
25180
25173
  ngDevMode && verifyStandaloneImport(rawDep, type);
25181
25174
  const dep = resolveForwardRef(rawDep);
25175
+ if (seen.has(dep)) {
25176
+ continue;
25177
+ }
25178
+ seen.add(dep);
25182
25179
  if (!!getNgModuleDef(dep)) {
25183
25180
  const scope = transitiveScopesFor(dep);
25184
25181
  for (const dir of scope.exported.directives) {
25185
25182
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25186
- if (def) {
25183
+ if (def && !seen.has(dir)) {
25184
+ seen.add(dir);
25187
25185
  cachedDirectiveDefs.push(def);
25188
25186
  }
25189
25187
  }
@@ -25201,11 +25199,22 @@ function getStandaloneDefFunctions(type, imports) {
25201
25199
  const pipeDefs = () => {
25202
25200
  if (cachedPipeDefs === null) {
25203
25201
  cachedPipeDefs = [];
25202
+ const seen = new Set();
25204
25203
  for (const rawDep of imports) {
25205
25204
  const dep = resolveForwardRef(rawDep);
25205
+ if (seen.has(dep)) {
25206
+ continue;
25207
+ }
25208
+ seen.add(dep);
25206
25209
  if (!!getNgModuleDef(dep)) {
25207
25210
  const scope = transitiveScopesFor(dep);
25208
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
25211
+ for (const pipe of scope.exported.pipes) {
25212
+ const def = getPipeDef$1(pipe);
25213
+ if (def && !seen.has(pipe)) {
25214
+ seen.add(pipe);
25215
+ cachedPipeDefs.push(def);
25216
+ }
25217
+ }
25209
25218
  }
25210
25219
  else {
25211
25220
  const def = getPipeDef$1(dep);
@@ -26317,7 +26326,7 @@ class NgZone {
26317
26326
  */
26318
26327
  this.onError = new EventEmitter(false);
26319
26328
  if (typeof Zone == 'undefined') {
26320
- throw new Error(`In this configuration Angular requires Zone.js`);
26329
+ throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);
26321
26330
  }
26322
26331
  Zone.assertZonePatched();
26323
26332
  const self = this;
@@ -26344,12 +26353,12 @@ class NgZone {
26344
26353
  }
26345
26354
  static assertInAngularZone() {
26346
26355
  if (!NgZone.isInAngularZone()) {
26347
- throw new Error('Expected to be in Angular Zone, but it is not!');
26356
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
26348
26357
  }
26349
26358
  }
26350
26359
  static assertNotInAngularZone() {
26351
26360
  if (NgZone.isInAngularZone()) {
26352
- throw new Error('Expected to not be in Angular Zone, but it is!');
26361
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
26353
26362
  }
26354
26363
  }
26355
26364
  /**
@@ -26913,7 +26922,7 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26913
26922
  * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
26914
26923
  * entire class tree-shakeable.
26915
26924
  */
26916
- const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
26925
+ const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
26917
26926
  const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
26918
26927
  function compileNgModuleFactory(injector, options, moduleType) {
26919
26928
  ngDevMode && assertNgModuleType(moduleType);
@@ -26978,10 +26987,8 @@ class NgProbeToken {
26978
26987
  */
26979
26988
  function createPlatform(injector) {
26980
26989
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26981
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26982
- 'There can be only one platform. Destroy the previous one to create a new one.' :
26983
- '';
26984
- throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, errorMessage);
26990
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26991
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26985
26992
  }
26986
26993
  publishDefaultGlobalUtils();
26987
26994
  _platformInjector = injector;
@@ -27054,7 +27061,15 @@ function internalBootstrapApplication(config) {
27054
27061
  const localeId = appInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
27055
27062
  setLocaleId(localeId || DEFAULT_LOCALE_ID);
27056
27063
  const appRef = appInjector.get(ApplicationRef);
27057
- appRef.onDestroy(() => onErrorSubscription.unsubscribe());
27064
+ // If the whole platform is destroyed, invoke the `destroy` method
27065
+ // for all bootstrapped applications as well.
27066
+ const destroyListener = () => appRef.destroy();
27067
+ const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS, null);
27068
+ onPlatformDestroyListeners?.add(destroyListener);
27069
+ appRef.onDestroy(() => {
27070
+ onPlatformDestroyListeners?.delete(destroyListener);
27071
+ onErrorSubscription.unsubscribe();
27072
+ });
27058
27073
  appRef.bootstrap(rootComponent);
27059
27074
  return appRef;
27060
27075
  });
@@ -27101,8 +27116,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27101
27116
  function assertPlatform(requiredToken) {
27102
27117
  const platform = getPlatform();
27103
27118
  if (!platform) {
27104
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27105
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
27119
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27106
27120
  }
27107
27121
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27108
27122
  !platform.injector.get(requiredToken, null)) {
@@ -27119,7 +27133,7 @@ function createPlatformInjector(providers = [], name) {
27119
27133
  name,
27120
27134
  providers: [
27121
27135
  { provide: INJECTOR_SCOPE, useValue: 'platform' },
27122
- { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
27136
+ { provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => _platformInjector = null]) },
27123
27137
  ...providers
27124
27138
  ],
27125
27139
  });
@@ -27180,10 +27194,7 @@ class PlatformRef {
27180
27194
  const moduleRef = moduleFactory.create(ngZoneInjector);
27181
27195
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27182
27196
  if (!exceptionHandler) {
27183
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27184
- 'No ErrorHandler. Is platform module (BrowserModule) included?' :
27185
- '';
27186
- throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, errorMessage);
27197
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27187
27198
  }
27188
27199
  ngZone.runOutsideAngular(() => {
27189
27200
  const subscription = ngZone.onError.subscribe({
@@ -27239,12 +27250,10 @@ class PlatformRef {
27239
27250
  moduleRef.instance.ngDoBootstrap(appRef);
27240
27251
  }
27241
27252
  else {
27242
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27253
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27243
27254
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27244
27255
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
27245
- `Please define one of these.` :
27246
- '';
27247
- throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
27256
+ `Please define one of these.`);
27248
27257
  }
27249
27258
  this._modules.push(moduleRef);
27250
27259
  }
@@ -27267,15 +27276,15 @@ class PlatformRef {
27267
27276
  */
27268
27277
  destroy() {
27269
27278
  if (this._destroyed) {
27270
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27271
- 'The platform has already been destroyed!' :
27272
- '';
27273
- throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, errorMessage);
27279
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27274
27280
  }
27275
27281
  this._modules.slice().forEach(module => module.destroy());
27276
27282
  this._destroyListeners.forEach(listener => listener());
27277
- const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
27278
- destroyListener?.();
27283
+ const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
27284
+ if (destroyListeners) {
27285
+ destroyListeners.forEach(listener => listener());
27286
+ destroyListeners.clear();
27287
+ }
27279
27288
  this._destroyed = true;
27280
27289
  }
27281
27290
  /**
@@ -27433,11 +27442,10 @@ function optionsReducer(dst, objs) {
27433
27442
  */
27434
27443
  class ApplicationRef {
27435
27444
  /** @internal */
27436
- constructor(_zone, _injector, _exceptionHandler, _initStatus) {
27445
+ constructor(_zone, _injector, _exceptionHandler) {
27437
27446
  this._zone = _zone;
27438
27447
  this._injector = _injector;
27439
27448
  this._exceptionHandler = _exceptionHandler;
27440
- this._initStatus = _initStatus;
27441
27449
  /** @internal */
27442
27450
  this._bootstrapListeners = [];
27443
27451
  this._views = [];
@@ -27554,7 +27562,8 @@ class ApplicationRef {
27554
27562
  bootstrap(componentOrFactory, rootSelectorOrNode) {
27555
27563
  NG_DEV_MODE && this.warnIfDestroyed();
27556
27564
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
27557
- if (!this._initStatus.done) {
27565
+ const initStatus = this._injector.get(ApplicationInitStatus);
27566
+ if (!initStatus.done) {
27558
27567
  const standalone = !isComponentFactory && isStandalone(componentOrFactory);
27559
27568
  const errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' +
27560
27569
  (standalone ? '' :
@@ -27602,10 +27611,7 @@ class ApplicationRef {
27602
27611
  tick() {
27603
27612
  NG_DEV_MODE && this.warnIfDestroyed();
27604
27613
  if (this._runningTick) {
27605
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27606
- 'ApplicationRef.tick is called recursively' :
27607
- '';
27608
- throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
27614
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27609
27615
  }
27610
27616
  try {
27611
27617
  this._runningTick = true;
@@ -27694,7 +27700,7 @@ class ApplicationRef {
27694
27700
  */
27695
27701
  destroy() {
27696
27702
  if (this._destroyed) {
27697
- throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, NG_DEV_MODE && 'This instance of the `ApplicationRef` has already been destroyed.');
27703
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27698
27704
  }
27699
27705
  const injector = this._injector;
27700
27706
  // Check that this injector instance supports destroy operation.
@@ -27716,12 +27722,12 @@ class ApplicationRef {
27716
27722
  }
27717
27723
  }
27718
27724
  }
27719
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
27725
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler)); };
27720
27726
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
27721
27727
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
27722
27728
  type: Injectable,
27723
27729
  args: [{ providedIn: 'root' }]
27724
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null); })();
27730
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }]; }, null); })();
27725
27731
  function remove(list, el) {
27726
27732
  const index = list.indexOf(el);
27727
27733
  if (index > -1) {
@@ -28731,10 +28737,8 @@ class DefaultIterableDiffer {
28731
28737
  if (collection == null)
28732
28738
  collection = [];
28733
28739
  if (!isListLikeIterable(collection)) {
28734
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28735
- `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
28736
- '';
28737
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
28740
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28741
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28738
28742
  }
28739
28743
  if (this.check(collection)) {
28740
28744
  return this;
@@ -29335,10 +29339,8 @@ class DefaultKeyValueDiffer {
29335
29339
  map = new Map();
29336
29340
  }
29337
29341
  else if (!(map instanceof Map || isJsObject(map))) {
29338
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29339
- `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
29340
- '';
29341
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
29342
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29343
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29342
29344
  }
29343
29345
  return this.check(map) ? this : null;
29344
29346
  }
@@ -29585,10 +29587,8 @@ class IterableDiffers {
29585
29587
  return factory;
29586
29588
  }
29587
29589
  else {
29588
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29589
- `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
29590
- '';
29591
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29590
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29591
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29592
29592
  }
29593
29593
  }
29594
29594
  }
@@ -29662,10 +29662,7 @@ class KeyValueDiffers {
29662
29662
  if (factory) {
29663
29663
  return factory;
29664
29664
  }
29665
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29666
- `Cannot find a differ supporting object '${kv}'` :
29667
- '';
29668
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29665
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29669
29666
  }
29670
29667
  }
29671
29668
  /** @nocollapse */