@codefast/di 0.5.0-canary.3 → 0.5.0-canary.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @codefast/di
2
2
 
3
+ ## 0.5.0-canary.4
4
+
5
+ ### Minor Changes
6
+
7
+ - [`4f7a188`](https://github.com/codefastlabs/codefast/commit/4f7a188a5f4a281882606f11ed660aecb9844753) Thanks [@thevuong](https://github.com/thevuong)! - Rename the `hint` resolve parameter to `options` throughout — "hint" implied optional guidance the container may ignore, but the value is a hard selection criterion (`resolve` throws `NoMatchingBindingError` when nothing matches), so the name misstated its role. Positional call sites are unaffected; the one breaking surface is `NoMatchingBindingError.hint`, now `NoMatchingBindingError.options`.
8
+
3
9
  ## 0.5.0-canary.3
4
10
 
5
11
  ## 0.5.0-canary.2
package/README.md CHANGED
@@ -239,7 +239,7 @@ container.bind(LoggerToken).toConstantValue(consoleLogger).whenNamed("console");
239
239
  container.resolve(LoggerToken, { name: "file" });
240
240
  ```
241
241
 
242
- **Tagged** — the hint is a tuple `[tag, value]`:
242
+ **Tagged** — the tag option is a tuple `[tag, value]`:
243
243
 
244
244
  ```typescript
245
245
  container.bind(StorageToken).to(S3Storage).whenTagged("provider", "s3");
@@ -250,7 +250,7 @@ container.resolve(StorageToken, { tag: ["provider", "s3"] });
250
250
 
251
251
  **Default slot**
252
252
 
253
- `.whenDefault()` is a documentation-only marker — it is a no-op at runtime. A binding without any constraint already participates in resolution when no `name` / `tag` hint is provided. Use it to signal intent when mixing constrained and unconstrained bindings for the same token.
253
+ `.whenDefault()` is a documentation-only marker — it is a no-op at runtime. A binding without any constraint already participates in resolution when no `name` / `tag` option is provided. Use it to signal intent when mixing constrained and unconstrained bindings for the same token.
254
254
 
255
255
  **Predicate** — inspect the full resolution graph:
256
256
 
@@ -590,7 +590,7 @@ All errors extend `DiError` and expose a stable `code` property.
590
590
  | `MissingContainerContextError` | `"MISSING_CONTAINER_CONTEXT"` | `@inject` accessor resolved without an active container |
591
591
  | `MissingMetadataError` | `"MISSING_METADATA"` | Class resolution missing `@injectable()` metadata |
592
592
  | `MissingScopeContextError` | `"MISSING_SCOPE_CONTEXT"` | `scoped` binding resolved without a child container context |
593
- | `NoMatchingBindingError` | `"NO_MATCHING_BINDING"` | Hint matches no registered binding |
593
+ | `NoMatchingBindingError` | `"NO_MATCHING_BINDING"` | Resolve options match no registered binding |
594
594
  | `RebindUnboundTokenError` | `"REBIND_UNBOUND_TOKEN"` | `rebind` targets a token with no binding owned by this container |
595
595
  | `ScopeViolationError` | `"SCOPE_VIOLATION"` | Captive dependency found by `validate()` (`details` describes the path) |
596
596
  | `SyncDisposalNotSupportedError` | `"SYNC_DISPOSAL_NOT_SUPPORTED"` | Sync `using` / `[Symbol.dispose]` on the container |
@@ -8,12 +8,12 @@ import { Binding } from "./binding.mjs";
8
8
  *
9
9
  * @since 0.3.16-canary.0
10
10
  */
11
- declare function selectBinding(bindings: ReadonlyArray<Binding>, hint: ResolveOptions | undefined, ctx: ConstraintContext, tokenDisplayName: string): Binding | undefined;
11
+ declare function selectBinding(bindings: ReadonlyArray<Binding>, options: ResolveOptions | undefined, ctx: ConstraintContext, tokenDisplayName: string): Binding | undefined;
12
12
  /**
13
- * Select all candidates matching hint + predicates.
13
+ * Select all candidates matching options + predicates.
14
14
  *
15
15
  * @since 0.3.16-canary.0
16
16
  */
17
- declare function selectAllBindings(bindings: ReadonlyArray<Binding>, hint: ResolveOptions | undefined, ctx: ConstraintContext): Array<Binding>;
17
+ declare function selectAllBindings(bindings: ReadonlyArray<Binding>, options: ResolveOptions | undefined, ctx: ConstraintContext): Array<Binding>;
18
18
  //#endregion
19
19
  export { selectAllBindings, selectBinding };
@@ -6,61 +6,61 @@ import { AmbiguousBindingError } from "./errors.mjs";
6
6
  *
7
7
  * @since 0.3.16-canary.0
8
8
  */
9
- function selectBinding(bindings, hint, ctx, tokenDisplayName) {
10
- const candidates = filterBindings(bindings, hint, ctx);
9
+ function selectBinding(bindings, options, ctx, tokenDisplayName) {
10
+ const candidates = filterBindings(bindings, options, ctx);
11
11
  if (candidates.length === 0) return;
12
12
  if (candidates.length === 1) return candidates[0];
13
13
  throw new AmbiguousBindingError(tokenDisplayName, candidates.map((c) => c.id));
14
14
  }
15
15
  /**
16
- * Select all candidates matching hint + predicates.
16
+ * Select all candidates matching options + predicates.
17
17
  *
18
18
  * @since 0.3.16-canary.0
19
19
  */
20
- function selectAllBindings(bindings, hint, ctx) {
21
- return filterBindings(bindings, hint, ctx, "all");
20
+ function selectAllBindings(bindings, options, ctx) {
21
+ return filterBindings(bindings, options, ctx, "all");
22
22
  }
23
- function filterBindings(bindings, hint, ctx, selectionMode = "single") {
24
- if (hint === void 0) {
25
- const resultWithoutHint = [];
23
+ function filterBindings(bindings, options, ctx, selectionMode = "single") {
24
+ if (options === void 0) {
25
+ const resultWithoutOptions = [];
26
26
  if (selectionMode === "all") {
27
- for (const binding of bindings) if (matchesPredicate(binding, ctx)) resultWithoutHint.push(binding);
27
+ for (const binding of bindings) if (matchesPredicate(binding, ctx)) resultWithoutOptions.push(binding);
28
28
  } else for (const binding of bindings) {
29
29
  const slot = binding.slot;
30
- if (slot.name === void 0 && slot.tags.length === 0 && matchesPredicate(binding, ctx)) resultWithoutHint.push(binding);
30
+ if (slot.name === void 0 && slot.tags.length === 0 && matchesPredicate(binding, ctx)) resultWithoutOptions.push(binding);
31
31
  }
32
- return resultWithoutHint;
32
+ return resultWithoutOptions;
33
33
  }
34
34
  const result = [];
35
- for (const binding of bindings) if ((selectionMode === "all" ? matchesSlotForResolveAll(binding, hint) : matchesSlot(binding, hint)) && matchesPredicate(binding, ctx)) result.push(binding);
35
+ for (const binding of bindings) if ((selectionMode === "all" ? matchesSlotForResolveAll(binding, options) : matchesSlot(binding, options)) && matchesPredicate(binding, ctx)) result.push(binding);
36
36
  return result;
37
37
  }
38
- function matchesSlotForResolveAll(binding, hint) {
39
- if (!(hint !== void 0 && (hint.name !== void 0 || hint.tags !== void 0 && hint.tags.length > 0 || hint.tag !== void 0))) return true;
40
- return matchesSlot(binding, hint);
38
+ function matchesSlotForResolveAll(binding, options) {
39
+ if (!(options !== void 0 && (options.name !== void 0 || options.tags !== void 0 && options.tags.length > 0 || options.tag !== void 0))) return true;
40
+ return matchesSlot(binding, options);
41
41
  }
42
- function matchesSlot(binding, hint) {
42
+ function matchesSlot(binding, options) {
43
43
  const slot = binding.slot;
44
- const hintName = hint?.name;
45
- const hintTags = hint?.tags;
46
- const singleHintTag = hint?.tag;
47
- const hasHintTags = (hintTags?.length ?? 0) > 0 || singleHintTag !== void 0;
44
+ const requestedName = options?.name;
45
+ const requestedTags = options?.tags;
46
+ const singleRequestedTag = options?.tag;
47
+ const hasRequestedTags = (requestedTags?.length ?? 0) > 0 || singleRequestedTag !== void 0;
48
48
  if (slot.name !== void 0) {
49
- if (hintName === void 0) return false;
50
- if (slot.name !== hintName) return false;
51
- } else if (hintName !== void 0) return false;
49
+ if (requestedName === void 0) return false;
50
+ if (slot.name !== requestedName) return false;
51
+ } else if (requestedName !== void 0) return false;
52
52
  if (slot.tags.length > 0) {
53
- if (!hasHintTags) return false;
54
- for (const [tagKey, tagValue] of slot.tags) if (!matchHintTag(tagKey, tagValue, hintTags, singleHintTag)) return false;
55
- } else if (hasHintTags) return false;
53
+ if (!hasRequestedTags) return false;
54
+ for (const [tagKey, tagValue] of slot.tags) if (!matchesRequestedTag(tagKey, tagValue, requestedTags, singleRequestedTag)) return false;
55
+ } else if (hasRequestedTags) return false;
56
56
  return true;
57
57
  }
58
- function matchHintTag(tagKey, tagValue, hintTags, singleHintTag) {
59
- if (singleHintTag !== void 0 && singleHintTag[0] === tagKey && Object.is(singleHintTag[1], tagValue)) return true;
60
- if (hintTags === void 0 || hintTags.length === 0) return false;
61
- for (let index = 0; index < hintTags.length; index += 1) {
62
- const hintTag = hintTags[index];
63
- if (hintTag[0] === tagKey && Object.is(hintTag[1], tagValue)) return true;
58
+ function matchesRequestedTag(tagKey, tagValue, requestedTags, singleRequestedTag) {
59
+ if (singleRequestedTag !== void 0 && singleRequestedTag[0] === tagKey && Object.is(singleRequestedTag[1], tagValue)) return true;
60
+ if (requestedTags === void 0 || requestedTags.length === 0) return false;
61
+ for (let index = 0; index < requestedTags.length; index += 1) {
62
+ const requestedTag = requestedTags[index];
63
+ if (requestedTag[0] === tagKey && Object.is(requestedTag[1], tagValue)) return true;
64
64
  }
65
65
  return false;
66
66
  }
@@ -26,20 +26,20 @@ interface Container {
26
26
  loadAutoRegistered(registry: AutoRegisterRegistry): number;
27
27
  onActivation<const Value>(token: Token<Value> | Constructor<Value>, handler: ActivationHandler<Value>): void;
28
28
  onDeactivation<const Value>(token: Token<Value> | Constructor<Value>, handler: DeactivationHandler<Value>): void;
29
- resolve<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value;
30
- resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value>;
31
- resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value | undefined;
32
- resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value | undefined>;
33
- resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Array<Value>;
34
- resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Array<Value>>;
29
+ resolve<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Value;
30
+ resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Value>;
31
+ resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Value | undefined;
32
+ resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Value | undefined>;
33
+ resolveAll<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Array<Value>;
34
+ resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Array<Value>>;
35
35
  createChild(): Container;
36
36
  dispose(): Promise<void>;
37
37
  [Symbol.asyncDispose](): Promise<void>;
38
38
  [Symbol.dispose](): never;
39
39
  initializeAsync(): Promise<void>;
40
40
  validate(): void;
41
- has(token: Token<unknown> | Constructor, hint?: ResolveOptions): boolean;
42
- hasOwn(token: Token<unknown> | Constructor, hint?: ResolveOptions): boolean;
41
+ has(token: Token<unknown> | Constructor, options?: ResolveOptions): boolean;
42
+ hasOwn(token: Token<unknown> | Constructor, options?: ResolveOptions): boolean;
43
43
  lookupBindings<const Value>(token: Token<Value> | Constructor<Value>): ReadonlyArray<BindingSnapshot>;
44
44
  inspect(): ContainerSnapshot;
45
45
  generateDependencyGraph(options?: GraphOptions): ContainerGraphJson;
@@ -262,31 +262,31 @@ var DefaultContainer = class DefaultContainer {
262
262
  this._assertNotDisposed();
263
263
  this._lifecycle.registerDeactivation(token, handler);
264
264
  }
265
- resolve(token, hint) {
265
+ resolve(token, options) {
266
266
  this._assertNotDisposed();
267
- if (hint === void 0) return this._resolver.resolveFromContext(token, [], []);
268
- return this._resolver.resolve(token, hint, [], []);
267
+ if (options === void 0) return this._resolver.resolveFromContext(token, [], []);
268
+ return this._resolver.resolve(token, options, [], []);
269
269
  }
270
- resolveAsync(token, hint) {
270
+ resolveAsync(token, options) {
271
271
  this._assertNotDisposed();
272
- if (hint === void 0) return this._resolver.resolveAsyncFromContext(token, [], []);
273
- return this._resolver.resolveAsync(token, hint, [], []);
272
+ if (options === void 0) return this._resolver.resolveAsyncFromContext(token, [], []);
273
+ return this._resolver.resolveAsync(token, options, [], []);
274
274
  }
275
- resolveOptional(token, hint) {
275
+ resolveOptional(token, options) {
276
276
  this._assertNotDisposed();
277
- return this._resolver.resolveOptional(token, hint, [], []);
277
+ return this._resolver.resolveOptional(token, options, [], []);
278
278
  }
279
- resolveOptionalAsync(token, hint) {
279
+ resolveOptionalAsync(token, options) {
280
280
  this._assertNotDisposed();
281
- return this._resolver.resolveOptionalAsync(token, hint, [], []);
281
+ return this._resolver.resolveOptionalAsync(token, options, [], []);
282
282
  }
283
- resolveAll(token, hint) {
283
+ resolveAll(token, options) {
284
284
  this._assertNotDisposed();
285
- return this._resolver.resolveAll(token, hint, [], []);
285
+ return this._resolver.resolveAll(token, options, [], []);
286
286
  }
287
- resolveAllAsync(token, hint) {
287
+ resolveAllAsync(token, options) {
288
288
  this._assertNotDisposed();
289
- return this._resolver.resolveAllAsync(token, hint, [], []);
289
+ return this._resolver.resolveAllAsync(token, options, [], []);
290
290
  }
291
291
  createChild() {
292
292
  this._assertNotDisposed();
@@ -316,8 +316,8 @@ var DefaultContainer = class DefaultContainer {
316
316
  if (effectiveBindingScope(binding) === "singleton" && !this._scope.hasSingleton(binding.id)) {
317
317
  if (binding.predicate !== void 0) continue;
318
318
  if (binding.kind === "constant" && binding.onActivation === void 0) continue;
319
- const slotHint = bindingSlotToResolveOptions(binding.slot);
320
- await this.resolveAsync(binding.token, slotHint);
319
+ const slotOptions = bindingSlotToResolveOptions(binding.slot);
320
+ await this.resolveAsync(binding.token, slotOptions);
321
321
  }
322
322
  }
323
323
  }
@@ -372,7 +372,7 @@ var DefaultContainer = class DefaultContainer {
372
372
  default: return terminal;
373
373
  }
374
374
  }
375
- _followAliasChainToTerminal(binding, hint) {
375
+ _followAliasChainToTerminal(binding, options) {
376
376
  const cyclePath = [];
377
377
  const seenAliasIds = /* @__PURE__ */ new Set();
378
378
  let current = binding;
@@ -381,7 +381,7 @@ var DefaultContainer = class DefaultContainer {
381
381
  seenAliasIds.add(current.id);
382
382
  cyclePath.push(tokenName(current.token));
383
383
  const nextToken = current.target;
384
- const next = this._resolver.peekBindingForValidate(nextToken, hint);
384
+ const next = this._resolver.peekBindingForValidate(nextToken, options);
385
385
  if (next === void 0) return;
386
386
  current = next.binding;
387
387
  }
@@ -400,50 +400,50 @@ var DefaultContainer = class DefaultContainer {
400
400
  const meta = reader.getConstructorMetadata(binding.target);
401
401
  if (meta === void 0) return edges;
402
402
  for (const param of meta.params) {
403
- const paramHint = injectionSlotToResolveOptions(param);
403
+ const paramOptions = injectionSlotToResolveOptions(param);
404
404
  if (param.optional) continue;
405
405
  const tokenRef = param.token;
406
406
  if (param.multi) {
407
- const candidates = this._resolver.peekCandidateBindingsForValidate(tokenRef, paramHint);
407
+ const candidates = this._resolver.peekCandidateBindingsForValidate(tokenRef, paramOptions);
408
408
  for (const cand of candidates) {
409
- const term = this._followAliasChainToTerminal(cand, paramHint);
409
+ const term = this._followAliasChainToTerminal(cand, paramOptions);
410
410
  pushTerminal(term, term !== void 0 ? tokenName(term.token) : "");
411
411
  }
412
412
  continue;
413
413
  }
414
- const found = paramHint === void 0 ? this._resolver.peekBindingForValidate(tokenRef, void 0) : this._resolver.peekBindingForValidate(tokenRef, paramHint);
414
+ const found = paramOptions === void 0 ? this._resolver.peekBindingForValidate(tokenRef, void 0) : this._resolver.peekBindingForValidate(tokenRef, paramOptions);
415
415
  if (found === void 0) continue;
416
- const term = this._followAliasChainToTerminal(found.binding, paramHint);
416
+ const term = this._followAliasChainToTerminal(found.binding, paramOptions);
417
417
  pushTerminal(term, term !== void 0 ? tokenName(term.token) : "");
418
418
  }
419
419
  return edges;
420
420
  }
421
421
  if (binding.kind === "resolved" || binding.kind === "resolved-async") for (const dep of binding.deps) {
422
- const depHint = injectionSlotToResolveOptions(dep);
422
+ const depOptions = injectionSlotToResolveOptions(dep);
423
423
  if (dep.optional) continue;
424
424
  const tokenRef = dep.token;
425
425
  if (dep.multi) {
426
- const candidates = this._resolver.peekCandidateBindingsForValidate(tokenRef, depHint);
426
+ const candidates = this._resolver.peekCandidateBindingsForValidate(tokenRef, depOptions);
427
427
  for (const cand of candidates) {
428
- const term = this._followAliasChainToTerminal(cand, depHint);
428
+ const term = this._followAliasChainToTerminal(cand, depOptions);
429
429
  pushTerminal(term, term !== void 0 ? tokenName(term.token) : "");
430
430
  }
431
431
  continue;
432
432
  }
433
- const found = depHint === void 0 ? this._resolver.peekBindingForValidate(tokenRef, void 0) : this._resolver.peekBindingForValidate(tokenRef, depHint);
433
+ const found = depOptions === void 0 ? this._resolver.peekBindingForValidate(tokenRef, void 0) : this._resolver.peekBindingForValidate(tokenRef, depOptions);
434
434
  if (found === void 0) continue;
435
- const term = this._followAliasChainToTerminal(found.binding, depHint);
435
+ const term = this._followAliasChainToTerminal(found.binding, depOptions);
436
436
  pushTerminal(term, term !== void 0 ? tokenName(term.token) : "");
437
437
  }
438
438
  return edges;
439
439
  }
440
- has(token, hint) {
440
+ has(token, options) {
441
441
  this._assertNotDisposed();
442
- return this._inspector.has(token, hint, () => this._parent?.has(token, hint) ?? false);
442
+ return this._inspector.has(token, options, () => this._parent?.has(token, options) ?? false);
443
443
  }
444
- hasOwn(token, hint) {
444
+ hasOwn(token, options) {
445
445
  this._assertNotDisposed();
446
- return this._inspector.hasOwn(token, hint);
446
+ return this._inspector.hasOwn(token, options);
447
447
  }
448
448
  lookupBindings(token) {
449
449
  this._assertNotDisposed();
@@ -93,11 +93,11 @@ function inject(token, options) {
93
93
  context.addInitializer(function() {
94
94
  const container = getActiveContainer();
95
95
  if (container === void 0) throw new MissingContainerContextError(String(context.name));
96
- const hint = options === void 0 ? void 0 : injectionSlotToResolveOptions({
96
+ const resolveOptions = options === void 0 ? void 0 : injectionSlotToResolveOptions({
97
97
  ...options.name !== void 0 ? { name: options.name } : {},
98
98
  ...options.tags !== void 0 ? { tags: options.tags } : {}
99
99
  });
100
- const value = descriptor.optional ? container.resolveOptional(token, hint) : container.resolve(token, hint);
100
+ const value = descriptor.optional ? container.resolveOptional(token, resolveOptions) : container.resolve(token, resolveOptions);
101
101
  context.access.set(this, value);
102
102
  });
103
103
  return {};
@@ -17,13 +17,13 @@ declare function getActiveContainer(): Container | undefined;
17
17
  */
18
18
  interface ResolverCallbacks {
19
19
  resolveFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value;
20
- resolve<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value;
20
+ resolve<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value;
21
21
  resolveAsyncFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value>;
22
- resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value>;
23
- resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value | undefined;
24
- resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value | undefined>;
25
- resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Array<Value>;
26
- resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Array<Value>>;
22
+ resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value>;
23
+ resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value | undefined;
24
+ resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value | undefined>;
25
+ resolveAll<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Array<Value>;
26
+ resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Array<Value>>;
27
27
  }
28
28
  /**
29
29
  * @since 0.3.16-canary.0
@@ -32,17 +32,17 @@ declare class DefaultResolutionContext implements ResolutionContext {
32
32
  private _resolver;
33
33
  private _resolutionPath;
34
34
  private _resolutionStack;
35
- private _currentHint;
36
- constructor(resolver: ResolverCallbacks, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>, currentHint: ResolveOptions | undefined);
35
+ private _currentOptions;
36
+ constructor(resolver: ResolverCallbacks, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>, currentOptions: ResolveOptions | undefined);
37
37
  private _graph;
38
38
  get graph(): ConstraintContext;
39
- reset(resolver: ResolverCallbacks, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>, currentHint: ResolveOptions | undefined): void;
40
- resolve<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value;
41
- resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value>;
42
- resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value | undefined;
43
- resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value | undefined>;
44
- resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Array<Value>;
45
- resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Array<Value>>;
39
+ reset(resolver: ResolverCallbacks, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>, currentOptions: ResolveOptions | undefined): void;
40
+ resolve<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Value;
41
+ resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Value>;
42
+ resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Value | undefined;
43
+ resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Value | undefined>;
44
+ resolveAll<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Array<Value>;
45
+ resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Array<Value>>;
46
46
  }
47
47
  /**
48
48
  * @since 0.3.16-canary.0
@@ -25,56 +25,56 @@ var DefaultResolutionContext = class {
25
25
  _resolver;
26
26
  _resolutionPath;
27
27
  _resolutionStack;
28
- _currentHint;
29
- constructor(resolver, resolutionPath, resolutionStack, currentHint) {
28
+ _currentOptions;
29
+ constructor(resolver, resolutionPath, resolutionStack, currentOptions) {
30
30
  this._resolver = resolver;
31
31
  this._resolutionPath = resolutionPath;
32
32
  this._resolutionStack = resolutionStack;
33
- this._currentHint = currentHint;
33
+ this._currentOptions = currentOptions;
34
34
  }
35
35
  _graph;
36
36
  get graph() {
37
- if (this._graph === void 0) this._graph = new DefaultConstraintContext(this._resolutionPath, this._resolutionStack, this._currentHint);
37
+ if (this._graph === void 0) this._graph = new DefaultConstraintContext(this._resolutionPath, this._resolutionStack, this._currentOptions);
38
38
  return this._graph;
39
39
  }
40
- reset(resolver, resolutionPath, resolutionStack, currentHint) {
40
+ reset(resolver, resolutionPath, resolutionStack, currentOptions) {
41
41
  this._resolver = resolver;
42
42
  this._resolutionPath = resolutionPath;
43
43
  this._resolutionStack = resolutionStack;
44
- this._currentHint = currentHint;
44
+ this._currentOptions = currentOptions;
45
45
  this._graph = void 0;
46
46
  }
47
- resolve(token, hint) {
48
- if (hint === void 0) return this._resolver.resolveFromContext(token, this._resolutionPath, this._resolutionStack);
49
- return this._resolver.resolve(token, hint, this._resolutionPath, this._resolutionStack);
47
+ resolve(token, options) {
48
+ if (options === void 0) return this._resolver.resolveFromContext(token, this._resolutionPath, this._resolutionStack);
49
+ return this._resolver.resolve(token, options, this._resolutionPath, this._resolutionStack);
50
50
  }
51
- resolveAsync(token, hint) {
52
- if (hint === void 0) return this._resolver.resolveAsyncFromContext(token, this._resolutionPath, this._resolutionStack);
53
- return this._resolver.resolveAsync(token, hint, this._resolutionPath, this._resolutionStack);
51
+ resolveAsync(token, options) {
52
+ if (options === void 0) return this._resolver.resolveAsyncFromContext(token, this._resolutionPath, this._resolutionStack);
53
+ return this._resolver.resolveAsync(token, options, this._resolutionPath, this._resolutionStack);
54
54
  }
55
- resolveOptional(token, hint) {
56
- return this._resolver.resolveOptional(token, hint, this._resolutionPath, this._resolutionStack);
55
+ resolveOptional(token, options) {
56
+ return this._resolver.resolveOptional(token, options, this._resolutionPath, this._resolutionStack);
57
57
  }
58
- resolveOptionalAsync(token, hint) {
59
- return this._resolver.resolveOptionalAsync(token, hint, this._resolutionPath, this._resolutionStack);
58
+ resolveOptionalAsync(token, options) {
59
+ return this._resolver.resolveOptionalAsync(token, options, this._resolutionPath, this._resolutionStack);
60
60
  }
61
- resolveAll(token, hint) {
62
- return this._resolver.resolveAll(token, hint, this._resolutionPath, this._resolutionStack);
61
+ resolveAll(token, options) {
62
+ return this._resolver.resolveAll(token, options, this._resolutionPath, this._resolutionStack);
63
63
  }
64
- resolveAllAsync(token, hint) {
65
- return this._resolver.resolveAllAsync(token, hint, this._resolutionPath, this._resolutionStack);
64
+ resolveAllAsync(token, options) {
65
+ return this._resolver.resolveAllAsync(token, options, this._resolutionPath, this._resolutionStack);
66
66
  }
67
67
  };
68
68
  var DefaultConstraintContext = class {
69
69
  resolutionPath;
70
70
  resolutionStack;
71
71
  parent;
72
- currentResolveHint;
73
- constructor(resolutionPath, resolutionStack, currentResolveHint) {
72
+ currentResolveOptions;
73
+ constructor(resolutionPath, resolutionStack, currentResolveOptions) {
74
74
  this.resolutionPath = resolutionPath;
75
75
  this.resolutionStack = resolutionStack;
76
76
  this.parent = resolutionStack.at(-1);
77
- this.currentResolveHint = currentResolveHint;
77
+ this.currentResolveOptions = currentResolveOptions;
78
78
  }
79
79
  _ancestors;
80
80
  get ancestors() {
package/dist/errors.d.mts CHANGED
@@ -29,9 +29,9 @@ declare class TokenNotBoundError extends DiError {
29
29
  declare class NoMatchingBindingError extends DiError {
30
30
  readonly code = "NO_MATCHING_BINDING";
31
31
  readonly tokenName: string;
32
- readonly hint: ResolveOptions;
32
+ readonly options: ResolveOptions;
33
33
  readonly availableSlots: Array<string>;
34
- constructor(tokenName: string, hint: ResolveOptions, availableSlots: Array<string>);
34
+ constructor(tokenName: string, options: ResolveOptions, availableSlots: Array<string>);
35
35
  }
36
36
  /**
37
37
  * @since 0.3.16-canary.0
package/dist/errors.mjs CHANGED
@@ -34,14 +34,14 @@ var TokenNotBoundError = class extends DiError {
34
34
  var NoMatchingBindingError = class extends DiError {
35
35
  code = "NO_MATCHING_BINDING";
36
36
  tokenName;
37
- hint;
37
+ options;
38
38
  availableSlots;
39
- constructor(tokenName, hint, availableSlots) {
40
- const hintStr = JSON.stringify(hint);
39
+ constructor(tokenName, options, availableSlots) {
40
+ const optionsString = JSON.stringify(options);
41
41
  const slotsStr = availableSlots.join(", ");
42
- super(`No binding for '${tokenName}' matching ${hintStr}. Available slots: [${slotsStr}].`);
42
+ super(`No binding for '${tokenName}' matching ${optionsString}. Available slots: [${slotsStr}].`);
43
43
  this.tokenName = tokenName;
44
- this.hint = hint;
44
+ this.options = options;
45
45
  this.availableSlots = availableSlots;
46
46
  }
47
47
  };
@@ -38,9 +38,9 @@ declare class Inspector {
38
38
  constructor(_registry: BindingRegistry, _scope: ScopeManager, _hasParent: boolean, _isDisposed: () => boolean);
39
39
  inspect(): ContainerSnapshot;
40
40
  lookupBindings<Value>(token: Token<Value> | Constructor<Value>): ReadonlyArray<BindingSnapshot>;
41
- has(token: Token<unknown> | Constructor, hint?: ResolveOptions, parentHas?: () => boolean): boolean;
42
- hasOwn(token: Token<unknown> | Constructor, hint?: ResolveOptions): boolean;
43
- private _makeHintContext;
41
+ has(token: Token<unknown> | Constructor, options?: ResolveOptions, parentHas?: () => boolean): boolean;
42
+ hasOwn(token: Token<unknown> | Constructor, options?: ResolveOptions): boolean;
43
+ private _makeConstraintContext;
44
44
  private allBindingSnapshots;
45
45
  private _toSnapshot;
46
46
  }
@@ -27,26 +27,26 @@ var Inspector = class {
27
27
  lookupBindings(token) {
28
28
  return this._registry.getAll(token).map((binding) => this._toSnapshot(binding));
29
29
  }
30
- has(token, hint, parentHas) {
30
+ has(token, options, parentHas) {
31
31
  const bindings = this._registry.getAll(token);
32
- if (bindings.length > 0) if (hint !== void 0) {
33
- if (selectBinding(bindings, hint, this._makeHintContext(hint), tokenName(token)) !== void 0) return true;
32
+ if (bindings.length > 0) if (options !== void 0) {
33
+ if (selectBinding(bindings, options, this._makeConstraintContext(options), tokenName(token)) !== void 0) return true;
34
34
  } else return true;
35
35
  return parentHas?.() ?? false;
36
36
  }
37
- hasOwn(token, hint) {
37
+ hasOwn(token, options) {
38
38
  const bindings = this._registry.getAll(token);
39
39
  if (bindings.length === 0) return false;
40
- if (hint !== void 0) return selectBinding(bindings, hint, this._makeHintContext(hint), tokenName(token)) !== void 0;
40
+ if (options !== void 0) return selectBinding(bindings, options, this._makeConstraintContext(options), tokenName(token)) !== void 0;
41
41
  return true;
42
42
  }
43
- _makeHintContext(hint) {
43
+ _makeConstraintContext(options) {
44
44
  return {
45
45
  resolutionPath: [],
46
46
  resolutionStack: [],
47
47
  parent: void 0,
48
48
  ancestors: [],
49
- currentResolveHint: hint
49
+ currentResolveOptions: options
50
50
  };
51
51
  }
52
52
  allBindingSnapshots() {
@@ -13,7 +13,7 @@ declare function injectionSlotToResolveOptions(injectionSlot: {
13
13
  readonly tags?: ReadonlyArray<BindingTag>;
14
14
  }): ResolveOptions | undefined;
15
15
  /**
16
- * Hint from a binding {@link BindingSlot} (tags may be empty; omits when nothing to match).
16
+ * Resolve options derived from a binding {@link BindingSlot} (tags may be empty; omits when nothing to match).
17
17
  *
18
18
  * @since 0.3.16-canary.0
19
19
  */
@@ -17,7 +17,7 @@ function injectionSlotToResolveOptions(injectionSlot) {
17
17
  return buildOptions(injectionSlot.name, injectionSlot.tags);
18
18
  }
19
19
  /**
20
- * Hint from a binding {@link BindingSlot} (tags may be empty; omits when nothing to match).
20
+ * Resolve options derived from a binding {@link BindingSlot} (tags may be empty; omits when nothing to match).
21
21
  *
22
22
  * @since 0.3.16-canary.0
23
23
  */
@@ -39,30 +39,30 @@ declare class DependencyResolver {
39
39
  /**
40
40
  * Binding lookup aligned with `resolve` — used by `Container.validate` without instantiating.
41
41
  */
42
- peekBindingForValidate(token: Token<unknown> | Constructor, hint: ResolveOptions | undefined): {
42
+ peekBindingForValidate(token: Token<unknown> | Constructor, options: ResolveOptions | undefined): {
43
43
  binding: Binding;
44
44
  owner: DependencyResolver;
45
45
  } | undefined;
46
46
  /**
47
47
  * Mirrors {@link DependencyResolver.resolveAll} candidate selection only (no instantiation).
48
48
  */
49
- peekCandidateBindingsForValidate(token: Token<unknown> | Constructor, hint: ResolveOptions | undefined): Array<Binding>;
49
+ peekCandidateBindingsForValidate(token: Token<unknown> | Constructor, options: ResolveOptions | undefined): Array<Binding>;
50
50
  resolveFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value;
51
- resolve<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value;
51
+ resolve<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value;
52
52
  private _resolveBinding;
53
53
  private _instantiateSync;
54
54
  private _resolveClassDeps;
55
55
  private _resolveDescriptorDeps;
56
- resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value | undefined;
57
- resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Array<Value>;
56
+ resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Value | undefined;
57
+ resolveAll<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Array<Value>;
58
58
  resolveAsyncFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value>;
59
- resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value>;
59
+ resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value>;
60
60
  private _resolveBindingAsync;
61
61
  private _instantiateAsync;
62
62
  private _resolveClassDepsAsync;
63
63
  private _resolveDescriptorDepsAsync;
64
- resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value | undefined>;
65
- resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Array<Value>>;
64
+ resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Value | undefined>;
65
+ resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionPath: Array<string>, resolutionStack: Array<ResolutionFrame>): Promise<Array<Value>>;
66
66
  private _getAllBindingsFromChain;
67
67
  private _getSimpleNamedBindingsFromChain;
68
68
  private _getAvailableSlots;
@@ -72,7 +72,7 @@ declare class DependencyResolver {
72
72
  private _getTokenName;
73
73
  private _getConstructorMetadata;
74
74
  private _instantiateClass;
75
- private _matchesHintTag;
75
+ private _matchesRequestedTag;
76
76
  private _resolveTransientDynamicSyncFromContext;
77
77
  private _resolveTransientDynamicSyncSlow;
78
78
  private _resolveTransientDynamicAsyncFromContext;