@angular/core 13.2.0-next.1 → 13.2.0-next.2

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,6 +1,6 @@
1
1
  /**
2
- * @license Angular v13.2.0-next.1
3
- * (c) 2010-2021 Google LLC. https://angular.io/
2
+ * @license Angular v13.2.0-next.2
3
+ * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
package/fesm2020/core.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v13.2.0-next.1
3
- * (c) 2010-2021 Google LLC. https://angular.io/
2
+ * @license Angular v13.2.0-next.2
3
+ * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
@@ -141,7 +141,7 @@ function isForwardRef(fn) {
141
141
  *
142
142
  * Keep the files below in full sync:
143
143
  * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
144
- * - packages/core/src/render3/error_details_base_url.ts
144
+ * - packages/core/src/error_details_base_url.ts
145
145
  */
146
146
  const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
147
147
 
@@ -158,30 +158,15 @@ class RuntimeError extends Error {
158
158
  this.code = code;
159
159
  }
160
160
  }
161
- // Contains a set of error messages that have details guides at angular.io.
162
- // Full list of available error guides can be found at https://angular.io/errors
163
- /* tslint:disable:no-toplevel-property-access */
164
- const RUNTIME_ERRORS_WITH_GUIDES = new Set([
165
- "100" /* EXPRESSION_CHANGED_AFTER_CHECKED */,
166
- "200" /* CYCLIC_DI_DEPENDENCY */,
167
- "201" /* PROVIDER_NOT_FOUND */,
168
- "300" /* MULTIPLE_COMPONENTS_MATCH */,
169
- "301" /* EXPORT_NOT_FOUND */,
170
- "302" /* PIPE_NOT_FOUND */,
171
- ]);
172
- /* tslint:enable:no-toplevel-property-access */
173
161
  /** Called to format a runtime error */
174
162
  function formatRuntimeError(code, message) {
175
- const fullCode = code ? `NG0${code}: ` : '';
176
- let errorMessage = `${fullCode}${message}`;
177
- // Some runtime errors are still thrown without `ngDevMode` (for example
178
- // `throwProviderNotFoundError`), so we add `ngDevMode` check here to avoid pulling
179
- // `RUNTIME_ERRORS_WITH_GUIDES` symbol into prod bundles.
180
- // TODO: revisit all instances where `RuntimeError` is thrown and see if `ngDevMode` can be added
181
- // there instead to tree-shake more devmode-only code (and eventually remove `ngDevMode` check
182
- // from this code).
183
- if (ngDevMode && RUNTIME_ERRORS_WITH_GUIDES.has(code)) {
184
- errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0${code}`;
163
+ const codeAsNumber = code;
164
+ // Error code might be a negative number, which is a special marker that instructs the logic to
165
+ // generate a link to the error details page on angular.io.
166
+ const fullCode = `NG0${Math.abs(codeAsNumber)}`;
167
+ let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
168
+ if (ngDevMode && codeAsNumber < 0) {
169
+ errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
185
170
  }
186
171
  return errorMessage;
187
172
  }
@@ -222,10 +207,17 @@ function stringifyForError(value) {
222
207
  return renderStringify(value);
223
208
  }
224
209
 
210
+ /**
211
+ * @license
212
+ * Copyright Google LLC All Rights Reserved.
213
+ *
214
+ * Use of this source code is governed by an MIT-style license that can be
215
+ * found in the LICENSE file at https://angular.io/license
216
+ */
225
217
  /** Called when directives inject each other (creating a circular dependency) */
226
218
  function throwCyclicDependencyError(token, path) {
227
219
  const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
228
- throw new RuntimeError("200" /* CYCLIC_DI_DEPENDENCY */, `Circular dependency in DI detected for ${token}${depPath}`);
220
+ throw new RuntimeError(-200 /* CYCLIC_DI_DEPENDENCY */, `Circular dependency in DI detected for ${token}${depPath}`);
229
221
  }
230
222
  function throwMixedMultiProviderError() {
231
223
  throw new Error(`Cannot mix multi providers and regular providers`);
@@ -242,7 +234,7 @@ function throwInvalidProviderError(ngModuleType, providers, provider) {
242
234
  /** Throws an error when a token is not found in DI. */
243
235
  function throwProviderNotFoundError(token, injectorName) {
244
236
  const injectorDetails = injectorName ? ` in ${injectorName}` : '';
245
- throw new RuntimeError("201" /* PROVIDER_NOT_FOUND */, `No provider for ${stringifyForError(token)} found${injectorDetails}`);
237
+ throw new RuntimeError(-201 /* PROVIDER_NOT_FOUND */, `No provider for ${stringifyForError(token)} found${injectorDetails}`);
246
238
  }
247
239
 
248
240
  /**
@@ -6454,7 +6446,6 @@ function discoverLocalRefs(lView, nodeIndex) {
6454
6446
  * Use of this source code is governed by an MIT-style license that can be
6455
6447
  * found in the LICENSE file at https://angular.io/license
6456
6448
  */
6457
- const ERROR_TYPE = 'ngType';
6458
6449
  const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6459
6450
  const ERROR_LOGGER = 'ngErrorLogger';
6460
6451
  function wrappedError(message, originalError) {
@@ -6463,17 +6454,6 @@ function wrappedError(message, originalError) {
6463
6454
  error[ERROR_ORIGINAL_ERROR] = originalError;
6464
6455
  return error;
6465
6456
  }
6466
-
6467
- /**
6468
- * @license
6469
- * Copyright Google LLC All Rights Reserved.
6470
- *
6471
- * Use of this source code is governed by an MIT-style license that can be
6472
- * found in the LICENSE file at https://angular.io/license
6473
- */
6474
- function getType(error) {
6475
- return error[ERROR_TYPE];
6476
- }
6477
6457
  function getOriginalError(error) {
6478
6458
  return error[ERROR_ORIGINAL_ERROR];
6479
6459
  }
@@ -6718,7 +6698,7 @@ function maybeUnwrapFn(value) {
6718
6698
  */
6719
6699
  /** Called when there are multiple component selectors that match a given node */
6720
6700
  function throwMultipleComponentError(tNode) {
6721
- throw new RuntimeError("300" /* MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}`);
6701
+ throw new RuntimeError(-300 /* MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}`);
6722
6702
  }
6723
6703
  /** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
6724
6704
  function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
@@ -6729,9 +6709,7 @@ function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName)
6729
6709
  ` It seems like the view has been created after its parent and its children have been dirty checked.` +
6730
6710
  ` Has it been created in a change detection hook?`;
6731
6711
  }
6732
- // TODO: include debug context, see `viewDebugError` function in
6733
- // `packages/core/src/view/errors.ts` for reference.
6734
- throw new RuntimeError("100" /* EXPRESSION_CHANGED_AFTER_CHECKED */, msg);
6712
+ throw new RuntimeError(-100 /* EXPRESSION_CHANGED_AFTER_CHECKED */, msg);
6735
6713
  }
