@angular/core 14.1.0-next.2 → 14.1.0-next.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 v14.1.0-next.2
2
+ * @license Angular v14.1.0-next.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -863,6 +863,68 @@ const NG_INJ_DEF = getClosureSafeProperty({ ɵinj: getClosureSafeProperty });
863
863
  const NG_INJECTABLE_DEF = getClosureSafeProperty({ ngInjectableDef: getClosureSafeProperty });
864
864
  const NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafeProperty });
865
865
 
866
+ /**
867
+ * @license
868
+ * Copyright Google LLC All Rights Reserved.
869
+ *
870
+ * Use of this source code is governed by an MIT-style license that can be
871
+ * found in the LICENSE file at https://angular.io/license
872
+ */
873
+ /**
874
+ * Base URL for the error details page.
875
+ *
876
+ * Keep the files below in full sync:
877
+ * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
878
+ * - packages/core/src/error_details_base_url.ts
879
+ */
880
+ const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
881
+
882
+ /**
883
+ * @license
884
+ * Copyright Google LLC All Rights Reserved.
885
+ *
886
+ * Use of this source code is governed by an MIT-style license that can be
887
+ * found in the LICENSE file at https://angular.io/license
888
+ */
889
+ /**
890
+ * Class that represents a runtime error.
891
+ * Formats and outputs the error message in a consistent way.
892
+ *
893
+ * Example:
894
+ * ```
895
+ * throw new RuntimeError(
896
+ * RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
897
+ * ngDevMode && 'Injector has already been destroyed.');
898
+ * ```
899
+ *
900
+ * Note: the `message` argument contains a descriptive error message as a string in development
901
+ * mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the
902
+ * `message` argument becomes `false`, thus we account for it in the typings and the runtime logic.
903
+ */
904
+ class RuntimeError extends Error {
905
+ constructor(code, message) {
906
+ super(formatRuntimeError(code, message));
907
+ this.code = code;
908
+ }
909
+ }
910
+ /**
911
+ * Called to format a runtime error.
912
+ * See additional info on the `message` argument type in the `RuntimeError` class description.
913
+ */
914
+ function formatRuntimeError(code, message) {
915
+ // Error code might be a negative number, which is a special marker that instructs the logic to
916
+ // generate a link to the error details page on angular.io.
917
+ const fullCode = `NG0${Math.abs(code)}`;
918
+ let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
919
+ if (ngDevMode && code < 0) {
920
+ const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
921
+ const separator = addPeriodSeparator ? '.' : '';
922
+ errorMessage =
923
+ `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
924
+ }
925
+ return errorMessage;
926
+ }
927
+
866
928
  /**
867
929
  * @license
868
930
  * Copyright Google LLC All Rights Reserved.
@@ -1791,68 +1853,6 @@ function initNgDevMode() {
1791
1853
  return false;
1792
1854
  }
1793
1855
 
1794
- /**
1795
- * @license
1796
- * Copyright Google LLC All Rights Reserved.
1797
- *
1798
- * Use of this source code is governed by an MIT-style license that can be
1799
- * found in the LICENSE file at https://angular.io/license
1800
- */
1801
- /**
1802
- * Base URL for the error details page.
1803
- *
1804
- * Keep the files below in full sync:
1805
- * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
1806
- * - packages/core/src/error_details_base_url.ts
1807
- */
1808
- const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
1809
-
1810
- /**
1811
- * @license
1812
- * Copyright Google LLC All Rights Reserved.
1813
- *
1814
- * Use of this source code is governed by an MIT-style license that can be
1815
- * found in the LICENSE file at https://angular.io/license
1816
- */
1817
- /**
1818
- * Class that represents a runtime error.
1819
- * Formats and outputs the error message in a consistent way.
1820
- *
1821
- * Example:
1822
- * ```
1823
- * throw new RuntimeError(
1824
- * RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
1825
- * ngDevMode && 'Injector has already been destroyed.');
1826
- * ```
1827
- *
1828
- * Note: the `message` argument contains a descriptive error message as a string in development
1829
- * mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the
1830
- * `message` argument becomes `false`, thus we account for it in the typings and the runtime logic.
1831
- */
1832
- class RuntimeError extends Error {
1833
- constructor(code, message) {
1834
- super(formatRuntimeError(code, message));
1835
- this.code = code;
1836
- }
1837
- }
1838
- /**
1839
- * Called to format a runtime error.
1840
- * See additional info on the `message` argument type in the `RuntimeError` class description.
1841
- */
1842
- function formatRuntimeError(code, message) {
1843
- // Error code might be a negative number, which is a special marker that instructs the logic to
1844
- // generate a link to the error details page on angular.io.
1845
- const fullCode = `NG0${Math.abs(code)}`;
1846
- let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
1847
- if (ngDevMode && code < 0) {
1848
- const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
1849
- const separator = addPeriodSeparator ? '.' : '';
1850
- errorMessage =
1851
- `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
1852
- }
1853
- return errorMessage;
1854
- }
1855
-
1856
1856
  /**
1857
1857
  * @license
1858
1858
  * Copyright Google LLC All Rights Reserved.
@@ -2063,22 +2063,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
2063
2063
  * Throws an error indicating that a factory function could not be generated by the compiler for a
2064
2064
  * particular class.
2065
2065
  *
2066
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
2067
- * off, saving bytes of generated code while still providing a good experience in dev mode.
2068
- *
2069
2066
  * The name of the class is not mentioned here, but will be in the generated factory function name
2070
2067
  * and thus in the stack trace.
2071
2068
  *
2072
2069
  * @codeGenApi
2073
2070
  */
