@codefast/di 0.3.14-canary.0 → 0.3.14-canary.2

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 (66) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +54 -29
  3. package/dist/binding-scope.d.mts +11 -0
  4. package/dist/binding-scope.mjs +19 -0
  5. package/dist/binding-select.d.mts +8 -26
  6. package/dist/binding-select.mjs +56 -49
  7. package/dist/binding.d.mts +107 -327
  8. package/dist/binding.mjs +19 -324
  9. package/dist/constraints.d.mts +11 -29
  10. package/dist/constraints.mjs +32 -36
  11. package/dist/constructor-type.d.mts +17 -0
  12. package/dist/constructor-type.mjs +1 -0
  13. package/dist/container.d.mts +44 -128
  14. package/dist/container.mjs +664 -433
  15. package/dist/decorators/inject.d.mts +19 -50
  16. package/dist/decorators/inject.mjs +131 -93
  17. package/dist/decorators/injectable.d.mts +16 -37
  18. package/dist/decorators/injectable.mjs +47 -66
  19. package/dist/decorators/lifecycle-decorators.d.mts +2 -22
  20. package/dist/decorators/lifecycle-decorators.mjs +81 -37
  21. package/dist/dependency-graph.d.mts +24 -54
  22. package/dist/dependency-graph.mjs +51 -153
  23. package/dist/environment.d.mts +38 -12
  24. package/dist/environment.mjs +82 -16
  25. package/dist/errors.d.mts +69 -188
  26. package/dist/errors.mjs +92 -219
  27. package/dist/graph-adapters/cytoscape.d.mts +24 -0
  28. package/dist/graph-adapters/cytoscape.mjs +23 -0
  29. package/dist/graph-adapters/dot.d.mts +6 -0
  30. package/dist/graph-adapters/dot.mjs +17 -0
  31. package/dist/graph-adapters/reactflow.d.mts +29 -0
  32. package/dist/graph-adapters/reactflow.mjs +29 -0
  33. package/dist/graph-adapters/types.d.mts +2 -0
  34. package/dist/graph-adapters/types.mjs +1 -0
  35. package/dist/index.d.mts +16 -9
  36. package/dist/index.mjs +8 -5
  37. package/dist/inspector.d.mts +34 -95
  38. package/dist/inspector.mjs +57 -256
  39. package/dist/lifecycle.d.mts +20 -53
  40. package/dist/lifecycle.mjs +129 -99
  41. package/dist/metadata/metadata-keys.d.mts +9 -26
  42. package/dist/metadata/metadata-keys.mjs +7 -28
  43. package/dist/metadata/metadata-reader-token.d.mts +7 -0
  44. package/dist/metadata/metadata-reader-token.mjs +5 -0
  45. package/dist/metadata/metadata-types.d.mts +22 -71
  46. package/dist/metadata/symbol-metadata-reader.d.mts +10 -26
  47. package/dist/metadata/symbol-metadata-reader.mjs +32 -45
  48. package/dist/module.d.mts +30 -84
  49. package/dist/module.mjs +26 -72
  50. package/dist/registry.d.mts +32 -63
  51. package/dist/registry.mjs +131 -82
  52. package/dist/resolve-options.d.mts +18 -0
  53. package/dist/resolve-options.mjs +22 -0
  54. package/dist/resolver.d.mts +67 -190
  55. package/dist/resolver.mjs +715 -424
  56. package/dist/scope.d.mts +19 -102
  57. package/dist/scope.mjs +37 -192
  58. package/dist/token.d.mts +8 -22
  59. package/dist/token.mjs +9 -11
  60. package/dist/types.d.mts +48 -0
  61. package/dist/types.mjs +1 -0
  62. package/package.json +52 -14
  63. package/dist/metadata/param-registry.d.mts +0 -16
  64. package/dist/metadata/param-registry.mjs +0 -31
  65. package/dist/scope-validation.d.mts +0 -21
  66. package/dist/scope-validation.mjs +0 -35
@@ -1,58 +1,28 @@
1
- import { RegistryKey } from "./registry.mjs";
2
- import { Binding, BindingIdentifier, ResolveHint } from "./binding.mjs";
1
+ import { BindingScope } from "./types.mjs";
2
+ import { BindingRegistry } from "./registry.mjs";
3
3
  import { MetadataReader } from "./metadata/metadata-types.mjs";
4
4
 
5
5
  //#region src/dependency-graph.d.ts
