@angular/core 14.0.2 → 14.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/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.2
2
+ * @license Angular v14.0.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4858,10 +4858,8 @@ function setCurrentInjector(injector) {
4858
4858
  }
4859
4859
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4860
4860
  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);
4861
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4862
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
4865
4863
  }
4866
4864
  else if (_currentInjector === null) {
4867
4865
  return injectRootLimpMode(token, undefined, flags);
@@ -4967,10 +4965,7 @@ function injectArgs(types) {
4967
4965
  const arg = resolveForwardRef(types[i]);
4968
4966
  if (Array.isArray(arg)) {
4969
4967
  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);
4968
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4974
4969
  }
4975
4970
  let type = undefined;
4976
4971
  let flags = InjectFlags.Default;
@@ -6215,10 +6210,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6215
6210
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
6216
6211
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6217
6212
  }
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);
6213
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
6214
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6222
6215
  }
6223
6216
  /**
6224
6217
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6240,10 +6233,7 @@ function ɵɵsanitizeScript(unsafeScript) {
6240
6233
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
6241
6234
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6242
6235
  }
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);
6236
+ throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
6247
6237
  }
6248
6238
  /**
6249
6239
  * A template tag function for promoting the associated constant literal to a
@@ -14085,10 +14075,8 @@ function ɵɵInheritDefinitionFeature(definition) {
14085
14075
  }
14086
14076
  else {
14087
14077
  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);
14078
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14079
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14092
14080
  }
14093
14081
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14094
14082
  superDef = superType.ɵdir;
@@ -21785,7 +21773,7 @@ class Version {
21785
21773
  /**
21786
21774
  * @publicApi
21787
21775
  */
21788
- const VERSION = new Version('14.0.2');
21776
+ const VERSION = new Version('14.0.3');
21789
21777
 
21790
21778
  /**
21791
21779
  * @license
@@ -22123,8 +22111,7 @@ class ViewRef$1 {
22123
22111
  }
22124
22112
  attachToViewContainerRef() {
22125
22113
  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);
22114
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
22128
22115
  }
22129
22116
  this._attachedToViewContainer = true;
22130
22117
  }
@@ -22134,8 +22121,7 @@ class ViewRef$1 {
22134
22121
  }
22135
22122
  attachToAppRef(appRef) {
22136
22123
  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);
22124
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
22139
22125
  }
22140
22126
  this._appRef = appRef;
22141
22127
  }
@@ -25177,14 +25163,20 @@ function getStandaloneDefFunctions(type, imports) {
25177
25163
  // Standalone components are always able to self-reference, so include the component's own
25178
25164
  // definition in its `directiveDefs`.
25179
25165
  cachedDirectiveDefs = [getComponentDef(type)];
25166
+ const seen = new Set();
25180
25167
  for (const rawDep of imports) {
25181
25168
  ngDevMode && verifyStandaloneImport(rawDep, type);
25182
25169
  const dep = resolveForwardRef(rawDep);
25170
+ if (seen.has(dep)) {
25171
+ continue;
25172
+ }
25173
+ seen.add(dep);
25183
25174
  if (!!getNgModuleDef(dep)) {
25184
25175
  const scope = transitiveScopesFor(dep);
25185
25176
  for (const dir of scope.exported.directives) {
25186
25177
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25187
- if (def) {
25178
+ if (def && !seen.has(dir)) {
25179
+ seen.add(dir);
25188
25180
  cachedDirectiveDefs.push(def);
25189
25181
  }
25190
25182
  }
@@ -25202,11 +25194,22 @@ function getStandaloneDefFunctions(type, imports) {
25202
25194
  const pipeDefs = () => {
25203
25195
  if (cachedPipeDefs === null) {
25204
25196
  cachedPipeDefs = [];
25197
+ const seen = new Set();
25205
25198
  for (const rawDep of imports) {
25206
25199
  const dep = resolveForwardRef(rawDep);
25200
+ if (seen.has(dep)) {
25201
+ continue;
25202
+ }
25203
+ seen.add(dep);
25207
25204
  if (!!getNgModuleDef(dep)) {
25208
25205
  const scope = transitiveScopesFor(dep);
25209
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
25206
+ for (const pipe of scope.exported.pipes) {
25207
+ const def = getPipeDef$1(pipe);
25208
+ if (def && !seen.has(pipe)) {
25209
+ seen.add(pipe);
25210
+ cachedPipeDefs.push(def);
25211
+ }
25212
+ }
25210
25213
  }
25211
25214
  else {
25212
25215
  const def = getPipeDef$1(dep);
@@ -26979,10 +26982,8 @@ class NgProbeToken {
26979
26982
  */
