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