6
- /**
7
- * A directed edge in the static dependency graph produced by {@link collectStaticDependencyEdges}.
8
- */
9
- type StaticDependencyEdge = {
10
- readonly fromBindingId: BindingIdentifier;
11
- readonly toBindingId: BindingIdentifier;
12
- readonly resolutionPath: readonly string[];
13
- readonly edgeKind: "sync" | "async";
14
- /**
15
- * True when the resolved target binding carries a {@link BindingBuilder.when} predicate (runtime may skip this edge).
16
- */
17
- readonly toBindingConditional: boolean;
18
- /**
19
- * Constructor inject hint for this edge (named / tagged), when known statically.
20
- */
21
- readonly injectHintLabel?: string;
22
- /**
23
- * True when the consumer binding is an alias (rebind to another token).
24
- */
25
- readonly isAliasEdge: boolean;
26
- };
27
- /**
28
- * A single resolved dependency entry produced by {@link listResolvedDependencies}.
29
- */
30
- type ResolvedDependency = {
31
- readonly binding: Binding<unknown>;
32
- readonly path: readonly string[];
33
- readonly injectHintLabel?: string;
34
- };
35
- /**
36
- * Converts a {@link ResolveHint} to a human-readable edge label for graph output (`name: x` / `tag: k=v`).
37
- */
38
- declare function injectHintLabelFromResolveHint(hint: ResolveHint | undefined): string | undefined;
39
- /**
40
- * Lists the direct static dependencies of `consumer` by inspecting binding metadata.
41
- *
42
- * - `constant` / `dynamic` / `async-dynamic` — no enumerable deps (empty array).
43
- * - `alias` — single dependency on the alias target (chased through alias chains).
44
- * - `resolved` — one dependency per entry in `dependencyTokens`; a missing binding
45
- * always throws {@link InternalError} (there is no optional concept for `resolved`).
46
- * - `class` — one dependency per `@injectable()` constructor parameter
47
- * (requires a {@link MetadataReader}). Parameters marked `optional` whose token
48
- * has no binding are silently skipped; non-optional missing tokens throw
49
- * {@link InternalError}.
50
- */
51
- declare function listResolvedDependencies(consumer: Binding<unknown>, lookup: (key: RegistryKey) => readonly Binding<unknown>[] | undefined, reader: MetadataReader | undefined, pathPrefix: readonly string[]): readonly ResolvedDependency[];
52
- /**
53
- * Flattens the direct dependencies of `consumer` into typed graph edges.
54
- * Used by {@link ContainerInspector} to build DOT and JSON outputs.
55
- */
56
- declare function collectStaticDependencyEdges(consumer: Binding<unknown>, lookup: (key: RegistryKey) => readonly Binding<unknown>[] | undefined, reader: MetadataReader | undefined, pathPrefix: readonly string[]): readonly StaticDependencyEdge[];
6
+ interface GraphNode {
7
+ readonly id: string;
8
+ readonly tokenName: string;
9
+ readonly kind: string;
10
+ readonly scope: BindingScope;
11
+ readonly fromParent: boolean;
12
+ }
13
+ interface GraphEdge {
14
+ readonly from: string;
15
+ readonly to: string;
16
+ readonly label?: string;
17
+ }
18
+ interface ContainerGraphJson {
19
+ readonly nodes: readonly GraphNode[];
20
+ readonly edges: readonly GraphEdge[];
21
+ readonly includesParent: boolean;
22
+ }
23
+ interface GraphOptions {
24
+ readonly includeParent?: boolean;
25
+ }
26
+ declare function buildDependencyGraph(registry: BindingRegistry, metadataReader: MetadataReader, options: GraphOptions | undefined, parentRegistry?: BindingRegistry): ContainerGraphJson;
57
27
  //#endregion
58
- export { ResolvedDependency, StaticDependencyEdge, collectStaticDependencyEdges, injectHintLabelFromResolveHint, listResolvedDependencies };
28
+ export { ContainerGraphJson, GraphEdge, GraphNode, GraphOptions, buildDependencyGraph };
@@ -1,160 +1,58 @@
1
- import { InternalError } from "./errors.mjs";
2
- import { filterMatchingBindings, registryKeyLabel, selectBindingForRegistry } from "./binding-select.mjs";
1
+ import { effectiveBindingScope } from "./binding-scope.mjs";
2
+ import { tokenName } from "./token.mjs";
3
3
  //#region src/dependency-graph.ts
