static-injector 3.0.0 → 4.0.1

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.
Files changed (77) hide show
  1. package/import/commonjs/index.js +65 -43
  2. package/import/es2022/di/index.js +1 -0
  3. package/import/es2022/di/initializer_token.js +1 -1
  4. package/import/es2022/di/inject_switch.js +1 -2
  5. package/import/es2022/di/injection_token.js +2 -0
  6. package/import/es2022/di/injector.js +3 -3
  7. package/import/es2022/di/injector_compatibility.js +23 -0
  8. package/import/es2022/di/injector_token.js +2 -3
  9. package/import/es2022/di/internal_tokens.js +1 -1
  10. package/import/es2022/di/r3_injector.js +15 -14
  11. package/import/es2022/di/scope.js +1 -1
  12. package/import/es2022/di.js +24 -0
  13. package/import/es2022/render3/errors_di.js +2 -2
  14. package/import/es2022/render3/instructions/di.js +7 -0
  15. package/import/es2022/util/array_utils.js +7 -0
  16. package/import/es2022/util/stringify.js +1 -1
  17. package/import/fesm2022/index.js +59 -37
  18. package/import/typings/di/create_injector.d.ts +2 -2
  19. package/import/typings/di/forward_ref.d.ts +1 -1
  20. package/import/typings/di/index.d.ts +1 -0
  21. package/import/typings/di/injector.d.ts +3 -3
  22. package/import/typings/di/injector_compatibility.d.ts +2 -1
  23. package/import/typings/di/injector_token.d.ts +1 -1
  24. package/import/typings/di/interface/provider.d.ts +12 -12
  25. package/import/typings/di/metadata.d.ts +2 -2
  26. package/import/typings/di/null_injector.d.ts +1 -1
  27. package/import/typings/di/r3_injector.d.ts +1 -1
  28. package/import/typings/di.d.ts +24 -0
  29. package/import/typings/errors.d.ts +4 -1
  30. package/import/typings/render3/errors_di.d.ts +2 -1
  31. package/import/typings/render3/instructions/di.d.ts +7 -0
  32. package/import/typings/util/array_utils.d.ts +7 -0
  33. package/import/typings/util/empty.d.ts +1 -1
  34. package/import/typings/util/stringify.d.ts +1 -1
  35. package/package.json +8 -6
  36. package/readme.md +33 -23
  37. package/transform/compiler/src/compiler.d.ts +0 -22
  38. package/transform/compiler/src/compiler.js +0 -26
  39. package/transform/compiler/src/core.d.ts +6 -0
  40. package/transform/compiler/src/core.js +13 -0
  41. package/transform/compiler/src/output/output_ast.d.ts +8 -6
  42. package/transform/compiler/src/output/output_ast.js +10 -6
  43. package/transform/compiler/src/render3/partial/api.d.ts +5 -0
  44. package/transform/compiler/src/render3/r3_identifiers.js +4 -0
  45. package/transform/compiler-cli/src/ngtsc/annotations/common/index.d.ts +0 -7
  46. package/transform/compiler-cli/src/ngtsc/annotations/common/index.js +0 -7
  47. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.d.ts +2 -3
  48. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.js +4 -31
  49. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.d.ts +3 -0
  50. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.js +14 -2
  51. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +5 -5
  52. package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +0 -7
  53. package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +0 -7
  54. package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +0 -7
  55. package/transform/compiler-cli/src/ngtsc/imports/index.js +0 -7
  56. package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +0 -7
  57. package/transform/compiler-cli/src/ngtsc/reflection/index.js +0 -7
  58. package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +7 -2
  59. package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +3 -1
  60. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +2 -1
  61. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +16 -5
  62. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +4 -3
  63. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +25 -9
  64. package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +0 -7
  65. package/transform/compiler-cli/src/ngtsc/transform/index.js +0 -7
  66. package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +1 -1
  67. package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +35 -24
  68. package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +0 -7
  69. package/transform/compiler-cli/src/ngtsc/translator/index.js +0 -7
  70. package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +1 -1
  71. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +21 -3
  72. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +13 -3
  73. package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +1 -0
  74. package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.d.ts +12 -0
  75. package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.js +27 -0
  76. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +3 -1
  77. package/transform/injectable-transform.js +1 -1