26980
26983
  function createPlatform(injector) {
26981
26984
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26982
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26983
- 'There can be only one platform. Destroy the previous one to create a new one.' :
26984
- '';
26985
- throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, errorMessage);
26985
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26986
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26986
26987
  }
26987
26988
  publishDefaultGlobalUtils();
26988
26989
  _platformInjector = injector;
@@ -27102,8 +27103,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27102
27103
  function assertPlatform(requiredToken) {
27103
27104
  const platform = getPlatform();
27104
27105
  if (!platform) {
27105
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27106
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
27106
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27107
27107
  }
27108
27108
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27109
27109
  !platform.injector.get(requiredToken, null)) {
@@ -27181,10 +27181,7 @@ class PlatformRef {
27181
27181
  const moduleRef = moduleFactory.create(ngZoneInjector);
27182
27182
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27183
27183
  if (!exceptionHandler) {
27184
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27185
- 'No ErrorHandler. Is platform module (BrowserModule) included?' :
27186
- '';
27187
- throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, errorMessage);
27184
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27188
27185
  }
27189
27186
  ngZone.runOutsideAngular(() => {
27190
27187
  const subscription = ngZone.onError.subscribe({
@@ -27240,12 +27237,10 @@ class PlatformRef {
27240
27237
  moduleRef.instance.ngDoBootstrap(appRef);
27241
27238
  }
27242
27239
  else {
27243
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27240
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27244
27241
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27245
27242
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
27246
- `Please define one of these.` :
27247
- '';
27248
- throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
27243
+ `Please define one of these.`);
27249
27244
  }
27250
27245
  this._modules.push(moduleRef);
27251
27246
  }
@@ -27268,10 +27263,7 @@ class PlatformRef {
27268
27263
  */
27269
27264
  destroy() {
27270
27265
  if (this._destroyed) {
27271
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27272
- 'The platform has already been destroyed!' :
27273
- '';
27274
- throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, errorMessage);
27266
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27275
27267
  }
27276
27268
  this._modules.slice().forEach(module => module.destroy());
27277
27269
  this._destroyListeners.forEach(listener => listener());
@@ -27603,10 +27595,7 @@ class ApplicationRef {
27603
27595
  tick() {
27604
27596
  NG_DEV_MODE && this.warnIfDestroyed();
27605
27597
  if (this._runningTick) {
27606
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27607
- 'ApplicationRef.tick is called recursively' :
27608
- '';
27609
- throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
27598
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27610
27599
  }
27611
27600
  try {
27612
27601
  this._runningTick = true;
@@ -27695,7 +27684,7 @@ class ApplicationRef {
27695
27684
  */
27696
27685
  destroy() {
27697
27686
  if (this._destroyed) {
27698
- throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, NG_DEV_MODE && 'This instance of the `ApplicationRef` has already been destroyed.');
27687
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27699
27688
  }
27700
27689
  const injector = this._injector;
27701
27690
  // Check that this injector instance supports destroy operation.
@@ -28732,10 +28721,8 @@ class DefaultIterableDiffer {
28732
28721
  if (collection == null)
28733
28722
  collection = [];
28734
28723
  if (!isListLikeIterable(collection)) {
28735
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28736
- `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
28737
- '';
28738
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
28724
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28725
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28739
28726
  }
28740
28727
  if (this.check(collection)) {
28741
28728
  return this;
@@ -29336,10 +29323,8 @@ class DefaultKeyValueDiffer {
29336
29323
  map = new Map();
29337
29324
  }
29338
29325
  else if (!(map instanceof Map || isJsObject(map))) {
29339
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29340
- `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
29341
- '';
29342
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
29326
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29327
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29343
29328
  }
29344
29329
  return this.check(map) ? this : null;
29345
29330
  }
@@ -29586,10 +29571,8 @@ class IterableDiffers {
29586
29571
  return factory;
29587
29572
  }
29588
29573
  else {
29589
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29590
- `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
29591
- '';
29592
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29574
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29575
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29593
29576
  }
29594
29577
  }
29595
29578
  }
@@ -29663,10 +29646,7 @@ class KeyValueDiffers {
29663
29646
  if (factory) {
29664
29647
  return factory;
29665
29648
  }
29666
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29667
- `Cannot find a differ supporting object '${kv}'` :
29668
- '';
29669
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29649
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29670
29650
  }
29671
29651
  }
29672
29652
  /** @nocollapse */