@angular/core 14.1.0-next.1 → 14.1.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.
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.1
2
+ * @license Angular v14.1.0-next.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4837,10 +4837,8 @@ function setCurrentInjector(injector) {
4837
4837
  }
4838
4838
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4839
4839
  if (_currentInjector === undefined) {
4840
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4841
- `inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
4842
- '';
4843
- throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4840
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4841
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
4844
4842
  }
4845
4843
  else if (_currentInjector === null) {
4846
4844
  return injectRootLimpMode(token, undefined, flags);
@@ -4946,10 +4944,7 @@ function injectArgs(types) {
4946
4944
  const arg = resolveForwardRef(types[i]);
4947
4945
  if (Array.isArray(arg)) {
4948
4946
  if (arg.length === 0) {
4949
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4950
- 'Arguments array must have arguments.' :
4951
- '';
4952
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
4947
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4953
4948
  }
4954
4949
  let type = undefined;
4955
4950
  let flags = InjectFlags.Default;
@@ -6200,10 +6195,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6200
6195
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
6201
6196
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6202
6197
  }
6203
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6204
- 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6205
- '';
6206
- throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6198
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
6199
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6207
6200
  }
6208
6201
  /**
6209
6202
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6225,10 +6218,7 @@ function ɵɵsanitizeScript(unsafeScript) {
6225
6218
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
6226
6219
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6227
6220
  }
6228
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6229
- 'unsafe value used in a script context' :
6230
- '';
6231
- throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6221
+ throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
6232
6222
  }
6233
6223
  /**
6234
6224
  * A template tag function for promoting the associated constant literal to a
@@ -14072,10 +14062,8 @@ function ɵɵInheritDefinitionFeature(definition) {
14072
14062
  }
14073
14063
  else {
14074
14064
  if (superType.ɵcmp) {
14075
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
14076
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}` :
14077
- '';
14078
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, errorMessage);
14065
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14066
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14079
14067
  }
14080
14068
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14081
14069
  superDef = superType.ɵdir;
