@angular/core 14.1.0-next.0 → 14.1.0-next.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/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/ng_module_ref.mjs +10 -2
  17. package/esm2020/src/render3/view_ref.mjs +3 -5
  18. package/esm2020/src/sanitization/sanitization.mjs +4 -9
  19. package/esm2020/src/version.mjs +1 -1
  20. package/esm2020/src/zone/ng_zone.mjs +5 -4
  21. package/esm2020/testing/src/logger.mjs +3 -3
  22. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  23. package/esm2020/testing/src/r3_test_bed_compiler.mjs +30 -25
  24. package/fesm2015/core.mjs +96 -91
  25. package/fesm2015/core.mjs.map +1 -1
  26. package/fesm2015/testing.mjs +131 -126
  27. package/fesm2015/testing.mjs.map +1 -1
  28. package/fesm2020/core.mjs +96 -91
  29. package/fesm2020/core.mjs.map +1 -1
  30. package/fesm2020/testing.mjs +131 -126
  31. package/fesm2020/testing.mjs.map +1 -1
  32. package/index.d.ts +15 -7
  33. package/package.json +1 -1
  34. package/testing/index.d.ts +1 -1
  35. package/schematics/utils/schematics_prompt.d.ts +0 -17
  36. package/schematics/utils/schematics_prompt.js +0 -45
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.0
2
+ * @license Angular v14.1.0-next.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1658,8 +1658,17 @@ var RendererStyleFlags3;
1658
1658
  function isProceduralRenderer(renderer) {
1659
1659
  return !!(renderer.listen);
1660
1660
  }
1661
+ let renderer3Enabled = false;
1662
+ function enableRenderer3() {
1663
+ renderer3Enabled = true;
1664
+ }
1661
1665
  const domRendererFactory3 = {
1662
1666
  createRenderer: (hostElement, rendererType) => {
1667
+ if (!renderer3Enabled) {
1668
+ throw new Error(ngDevMode ?
1669
+ `Renderer3 is not supported. This problem is likely caused by some component in the hierarchy was constructed without a correct parent injector.` :
1670
+ 'Renderer3 disabled');
1671
+ }
1663
1672
  return getDocument();
1664
1673
  }
1665
1674
  };
@@ -4837,10 +4846,8 @@ function setCurrentInjector(injector) {
4837
4846
  }
