@lppedd/di-wise-neo 0.19.0 → 0.21.0

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,4 +1,4 @@
1
- type ClassDecorator<Class extends object> = (target: Constructor<Class>) => Constructor<Class> | void;
1
+ type ClassDecorator<Class extends object> = <T extends Constructor<Class>>(target: T) => T | void;
2
2
  type ParameterDecorator = (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
3
3
 
4
4
  declare const Scope: {
@@ -34,7 +34,7 @@ interface RegistrationOptions {
34
34
  /**
35
35
  * Create a one-off type token from a factory function.
36
36
  *
37
- * @example
37
+ * Example:
38
38
  * ```ts
39
39
  * class Wizard {
40
40
  * wand = inject(
@@ -102,7 +102,7 @@ type Tokens<Value> = [Token<Value>, ...Token<Value>[]];
102
102
  /**
103
103
  * Creates a type token.
104
104
  *
105
- * @example
105
+ * Example:
106
106
  * ```ts
107
107
  * const ISpell = createType<Spell>("Spell");
108
108
  * container.register(ISpell, {
@@ -114,7 +114,7 @@ declare function createType<T>(typeName: string): Type<T>;
114
114
  /**
115
115
  * Creates a type token with a default {@link Provider} and optional default registration options.
116
116
  *
117
- * @example
117
+ * Example:
118
118
  * ```ts
119
119
  * // Notice how we pass in a Provider directly at type creation site
120
120
  * const ISpell = createType<Spell>("Spell", {
@@ -134,9 +134,7 @@ interface TokenRef<Value> {
134
134
  }
135
135
  /**
136
136
  * Allows referencing a class declared later in the file by wrapping it
137
- * in a lazily evaluated function.
138
- *
139
- * @__NO_SIDE_EFFECTS__
137
+ * into a lazily evaluated function.
140
138
  */
141
139
  declare function classRef<Instance extends object>(Class: () => Constructor<Instance>): ClassRef<Instance>;
142
140
  /**
@@ -159,7 +157,7 @@ interface ClassProvider<Instance extends object> {
159
157
  *
160
158
  * Equivalent to decorating the class with `@Named(...)`.
161
159
  *
162
- * @example
160
+ * Example:
163
161
  * ```ts
164
162
  * export class ExtensionContext {
165
163
  * // Decorator-based injection
@@ -187,7 +185,7 @@ interface FactoryProvider<Value> {
187
185
  * An optional name to qualify this provider.
188
186
  * If specified, the token must be resolved using the same name.
189
187
  *
190
- * @example
188
+ * Example:
191
189
  * ```ts
192
190
  * export class ExtensionContext {
193
191
  * // Decorator-based injection
@@ -212,7 +210,7 @@ interface ValueProvider<Value> {
212
210
  * An optional name to qualify this provider.
213
211
  * If specified, the token must be resolved using the same name.
214
212
  *
215
- * @example
213
+ * Example:
216
214
  * ```ts
217
215
  * export class ExtensionContext {
218
216
  * // Decorator-based injection
@@ -234,7 +232,7 @@ interface ExistingProvider<Value> {
234
232
  /**
235
233
  * The existing token to alias, with an optional name qualifier.
236
234
  *
237
- * @example
235
+ * Example:
238
236
  * ```ts
239
237
  * container.register(ISecretStorage, {
240
238
  * useExisting: PersistentSecretStorage,
@@ -251,7 +249,7 @@ interface ExistingProvider<Value> {
251
249
  * An optional name to qualify this provider.
252
250
  * If specified, the token must be resolved using the same name.
253
251
  *
254
- * @example
252
+ * Example:
255
253
  * ```ts
256
254
  * export class ExtensionContext {
257
255
  * // Decorator-based injection
@@ -350,7 +348,7 @@ interface Container {
350
348
  */
351
349
  createChild(options?: Partial<ChildContainerOptions>): Container;
352
350
  /**
353
- * Clears and returns all distinct values that were cached by this container.
351
+ * Clears and returns all distinct values cached by this container.
354
352
  * Values from {@link ValueProvider} registrations are not included, as they are never cached.
355
353
  *
356
354
  * Note that only this container is affected. Parent or child containers, if any, remain unchanged.
@@ -629,11 +627,13 @@ interface Container {
629
627
  * Disposes this container and all its cached values.
630
628
  *
631
629
  * Token values implementing a `Disposable` interface (e.g., objects with a `dispose()` function)
632
- * are automatically disposed during this process.
630
+ * are also disposed. All disposals, whether synchronous or asynchronous, are returned as promises
631
+ * in an array. Callers may await these promises (e.g., using `Promise.allSettled()`) if they want
632
+ * to ensure that all async work has completed.
633
633
  *
634
634
  * Note that children containers are disposed first, in creation order.
635
635
  */
636
- dispose(): void;
636
+ dispose(): Promise<unknown>[];
637
637
  }
638
638
  /**
639
639
  * Creates a new container.
@@ -644,7 +644,7 @@ declare function createContainer(options?: Partial<ContainerOptions>): Container
644
644
  * Class decorator that enables auto-registration of an unregistered class
645
645
  * when the class is first resolved from the container.
646
646
  *
647
- * @example
647
+ * Example:
648
648
  * ```ts
649
649
  * @AutoRegister()
650
650
  * class Wizard {}
@@ -652,8 +652,6 @@ declare function createContainer(options?: Partial<ContainerOptions>): Container
652
652
  * const wizard = container.resolve(Wizard);
653
653
  * container.isRegistered(Wizard); // => true
654
654
  * ```
655
- *
656
- * @__NO_SIDE_EFFECTS__
657
655
  */
658
656
  declare function AutoRegister<This extends object>(): ClassDecorator<This>;
659
657
 
@@ -664,7 +662,7 @@ declare function AutoRegister<This extends object>(): ClassDecorator<This>;
664
662
  * This causes the container to immediately create and cache the instance of the class,
665
663
  * instead of deferring instantiation until the first resolution.
666
664
  *
667
- * @example
665
+ * Example:
668
666
  * ```ts
669
667
  * @EagerInstantiate()
670
668
  * class Wizard {}
@@ -673,8 +671,6 @@ declare function AutoRegister<This extends object>(): ClassDecorator<This>;
673
671
  * // is immediately created and cached by the container
674
672
  * container.register(Wizard);
675
673
  * ```
676
- *
677
- * @__NO_SIDE_EFFECTS__
678
674
  */
679
675
  declare function EagerInstantiate<This extends object>(): ClassDecorator<This>;
680
676
 
@@ -699,15 +695,15 @@ declare function Inject<Value>(token: Token<Value>): ParameterDecorator;
699
695
  /**
700
696
  * Parameter decorator that injects the value associated with the given token.
701
697
  *
702
- * Allows referencing a token declared later in the file by using the
703
- * {@link tokenRef} helper function.
698
+ * This overload allows referencing a token declared later in the file by using
699
+ * the {@link tokenRef} helper function.
704
700
  *
705
701
  * Throws an error if:
706
702
  * - The token is not registered in the container.
707
703
  * - A circular dependency is detected. Use function injection with {@link injectBy}
708
704
  * if resolving circular dependencies is necessary.
709
705
  *
710
- * @example
706
+ * Example:
711
707
  * ```ts
712
708
  * class Wizard {
713
709
  * constructor(@Inject(tokenRef(() => Wand)) readonly wand: Wand) {}
@@ -719,39 +715,56 @@ declare function Inject<Value>(token: Token<Value>): ParameterDecorator;
719
715
  declare function Inject<Value>(tokens: TokenRef<Value>): ParameterDecorator;
720
716
 
721
717
  /**
722
- * Class decorator that registers additional aliasing tokens for the decorated type
723
- * when the type is first registered in the container.
718
+ * Class decorator that registers additional aliasing tokens for the decorated type.
724
719
  *
725
- * The container uses {@link ExistingProvider} under the hood.
720
+ * The aliases are added using {@link ExistingProvider}(s) when the class is first
721
+ * registered in the container.
726
722
  *
727
- * @example
723
+ * Example:
728
724
  * ```ts
729
725
  * @Injectable(Weapon)
730
- * class Wand {}
726
+ * class Rifle {}
727
+ * ```
728
+ *
729
+ * Note that `@Injectable` decorators can be stacked to add multiple aliases.
730
+ *
731
+ * Example:
732
+ * ```ts
733
+ * @Injectable(Weapon)
734
+ * @Injectable(Gun) // Or just @Injectable(Weapon, Gun)
735
+ * class Rifle {}
731
736
  * ```
732
737
  */
733
738
  declare function Injectable<Value, This extends Value & object>(token: Token<Value>): ClassDecorator<This>;
734
- declare function Injectable<VA, VB, This extends VA & VB & object>(tokenA: Token<VA>, //
735
- tokenB: Token<VB>): ClassDecorator<This>;
739
+ declare function Injectable<VA, VB, This extends VA & VB & object>(tokenA: Token<VA>, tokenB: Token<VB>): ClassDecorator<This>;
736
740
  declare function Injectable<VA, VB, VC, This extends VA & VB & VC & object>(tokenA: Token<VA>, tokenB: Token<VB>, tokenC: Token<VC>): ClassDecorator<This>;
737
741
  declare function Injectable<VA, VB, VC, VD, This extends VA & VB & VC & VD & object>(tokenA: Token<VA>, tokenB: Token<VB>, tokenC: Token<VC>, tokenD: Token<VD>): ClassDecorator<This>;
738
742
  declare function Injectable<VA, VB, VC, VD, VE, This extends VA & VB & VC & VD & VE & object>(tokenA: Token<VA>, tokenB: Token<VB>, tokenC: Token<VC>, tokenD: Token<VD>, tokenE: Token<VE>): ClassDecorator<This>;
739
743
  declare function Injectable<VA, VB, VC, VD, VE, VF, This extends VA & VB & VC & VD & VE & VF & object>(tokenA: Token<VA>, tokenB: Token<VB>, tokenC: Token<VC>, tokenD: Token<VD>, tokenE: Token<VE>, tokenF: Token<VF>): ClassDecorator<This>;
740
744
  /**
741
- * Class decorator that registers additional aliasing tokens for the decorated type
742
- * when the type is first registered in the container.
745
+ * Class decorator that registers an additional aliasing token for the decorated type.
743
746
  *
744
- * The container uses {@link ExistingProvider} under the hood.
747
+ * The alias is added using an {@link ExistingProvider} when the class is first
748
+ * registered in the container.
745
749
  *
746
- * Allows referencing tokens that are declared later in the file by using
747
- * the {@link tokenRef} helper function.
750
+ * This overload allows referencing tokens that are declared later in the file
751
+ * by using the {@link tokenRef} helper function.
748
752
  *
749
- * @example
753
+ * Example:
750
754
  * ```ts
751
- * @Injectable(tokenRef() => Weapon) // Weapon is declared after Wand
752
- * class Wizard {}
755
+ * @Injectable(tokenRef(() => Weapon)) // Weapon is declared after Rifle
756
+ * class Rifle {}
753
757
  * // Other code...
754
- * class Weapon {}
758
+ * const Weapon = createType("Weapon");
759
+ * ```
760
+ *
761
+ * Note that `@Injectable` decorators can be stacked to add multiple aliases.
762
+ *
763
+ * Example:
764
+ * ```ts
765
+ * @Injectable(tokenRef(() => Weapon))
766
+ * @Injectable(Gun)
767
+ * class Rifle {}
755
768
  * ```
756
769
  */
757
770
  declare function Injectable<Value, This extends Value & object>(tokens: TokenRef<Value>): ClassDecorator<This>;
@@ -778,14 +791,14 @@ declare function InjectAll<Value>(token: Token<Value>): ParameterDecorator;
778
791
  * Parameter decorator that injects all values provided by the registrations
779
792
  * associated with the given token.
780
793
  *
781
- * Allows referencing a token declared later in the file by using the
782
- * {@link tokenRef} helper function.
794
+ * This overload allows referencing a token declared later in the file by using
795
+ * the {@link tokenRef} helper function.
783
796
  *
784
797
  * Throws an error if:
785
798
  * - The token is not registered in the container.
786
799
  * - A circular dependency is detected.
787
800
  *
788
- * @example
801
+ * Example:
789
802
  * ```ts
790
803
  * class Wizard {
791
804
  * constructor(@InjectAll(tokenRef(() => Wand)) readonly wands: Wand[]) {}
@@ -802,7 +815,7 @@ declare function InjectAll<Value>(tokens: TokenRef<Value>): ParameterDecorator;
802
815
  * This allows the container to distinguish between multiple implementations
803
816
  * of the same interface or type during registration and injection.
804
817
  *
805
- * @example
818
+ * Example:
806
819
  * ```ts
807
820
  * @Named("dumbledore")
808
821
  * class Dumbledore implements Wizard {}
@@ -811,8 +824,6 @@ declare function InjectAll<Value>(tokens: TokenRef<Value>): ParameterDecorator;
811
824
  * container.register(IWizard, { useClass: Dumbledore });
812
825
  * const dumbledore = container.resolve(IWizard, "dumbledore");
813
826
  * ```
814
- *
815
- * @__NO_SIDE_EFFECTS__
816
827
  */
817
828
  declare function Named<This extends object>(name: string): ClassDecorator<This> & ParameterDecorator;
818
829
 
@@ -836,13 +847,13 @@ declare function Optional<Value>(token: Token<Value>): ParameterDecorator;
836
847
  * Parameter decorator that injects the value associated with the given token,
837
848
  * or `undefined` if the token is not registered in the container.
838
849
  *
839
- * Allows referencing a token declared later in the file by using the
840
- * {@link tokenRef} helper function.
850
+ * This overload allows referencing a token declared later in the file by using
851
+ * the {@link tokenRef} helper function.
841
852
  *
842
853
  * Throws an error if a circular dependency is detected. Use function injection
843
854
  * with {@link optionalBy} if resolving circular dependencies is necessary.
844
855
  *
845
- * @example
856
+ * Example:
846
857
  * ```ts
847
858
  * class Wizard {
848
859
  * constructor(@Optional(tokenRef(() => Wand)) readonly wand: Wand | undefined) {}
@@ -874,12 +885,12 @@ declare function OptionalAll<Value>(token: Token<Value>): ParameterDecorator;
874
885
  * associated with the given token or an empty array if the token is not registered
875
886
  * in the container.
876
887
  *
877
- * Allows referencing a token declared later in the file by using the
878
- * {@link tokenRef} helper function.
888
+ * This overload allows referencing a token declared later in the file by using
889
+ * the {@link tokenRef} helper function.
879
890
  *
880
891
  * Throws an error if a circular dependency is detected.
881
892
  *
882
- * @example
893
+ * Example:
883
894
  * ```ts
884
895
  * class Wizard {
885
896
  * constructor(@OptionalAll(tokenRef(() => Wand)) readonly wands: Wand[]) {}
@@ -895,7 +906,7 @@ declare function OptionalAll<Value>(tokens: TokenRef<Value>): ParameterDecorator
895
906
  *
896
907
  * The scope set by this decorator can be overridden by explicit registration options, if provided.
897
908
  *
898
- * @example
909
+ * Example:
899
910
  * ```ts
900
911
  * @Scoped("Container")
901
912
  * class Wizard {}
@@ -909,8 +920,6 @@ declare function OptionalAll<Value>(tokens: TokenRef<Value>): ParameterDecorator
909
920
  * { scope: "Container" },
910
921
  * );
911
922
  * ```
912
- *
913
- * @__NO_SIDE_EFFECTS__
914
923
  */
915
924
  declare function Scoped<This extends object>(scope: Scope): ClassDecorator<This>;
916
925
 
@@ -958,7 +967,7 @@ declare function injectAll<Value>(token: Token<Value>): Value[];
958
967
  * Compared to {@link inject}, `injectBy` accepts a `thisArg` argument
959
968
  * (e.g., the containing class instance) which is used to resolve circular dependencies.
960
969
  *
961
- * @example
970
+ * Example:
962
971
  * ```ts
963
972
  * class Wand {
964
973
  * owner = inject(Wizard);
@@ -982,7 +991,7 @@ declare function injectBy<Instance extends object>(thisArg: any, Class: Construc
982
991
  * Compared to {@link inject}, `injectBy` accepts a `thisArg` argument
983
992
  * (e.g., the containing class instance) which is used to resolve circular dependencies.
984
993
  *
985
- * @example
994
+ * Example:
986
995
  * ```ts
987
996
  * class Wand {
988
997
  * owner = inject(Wizard);
@@ -1011,7 +1020,7 @@ declare function assertInjectionContext(fn: Function | string): void;
1011
1020
  /**
1012
1021
  * Allows performing injections outside the normal injection context window.
1013
1022
  *
1014
- * @example
1023
+ * Example:
1015
1024
  * ```ts
1016
1025
  * class Wizard {
1017
1026
  * private injector = inject(Injector);
@@ -1021,7 +1030,7 @@ declare function assertInjectionContext(fn: Function | string): void;
1021
1030
  *
1022
1031
  * getWand(): Wand {
1023
1032
  * // An injection context does not exist here, but the
1024
- * // Injector instance retains and reuse the context
1033
+ * // Injector instance retains and reuses the context
1025
1034
  * // that was present at the time of its injection
1026
1035
  * return (this.wand ??= this.injector.inject(Wand));
1027
1036
  * }
@@ -1088,7 +1097,7 @@ interface Injector {
1088
1097
  /**
1089
1098
  * Allows performing injections outside the normal injection context window.
1090
1099
  *
1091
- * @example
1100
+ * Example:
1092
1101
  * ```ts
1093
1102
  * class Wizard {
1094
1103
  * private injector = inject(Injector);
@@ -1098,7 +1107,7 @@ interface Injector {
1098
1107
  *
1099
1108
  * getWand(): Wand {
1100
1109
  * // An injection context does not exist here, but the
1101
- * // Injector instance retains and reuse the context
1110
+ * // Injector instance retains and reuses the context
1102
1111
  * // that was present at the time of its injection
1103
1112
  * return (this.wand ??= this.injector.inject(Wand));
1104
1113
  * }
package/dist/cjs/index.js CHANGED
@@ -57,7 +57,7 @@ function getTokenName(token) {
57
57
  }
58
58
  function getFullTokenName([token, name]) {
59
59
  const tokenName = token ? token.name || "<unnamed>" : "<undefined token>";
60
- return name ? `${tokenName}["${name}"]` : tokenName;
60
+ return name !== undefined ? `${tokenName}["${name}"]` : tokenName;
61
61
  }
62
62
  function getCause(error) {
63
63
  if (!error) {
@@ -218,10 +218,9 @@ function injectBy(thisArg, token, name) {
218
218
 
219
219
  /**
220
220
  * Allows referencing a class declared later in the file by wrapping it
221
- * in a lazily evaluated function.
222
- *
223
- * @__NO_SIDE_EFFECTS__
224
- */ function classRef(Class) {
221
+ * into a lazily evaluated function.
222
+ */ // @__NO_SIDE_EFFECTS__
223
+ function classRef(Class) {
225
224
  return {
226
225
  getRefClass: ()=>Class()
227
226
  };
@@ -545,8 +544,12 @@ class TokenRegistry {
545
544
  return registrations;
546
545
  }
547
546
  deleteAll() {
548
- const tokens = Array.from(this.myRegistrations.keys());
549
- const registrations = Array.from(this.myRegistrations.values()).flat();
547
+ const tokens = [
548
+ ...this.myRegistrations.keys()
549
+ ];
550
+ const registrations = [
551
+ ...this.myRegistrations.values()
552
+ ].flat();
550
553
  this.myRegistrations.clear();
551
554
  return [
552
555
  tokens,
@@ -564,7 +567,9 @@ class TokenRegistry {
564
567
  registration.valueRef = undefined;
565
568
  }
566
569
  }
567
- return Array.from(values);
570
+ return [
571
+ ...values
572
+ ];
568
573
  }
569
574
  getAllFromParent(token, name) {
570
575
  let registrations = this.myRegistrations.get(token) || this.myParent?.getAllFromParent(token, name);
@@ -662,7 +667,9 @@ function isDisposable(value) {
662
667
  values.add(valueRef.current);
663
668
  }
664
669
  }
665
- return Array.from(values);
670
+ return [
671
+ ...values
672
+ ];
666
673
  }
667
674
  resetRegistry() {
668
675
  this.checkDisposed();
@@ -673,7 +680,9 @@ function isDisposable(value) {
673
680
  values.add(valueRef.current);
674
681
  }
675
682
  }
676
- return Array.from(values);
683
+ return [
684
+ ...values
685
+ ];
677
686
  }
678
687
  isRegistered(token, name) {
679
688
  this.checkDisposed();
@@ -702,7 +711,9 @@ function isDisposable(value) {
702
711
  values.add(valueRef.current);
703
712
  }
704
713
  }
705
- return Array.from(values);
714
+ return [
715
+ ...values
716
+ ];
706
717
  }
707
718
  resolve(token, name) {
708
719
  this.checkDisposed();
@@ -728,13 +739,14 @@ function isDisposable(value) {
728
739
  }
729
740
  dispose() {
730
741
  if (this.myDisposed) {
731
- return;
742
+ return [];
732
743
  }
744
+ this.myDisposed = true;
745
+ const promises = [];
733
746
  // Dispose children containers first
734
747
  for (const child of this.myChildren){
735
- child.dispose();
748
+ promises.push(...child.dispose());
736
749
  }
737
- this.myDisposed = true;
738
750
  this.myChildren.clear();
739
751
  this.myParent?.myChildren?.delete(this);
740
752
  const [, registrations] = this.myTokenRegistry.deleteAll();
@@ -751,11 +763,18 @@ function isDisposable(value) {
751
763
  }
752
764
  for (const value of allValues){
753
765
  if (isDisposable(value)) {
754
- value.dispose();
766
+ try {
767
+ promises.push(Promise.resolve(value.dispose()));
768
+ } catch (e) {
769
+ promises.push(Promise.reject(e));
770
+ }
755
771
  }
756
772
  }
757
- this.notifyDisposeHooks(Array.from(cacheValues));
773
+ this.notifyDisposeHooks([
774
+ ...cacheValues
775
+ ]);
758
776
  this.myHookRegistry.clear();
777
+ return promises;
759
778
  }
760
779
  registerClass(Class) {
761
780
  const metadata = getMetadata(Class);
@@ -1098,7 +1117,7 @@ function isDisposable(value) {
1098
1117
  * Class decorator that enables auto-registration of an unregistered class
1099
1118
  * when the class is first resolved from the container.
1100
1119
  *
1101
- * @example
1120
+ * Example:
1102
1121
  * ```ts
1103
1122
  * @AutoRegister()
1104
1123
  * class Wizard {}
@@ -1106,9 +1125,8 @@ function isDisposable(value) {
1106
1125
  * const wizard = container.resolve(Wizard);
1107
1126
  * container.isRegistered(Wizard); // => true
1108
1127
  * ```
1109
- *
1110
- * @__NO_SIDE_EFFECTS__
1111
- */ function AutoRegister() {
1128
+ */ // @__NO_SIDE_EFFECTS__
1129
+ function AutoRegister() {
1112
1130
  return function(Class) {
1113
1131
  const metadata = getMetadata(Class);
1114
1132
  metadata.autoRegister = true;
@@ -1122,7 +1140,7 @@ function isDisposable(value) {
1122
1140
  * This causes the container to immediately create and cache the instance of the class,
1123
1141
  * instead of deferring instantiation until the first resolution.
1124
1142
  *
1125
- * @example
1143
+ * Example:
1126
1144
  * ```ts
1127
1145
  * @EagerInstantiate()
1128
1146
  * class Wizard {}
@@ -1131,9 +1149,8 @@ function isDisposable(value) {
1131
1149
  * // is immediately created and cached by the container
1132
1150
  * container.register(Wizard);
1133
1151
  * ```
1134
- *
1135
- * @__NO_SIDE_EFFECTS__
1136
- */ function EagerInstantiate() {
1152
+ */ // @__NO_SIDE_EFFECTS__
1153
+ function EagerInstantiate() {
1137
1154
  return function(Class) {
1138
1155
  const metadata = getMetadata(Class);
1139
1156
  const currentScope = metadata.scope;
@@ -1199,7 +1216,7 @@ function InjectAll(token) {
1199
1216
  * This allows the container to distinguish between multiple implementations
1200
1217
  * of the same interface or type during registration and injection.
1201
1218
  *
1202
- * @example
1219
+ * Example:
1203
1220
  * ```ts
1204
1221
  * @Named("dumbledore")
1205
1222
  * class Dumbledore implements Wizard {}
@@ -1208,9 +1225,8 @@ function InjectAll(token) {
1208
1225
  * container.register(IWizard, { useClass: Dumbledore });
1209
1226
  * const dumbledore = container.resolve(IWizard, "dumbledore");
1210
1227
  * ```
1211
- *
1212
- * @__NO_SIDE_EFFECTS__
1213
- */ function Named(name) {
1228
+ */ // @__NO_SIDE_EFFECTS__
1229
+ function Named(name) {
1214
1230
  check(name.trim(), "@Named qualifier must not be empty");
1215
1231
  return function(target, propertyKey, parameterIndex) {
1216
1232
  if (parameterIndex === undefined) {
@@ -1262,7 +1278,7 @@ function OptionalAll(token) {
1262
1278
  *
1263
1279
  * The scope set by this decorator can be overridden by explicit registration options, if provided.
1264
1280
  *
1265
- * @example
1281
+ * Example:
1266
1282
  * ```ts
1267
1283
  * @Scoped("Container")
1268
1284
  * class Wizard {}
@@ -1276,9 +1292,8 @@ function OptionalAll(token) {
1276
1292
  * { scope: "Container" },
1277
1293
  * );
1278
1294
  * ```
1279
- *
1280
- * @__NO_SIDE_EFFECTS__
1281
- */ function Scoped(scope) {
1295
+ */ // @__NO_SIDE_EFFECTS__
1296
+ function Scoped(scope) {
1282
1297
  return function(Class) {
1283
1298
  const metadata = getMetadata(Class);
1284
1299
  const currentScope = metadata.scope;
@@ -1298,7 +1313,7 @@ function OptionalAll(token) {
1298
1313
  /**
1299
1314
  * Allows performing injections outside the normal injection context window.
1300
1315
  *
1301
- * @example
1316
+ * Example:
1302
1317
  * ```ts
1303
1318
  * class Wizard {
1304
1319
  * private injector = inject(Injector);
@@ -1308,13 +1323,13 @@ function OptionalAll(token) {
1308
1323
  *
1309
1324
  * getWand(): Wand {
1310
1325
  * // An injection context does not exist here, but the
1311
- * // Injector instance retains and reuse the context
1326
+ * // Injector instance retains and reuses the context
1312
1327
  * // that was present at the time of its injection
1313
1328
  * return (this.wand ??= this.injector.inject(Wand));
1314
1329
  * }
1315
1330
  * }
1316
1331
  * ```
1317
- */ const Injector = /*@__PURE__*/ build(()=>{
1332
+ */ const Injector = /* @__PURE__ */ build(()=>{
1318
1333
  const context = ensureInjectionContext("Injector factory");
1319
1334
  const runInContext = (fn)=>{
1320
1335
  if (useInjectionContext()) {