@@ -21772,7 +21760,7 @@ class Version {
21772
21760
  /**
21773
21761
  * @publicApi
21774
21762
  */
21775
- const VERSION = new Version('14.1.0-next.1');
21763
+ const VERSION = new Version('14.1.0-next.2');
21776
21764
 
21777
21765
  /**
21778
21766
  * @license
@@ -22110,8 +22098,7 @@ class ViewRef$1 {
22110
22098
  }
22111
22099
  attachToViewContainerRef() {
22112
22100
  if (this._appRef) {
22113
- const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
22114
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22101
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
22115
22102
  }
22116
22103
  this._attachedToViewContainer = true;
22117
22104
  }
@@ -22121,8 +22108,7 @@ class ViewRef$1 {
22121
22108
  }
22122
22109
  attachToAppRef(appRef) {
22123
22110
  if (this._attachedToViewContainer) {
22124
- const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
22125
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22111
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
22126
22112
  }
22127
22113
  this._appRef = appRef;
22128
22114
  }
@@ -22443,10 +22429,18 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22443
22429
  /**
22444
22430
  * Create a new environment injector.
22445
22431
  *
22432
+ * Learn more about environment injectors in
22433
+ * [this guide](guide/standalone-components#environment-injectors).
22434
+ *
22435
+ * @param providers An array of providers.
22436
+ * @param parent A parent environment injector.
22437
+ * @param debugName An optional name for this injector instance, which will be used in error
22438
+ * messages.
22439
+ *
22446
22440
  * @publicApi
22447
22441
  * @developerPreview
22448
22442
  */
22449
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22443
+ function createEnvironmentInjector(providers, parent, debugName = null) {
22450
22444
  const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22451
22445
  return adapter.injector;
22452
22446
  }
@@ -25153,14 +25147,20 @@ function getStandaloneDefFunctions(type, imports) {
25153
25147
  // Standalone components are always able to self-reference, so include the component's own
25154
25148
  // definition in its `directiveDefs`.
25155
25149
  cachedDirectiveDefs = [getComponentDef(type)];
25150
+ const seen = new Set();
25156
25151
  for (const rawDep of imports) {
25157
25152
  ngDevMode && verifyStandaloneImport(rawDep, type);
25158
25153
  const dep = resolveForwardRef(rawDep);
25154
+ if (seen.has(dep)) {
25155
+ continue;
25156
+ }
25157
+ seen.add(dep);
25159
25158
  if (!!getNgModuleDef(dep)) {
25160
25159
  const scope = transitiveScopesFor(dep);
25161
25160
  for (const dir of scope.exported.directives) {
25162
25161
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25163
- if (def) {
25162
+ if (def && !seen.has(dir)) {
25163
+ seen.add(dir);
25164
25164
  cachedDirectiveDefs.push(def);
25165
25165
  }
25166
25166
  }
@@ -25178,11 +25178,22 @@ function getStandaloneDefFunctions(type, imports) {
25178
25178
  const pipeDefs = () => {
25179
25179
  if (cachedPipeDefs === null) {
25180
25180
  cachedPipeDefs = [];
25181
+ const seen = new Set();
25181
25182
  for (const rawDep of imports) {
25182
25183
  const dep = resolveForwardRef(rawDep);
25184
+ if (seen.has(dep)) {
25185
+ continue;
25186
+ }
25187
+ seen.add(dep);
25183
25188
  if (!!getNgModuleDef(dep)) {
25184
25189
  const scope = transitiveScopesFor(dep);
25185
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
25190
+ for (const pipe of scope.exported.pipes) {
25191
+ const def = getPipeDef$1(pipe);
25192
+ if (def && !seen.has(pipe)) {
25193
+ seen.add(pipe);
25194
+ cachedPipeDefs.push(def);
25195
+ }
25196
+ }
25186
25197
  }
25187
25198
  else {
25188
25199
  const def = getPipeDef$1(dep);
@@ -26962,10 +26973,8 @@ class NgProbeToken {
26962
26973
  */
26963
26974
  function createPlatform(injector) {
26964
26975
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26965
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26966
- 'There can be only one platform. Destroy the previous one to create a new one.' :
26967
- '';
26968
- throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, errorMessage);
26976
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26977
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26969
26978
  }
26970
26979
  publishDefaultGlobalUtils();
26971
26980
  _platformInjector = injector;
@@ -27085,8 +27094,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27085
27094
  function assertPlatform(requiredToken) {
27086
27095
  const platform = getPlatform();
27087
27096
  if (!platform) {
27088
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27089
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
27097
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27090
27098
  }
27091
27099
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27092
27100
  !platform.injector.get(requiredToken, null)) {
@@ -27166,10 +27174,7 @@ class PlatformRef {
27166
27174
  const moduleRef = moduleFactory.create(ngZoneInjector);
27167
27175
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27168
27176
  if (!exceptionHandler) {
27169
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27170
- 'No ErrorHandler. Is platform module (BrowserModule) included?' :
27171
- '';
27172
- throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, errorMessage);
27177
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27173
27178
  }
27174
27179
  ngZone.runOutsideAngular(() => {
27175
27180
  const subscription = ngZone.onError.subscribe({
@@ -27225,12 +27230,10 @@ class PlatformRef {
27225
27230
  moduleRef.instance.ngDoBootstrap(appRef);
27226
27231
  }
27227
27232
  else {
27228
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27233
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27229
27234
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27230
27235
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
27231
- `Please define one of these.` :
27232
- '';
27233
- throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
27236
+ `Please define one of these.`);
27234
27237
  }
27235
27238
  this._modules.push(moduleRef);
27236
27239
  }
@@ -27253,10 +27256,7 @@ class PlatformRef {
27253
27256
  */
27254
27257
  destroy() {
27255
27258
  if (this._destroyed) {
27256
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27257
- 'The platform has already been destroyed!' :
27258
- '';
27259
- throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, errorMessage);
27259
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27260
27260
  }
27261
27261
  this._modules.slice().forEach(module => module.destroy());
27262
27262
  this._destroyListeners.forEach(listener => listener());
@@ -27590,10 +27590,7 @@ class ApplicationRef {
27590
27590
  tick() {
27591
27591
  NG_DEV_MODE && this.warnIfDestroyed();
27592
27592
  if (this._runningTick) {
27593
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27594
- 'ApplicationRef.tick is called recursively' :
27595
- '';
27596
- throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
27593
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27597
27594
  }
27598
27595
  try {
27599
27596
  this._runningTick = true;
@@ -27682,7 +27679,7 @@ class ApplicationRef {
27682
27679
  */
27683
27680
  destroy() {
27684
27681
  if (this._destroyed) {
27685
- throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, NG_DEV_MODE && 'This instance of the `ApplicationRef` has already been destroyed.');
27682
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27686
27683
  }
27687
27684
  const injector = this._injector;
27688
27685
  // Check that this injector instance supports destroy operation.
@@ -28721,10 +28718,8 @@ class DefaultIterableDiffer {
28721
28718
  if (collection == null)
28722
28719
  collection = [];
28723
28720
  if (!isListLikeIterable(collection)) {
28724
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28725
- `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
28726
- '';
28727
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
28721
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28722
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28728
28723
  }
28729
28724
  if (this.check(collection)) {
28730
28725
  return this;
@@ -29325,10 +29320,8 @@ class DefaultKeyValueDiffer {
29325
29320
  map = new Map();
29326
29321
  }
29327
29322
  else if (!(map instanceof Map || isJsObject(map))) {
29328
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29329
- `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
29330
- '';
29331
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
29323
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29324
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29332
29325
  }
29333
29326
  return this.check(map) ? this : null;
29334
29327
  }
@@ -29575,10 +29568,8 @@ class IterableDiffers {
29575
29568
  return factory;
29576
29569
  }
29577
29570
  else {
29578
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29579
- `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
29580
- '';
29581
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29571
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29572
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29582
29573
  }
29583
29574
  }
29584
29575
  }
@@ -29652,10 +29643,7 @@ class KeyValueDiffers {
29652
29643
  if (factory) {
29653
29644
  return factory;
29654
29645
  }
29655
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29656
- `Cannot find a differ supporting object '${kv}'` :
29657
- '';
29658
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29646
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29659
29647
  }
29660
29648
  }
29661
29649
  /** @nocollapse */