4838
4847
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4839
4848
  if (_currentInjector === undefined) {
4840
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4841
- `inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
4842
- '';
4843
- throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4849
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4850
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
4844
4851
  }
4845
4852
  else if (_currentInjector === null) {
4846
4853
  return injectRootLimpMode(token, undefined, flags);
@@ -4856,22 +4863,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
4856
4863
  * Throws an error indicating that a factory function could not be generated by the compiler for a
4857
4864
  * particular class.
4858
4865
  *
4859
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
4860
- * off, saving bytes of generated code while still providing a good experience in dev mode.
4861
- *
4862
4866
  * The name of the class is not mentioned here, but will be in the generated factory function name
4863
4867
  * and thus in the stack trace.
4864
4868
  *
4865
4869
  * @codeGenApi
4866
4870
  */
4867
4871
  function ɵɵinvalidFactoryDep(index) {
4868
- const msg = ngDevMode ?
4872
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4869
4873
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4870
4874
  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.
4871
4875
 
4872
- 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.` :
4873
- 'invalid';
4874
- throw new Error(msg);
4876
+ 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.`);
4875
4877
  }
4876
4878
  /**
4877
4879
  * Injects a token from the currently active injector.
@@ -4946,10 +4948,7 @@ function injectArgs(types) {
4946
4948
  const arg = resolveForwardRef(types[i]);
4947
4949
  if (Array.isArray(arg)) {
4948
4950
  if (arg.length === 0) {
4949
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4950
- 'Arguments array must have arguments.' :
4951
- '';
4952
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
4951
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4953
4952
  }
4954
4953
  let type = undefined;
4955
4954
  let flags = InjectFlags.Default;
@@ -5138,7 +5137,7 @@ function reflectDependency(dep) {
5138
5137
  }
5139
5138
  else if (param instanceof Attribute) {
5140
5139
  if (param.attributeName === undefined) {
5141
- throw new Error(`Attribute name must be defined.`);
5140
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5142
5141
  }
5143
5142
  meta.attribute = param.attributeName;
5144
5143
  }
@@ -6200,10 +6199,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6200
6199
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
6201
6200
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6202
6201
  }
6203
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6204
- 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6205
- '';
6206
- throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6202
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
6203
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6207
6204
  }
6208
6205
  /**
6209
6206
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6225,10 +6222,7 @@ function ɵɵsanitizeScript(unsafeScript) {
6225
6222
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
6226
6223
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6227
6224
  }
6228
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6229
- 'unsafe value used in a script context' :
6230
- '';
6231
- throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6225
+ throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
6232
6226
  }
6233
6227
  /**
6234
6228
  * A template tag function for promoting the associated constant literal to a
@@ -9814,7 +9808,7 @@ class ReflectiveKey {
9814
9808
  this.token = token;
9815
9809
  this.id = id;
9816
9810
  if (!token) {
9817
- throw new Error('Token must be defined!');
9811
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
9818
9812
  }
9819
9813
  this.displayName = stringify(this.token);
9820
9814
  }
@@ -13885,6 +13879,7 @@ const NULL_INJECTOR = {
13885
13879
  function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13886
13880
  ngDevMode && publishDefaultGlobalUtils$1();
13887
13881
  ngDevMode && assertComponentType(componentType);
13882
+ enableRenderer3();
13888
13883
  const rendererFactory = opts.rendererFactory || domRendererFactory3;
13889
13884
  const sanitizer = opts.sanitizer || null;
13890
13885
  const componentDef = getComponentDef(componentType);
@@ -14072,10 +14067,8 @@ function ɵɵInheritDefinitionFeature(definition) {
14072
14067
  }
14073
14068
  else {
14074
14069
  if (superType.ɵcmp) {
14075
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
14076
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}` :
14077
- '';
14078
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, errorMessage);
14070
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14071
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14079
14072
  }
14080
14073
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14081
14074
  superDef = superType.ɵdir;
@@ -19196,7 +19189,7 @@ function findLocaleData(locale) {
19196
19189
  if (parentLocale === 'en') {
19197
19190
  return localeEn;
19198
19191
  }
19199
- throw new Error(`Missing locale data for the locale "${locale}".`);
19192
+ throw new RuntimeError(701 /* RuntimeErrorCode.MISSING_LOCALE_DATA */, ngDevMode && `Missing locale data for the locale "${locale}".`);
19200
19193
  }
19201
19194
  /**
19202
19195
  * Retrieves the default currency code for the given locale.
@@ -21772,7 +21765,7 @@ class Version {
21772
21765
  /**
21773
21766
  * @publicApi
21774
21767
  */
21775
- const VERSION = new Version('14.1.0-next.0');
21768
+ const VERSION = new Version('14.1.0-next.3');
21776
21769
 
21777
21770
  /**
21778
21771
  * @license
@@ -22110,8 +22103,7 @@ class ViewRef$1 {
22110
22103
  }
22111
22104
  attachToViewContainerRef() {
22112
22105
  if (this._appRef) {
22113
- const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
22114
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22106
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
22115
22107
  }
22116
22108
  this._attachedToViewContainer = true;
22117
22109
  }
@@ -22121,8 +22113,7 @@ class ViewRef$1 {
22121
22113
  }
22122
22114
  attachToAppRef(appRef) {
22123
22115
  if (this._attachedToViewContainer) {
22124
- const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
22125
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22116
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
22126
22117
  }
22127
22118
  this._appRef = appRef;
22128
22119
  }
@@ -22443,10 +22434,18 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22443
22434
  /**
22444
22435
  * Create a new environment injector.
22445
22436
  *
22437
+ * Learn more about environment injectors in
22438
+ * [this guide](guide/standalone-components#environment-injectors).
22439
+ *
22440
+ * @param providers An array of providers.
22441
+ * @param parent A parent environment injector.
22442
+ * @param debugName An optional name for this injector instance, which will be used in error
22443
+ * messages.
22444
+ *
22446
22445
  * @publicApi
22447
22446
  * @developerPreview
22448
22447
  */
