@angular/core 14.1.0-next.2 → 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.
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.2
2
+ * @license Angular v14.1.0-next.3
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
  };
@@ -4875,22 +4884,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
4875
4884
  * Throws an error indicating that a factory function could not be generated by the compiler for a
4876
4885
  * particular class.
4877
4886
  *
4878
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
4879
- * off, saving bytes of generated code while still providing a good experience in dev mode.
4880
- *
4881
4887
  * The name of the class is not mentioned here, but will be in the generated factory function name
4882
4888
  * and thus in the stack trace.
4883
4889
  *
4884
4890
  * @codeGenApi
4885
4891
  */
4886
4892
  function ɵɵinvalidFactoryDep(index) {
4887
- const msg = ngDevMode ?
4893
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4888
4894
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4889
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.
4890
4896
 
4891
- 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.` :
4892
- 'invalid';
4893
- 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.`);
4894
4898
  }
4895
4899
  /**
4896
4900
  * Injects a token from the currently active injector.
@@ -5154,7 +5158,7 @@ function reflectDependency(dep) {
5154
5158
  }
5155
5159
  else if (param instanceof Attribute) {
5156
5160
  if (param.attributeName === undefined) {
5157
- throw new Error(`Attribute name must be defined.`);
5161
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5158
5162
  }
5159
5163
  meta.attribute = param.attributeName;
5160
5164
  }
@@ -9818,7 +9822,7 @@ class ReflectiveKey {
9818
9822
  this.token = token;
9819
9823
  this.id = id;
9820
9824
  if (!token) {
9821
- throw new Error('Token must be defined!');
9825
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
9822
9826
  }
9823
9827
  this.displayName = stringify(this.token);
9824
9828
  }
@@ -13888,6 +13892,7 @@ const NULL_INJECTOR = {
13888
13892
  function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13889
13893
  ngDevMode && publishDefaultGlobalUtils$1();
13890
13894
  ngDevMode && assertComponentType(componentType);
13895
+ enableRenderer3();
13891
13896
  const rendererFactory = opts.rendererFactory || domRendererFactory3;
13892
13897
  const sanitizer = opts.sanitizer || null;
13893
13898
  const componentDef = getComponentDef(componentType);
@@ -19197,7 +19202,7 @@ function findLocaleData(locale) {
19197
19202
  if (parentLocale === 'en') {
19198
19203
  return localeEn;
19199
19204
  }
19200
- 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}".`);
19201
19206
  }
19202
19207
  /**
19203
19208
  * Retrieves the default currency code for the given locale.
@@ -21773,7 +21778,7 @@ class Version {
21773
21778
  /**
21774
21779
  * @publicApi
21775
21780
  */
21776
- const VERSION = new Version('14.1.0-next.2');
21781
+ const VERSION = new Version('14.1.0-next.3');
21777
21782
 
21778
21783
  /**
21779
21784
  * @license
@@ -26329,7 +26334,7 @@ class NgZone {
26329
26334
  */
26330
26335
  this.onError = new EventEmitter(false);
26331
26336
  if (typeof Zone == 'undefined') {
26332
- throw new Error(`In this configuration Angular requires Zone.js`);
26337
+ throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);
26333
26338
  }
26334
26339
  Zone.assertZonePatched();
26335
26340
  const self = this;
@@ -26356,12 +26361,12 @@ class NgZone {
26356
26361
  }
26357
26362
  static assertInAngularZone() {
26358
26363
  if (!NgZone.isInAngularZone()) {
26359
- throw new Error('Expected to be in Angular Zone, but it is not!');
26364
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
26360
26365
  }
26361
26366
  }
26362
26367
  static assertNotInAngularZone() {
26363
26368
  if (NgZone.isInAngularZone()) {
26364
- throw new Error('Expected to not be in Angular Zone, but it is!');
26369
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
26365
26370
  }
26366
26371
  }
