@angular/core 13.1.2 → 13.1.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.1.2
2
+ * @license Angular v13.1.3
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.1.2
2
+ * @license Angular v13.1.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4750,7 +4750,10 @@ function setCurrentInjector(injector) {
4750
4750
  }
4751
4751
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4752
4752
  if (_currentInjector === undefined) {
4753
- throw new Error(`inject() must be called from an injection context`);
4753
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4754
+ `inject() must be called from an injection context` :
4755
+ '';
4756
+ throw new RuntimeError(203 /* MISSING_INJECTION_CONTEXT */, errorMessage);
4754
4757
  }
4755
4758
  else if (_currentInjector === null) {
4756
4759
  return injectRootLimpMode(token, undefined, flags);
@@ -4814,7 +4817,10 @@ function injectArgs(types) {
4814
4817
  const arg = resolveForwardRef(types[i]);
4815
4818
  if (Array.isArray(arg)) {
4816
4819
  if (arg.length === 0) {
4817
- throw new Error('Arguments array must have arguments.');
4820
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4821
+ 'Arguments array must have arguments.' :
4822
+ '';
4823
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
4818
4824
  }
4819
4825
  let type = undefined;
4820
4826
  let flags = InjectFlags.Default;
@@ -6005,7 +6011,10 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6005
6011
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* ResourceUrl */)) {
6006
6012
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6007
6013
  }
6008
- throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6014
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6015
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6016
+ '';
6017
+ throw new RuntimeError(904 /* UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6009
6018
  }
6010
6019
  /**
6011
6020
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6027,7 +6036,10 @@ function ɵɵsanitizeScript(unsafeScript) {
6027
6036
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* Script */)) {
6028
6037
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6029
6038
  }
6030
- throw new Error('unsafe value used in a script context');
6039
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6040
+ 'unsafe value used in a script context' :
6041
+ '';
6042
+ throw new RuntimeError(905 /* UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6031
6043
  }
6032
6044
  /**
6033
6045
  * A template tag function for promoting the associated constant literal to a
@@ -6115,18 +6127,18 @@ function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
6115
6127
  }
6116
6128
  function validateAgainstEventProperties(name) {
6117
6129
  if (name.toLowerCase().startsWith('on')) {
6118
- const msg = `Binding to event property '${name}' is disallowed for security reasons, ` +
6130
+ const errorMessage = `Binding to event property '${name}' is disallowed for security reasons, ` +
6119
6131
  `please use (${name.slice(2)})=...` +
6120
6132
  `\nIf '${name}' is a directive input, make sure the directive is imported by the` +
6121
6133
  ` current module.`;
6122
- throw new Error(msg);
6134
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6123
6135
  }
6124
6136
  }
6125
6137
  function validateAgainstEventAttributes(name) {
6126
6138
  if (name.toLowerCase().startsWith('on')) {
6127
- const msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
6139
+ const errorMessage = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
6128
6140
  `please use (${name.slice(2)})=...`;
6129
- throw new Error(msg);
6141
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6130
6142
  }
6131
6143
  }
6132
6144
  function getSanitizer() {
@@ -11298,7 +11310,10 @@ class R3Injector {
11298
11310
  }
11299
11311
  assertNotDestroyed() {
11300
11312
  if (this._destroyed) {
11301
- throw new Error('Injector has already been destroyed.');
11313
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11314
+ 'Injector has already been destroyed.' :
11315
+ '';
11316
+ throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, errorMessage);
11302
11317
  }
11303
11318
  }
11304
11319
  /**
@@ -11462,21 +11477,28 @@ function injectableDefOrInjectorDefFactory(token) {
11462
11477
  // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.
11463
11478
  // If it's missing that, it's an error.
11464
11479
  if (token instanceof InjectionToken) {
11465
- throw new Error(`Token ${stringify(token)} is missing a ɵprov definition.`);
11480
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11481
+ `Token ${stringify(token)} is missing a ɵprov definition.` :
11482
+ '';
11483
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11466
11484
  }
11467
11485
  // Undecorated types can sometimes be created if they have no constructor arguments.
11468
11486
  if (token instanceof Function) {
11469
11487
  return getUndecoratedInjectableFactory(token);
11470
11488
  }
11471
11489
  // There was no way to resolve a factory for this token.
11472
- throw new Error('unreachable');
11490
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'unreachable' : '';
11491
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11473
11492
  }
11474
11493
  function getUndecoratedInjectableFactory(token) {
11475
11494
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
11476
11495
  const paramLength = token.length;
11477
11496
  if (paramLength > 0) {
11478
11497
  const args = newArray(paramLength, '?');
11479
- throw new Error(`Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
11498
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11499
+ `Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).` :
11500
+ '';
11501
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11480
11502
  }
11481
11503
  // The constructor function appears to have no parameters.
11482
11504
  // This might be because it inherits from a super-class. In which case, use an injectable
@@ -12334,7 +12356,10 @@ function ɵɵInheritDefinitionFeature(definition) {
12334
12356
  }
12335
12357
  else {
12336
12358
  if (superType.ɵcmp) {
12337
- throw new Error('Directives cannot inherit Components');
12359
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
12360
+ 'Directives cannot inherit Components' :
12361
+ '';
12362
+ throw new RuntimeError(903 /* INVALID_INHERITANCE */, errorMessage);
12338
12363
  }