22449
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22448
+ function createEnvironmentInjector(providers, parent, debugName = null) {
22450
22449
  const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22451
22450
  return adapter.injector;
22452
22451
  }
@@ -24813,6 +24812,7 @@ function setScopeOnDeclaredComponents(moduleType, ngModule) {
24813
24812
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
24814
24813
  const transitiveScopes = transitiveScopesFor(moduleType);
24815
24814
  declarations.forEach(declaration => {
24815
+ declaration = resolveForwardRef(declaration);
24816
24816
  if (declaration.hasOwnProperty(NG_COMP_DEF)) {
24817
24817
  // A `ɵcmp` field exists - go ahead and patch the component directly.
24818
24818
  const component = declaration;
@@ -25152,14 +25152,20 @@ function getStandaloneDefFunctions(type, imports) {
25152
25152
  // Standalone components are always able to self-reference, so include the component's own
25153
25153
  // definition in its `directiveDefs`.
25154
25154
  cachedDirectiveDefs = [getComponentDef(type)];
25155
+ const seen = new Set();
25155
25156
  for (const rawDep of imports) {
25156
25157
  ngDevMode && verifyStandaloneImport(rawDep, type);
25157
25158
  const dep = resolveForwardRef(rawDep);
25159
+ if (seen.has(dep)) {
25160
+ continue;
25161
+ }
25162
+ seen.add(dep);
25158
25163
  if (!!getNgModuleDef(dep)) {
25159
25164
  const scope = transitiveScopesFor(dep);
25160
25165
  for (const dir of scope.exported.directives) {
25161
25166
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25162
- if (def) {
25167
+ if (def && !seen.has(dir)) {
25168
+ seen.add(dir);
25163
25169
  cachedDirectiveDefs.push(def);
25164
25170
  }
25165
25171
  }
@@ -25177,11 +25183,22 @@ function getStandaloneDefFunctions(type, imports) {
25177
25183
  const pipeDefs = () => {
25178
25184
  if (cachedPipeDefs === null) {
25179
25185
  cachedPipeDefs = [];
25186
+ const seen = new Set();
25180
25187
  for (const rawDep of imports) {
25181
25188
  const dep = resolveForwardRef(rawDep);
25189
+ if (seen.has(dep)) {
25190
+ continue;
25191
+ }
25192
+ seen.add(dep);
25182
25193
  if (!!getNgModuleDef(dep)) {
25183
25194
  const scope = transitiveScopesFor(dep);
25184
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
25195
+ for (const pipe of scope.exported.pipes) {
25196
+ const def = getPipeDef$1(pipe);
25197
+ if (def && !seen.has(pipe)) {
25198
+ seen.add(pipe);
25199
+ cachedPipeDefs.push(def);
25200
+ }
25201
+ }
25185
25202
  }
25186
25203
  else {
25187
25204
  const def = getPipeDef$1(dep);
@@ -26293,7 +26310,7 @@ class NgZone {
26293
26310
  */
26294
26311
  this.onError = new EventEmitter(false);
26295
26312
  if (typeof Zone == 'undefined') {
26296
- throw new Error(`In this configuration Angular requires Zone.js`);
26313
+ throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);
26297
26314
  }
26298
26315
  Zone.assertZonePatched();
26299
26316
  const self = this;
@@ -26320,12 +26337,12 @@ class NgZone {
26320
26337
  }
26321
26338
  static assertInAngularZone() {
26322
26339
  if (!NgZone.isInAngularZone()) {
26323
- throw new Error('Expected to be in Angular Zone, but it is not!');
26340
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
26324
26341
  }
26325
26342
  }
26326
26343
  static assertNotInAngularZone() {
26327
26344
  if (NgZone.isInAngularZone()) {
26328
- throw new Error('Expected to not be in Angular Zone, but it is!');
26345
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
26329
26346
  }
26330
26347
  }
26331
26348
  /**
@@ -26896,7 +26913,7 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26896
26913
  * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
26897
26914
  * entire class tree-shakeable.
26898
26915
  */
26899
- const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
26916
+ const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
26900
26917
  const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
26901
26918
  function compileNgModuleFactory(injector, options, moduleType) {
26902
26919
  ngDevMode && assertNgModuleType(moduleType);
@@ -26961,10 +26978,8 @@ class NgProbeToken {
26961
26978
  */
26962
26979
  function createPlatform(injector) {
26963
26980
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26964
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26965
- 'There can be only one platform. Destroy the previous one to create a new one.' :
26966
- '';
26967
- throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, errorMessage);
26981
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26982
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26968
26983
  }
26969
26984
  publishDefaultGlobalUtils();
26970
26985
  _platformInjector = injector;
@@ -27037,7 +27052,15 @@ function internalBootstrapApplication(config) {
27037
27052
  const localeId = appInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
27038
27053
  setLocaleId(localeId || DEFAULT_LOCALE_ID);
27039
27054
  const appRef = appInjector.get(ApplicationRef);
27040
- appRef.onDestroy(() => onErrorSubscription.unsubscribe());
27055
+ // If the whole platform is destroyed, invoke the `destroy` method
27056
+ // for all bootstrapped applications as well.
27057
+ const destroyListener = () => appRef.destroy();
27058
+ const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS, null);
27059
+ onPlatformDestroyListeners === null || onPlatformDestroyListeners === void 0 ? void 0 : onPlatformDestroyListeners.add(destroyListener);
27060
+ appRef.onDestroy(() => {
27061
+ onPlatformDestroyListeners === null || onPlatformDestroyListeners === void 0 ? void 0 : onPlatformDestroyListeners.delete(destroyListener);
27062
+ onErrorSubscription.unsubscribe();
27063
+ });
27041
27064
  appRef.bootstrap(rootComponent);
27042
27065
  return appRef;
27043
27066
  });
@@ -27084,8 +27107,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27084
27107
  function assertPlatform(requiredToken) {
27085
27108
  const platform = getPlatform();
27086
27109
  if (!platform) {
27087
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27088
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
27110
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27089
27111
  }
27090
27112
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27091
27113
  !platform.injector.get(requiredToken, null)) {
@@ -27102,7 +27124,7 @@ function createPlatformInjector(providers = [], name) {
27102
27124
  name,
27103
27125
  providers: [
27104
27126
  { provide: INJECTOR_SCOPE, useValue: 'platform' },
27105
- { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
27127
+ { provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => _platformInjector = null]) },
27106
27128
  ...providers
27107
27129
  ],
27108
27130
  });
@@ -27165,10 +27187,7 @@ class PlatformRef {
27165
27187
  const moduleRef = moduleFactory.create(ngZoneInjector);
27166
27188
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27167
27189
  if (!exceptionHandler) {
27168
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27169
- 'No ErrorHandler. Is platform module (BrowserModule) included?' :
27170
- '';
27171
- throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, errorMessage);
27190
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27172
27191
  }
27173
27192
  ngZone.runOutsideAngular(() => {
27174
27193
  const subscription = ngZone.onError.subscribe({
@@ -27224,12 +27243,10 @@ class PlatformRef {
27224
27243
  moduleRef.instance.ngDoBootstrap(appRef);
27225
27244
  }
27226
27245
  else {
27227
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27246
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27228
27247
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27229
27248
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
27230
- `Please define one of these.` :
27231
- '';
27232
- throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
27249
+ `Please define one of these.`);
27233
27250
  }
27234
27251
  this._modules.push(moduleRef);
27235
27252
  }
@@ -27252,15 +27269,15 @@ class PlatformRef {
27252
27269
  */
27253
27270
  destroy() {
27254
27271
  if (this._destroyed) {
27255
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27256
- 'The platform has already been destroyed!' :
27257
- '';
27258
- throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, errorMessage);
27272
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27259
27273
  }
27260
27274
  this._modules.slice().forEach(module => module.destroy());
27261
27275
  this._destroyListeners.forEach(listener => listener());
27262
- const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
27263
- destroyListener === null || destroyListener === void 0 ? void 0 : destroyListener();
27276
+ const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
27277
+ if (destroyListeners) {
27278
+ destroyListeners.forEach(listener => listener());
27279
+ destroyListeners.clear();
27280
+ }
27264
27281
  this._destroyed = true;
27265
27282
  }
27266
27283
  /**
@@ -27420,11 +27437,10 @@ function optionsReducer(dst, objs) {
27420
27437
  */
27421
27438
  class ApplicationRef {
27422
27439
  /** @internal */
27423
- constructor(_zone, _injector, _exceptionHandler, _initStatus) {
27440
+ constructor(_zone, _injector, _exceptionHandler) {
27424
27441
  this._zone = _zone;
27425
27442
  this._injector = _injector;
27426
27443
  this._exceptionHandler = _exceptionHandler;
27427
- this._initStatus = _initStatus;
27428
27444
  /** @internal */
27429
27445
  this._bootstrapListeners = [];
27430
27446
  this._views = [];
@@ -27541,7 +27557,8 @@ class ApplicationRef {
27541
27557
  bootstrap(componentOrFactory, rootSelectorOrNode) {
27542
27558
  NG_DEV_MODE && this.warnIfDestroyed();
27543
27559
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
27544
- if (!this._initStatus.done) {
27560
+ const initStatus = this._injector.get(ApplicationInitStatus);
27561
+ if (!initStatus.done) {
27545
27562
  const standalone = !isComponentFactory && isStandalone(componentOrFactory);
27546
27563
  const errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' +
27547
27564
  (standalone ? '' :
@@ -27589,10 +27606,7 @@ class ApplicationRef {
27589
27606
  tick() {
27590
27607
  NG_DEV_MODE && this.warnIfDestroyed();
27591
27608
  if (this._runningTick) {
27592
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27593
- 'ApplicationRef.tick is called recursively' :
27594
- '';
27595
- throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
27609
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27596
27610
  }
27597
27611
  try {
27598
27612
  this._runningTick = true;
@@ -27681,7 +27695,7 @@ class ApplicationRef {
27681
27695
  */
27682
27696
  destroy() {
27683
27697
  if (this._destroyed) {
27684
- throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, NG_DEV_MODE && 'This instance of the `ApplicationRef` has already been destroyed.');
27698
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27685
27699
  }
27686
27700
  const injector = this._injector;
27687
27701
  // Check that this injector instance supports destroy operation.
@@ -27703,13 +27717,13 @@ class ApplicationRef {
27703
27717
  }
27704
27718
  }
27705
27719
  }
27706
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
27720
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler)); };
27707
27721
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
27708
27722
  (function () {
27709
27723
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
27710
27724
  type: Injectable,
27711
27725
  args: [{ providedIn: 'root' }]
27712
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null);
27726
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }]; }, null);
27713
27727
  })();
27714
27728
  function remove(list, el) {
27715
27729
  const index = list.indexOf(el);
@@ -28720,10 +28734,8 @@ class DefaultIterableDiffer {
28720
28734
  if (collection == null)
28721
28735
  collection = [];
28722
28736
  if (!isListLikeIterable(collection)) {
28723
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28724
- `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
28725
- '';
28726
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
28737
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28738
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28727
28739
  }
28728
28740
  if (this.check(collection)) {
28729
28741
  return this;
@@ -29324,10 +29336,8 @@ class DefaultKeyValueDiffer {
29324
29336
  map = new Map();
29325
29337
  }
29326
29338
  else if (!(map instanceof Map || isJsObject(map))) {
29327
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29328
- `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
29329
- '';
29330
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
29339
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29340
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29331
29341
  }
29332
29342
  return this.check(map) ? this : null;
29333
29343
  }
@@ -29574,10 +29584,8 @@ class IterableDiffers {
29574
29584
  return factory;
29575
29585
  }
29576
29586
  else {
29577
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29578
- `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
29579
- '';
29580
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29587
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29588
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29581
29589
  }
29582
29590
  }
29583
29591
  }
@@ -29651,10 +29659,7 @@ class KeyValueDiffers {
29651
29659
  if (factory) {
29652
29660
  return factory;
29653
29661
  }
29654
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29655
- `Cannot find a differ supporting object '${kv}'` :
29656
- '';
29657
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29662
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29658
29663
  }
29659
29664
  }
29660
29665
  /** @nocollapse */