@codefast/di 0.5.0 → 0.6.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.
Files changed (266) hide show
  1. package/CHANGELOG.md +615 -0
  2. package/README.md +119 -30
  3. package/dist/ambient/active-container.d.ts +37 -0
  4. package/dist/ambient/active-container.d.ts.map +1 -0
  5. package/dist/ambient/active-container.js +41 -0
  6. package/dist/ambient/active-container.js.map +1 -0
  7. package/dist/container/binding-builders.d.ts +12 -8
  8. package/dist/container/binding-builders.d.ts.map +1 -1
  9. package/dist/container/binding-builders.js +56 -31
  10. package/dist/container/binding-builders.js.map +1 -1
  11. package/dist/container/container.d.ts +33 -19
  12. package/dist/container/container.d.ts.map +1 -1
  13. package/dist/container/container.js +279 -118
  14. package/dist/container/container.js.map +1 -1
  15. package/dist/{resolution → core}/binding-scope.d.ts +2 -2
  16. package/dist/core/binding-scope.d.ts.map +1 -0
  17. package/dist/core/binding-scope.js.map +1 -0
  18. package/dist/{binding.d.ts → core/binding.d.ts} +70 -15
  19. package/dist/core/binding.d.ts.map +1 -0
  20. package/dist/{binding.js → core/binding.js} +27 -12
  21. package/dist/core/binding.js.map +1 -0
  22. package/dist/core/constraint-requirement.d.ts +38 -0
  23. package/dist/core/constraint-requirement.d.ts.map +1 -0
  24. package/dist/core/constraint-requirement.js +28 -0
  25. package/dist/core/constraint-requirement.js.map +1 -0
  26. package/dist/{constructor-type.d.ts → core/constructor-type.d.ts} +1 -1
  27. package/dist/core/constructor-type.d.ts.map +1 -0
  28. package/dist/core/constructor-type.js.map +1 -0
  29. package/dist/{module.d.ts → core/module.d.ts} +5 -5
  30. package/dist/core/module.d.ts.map +1 -0
  31. package/dist/{module.js → core/module.js} +4 -4
  32. package/dist/core/module.js.map +1 -0
  33. package/dist/{registry.d.ts → core/registry.d.ts} +27 -7
  34. package/dist/core/registry.d.ts.map +1 -0
  35. package/dist/{registry.js → core/registry.js} +125 -52
  36. package/dist/core/registry.js.map +1 -0
  37. package/dist/core/tag.d.ts +80 -0
  38. package/dist/core/tag.d.ts.map +1 -0
  39. package/dist/core/tag.js +84 -0
  40. package/dist/core/tag.js.map +1 -0
  41. package/dist/{token.d.ts → core/token.d.ts} +2 -6
  42. package/dist/core/token.d.ts.map +1 -0
  43. package/dist/core/token.js +13 -0
  44. package/dist/core/token.js.map +1 -0
  45. package/dist/{types.d.ts → core/types.d.ts} +27 -21
  46. package/dist/core/types.d.ts.map +1 -0
  47. package/dist/core/types.js.map +1 -0
  48. package/dist/decorators/inject.d.ts +5 -49
  49. package/dist/decorators/inject.d.ts.map +1 -1
  50. package/dist/decorators/inject.js +34 -104
  51. package/dist/decorators/inject.js.map +1 -1
  52. package/dist/decorators/injectable.d.ts +25 -5
  53. package/dist/decorators/injectable.d.ts.map +1 -1
  54. package/dist/decorators/injectable.js +2 -3
  55. package/dist/decorators/injectable.js.map +1 -1
  56. package/dist/decorators/lifecycle-decorators.d.ts +4 -2
  57. package/dist/decorators/lifecycle-decorators.d.ts.map +1 -1
  58. package/dist/decorators/lifecycle-decorators.js +19 -25
  59. package/dist/decorators/lifecycle-decorators.js.map +1 -1
  60. package/dist/{resolution → errors}/diagnostics.d.ts +2 -0
  61. package/dist/errors/diagnostics.d.ts.map +1 -0
  62. package/dist/errors/diagnostics.js.map +1 -0
  63. package/dist/{errors.d.ts → errors/errors.d.ts} +89 -4
  64. package/dist/errors/errors.d.ts.map +1 -0
  65. package/dist/{errors.js → errors/errors.js} +129 -7
  66. package/dist/errors/errors.js.map +1 -0
  67. package/dist/index.d.ts +21 -14
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +15 -7
  70. package/dist/index.js.map +1 -1
  71. package/dist/injection/descriptor.d.ts +79 -0
  72. package/dist/injection/descriptor.d.ts.map +1 -0
  73. package/dist/injection/descriptor.js +118 -0
  74. package/dist/injection/descriptor.js.map +1 -0
  75. package/dist/{resolution → injection}/resolve-options.d.ts +21 -11
  76. package/dist/injection/resolve-options.d.ts.map +1 -0
  77. package/dist/injection/resolve-options.js +101 -0
  78. package/dist/injection/resolve-options.js.map +1 -0
  79. package/dist/introspection/dependency-graph.d.ts +16 -5
  80. package/dist/introspection/dependency-graph.d.ts.map +1 -1
  81. package/dist/introspection/dependency-graph.js +138 -57
  82. package/dist/introspection/dependency-graph.js.map +1 -1
  83. package/dist/introspection/graph-adapters/cytoscape.d.ts +6 -3
  84. package/dist/introspection/graph-adapters/cytoscape.d.ts.map +1 -1
  85. package/dist/introspection/graph-adapters/cytoscape.js +3 -0
  86. package/dist/introspection/graph-adapters/cytoscape.js.map +1 -1
  87. package/dist/introspection/graph-adapters/dot.d.ts.map +1 -1
  88. package/dist/introspection/graph-adapters/dot.js +12 -5
  89. package/dist/introspection/graph-adapters/dot.js.map +1 -1
  90. package/dist/introspection/graph-adapters/mermaid.d.ts +9 -0
  91. package/dist/introspection/graph-adapters/mermaid.d.ts.map +1 -0
  92. package/dist/introspection/graph-adapters/mermaid.js +47 -0
  93. package/dist/introspection/graph-adapters/mermaid.js.map +1 -0
  94. package/dist/introspection/graph-adapters/reactflow.d.ts +6 -3
  95. package/dist/introspection/graph-adapters/reactflow.d.ts.map +1 -1
  96. package/dist/introspection/graph-adapters/reactflow.js +5 -1
  97. package/dist/introspection/graph-adapters/reactflow.js.map +1 -1
  98. package/dist/introspection/inspector.d.ts +4 -4
  99. package/dist/introspection/inspector.d.ts.map +1 -1
  100. package/dist/introspection/inspector.js +10 -6
  101. package/dist/introspection/inspector.js.map +1 -1
  102. package/dist/lifecycle/lifecycle-manager.d.ts +27 -0
  103. package/dist/lifecycle/lifecycle-manager.d.ts.map +1 -0
  104. package/dist/{resolution/lifecycle.js → lifecycle/lifecycle-manager.js} +39 -9
  105. package/dist/lifecycle/lifecycle-manager.js.map +1 -0
  106. package/dist/lifecycle/scope-manager.d.ts +48 -0
  107. package/dist/lifecycle/scope-manager.d.ts.map +1 -0
  108. package/dist/lifecycle/scope-manager.js +135 -0
  109. package/dist/lifecycle/scope-manager.js.map +1 -0
  110. package/dist/metadata/metadata-reader-token.d.ts +1 -1
  111. package/dist/metadata/metadata-reader-token.d.ts.map +1 -1
  112. package/dist/metadata/metadata-reader-token.js +1 -1
  113. package/dist/metadata/metadata-reader-token.js.map +1 -1
  114. package/dist/metadata/metadata-types.d.ts +9 -9
  115. package/dist/metadata/metadata-types.d.ts.map +1 -1
  116. package/dist/metadata/symbol-metadata-reader.d.ts +19 -6
  117. package/dist/metadata/symbol-metadata-reader.d.ts.map +1 -1
  118. package/dist/metadata/symbol-metadata-reader.js +89 -9
  119. package/dist/metadata/symbol-metadata-reader.js.map +1 -1
  120. package/dist/metadata/verifying-metadata-reader.d.ts +16 -0
  121. package/dist/metadata/verifying-metadata-reader.d.ts.map +1 -0
  122. package/dist/metadata/verifying-metadata-reader.js +32 -0
  123. package/dist/metadata/verifying-metadata-reader.js.map +1 -0
  124. package/dist/resolution/{activation-need.d.ts → cache/activation-need.d.ts} +5 -5
  125. package/dist/resolution/cache/activation-need.d.ts.map +1 -0
  126. package/dist/resolution/cache/activation-need.js.map +1 -0
  127. package/dist/resolution/{binding-lookup-cache.d.ts → cache/binding-lookup-cache.d.ts} +6 -5
  128. package/dist/resolution/cache/binding-lookup-cache.d.ts.map +1 -0
  129. package/dist/resolution/cache/binding-lookup-cache.js.map +1 -0
  130. package/dist/resolution/cache/class-introspector.d.ts +66 -0
  131. package/dist/resolution/cache/class-introspector.d.ts.map +1 -0
  132. package/dist/resolution/cache/class-introspector.js +194 -0
  133. package/dist/resolution/cache/class-introspector.js.map +1 -0
  134. package/dist/resolution/context.d.ts +84 -0
  135. package/dist/resolution/context.d.ts.map +1 -0
  136. package/dist/resolution/{environment.js → context.js} +54 -80
  137. package/dist/resolution/context.js.map +1 -0
  138. package/dist/resolution/path/resolution-path.d.ts +94 -0
  139. package/dist/resolution/path/resolution-path.d.ts.map +1 -0
  140. package/dist/resolution/path/resolution-path.js +117 -0
  141. package/dist/resolution/path/resolution-path.js.map +1 -0
  142. package/dist/resolution/{instantiation-plan.d.ts → plan/instantiation-plan.d.ts} +30 -7
  143. package/dist/resolution/plan/instantiation-plan.d.ts.map +1 -0
  144. package/dist/resolution/plan/instantiation-plan.js +390 -0
  145. package/dist/resolution/plan/instantiation-plan.js.map +1 -0
  146. package/dist/resolution/resolver.d.ts +28 -28
  147. package/dist/resolution/resolver.d.ts.map +1 -1
  148. package/dist/resolution/resolver.js +552 -239
  149. package/dist/resolution/resolver.js.map +1 -1
  150. package/dist/resolution/select/binding-select.d.ts +34 -0
  151. package/dist/resolution/select/binding-select.d.ts.map +1 -0
  152. package/dist/resolution/select/binding-select.js +175 -0
  153. package/dist/resolution/select/binding-select.js.map +1 -0
  154. package/dist/resolution/{constraints.d.ts → select/constraints.d.ts} +13 -12
  155. package/dist/resolution/select/constraints.d.ts.map +1 -0
  156. package/dist/resolution/{constraints.js → select/constraints.js} +33 -22
  157. package/dist/resolution/select/constraints.js.map +1 -0
  158. package/package.json +160 -20
  159. package/src/ambient/active-container.ts +65 -0
  160. package/src/container/binding-builders.ts +72 -44
  161. package/src/container/container.ts +355 -170
  162. package/src/{resolution → core}/binding-scope.ts +2 -2
  163. package/src/{binding.ts → core/binding.ts} +101 -39
  164. package/src/core/constraint-requirement.ts +51 -0
  165. package/src/{constructor-type.ts → core/constructor-type.ts} +1 -1
  166. package/src/{module.ts → core/module.ts} +10 -10
  167. package/src/core/registry.ts +365 -0
  168. package/src/core/tag.ts +144 -0
  169. package/src/{token.ts → core/token.ts} +2 -14
  170. package/src/{types.ts → core/types.ts} +37 -34
  171. package/src/decorators/inject.ts +39 -175
  172. package/src/decorators/injectable.ts +40 -10
  173. package/src/decorators/lifecycle-decorators.ts +22 -34
  174. package/src/{resolution → errors}/diagnostics.ts +2 -0
  175. package/src/{errors.ts → errors/errors.ts} +152 -8
  176. package/src/index.ts +43 -15
  177. package/src/injection/descriptor.ts +206 -0
  178. package/src/injection/resolve-options.ts +144 -0
  179. package/src/introspection/dependency-graph.ts +223 -63
  180. package/src/introspection/graph-adapters/cytoscape.ts +9 -3
  181. package/src/introspection/graph-adapters/dot.ts +13 -5
  182. package/src/introspection/graph-adapters/mermaid.ts +61 -0
  183. package/src/introspection/graph-adapters/reactflow.ts +11 -4
  184. package/src/introspection/inspector.ts +16 -12
  185. package/src/{resolution/lifecycle.ts → lifecycle/lifecycle-manager.ts} +68 -32
  186. package/src/lifecycle/scope-manager.ts +156 -0
  187. package/src/metadata/metadata-reader-token.ts +2 -2
  188. package/src/metadata/metadata-types.ts +9 -9
  189. package/src/metadata/symbol-metadata-reader.ts +95 -18
  190. package/src/metadata/verifying-metadata-reader.ts +41 -0
  191. package/src/resolution/{activation-need.ts → cache/activation-need.ts} +8 -8
  192. package/src/resolution/{binding-lookup-cache.ts → cache/binding-lookup-cache.ts} +6 -5
  193. package/src/resolution/cache/class-introspector.ts +251 -0
  194. package/src/resolution/{environment.ts → context.ts} +84 -145
  195. package/src/resolution/path/resolution-path.ts +167 -0
  196. package/src/resolution/plan/instantiation-plan.ts +579 -0
  197. package/src/resolution/resolver.ts +635 -313
  198. package/src/resolution/select/binding-select.ts +210 -0
  199. package/src/resolution/select/constraints.ts +130 -0
  200. package/dist/binding.d.ts.map +0 -1
  201. package/dist/binding.js.map +0 -1
  202. package/dist/constructor-type.d.ts.map +0 -1
  203. package/dist/constructor-type.js.map +0 -1
  204. package/dist/errors.d.ts.map +0 -1
  205. package/dist/errors.js.map +0 -1
  206. package/dist/module.d.ts.map +0 -1
  207. package/dist/module.js.map +0 -1
  208. package/dist/registry.d.ts.map +0 -1
  209. package/dist/registry.js.map +0 -1
  210. package/dist/resolution/activation-need.d.ts.map +0 -1
  211. package/dist/resolution/activation-need.js.map +0 -1
  212. package/dist/resolution/binding-lookup-cache.d.ts.map +0 -1
  213. package/dist/resolution/binding-lookup-cache.js.map +0 -1
  214. package/dist/resolution/binding-scope.d.ts.map +0 -1
  215. package/dist/resolution/binding-scope.js.map +0 -1
  216. package/dist/resolution/binding-select.d.ts +0 -23
  217. package/dist/resolution/binding-select.d.ts.map +0 -1
  218. package/dist/resolution/binding-select.js +0 -121
  219. package/dist/resolution/binding-select.js.map +0 -1
  220. package/dist/resolution/class-introspector.d.ts +0 -27
  221. package/dist/resolution/class-introspector.d.ts.map +0 -1
  222. package/dist/resolution/class-introspector.js +0 -60
  223. package/dist/resolution/class-introspector.js.map +0 -1
  224. package/dist/resolution/constraints.d.ts.map +0 -1
  225. package/dist/resolution/constraints.js.map +0 -1
  226. package/dist/resolution/diagnostics.d.ts.map +0 -1
  227. package/dist/resolution/diagnostics.js.map +0 -1
  228. package/dist/resolution/environment.d.ts +0 -94
  229. package/dist/resolution/environment.d.ts.map +0 -1
  230. package/dist/resolution/environment.js.map +0 -1
  231. package/dist/resolution/instantiation-plan.d.ts.map +0 -1
  232. package/dist/resolution/instantiation-plan.js +0 -183
  233. package/dist/resolution/instantiation-plan.js.map +0 -1
  234. package/dist/resolution/lifecycle.d.ts +0 -23
  235. package/dist/resolution/lifecycle.d.ts.map +0 -1
  236. package/dist/resolution/lifecycle.js.map +0 -1
  237. package/dist/resolution/resolution-path.d.ts +0 -98
  238. package/dist/resolution/resolution-path.d.ts.map +0 -1
  239. package/dist/resolution/resolution-path.js +0 -98
  240. package/dist/resolution/resolution-path.js.map +0 -1
  241. package/dist/resolution/resolve-options.d.ts.map +0 -1
  242. package/dist/resolution/resolve-options.js +0 -56
  243. package/dist/resolution/resolve-options.js.map +0 -1
  244. package/dist/resolution/scope.d.ts +0 -28
  245. package/dist/resolution/scope.d.ts.map +0 -1
  246. package/dist/resolution/scope.js +0 -88
  247. package/dist/resolution/scope.js.map +0 -1
  248. package/dist/token.d.ts.map +0 -1
  249. package/dist/token.js +0 -22
  250. package/dist/token.js.map +0 -1
  251. package/dist/types.d.ts.map +0 -1
  252. package/dist/types.js.map +0 -1
  253. package/src/registry.ts +0 -282
  254. package/src/resolution/binding-select.ts +0 -154
  255. package/src/resolution/class-introspector.ts +0 -74
  256. package/src/resolution/constraints.ts +0 -121
  257. package/src/resolution/instantiation-plan.ts +0 -292
  258. package/src/resolution/resolution-path.ts +0 -156
  259. package/src/resolution/resolve-options.ts +0 -89
  260. package/src/resolution/scope.ts +0 -105
  261. /package/dist/{resolution → core}/binding-scope.js +0 -0
  262. /package/dist/{constructor-type.js → core/constructor-type.js} +0 -0
  263. /package/dist/{types.js → core/types.js} +0 -0
  264. /package/dist/{resolution → errors}/diagnostics.js +0 -0
  265. /package/dist/resolution/{activation-need.js → cache/activation-need.js} +0 -0
  266. /package/dist/resolution/{binding-lookup-cache.js → cache/binding-lookup-cache.js} +0 -0
