@codefast/di 0.3.14 → 0.3.16-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +173 -109
- package/dist/binding-scope.d.mts +2 -0
- package/dist/binding-scope.mjs +2 -0
- package/dist/binding-select.d.mts +4 -0
- package/dist/binding-select.mjs +4 -0
- package/dist/binding.d.mts +68 -1
- package/dist/binding.mjs +12 -0
- package/dist/constraints.d.mts +24 -0
- package/dist/constraints.mjs +24 -0
- package/dist/constructor-type.d.mts +4 -0
- package/dist/container.d.mts +9 -0
- package/dist/container.mjs +3 -0
- package/dist/decorators/inject.d.mts +24 -0
- package/dist/decorators/inject.mjs +15 -0
- package/dist/decorators/injectable.d.mts +12 -0
- package/dist/decorators/injectable.mjs +6 -0
- package/dist/decorators/lifecycle-decorators.d.mts +6 -0
- package/dist/decorators/lifecycle-decorators.mjs +6 -0
- package/dist/dependency-graph.d.mts +15 -0
- package/dist/dependency-graph.mjs +3 -0
- package/dist/environment.d.mts +15 -0
- package/dist/environment.mjs +12 -0
- package/dist/errors.d.mts +51 -0
- package/dist/errors.mjs +48 -0
- package/dist/graph-adapters/cytoscape.d.mts +12 -0
- package/dist/graph-adapters/cytoscape.mjs +3 -0
- package/dist/graph-adapters/dot.d.mts +3 -0
- package/dist/graph-adapters/dot.mjs +3 -0
- package/dist/graph-adapters/reactflow.d.mts +12 -0
- package/dist/graph-adapters/reactflow.mjs +3 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/inspector.d.mts +9 -0
- package/dist/inspector.mjs +3 -0
- package/dist/lifecycle.d.mts +3 -0
- package/dist/lifecycle.mjs +3 -0
- package/dist/metadata/metadata-keys.d.mts +18 -0
- package/dist/metadata/metadata-keys.mjs +18 -0
- package/dist/metadata/metadata-reader-token.d.mts +3 -0
- package/dist/metadata/metadata-reader-token.mjs +3 -0
- package/dist/metadata/metadata-types.d.mts +17 -1
- package/dist/metadata/symbol-metadata-reader.d.mts +6 -0
- package/dist/metadata/symbol-metadata-reader.mjs +6 -0
- package/dist/module.d.mts +24 -0
- package/dist/module.mjs +12 -0
- package/dist/registry.d.mts +7 -0
- package/dist/registry.mjs +44 -0
- package/dist/resolve-options.d.mts +4 -0
- package/dist/resolve-options.mjs +4 -0
- package/dist/resolver.d.mts +3 -0
- package/dist/resolver.mjs +15 -12
- package/dist/scope.d.mts +3 -0
- package/dist/scope.mjs +3 -0
- package/dist/token.d.mts +12 -0
- package/dist/token.mjs +9 -0
- package/dist/types.d.mts +35 -1
- package/package.json +3 -4
package/dist/errors.d.mts
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { BindingIdentifier, BindingScope, ResolveOptions } from "./types.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @since 0.3.16-canary.0
|
|
6
|
+
*/
|
|
4
7
|
declare abstract class DiError extends Error {
|
|
5
8
|
abstract readonly code: string;
|
|
6
9
|
constructor(message: string);
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
8
14
|
declare class InternalError extends DiError {
|
|
9
15
|
readonly code = "INTERNAL_ERROR";
|
|
10
16
|
constructor(message: string);
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
12
21
|
declare class TokenNotBoundError extends DiError {
|
|
13
22
|
readonly code = "TOKEN_NOT_BOUND";
|
|
14
23
|
readonly tokenName: string;
|
|
15
24
|
constructor(tokenName: string);
|
|
16
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* @since 0.3.16-canary.0
|
|
28
|
+
*/
|
|
17
29
|
declare class NoMatchingBindingError extends DiError {
|
|
18
30
|
readonly code = "NO_MATCHING_BINDING";
|
|
19
31
|
readonly tokenName: string;
|
|
@@ -21,28 +33,43 @@ declare class NoMatchingBindingError extends DiError {
|
|
|
21
33
|
readonly availableSlots: string[];
|
|
22
34
|
constructor(tokenName: string, hint: ResolveOptions, availableSlots: string[]);
|
|
23
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @since 0.3.16-canary.0
|
|
38
|
+
*/
|
|
24
39
|
declare class AmbiguousBindingError extends DiError {
|
|
25
40
|
readonly code = "AMBIGUOUS_BINDING";
|
|
26
41
|
readonly tokenName: string;
|
|
27
42
|
readonly candidateIds: readonly BindingIdentifier[];
|
|
28
43
|
constructor(tokenName: string, candidateIds: readonly BindingIdentifier[]);
|
|
29
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @since 0.3.16-canary.0
|
|
47
|
+
*/
|
|
30
48
|
declare class CircularDependencyError extends DiError {
|
|
31
49
|
readonly code = "CIRCULAR_DEPENDENCY";
|
|
32
50
|
readonly cycle: string[];
|
|
33
51
|
constructor(cycle: string[]);
|
|
34
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @since 0.3.16-canary.0
|
|
55
|
+
*/
|
|
35
56
|
declare class AsyncResolutionError extends DiError {
|
|
36
57
|
readonly code = "ASYNC_RESOLUTION";
|
|
37
58
|
readonly tokenName: string;
|
|
38
59
|
readonly asyncSourceToken: string;
|
|
39
60
|
constructor(tokenName: string, asyncSourceToken: string);
|
|
40
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* @since 0.3.16-canary.0
|
|
64
|
+
*/
|
|
41
65
|
declare class AsyncDeactivationError extends DiError {
|
|
42
66
|
readonly code = "ASYNC_DEACTIVATION";
|
|
43
67
|
readonly tokenName: string;
|
|
44
68
|
constructor(tokenName: string);
|
|
45
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @since 0.3.16-canary.0
|
|
72
|
+
*/
|
|
46
73
|
interface ScopeViolationDetails {
|
|
47
74
|
readonly consumerToken: string;
|
|
48
75
|
readonly consumerScope: BindingScope;
|
|
@@ -50,40 +77,64 @@ interface ScopeViolationDetails {
|
|
|
50
77
|
readonly dependencyScope: BindingScope;
|
|
51
78
|
readonly path: string[];
|
|
52
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* @since 0.3.16-canary.0
|
|
82
|
+
*/
|
|
53
83
|
declare class ScopeViolationError extends DiError {
|
|
54
84
|
readonly code = "SCOPE_VIOLATION";
|
|
55
85
|
readonly details: ScopeViolationDetails;
|
|
56
86
|
constructor(details: ScopeViolationDetails);
|
|
57
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* @since 0.3.16-canary.0
|
|
90
|
+
*/
|
|
58
91
|
declare class MissingMetadataError extends DiError {
|
|
59
92
|
readonly code = "MISSING_METADATA";
|
|
60
93
|
readonly targetName: string;
|
|
61
94
|
constructor(targetName: string);
|
|
62
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* @since 0.3.16-canary.0
|
|
98
|
+
*/
|
|
63
99
|
declare class AsyncModuleLoadError extends DiError {
|
|
64
100
|
readonly code = "ASYNC_MODULE_LOAD";
|
|
65
101
|
readonly moduleName: string;
|
|
66
102
|
constructor(moduleName: string);
|
|
67
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @since 0.3.16-canary.0
|
|
106
|
+
*/
|
|
68
107
|
declare class SyncDisposalNotSupportedError extends DiError {
|
|
69
108
|
readonly code = "SYNC_DISPOSAL_NOT_SUPPORTED";
|
|
70
109
|
constructor();
|
|
71
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* @since 0.3.16-canary.0
|
|
113
|
+
*/
|
|
72
114
|
declare class MissingScopeContextError extends DiError {
|
|
73
115
|
readonly code = "MISSING_SCOPE_CONTEXT";
|
|
74
116
|
readonly tokenName: string;
|
|
75
117
|
constructor(tokenName: string);
|
|
76
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* @since 0.3.16-canary.0
|
|
121
|
+
*/
|
|
77
122
|
declare class MissingContainerContextError extends DiError {
|
|
78
123
|
readonly code = "MISSING_CONTAINER_CONTEXT";
|
|
79
124
|
readonly targetName: string;
|
|
80
125
|
constructor(targetName: string);
|
|
81
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* @since 0.3.16-canary.0
|
|
129
|
+
*/
|
|
82
130
|
declare class RebindUnboundTokenError extends DiError {
|
|
83
131
|
readonly code = "REBIND_UNBOUND_TOKEN";
|
|
84
132
|
readonly tokenName: string;
|
|
85
133
|
constructor(tokenName: string);
|
|
86
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* @since 0.3.16-canary.0
|
|
137
|
+
*/
|
|
87
138
|
declare class DisposedContainerError extends DiError {
|
|
88
139
|
readonly code = "DISPOSED_CONTAINER";
|
|
89
140
|
constructor();
|
package/dist/errors.mjs
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
//#region src/errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* @since 0.3.16-canary.0
|
|
4
|
+
*/
|
|
2
5
|
var DiError = class extends Error {
|
|
3
6
|
constructor(message) {
|
|
4
7
|
super(message);
|
|
5
8
|
this.name = this.constructor.name;
|
|
6
9
|
}
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
8
14
|
var InternalError = class extends DiError {
|
|
9
15
|
code = "INTERNAL_ERROR";
|
|
10
16
|
constructor(message) {
|
|
11
17
|
super(message);
|
|
12
18
|
}
|
|
13
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
14
23
|
var TokenNotBoundError = class extends DiError {
|
|
15
24
|
code = "TOKEN_NOT_BOUND";
|
|
16
25
|
tokenName;
|
|
@@ -19,6 +28,9 @@ var TokenNotBoundError = class extends DiError {
|
|
|
19
28
|
this.tokenName = tokenName;
|
|
20
29
|
}
|
|
21
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
22
34
|
var NoMatchingBindingError = class extends DiError {
|
|
23
35
|
code = "NO_MATCHING_BINDING";
|
|
24
36
|
tokenName;
|
|
@@ -33,6 +45,9 @@ var NoMatchingBindingError = class extends DiError {
|
|
|
33
45
|
this.availableSlots = availableSlots;
|
|
34
46
|
}
|
|
35
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* @since 0.3.16-canary.0
|
|
50
|
+
*/
|
|
36
51
|
var AmbiguousBindingError = class extends DiError {
|
|
37
52
|
code = "AMBIGUOUS_BINDING";
|
|
38
53
|
tokenName;
|
|
@@ -43,6 +58,9 @@ var AmbiguousBindingError = class extends DiError {
|
|
|
43
58
|
this.candidateIds = candidateIds;
|
|
44
59
|
}
|
|
45
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* @since 0.3.16-canary.0
|
|
63
|
+
*/
|
|
46
64
|
var CircularDependencyError = class extends DiError {
|
|
47
65
|
code = "CIRCULAR_DEPENDENCY";
|
|
48
66
|
cycle;
|
|
@@ -51,6 +69,9 @@ var CircularDependencyError = class extends DiError {
|
|
|
51
69
|
this.cycle = cycle;
|
|
52
70
|
}
|
|
53
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* @since 0.3.16-canary.0
|
|
74
|
+
*/
|
|
54
75
|
var AsyncResolutionError = class extends DiError {
|
|
55
76
|
code = "ASYNC_RESOLUTION";
|
|
56
77
|
tokenName;
|
|
@@ -61,6 +82,9 @@ var AsyncResolutionError = class extends DiError {
|
|
|
61
82
|
this.asyncSourceToken = asyncSourceToken;
|
|
62
83
|
}
|
|
63
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* @since 0.3.16-canary.0
|
|
87
|
+
*/
|
|
64
88
|
var AsyncDeactivationError = class extends DiError {
|
|
65
89
|
code = "ASYNC_DEACTIVATION";
|
|
66
90
|
tokenName;
|
|
@@ -69,6 +93,9 @@ var AsyncDeactivationError = class extends DiError {
|
|
|
69
93
|
this.tokenName = tokenName;
|
|
70
94
|
}
|
|
71
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* @since 0.3.16-canary.0
|
|
98
|
+
*/
|
|
72
99
|
var ScopeViolationError = class extends DiError {
|
|
73
100
|
code = "SCOPE_VIOLATION";
|
|
74
101
|
details;
|
|
@@ -77,6 +104,9 @@ var ScopeViolationError = class extends DiError {
|
|
|
77
104
|
this.details = details;
|
|
78
105
|
}
|
|
79
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* @since 0.3.16-canary.0
|
|
109
|
+
*/
|
|
80
110
|
var MissingMetadataError = class extends DiError {
|
|
81
111
|
code = "MISSING_METADATA";
|
|
82
112
|
targetName;
|
|
@@ -85,6 +115,9 @@ var MissingMetadataError = class extends DiError {
|
|
|
85
115
|
this.targetName = targetName;
|
|
86
116
|
}
|
|
87
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* @since 0.3.16-canary.0
|
|
120
|
+
*/
|
|
88
121
|
var AsyncModuleLoadError = class extends DiError {
|
|
89
122
|
code = "ASYNC_MODULE_LOAD";
|
|
90
123
|
moduleName;
|
|
@@ -93,12 +126,18 @@ var AsyncModuleLoadError = class extends DiError {
|
|
|
93
126
|
this.moduleName = moduleName;
|
|
94
127
|
}
|
|
95
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* @since 0.3.16-canary.0
|
|
131
|
+
*/
|
|
96
132
|
var SyncDisposalNotSupportedError = class extends DiError {
|
|
97
133
|
code = "SYNC_DISPOSAL_NOT_SUPPORTED";
|
|
98
134
|
constructor() {
|
|
99
135
|
super("Container cannot be disposed synchronously because onDeactivation handlers may be async. Use `await using` or call container.dispose() explicitly.");
|
|
100
136
|
}
|
|
101
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* @since 0.3.16-canary.0
|
|
140
|
+
*/
|
|
102
141
|
var MissingScopeContextError = class extends DiError {
|
|
103
142
|
code = "MISSING_SCOPE_CONTEXT";
|
|
104
143
|
tokenName;
|
|
@@ -107,6 +146,9 @@ var MissingScopeContextError = class extends DiError {
|
|
|
107
146
|
this.tokenName = tokenName;
|
|
108
147
|
}
|
|
109
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* @since 0.3.16-canary.0
|
|
151
|
+
*/
|
|
110
152
|
var MissingContainerContextError = class extends DiError {
|
|
111
153
|
code = "MISSING_CONTAINER_CONTEXT";
|
|
112
154
|
targetName;
|
|
@@ -115,6 +157,9 @@ var MissingContainerContextError = class extends DiError {
|
|
|
115
157
|
this.targetName = targetName;
|
|
116
158
|
}
|
|
117
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* @since 0.3.16-canary.0
|
|
162
|
+
*/
|
|
118
163
|
var RebindUnboundTokenError = class extends DiError {
|
|
119
164
|
code = "REBIND_UNBOUND_TOKEN";
|
|
120
165
|
tokenName;
|
|
@@ -123,6 +168,9 @@ var RebindUnboundTokenError = class extends DiError {
|
|
|
123
168
|
this.tokenName = tokenName;
|
|
124
169
|
}
|
|
125
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* @since 0.3.16-canary.0
|
|
173
|
+
*/
|
|
126
174
|
var DisposedContainerError = class extends DiError {
|
|
127
175
|
code = "DISPOSED_CONTAINER";
|
|
128
176
|
constructor() {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ContainerGraphJson } from "../dependency-graph.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/graph-adapters/cytoscape.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @since 0.3.16-canary.0
|
|
6
|
+
*/
|
|
4
7
|
interface CytoscapeNode {
|
|
5
8
|
data: {
|
|
6
9
|
id: string;
|
|
@@ -10,6 +13,9 @@ interface CytoscapeNode {
|
|
|
10
13
|
fromParent: boolean;
|
|
11
14
|
};
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
13
19
|
interface CytoscapeEdge {
|
|
14
20
|
data: {
|
|
15
21
|
id: string;
|
|
@@ -18,7 +24,13 @@ interface CytoscapeEdge {
|
|
|
18
24
|
label?: string;
|
|
19
25
|
};
|
|
20
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @since 0.3.16-canary.0
|
|
29
|
+
*/
|
|
21
30
|
type CytoscapeElements = Array<CytoscapeNode | CytoscapeEdge>;
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
22
34
|
declare function toCytoscapeGraph(graph: ContainerGraphJson): CytoscapeElements;
|
|
23
35
|
//#endregion
|
|
24
36
|
export { CytoscapeEdge, CytoscapeElements, CytoscapeNode, toCytoscapeGraph };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ContainerGraphJson } from "../dependency-graph.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/graph-adapters/reactflow.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @since 0.3.16-canary.0
|
|
6
|
+
*/
|
|
4
7
|
interface ReactFlowNode {
|
|
5
8
|
id: string;
|
|
6
9
|
data: {
|
|
@@ -14,16 +17,25 @@ interface ReactFlowNode {
|
|
|
14
17
|
y: number;
|
|
15
18
|
};
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
17
23
|
interface ReactFlowEdge {
|
|
18
24
|
id: string;
|
|
19
25
|
source: string;
|
|
20
26
|
target: string;
|
|
21
27
|
label?: string;
|
|
22
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @since 0.3.16-canary.0
|
|
31
|
+
*/
|
|
23
32
|
interface ReactFlowGraph {
|
|
24
33
|
nodes: ReactFlowNode[];
|
|
25
34
|
edges: ReactFlowEdge[];
|
|
26
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @since 0.3.16-canary.0
|
|
38
|
+
*/
|
|
27
39
|
declare function toReactFlowGraph(graph: ContainerGraphJson): ReactFlowGraph;
|
|
28
40
|
//#endregion
|
|
29
41
|
export { ReactFlowEdge, ReactFlowGraph, ReactFlowNode, toReactFlowGraph };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Constructor } from "./constructor-type.mjs";
|
|
2
|
-
import { Token, token } from "./token.mjs";
|
|
2
|
+
import { Token, isToken, token, tokenName } from "./token.mjs";
|
|
3
3
|
import { ActivationHandler, BindingIdentifier, BindingKind, BindingScope, ConstraintContext, DeactivationHandler, DependencyKey, MaterializationFrame, ResolutionContext, ResolveOptions, TokenValue } from "./types.mjs";
|
|
4
4
|
import { InjectOptions, InjectableDependency, InjectionDescriptor, inject, injectAll, isInjectionDescriptor, optional } from "./decorators/inject.mjs";
|
|
5
5
|
import { AliasBindingBuilder, BindToBuilder, BindingBuilder, ConstantBindingBuilder, ScopedBindingBuilder, SingletonBindingBuilder, SingletonLifecycleBuilder, TransientBindingBuilder } from "./binding.mjs";
|
|
@@ -14,4 +14,4 @@ import { postConstruct, preDestroy } from "./decorators/lifecycle-decorators.mjs
|
|
|
14
14
|
import { AmbiguousBindingError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationDetails, ScopeViolationError, SyncDisposalNotSupportedError, TokenNotBoundError } from "./errors.mjs";
|
|
15
15
|
import { injectableSlotToResolveOptions, slotKeyToResolveOptions } from "./resolve-options.mjs";
|
|
16
16
|
import { MetadataReaderToken } from "./metadata/metadata-reader-token.mjs";
|
|
17
|
-
export { type ActivationHandler, type AliasBindingBuilder, AmbiguousBindingError, AsyncDeactivationError, AsyncModule, type AsyncModuleBuilder, AsyncModuleLoadError, AsyncResolutionError, type AutoRegisterRegistry, type BindToBuilder, type BindingBuilder, type BindingIdentifier, type BindingKind, type BindingScope, type BindingSnapshot, 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 MaterializationFrame, type MetadataReader, MetadataReaderToken, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, Module, type ModuleBuilder, type MutableLifecycleMetadata, NoMatchingBindingError, RebindUnboundTokenError, type ResolutionContext, type ResolveOptions, type ScopeViolationDetails, ScopeViolationError, type ScopedBindingBuilder, type SingletonBindingBuilder, type SingletonLifecycleBuilder, SyncDisposalNotSupportedError, SyncModule, type Token, TokenNotBoundError, type TokenValue, type TransientBindingBuilder, createAutoRegisterRegistry, effectiveBindingScope, inject, injectAll, injectable, injectableSlotToResolveOptions, isInjectionDescriptor, optional, postConstruct, preDestroy, slotKeyToResolveOptions, token };
|
|
17
|
+
export { type ActivationHandler, type AliasBindingBuilder, AmbiguousBindingError, AsyncDeactivationError, AsyncModule, type AsyncModuleBuilder, AsyncModuleLoadError, AsyncResolutionError, type AutoRegisterRegistry, type BindToBuilder, type BindingBuilder, type BindingIdentifier, type BindingKind, type BindingScope, type BindingSnapshot, 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 MaterializationFrame, type MetadataReader, MetadataReaderToken, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, Module, type ModuleBuilder, type MutableLifecycleMetadata, NoMatchingBindingError, RebindUnboundTokenError, type ResolutionContext, type ResolveOptions, type ScopeViolationDetails, ScopeViolationError, type ScopedBindingBuilder, type SingletonBindingBuilder, type SingletonLifecycleBuilder, SyncDisposalNotSupportedError, SyncModule, type Token, TokenNotBoundError, type TokenValue, type TransientBindingBuilder, createAutoRegisterRegistry, effectiveBindingScope, inject, injectAll, injectable, injectableSlotToResolveOptions, isInjectionDescriptor, isToken, optional, postConstruct, preDestroy, slotKeyToResolveOptions, token, tokenName };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { effectiveBindingScope } from "./binding-scope.mjs";
|
|
2
2
|
import { AmbiguousBindingError, AsyncDeactivationError, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, DiError, DisposedContainerError, InternalError, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SyncDisposalNotSupportedError, TokenNotBoundError } from "./errors.mjs";
|
|
3
|
-
import { token } from "./token.mjs";
|
|
3
|
+
import { isToken, token, tokenName } from "./token.mjs";
|
|
4
4
|
import { injectableSlotToResolveOptions, slotKeyToResolveOptions } from "./resolve-options.mjs";
|
|
5
5
|
import { MetadataReaderToken } from "./metadata/metadata-reader-token.mjs";
|
|
6
6
|
import { inject, injectAll, isInjectionDescriptor, optional } from "./decorators/inject.mjs";
|
|
@@ -8,4 +8,4 @@ import { AsyncModule, Module, SyncModule } from "./module.mjs";
|
|
|
8
8
|
import { Container } from "./container.mjs";
|
|
9
9
|
import { createAutoRegisterRegistry, injectable } from "./decorators/injectable.mjs";
|
|
10
10
|
import { postConstruct, preDestroy } from "./decorators/lifecycle-decorators.mjs";
|
|
11
|
-
export { AmbiguousBindingError, AsyncDeactivationError, AsyncModule, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, Container, DiError, DisposedContainerError, InternalError, MetadataReaderToken, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, Module, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SyncDisposalNotSupportedError, SyncModule, TokenNotBoundError, createAutoRegisterRegistry, effectiveBindingScope, inject, injectAll, injectable, injectableSlotToResolveOptions, isInjectionDescriptor, optional, postConstruct, preDestroy, slotKeyToResolveOptions, token };
|
|
11
|
+
export { AmbiguousBindingError, AsyncDeactivationError, AsyncModule, AsyncModuleLoadError, AsyncResolutionError, CircularDependencyError, Container, DiError, DisposedContainerError, InternalError, MetadataReaderToken, MissingContainerContextError, MissingMetadataError, MissingScopeContextError, Module, NoMatchingBindingError, RebindUnboundTokenError, ScopeViolationError, SyncDisposalNotSupportedError, SyncModule, TokenNotBoundError, createAutoRegisterRegistry, effectiveBindingScope, inject, injectAll, injectable, injectableSlotToResolveOptions, isInjectionDescriptor, isToken, optional, postConstruct, preDestroy, slotKeyToResolveOptions, token, tokenName };
|
package/dist/inspector.d.mts
CHANGED
|
@@ -5,6 +5,9 @@ import { BindingRegistry } from "./registry.mjs";
|
|
|
5
5
|
import { ScopeManager } from "./scope.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/inspector.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* @since 0.3.16-canary.0
|
|
10
|
+
*/
|
|
8
11
|
interface BindingSnapshot {
|
|
9
12
|
readonly tokenName: string;
|
|
10
13
|
readonly kind: BindingKind;
|
|
@@ -15,6 +18,9 @@ interface BindingSnapshot {
|
|
|
15
18
|
};
|
|
16
19
|
readonly id: BindingIdentifier;
|
|
17
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @since 0.3.16-canary.0
|
|
23
|
+
*/
|
|
18
24
|
interface ContainerSnapshot {
|
|
19
25
|
readonly ownBindings: readonly BindingSnapshot[];
|
|
20
26
|
readonly bindings: readonly BindingSnapshot[];
|
|
@@ -22,6 +28,9 @@ interface ContainerSnapshot {
|
|
|
22
28
|
readonly hasParent: boolean;
|
|
23
29
|
readonly isDisposed: boolean;
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
25
34
|
declare class Inspector {
|
|
26
35
|
private readonly _registry;
|
|
27
36
|
private readonly _scope;
|
package/dist/inspector.mjs
CHANGED
|
@@ -2,6 +2,9 @@ import { effectiveBindingScope } from "./binding-scope.mjs";
|
|
|
2
2
|
import { selectBinding } from "./binding-select.mjs";
|
|
3
3
|
import { tokenName } from "./token.mjs";
|
|
4
4
|
//#region src/inspector.ts
|
|
5
|
+
/**
|
|
6
|
+
* @since 0.3.16-canary.0
|
|
7
|
+
*/
|
|
5
8
|
var Inspector = class {
|
|
6
9
|
constructor(_registry, _scope, _hasParent, _isDisposed) {
|
|
7
10
|
this._registry = _registry;
|
package/dist/lifecycle.d.mts
CHANGED
|
@@ -5,6 +5,9 @@ import { Binding } from "./binding.mjs";
|
|
|
5
5
|
import { MetadataReader } from "./metadata/metadata-types.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/lifecycle.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* @since 0.3.16-canary.0
|
|
10
|
+
*/
|
|
8
11
|
declare class LifecycleManager {
|
|
9
12
|
private readonly _activationHooks;
|
|
10
13
|
private readonly _deactivationHooks;
|
package/dist/lifecycle.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AsyncDeactivationError } from "./errors.mjs";
|
|
2
2
|
import { tokenName } from "./token.mjs";
|
|
3
3
|
//#region src/lifecycle.ts
|
|
4
|
+
/**
|
|
5
|
+
* @since 0.3.16-canary.0
|
|
6
|
+
*/
|
|
4
7
|
var LifecycleManager = class {
|
|
5
8
|
_activationHooks = /* @__PURE__ */ new Map();
|
|
6
9
|
_deactivationHooks = /* @__PURE__ */ new Map();
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import { ConstructorMetadata, MutableLifecycleMetadata } from "./metadata-types.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/metadata/metadata-keys.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @since 0.3.16-canary.0
|
|
6
|
+
*/
|
|
4
7
|
declare const INJECTABLE_KEY: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* @since 0.3.16-canary.0
|
|
10
|
+
*/
|
|
5
11
|
declare const LIFECYCLE_KEY: unique symbol;
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.16-canary.0
|
|
14
|
+
*/
|
|
6
15
|
declare const INJECT_ACCESSOR_KEY: unique symbol;
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
7
19
|
declare const constructorMetadataMap: WeakMap<object, ConstructorMetadata>;
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
8
23
|
declare const lifecycleMetadataMap: WeakMap<object, MutableLifecycleMetadata>;
|
|
24
|
+
/**
|
|
25
|
+
* @since 0.3.16-canary.0
|
|
26
|
+
*/
|
|
9
27
|
declare const lifecycleByConstructorMetadataMap: WeakMap<object, MutableLifecycleMetadata>;
|
|
10
28
|
//#endregion
|
|
11
29
|
export { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap };
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
//#region src/metadata/metadata-keys.ts
|
|
2
|
+
/**
|
|
3
|
+
* @since 0.3.16-canary.0
|
|
4
|
+
*/
|
|
2
5
|
const INJECTABLE_KEY = Symbol("di:injectable");
|
|
6
|
+
/**
|
|
7
|
+
* @since 0.3.16-canary.0
|
|
8
|
+
*/
|
|
3
9
|
const LIFECYCLE_KEY = Symbol("di:lifecycle");
|
|
10
|
+
/**
|
|
11
|
+
* @since 0.3.16-canary.0
|
|
12
|
+
*/
|
|
4
13
|
const INJECT_ACCESSOR_KEY = Symbol("di:inject-accessor");
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.3.16-canary.0
|
|
16
|
+
*/
|
|
5
17
|
const constructorMetadataMap = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
6
21
|
const lifecycleMetadataMap = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
/**
|
|
23
|
+
* @since 0.3.16-canary.0
|
|
24
|
+
*/
|
|
7
25
|
const lifecycleByConstructorMetadataMap = /* @__PURE__ */ new WeakMap();
|
|
8
26
|
//#endregion
|
|
9
27
|
export { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap };
|
|
@@ -2,6 +2,9 @@ import { Token } from "../token.mjs";
|
|
|
2
2
|
import { MetadataReader } from "./metadata-types.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/metadata/metadata-reader-token.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* @since 0.3.16-canary.0
|
|
7
|
+
*/
|
|
5
8
|
declare const MetadataReaderToken: Token<MetadataReader>;
|
|
6
9
|
//#endregion
|
|
7
10
|
export { MetadataReaderToken };
|
|
@@ -2,6 +2,9 @@ import { Constructor } from "../constructor-type.mjs";
|
|
|
2
2
|
import { Token } from "../token.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/metadata/metadata-types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* @since 0.3.16-canary.0
|
|
7
|
+
*/
|
|
5
8
|
interface ParamMetadata {
|
|
6
9
|
readonly index: number;
|
|
7
10
|
readonly token: Token<unknown> | Constructor;
|
|
@@ -10,18 +13,31 @@ interface ParamMetadata {
|
|
|
10
13
|
readonly name?: string;
|
|
11
14
|
readonly tags?: ReadonlyArray<readonly [string, unknown]>;
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
13
19
|
interface ConstructorMetadata {
|
|
14
20
|
readonly params: readonly ParamMetadata[];
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @since 0.3.16-canary.0
|
|
24
|
+
*/
|
|
16
25
|
interface LifecycleMetadata {
|
|
17
26
|
readonly postConstruct: readonly string[];
|
|
18
27
|
readonly preDestroy: readonly string[];
|
|
19
28
|
}
|
|
20
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Mutable buckets used while aggregating decorator metadata (same keys as {@link LifecycleMetadata}).
|
|
31
|
+
*
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
21
34
|
interface MutableLifecycleMetadata {
|
|
22
35
|
postConstruct: string[];
|
|
23
36
|
preDestroy: string[];
|
|
24
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @since 0.3.16-canary.0
|
|
40
|
+
*/
|
|
25
41
|
interface MetadataReader {
|
|
26
42
|
getConstructorMetadata(target: Constructor): ConstructorMetadata | undefined;
|
|
27
43
|
getLifecycleMetadata(target: Constructor): LifecycleMetadata | undefined;
|
|
@@ -3,6 +3,9 @@ import { InjectionDescriptor } from "../decorators/inject.mjs";
|
|
|
3
3
|
import { ConstructorMetadata, LifecycleMetadata, MetadataReader } from "./metadata-types.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/metadata/symbol-metadata-reader.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* @since 0.3.16-canary.0
|
|
8
|
+
*/
|
|
6
9
|
declare class SymbolMetadataReader implements MetadataReader {
|
|
7
10
|
getConstructorMetadata(target: Constructor): ConstructorMetadata | undefined;
|
|
8
11
|
getLifecycleMetadata(target: Constructor): LifecycleMetadata | undefined;
|
|
@@ -11,6 +14,9 @@ declare class SymbolMetadataReader implements MetadataReader {
|
|
|
11
14
|
descriptor: InjectionDescriptor;
|
|
12
15
|
}> | undefined;
|
|
13
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
14
20
|
declare const defaultMetadataReader: SymbolMetadataReader;
|
|
15
21
|
//#endregion
|
|
16
22
|
export { SymbolMetadataReader, defaultMetadataReader };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap } from "./metadata-keys.mjs";
|
|
2
2
|
//#region src/metadata/symbol-metadata-reader.ts
|
|
3
|
+
/**
|
|
4
|
+
* @since 0.3.16-canary.0
|
|
5
|
+
*/
|
|
3
6
|
var SymbolMetadataReader = class {
|
|
4
7
|
getConstructorMetadata(target) {
|
|
5
8
|
const fromWeakMap = constructorMetadataMap.get(target);
|
|
@@ -33,6 +36,9 @@ var SymbolMetadataReader = class {
|
|
|
33
36
|
return meta[INJECT_ACCESSOR_KEY];
|
|
34
37
|
}
|
|
35
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* @since 0.3.16-canary.0
|
|
41
|
+
*/
|
|
36
42
|
const defaultMetadataReader = new SymbolMetadataReader();
|
|
37
43
|
//#endregion
|
|
38
44
|
export { SymbolMetadataReader, defaultMetadataReader };
|