12339
12364
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
12340
12365
  superDef = superType.ɵdir;
@@ -19115,7 +19140,9 @@ function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
19115
19140
  setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
19116
19141
  break;
19117
19142
  default:
19118
- throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
19143
+ if (ngDevMode) {
19144
+ throw new RuntimeError(700 /* INVALID_I18N_STRUCTURE */, `Unable to determine the type of mutate operation for "${opCode}"`);
19145
+ }
19119
19146
  }
19120
19147
  }
19121
19148
  else {
@@ -21042,7 +21069,7 @@ class Version {
21042
21069
  /**
21043
21070
  * @publicApi
21044
21071
  */
21045
- const VERSION = new Version('13.1.2');
21072
+ const VERSION = new Version('13.1.3');
21046
21073
 
21047
21074
  /**
21048
21075
  * @license
@@ -21378,7 +21405,8 @@ class ViewRef$1 {
21378
21405
  }
21379
21406
  attachToViewContainerRef() {
21380
21407
  if (this._appRef) {
21381
- throw new Error('This view is already attached directly to the ApplicationRef!');
21408
+ const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
21409
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21382
21410
  }
21383
21411
  this._attachedToViewContainer = true;
21384
21412
  }
@@ -21388,7 +21416,8 @@ class ViewRef$1 {
21388
21416
  }
21389
21417
  attachToAppRef(appRef) {
21390
21418
  if (this._attachedToViewContainer) {
21391
- throw new Error('This view is already attached to a ViewContainer!');
21419
+ const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
21420
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21392
21421
  }
21393
21422
  this._appRef = appRef;
21394
21423
  }
@@ -27390,7 +27419,10 @@ class DefaultIterableDiffer {
27390
27419
  if (collection == null)
27391
27420
  collection = [];
27392
27421
  if (!isListLikeIterable(collection)) {
27393
- throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
27422
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27423
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
27424
+ '';
27425
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27394
27426
  }
27395
27427
  if (this.check(collection)) {
27396
27428
  return this;
@@ -27991,7 +28023,10 @@ class DefaultKeyValueDiffer {
27991
28023
  map = new Map();
27992
28024
  }
27993
28025
  else if (!(map instanceof Map || isJsObject(map))) {
27994
- throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
28026
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28027
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
28028
+ '';
28029
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27995
28030
  }
27996
28031
  return this.check(map) ? this : null;
27997
28032
  }
@@ -28238,7 +28273,10 @@ class IterableDiffers {
28238
28273
  return factory;
28239
28274
  }
28240
28275
  else {
28241
- throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
28276
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28277
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
28278
+ '';
28279
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28242
28280
  }
28243
28281
  }
28244
28282
  }
@@ -28312,7 +28350,10 @@ class KeyValueDiffers {
28312
28350
  if (factory) {
28313
28351
  return factory;
28314
28352
  }
28315
- throw new Error(`Cannot find a differ supporting object '${kv}'`);
28353
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28354
+ `Cannot find a differ supporting object '${kv}'` :
28355
+ '';
28356
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28316
28357
  }
28317
28358
  }
28318
28359
  /** @nocollapse */