@codefast/di 0.5.0-canary.4 → 0.5.0-canary.6
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 +12 -0
- package/README.md +67 -499
- package/dist/binding-scope.d.ts +10 -0
- package/dist/binding-scope.d.ts.map +1 -0
- package/dist/binding-scope.js +24 -0
- package/dist/binding-scope.js.map +1 -0
- package/dist/binding-select.d.ts +16 -0
- package/dist/binding-select.d.ts.map +1 -0
- package/dist/binding-select.js +130 -0
- package/dist/binding-select.js.map +1 -0
- package/dist/binding.d.ts +194 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +46 -0
- package/dist/binding.js.map +1 -0
- package/dist/constraints.d.ts +51 -0
- package/dist/constraints.d.ts.map +1 -0
- package/dist/constraints.js +88 -0
- package/dist/constraints.js.map +1 -0
- package/dist/{constructor-type.d.mts → constructor-type.d.ts} +3 -5
- package/dist/constructor-type.d.ts.map +1 -0
- package/dist/constructor-type.js +2 -0
- package/dist/constructor-type.js.map +1 -0
- package/dist/container.d.ts +58 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +853 -0
- package/dist/container.js.map +1 -0
- package/dist/decorators/inject.d.ts +46 -0
- package/dist/decorators/inject.d.ts.map +1 -0
- package/dist/decorators/inject.js +145 -0
- package/dist/decorators/inject.js.map +1 -0
- package/dist/decorators/injectable.d.ts +29 -0
- package/dist/decorators/injectable.d.ts.map +1 -0
- package/dist/decorators/injectable.js +53 -0
- package/dist/decorators/injectable.js.map +1 -0
- package/dist/decorators/lifecycle-decorators.d.ts +9 -0
- package/dist/decorators/lifecycle-decorators.d.ts.map +1 -0
- package/dist/decorators/lifecycle-decorators.js +40 -0
- package/dist/decorators/lifecycle-decorators.js.map +1 -0
- package/dist/dependency-graph.d.ts +40 -0
- package/dist/dependency-graph.d.ts.map +1 -0
- package/dist/dependency-graph.js +66 -0
- package/dist/dependency-graph.js.map +1 -0
- package/dist/environment.d.ts +51 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +100 -0
- package/dist/environment.js.map +1 -0
- package/dist/errors.d.ts +150 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +197 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph-adapters/cytoscape.d.ts +33 -0
- package/dist/graph-adapters/cytoscape.d.ts.map +1 -0
- package/dist/graph-adapters/cytoscape.js +30 -0
- package/dist/graph-adapters/cytoscape.js.map +1 -0
- package/dist/graph-adapters/dot.d.ts +6 -0
- package/dist/graph-adapters/dot.d.ts.map +1 -0
- package/dist/graph-adapters/dot.js +18 -0
- package/dist/graph-adapters/dot.js.map +1 -0
- package/dist/graph-adapters/reactflow.d.ts +38 -0
- package/dist/graph-adapters/reactflow.d.ts.map +1 -0
- package/dist/graph-adapters/reactflow.js +23 -0
- package/dist/graph-adapters/reactflow.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector.d.ts +44 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +82 -0
- package/dist/inspector.js.map +1 -0
- package/dist/lifecycle.d.ts +21 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +174 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/metadata/{metadata-keys.d.mts → metadata-keys.d.ts} +5 -7
- package/dist/metadata/metadata-keys.d.ts.map +1 -0
- package/dist/metadata/metadata-keys.js +25 -0
- package/dist/metadata/metadata-keys.js.map +1 -0
- package/dist/metadata/metadata-reader-token.d.ts +7 -0
- package/dist/metadata/metadata-reader-token.d.ts.map +1 -0
- package/dist/metadata/metadata-reader-token.js +6 -0
- package/dist/metadata/metadata-reader-token.js.map +1 -0
- package/dist/metadata/metadata-types.d.ts +48 -0
- package/dist/metadata/metadata-types.d.ts.map +1 -0
- package/dist/metadata/metadata-types.js +2 -0
- package/dist/metadata/metadata-types.js.map +1 -0
- package/dist/metadata/symbol-metadata-reader.d.ts +20 -0
- package/dist/metadata/symbol-metadata-reader.d.ts.map +1 -0
- package/dist/metadata/symbol-metadata-reader.js +34 -0
- package/dist/metadata/symbol-metadata-reader.js.map +1 -0
- package/dist/module.d.ts +60 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +47 -0
- package/dist/module.js.map +1 -0
- package/dist/registry.d.ts +41 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +208 -0
- package/dist/registry.js.map +1 -0
- package/dist/resolve-options.d.ts +19 -0
- package/dist/resolve-options.d.ts.map +1 -0
- package/dist/resolve-options.js +32 -0
- package/dist/resolve-options.js.map +1 -0
- package/dist/resolver.d.ts +90 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +1208 -0
- package/dist/resolver.js.map +1 -0
- package/dist/scope.d.ts +25 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +61 -0
- package/dist/scope.js.map +1 -0
- package/dist/token.d.ts +23 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +25 -0
- package/dist/token.js.map +1 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +87 -79
- package/dist/binding-scope.d.mts +0 -13
- package/dist/binding-scope.mjs +0 -21
- package/dist/binding-select.d.mts +0 -19
- package/dist/binding-select.mjs +0 -72
- package/dist/binding.d.mts +0 -191
- package/dist/binding.mjs +0 -36
- package/dist/constraints.d.mts +0 -55
- package/dist/constraints.mjs +0 -87
- package/dist/constructor-type.mjs +0 -1
- package/dist/container.d.mts +0 -62
- package/dist/container.mjs +0 -741
- package/dist/decorators/inject.d.mts +0 -49
- package/dist/decorators/inject.mjs +0 -136
- package/dist/decorators/injectable.d.mts +0 -32
- package/dist/decorators/injectable.mjs +0 -57
- package/dist/decorators/lifecycle-decorators.d.mts +0 -11
- package/dist/decorators/lifecycle-decorators.mjs +0 -38
- package/dist/dependency-graph.d.mts +0 -43
- package/dist/dependency-graph.mjs +0 -63
- package/dist/environment.d.mts +0 -55
- package/dist/environment.mjs +0 -98
- package/dist/errors.d.mts +0 -153
- package/dist/errors.mjs +0 -197
- package/dist/graph-adapters/cytoscape.d.mts +0 -36
- package/dist/graph-adapters/cytoscape.mjs +0 -26
- package/dist/graph-adapters/dot.d.mts +0 -9
- package/dist/graph-adapters/dot.mjs +0 -20
- package/dist/graph-adapters/reactflow.d.mts +0 -41
- package/dist/graph-adapters/reactflow.mjs +0 -29
- package/dist/index.d.mts +0 -18
- package/dist/index.mjs +0 -12
- package/dist/inspector.d.mts +0 -48
- package/dist/inspector.mjs +0 -71
- package/dist/lifecycle.d.mts +0 -25
- package/dist/lifecycle.mjs +0 -118
- package/dist/metadata/metadata-keys.mjs +0 -27
- package/dist/metadata/metadata-reader-token.d.mts +0 -10
- package/dist/metadata/metadata-reader-token.mjs +0 -8
- package/dist/metadata/metadata-types.d.mts +0 -51
- package/dist/metadata/metadata-types.mjs +0 -1
- package/dist/metadata/symbol-metadata-reader.d.mts +0 -23
- package/dist/metadata/symbol-metadata-reader.mjs +0 -29
- package/dist/module.d.mts +0 -62
- package/dist/module.mjs +0 -42
- package/dist/registry.d.mts +0 -45
- package/dist/registry.mjs +0 -163
- package/dist/resolve-options.d.mts +0 -22
- package/dist/resolve-options.mjs +0 -28
- package/dist/resolver.d.mts +0 -94
- package/dist/resolver.mjs +0 -767
- package/dist/scope.d.mts +0 -28
- package/dist/scope.mjs +0 -58
- package/dist/token.d.mts +0 -25
- package/dist/token.mjs +0 -22
- package/dist/types.d.mts +0 -92
- package/dist/types.mjs +0 -1
package/dist/errors.d.mts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { BindingIdentifier, BindingScope, ResolveOptions } from "./types.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/errors.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* @since 0.3.16-canary.0
|
|
6
|
-
*/
|
|
7
|
-
declare abstract class DiError extends Error {
|
|
8
|
-
abstract readonly code: string;
|
|
9
|
-
constructor(message: string);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @since 0.3.16-canary.0
|
|
13
|
-
*/
|
|
14
|
-
declare class InternalError extends DiError {
|
|
15
|
-
readonly code = "INTERNAL_ERROR";
|
|
16
|
-
constructor(message: string);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @since 0.3.16-canary.0
|
|
20
|
-
*/
|
|
21
|
-
declare class TokenNotBoundError extends DiError {
|
|
22
|
-
readonly code = "TOKEN_NOT_BOUND";
|
|
23
|
-
readonly tokenName: string;
|
|
24
|
-
constructor(tokenName: string);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @since 0.3.16-canary.0
|
|
28
|
-
*/
|
|
29
|
-
declare class NoMatchingBindingError extends DiError {
|
|
30
|
-
readonly code = "NO_MATCHING_BINDING";
|
|
31
|
-
readonly tokenName: string;
|
|
32
|
-
readonly options: ResolveOptions;
|
|
33
|
-
readonly availableSlots: Array<string>;
|
|
34
|
-
constructor(tokenName: string, options: ResolveOptions, availableSlots: Array<string>);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @since 0.3.16-canary.0
|
|
38
|
-
*/
|
|
39
|
-
declare class AmbiguousBindingError extends DiError {
|
|
40
|
-
readonly code = "AMBIGUOUS_BINDING";
|
|
41
|
-
readonly tokenName: string;
|
|
42
|
-
readonly candidateIds: ReadonlyArray<BindingIdentifier>;
|
|
43
|
-
constructor(tokenName: string, candidateIds: ReadonlyArray<BindingIdentifier>);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @since 0.3.16-canary.0
|
|
47
|
-
*/
|
|
48
|
-
declare class CircularDependencyError extends DiError {
|
|
49
|
-
readonly code = "CIRCULAR_DEPENDENCY";
|
|
50
|
-
readonly cycle: Array<string>;
|
|
51
|
-
constructor(cycle: Array<string>);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @since 0.3.16-canary.0
|
|
55
|
-
*/
|
|
56
|
-
declare class AsyncResolutionError extends DiError {
|
|
57
|
-
readonly code = "ASYNC_RESOLUTION";
|
|
58
|
-
readonly tokenName: string;
|
|
59
|
-
readonly asyncSourceToken: string;
|
|
60
|
-
constructor(tokenName: string, asyncSourceToken: string);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* @since 0.3.16-canary.0
|
|
64
|
-
*/
|
|
65
|
-
declare class AsyncDeactivationError extends DiError {
|
|
66
|
-
readonly code = "ASYNC_DEACTIVATION";
|
|
67
|
-
readonly tokenName: string;
|
|
68
|
-
constructor(tokenName: string);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @since 0.3.16-canary.0
|
|
72
|
-
*/
|
|
73
|
-
interface ScopeViolationDetails {
|
|
74
|
-
readonly consumerToken: string;
|
|
75
|
-
readonly consumerScope: BindingScope;
|
|
76
|
-
readonly dependencyToken: string;
|
|
77
|
-
readonly dependencyScope: BindingScope;
|
|
78
|
-
readonly path: Array<string>;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @since 0.3.16-canary.0
|
|
82
|
-
*/
|
|
83
|
-
declare class ScopeViolationError extends DiError {
|
|
84
|
-
readonly code = "SCOPE_VIOLATION";
|
|
85
|
-
readonly details: ScopeViolationDetails;
|
|
86
|
-
constructor(details: ScopeViolationDetails);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @since 0.3.16-canary.0
|
|
90
|
-
*/
|
|
91
|
-
declare class MissingMetadataError extends DiError {
|
|
92
|
-
readonly code = "MISSING_METADATA";
|
|
93
|
-
readonly targetName: string;
|
|
94
|
-
constructor(targetName: string);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @since 0.3.16-canary.0
|
|
98
|
-
*/
|
|
99
|
-
declare class AsyncModuleLoadError extends DiError {
|
|
100
|
-
readonly code = "ASYNC_MODULE_LOAD";
|
|
101
|
-
readonly moduleName: string;
|
|
102
|
-
constructor(moduleName: string);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @since 0.3.16-canary.0
|
|
106
|
-
*/
|
|
107
|
-
declare class SyncDisposalNotSupportedError extends DiError {
|
|
108
|
-
readonly code = "SYNC_DISPOSAL_NOT_SUPPORTED";
|
|
109
|
-
constructor();
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* @since 0.3.16-canary.0
|
|
113
|
-
*/
|
|
114
|
-
declare class MissingScopeContextError extends DiError {
|
|
115
|
-
readonly code = "MISSING_SCOPE_CONTEXT";
|
|
116
|
-
readonly tokenName: string;
|
|
117
|
-
constructor(tokenName: string);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @since 0.3.16-canary.0
|
|
121
|
-
*/
|
|
122
|
-
declare class MissingContainerContextError extends DiError {
|
|
123
|
-
readonly code = "MISSING_CONTAINER_CONTEXT";
|
|
124
|
-
readonly targetName: string;
|
|
125
|
-
constructor(targetName: string);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @since 0.3.16-canary.0
|
|
129
|
-
*/
|
|
130
|
-
declare class RebindUnboundTokenError extends DiError {
|
|
131
|
-
readonly code = "REBIND_UNBOUND_TOKEN";
|
|
132
|
-
readonly tokenName: string;
|
|
133
|
-
constructor(tokenName: string);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @since 0.3.16-canary.0
|
|
137
|
-
*/
|
|
138
|
-
declare class DisposedContainerError extends DiError {
|
|
139
|
-
readonly code = "DISPOSED_CONTAINER";
|
|
140
|
-
constructor();
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* @since 0.3.16-canary.0
|
|
144
|
-
*/
|
|
145
|
-
declare class AsyncActivationError extends DiError {
|
|
146
|
-
readonly code = "ASYNC_ACTIVATION";
|
|
147
|
-
readonly tokenName: string;
|
|
148
|
-
readonly hookKind: "postConstruct" | "onActivation";
|
|
149
|
-
readonly methodName: string | undefined;
|
|
150
|
-
constructor(tokenName: string, hookKind: "postConstruct" | "onActivation", methodName?: string);
|
|
151
|
-
}
|
|
152
|
-
//#endregion
|
|
153
|
-
export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationDetails, ScopeViolationError, SyncDisposalNotSupportedError, TokenNotBoundError };
|
package/dist/errors.mjs
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
//#region src/errors.ts
|
|
2
|
-
/**
|
|
3
|
-
* @since 0.3.16-canary.0
|
|
4
|
-
*/
|
|
5
|
-
var DiError = class extends Error {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = this.constructor.name;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* @since 0.3.16-canary.0
|
|
13
|
-
*/
|
|
14
|
-
var InternalError = class extends DiError {
|
|
15
|
-
code = "INTERNAL_ERROR";
|
|
16
|
-
constructor(message) {
|
|
17
|
-
super(message);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @since 0.3.16-canary.0
|
|
22
|
-
*/
|
|
23
|
-
var TokenNotBoundError = class extends DiError {
|
|
24
|
-
code = "TOKEN_NOT_BOUND";
|
|
25
|
-
tokenName;
|
|
26
|
-
constructor(tokenName) {
|
|
27
|
-
super(`No binding found for token '${tokenName}'. Did you forget container.bind(${tokenName})?`);
|
|
28
|
-
this.tokenName = tokenName;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* @since 0.3.16-canary.0
|
|
33
|
-
*/
|
|
34
|
-
var NoMatchingBindingError = class extends DiError {
|
|
35
|
-
code = "NO_MATCHING_BINDING";
|
|
36
|
-
tokenName;
|
|
37
|
-
options;
|
|
38
|
-
availableSlots;
|
|
39
|
-
constructor(tokenName, options, availableSlots) {
|
|
40
|
-
const optionsString = JSON.stringify(options);
|
|
41
|
-
const slotsStr = availableSlots.join(", ");
|
|
42
|
-
super(`No binding for '${tokenName}' matching ${optionsString}. Available slots: [${slotsStr}].`);
|
|
43
|
-
this.tokenName = tokenName;
|
|
44
|
-
this.options = options;
|
|
45
|
-
this.availableSlots = availableSlots;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* @since 0.3.16-canary.0
|
|
50
|
-
*/
|
|
51
|
-
var AmbiguousBindingError = class extends DiError {
|
|
52
|
-
code = "AMBIGUOUS_BINDING";
|
|
53
|
-
tokenName;
|
|
54
|
-
candidateIds;
|
|
55
|
-
constructor(tokenName, candidateIds) {
|
|
56
|
-
super(`Multiple bindings for '${tokenName}' matched without a clear winner. Candidates: [${candidateIds.join(", ")}]. Ensure when() predicates are mutually exclusive.`);
|
|
57
|
-
this.tokenName = tokenName;
|
|
58
|
-
this.candidateIds = candidateIds;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* @since 0.3.16-canary.0
|
|
63
|
-
*/
|
|
64
|
-
var CircularDependencyError = class extends DiError {
|
|
65
|
-
code = "CIRCULAR_DEPENDENCY";
|
|
66
|
-
cycle;
|
|
67
|
-
constructor(cycle) {
|
|
68
|
-
super(`Circular dependency detected: ${cycle.join(" → ")}`);
|
|
69
|
-
this.cycle = cycle;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* @since 0.3.16-canary.0
|
|
74
|
-
*/
|
|
75
|
-
var AsyncResolutionError = class extends DiError {
|
|
76
|
-
code = "ASYNC_RESOLUTION";
|
|
77
|
-
tokenName;
|
|
78
|
-
asyncSourceToken;
|
|
79
|
-
constructor(tokenName, asyncSourceToken) {
|
|
80
|
-
super(`Token '${tokenName}' requires async resolution because '${asyncSourceToken}' in its dependency chain has an async factory. Use container.resolveAsync(${tokenName}).`);
|
|
81
|
-
this.tokenName = tokenName;
|
|
82
|
-
this.asyncSourceToken = asyncSourceToken;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* @since 0.3.16-canary.0
|
|
87
|
-
*/
|
|
88
|
-
var AsyncDeactivationError = class extends DiError {
|
|
89
|
-
code = "ASYNC_DEACTIVATION";
|
|
90
|
-
tokenName;
|
|
91
|
-
constructor(tokenName) {
|
|
92
|
-
super(`Token '${tokenName}' has an async onDeactivation handler. Use unbindAsync() instead.`);
|
|
93
|
-
this.tokenName = tokenName;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* @since 0.3.16-canary.0
|
|
98
|
-
*/
|
|
99
|
-
var ScopeViolationError = class extends DiError {
|
|
100
|
-
code = "SCOPE_VIOLATION";
|
|
101
|
-
details;
|
|
102
|
-
constructor(details) {
|
|
103
|
-
super(`Scope violation: '${details.consumerToken}' (${details.consumerScope}) depends on '${details.dependencyToken}' (${details.dependencyScope}). Path: ${details.path.join(" → ")}`);
|
|
104
|
-
this.details = details;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* @since 0.3.16-canary.0
|
|
109
|
-
*/
|
|
110
|
-
var MissingMetadataError = class extends DiError {
|
|
111
|
-
code = "MISSING_METADATA";
|
|
112
|
-
targetName;
|
|
113
|
-
constructor(targetName) {
|
|
114
|
-
super(`Class '${targetName}' is missing @injectable() decorator. Add @injectable([...deps]) or use toDynamic()/toResolved() instead.`);
|
|
115
|
-
this.targetName = targetName;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* @since 0.3.16-canary.0
|
|
120
|
-
*/
|
|
121
|
-
var AsyncModuleLoadError = class extends DiError {
|
|
122
|
-
code = "ASYNC_MODULE_LOAD";
|
|
123
|
-
moduleName;
|
|
124
|
-
constructor(moduleName) {
|
|
125
|
-
super(`Module '${moduleName}' is async. Use container.loadAsync() instead.`);
|
|
126
|
-
this.moduleName = moduleName;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* @since 0.3.16-canary.0
|
|
131
|
-
*/
|
|
132
|
-
var SyncDisposalNotSupportedError = class extends DiError {
|
|
133
|
-
code = "SYNC_DISPOSAL_NOT_SUPPORTED";
|
|
134
|
-
constructor() {
|
|
135
|
-
super("Container cannot be disposed synchronously because onDeactivation handlers may be async. Use `await using` or call container.dispose() explicitly.");
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* @since 0.3.16-canary.0
|
|
140
|
-
*/
|
|
141
|
-
var MissingScopeContextError = class extends DiError {
|
|
142
|
-
code = "MISSING_SCOPE_CONTEXT";
|
|
143
|
-
tokenName;
|
|
144
|
-
constructor(tokenName) {
|
|
145
|
-
super(`Token '${tokenName}' is scoped but was resolved from a container without a child scope context. Use container.createChild() to create a scoped context.`);
|
|
146
|
-
this.tokenName = tokenName;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* @since 0.3.16-canary.0
|
|
151
|
-
*/
|
|
152
|
-
var MissingContainerContextError = class extends DiError {
|
|
153
|
-
code = "MISSING_CONTAINER_CONTEXT";
|
|
154
|
-
targetName;
|
|
155
|
-
constructor(targetName) {
|
|
156
|
-
super(`Class '${targetName}' has @inject accessor fields but was instantiated outside a container context. Resolve it via container.resolve(${targetName}) instead.`);
|
|
157
|
-
this.targetName = targetName;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* @since 0.3.16-canary.0
|
|
162
|
-
*/
|
|
163
|
-
var RebindUnboundTokenError = class extends DiError {
|
|
164
|
-
code = "REBIND_UNBOUND_TOKEN";
|
|
165
|
-
tokenName;
|
|
166
|
-
constructor(tokenName) {
|
|
167
|
-
super(`Cannot rebind token '${tokenName}' because it has no own binding in this container. Use container.bind(${tokenName}) to create a new binding instead.`);
|
|
168
|
-
this.tokenName = tokenName;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* @since 0.3.16-canary.0
|
|
173
|
-
*/
|
|
174
|
-
var DisposedContainerError = class extends DiError {
|
|
175
|
-
code = "DISPOSED_CONTAINER";
|
|
176
|
-
constructor() {
|
|
177
|
-
super("Cannot perform operations on a disposed container.");
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* @since 0.3.16-canary.0
|
|
182
|
-
*/
|
|
183
|
-
var AsyncActivationError = class extends DiError {
|
|
184
|
-
code = "ASYNC_ACTIVATION";
|
|
185
|
-
tokenName;
|
|
186
|
-
hookKind;
|
|
187
|
-
methodName;
|
|
188
|
-
constructor(tokenName, hookKind, methodName) {
|
|
189
|
-
const detail = hookKind === "postConstruct" ? `@postConstruct method '${methodName ?? ""}' returned a Promise` : `onActivation for '${tokenName}' returned a Promise`;
|
|
190
|
-
super(`${detail}. Use resolveAsync() instead.`);
|
|
191
|
-
this.tokenName = tokenName;
|
|
192
|
-
this.hookKind = hookKind;
|
|
193
|
-
this.methodName = methodName;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
//#endregion
|
|
197
|
-
export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SyncDisposalNotSupportedError, TokenNotBoundError };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ContainerGraphJson } from "../dependency-graph.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/graph-adapters/cytoscape.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* @since 0.3.16-canary.0
|
|
6
|
-
*/
|
|
7
|
-
interface CytoscapeNode {
|
|
8
|
-
readonly data: {
|
|
9
|
-
readonly id: string;
|
|
10
|
-
readonly label: string;
|
|
11
|
-
readonly kind: string;
|
|
12
|
-
readonly scope: string;
|
|
13
|
-
readonly fromParent: boolean;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @since 0.3.16-canary.0
|
|
18
|
-
*/
|
|
19
|
-
interface CytoscapeEdge {
|
|
20
|
-
readonly data: {
|
|
21
|
-
readonly id: string;
|
|
22
|
-
readonly source: string;
|
|
23
|
-
readonly target: string;
|
|
24
|
-
readonly label?: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @since 0.3.16-canary.0
|
|
29
|
-
*/
|
|
30
|
-
type CytoscapeElements = ReadonlyArray<CytoscapeNode | CytoscapeEdge>;
|
|
31
|
-
/**
|
|
32
|
-
* @since 0.3.16-canary.0
|
|
33
|
-
*/
|
|
34
|
-
declare function toCytoscapeGraph(graph: ContainerGraphJson): CytoscapeElements;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { CytoscapeEdge, CytoscapeElements, CytoscapeNode, toCytoscapeGraph };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region src/graph-adapters/cytoscape.ts
|
|
2
|
-
/**
|
|
3
|
-
* @since 0.3.16-canary.0
|
|
4
|
-
*/
|
|
5
|
-
function toCytoscapeGraph(graph) {
|
|
6
|
-
const elements = [];
|
|
7
|
-
for (const node of graph.nodes) elements.push({ data: {
|
|
8
|
-
id: node.id,
|
|
9
|
-
label: node.tokenName,
|
|
10
|
-
kind: node.kind,
|
|
11
|
-
scope: node.scope,
|
|
12
|
-
fromParent: node.fromParent
|
|
13
|
-
} });
|
|
14
|
-
for (let idx = 0; idx < graph.edges.length; idx += 1) {
|
|
15
|
-
const edge = graph.edges[idx];
|
|
16
|
-
elements.push({ data: {
|
|
17
|
-
id: `edge-${idx}`,
|
|
18
|
-
source: edge.from,
|
|
19
|
-
target: edge.to,
|
|
20
|
-
...edge.label !== void 0 ? { label: edge.label } : {}
|
|
21
|
-
} });
|
|
22
|
-
}
|
|
23
|
-
return elements;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { toCytoscapeGraph };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region src/graph-adapters/dot.ts
|
|
2
|
-
/**
|
|
3
|
-
* @since 0.3.16-canary.0
|
|
4
|
-
*/
|
|
5
|
-
function toDotGraph(graph) {
|
|
6
|
-
const lines = ["digraph DI {", " rankdir=TB;"];
|
|
7
|
-
for (const node of graph.nodes) {
|
|
8
|
-
const label = `${node.tokenName}\\n[${node.kind}/${node.scope}]`;
|
|
9
|
-
const style = node.fromParent ? " style=\"dashed\"" : "";
|
|
10
|
-
lines.push(` "${node.id}" [label="${label}"${style}];`);
|
|
11
|
-
}
|
|
12
|
-
for (const edge of graph.edges) {
|
|
13
|
-
const label = edge.label !== void 0 ? ` [label="${edge.label}"]` : "";
|
|
14
|
-
lines.push(` "${edge.from}" -> "${edge.to}"${label};`);
|
|
15
|
-
}
|
|
16
|
-
lines.push("}");
|
|
17
|
-
return lines.join("\n");
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { toDotGraph };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ContainerGraphJson } from "../dependency-graph.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/graph-adapters/reactflow.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* @since 0.3.16-canary.0
|
|
6
|
-
*/
|
|
7
|
-
interface ReactFlowNode {
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly data: {
|
|
10
|
-
readonly label: string;
|
|
11
|
-
readonly kind: string;
|
|
12
|
-
readonly scope: string;
|
|
13
|
-
readonly fromParent: boolean;
|
|
14
|
-
};
|
|
15
|
-
readonly position: {
|
|
16
|
-
readonly x: number;
|
|
17
|
-
readonly y: number;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @since 0.3.16-canary.0
|
|
22
|
-
*/
|
|
23
|
-
interface ReactFlowEdge {
|
|
24
|
-
readonly id: string;
|
|
25
|
-
readonly source: string;
|
|
26
|
-
readonly target: string;
|
|
27
|
-
readonly label?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @since 0.3.16-canary.0
|
|
31
|
-
*/
|
|
32
|
-
interface ReactFlowGraph {
|
|
33
|
-
readonly nodes: ReadonlyArray<ReactFlowNode>;
|
|
34
|
-
readonly edges: ReadonlyArray<ReactFlowEdge>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @since 0.3.16-canary.0
|
|
38
|
-
*/
|
|
39
|
-
declare function toReactFlowGraph(graph: ContainerGraphJson): ReactFlowGraph;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { ReactFlowEdge, ReactFlowGraph, ReactFlowNode, toReactFlowGraph };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/graph-adapters/reactflow.ts
|
|
2
|
-
/**
|
|
3
|
-
* @since 0.3.16-canary.0
|
|
4
|
-
*/
|
|
5
|
-
function toReactFlowGraph(graph) {
|
|
6
|
-
return {
|
|
7
|
-
nodes: graph.nodes.map((node, idx) => ({
|
|
8
|
-
id: node.id,
|
|
9
|
-
data: {
|
|
10
|
-
label: node.tokenName,
|
|
11
|
-
kind: node.kind,
|
|
12
|
-
scope: node.scope,
|
|
13
|
-
fromParent: node.fromParent
|
|
14
|
-
},
|
|
15
|
-
position: {
|
|
16
|
-
x: idx % 5 * 200,
|
|
17
|
-
y: Math.floor(idx / 5) * 100
|
|
18
|
-
}
|
|
19
|
-
})),
|
|
20
|
-
edges: graph.edges.map((edge, idx) => ({
|
|
21
|
-
id: `edge-${idx}`,
|
|
22
|
-
source: edge.from,
|
|
23
|
-
target: edge.to,
|
|
24
|
-
...edge.label !== void 0 ? { label: edge.label } : {}
|
|
25
|
-
}))
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { toReactFlowGraph };
|
package/dist/index.d.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Constructor } from "./constructor-type.mjs";
|
|
2
|
-
import { Token, isToken, token, tokenName } from "./token.mjs";
|
|
3
|
-
import { ActivationHandler, BindingIdentifier, BindingKind, BindingScope, BindingTag, ConstraintContext, DeactivationHandler, DependencyKey, ResolutionContext, ResolutionFrame, ResolveOptions, TokenValue } from "./types.mjs";
|
|
4
|
-
import { InjectOptions, InjectableDependency, InjectionDescriptor, inject, injectAll, isInjectionDescriptor, optional } from "./decorators/inject.mjs";
|
|
5
|
-
import { AliasBindingBuilder, BindToBuilder, BindingBuilder, ConstantBindingBuilder, ScopedBindingBuilder, SingletonBindingBuilder, SingletonLifecycleBuilder, SlotConstrainedBuilder, TransientBindingBuilder } from "./binding.mjs";
|
|
6
|
-
import { effectiveBindingScope } from "./binding-scope.mjs";
|
|
7
|
-
import { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll } from "./constraints.mjs";
|
|
8
|
-
import { AutoRegisterRegistry, InjectableOptions, createAutoRegisterRegistry, injectable } from "./decorators/injectable.mjs";
|
|
9
|
-
import { MetadataReader, MutableLifecycleMetadata } from "./metadata/metadata-types.mjs";
|
|
10
|
-
import { ContainerGraphJson, GraphEdge, GraphNode, GraphOptions } from "./dependency-graph.mjs";
|
|
11
|
-
import { BindingSnapshot, ContainerSnapshot } from "./inspector.mjs";
|
|
12
|
-
import { AsyncModule, AsyncModuleBuilder, Module, ModuleBuilder, SyncModule, isSyncModule } from "./module.mjs";
|
|
13
|
-
import { Container, ContainerStatic } from "./container.mjs";
|
|
14
|
-
import { postConstruct, preDestroy } from "./decorators/lifecycle-decorators.mjs";
|
|
15
|
-
import { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationDetails, ScopeViolationError, SyncDisposalNotSupportedError, TokenNotBoundError } from "./errors.mjs";
|
|
16
|
-
import { bindingSlotToResolveOptions, injectionSlotToResolveOptions } from "./resolve-options.mjs";
|
|
17
|
-
import { MetadataReaderToken } from "./metadata/metadata-reader-token.mjs";
|
|
18
|
-
export { type ActivationHandler, type AliasBindingBuilder, AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModule, type AsyncModuleBuilder, AsyncModuleLoadError, AsyncResolutionError, type AutoRegisterRegistry, type BindToBuilder, type BindingBuilder, type BindingIdentifier, type BindingKind, type BindingScope, type BindingSnapshot, type BindingTag, CircularDependencyError, type ConstantBindingBuilder, type ConstraintContext, type Constructor, Container, type ContainerGraphJson, type Container as ContainerInterface, type ContainerSnapshot, type ContainerStatic, type DeactivationHandler, type DependencyKey, DiError, DisposedContainerError, type GraphEdge, type GraphNode, type GraphOptions, type InjectOptions, type InjectableDependency, type InjectableOptions, type InjectionDescriptor, InternalError, type MetadataReader, MetadataReaderToken, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, Module, type ModuleBuilder, type MutableLifecycleMetadata, NoMatchingBindingError, RebindUnboundTokenError, type ResolutionContext, type ResolutionFrame, type ResolveOptions, type ScopeViolationDetails, ScopeViolationError, type ScopedBindingBuilder, type SingletonBindingBuilder, type SingletonLifecycleBuilder, type SlotConstrainedBuilder, SyncDisposalNotSupportedError, SyncModule, type Token, TokenNotBoundError, type TokenValue, type TransientBindingBuilder, bindingSlotToResolveOptions, createAutoRegisterRegistry, effectiveBindingScope, inject, injectAll, injectable, injectionSlotToResolveOptions, isInjectionDescriptor, isSyncModule, isToken, optional, postConstruct, preDestroy, token, tokenName, whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll };
|
package/dist/index.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { effectiveBindingScope } from "./binding-scope.mjs";
|
|
2
|
-
import { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SyncDisposalNotSupportedError, TokenNotBoundError } from "./errors.mjs";
|
|
3
|
-
import { isToken, token, tokenName } from "./token.mjs";
|
|
4
|
-
import { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll } from "./constraints.mjs";
|
|
5
|
-
import { bindingSlotToResolveOptions, injectionSlotToResolveOptions } from "./resolve-options.mjs";
|
|
6
|
-
import { inject, injectAll, isInjectionDescriptor, optional } from "./decorators/inject.mjs";
|
|
7
|
-
import { MetadataReaderToken } from "./metadata/metadata-reader-token.mjs";
|
|
8
|
-
import { AsyncModule, Module, SyncModule, isSyncModule } from "./module.mjs";
|
|
9
|
-
import { Container } from "./container.mjs";
|
|
10
|
-
import { createAutoRegisterRegistry, injectable } from "./decorators/injectable.mjs";
|
|
11
|
-
import { postConstruct, preDestroy } from "./decorators/lifecycle-decorators.mjs";
|
|
12
|
-
export { AmbiguousBindingError, AsyncActivationError, AsyncDeactivationError, AsyncModule, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, Container, DiError, DisposedContainerError, InternalError, MetadataReaderToken, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, Module, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SyncDisposalNotSupportedError, SyncModule, TokenNotBoundError, bindingSlotToResolveOptions, createAutoRegisterRegistry, effectiveBindingScope, inject, injectAll, injectable, injectionSlotToResolveOptions, isInjectionDescriptor, isSyncModule, isToken, optional, postConstruct, preDestroy, token, tokenName, whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll };
|
package/dist/inspector.d.mts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Constructor } from "./constructor-type.mjs";
|
|
2
|
-
import { Token } from "./token.mjs";
|
|
3
|
-
import { BindingIdentifier, BindingKind, BindingScope, BindingTag, ResolveOptions } from "./types.mjs";
|
|
4
|
-
import { BindingRegistry } from "./registry.mjs";
|
|
5
|
-
import { ScopeManager } from "./scope.mjs";
|
|
6
|
-
|
|
7
|
-
//#region src/inspector.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* @since 0.3.16-canary.0
|
|
10
|
-
*/
|
|
11
|
-
interface BindingSnapshot {
|
|
12
|
-
readonly tokenName: string;
|
|
13
|
-
readonly kind: BindingKind;
|
|
14
|
-
readonly scope: BindingScope;
|
|
15
|
-
readonly slot: {
|
|
16
|
-
readonly name?: string;
|
|
17
|
-
readonly tags: ReadonlyArray<BindingTag>;
|
|
18
|
-
};
|
|
19
|
-
readonly id: BindingIdentifier;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @since 0.3.16-canary.0
|
|
23
|
-
*/
|
|
24
|
-
interface ContainerSnapshot {
|
|
25
|
-
readonly ownBindings: ReadonlyArray<BindingSnapshot>;
|
|
26
|
-
readonly cachedSingletonCount: number;
|
|
27
|
-
readonly hasParent: boolean;
|
|
28
|
-
readonly isDisposed: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @since 0.3.16-canary.0
|
|
32
|
-
*/
|
|
33
|
-
declare class Inspector {
|
|
34
|
-
private readonly _registry;
|
|
35
|
-
private readonly _scope;
|
|
36
|
-
private readonly _hasParent;
|
|
37
|
-
private readonly _isDisposed;
|
|
38
|
-
constructor(_registry: BindingRegistry, _scope: ScopeManager, _hasParent: boolean, _isDisposed: () => boolean);
|
|
39
|
-
inspect(): ContainerSnapshot;
|
|
40
|
-
lookupBindings<Value>(token: Token<Value> | Constructor<Value>): ReadonlyArray<BindingSnapshot>;
|
|
41
|
-
has(token: Token<unknown> | Constructor, options?: ResolveOptions, parentHas?: () => boolean): boolean;
|
|
42
|
-
hasOwn(token: Token<unknown> | Constructor, options?: ResolveOptions): boolean;
|
|
43
|
-
private _makeConstraintContext;
|
|
44
|
-
private allBindingSnapshots;
|
|
45
|
-
private _toSnapshot;
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { BindingSnapshot, ContainerSnapshot, Inspector };
|
package/dist/inspector.mjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { effectiveBindingScope } from "./binding-scope.mjs";
|
|
2
|
-
import { selectBinding } from "./binding-select.mjs";
|
|
3
|
-
import { tokenName } from "./token.mjs";
|
|
4
|
-
//#region src/inspector.ts
|
|
5
|
-
/**
|
|
6
|
-
* @since 0.3.16-canary.0
|
|
7
|
-
*/
|
|
8
|
-
var Inspector = class {
|
|
9
|
-
_registry;
|
|
10
|
-
_scope;
|
|
11
|
-
_hasParent;
|
|
12
|
-
_isDisposed;
|
|
13
|
-
constructor(_registry, _scope, _hasParent, _isDisposed) {
|
|
14
|
-
this._registry = _registry;
|
|
15
|
-
this._scope = _scope;
|
|
16
|
-
this._hasParent = _hasParent;
|
|
17
|
-
this._isDisposed = _isDisposed;
|
|
18
|
-
}
|
|
19
|
-
inspect() {
|
|
20
|
-
return {
|
|
21
|
-
ownBindings: this.allBindingSnapshots(),
|
|
22
|
-
cachedSingletonCount: this._scope.getAllSingletons().size,
|
|
23
|
-
hasParent: this._hasParent,
|
|
24
|
-
isDisposed: this._isDisposed()
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
lookupBindings(token) {
|
|
28
|
-
return this._registry.getAll(token).map((binding) => this._toSnapshot(binding));
|
|
29
|
-
}
|
|
30
|
-
has(token, options, parentHas) {
|
|
31
|
-
const bindings = this._registry.getAll(token);
|
|
32
|
-
if (bindings.length > 0) if (options !== void 0) {
|
|
33
|
-
if (selectBinding(bindings, options, this._makeConstraintContext(options), tokenName(token)) !== void 0) return true;
|
|
34
|
-
} else return true;
|
|
35
|
-
return parentHas?.() ?? false;
|
|
36
|
-
}
|
|
37
|
-
hasOwn(token, options) {
|
|
38
|
-
const bindings = this._registry.getAll(token);
|
|
39
|
-
if (bindings.length === 0) return false;
|
|
40
|
-
if (options !== void 0) return selectBinding(bindings, options, this._makeConstraintContext(options), tokenName(token)) !== void 0;
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
_makeConstraintContext(options) {
|
|
44
|
-
return {
|
|
45
|
-
resolutionPath: [],
|
|
46
|
-
resolutionStack: [],
|
|
47
|
-
parent: void 0,
|
|
48
|
-
ancestors: [],
|
|
49
|
-
currentResolveOptions: options
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
allBindingSnapshots() {
|
|
53
|
-
return this._registry.allBindings().map((binding) => this._toSnapshot(binding));
|
|
54
|
-
}
|
|
55
|
-
_toSnapshot(binding) {
|
|
56
|
-
const scope = effectiveBindingScope(binding);
|
|
57
|
-
const slot = binding.slot.name !== void 0 ? {
|
|
58
|
-
name: binding.slot.name,
|
|
59
|
-
tags: binding.slot.tags
|
|
60
|
-
} : { tags: binding.slot.tags };
|
|
61
|
-
return {
|
|
62
|
-
tokenName: tokenName(binding.token),
|
|
63
|
-
kind: binding.kind,
|
|
64
|
-
scope,
|
|
65
|
-
slot,
|
|
66
|
-
id: binding.id
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
//#endregion
|
|
71
|
-
export { Inspector };
|