2074
2071
  function ɵɵinvalidFactoryDep(index) {
2075
- const msg = ngDevMode ?
2072
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
2076
2073
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
2077
2074
  This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
2078
2075
 
2079
- Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.` :
2080
- 'invalid';
2081
- throw new Error(msg);
2076
+ Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
2082
2077
  }
2083
2078
  /**
2084
2079
  * Injects a token from the currently active injector.
@@ -3260,8 +3255,17 @@ var RendererStyleFlags3;
3260
3255
  function isProceduralRenderer(renderer) {
3261
3256
  return !!(renderer.listen);
3262
3257
  }
3258
+ let renderer3Enabled = false;
3259
+ function enableRenderer3() {
3260
+ renderer3Enabled = true;
3261
+ }
3263
3262
  const domRendererFactory3 = {
3264
3263
  createRenderer: (hostElement, rendererType) => {
3264
+ if (!renderer3Enabled) {
3265
+ throw new Error(ngDevMode ?
3266
+ `Renderer3 is not supported. This problem is likely caused by some component in the hierarchy was constructed without a correct parent injector.` :
3267
+ 'Renderer3 disabled');
3268
+ }
3265
3269
  return getDocument();
3266
3270
  }
3267
3271
  };
@@ -5476,7 +5480,7 @@ function reflectDependency(dep) {
5476
5480
  }
5477
5481
  else if (param instanceof Attribute) {
5478
5482
  if (param.attributeName === undefined) {
5479
- throw new Error(`Attribute name must be defined.`);
5483
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5480
5484
  }
5481
5485
  meta.attribute = param.attributeName;
5482
5486
  }
@@ -10119,7 +10123,7 @@ class ReflectiveKey {
10119
10123
  this.token = token;
10120
10124
  this.id = id;
10121
10125
  if (!token) {
10122
- throw new Error('Token must be defined!');
10126
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
10123
10127
  }
10124
10128
  this.displayName = stringify(this.token);
10125
10129
  }
@@ -14190,6 +14194,7 @@ const NULL_INJECTOR = {
14190
14194
  function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
14191
14195
  ngDevMode && publishDefaultGlobalUtils();
14192
14196
  ngDevMode && assertComponentType(componentType);
14197
+ enableRenderer3();
14193
14198
  const rendererFactory = opts.rendererFactory || domRendererFactory3;
14194
14199
  const sanitizer = opts.sanitizer || null;
14195
14200
  const componentDef = getComponentDef$1(componentType);
@@ -19499,7 +19504,7 @@ function findLocaleData(locale) {
19499
19504
  if (parentLocale === 'en') {
19500
19505
  return localeEn;
19501
19506
  }
19502
- throw new Error(`Missing locale data for the locale "${locale}".`);
19507
+ throw new RuntimeError(701 /* RuntimeErrorCode.MISSING_LOCALE_DATA */, ngDevMode && `Missing locale data for the locale "${locale}".`);
19503
19508
  }
19504
19509
  /**
19505
19510
  * Retrieves the default currency code for the given locale.
@@ -22075,7 +22080,7 @@ class Version {
22075
22080
  /**
22076
22081
  * @publicApi
22077
22082
  */
22078
- const VERSION = new Version('14.1.0-next.2');
22083
+ const VERSION = new Version('14.1.0-next.3');
22079
22084
 
22080
22085
  /**
22081
22086
  * @license