@@ -168,7 +168,7 @@ function stringify(token) {
168
168
  *
169
169
  * @param string
170
170
  * @param maxLength of the output string
171
- * @returns elispsed string with ... in the middle
171
+ * @returns ellipsed string with ... in the middle
172
172
  */
173
173
  function truncateMiddle(str, maxLength = 100) {
174
174
  if (!str || maxLength < 1 || str.length <= maxLength)
@@ -283,8 +283,8 @@ function isForwardRef(fn) {
283
283
  */
284
284
  /** Throws an error when a token is not found in DI. */
285
285
  function throwProviderNotFoundError(token, injectorName) {
286
- const injectorDetails = injectorName ? ` in ${injectorName}` : '';
287
- throw new RuntimeError(-201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */, null);
286
+ const errorMessage = null;
287
+ throw new RuntimeError(-201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */, errorMessage);
288
288
  }
289
289
 
290
290
  /**
@@ -466,7 +466,7 @@ function injectRootLimpMode(token, notFoundValue, flags) {
466
466
  return null;
467
467
  if (notFoundValue !== undefined)
468
468
  return notFoundValue;
469
- throwProviderNotFoundError(stringify(token), 'Injector');
469
+ throwProviderNotFoundError(token, 'Injector');
470
470
  }
471
471
 
472
472
  /**
@@ -531,6 +531,27 @@ function ɵɵinject(token, flags = exports.InjectFlags.Default) {
531
531
  function ɵɵinvalidFactoryDep(index) {
532
532
  throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, null);
533
533
  }
534
+ /**
535
+ * @param token A token that represents a static attribute on the host node that should be injected.
536
+ * @returns Value of the attribute if it exists.
537
+ * @throws If called outside of a supported context or the attribute does not exist.
538
+ *
539
+ * @publicApi
540
+ */
541
+ /**
542
+ * @param token A token that represents a static attribute on the host node that should be injected.
543
+ * @returns Value of the attribute if it exists, otherwise `null`.
544
+ * @throws If called outside of a supported context.
545
+ *
546
+ * @publicApi
547
+ */
548
+ /**
549
+ * @param token A token that represents a static attribute on the host node that should be injected.
550
+ * @returns Value of the attribute if it exists.
551
+ * @throws If called outside of a supported context or the attribute does not exist.
552
+ *
553
+ * @publicApi
554
+ */
534
555
  /**
535
556
  * Injects a token from the currently active injector.
536
557
  * `inject` is only supported in an [injection context](/guide/dependency-injection-context). It can
@@ -597,6 +618,8 @@ function ɵɵinvalidFactoryDep(index) {
597
618
  * @publicApi
598
619
  */
599
620
  function inject(token, flags = exports.InjectFlags.Default) {
621
+ // The `as any` here _shouldn't_ be necessary, but without it JSCompiler
622
+ // throws a disambiguation error due to the multiple signatures.
600
623
  return ɵɵinject(token, convertToBitFlags(flags));
601
624
  }
602
625
  // Converts object-based DI flags (`InjectOptions`) to bit flags (`InjectFlags`).
@@ -791,17 +814,6 @@ function getFactoryDef(type, throwNotFound) {
791
814
  return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
792
815
  }
793
816
 
794
- function deepForEach(input, fn) {
795
- input.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
796
- }
797
- function newArray(size, value) {
798
- const list = [];
799
- for (let i = 0; i < size; i++) {
800
- list.push(value);
801
- }
802
- return list;
803
- }
804
-
805
817
  /**
806
818
  * @license
807
819
  * Copyright Google LLC All Rights Reserved.
@@ -892,6 +904,8 @@ class InjectionToken {
892
904
  this._desc = _desc;
893
905
  this.ɵprov = undefined;
894
906
  if (typeof options == 'number') {
907
+ // This is a special hack to assign __NG_ELEMENT_ID__ to this instance.
908
+ // See `InjectorMarkers`
895
909
  }
896
910
  else if (options !== undefined) {
897
911
  this.ɵprov = ɵɵdefineInjectable({
@@ -925,7 +939,7 @@ class InjectionToken {
925
939
  *
926
940
  * @publicApi
927
941
  */
928
- const ENVIRONMENT_INITIALIZER = new InjectionToken('ENVIRONMENT_INITIALIZER');
942
+ const ENVIRONMENT_INITIALIZER = new InjectionToken('');
929
943
 
930
944
  /**
931
945
  * @license
@@ -942,11 +956,10 @@ const ENVIRONMENT_INITIALIZER = new InjectionToken('ENVIRONMENT_INITIALIZER');
942
956
  *
943
957
  * @publicApi
944
958
  */
945
- const INJECTOR = new InjectionToken('INJECTOR',
959
+ const INJECTOR = new InjectionToken('',
946
960
  // Disable tslint because this is const enum which gets inlined not top level prop access.
947
961
  // tslint:disable-next-line: no-toplevel-property-access
948
- -1 /* InjectorMarkers.Injector */ // Special value used by Ivy to identify `Injector`.
949
- );
962
+ -1 /* InjectorMarkers.Injector */);
950
963
 
951
964
  /**
952
965
  * @license
@@ -966,7 +979,7 @@ function isEnvironmentProviders(value) {
966
979
  * Use of this source code is governed by an MIT-style license that can be
967
980
  * found in the LICENSE file at https://angular.io/license
968
981
  */
969
- const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
982
+ const INJECTOR_DEF_TYPES = new InjectionToken('');
970
983
 
971
984
  /**
972
985
  * @license
@@ -1102,7 +1115,7 @@ function isClassProvider(value) {
1102
1115
  * as a root scoped injector when processing requests for unknown tokens which may indicate
1103
1116
  * they are provided in the root scope.
1104
1117
  */
1105
- const INJECTOR_SCOPE = new InjectionToken('Set Injector scope.');
1118
+ const INJECTOR_SCOPE = new InjectionToken('');
1106
1119
 
1107
1120
  /**
1108
1121
  * @license
@@ -1370,29 +1383,32 @@ class R3Injector extends EnvironmentInjector {
1370
1383
  multiRecord.multi.push(provider);
1371
1384
  }
1372
1385
  else {
1373
- const existing = this.records.get(token);
1374
1386
  if (false) {
1375
1387
  }
1376
1388
  }
1377
1389
  this.records.set(token, record);
1378
1390
  }
1379
1391
  hydrate(token, record) {
1380
- if (false) {
1381
- }
1382
- else if (record.value === NOT_YET) {
1383
- record.value = CIRCULAR;
1392
+ try {
1384
1393
  if (false) {
1385
1394
  }
1386
- else {
1387
- record.value = record.factory();
1395
+ else if (record.value === NOT_YET) {
1396
+ record.value = CIRCULAR;
1397
+ if (false) {
1398
+ }
1399
+ else {
1400
+ record.value = record.factory();
1401
+ }
1402
+ }
1403
+ if (typeof record.value === 'object' &&
1404
+ record.value &&
1405
+ hasOnDestroy(record.value)) {
1406
+ this._ngOnDestroyHooks.add(record.value);
1388
1407
  }
1408
+ return record.value;
1389
1409
  }
1390
- if (typeof record.value === 'object' &&
1391
- record.value &&
1392
- hasOnDestroy(record.value)) {
1393
- this._ngOnDestroyHooks.add(record.value);
1410
+ finally {
1394
1411
  }
1395
- return record.value;
1396
1412
  }
1397
1413
  injectableDefInScope(def) {
1398
1414
  if (!def.providedIn) {
@@ -1436,7 +1452,6 @@ function getUndecoratedInjectableFactory(token) {
1436
1452
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
1437
1453
  const paramLength = token.length;
1438
1454
  if (paramLength > 0) {
1439
- const args = newArray(paramLength, '?');
1440
1455
  throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, null);
1441
1456
  }
1442
1457
  // The constructor function appears to have no parameters.
@@ -1572,10 +1587,10 @@ function createInjectorWithoutInjectorInstances(defType, parent = null, addition
1572
1587
  */
1573
1588
  /**
1574
1589
  * Concrete injectors implement this interface. Injectors are configured
1575
- * with [providers](guide/glossary#provider) that associate
1576
- * dependencies of various types with [injection tokens](guide/glossary#di-token).
1590
+ * with [providers](guide/dependency-injection-providers) that associate
1591
+ * dependencies of various types with [injection tokens](guide/dependency-injection-providers).
1577
1592
  *
1578
- * @see ["DI Providers"](guide/dependency-injection-providers).
1593
+ * @see [DI Providers](guide/dependency-injection-providers).
1579
1594
  * @see {@link StaticProvider}
1580
1595
  *
1581
1596
  * @usageNotes
@@ -1619,6 +1634,13 @@ class Injector {
1619
1634
  static __NG_ELEMENT_ID__ = -1 /* InjectorMarkers.Injector */;
1620
1635
  }
1621
1636
 
1637
+ /**
1638
+ * @license
1639
+ * Copyright Google LLC All Rights Reserved.
1640
+ *
1641
+ * Use of this source code is governed by an MIT-style license that can be
1642
+ * found in the LICENSE file at https://angular.io/license
1643
+ */
1622
1644
  /**
1623
1645
  * Throws an error indicating that a factory function could not be generated by the compiler for a
1624
1646
  * particular class.
@@ -1714,9 +1736,9 @@ exports.injectInjectorOnly = injectInjectorOnly;
1714
1736
  exports.isInjectable = isInjectable;
1715
1737
  exports.providerToFactory = providerToFactory;
1716
1738
  exports.setCurrentInjector = setCurrentInjector;
1717
- exports["ɵɵdefineInjectable"] = ɵɵdefineInjectable;
1718
- exports["ɵɵdefineInjector"] = ɵɵdefineInjector;
1719
- exports["ɵɵgetInheritedFactory"] = ɵɵgetInheritedFactory;
1720
- exports["ɵɵinject"] = ɵɵinject;
1721
- exports["ɵɵinvalidFactory"] = ɵɵinvalidFactory;
1722
- exports["ɵɵinvalidFactoryDep"] = ɵɵinvalidFactoryDep;
1739
+ exports.ɵɵdefineInjectable = ɵɵdefineInjectable;
1740
+ exports.ɵɵdefineInjector = ɵɵdefineInjector;
1741
+ exports.ɵɵgetInheritedFactory = ɵɵgetInheritedFactory;
1742
+ exports.ɵɵinject = ɵɵinject;
1743
+ exports.ɵɵinvalidFactory = ɵɵinvalidFactory;
1744
+ exports.ɵɵinvalidFactoryDep = ɵɵinvalidFactoryDep;
@@ -0,0 +1 @@
1
+ export {};
@@ -12,4 +12,4 @@ import { InjectionToken } from './injection_token';
12
12
  *
13
13
  * @publicApi
14
14
  */
15
- export const ENVIRONMENT_INITIALIZER = new InjectionToken('ENVIRONMENT_INITIALIZER');
15
+ export const ENVIRONMENT_INITIALIZER = new InjectionToken('');
@@ -6,7 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { throwProviderNotFoundError } from '../render3/errors_di';
9
- import { stringify } from '../util/stringify';
10
9
  import { getInjectableDef } from './interface/defs';
11
10
  import { InjectFlags } from './interface/injector';
12
11
  /**
@@ -48,5 +47,5 @@ export function injectRootLimpMode(token, notFoundValue, flags) {
48
47
  return null;
49
48
  if (notFoundValue !== undefined)
50
49
  return notFoundValue;
51
- throwProviderNotFoundError(stringify(token), 'Injector');
50
+ throwProviderNotFoundError(token, 'Injector');
52
51
  }
@@ -70,6 +70,8 @@ export class InjectionToken {
70
70
  this._desc = _desc;
71
71
  this.ɵprov = undefined;
72
72
  if (typeof options == 'number') {
73
+ // This is a special hack to assign __NG_ELEMENT_ID__ to this instance.
74
+ // See `InjectorMarkers`
73
75
  }
74
76
  else if (options !== undefined) {
75
77
  this.ɵprov = ɵɵdefineInjectable({
@@ -12,10 +12,10 @@ import { ɵɵdefineInjectable } from './interface/defs';
12
12
  import { NullInjector } from './null_injector';
13
13
  /**
14
14
  * Concrete injectors implement this interface. Injectors are configured
15
- * with [providers](guide/glossary#provider) that associate
16
- * dependencies of various types with [injection tokens](guide/glossary#di-token).
15
+ * with [providers](guide/dependency-injection-providers) that associate
16
+ * dependencies of various types with [injection tokens](guide/dependency-injection-providers).
17
17
  *
18
- * @see ["DI Providers"](guide/dependency-injection-providers).
18
+ * @see [DI Providers](guide/dependency-injection-providers).
19
19
  * @see {@link StaticProvider}
20
20
  *
21
21
  * @usageNotes
@@ -65,6 +65,27 @@ export function ɵɵinject(token, flags = InjectFlags.Default) {
65
65
  export function ɵɵinvalidFactoryDep(index) {
66
66
  throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, null);
67
67
  }
68
+ /**
69
+ * @param token A token that represents a static attribute on the host node that should be injected.
70
+ * @returns Value of the attribute if it exists.
71
+ * @throws If called outside of a supported context or the attribute does not exist.
72
+ *
73
+ * @publicApi
74
+ */
75
+ /**
76
+ * @param token A token that represents a static attribute on the host node that should be injected.
77
+ * @returns Value of the attribute if it exists, otherwise `null`.
78
+ * @throws If called outside of a supported context.
79
+ *
80
+ * @publicApi
81
+ */
82
+ /**
83
+ * @param token A token that represents a static attribute on the host node that should be injected.
84
+ * @returns Value of the attribute if it exists.
85
+ * @throws If called outside of a supported context or the attribute does not exist.
86
+ *
87
+ * @publicApi
88
+ */
68
89
  /**
69
90
  * Injects a token from the currently active injector.
70
91
  * `inject` is only supported in an [injection context](/guide/dependency-injection-context). It can
@@ -131,6 +152,8 @@ export function ɵɵinvalidFactoryDep(index) {
131
152
  * @publicApi
132
153
  */
133
154
  export function inject(token, flags = InjectFlags.Default) {
155
+ // The `as any` here _shouldn't_ be necessary, but without it JSCompiler
156
+ // throws a disambiguation error due to the multiple signatures.
134
157
  return ɵɵinject(token, convertToBitFlags(flags));
135
158
  }
136
159
  // Converts object-based DI flags (`InjectOptions`) to bit flags (`InjectFlags`).
@@ -14,8 +14,7 @@ import { InjectionToken } from './injection_token';
14
14
  *
15
15
  * @publicApi
16
16
  */
17
- export const INJECTOR = new InjectionToken('INJECTOR',
17
+ export const INJECTOR = new InjectionToken('',
18
18
  // Disable tslint because this is const enum which gets inlined not top level prop access.
19
19
  // tslint:disable-next-line: no-toplevel-property-access
20
- -1 /* InjectorMarkers.Injector */ // Special value used by Ivy to identify `Injector`.
21
- );
20
+ -1 /* InjectorMarkers.Injector */);
@@ -6,4 +6,4 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { InjectionToken } from './injection_token';
9
- export const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
9
+ export const INJECTOR_DEF_TYPES = new InjectionToken('');
@@ -8,7 +8,6 @@
8
8
  import { RuntimeError } from '../errors';
9
9
  import { getFactoryDef } from '../render3/definition_factory';
10
10
  import { NG_ENV_ID } from '../render3/fields';
11
- import { newArray } from '../util/array_utils';
12
11
  import { EMPTY_ARRAY } from '../util/empty';
13
12
  import { stringify } from '../util/stringify';
14
13
  import { resolveForwardRef } from './forward_ref';
@@ -283,29 +282,32 @@ export class R3Injector extends EnvironmentInjector {
283
282
  multiRecord.multi.push(provider);
284
283
  }
285
284
  else {
286
- const existing = this.records.get(token);
287
285
  if (false) {
288
286
  }
289
287
  }
290
288
  this.records.set(token, record);
291
289
  }
292
290
  hydrate(token, record) {
293
- if (false) {
294
- }
295
- else if (record.value === NOT_YET) {
296
- record.value = CIRCULAR;
291
+ try {
297
292
  if (false) {
298
293
  }
299
- else {
300
- record.value = record.factory();
294
+ else if (record.value === NOT_YET) {
295
+ record.value = CIRCULAR;
296
+ if (false) {
297
+ }
298
+ else {
299
+ record.value = record.factory();
300
+ }
301
301
  }
302
+ if (typeof record.value === 'object' &&
303
+ record.value &&
304
+ hasOnDestroy(record.value)) {
305
+ this._ngOnDestroyHooks.add(record.value);
306
+ }
307
+ return record.value;
302
308
  }
303
- if (typeof record.value === 'object' &&
304
- record.value &&
305
- hasOnDestroy(record.value)) {
306
- this._ngOnDestroyHooks.add(record.value);
309
+ finally {
307
310
  }
308
- return record.value;
309
311
  }
310
312
  injectableDefInScope(def) {
311
313
  if (!def.providedIn) {
@@ -349,7 +351,6 @@ function getUndecoratedInjectableFactory(token) {
349
351
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
350
352
  const paramLength = token.length;
351
353
  if (paramLength > 0) {
352
- const args = newArray(paramLength, '?');
353
354
  throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, null);
354
355
  }
355
356
  // The constructor function appears to have no parameters.
@@ -11,4 +11,4 @@ import { InjectionToken } from './injection_token';
11
11
  * as a root scoped injector when processing requests for unknown tokens which may indicate
12
12
  * they are provided in the root scope.
13
13
  */
14
- export const INJECTOR_SCOPE = new InjectionToken('Set Injector scope.');
14
+ export const INJECTOR_SCOPE = new InjectionToken('');
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ /**
9
+ * This file should not be necessary because node resolution should just default to `./di/index`!
10
+ *
11
+ * However it does not seem to work and it breaks:
12
+ * - //packages/animations/browser/test:test_web_chromium-local
13
+ * - //packages/compiler-cli/test:extract_i18n
14
+ * - //packages/compiler-cli/test:ngc
15
+ * - //packages/compiler-cli/test:perform_watch
16
+ * - //packages/compiler-cli/test/diagnostics:check_types
17
+ * - //packages/compiler-cli/test/transformers:test
18
+ * - //packages/compiler/test:test
19
+ * - //tools/public_api_guard:core_api
20
+ *
21
+ * Remove this file once the above is solved or wait until `ngc` is deleted and then it should be
22
+ * safe to delete this file.
23
+ */
24
+ export * from './di/index';
@@ -8,6 +8,6 @@
8
8
  import { RuntimeError } from '../errors';
9
9
  /** Throws an error when a token is not found in DI. */
10
10
  export function throwProviderNotFoundError(token, injectorName) {
11
- const injectorDetails = injectorName ? ` in ${injectorName}` : '';
12
- throw new RuntimeError(-201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */, null);
11
+ const errorMessage = null;
12
+ throw new RuntimeError(-201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */, errorMessage);
13
13
  }
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  /**
2
9
  * Throws an error indicating that a factory function could not be generated by the compiler for a
3
10
  * particular class.
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  export function deepForEach(input, fn) {
2
9
  input.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
3
10
  }
@@ -33,7 +33,7 @@ export function stringify(token) {
33
33
  *
34
34
  * @param string
35
35
  * @param maxLength of the output string
36
- * @returns elispsed string with ... in the middle
36
+ * @returns ellipsed string with ... in the middle
37
37
  */
38
38
  export function truncateMiddle(str, maxLength = 100) {
39
39
  if (!str || maxLength < 1 || str.length <= maxLength)