@angular/core 13.3.3 → 13.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.3.3
2
+ * @license Angular v13.3.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.3.3
2
+ * @license Angular v13.3.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -6733,8 +6733,10 @@ function maybeUnwrapFn(value) {
6733
6733
  * found in the LICENSE file at https://angular.io/license
6734
6734
  */
6735
6735
  /** Called when there are multiple component selectors that match a given node */
6736
- function throwMultipleComponentError(tNode) {
6737
- throw new RuntimeError(-300 /* MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}`);
6736
+ function throwMultipleComponentError(tNode, first, second) {
6737
+ throw new RuntimeError(-300 /* MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}: ` +
6738
+ `${stringifyForError(first)} and ` +
6739
+ `${stringifyForError(second)}`);
6738
6740
  }
6739
6741
  /** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
6740
6742
  function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
@@ -10393,8 +10395,11 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
10393
10395
  if (ngDevMode) {
10394
10396
  assertTNodeType(tNode, 2 /* Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
10395
10397
  `Please use a different tag to activate the ${stringify(def.type)} component.`);
10396
- if (tNode.flags & 2 /* isComponentHost */)
10397
- throwMultipleComponentError(tNode);
10398
+ if (tNode.flags & 2 /* isComponentHost */) {
10399
+ // If another component has been matched previously, it's the first element in the
10400
+ // `matches` array, see how we store components/directives in `matches` below.
10401
+ throwMultipleComponentError(tNode, matches[0].type, def.type);
10402
+ }
10398
10403
  }
10399
10404
  markAsComponentHost(tView, tNode);
10400
10405
  // The component is always stored first with directives after.
@@ -12392,7 +12397,7 @@ function ɵɵInheritDefinitionFeature(definition) {
12392
12397
  else {
12393
12398
  if (superType.ɵcmp) {
12394
12399
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
12395
- 'Directives cannot inherit Components' :
12400
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}` :
12396
12401
  '';
12397
12402
  throw new RuntimeError(903 /* INVALID_INHERITANCE */, errorMessage);
12398
12403
  }
@@ -21137,7 +21142,7 @@ class Version {
21137
21142
  /**
21138
21143
  * @publicApi
21139
21144
  */
21140
- const VERSION = new Version('13.3.3');
21145
+ const VERSION = new Version('13.3.6');
21141
21146
 
21142
21147
  /**
21143
21148
  * @license
@@ -25951,7 +25956,19 @@ let _testabilityGetter = new _NoopGetTestability();
25951
25956
  * Use of this source code is governed by an MIT-style license that can be
25952
25957
  * found in the LICENSE file at https://angular.io/license
25953
25958
  */
25954
- let _platform;
25959
+ let _platformInjector = null;
25960
+ /**
25961
+ * Internal token to indicate whether having multiple bootstrapped platform should be allowed (only
25962
+ * one bootstrapped platform is allowed by default). This token helps to support SSR scenarios.
25963
+ */
25964
+ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
25965
+ /**
25966
+ * Internal token that allows to register extra callbacks that should be invoked during the
25967
+ * `PlatformRef.destroy` operation. This token is needed to avoid a direct reference to the
25968
+ * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
25969
+ * entire class tree-shakeable.
25970
+ */
25971
+ const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
25955
25972
  function compileNgModuleFactory(injector, options, moduleType) {
25956
25973
  ngDevMode && assertNgModuleType(moduleType);
25957
25974
  const moduleFactory = new NgModuleFactory(moduleType);
@@ -25996,7 +26013,6 @@ function publishDefaultGlobalUtils() {
25996
26013
  function isBoundToModule(cf) {
25997
26014
  return cf.isBoundToModule;
25998
26015
  }
25999
- const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26000
26016
  /**
26001
26017
  * A token for third-party components that can register themselves with NgProbe.
26002
26018
  *
@@ -26015,19 +26031,19 @@ class NgProbeToken {
26015
26031
  * @publicApi
26016
26032
  */
26017
26033
  function createPlatform(injector) {
26018
- if (_platform && !_platform.destroyed &&
26019
- !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26034
+ if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26020
26035
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26021
26036
  'There can be only one platform. Destroy the previous one to create a new one.' :
26022
26037
  '';
26023
26038
  throw new RuntimeError(400 /* MULTIPLE_PLATFORMS */, errorMessage);
26024
26039
  }
26025
26040
  publishDefaultGlobalUtils();
26026
- _platform = injector.get(PlatformRef);
26041
+ _platformInjector = injector;
26042
+ const platform = injector.get(PlatformRef);
26027
26043
  const inits = injector.get(PLATFORM_INITIALIZER, null);
26028
26044
  if (inits)
26029
- inits.forEach((init) => init());
26030
- return _platform;
26045
+ inits.forEach(initFn => initFn());
26046
+ return platform;
26031
26047
  }
26032
26048
  /**
26033
26049
  * Creates a factory for a platform. Can be used to provide or override `Providers` specific to
@@ -26046,15 +26062,16 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
26046
26062
  return (extraProviders = []) => {
26047
26063
  let platform = getPlatform();
26048
26064
  if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26065
+ const platformProviders = [
26066
+ ...providers,
26067
+ ...extraProviders,
26068
+ { provide: marker, useValue: true }
26069
+ ];
26049
26070
  if (parentPlatformFactory) {
26050
- parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
26071
+ parentPlatformFactory(platformProviders);
26051
26072
  }
26052
26073
  else {
26053
- const injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true }, {
26054
- provide: INJECTOR_SCOPE,
26055
- useValue: 'platform'
26056
- });
26057
- createPlatform(Injector.create({ providers: injectedProviders, name: desc }));
26074
+ createPlatform(createPlatformInjector(platformProviders, desc));
26058
26075
  }
26059
26076
  }
26060
26077
  return assertPlatform(marker);
@@ -26077,6 +26094,20 @@ function assertPlatform(requiredToken) {
26077
26094
  }
26078
26095
  return platform;
26079
26096
  }
26097
+ /**
26098
+ * Helper function to create an instance of a platform injector (that maintains the 'platform'
26099
+ * scope).
26100
+ */
26101
+ function createPlatformInjector(providers = [], name) {
26102
+ return Injector.create({
26103
+ name,
26104
+ providers: [
26105
+ { provide: INJECTOR_SCOPE, useValue: 'platform' },
26106
+ { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
26107
+ ...providers
26108
+ ],
26109
+ });
26110
+ }
26080
26111
  /**
26081
26112
  * Destroys the current Angular platform and all Angular applications on the page.
26082
26113
  * Destroys all modules and listeners registered with the platform.
@@ -26084,9 +26115,7 @@ function assertPlatform(requiredToken) {
26084
26115
  * @publicApi
26085
26116
  */
26086
26117
  function destroyPlatform() {
26087
- if (_platform && !_platform.destroyed) {
26088
- _platform.destroy();
26089
- }
26118
+ getPlatform()?.destroy();
26090
26119
  }
26091
26120
  /**
26092
26121
  * Returns the current platform.
@@ -26094,7 +26123,7 @@ function destroyPlatform() {
26094
26123
  * @publicApi
26095
26124
  */
26096
26125
  function getPlatform() {
26097
- return _platform && !_platform.destroyed ? _platform : null;
26126
+ return _platformInjector?.get(PlatformRef) ?? null;
26098
26127
  }
26099
26128
  /**
26100
26129
  * The Angular platform is the entry point for Angular on a web page.
@@ -26232,6 +26261,8 @@ class PlatformRef {
26232
26261
  }
26233
26262
  this._modules.slice().forEach(module => module.destroy());
26234
26263
  this._destroyListeners.forEach(listener => listener());
26264
+ const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
26265
+ destroyListener?.();
26235
26266
  this._destroyed = true;
26236
26267
  }
26237
26268
  get destroyed() {