4
- /**
5
- * Converts a tag value to a printable string for graph edge labels.
6
- */
7
- function formatTagValueForGraph(value) {
8
- if (typeof value === "string") return value;
9
- try {
10
- return JSON.stringify(value);
11
- } catch {
12
- return String(value);
13
- }
14
- }
15
- /**
16
- * Converts a {@link ResolveHint} to a human-readable edge label for graph output (`name: x` / `tag: k=v`).
17
- */
18
- function injectHintLabelFromResolveHint(hint) {
19
- if (hint === void 0) return;
20
- if (hint.name !== void 0) return `name: ${hint.name}`;
21
- if (hint.tag !== void 0) {
22
- const [tagKey, tagValue] = hint.tag;
23
- return `tag: ${tagKey}=${formatTagValueForGraph(tagValue)}`;
24
- }
25
- }
26
- /**
27
- * Returns `"async"` when either the consumer or dependency binding is an `async-dynamic` factory.
28
- */
29
- function edgeKindFor(consumer, dependency) {
30
- if (consumer.kind === "async-dynamic" || dependency.kind === "async-dynamic") return "async";
31
- return "sync";
32
- }
33
- /**
34
- * Resolves the default (first matching, no hint) binding for `depKey`.
35
- * Returns `undefined` when the key has no registered bindings.
36
- */
37
- function resolveDefaultBinding(lookup, depKey, pathPrefix) {
38
- const label = registryKeyLabel(depKey);
39
- const nextPath = [...pathPrefix, label];
40
- const list = lookup(depKey);
41
- if (list === void 0 || list.length === 0) return;
42
- return selectBindingForRegistry(list, void 0, label, nextPath, void 0);
43
- }
44
- /**
45
- * Follows alias bindings until a non-alias binding is reached.
46
- * Returns the last reachable binding; stops early if an alias target is unregistered.
47
- *
48
- * **Warning:** This is a static walk with no cycle detection (`visiting` set). If the
49
- * registry contains a cyclic alias chain (A → B → A), this function will loop
50
- * indefinitely. The runtime resolver prevents such cycles via its own `visiting`
51
- * guard, but callers invoking `expandAliasChain` on a manually-constructed or
52
- * corrupted registry must ensure alias chains are acyclic.
53
- */
54
- function expandAliasChain(lookup, start, pathPrefix) {
55
- let current = start;
56
- let path = pathPrefix;
57
- while (current.kind === "alias") {
58
- const next = resolveDefaultBinding(lookup, current.targetToken, path);
59
- if (next === void 0) return current;
60
- const label = registryKeyLabel(current.targetToken);
61
- path = [...path, label];
62
- current = next;
63
- }
64
- return current;
65
- }
66
- /**
67
- * Lists the direct static dependencies of `consumer` by inspecting binding metadata.
68
- *
69
- * - `constant` / `dynamic` / `async-dynamic` — no enumerable deps (empty array).
70
- * - `alias` — single dependency on the alias target (chased through alias chains).
71
- * - `resolved` — one dependency per entry in `dependencyTokens`; a missing binding
72
- * always throws {@link InternalError} (there is no optional concept for `resolved`).
73
- * - `class` — one dependency per `@injectable()` constructor parameter
74
- * (requires a {@link MetadataReader}). Parameters marked `optional` whose token
75
- * has no binding are silently skipped; non-optional missing tokens throw
76
- * {@link InternalError}.
77
- */
78
- function listResolvedDependencies(consumer, lookup, reader, pathPrefix) {
79
- switch (consumer.kind) {
80
- case "constant":
81
- case "dynamic":
82
- case "async-dynamic": return [];
83
- case "alias": {
84
- const binding = resolveDefaultBinding(lookup, consumer.targetToken, pathPrefix);
85
- if (binding === void 0) return [];
86
- const label = registryKeyLabel(consumer.targetToken);
87
- const nextPath = [...pathPrefix, label];
88
- return [{
89
- binding: expandAliasChain(lookup, binding, nextPath),
90
- path: nextPath,
91
- injectHintLabel: void 0
92
- }];
93
- }
94
- case "resolved": return consumer.dependencyTokens.map((tok) => {
95
- const label = registryKeyLabel(tok);
96
- const nextPath = [...pathPrefix, label];
97
- const binding = resolveDefaultBinding(lookup, tok, pathPrefix);
98
- if (binding === void 0) throw new InternalError(`Missing binding for dependency "${label}" while building dependency graph (resolution path: ${nextPath.join(" -> ")})`);
99
- return {
100
- binding: expandAliasChain(lookup, binding, nextPath),
101
- path: nextPath,
102
- injectHintLabel: void 0
103
- };
104
- });
105
- case "class": {
106
- if (reader === void 0) return [];
107
- const meta = reader.getConstructorMetadata(consumer.implementationClass);
108
- if (meta === void 0 || meta.params.length === 0) return [];
109
- return meta.params.flatMap((param) => {
110
- const tok = param.token;
111
- const label = registryKeyLabel(tok);
112
- const nextPath = [...pathPrefix, label];
113
- const paramHint = param.name !== void 0 ? { name: param.name } : param.tag !== void 0 ? { tag: param.tag } : void 0;
114
- if (param.all === true) {
115
- const bindings = lookup(tok);
116
- if (bindings === void 0 || bindings.length === 0) return [];
117
- const candidates = filterMatchingBindings(bindings, paramHint, void 0);
118
- if (candidates.length === 0) return [];
119
- return candidates.map((binding) => {
120
- return {
121
- binding: expandAliasChain(lookup, binding, nextPath),
122
- path: nextPath,
123
- injectHintLabel: injectHintLabelFromResolveHint(paramHint)
124
- };
4
+ function buildDependencyGraph(registry, metadataReader, options, parentRegistry) {
5
+ const nodes = [];
6
+ const edges = [];
7
+ const includesParent = options?.includeParent === true;
8
+ const addBindings = (reg, fromParent) => {
9
+ for (const binding of reg.allBindings()) {
10
+ const scope = effectiveBindingScope(binding);
11
+ nodes.push({
12
+ id: binding.id,
13
+ tokenName: tokenName(binding.token),
14
+ kind: binding.kind,
15
+ scope,
16
+ fromParent
17
+ });
18
+ if (binding.kind === "class") {
19
+ const meta = metadataReader.getConstructorMetadata(binding.target);
20
+ if (meta !== void 0) meta.params.forEach((param, idx) => {
21
+ const depBinding = reg.getAll(param.token)[0];
22
+ if (depBinding !== void 0) edges.push({
23
+ from: binding.id,
24
+ to: depBinding.id,
25
+ label: `[${idx}]`
26
+ });
27
+ });
28
+ } else if (binding.kind === "resolved" || binding.kind === "resolved-async") binding.deps.forEach((dep, idx) => {
29
+ const depBindings = reg.getAll(dep.token);
30
+ if (depBindings.length > 0 && depBindings[0] !== void 0) {
31
+ const label = dep.name !== void 0 ? `name:${dep.name}` : dep.tags !== void 0 && dep.tags.length > 0 ? `tag:${dep.tags[0]?.[0]}=${String(dep.tags[0]?.[1])}` : `[${idx}]`;
32
+ edges.push({
33
+ from: binding.id,
34
+ to: depBindings[0].id,
35
+ label
125
36
  });
126
37
  }
127
- const binding = resolveDefaultBinding(lookup, tok, pathPrefix);
128
- if (binding === void 0) {
129
- if (param.optional) return [];
130
- throw new InternalError(`Missing binding for constructor parameter "${label}" while building dependency graph (resolution path: ${nextPath.join(" -> ")})`);
131
- }
132
- return [{
133
- binding: expandAliasChain(lookup, binding, nextPath),
134
- path: nextPath,
135
- injectHintLabel: injectHintLabelFromResolveHint(paramHint)
136
- }];
137
38
  });
39
+ else if (binding.kind === "alias") {
40
+ const targetBindings = reg.getAll(binding.target);
41
+ if (targetBindings.length > 0 && targetBindings[0] !== void 0) edges.push({
42
+ from: binding.id,
43
+ to: targetBindings[0].id,
44
+ label: "alias"
45
+ });
46
+ }
138
47
  }
139
- default: return consumer;
140
- }
141
- }
142
- /**
143
- * Flattens the direct dependencies of `consumer` into typed graph edges.
144
- * Used by {@link ContainerInspector} to build DOT and JSON outputs.
145
- */
146
- function collectStaticDependencyEdges(consumer, lookup, reader, pathPrefix) {
147
- const deps = listResolvedDependencies(consumer, lookup, reader, pathPrefix);
148
- const isAliasEdge = consumer.kind === "alias";
149
- return deps.map((dep) => ({
150
- fromBindingId: consumer.id,
151
- toBindingId: dep.binding.id,
152
- resolutionPath: dep.path,
153
- edgeKind: edgeKindFor(consumer, dep.binding),
154
- toBindingConditional: dep.binding.constraint !== void 0,
155
- injectHintLabel: dep.injectHintLabel,
156
- isAliasEdge
157
- }));
48
+ };
49
+ addBindings(registry, false);
50
+ if (includesParent && parentRegistry !== void 0) addBindings(parentRegistry, true);
51
+ return {
52
+ nodes,
53
+ edges,
54
+ includesParent
55
+ };
158
56
  }
159
57
  //#endregion
160
- export { collectStaticDependencyEdges, injectHintLabelFromResolveHint, listResolvedDependencies };
58
+ export { buildDependencyGraph };
@@ -1,14 +1,40 @@
1
+ import { Constructor } from "./constructor-type.mjs";
2
+ import { Token } from "./token.mjs";
3
+ import { BindingIdentifier, BindingKind, BindingScope, ConstraintContext, MaterializationFrame, ResolutionContext, ResolveOptions } from "./types.mjs";
4
+ import { Container } from "./container.mjs";
5
+
1
6
  //#region src/environment.d.ts
2
- /**
3
- * Node-style production gate using `process.env.NODE_ENV`.
4
- * When `process` is unavailable, this returns false (not treated as production).
5
- */
6
- declare function isProductionEnvironment(): boolean;
7
- /**
8
- * True when not in production: `development`, `test`, unset `NODE_ENV`, or any value other than `"production"`.
9
- * The container uses this to run one-time static scope validation after load/resolve so graph issues surface
10
- * during local work and CI tests (e.g. Vitest).
11
- */
12
- declare function isDevelopmentOrTestEnvironment(): boolean;
7
+ declare function runWithContainer<Result>(container: Container, fn: () => Result): Result;
8
+ declare function getActiveContainer(): Container | undefined;
9
+ interface ResolverCallbacks {
10
+ resolveFromContext<const Value>(token: Token<Value> | Constructor<Value>, path: string[], stack: MaterializationFrame[]): Value;
11
+ resolve<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, path: string[], stack: MaterializationFrame[]): Value;
12
+ resolveAsyncFromContext<const Value>(token: Token<Value> | Constructor<Value>, path: string[], stack: MaterializationFrame[]): Promise<Value>;
13
+ resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, path: string[], stack: MaterializationFrame[]): Promise<Value>;
14
+ resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, path: string[], stack: MaterializationFrame[]): Value | undefined;
15
+ resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, path: string[], stack: MaterializationFrame[]): Promise<Value | undefined>;
16
+ resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, path: string[], stack: MaterializationFrame[]): Value[];
17
+ resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, path: string[], stack: MaterializationFrame[]): Promise<Value[]>;
18
+ }
19
+ declare class DefaultResolutionContext implements ResolutionContext {
20
+ private _resolver;
21
+ private _resolutionPath;
22
+ private _materializationStack;
23
+ private _currentHint;
24
+ constructor(resolver: ResolverCallbacks, resolutionPath: string[], materializationStack: MaterializationFrame[], currentHint: ResolveOptions | undefined);
25
+ private _graph;
26
+ get graph(): ConstraintContext;
27
+ reset(resolver: ResolverCallbacks, resolutionPath: string[], materializationStack: MaterializationFrame[], currentHint: ResolveOptions | undefined): void;
28
+ resolve<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value;
29
+ resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value>;
30
+ resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value | undefined;
31
+ resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value | undefined>;
32
+ resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Value[];
33
+ resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint?: ResolveOptions): Promise<Value[]>;
34
+ }
35
+ declare function buildMaterializationFrame(tokenName: string, scope: BindingScope, bindingId: BindingIdentifier, kind: BindingKind, slot: {
36
+ name: string | undefined;
37
+ tags: ReadonlyArray<readonly [string, unknown]>;
38
+ }): MaterializationFrame;
13
39
  //#endregion