6736
6714
  function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
6737
6715
  const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
@@ -10141,7 +10119,7 @@ function matchingSchemas(tView, tagName) {
10141
10119
  */
10142
10120
  function logUnknownPropertyError(propName, tNode) {
10143
10121
  let message = `Can't bind to '${propName}' since it isn't a known property of '${tNode.value}'.`;
10144
- console.error(formatRuntimeError("303" /* UNKNOWN_BINDING */, message));
10122
+ console.error(formatRuntimeError(303 /* UNKNOWN_BINDING */, message));
10145
10123
  }
10146
10124
  /**
10147
10125
  * Instantiate a root component.
@@ -10394,7 +10372,7 @@ function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
10394
10372
  for (let i = 0; i < localRefs.length; i += 2) {
10395
10373
  const index = exportsMap[localRefs[i + 1]];
10396
10374
  if (index == null)
10397
- throw new RuntimeError("301" /* EXPORT_NOT_FOUND */, `Export of name '${localRefs[i + 1]}' not found!`);
10375
+ throw new RuntimeError(-301 /* EXPORT_NOT_FOUND */, `Export of name '${localRefs[i + 1]}' not found!`);
10398
10376
  localNames.push(localRefs[i], index);
10399
10377
  }
10400
10378
  }
@@ -14618,7 +14596,7 @@ function logUnknownElementError(tView, element, tNode, hasDirectives) {
14618
14596
  message +=
14619
14597
  `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
14620
14598
  }
14621
- console.error(formatRuntimeError("304" /* UNKNOWN_ELEMENT */, message));
14599
+ console.error(formatRuntimeError(304 /* UNKNOWN_ELEMENT */, message));
14622
14600
  }
14623
14601
  }
14624
14602
  }
@@ -19763,7 +19741,7 @@ function i18nStartFirstCreatePass(tView, parentTNodeIndex, lView, index, message
19763
19741
  };
19764
19742
  }
19765
19743
  /**
19766
- * Allocate space in i18n Range add create OpCode instruction to crete a text or comment node.
19744
+ * Allocate space in i18n Range add create OpCode instruction to create a text or comment node.
19767
19745
  *
19768
19746
  * @param tView Current `TView` needed to allocate space in i18n range.
19769
19747
  * @param rootTNode Root `TNode` of the i18n block. This node determines if the new TNode will be
@@ -21064,7 +21042,7 @@ class Version {
21064
21042
  /**
21065
21043
  * @publicApi
21066
21044
  */
21067
- const VERSION = new Version('13.2.0-next.1');
21045
+ const VERSION = new Version('13.2.0-next.2');
21068
21046
 
21069
21047
  /**
21070
21048
  * @license
@@ -21802,7 +21780,7 @@ class NgModuleRef extends NgModuleRef$1 {
21802
21780
  }
21803
21781
  ], stringify(ngModuleType));
21804
21782
  // We need to resolve the injector types separately from the injector creation, because
21805
- // the module might be trying to use this ref in its contructor for DI which will cause a
21783
+ // the module might be trying to use this ref in its constructor for DI which will cause a
21806
21784
  // circular error that will eventually error out, because the injector isn't created yet.
21807
21785
  this._r3Injector._resolveInjectorDefTypes();
21808
21786
  this.instance = this.get(ngModuleType);
@@ -22281,7 +22259,7 @@ function getPipeDef(name, registry) {
22281
22259
  const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22282
22260
  const context = declarationLView[CONTEXT];
22283
22261
  const component = context ? ` in the '${context.constructor.name}' component` : '';
22284
- throw new RuntimeError("302" /* PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22262
+ throw new RuntimeError(-302 /* PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22285
22263
  }
22286
22264
  }
22287
22265
  /**
@@ -24542,7 +24520,7 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
24542
24520
  * @HostListener('click', ['$event.target'])
24543
24521
  * onClick(btn) {
24544
24522
  * console.log('button', btn, 'number of clicks:', this.numberOfClicks++);
24545
- * }
24523
+ * }
24546
24524
  * }
24547
24525
  *
24548
24526
  * @Component({
@@ -25882,7 +25860,7 @@ function createPlatform(injector) {
25882
25860
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
25883
25861
  'There can be only one platform. Destroy the previous one to create a new one.' :
25884
25862
  '';
25885
- throw new RuntimeError("400" /* MULTIPLE_PLATFORMS */, errorMessage);
25863
+ throw new RuntimeError(400 /* MULTIPLE_PLATFORMS */, errorMessage);
25886
25864
  }
25887
25865
  publishDefaultGlobalUtils();
25888
25866
  _platform = injector.get(PlatformRef);
@@ -25931,11 +25909,11 @@ function assertPlatform(requiredToken) {
25931
25909
  const platform = getPlatform();
25932
25910
  if (!platform) {
25933
25911
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
25934
- throw new RuntimeError("401" /* PLATFORM_NOT_FOUND */, errorMessage);
25912
+ throw new RuntimeError(401 /* PLATFORM_NOT_FOUND */, errorMessage);
25935
25913
  }
25936
25914
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
25937
25915
  !platform.injector.get(requiredToken, null)) {
25938
- throw new RuntimeError("400" /* MULTIPLE_PLATFORMS */, 'A platform with a different configuration has been created. Please destroy it first.');
25916
+ throw new RuntimeError(400 /* MULTIPLE_PLATFORMS */, 'A platform with a different configuration has been created. Please destroy it first.');
25939
25917
  }
25940
25918
  return platform;
25941
25919
  }
@@ -26022,7 +26000,7 @@ class PlatformRef {
26022
26000
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26023
26001
  'No ErrorHandler. Is platform module (BrowserModule) included?' :
26024
26002
  '';
26025
- throw new RuntimeError("402" /* ERROR_HANDLER_NOT_FOUND */, errorMessage);
26003
+ throw new RuntimeError(402 /* ERROR_HANDLER_NOT_FOUND */, errorMessage);
26026
26004
  }
26027
26005
  ngZone.runOutsideAngular(() => {
26028
26006
  const subscription = ngZone.onError.subscribe({
@@ -26083,7 +26061,7 @@ class PlatformRef {
26083
26061
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
26084
26062
  `Please define one of these.` :
26085
26063
  '';
26086
- throw new RuntimeError("403" /* BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
26064
+ throw new RuntimeError(403 /* BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
26087
26065
  }
26088
26066
  this._modules.push(moduleRef);
26089
26067
  }
@@ -26109,7 +26087,7 @@ class PlatformRef {
26109
26087
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26110
26088
  'The platform has already been destroyed!' :
26111
26089
  '';
26112
- throw new RuntimeError("404" /* ALREADY_DESTROYED_PLATFORM */, errorMessage);
26090
+ throw new RuntimeError(404 /* ALREADY_DESTROYED_PLATFORM */, errorMessage);
26113
26091
  }
26114
26092
  this._modules.slice().forEach(module => module.destroy());
26115
26093
  this._destroyListeners.forEach(listener => listener());
@@ -26373,7 +26351,7 @@ class ApplicationRef {
26373
26351
  'Cannot bootstrap as there are still asynchronous initializers running. ' +
26374
26352
  'Bootstrap components in the `ngDoBootstrap` method of the root module.' :
26375
26353
  '';
26376
- throw new RuntimeError("405" /* ASYNC_INITIALIZERS_STILL_RUNNING */, errorMessage);
26354
+ throw new RuntimeError(405 /* ASYNC_INITIALIZERS_STILL_RUNNING */, errorMessage);
26377
26355
  }
26378
26356
  let componentFactory;
26379
26357
  if (componentOrFactory instanceof ComponentFactory$1) {
@@ -26423,7 +26401,7 @@ class ApplicationRef {
26423
26401
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26424
26402
  'ApplicationRef.tick is called recursively' :
26425
26403
  '';
26426
- throw new RuntimeError("101" /* RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
26404
+ throw new RuntimeError(101 /* RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
26427
26405
  }
26428
26406
  try {
26429
26407
  this._runningTick = true;