26367
26372
  /**
@@ -26925,7 +26930,7 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26925
26930
  * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
26926
26931
  * entire class tree-shakeable.
26927
26932
  */
26928
- const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
26933
+ const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
26929
26934
  const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
26930
26935
  function compileNgModuleFactory(injector, options, moduleType) {
26931
26936
  ngDevMode && assertNgModuleType(moduleType);
@@ -27064,7 +27069,15 @@ function internalBootstrapApplication(config) {
27064
27069
  const localeId = appInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
27065
27070
  setLocaleId(localeId || DEFAULT_LOCALE_ID);
27066
27071
  const appRef = appInjector.get(ApplicationRef);
27067
- appRef.onDestroy(() => onErrorSubscription.unsubscribe());
27072
+ // If the whole platform is destroyed, invoke the `destroy` method
27073
+ // for all bootstrapped applications as well.
27074
+ const destroyListener = () => appRef.destroy();
27075
+ const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS, null);
27076
+ onPlatformDestroyListeners?.add(destroyListener);
27077
+ appRef.onDestroy(() => {
27078
+ onPlatformDestroyListeners?.delete(destroyListener);
27079
+ onErrorSubscription.unsubscribe();
27080
+ });
27068
27081
  appRef.bootstrap(rootComponent);
27069
27082
  return appRef;
27070
27083
  });
@@ -27128,7 +27141,7 @@ function createPlatformInjector(providers = [], name) {
27128
27141
  name,
27129
27142
  providers: [
27130
27143
  { provide: INJECTOR_SCOPE, useValue: 'platform' },
27131
- { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
27144
+ { provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => _platformInjector = null]) },
27132
27145
  ...providers
27133
27146
  ],
27134
27147
  });
@@ -27275,8 +27288,11 @@ class PlatformRef {
27275
27288
  }
27276
27289
  this._modules.slice().forEach(module => module.destroy());
27277
27290
  this._destroyListeners.forEach(listener => listener());
27278
- const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
27279
- destroyListener?.();
27291
+ const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
27292
+ if (destroyListeners) {
27293
+ destroyListeners.forEach(listener => listener());
27294
+ destroyListeners.clear();
27295
+ }
27280
27296
  this._destroyed = true;
27281
27297
  }
27282
27298
  /**
@@ -27434,11 +27450,10 @@ function optionsReducer(dst, objs) {
27434
27450
  */
27435
27451
  class ApplicationRef {
27436
27452
  /** @internal */
27437
- constructor(_zone, _injector, _exceptionHandler, _initStatus) {
27453
+ constructor(_zone, _injector, _exceptionHandler) {
27438
27454
  this._zone = _zone;
27439
27455
  this._injector = _injector;
27440
27456
  this._exceptionHandler = _exceptionHandler;
27441
- this._initStatus = _initStatus;
27442
27457
  /** @internal */
27443
27458
  this._bootstrapListeners = [];
27444
27459
  this._views = [];
@@ -27555,7 +27570,8 @@ class ApplicationRef {
27555
27570
  bootstrap(componentOrFactory, rootSelectorOrNode) {
27556
27571
  NG_DEV_MODE && this.warnIfDestroyed();
27557
27572
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
27558
- if (!this._initStatus.done) {
27573
+ const initStatus = this._injector.get(ApplicationInitStatus);
27574
+ if (!initStatus.done) {
27559
27575
  const standalone = !isComponentFactory && isStandalone(componentOrFactory);
27560
27576
  const errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' +
27561
27577
  (standalone ? '' :
@@ -27714,12 +27730,12 @@ class ApplicationRef {
27714
27730
  }
27715
27731
  }
27716
27732
  }
27717
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
27733
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler)); };
27718
27734
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
27719
27735
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
27720
27736
  type: Injectable,
27721
27737
  args: [{ providedIn: 'root' }]
27722
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null); })();
27738
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }]; }, null); })();
27723
27739
  function remove(list, el) {
27724
27740
  const index = list.indexOf(el);
27725
27741
  if (index > -1) {