@codefast/di 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +242 -159
- package/dist/ambient/active-container.d.ts +1 -2
- package/dist/ambient/active-container.js +1 -2
- package/dist/container/binding-builders.d.ts +1 -2
- package/dist/container/binding-builders.js +5 -7
- package/dist/container/container.d.ts +1 -2
- package/dist/container/container.js +4 -6
- package/dist/core/binding-scope.d.ts +1 -2
- package/dist/core/binding-scope.js +1 -2
- package/dist/core/binding.d.ts +16 -4
- package/dist/core/binding.js +30 -6
- package/dist/core/constraint-requirement.d.ts +1 -2
- package/dist/core/constraint-requirement.js +1 -2
- package/dist/core/constructor-type.d.ts +1 -2
- package/dist/core/constructor-type.js +1 -2
- package/dist/core/map-upsert.d.ts +1 -2
- package/dist/core/map-upsert.js +1 -2
- package/dist/core/module.d.ts +1 -2
- package/dist/core/module.js +1 -2
- package/dist/core/registry.d.ts +1 -5
- package/dist/core/registry.js +15 -63
- package/dist/core/tag.d.ts +27 -2
- package/dist/core/tag.js +55 -13
- package/dist/core/token.d.ts +1 -2
- package/dist/core/token.js +1 -2
- package/dist/core/types.d.ts +1 -2
- package/dist/core/types.js +1 -2
- package/dist/decorators/inject.d.ts +1 -2
- package/dist/decorators/inject.js +1 -2
- package/dist/decorators/injectable.d.ts +1 -2
- package/dist/decorators/injectable.js +1 -2
- package/dist/decorators/lifecycle-decorators.d.ts +1 -2
- package/dist/decorators/lifecycle-decorators.js +1 -2
- package/dist/errors/diagnostics.d.ts +1 -2
- package/dist/errors/diagnostics.js +1 -2
- package/dist/errors/errors.d.ts +1 -2
- package/dist/errors/errors.js +29 -5
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/injection/descriptor.d.ts +1 -2
- package/dist/injection/descriptor.js +1 -2
- package/dist/injection/resolve-options.d.ts +18 -14
- package/dist/injection/resolve-options.js +70 -17
- package/dist/introspection/dependency-graph.d.ts +1 -2
- package/dist/introspection/dependency-graph.js +23 -11
- package/dist/introspection/graph-adapters/cytoscape.d.ts +1 -2
- package/dist/introspection/graph-adapters/cytoscape.js +1 -2
- package/dist/introspection/graph-adapters/dot.d.ts +1 -2
- package/dist/introspection/graph-adapters/dot.js +1 -2
- package/dist/introspection/graph-adapters/mermaid.d.ts +1 -2
- package/dist/introspection/graph-adapters/mermaid.js +1 -2
- package/dist/introspection/graph-adapters/reactflow.d.ts +1 -2
- package/dist/introspection/graph-adapters/reactflow.js +1 -2
- package/dist/introspection/inspector.d.ts +1 -2
- package/dist/introspection/inspector.js +1 -2
- package/dist/lifecycle/lifecycle-manager.d.ts +1 -2
- package/dist/lifecycle/lifecycle-manager.js +1 -2
- package/dist/lifecycle/scope-manager.d.ts +1 -2
- package/dist/lifecycle/scope-manager.js +1 -2
- package/dist/metadata/metadata-keys.d.ts +1 -2
- package/dist/metadata/metadata-keys.js +1 -2
- package/dist/metadata/metadata-reader-token.d.ts +1 -2
- package/dist/metadata/metadata-reader-token.js +1 -2
- package/dist/metadata/metadata-types.d.ts +1 -2
- package/dist/metadata/metadata-types.js +1 -2
- package/dist/metadata/symbol-metadata-reader.d.ts +1 -2
- package/dist/metadata/symbol-metadata-reader.js +1 -2
- package/dist/metadata/verifying-metadata-reader.d.ts +1 -2
- package/dist/metadata/verifying-metadata-reader.js +1 -2
- package/dist/resolution/cache/activation-need.d.ts +1 -2
- package/dist/resolution/cache/activation-need.js +1 -2
- package/dist/resolution/cache/binding-lookup-cache.d.ts +2 -5
- package/dist/resolution/cache/binding-lookup-cache.js +2 -40
- package/dist/resolution/cache/class-introspector.d.ts +1 -2
- package/dist/resolution/cache/class-introspector.js +1 -2
- package/dist/resolution/context.d.ts +1 -2
- package/dist/resolution/context.js +1 -2
- package/dist/resolution/path/resolution-path.d.ts +1 -2
- package/dist/resolution/path/resolution-path.js +1 -2
- package/dist/resolution/plan/instantiation-plan.d.ts +5 -14
- package/dist/resolution/plan/instantiation-plan.js +10 -29
- package/dist/resolution/resolver.d.ts +13 -7
- package/dist/resolution/resolver.js +107 -143
- package/dist/resolution/select/binding-select.d.ts +5 -7
- package/dist/resolution/select/binding-select.js +19 -22
- package/dist/resolution/select/constraints.d.ts +1 -2
- package/dist/resolution/select/constraints.js +1 -2
- package/package.json +6 -58
- package/dist/ambient/active-container.d.ts.map +0 -1
- package/dist/ambient/active-container.js.map +0 -1
- package/dist/container/binding-builders.d.ts.map +0 -1
- package/dist/container/binding-builders.js.map +0 -1
- package/dist/container/container.d.ts.map +0 -1
- package/dist/container/container.js.map +0 -1
- package/dist/core/binding-scope.d.ts.map +0 -1
- package/dist/core/binding-scope.js.map +0 -1
- package/dist/core/binding.d.ts.map +0 -1
- package/dist/core/binding.js.map +0 -1
- package/dist/core/constraint-requirement.d.ts.map +0 -1
- package/dist/core/constraint-requirement.js.map +0 -1
- package/dist/core/constructor-type.d.ts.map +0 -1
- package/dist/core/constructor-type.js.map +0 -1
- package/dist/core/map-upsert.d.ts.map +0 -1
- package/dist/core/map-upsert.js.map +0 -1
- package/dist/core/module.d.ts.map +0 -1
- package/dist/core/module.js.map +0 -1
- package/dist/core/registry.d.ts.map +0 -1
- package/dist/core/registry.js.map +0 -1
- package/dist/core/tag.d.ts.map +0 -1
- package/dist/core/tag.js.map +0 -1
- package/dist/core/token.d.ts.map +0 -1
- package/dist/core/token.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/decorators/inject.d.ts.map +0 -1
- package/dist/decorators/inject.js.map +0 -1
- package/dist/decorators/injectable.d.ts.map +0 -1
- package/dist/decorators/injectable.js.map +0 -1
- package/dist/decorators/lifecycle-decorators.d.ts.map +0 -1
- package/dist/decorators/lifecycle-decorators.js.map +0 -1
- package/dist/errors/diagnostics.d.ts.map +0 -1
- package/dist/errors/diagnostics.js.map +0 -1
- package/dist/errors/errors.d.ts.map +0 -1
- package/dist/errors/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/injection/descriptor.d.ts.map +0 -1
- package/dist/injection/descriptor.js.map +0 -1
- package/dist/injection/resolve-options.d.ts.map +0 -1
- package/dist/injection/resolve-options.js.map +0 -1
- package/dist/introspection/dependency-graph.d.ts.map +0 -1
- package/dist/introspection/dependency-graph.js.map +0 -1
- package/dist/introspection/graph-adapters/cytoscape.d.ts.map +0 -1
- package/dist/introspection/graph-adapters/cytoscape.js.map +0 -1
- package/dist/introspection/graph-adapters/dot.d.ts.map +0 -1
- package/dist/introspection/graph-adapters/dot.js.map +0 -1
- package/dist/introspection/graph-adapters/mermaid.d.ts.map +0 -1
- package/dist/introspection/graph-adapters/mermaid.js.map +0 -1
- package/dist/introspection/graph-adapters/reactflow.d.ts.map +0 -1
- package/dist/introspection/graph-adapters/reactflow.js.map +0 -1
- package/dist/introspection/inspector.d.ts.map +0 -1
- package/dist/introspection/inspector.js.map +0 -1
- package/dist/lifecycle/lifecycle-manager.d.ts.map +0 -1
- package/dist/lifecycle/lifecycle-manager.js.map +0 -1
- package/dist/lifecycle/scope-manager.d.ts.map +0 -1
- package/dist/lifecycle/scope-manager.js.map +0 -1
- package/dist/metadata/metadata-keys.d.ts.map +0 -1
- package/dist/metadata/metadata-keys.js.map +0 -1
- package/dist/metadata/metadata-reader-token.d.ts.map +0 -1
- package/dist/metadata/metadata-reader-token.js.map +0 -1
- package/dist/metadata/metadata-types.d.ts.map +0 -1
- package/dist/metadata/metadata-types.js.map +0 -1
- package/dist/metadata/symbol-metadata-reader.d.ts.map +0 -1
- package/dist/metadata/symbol-metadata-reader.js.map +0 -1
- package/dist/metadata/verifying-metadata-reader.d.ts.map +0 -1
- package/dist/metadata/verifying-metadata-reader.js.map +0 -1
- package/dist/resolution/cache/activation-need.d.ts.map +0 -1
- package/dist/resolution/cache/activation-need.js.map +0 -1
- package/dist/resolution/cache/binding-lookup-cache.d.ts.map +0 -1
- package/dist/resolution/cache/binding-lookup-cache.js.map +0 -1
- package/dist/resolution/cache/class-introspector.d.ts.map +0 -1
- package/dist/resolution/cache/class-introspector.js.map +0 -1
- package/dist/resolution/context.d.ts.map +0 -1
- package/dist/resolution/context.js.map +0 -1
- package/dist/resolution/path/resolution-path.d.ts.map +0 -1
- package/dist/resolution/path/resolution-path.js.map +0 -1
- package/dist/resolution/plan/instantiation-plan.d.ts.map +0 -1
- package/dist/resolution/plan/instantiation-plan.js.map +0 -1
- package/dist/resolution/resolver.d.ts.map +0 -1
- package/dist/resolution/resolver.js.map +0 -1
- package/dist/resolution/select/binding-select.d.ts.map +0 -1
- package/dist/resolution/select/binding-select.js.map +0 -1
- package/dist/resolution/select/constraints.d.ts.map +0 -1
- package/dist/resolution/select/constraints.js.map +0 -1
- package/src/ambient/active-container.ts +0 -69
- package/src/container/binding-builders.ts +0 -332
- package/src/container/container.ts +0 -973
- package/src/core/binding-scope.ts +0 -15
- package/src/core/binding.ts +0 -477
- package/src/core/constraint-requirement.ts +0 -94
- package/src/core/constructor-type.ts +0 -18
- package/src/core/map-upsert.ts +0 -53
- package/src/core/module.ts +0 -117
- package/src/core/registry.ts +0 -371
- package/src/core/tag.ts +0 -158
- package/src/core/token.ts +0 -31
- package/src/core/types.ts +0 -149
- package/src/decorators/inject.ts +0 -101
- package/src/decorators/injectable.ts +0 -134
- package/src/decorators/lifecycle-decorators.ts +0 -43
- package/src/errors/diagnostics.ts +0 -45
- package/src/errors/errors.ts +0 -476
- package/src/index.ts +0 -139
- package/src/injection/descriptor.ts +0 -218
- package/src/injection/resolve-options.ts +0 -144
- package/src/introspection/dependency-graph.ts +0 -282
- package/src/introspection/graph-adapters/cytoscape.ts +0 -78
- package/src/introspection/graph-adapters/dot.ts +0 -32
- package/src/introspection/graph-adapters/mermaid.ts +0 -61
- package/src/introspection/graph-adapters/reactflow.ts +0 -84
- package/src/introspection/inspector.ts +0 -134
- package/src/lifecycle/lifecycle-manager.ts +0 -272
- package/src/lifecycle/scope-manager.ts +0 -158
- package/src/metadata/metadata-keys.ts +0 -28
- package/src/metadata/metadata-reader-token.ts +0 -10
- package/src/metadata/metadata-types.ts +0 -57
- package/src/metadata/symbol-metadata-reader.ts +0 -126
- package/src/metadata/verifying-metadata-reader.ts +0 -41
- package/src/resolution/cache/activation-need.ts +0 -87
- package/src/resolution/cache/binding-lookup-cache.ts +0 -209
- package/src/resolution/cache/class-introspector.ts +0 -256
- package/src/resolution/context.ts +0 -331
- package/src/resolution/path/resolution-path.ts +0 -167
- package/src/resolution/plan/instantiation-plan.ts +0 -617
- package/src/resolution/resolver.ts +0 -1675
- package/src/resolution/select/binding-select.ts +0 -210
- package/src/resolution/select/constraints.ts +0 -146
|
@@ -6,13 +6,9 @@ import { getOrInsertComputed } from "#/core/map-upsert";
|
|
|
6
6
|
* @since 0.5.0-canary.8
|
|
7
7
|
*/
|
|
8
8
|
export const ALIAS_HOP_LIMIT = 32;
|
|
9
|
-
/**
|
|
10
|
-
* @since 0.5.0-canary.8
|
|
11
|
-
*/
|
|
12
|
-
const newNameToEntryMap = () => new Map();
|
|
13
9
|
const newTagToEntryMap = () => new Map();
|
|
14
10
|
/**
|
|
15
|
-
* A version-stamped cache of binding lookups by token
|
|
11
|
+
* A version-stamped cache of binding lookups by token and criterion across the container chain.
|
|
16
12
|
*
|
|
17
13
|
* @since 0.5.0-canary.9
|
|
18
14
|
*/
|
|
@@ -24,8 +20,6 @@ export class BindingLookupCache {
|
|
|
24
20
|
// is tracked by the token slot rather than by the entry.
|
|
25
21
|
#lastToken;
|
|
26
22
|
#lastEntry = null;
|
|
27
|
-
#byTokenAndName = new Map();
|
|
28
|
-
#namedVersion = -1;
|
|
29
23
|
#byTokenAndTag = new Map();
|
|
30
24
|
#taggedVersion = -1;
|
|
31
25
|
// One entry in front of the tag map, and the map is not written until a second distinct request
|
|
@@ -70,23 +64,6 @@ export class BindingLookupCache {
|
|
|
70
64
|
this.#lastEntry = entry;
|
|
71
65
|
return entry;
|
|
72
66
|
}
|
|
73
|
-
/** `null` when the name's shape needs the full selection path. */
|
|
74
|
-
namedEntry(token, name) {
|
|
75
|
-
const version = this.chainVersion();
|
|
76
|
-
if (version !== this.#namedVersion) {
|
|
77
|
-
this.#byTokenAndName.clear();
|
|
78
|
-
this.#namedVersion = version;
|
|
79
|
-
}
|
|
80
|
-
// Computed, not eager: this runs on every named resolve, and the eager form would allocate a
|
|
81
|
-
// Map per call only to discard it on the hit that follows.
|
|
82
|
-
const byName = getOrInsertComputed(this.#byTokenAndName, token, newNameToEntryMap);
|
|
83
|
-
let entry = byName.get(name);
|
|
84
|
-
if (entry === undefined) {
|
|
85
|
-
entry = this.#findNamedInChain(token, name);
|
|
86
|
-
byName.set(name, entry);
|
|
87
|
-
}
|
|
88
|
-
return entry;
|
|
89
|
-
}
|
|
90
67
|
/** `null` when the tag's shape needs the full selection path. */
|
|
91
68
|
taggedEntry(token, tag) {
|
|
92
69
|
const version = this.chainVersion();
|
|
@@ -144,20 +121,6 @@ export class BindingLookupCache {
|
|
|
144
121
|
}
|
|
145
122
|
return this.#parent === undefined ? null : this.#parent.#findDefaultInChain(token);
|
|
146
123
|
}
|
|
147
|
-
#findNamedInChain(token, name) {
|
|
148
|
-
const named = this.#registry.getSimpleNamed(token, name);
|
|
149
|
-
if (named !== undefined) {
|
|
150
|
-
// Predicates need a live context; aliases carry options through the full path.
|
|
151
|
-
if (named.predicate !== undefined || named.kind === "alias") {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
return { binding: named, owner: this.#owner };
|
|
155
|
-
}
|
|
156
|
-
if (this.#registry.has(token)) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
return this.#parent === undefined ? null : this.#parent.#findNamedInChain(token, name);
|
|
160
|
-
}
|
|
161
124
|
#findTaggedInChain(token, tag) {
|
|
162
125
|
const tagged = this.#registry.getSimpleTagged(token, tag);
|
|
163
126
|
if (tagged !== undefined) {
|
|
@@ -172,5 +135,4 @@ export class BindingLookupCache {
|
|
|
172
135
|
}
|
|
173
136
|
return this.#parent === undefined ? null : this.#parent.#findTaggedInChain(token, tag);
|
|
174
137
|
}
|
|
175
|
-
}
|
|
176
|
-
//# sourceMappingURL=binding-lookup-cache.js.map
|
|
138
|
+
}
|
|
@@ -64,5 +64,4 @@ export declare class ClassIntrospector {
|
|
|
64
64
|
/** True when the class has accessor injection, which reads the container during construction. */
|
|
65
65
|
needsActiveContainer(target: Constructor): boolean;
|
|
66
66
|
instantiate(target: Constructor, deps: Array<unknown>, resolution?: AmbientResolution): unknown;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=class-introspector.d.ts.map
|
|
67
|
+
}
|
|
@@ -86,5 +86,4 @@ export declare class AsyncCascadeContext implements ResolutionContext {
|
|
|
86
86
|
*
|
|
87
87
|
* @since 0.3.16-canary.0
|
|
88
88
|
*/
|
|
89
|
-
export declare function buildResolutionFrame(tokenName: string, scope: BindingScope, bindingId: BindingIdentifier, kind: BindingKind, slot: ResolutionFrame["slot"]): ResolutionFrame;
|
|
90
|
-
//# sourceMappingURL=context.d.ts.map
|
|
89
|
+
export declare function buildResolutionFrame(tokenName: string, scope: BindingScope, bindingId: BindingIdentifier, kind: BindingKind, slot: ResolutionFrame["slot"]): ResolutionFrame;
|
|
@@ -90,5 +90,4 @@ export declare function branchDepthOf(branch: OwnedBranchStack): OwnedBranchDept
|
|
|
90
90
|
* @since 0.5.0-canary.9
|
|
91
91
|
*/
|
|
92
92
|
export declare function extendResolutionBranch(resolutionStack: Array<ResolutionFrame>, branchDepth: BranchDepth, frame: ResolutionFrame): OwnedBranchStack;
|
|
93
|
-
export {};
|
|
94
|
-
//# sourceMappingURL=resolution-path.d.ts.map
|
|
93
|
+
export {};
|
|
@@ -45,21 +45,13 @@ export interface InstantiationPlanHost {
|
|
|
45
45
|
/** Options-less lookup with alias hops folded; `null` when the fast lane can't answer. */
|
|
46
46
|
lookupDependencyEntry(token: Token<unknown> | Constructor): InstantiationPlanDependencyEntry | null;
|
|
47
47
|
/**
|
|
48
|
-
* A
|
|
48
|
+
* A single-criterion lookup a plan may bake in, or `null` when the answer is not the compiler's
|
|
49
|
+
* to make.
|
|
49
50
|
*
|
|
50
|
-
* @remarks Selection for a
|
|
51
|
+
* @remarks Selection for such a request is an index hit *and* a predicate, and a predicate reads
|
|
51
52
|
* the resolution path — so only a candidate carrying none of one can be decided ahead of time.
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
-
name: string;
|
|
55
|
-
}): InstantiationPlanDependencyEntry | null;
|
|
56
|
-
/**
|
|
57
|
-
* The named lookup's single-tag twin, or `null` under the same rule.
|
|
58
|
-
*
|
|
59
|
-
* @remarks Optional so a host predating it stays a valid host — a compiler given none simply
|
|
60
|
-
* escapes the dependency, which is exactly the pre-settlement behavior.
|
|
61
|
-
*/
|
|
62
|
-
lookupPathIndependentTaggedEntry?(token: Token<unknown> | Constructor, options: ResolveOptions): InstantiationPlanDependencyEntry | null;
|
|
54
|
+
lookupPathIndependentEntry(token: Token<unknown> | Constructor, options: ResolveOptions): InstantiationPlanDependencyEntry | null;
|
|
63
55
|
/** The frame the interpreted path pushes for this binding, so escapes can replay it. */
|
|
64
56
|
getResolutionFrame(binding: Binding): ResolutionFrame;
|
|
65
57
|
/** Runtime resolve for an escaped dependency, seeded with the ancestor frames above it. */
|
|
@@ -95,5 +87,4 @@ export declare class InstantiationPlanCompiler {
|
|
|
95
87
|
compileAsync(binding: Binding & {
|
|
96
88
|
kind: "class" | "resolved" | "resolved-async";
|
|
97
89
|
}): InstantiationPlanCompileResult;
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=instantiation-plan.d.ts.map
|
|
90
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NO_INSTANCE } from "#/core/binding";
|
|
2
2
|
import { tokenName } from "#/core/token";
|
|
3
3
|
import { AsyncResolutionError } from "#/errors/errors";
|
|
4
|
-
import { injectionSlotToResolveOptions
|
|
4
|
+
import { injectionSlotToResolveOptions } from "#/injection/resolve-options";
|
|
5
5
|
// Past this depth a dependency escapes to the runtime path rather than inlining further —
|
|
6
6
|
// compiled closures nest one JS frame per level, and pathological graphs are the runtime's job.
|
|
7
7
|
const PLAN_DEPTH_LIMIT = 32;
|
|
@@ -126,20 +126,11 @@ export class InstantiationPlanCompiler {
|
|
|
126
126
|
return this.#compileEscapeThunk(token, ancestors, "optional", options);
|
|
127
127
|
}
|
|
128
128
|
if (options !== undefined) {
|
|
129
|
-
// A
|
|
130
|
-
// escapes only because
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return this.#compileDepThunk(named, compileStack, depth, ancestors, options);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
// The host owns the whole single-tag decision, including whether the options qualify.
|
|
139
|
-
const tagged = this.#host.lookupPathIndependentTaggedEntry?.(token, options);
|
|
140
|
-
if (tagged !== null && tagged !== undefined) {
|
|
141
|
-
return this.#compileDepThunk(tagged, compileStack, depth, ancestors, options);
|
|
142
|
-
}
|
|
129
|
+
// A criterion the registry can settle without reading a path is a dependency like any other:
|
|
130
|
+
// it escapes only because the host cannot decide it ahead of time.
|
|
131
|
+
const indexed = this.#host.lookupPathIndependentEntry(token, options);
|
|
132
|
+
if (indexed !== null) {
|
|
133
|
+
return this.#compileDepThunk(indexed, compileStack, depth, ancestors, options);
|
|
143
134
|
}
|
|
144
135
|
return this.#compileEscapeThunk(token, ancestors, "single", options);
|
|
145
136
|
}
|
|
@@ -359,18 +350,9 @@ export class InstantiationPlanCompiler {
|
|
|
359
350
|
return this.#compileAsyncEscapeThunk(token, ancestors, "optional", options);
|
|
360
351
|
}
|
|
361
352
|
if (options !== undefined) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
return this.#compileAsyncDepThunk(named, compileStack, depth, ancestors, options);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
// The host owns the whole single-tag decision, including whether the options qualify.
|
|
370
|
-
const tagged = this.#host.lookupPathIndependentTaggedEntry?.(token, options);
|
|
371
|
-
if (tagged !== null && tagged !== undefined) {
|
|
372
|
-
return this.#compileAsyncDepThunk(tagged, compileStack, depth, ancestors, options);
|
|
373
|
-
}
|
|
353
|
+
const indexed = this.#host.lookupPathIndependentEntry(token, options);
|
|
354
|
+
if (indexed !== null) {
|
|
355
|
+
return this.#compileAsyncDepThunk(indexed, compileStack, depth, ancestors, options);
|
|
374
356
|
}
|
|
375
357
|
return this.#compileAsyncEscapeThunk(token, ancestors, "single", options);
|
|
376
358
|
}
|
|
@@ -417,5 +399,4 @@ export class InstantiationPlanCompiler {
|
|
|
417
399
|
}
|
|
418
400
|
return this.#compileAsyncEscapeThunk(binding.token, ancestors, "single", options);
|
|
419
401
|
}
|
|
420
|
-
}
|
|
421
|
-
//# sourceMappingURL=instantiation-plan.js.map
|
|
402
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { Container } from "#/container/container";
|
|
|
2
2
|
import type { Binding } from "#/core/binding";
|
|
3
3
|
import type { BindingRegistry } from "#/core/registry";
|
|
4
4
|
import type { Token } from "#/core/token";
|
|
5
|
-
import type { Constructor, ResolutionFrame, ResolveOptions } from "#/core/types";
|
|
5
|
+
import type { BindingTag, Constructor, ResolutionFrame, ResolveOptions } from "#/core/types";
|
|
6
6
|
import type { ResolutionDiagnostics } from "#/errors/diagnostics";
|
|
7
7
|
import type { LifecycleManager } from "#/lifecycle/lifecycle-manager";
|
|
8
8
|
import type { ScopeManager } from "#/lifecycle/scope-manager";
|
|
@@ -40,12 +40,19 @@ export declare class DependencyResolver implements ResolverCallbacks {
|
|
|
40
40
|
*/
|
|
41
41
|
peekCandidateBindingsForValidate(token: Token<unknown> | Constructor, options: ResolveOptions | undefined): ReadonlyArray<Binding>;
|
|
42
42
|
resolveFromContext<Value>(token: Token<Value> | Constructor<Value>, resolutionStack: Array<ResolutionFrame>): Value;
|
|
43
|
-
resolve<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame
|
|
44
|
-
resolveOptional<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame
|
|
43
|
+
resolve<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame>, precomputedCriterion?: BindingTag | null): Value;
|
|
44
|
+
resolveOptional<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame>, precomputedCriterion?: BindingTag | null): Value | undefined;
|
|
45
45
|
resolveAll<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame>): Array<Value>;
|
|
46
46
|
resolveAsyncFromContext<Value>(token: Token<Value> | Constructor<Value>, resolutionStack: Array<ResolutionFrame>, branchDepth: BranchDepth): Promise<Value>;
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Instantiates one owned binding directly, bypassing selection.
|
|
49
|
+
*
|
|
50
|
+
* @remarks Warm-up must build the binding it inspected: re-selecting by the slot's own criteria
|
|
51
|
+
* could pick a different candidate whose criteria are a subset of them.
|
|
52
|
+
*/
|
|
53
|
+
warmBindingAsync(binding: Binding, options: ResolveOptions | undefined): Promise<unknown>;
|
|
54
|
+
resolveAsync<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame>, branchDepth?: BranchDepth, precomputedCriterion?: BindingTag | null): Promise<Value>;
|
|
55
|
+
resolveOptionalAsync<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame>, branchDepth?: BranchDepth, precomputedCriterion?: BindingTag | null): Promise<Value | undefined>;
|
|
49
56
|
resolveAllAsync<Value>(token: Token<Value> | Constructor<Value>, options: ResolveOptions | undefined, resolutionStack: Array<ResolutionFrame>, branchDepth?: BranchDepth): Promise<Array<Value>>;
|
|
50
57
|
/**
|
|
51
58
|
* Entry for a request a factory makes from inside an open synchronous cascade.
|
|
@@ -56,5 +63,4 @@ export declare class DependencyResolver implements ResolverCallbacks {
|
|
|
56
63
|
resolveAsyncFromCascade(token: Token<unknown> | Constructor): Promise<unknown>;
|
|
57
64
|
/** Entry for a resolve the container starts, which opens the cascade rather than joining one. */
|
|
58
65
|
resolveAsyncFromRoot(token: Token<unknown> | Constructor): Promise<unknown>;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=resolver.d.ts.map
|
|
66
|
+
}
|