@@ -1,4 +1,4 @@
1
- import type { BindingIdentifier, BindingScope, ResolveOptions } from "#/types";
1
+ import type { BindingIdentifier, BindingScope, ResolveOptions } from "#/core/types";
2
2
  /**
3
3
  * @since 0.3.16-canary.0
4
4
  */
@@ -53,9 +53,11 @@ export declare class CircularDependencyError extends DiError {
53
53
  */
54
54
  export declare class AsyncResolutionError extends DiError {
55
55
  readonly code = "ASYNC_RESOLUTION";
56
+ /** The token the caller asked for — what `resolveAsync` has to be called with. */
56
57
  readonly tokenName: string;
58
+ /** The token whose factory is async: `tokenName` itself unless a dependency forced it. */
57
59
  readonly asyncSourceToken: string;
58
- constructor(tokenName: string, asyncSourceToken: string);
60
+ constructor(tokenName: string, asyncSourceToken?: string);
59
61
  }
60
62
  /**
61
63
  * @since 0.3.16-canary.0
@@ -83,6 +85,66 @@ export declare class ScopeViolationError extends DiError {
83
85
  readonly details: ScopeViolationDetails;
84
86
  constructor(details: ScopeViolationDetails);
85
87
  }
88
+ /**
89
+ * A `…TaggedAll` constraint built from a criteria list with nothing in it.
90
+ *
91
+ * @remarks Reported where the list is passed rather than where it fails to match, because it does
92
+ * not fail to match — "carries all of no criteria" holds for any ancestor, so the constraint quietly
93
+ * becomes a weaker one that still outranks an unconstrained binding.
94
+ *
95
+ * @since 0.6.0
96
+ */
97
+ export declare class EmptyTagCriteriaError extends DiError {
98
+ readonly code = "EMPTY_TAG_CRITERIA";
99
+ readonly helperName: string;
100
+ constructor(helperName: string);
101
+ }
102
+ /**
103
+ * A constraint waiting on a slot name that nothing in the container chain declares.
104
+ *
105
+ * @remarks A name is a bare string, so a typo produces a constraint that is never satisfied and
106
+ * never reported. Reported by `validate()` rather than at bind time, because the binding carrying
107
+ * the name may be registered after the constraint is built.
108
+ *
109
+ * @since 0.6.0
110
+ */
111
+ export declare class UnreachableConstraintError extends DiError {
112
+ readonly code = "UNREACHABLE_CONSTRAINT";
113
+ readonly tokenName: string;
114
+ readonly requiredName: string;
115
+ readonly helperName: string;
116
+ constructor(tokenName: string, requiredName: string, helperName: string);
117
+ }
118
+ /**
119
+ * A container-level lifecycle hook whose token nothing is bound to, so it can never run.
120
+ *
121
+ * @remarks Hooks are keyed by token identity, which makes a class that is only ever a `to()` target
122
+ * look like a token and match nothing. Reported by `validate()` rather than at registration, because
123
+ * binding after registering the hook is a supported order.
124
+ *
125
+ * @since 0.6.0
126
+ */
127
+ export declare class UnreachableLifecycleHookError extends DiError {
128
+ readonly code = "UNREACHABLE_LIFECYCLE_HOOK";
129
+ readonly tokenName: string;
130
+ readonly phase: "onActivation" | "onDeactivation";
131
+ constructor(tokenName: string, phase: "onActivation" | "onDeactivation");
132
+ }
133
+ /**
134
+ * A {@link MetadataReader} described a class with something the container cannot use.
135
+ *
136
+ * @remarks Separate from {@link MissingMetadataError}: absent metadata is a class the container was
137
+ * never told about, while invalid metadata is a reader that answered wrongly. Covers both the
138
+ * constructor answer and the lifecycle one, since only the `reason` differs.
139
+ *
140
+ * @since 0.6.0
141
+ */
142
+ export declare class InvalidMetadataError extends DiError {
143
+ readonly code = "INVALID_METADATA";
144
+ readonly targetName: string;
145
+ readonly reason: string;
146
+ constructor(targetName: string, reason: string);
147
+ }
86
148
  /**
87
149
  * @since 0.3.16-canary.0
88
150
  */
@@ -115,12 +177,20 @@ export declare class MissingScopeContextError extends DiError {
115
177
  constructor(tokenName: string);
116
178
  }
117
179
  /**
180
+ * An `@inject` accessor initialized with no container context open.
181
+ *
182
+ * @remarks Carries the class and the accessor separately: a nameless class is possible (an anonymous
183
+ * class expression has an empty `name`), and a message that claims a class it does not have is what
184
+ * sent readers looking for a class called `clock`.
185
+ *
118
186
  * @since 0.3.16-canary.0
119
187
  */
120
188
  export declare class MissingContainerContextError extends DiError {
121
189
  readonly code = "MISSING_CONTAINER_CONTEXT";
122
- readonly targetName: string;
123
- constructor(targetName: string);
190
+ /** The class being constructed, or `undefined` when it has no readable name. */
191
+ readonly className: string | undefined;
192
+ readonly accessorName: string | symbol;
193
+ constructor(className: string | undefined, accessorName: string | symbol);
124
194
  }
125
195
  /**
126
196
  * A fluent chain was refined before a `to*()` call gave it a binding to refine.
@@ -154,6 +224,21 @@ export declare class SelfBindingRequiresClassError extends DiError {
154
224
  readonly tokenName: string;
155
225
  constructor(tokenName: string);
156
226
  }
227
+ /**
228
+ * A decorator that acts on one instance was applied to a static member.
229
+ *
230
+ * @remarks Instance-only by construction: `@inject` resolves through the container active while an
231
+ * instance is built, and `@postConstruct`/`@preDestroy` bracket one instance's lifecycle. A static
232
+ * member belongs to the class, which no container constructs.
233
+ *
234
+ * @since 0.6.0
235
+ */
236
+ export declare class StaticMemberDecoratorError extends DiError {
237
+ readonly code = "STATIC_MEMBER_DECORATOR";
238
+ readonly decoratorName: string;
239
+ readonly memberName: string;
240
+ constructor(decoratorName: string, memberName: string);
241
+ }
157
242
  /**
158
243
  * @since 0.3.16-canary.0
159
244
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEpF;;GAEG;AACH,8BAAsB,OAAQ,SAAQ,KAAK;IACzC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED;;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AC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC,YAAY,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,cAAc,EAAE,UAAU,CAAC,EAAE,MAAM,EAS7F;CACF"}
@@ -27,6 +27,17 @@ export class TokenNotBoundError extends DiError {
27
27
  this.tokenName = tokenName;
28
28
  }
29
29
  }
30
+ // Options carry caller values a tag may hold — a bigint or a circular object must not make the
31
+ // diagnostic itself throw and mask the real error.
32
+ function describeResolveOptions(options) {
33
+ try {
34
+ return (JSON.stringify(options, (_key, value) => (typeof value === "bigint" ? `${String(value)}n` : value)) ??
35
+ "undefined");
36
+ }
37
+ catch {
38
+ return "[unserializable options]";
39
+ }
40
+ }
30
41
  /**
31
42
  * @since 0.3.16-canary.0
32
43
  */
@@ -36,7 +47,7 @@ export class NoMatchingBindingError extends DiError {
36
47
  options;
37
48
  availableSlots;
38
49
  constructor(tokenName, options, availableSlots) {
39
- const optionsString = JSON.stringify(options);
50
+ const optionsString = describeResolveOptions(options);
40
51
  const slotsStr = availableSlots.join(", ");
41
52
  super(`No binding for '${tokenName}' matching ${optionsString}. Available slots: [${slotsStr}].`);
42
53
  this.tokenName = tokenName;
@@ -73,10 +84,14 @@ export class CircularDependencyError extends DiError {
73
84
  */
74
85
  export class AsyncResolutionError extends DiError {
75
86
  code = "ASYNC_RESOLUTION";
87
+ /** The token the caller asked for — what `resolveAsync` has to be called with. */
76
88
  tokenName;
89
+ /** The token whose factory is async: `tokenName` itself unless a dependency forced it. */
77
90
  asyncSourceToken;
78
- constructor(tokenName, asyncSourceToken) {
79
- super(`Token '${tokenName}' requires async resolution because '${asyncSourceToken}' in its dependency chain has an async factory. Use container.resolveAsync(${tokenName}).`);
91
+ constructor(tokenName, asyncSourceToken = tokenName) {
92
+ super(asyncSourceToken === tokenName
93
+ ? `Token '${tokenName}' requires async resolution because its factory is async. Use container.resolveAsync(${tokenName}).`
94
+ : `Token '${tokenName}' requires async resolution because '${asyncSourceToken}' in its dependency chain has an async factory. Use container.resolveAsync(${tokenName}).`);
80
95
  this.tokenName = tokenName;
81
96
  this.asyncSourceToken = asyncSourceToken;
82
97
  }
@@ -103,6 +118,82 @@ export class ScopeViolationError extends DiError {
103
118
  this.details = details;
104
119
  }
105
120
  }
121
+ /**
122
+ * A `…TaggedAll` constraint built from a criteria list with nothing in it.
123
+ *
124
+ * @remarks Reported where the list is passed rather than where it fails to match, because it does
125
+ * not fail to match — "carries all of no criteria" holds for any ancestor, so the constraint quietly
126
+ * becomes a weaker one that still outranks an unconstrained binding.
127
+ *
128
+ * @since 0.6.0
129
+ */
130
+ export class EmptyTagCriteriaError extends DiError {
131
+ code = "EMPTY_TAG_CRITERIA";
132
+ helperName;
133
+ constructor(helperName) {
134
+ super(`${helperName}() was given no criteria. An empty list matches any ancestor, which is not what the call says — pass the criteria to require, or drop the constraint if there are none.`);
135
+ this.helperName = helperName;
136
+ }
137
+ }
138
+ /**
139
+ * A constraint waiting on a slot name that nothing in the container chain declares.
140
+ *
141
+ * @remarks A name is a bare string, so a typo produces a constraint that is never satisfied and
142
+ * never reported. Reported by `validate()` rather than at bind time, because the binding carrying
143
+ * the name may be registered after the constraint is built.
144
+ *
145
+ * @since 0.6.0
146
+ */
147
+ export class UnreachableConstraintError extends DiError {
148
+ code = "UNREACHABLE_CONSTRAINT";
149
+ tokenName;
150
+ requiredName;
151
+ helperName;
152
+ constructor(tokenName, requiredName, helperName) {
153
+ super(`The binding for '${tokenName}' is constrained by ${helperName}('${requiredName}'), but no binding in this container or its ancestors declares the slot name '${requiredName}', so the constraint can never hold. Name the slot with .whenNamed('${requiredName}') on the binding it should match, or correct the name here.`);
154
+ this.tokenName = tokenName;
155
+ this.requiredName = requiredName;
156
+ this.helperName = helperName;
157
+ }
158
+ }
159
+ /**
160
+ * A container-level lifecycle hook whose token nothing is bound to, so it can never run.
161
+ *
162
+ * @remarks Hooks are keyed by token identity, which makes a class that is only ever a `to()` target
163
+ * look like a token and match nothing. Reported by `validate()` rather than at registration, because
164
+ * binding after registering the hook is a supported order.
165
+ *
166
+ * @since 0.6.0
167
+ */
168
+ export class UnreachableLifecycleHookError extends DiError {
169
+ code = "UNREACHABLE_LIFECYCLE_HOOK";
170
+ tokenName;
171
+ phase;
172
+ constructor(tokenName, phase) {
173
+ super(`${phase}() is registered for '${tokenName}', which nothing is bound to in this container or its ancestors, so the hook can never run. Bind the token, or — if '${tokenName}' is a class you bound as an implementation via .to(${tokenName}) — register the hook against the token you bound instead.`);
174
+ this.tokenName = tokenName;
175
+ this.phase = phase;
176
+ }
177
+ }
178
+ /**
179
+ * A {@link MetadataReader} described a class with something the container cannot use.
180
+ *
181
+ * @remarks Separate from {@link MissingMetadataError}: absent metadata is a class the container was
182
+ * never told about, while invalid metadata is a reader that answered wrongly. Covers both the
183
+ * constructor answer and the lifecycle one, since only the `reason` differs.
184
+ *
185
+ * @since 0.6.0
186
+ */
187
+ export class InvalidMetadataError extends DiError {
188
+ code = "INVALID_METADATA";
189
+ targetName;
190
+ reason;
191
+ constructor(targetName, reason) {
192
+ super(`MetadataReader returned invalid metadata for class '${targetName}': ${reason}. Check the reader bound to MetadataReaderToken or passed to Container.create().`);
193
+ this.targetName = targetName;
194
+ this.reason = reason;
195
+ }
196
+ }
106
197
  /**
107
198
  * @since 0.3.16-canary.0
108
199
  */
@@ -146,14 +237,26 @@ export class MissingScopeContextError extends DiError {
146
237
  }
147
238
  }
148
239
  /**
240
+ * An `@inject` accessor initialized with no container context open.
241
+ *
242
+ * @remarks Carries the class and the accessor separately: a nameless class is possible (an anonymous
243
+ * class expression has an empty `name`), and a message that claims a class it does not have is what
244
+ * sent readers looking for a class called `clock`.
245
+ *
149
246
  * @since 0.3.16-canary.0
150
247
  */
151
248
  export class MissingContainerContextError extends DiError {
152
249
  code = "MISSING_CONTAINER_CONTEXT";
153
- targetName;
154
- constructor(targetName) {
155
- super(`Class '${targetName}' has @inject accessor fields but was instantiated outside a container context. Resolve it via container.resolve(${targetName}) instead.`);
156
- this.targetName = targetName;
250
+ /** The class being constructed, or `undefined` when it has no readable name. */
251
+ className;
252
+ accessorName;
253
+ constructor(className, accessorName) {
254
+ const accessor = `@inject accessor '${String(accessorName)}'`;
255
+ super(className === undefined
256
+ ? `An ${accessor} was initialized outside a container context. Resolve its class through a container, or open a context with runWithContainer().`
257
+ : `Class '${className}' has an ${accessor} but was constructed outside a container context. Resolve it via container.resolve(${className}), or open a context with runWithContainer().`);
258
+ this.className = className;
259
+ this.accessorName = accessorName;
157
260
  }
158
261
  }
159
262
  /**
@@ -197,6 +300,25 @@ export class SelfBindingRequiresClassError extends DiError {
197
300
  this.tokenName = tokenName;
198
301
  }
199
302
  }
303
+ /**
304
+ * A decorator that acts on one instance was applied to a static member.
305
+ *
306
+ * @remarks Instance-only by construction: `@inject` resolves through the container active while an
307
+ * instance is built, and `@postConstruct`/`@preDestroy` bracket one instance's lifecycle. A static
308
+ * member belongs to the class, which no container constructs.
309
+ *
310
+ * @since 0.6.0
311
+ */
312
+ export class StaticMemberDecoratorError extends DiError {
313
+ code = "STATIC_MEMBER_DECORATOR";
314
+ decoratorName;
315
+ memberName;
316
+ constructor(decoratorName, memberName) {
317
+ super(`@${decoratorName}() applies to instance members only, and '${memberName}' is static. Move it to an instance member, or read the value from the container where the static member is used.`);
318
+ this.decoratorName = decoratorName;
319
+ this.memberName = memberName;
320
+ }
321
+ }
200
322
  /**
201
323
  * @since 0.3.16-canary.0
202
324
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IAGzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO;IAC/B,IAAI,GA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,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,29 +1,36 @@
1
- export type { ActivationHandler, BindingIdentifier, BindingKind, BindingScope, BindingTag, ConstraintContext, Constructor, DependencyKey, DeactivationHandler, ResolutionFrame, ResolveOptions, ResolutionContext, TokenValue, } from "#/types";
2
- export { token, tokenName, isToken } from "#/token";
3
- export type { Token } from "#/token";
4
- export type { AliasBindingBuilder, BindToBuilder, BindingBuilder, ConstantBindingBuilder, ScopedBindingBuilder, SingletonBindingBuilder, SingletonLifecycleBuilder, SlotConstrainedBuilder, TransientBindingBuilder, } from "#/binding";
1
+ export type { ActivationHandler, BindingConstraint, BindingIdentifier, BindingKind, BindingScope, BindingTag, ConstraintContext, Constructor, DependencyKey, DeactivationHandler, ResolutionFrame, ResolveOptions, ResolutionContext, TokenValue, } from "#/core/types";
2
+ export { token, tokenName } from "#/core/token";
3
+ export type { Token } from "#/core/token";
4
+ export { coversTagKeys, NO_TAG_KEYS, tag, tagKeyMaskOf } from "#/core/tag";
5
+ export type { TagKey, TagKeyMask } from "#/core/tag";
6
+ export type { AliasBindingBuilder, BindToBuilder, BindingBuilder, ConstantBindingBuilder, ScopedBindingBuilder, SingletonBindingBuilder, SingletonLifecycleBuilder, SlotConstrainedBuilder, TransientBindingBuilder, } from "#/core/binding";
5
7
  export { Container } from "#/container/container";
6
- export type { Container as ContainerInterface, ContainerStatic } from "#/container/container";
7
- export { injectionSlotToResolveOptions, bindingSlotToResolveOptions } from "#/resolution/resolve-options";
8
+ export type { Container as ContainerInterface, ContainerOptions, ContainerStatic } from "#/container/container";
9
+ export { getActiveContainer, runWithContainer } from "#/ambient/active-container";
10
+ export { bindingSlotToResolveOptions, injectionSlotToResolveOptions, resolveOptionsForSlot, } from "#/injection/resolve-options";
11
+ export type { DependencySlot } from "#/injection/resolve-options";
8
12
  export type { BindingSnapshot, ContainerSnapshot } from "#/introspection/inspector";
9
13
  export type { ContainerGraphJson, GraphEdge, GraphNode, GraphOptions } from "#/introspection/dependency-graph";
10
- export { AsyncModule, isSyncModule, Module, SyncModule } from "#/module";
11
- export type { AsyncModuleBuilder, ModuleBuilder } from "#/module";
12
- export { inject, injectAll, isInjectionDescriptor, optional } from "#/decorators/inject";
13
- export type { InjectionDescriptor, InjectOptions } from "#/decorators/inject";
14
+ export { AsyncModule, isSyncModule, Module, SyncModule } from "#/core/module";
15
+ export type { AsyncModuleBuilder, ModuleBuilder } from "#/core/module";
16
+ export { inject } from "#/decorators/inject";
17
+ export { injectAll, isInjectionDescriptor, optional } from "#/injection/descriptor";
18
+ export type { InjectionDescriptor, InjectOptions } from "#/injection/descriptor";
14
19
  export { injectable } from "#/decorators/injectable";
15
20
  export type { InjectableDependency, InjectableOptions } from "#/decorators/injectable";
16
21
  export { postConstruct, preDestroy } from "#/decorators/lifecycle-decorators";
17
22
  export { createAutoRegisterRegistry } from "#/decorators/injectable";
18
23
  export type { AutoRegisterRegistry } from "#/decorators/injectable";
19
24
  export { MetadataReaderToken } from "#/metadata/metadata-reader-token";
20
- export type { MetadataReader, MutableLifecycleMetadata } from "#/metadata/metadata-types";
21
- export { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll, } from "#/resolution/constraints";
22
- export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, ChainNotRegisteredError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SelfBindingRequiresClassError, SyncDisposalNotSupportedError, TokenNotBoundError, } from "#/errors";
23
- export type { ScopeViolationDetails } from "#/errors";
25
+ export type { ConstructorMetadata, LifecycleMetadata, MetadataReader, MutableLifecycleMetadata, ParamMetadata, } from "#/metadata/metadata-types";
26
+ export { defaultMetadataReader, SymbolMetadataReader } from "#/metadata/symbol-metadata-reader";
27
+ export { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll, } from "#/resolution/select/constraints";
28
+ export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, ChainNotRegisteredError, CircularDependencyError, DiError, DisposedContainerError, InternalError, InvalidMetadataError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SelfBindingRequiresClassError, StaticMemberDecoratorError, SyncDisposalNotSupportedError, EmptyTagCriteriaError, TokenNotBoundError, UnreachableConstraintError, UnreachableLifecycleHookError, } from "#/errors/errors";
29
+ export type { ScopeViolationDetails } from "#/errors/errors";
24
30
  export { toDotGraph } from "#/introspection/graph-adapters/dot";
25
31
  export { toCytoscapeGraph } from "#/introspection/graph-adapters/cytoscape";
26
32
  export type { CytoscapeEdge, CytoscapeElements, CytoscapeNode } from "#/introspection/graph-adapters/cytoscape";
27
33
  export { toReactFlowGraph } from "#/introspection/graph-adapters/reactflow";
28
34
  export type { ReactFlowEdge, ReactFlowGraph, ReactFlowNode } from "#/introspection/graph-adapters/reactflow";
35
+ export { toMermaidGraph } from "#/introspection/graph-adapters/mermaid";
29
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,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AAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC7G,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
package/dist/index.js CHANGED
@@ -1,26 +1,34 @@
1
1
  // Token
2
- export { token, tokenName, isToken } from "#/token";
2
+ export { token, tokenName } from "#/core/token";
3
+ // Tag — the interned slot criteria a `whenTagged` and a resolve both take
4
+ export { coversTagKeys, NO_TAG_KEYS, tag, tagKeyMaskOf } from "#/core/tag";
3
5
  // Container
4
6
  export { Container } from "#/container/container";
7
+ // Ambient container — the context an `@inject` accessor initializer resolves from. `resolution/context`
8
+ // stays internal: it hands out resolver callbacks, not public values.
9
+ export { getActiveContainer, runWithContainer } from "#/ambient/active-container";
5
10
  // `effectiveBindingScope` is deliberately absent: it reads a `Binding`, which is internal, and no
6
11
  // public API hands one out. `BindingSnapshot.scope` and `GraphNode.scope` are the public answers.
7
- export { injectionSlotToResolveOptions, bindingSlotToResolveOptions } from "#/resolution/resolve-options";
12
+ export { bindingSlotToResolveOptions, injectionSlotToResolveOptions, resolveOptionsForSlot, } from "#/injection/resolve-options";
8
13
  // Module
9
- export { AsyncModule, isSyncModule, Module, SyncModule } from "#/module";
14
+ export { AsyncModule, isSyncModule, Module, SyncModule } from "#/core/module";
10
15
  // Decorators
11
- export { inject, injectAll, isInjectionDescriptor, optional } from "#/decorators/inject";
16
+ export { inject } from "#/decorators/inject";
17
+ export { injectAll, isInjectionDescriptor, optional } from "#/injection/descriptor";
12
18
  export { injectable } from "#/decorators/injectable";
13
19
  export { postConstruct, preDestroy } from "#/decorators/lifecycle-decorators";
14
20
  // Auto-register
15
21
  export { createAutoRegisterRegistry } from "#/decorators/injectable";
16
- // MetadataReader
22
+ // MetadataReader — everything a consumer needs to write one and pass it to Container.create()
17
23
  export { MetadataReaderToken } from "#/metadata/metadata-reader-token";
24
+ export { defaultMetadataReader, SymbolMetadataReader } from "#/metadata/symbol-metadata-reader";
18
25
  // Constraints — contextual injection predicates for .when()
19
- export { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll, } from "#/resolution/constraints";
26
+ export { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll, } from "#/resolution/select/constraints";
20
27
  // Errors
21
- export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, ChainNotRegisteredError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SelfBindingRequiresClassError, SyncDisposalNotSupportedError, TokenNotBoundError, } from "#/errors";
28
+ export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, ChainNotRegisteredError, CircularDependencyError, DiError, DisposedContainerError, InternalError, InvalidMetadataError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SelfBindingRequiresClassError, StaticMemberDecoratorError, SyncDisposalNotSupportedError, EmptyTagCriteriaError, TokenNotBoundError, UnreachableConstraintError, UnreachableLifecycleHookError, } from "#/errors/errors";
22
29
  // Graph adapters — render `generateDependencyGraph()` output for common viewers
23
30
  export { toDotGraph } from "#/introspection/graph-adapters/dot";
24
31
  export { toCytoscapeGraph } from "#/introspection/graph-adapters/cytoscape";
25
32
  export { toReactFlowGraph } from "#/introspection/graph-adapters/reactflow";
33
+ export { toMermaidGraph } from "#/introspection/graph-adapters/mermaid";
26
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAgBpD,YAAY;AACZ,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,kGAAkG;AAClG,kGAAkG;AAClG,OAAO,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAQ1G,SAAS;AACT,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzE,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE9E,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAGrE,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,4DAA4D;AAC5D,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,SAAS;AACT,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,OAAO,EACP,sBAAsB,EACtB,aAAa,EACb,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,sB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,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAQvE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEhG,4DAA4D;AAC5D,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAEzC,SAAS;AACT,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,OAAO,EACP,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AAGzB,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,79 @@
1
+ /** The one shape every declared dependency is normalised to, whatever channel declared it. */
2
+ import type { Token } from "#/core/token";
3
+ import type { BindingTag, Constructor, TokenValue } from "#/core/types";
4
+ import type { DependencySlot } from "#/injection/resolve-options";
5
+ /**
6
+ * @since 0.3.16-canary.0
7
+ */
8
+ export interface InjectOptions {
9
+ name?: string | undefined;
10
+ /**
11
+ * Single-tag shorthand, equivalent to listing the one pair in `tags`.
12
+ *
13
+ * @remarks Folded into `tags` when the descriptor is built, so nothing downstream sees two
14
+ * spellings of one request. Giving both is a request for every pair across the two.
15
+ */
16
+ tag?: BindingTag | undefined;
17
+ tags?: ReadonlyArray<BindingTag> | undefined;
18
+ }
19
+ /**
20
+ * One dependency a `toResolved` factory or an `@inject` accessor declares.
21
+ *
22
+ * @remarks Extends {@link DependencySlot} so the two dependency sources stay literally one shape,
23
+ * narrowing only `token` to carry the value type a factory's parameter is checked against.
24
+ *
25
+ * @since 0.3.16-canary.0
26
+ */
27
+ export interface InjectionDescriptor<out Value = unknown> extends DependencySlot {
28
+ readonly token: Token<Value> | Constructor<Value>;
29
+ }
30
+ /**
31
+ * @since 0.3.16-canary.0
32
+ */
33
+ export type InjectableDependency<Value = unknown> = Token<Value> | Constructor<Value> | InjectionDescriptor<Value>;
34
+ /**
35
+ * The value a factory receives for one declared dependency.
36
+ *
37
+ * @remarks `optional()` and `injectAll()` fold their effect into the descriptor's own type
38
+ * parameter, so reading it back is enough; bare tokens fall through to {@link TokenValue}.
39
+ *
40
+ * @since 0.5.0-canary.7
41
+ */
42
+ export type ResolvedDependencyValue<Dependency> = Dependency extends {
43
+ readonly multi: true;
44
+ } ? Array<DescribedValue<Dependency>> : Dependency extends {
45
+ readonly optional: true;
46
+ } ? DescribedValue<Dependency> | undefined : DescribedValue<Dependency>;
47
+ /**
48
+ * The value a dependency's own type parameter carries, before its flags are read.
49
+ *
50
+ * @remarks Split out because a hand-written descriptor states its flags and its value type
51
+ * separately, and only the flags are load-bearing: `{ token: Plugin, multi: true }` says `Plugin`
52
+ * and delivers `Array<Plugin>`. `injectAll()` and `optional()` already fold their effect in, so the
53
+ * flags find an array or an optional there and leave it alone.
54
+ */
55
+ type DescribedValue<Dependency> = Dependency extends InjectionDescriptor<infer Value> ? Value : TokenValue<Dependency>;
56
+ /**
57
+ * @since 0.3.16-canary.0
58
+ */
59
+ export declare function isInjectionDescriptor(value: unknown): value is InjectionDescriptor;
60
+ /**
61
+ * @since 0.3.16-canary.0
62
+ */
63
+ export declare function normalizeToDescriptor(dependency: InjectableDependency): InjectionDescriptor;
64
+ /**
65
+ * The descriptor half of `inject()`, shared with the accessor decorator that wraps it.
66
+ *
67
+ * @since 0.6.0
68
+ */
69
+ export declare function buildInjectionDescriptor<Value>(token: Token<Value> | Constructor<Value>, options?: InjectOptions): InjectionDescriptor<Value>;
70
+ /**
71
+ * @since 0.3.16-canary.0
72
+ */
73
+ export declare function optional<Value>(token: Token<Value> | Constructor<Value>, options?: InjectOptions): InjectionDescriptor<Value | undefined>;
74
+ /**
75
+ * @since 0.3.16-canary.0
76
+ */
77
+ export declare function injectAll<Value>(token: Token<Value> | Constructor<Value>, options?: InjectOptions): InjectionDescriptor<Array<Value>>;
78
+ export {};
79
+ //# sourceMappingURL=descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../src/injection/descriptor.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,IAAI,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB,CAAC,GAAG,CAAC,KAAK,GAAG,OAAO,CAAE,SAAQ,cAAc;IAC9E,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,MAA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