14
- export { isDevelopmentOrTestEnvironment, isProductionEnvironment };
40
+ export { DefaultResolutionContext, ResolverCallbacks, buildMaterializationFrame, getActiveContainer, runWithContainer };
@@ -1,20 +1,86 @@
1
1
  //#region src/environment.ts
2
- /**
3
- * Node-style production gate using `process.env.NODE_ENV`.
4
- * When `process` is unavailable, this returns false (not treated as production).
5
- */
6
- function isProductionEnvironment() {
7
- const processRef = globalThis.process;
8
- if (processRef === void 0 || processRef === null) return false;
9
- return processRef.env.NODE_ENV === "production";
2
+ let _activeContainer;
3
+ function runWithContainer(container, fn) {
4
+ const prev = _activeContainer;
5
+ _activeContainer = container;
6
+ try {
7
+ return fn();
8
+ } finally {
9
+ _activeContainer = prev;
10
+ }
10
11
  }
11
- /**
12
- * True when not in production: `development`, `test`, unset `NODE_ENV`, or any value other than `"production"`.
13
- * The container uses this to run one-time static scope validation after load/resolve so graph issues surface
14
- * during local work and CI tests (e.g. Vitest).
15
- */
16
- function isDevelopmentOrTestEnvironment() {
17
- return !isProductionEnvironment();
12
+ function getActiveContainer() {
13
+ return _activeContainer;
14
+ }
15
+ var DefaultResolutionContext = class {
16
+ _resolver;
17
+ _resolutionPath;
18
+ _materializationStack;
19
+ _currentHint;
20
+ constructor(resolver, resolutionPath, materializationStack, currentHint) {
21
+ this._resolver = resolver;
22
+ this._resolutionPath = resolutionPath;
23
+ this._materializationStack = materializationStack;
24
+ this._currentHint = currentHint;
25
+ }
26
+ _graph;
27
+ get graph() {
28
+ if (this._graph === void 0) this._graph = new DefaultConstraintContext(this._resolutionPath, this._materializationStack, this._currentHint);
29
+ return this._graph;
30
+ }
31
+ reset(resolver, resolutionPath, materializationStack, currentHint) {
32
+ this._resolver = resolver;
33
+ this._resolutionPath = resolutionPath;
34
+ this._materializationStack = materializationStack;
35
+ this._currentHint = currentHint;
36
+ this._graph = void 0;
37
+ }
38
+ resolve(token, hint) {
39
+ if (hint === void 0) return this._resolver.resolveFromContext(token, this._resolutionPath, this._materializationStack);
40
+ return this._resolver.resolve(token, hint, this._resolutionPath, this._materializationStack);
41
+ }
42
+ resolveAsync(token, hint) {
43
+ if (hint === void 0) return this._resolver.resolveAsyncFromContext(token, this._resolutionPath, this._materializationStack);
44
+ return this._resolver.resolveAsync(token, hint, this._resolutionPath, this._materializationStack);
45
+ }
46
+ resolveOptional(token, hint) {
47
+ return this._resolver.resolveOptional(token, hint, this._resolutionPath, this._materializationStack);
48
+ }
49
+ resolveOptionalAsync(token, hint) {
50
+ return this._resolver.resolveOptionalAsync(token, hint, this._resolutionPath, this._materializationStack);
51
+ }
52
+ resolveAll(token, hint) {
53
+ return this._resolver.resolveAll(token, hint, this._resolutionPath, this._materializationStack);
54
+ }
55
+ resolveAllAsync(token, hint) {
56
+ return this._resolver.resolveAllAsync(token, hint, this._resolutionPath, this._materializationStack);
57
+ }
58
+ };
59
+ var DefaultConstraintContext = class {
60
+ resolutionPath;
61
+ materializationStack;
62
+ parent;
63
+ currentResolveHint;
64
+ constructor(resolutionPath, materializationStack, currentResolveHint) {
65
+ this.resolutionPath = resolutionPath;
66
+ this.materializationStack = materializationStack;
67
+ this.parent = materializationStack.at(-1);
68
+ this.currentResolveHint = currentResolveHint;
69
+ }
70
+ _ancestors;
71
+ get ancestors() {
72
+ if (this._ancestors === void 0) this._ancestors = this.materializationStack.length > 1 ? this.materializationStack.slice(0, -1) : [];
73
+ return this._ancestors;
74
+ }
75
+ };
76
+ function buildMaterializationFrame(tokenName, scope, bindingId, kind, slot) {
77
+ return {
78
+ tokenName,
79
+ scope,
80
+ bindingId,
81
+ kind,
82
+ slot
83
+ };
18
84
  }
19
85
  //#endregion
20
- export { isDevelopmentOrTestEnvironment, isProductionEnvironment };
86
+ export { DefaultResolutionContext, buildMaterializationFrame, getActiveContainer, runWithContainer };