@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/fesm2020/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
  */
@@ -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.1.0-next.1');
21776
+ const VERSION = new Version('14.1.0-next.2');
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
  }
@@ -22456,10 +22442,18 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22456
22442
  /**
22457
22443
  * Create a new environment injector.
22458
22444
  *
22445
+ * Learn more about environment injectors in
22446
+ * [this guide](guide/standalone-components#environment-injectors).
22447
+ *
22448
+ * @param providers An array of providers.
22449
+ * @param parent A parent environment injector.
22450
+ * @param debugName An optional name for this injector instance, which will be used in error
22451
+ * messages.
22452
+ *
22459
22453
  * @publicApi
22460
22454
  * @developerPreview
22461
22455
  */
22462
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22456
+ function createEnvironmentInjector(providers, parent, debugName = null) {
22463
22457
  const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22464
22458
  return adapter.injector;
22465
22459
  }
@@ -25177,14 +25171,20 @@ function getStandaloneDefFunctions(type, imports) {
25177
25171
  // Standalone components are always able to self-reference, so include the component's own
25178
25172
  // definition in its `directiveDefs`.
25179
25173
  cachedDirectiveDefs = [getComponentDef(type)];
25174
+ const seen = new Set();
25180
25175
  for (const rawDep of imports) {
25181
25176
  ngDevMode && verifyStandaloneImport(rawDep, type);
25182
25177
  const dep = resolveForwardRef(rawDep);
25178
+ if (seen.has(dep)) {
25179
+ continue;
25180
+ }
25181
+ seen.add(dep);
25183
25182
  if (!!getNgModuleDef(dep)) {
25184
25183
  const scope = transitiveScopesFor(dep);
25185
25184
  for (const dir of scope.exported.directives) {
25186
25185
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25187
- if (def) {
25186
+ if (def && !seen.has(dir)) {
25187
+ seen.add(dir);
25188
25188
  cachedDirectiveDefs.push(def);
25189
25189
  }
25190
25190
  }
@@ -25202,11 +25202,22 @@ function getStandaloneDefFunctions(type, imports) {
25202
25202
  const pipeDefs = () => {
25203
25203
  if (cachedPipeDefs === null) {
25204
25204
  cachedPipeDefs = [];
25205
+ const seen = new Set();
25205
25206
  for (const rawDep of imports) {
25206
25207
  const dep = resolveForwardRef(rawDep);
25208
+ if (seen.has(dep)) {
25209
+ continue;
25210
+ }
25211
+ seen.add(dep);
25207
25212
  if (!!getNgModuleDef(dep)) {
25208
25213
  const scope = transitiveScopesFor(dep);
25209
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
25214
+ for (const pipe of scope.exported.pipes) {
25215
+ const def = getPipeDef$1(pipe);
25216
+ if (def && !seen.has(pipe)) {
25217
+ seen.add(pipe);
25218
+ cachedPipeDefs.push(def);
25219
+ }
25220
+ }
25210
25221
  }
25211
25222
  else {
25212
25223
  const def = getPipeDef$1(dep);
@@ -26979,10 +26990,8 @@ class NgProbeToken {
26979
26990
  */
26980
26991
  function createPlatform(injector) {
26981
26992
  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);
26993
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26994
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26986
26995
  }
26987
26996
  publishDefaultGlobalUtils();
26988
26997
  _platformInjector = injector;
@@ -27102,8 +27111,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27102
27111
  function assertPlatform(requiredToken) {
27103
27112
  const platform = getPlatform();
27104
27113
  if (!platform) {
27105
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27106
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
27114
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27107
27115
  }
27108
27116
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27109
27117
  !platform.injector.get(requiredToken, null)) {
@@ -27181,10 +27189,7 @@ class PlatformRef {
27181
27189
  const moduleRef = moduleFactory.create(ngZoneInjector);
27182
27190
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27183
27191
  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);
27192
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27188
27193
  }
27189
27194
  ngZone.runOutsideAngular(() => {
27190
27195
  const subscription = ngZone.onError.subscribe({
@@ -27240,12 +27245,10 @@ class PlatformRef {
27240
27245
  moduleRef.instance.ngDoBootstrap(appRef);
27241
27246
  }
27242
27247
  else {
27243
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27248
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27244
27249
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27245
27250
  `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);
27251
+ `Please define one of these.`);
27249
27252
  }
27250
27253
  this._modules.push(moduleRef);
27251
27254
  }
@@ -27268,10 +27271,7 @@ class PlatformRef {
27268
27271
  */
27269
27272
  destroy() {
27270
27273
  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);
27274
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27275
27275
  }
27276
27276
  this._modules.slice().forEach(module => module.destroy());
27277
27277
  this._destroyListeners.forEach(listener => listener());
@@ -27603,10 +27603,7 @@ class ApplicationRef {
27603
27603
  tick() {
27604
27604
  NG_DEV_MODE && this.warnIfDestroyed();
27605
27605
  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);
27606
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27610
27607
  }
27611
27608
  try {
27612
27609
  this._runningTick = true;
@@ -27695,7 +27692,7 @@ class ApplicationRef {
27695
27692
  */
27696
27693
  destroy() {
27697
27694
  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.');
27695
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27699
27696
  }
27700
27697
  const injector = this._injector;
27701
27698
  // Check that this injector instance supports destroy operation.
@@ -28732,10 +28729,8 @@ class DefaultIterableDiffer {
28732
28729
  if (collection == null)
28733
28730
  collection = [];
28734
28731
  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);
28732
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28733
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28739
28734
  }
28740
28735
  if (this.check(collection)) {
28741
28736
  return this;
@@ -29336,10 +29331,8 @@ class DefaultKeyValueDiffer {
29336
29331
  map = new Map();
29337
29332
  }
29338
29333
  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);
29334
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29335
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29343
29336
  }
29344
29337
  return this.check(map) ? this : null;
29345
29338
  }
@@ -29586,10 +29579,8 @@ class IterableDiffers {
29586
29579
  return factory;
29587
29580
  }
29588
29581
  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);
29582
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29583
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29593
29584
  }
29594
29585
  }
29595
29586
  }
@@ -29663,10 +29654,7 @@ class KeyValueDiffers {
29663
29654
  if (factory) {
29664
29655
  return factory;
29665
29656
  }
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);
29657
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29670
29658
  }
29671
29659
  }
29672
29660
  /** @nocollapse */