@avijs/di 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/container.d.ts +65 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +368 -0
- package/dist/container.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.d.ts +39 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +91 -0
- package/dist/provider.js.map +1 -0
- package/dist/token.d.ts +22 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +16 -0
- package/dist/token.js.map +1 -0
- package/package.json +44 -3
- package/src/container.ts +469 -0
- package/src/index.ts +18 -0
- package/src/provider.ts +151 -0
- package/src/token.ts +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christopher Robin Chase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @avijs/di
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Explicit, reflection-free dependency injection for Avi.js: tokens, providers, scopes, module visibility and disposal.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @avijs/di
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Part of [Avi.js](https://github.com/chrischase011/avi-js), a TypeScript framework for Node.js with
|
|
10
|
+
modules, controllers and dependency injection, without `reflect-metadata`. See the
|
|
11
|
+
[tutorial](https://github.com/chrischase011/avi-js/blob/main/docs/tutorial/README.md) to get started.
|
|
12
|
+
|
|
13
|
+
Requires Node.js 22.12 or newer. MIT licensed.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Provider, type Scope } from './provider.js';
|
|
2
|
+
import { type Token } from './token.js';
|
|
3
|
+
export interface ModuleDefinition {
|
|
4
|
+
readonly name?: string;
|
|
5
|
+
readonly imports?: readonly ModuleDefinition[];
|
|
6
|
+
readonly providers?: readonly Provider[];
|
|
7
|
+
/** Own providers, tokens re-exported from imports, or imported modules to re-export. */
|
|
8
|
+
readonly exports?: readonly (Token | ModuleDefinition)[];
|
|
9
|
+
}
|
|
10
|
+
export interface ContainerOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Providers that replace the provider for the same token wherever it is declared. Meant for
|
|
13
|
+
* tests. An override that matches nothing is an error.
|
|
14
|
+
*/
|
|
15
|
+
readonly overrides?: readonly Provider[];
|
|
16
|
+
/**
|
|
17
|
+
* Tokens whose values each request supplies through `requestScope()`, such as the request
|
|
18
|
+
* itself. Visible in every module, as request-scoped providers.
|
|
19
|
+
*/
|
|
20
|
+
readonly requestTokens?: readonly Token[];
|
|
21
|
+
}
|
|
22
|
+
/** Request-scoped instances for one request. */
|
|
23
|
+
export interface RequestScope {
|
|
24
|
+
/** Like `Container.resolve`, but request-scoped providers are created once for this scope. */
|
|
25
|
+
resolve(module: ModuleDefinition, token: Token): unknown;
|
|
26
|
+
/** Disposes this scope's instances in reverse creation order. */
|
|
27
|
+
dispose(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface ProviderDescription {
|
|
30
|
+
readonly token: string;
|
|
31
|
+
readonly kind: 'class' | 'value' | 'factory';
|
|
32
|
+
readonly scope: Scope;
|
|
33
|
+
readonly inject: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
export interface ModuleDescription {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly imports: readonly string[];
|
|
38
|
+
readonly providers: readonly ProviderDescription[];
|
|
39
|
+
readonly exports: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Builds and validates the module graph on construction. `init()` creates every singleton,
|
|
43
|
+
* `dispose()` tears them down in reverse creation order.
|
|
44
|
+
*/
|
|
45
|
+
export declare class Container {
|
|
46
|
+
#private;
|
|
47
|
+
constructor(roots: readonly ModuleDefinition[], options?: ContainerOptions);
|
|
48
|
+
/** Module definitions in dependency order: imports before importers. */
|
|
49
|
+
get modules(): ModuleDefinition[];
|
|
50
|
+
/** A plain description of the validated graph, without creating any provider. */
|
|
51
|
+
describe(): ModuleDescription[];
|
|
52
|
+
/** Throws if `tokens` cannot all be resolved from `module`. `label` starts the error path. */
|
|
53
|
+
check(module: ModuleDefinition, tokens: readonly Token[], label: string): void;
|
|
54
|
+
/** True if resolving any of `tokens` from `module` needs a request scope. */
|
|
55
|
+
needsRequest(module: ModuleDefinition, tokens: readonly Token[]): boolean;
|
|
56
|
+
/** Starts a request scope. `values` supplies the `requestTokens`. */
|
|
57
|
+
requestScope(values: ReadonlyMap<Token, unknown>): RequestScope;
|
|
58
|
+
init(): Promise<void>;
|
|
59
|
+
/** Resolves `token` as seen from `module`. Transients are created on every call. */
|
|
60
|
+
resolve(module: ModuleDefinition, token: Token): unknown;
|
|
61
|
+
/** Resolves `token` from what the root modules can see. Meant for tests and scripts. */
|
|
62
|
+
get(token: Token): unknown;
|
|
63
|
+
dispose(): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,QAAQ,EAAqB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EAAsB,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACzC,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,KAAK,GAAG,gBAAgB,CAAC,EAAE,CAAC;CAC1D;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;CAC3C;AAED,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,8FAA8F;IAC9F,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;IACzD,iEAAiE;IACjE,OAAO,IAAI,OAAO,CA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AK,GAAG,OAAO;IAgBpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA6K/B"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { normalizeProvider } from './provider.js';
|
|
2
|
+
import { isToken, tokenName } from './token.js';
|
|
3
|
+
const REQUEST_MODULE = {
|
|
4
|
+
definition: { name: 'request' },
|
|
5
|
+
name: 'request',
|
|
6
|
+
imports: [],
|
|
7
|
+
own: new Map(),
|
|
8
|
+
exported: new Map(),
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Builds and validates the module graph on construction. `init()` creates every singleton,
|
|
12
|
+
* `dispose()` tears them down in reverse creation order.
|
|
13
|
+
*/
|
|
14
|
+
export class Container {
|
|
15
|
+
#modules = new Map();
|
|
16
|
+
#roots;
|
|
17
|
+
#created = [];
|
|
18
|
+
#overrides = new Map();
|
|
19
|
+
#overridden = new Set();
|
|
20
|
+
#supplied = new Map();
|
|
21
|
+
#state = 'new';
|
|
22
|
+
constructor(roots, options = {}) {
|
|
23
|
+
(options.overrides ?? []).forEach((provider, i) => {
|
|
24
|
+
const spec = normalizeProvider(provider, `overrides[${String(i)}]`);
|
|
25
|
+
if (this.#overrides.has(spec.token)) {
|
|
26
|
+
throw new Error(`${tokenName(spec.token)} is overridden twice`);
|
|
27
|
+
}
|
|
28
|
+
this.#overrides.set(spec.token, spec);
|
|
29
|
+
});
|
|
30
|
+
for (const token of options.requestTokens ?? []) {
|
|
31
|
+
this.#supplied.set(token, {
|
|
32
|
+
token,
|
|
33
|
+
kind: 'value',
|
|
34
|
+
scope: 'request',
|
|
35
|
+
deps: [],
|
|
36
|
+
create: () => undefined,
|
|
37
|
+
dispose: undefined,
|
|
38
|
+
module: REQUEST_MODULE,
|
|
39
|
+
links: [],
|
|
40
|
+
requestBound: true,
|
|
41
|
+
supplied: true,
|
|
42
|
+
state: 'checked',
|
|
43
|
+
instance: undefined,
|
|
44
|
+
ready: undefined,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
this.#roots = roots.map((root, i) => this.#collect(root, [], `root module ${String(i)}`));
|
|
48
|
+
for (const token of this.#overrides.keys()) {
|
|
49
|
+
if (!this.#overridden.has(token)) {
|
|
50
|
+
throw new Error(`The override for ${tokenName(token)} matches no provider in the app`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for (const module of this.#modules.values()) {
|
|
54
|
+
for (const record of module.own.values())
|
|
55
|
+
this.#check(record, [tokenName(record.token)]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Module definitions in dependency order: imports before importers. */
|
|
59
|
+
get modules() {
|
|
60
|
+
return [...this.#modules.keys()];
|
|
61
|
+
}
|
|
62
|
+
/** A plain description of the validated graph, without creating any provider. */
|
|
63
|
+
describe() {
|
|
64
|
+
return [...this.#modules.values()].map((module) => ({
|
|
65
|
+
name: module.name,
|
|
66
|
+
imports: module.imports.map((imported) => imported.name),
|
|
67
|
+
providers: [...module.own.values()].map((record) => ({
|
|
68
|
+
token: tokenName(record.token),
|
|
69
|
+
kind: record.kind,
|
|
70
|
+
scope: record.scope,
|
|
71
|
+
inject: record.deps.map(tokenName),
|
|
72
|
+
})),
|
|
73
|
+
exports: [...module.exported.keys()].map(tokenName),
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
/** Throws if `tokens` cannot all be resolved from `module`. `label` starts the error path. */
|
|
77
|
+
check(module, tokens, label) {
|
|
78
|
+
const record = this.#module(module);
|
|
79
|
+
for (const token of tokens) {
|
|
80
|
+
const target = this.#lookupOrThrow(record, token, [label]);
|
|
81
|
+
this.#check(target, [label, tokenName(token)]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** True if resolving any of `tokens` from `module` needs a request scope. */
|
|
85
|
+
needsRequest(module, tokens) {
|
|
86
|
+
const record = this.#module(module);
|
|
87
|
+
return tokens.some((token) => this.#lookupOrThrow(record, token, []).requestBound);
|
|
88
|
+
}
|
|
89
|
+
/** Starts a request scope. `values` supplies the `requestTokens`. */
|
|
90
|
+
requestScope(values) {
|
|
91
|
+
this.#assertReady();
|
|
92
|
+
const scope = { values, instances: new Map(), created: [] };
|
|
93
|
+
return {
|
|
94
|
+
resolve: (module, token) => this.#instance(this.#lookupOrThrow(this.#module(module), token, []), scope),
|
|
95
|
+
dispose: () => disposeAll(scope.created.splice(0)),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
async init() {
|
|
99
|
+
if (this.#state !== 'new')
|
|
100
|
+
throw new Error(`Container is already ${this.#state}`);
|
|
101
|
+
this.#state = 'initializing';
|
|
102
|
+
try {
|
|
103
|
+
for (const module of this.#modules.values()) {
|
|
104
|
+
for (const record of module.own.values()) {
|
|
105
|
+
if (record.scope === 'singleton')
|
|
106
|
+
await this.#ensure(record);
|
|
107
|
+
else
|
|
108
|
+
await this.#ensureDeps(record);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
this.#state = 'ready';
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
await this.dispose().catch(() => undefined);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** Resolves `token` as seen from `module`. Transients are created on every call. */
|
|
119
|
+
resolve(module, token) {
|
|
120
|
+
this.#assertReady();
|
|
121
|
+
return this.#instance(this.#lookupOrThrow(this.#module(module), token, []));
|
|
122
|
+
}
|
|
123
|
+
/** Resolves `token` from what the root modules can see. Meant for tests and scripts. */
|
|
124
|
+
get(token) {
|
|
125
|
+
this.#assertReady();
|
|
126
|
+
const found = new Set();
|
|
127
|
+
for (const root of this.#roots) {
|
|
128
|
+
const hit = lookup(root, token);
|
|
129
|
+
if (hit && 'ambiguous' in hit) {
|
|
130
|
+
throw new Error(`${tokenName(token)} is exported to ${root.name} by more than one import`);
|
|
131
|
+
}
|
|
132
|
+
if (hit)
|
|
133
|
+
found.add(hit);
|
|
134
|
+
}
|
|
135
|
+
if (found.size === 0)
|
|
136
|
+
throw new Error(`${tokenName(token)} is not visible to the root modules`);
|
|
137
|
+
if (found.size > 1)
|
|
138
|
+
throw new Error(`${tokenName(token)} is provided by more than one root module`);
|
|
139
|
+
return this.#instance([...found][0]);
|
|
140
|
+
}
|
|
141
|
+
async dispose() {
|
|
142
|
+
this.#state = 'disposed';
|
|
143
|
+
await disposeAll(this.#created.splice(0).map((record) => ({ record, value: record.instance })));
|
|
144
|
+
}
|
|
145
|
+
#collect(definition, stack, where) {
|
|
146
|
+
if (typeof definition !== 'object' || definition === null) {
|
|
147
|
+
const value = definition;
|
|
148
|
+
const hint = value === undefined ? ' (is there a circular import?)' : '';
|
|
149
|
+
throw new TypeError(`Invalid module at ${where}: ${value === null ? 'null' : typeof value}${hint}`);
|
|
150
|
+
}
|
|
151
|
+
const existing = this.#modules.get(definition);
|
|
152
|
+
if (existing)
|
|
153
|
+
return existing;
|
|
154
|
+
const name = definition.name ?? '(anonymous module)';
|
|
155
|
+
if (stack.includes(definition)) {
|
|
156
|
+
const cycle = [...stack.slice(stack.indexOf(definition)), definition].map(moduleName);
|
|
157
|
+
throw new Error(`Module import cycle: ${cycle.join(' → ')}`);
|
|
158
|
+
}
|
|
159
|
+
const imports = (definition.imports ?? []).map((child, i) => this.#collect(child, [...stack, definition], `${name}.imports[${String(i)}]`));
|
|
160
|
+
const record = { definition, name, imports, own: new Map(), exported: new Map() };
|
|
161
|
+
(definition.providers ?? []).forEach((provider, i) => {
|
|
162
|
+
const declared = normalizeProvider(provider, `${name}.providers[${String(i)}]`);
|
|
163
|
+
if (record.own.has(declared.token)) {
|
|
164
|
+
throw new Error(`${tokenName(declared.token)} is provided twice in ${name}`);
|
|
165
|
+
}
|
|
166
|
+
const spec = this.#overrides.get(declared.token) ?? declared;
|
|
167
|
+
if (spec !== declared)
|
|
168
|
+
this.#overridden.add(declared.token);
|
|
169
|
+
record.own.set(spec.token, {
|
|
170
|
+
...spec,
|
|
171
|
+
module: record,
|
|
172
|
+
links: [],
|
|
173
|
+
requestBound: false,
|
|
174
|
+
supplied: false,
|
|
175
|
+
state: 'unchecked',
|
|
176
|
+
instance: undefined,
|
|
177
|
+
ready: undefined,
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
for (const entry of definition.exports ?? [])
|
|
181
|
+
exportEntry(record, entry);
|
|
182
|
+
this.#modules.set(definition, record);
|
|
183
|
+
return record;
|
|
184
|
+
}
|
|
185
|
+
#module(definition) {
|
|
186
|
+
const record = this.#modules.get(definition);
|
|
187
|
+
if (!record)
|
|
188
|
+
throw new Error(`${moduleName(definition)} is not part of this application`);
|
|
189
|
+
return record;
|
|
190
|
+
}
|
|
191
|
+
#lookupOrThrow(module, token, path) {
|
|
192
|
+
const hit = lookup(module, token) ?? this.#supplied.get(token);
|
|
193
|
+
const chain = [...path, tokenName(token)].join(' → ');
|
|
194
|
+
if (!hit) {
|
|
195
|
+
const imports = module.imports.map((m) => m.name).join(', ') || 'none';
|
|
196
|
+
throw new Error(`Cannot resolve ${chain} in ${module.name}: ${tokenName(token)} is not provided by ${module.name} or exported by its imports (${imports})`);
|
|
197
|
+
}
|
|
198
|
+
if ('ambiguous' in hit) {
|
|
199
|
+
throw new Error(`Cannot resolve ${chain} in ${module.name}: ${tokenName(token)} is exported by more than one import (${hit.ambiguous.join(', ')})`);
|
|
200
|
+
}
|
|
201
|
+
return hit;
|
|
202
|
+
}
|
|
203
|
+
/** Links dependencies and detects missing providers and cycles. */
|
|
204
|
+
#check(record, path) {
|
|
205
|
+
if (record.state === 'checked')
|
|
206
|
+
return;
|
|
207
|
+
if (record.state === 'checking') {
|
|
208
|
+
const start = path.indexOf(tokenName(record.token));
|
|
209
|
+
throw new Error(`Dependency cycle: ${path.slice(start).join(' → ')}`);
|
|
210
|
+
}
|
|
211
|
+
record.state = 'checking';
|
|
212
|
+
record.links = record.deps.map((token) => {
|
|
213
|
+
const target = this.#lookupOrThrow(record.module, token, path);
|
|
214
|
+
this.#check(target, [...path, tokenName(token)]);
|
|
215
|
+
return target;
|
|
216
|
+
});
|
|
217
|
+
record.requestBound =
|
|
218
|
+
record.scope === 'request' ||
|
|
219
|
+
(record.scope === 'transient' && record.links.some((link) => link.requestBound));
|
|
220
|
+
const bound = record.scope === 'singleton' && record.links.find((link) => link.requestBound);
|
|
221
|
+
if (bound) {
|
|
222
|
+
const name = tokenName(record.token);
|
|
223
|
+
const chain = [...path, tokenName(bound.token)].join(' → ');
|
|
224
|
+
throw new Error(`Singleton ${name} in ${record.module.name} depends on request-scoped ${tokenName(bound.token)} (${chain}). A singleton outlives the request; make ${name} request-scoped or transient.`);
|
|
225
|
+
}
|
|
226
|
+
record.state = 'checked';
|
|
227
|
+
}
|
|
228
|
+
#ensure(record) {
|
|
229
|
+
record.ready ??= (async () => {
|
|
230
|
+
await this.#ensureDeps(record);
|
|
231
|
+
let value = this.#create(record);
|
|
232
|
+
if (record.kind === 'factory' && value instanceof Promise) {
|
|
233
|
+
try {
|
|
234
|
+
value = await value;
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
throw creationError(record, error);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
record.instance = value;
|
|
241
|
+
if (record.kind !== 'value')
|
|
242
|
+
this.#created.push(record);
|
|
243
|
+
})();
|
|
244
|
+
return record.ready;
|
|
245
|
+
}
|
|
246
|
+
async #ensureDeps(record) {
|
|
247
|
+
for (const dep of record.links) {
|
|
248
|
+
if (dep.scope === 'singleton')
|
|
249
|
+
await this.#ensure(dep);
|
|
250
|
+
else
|
|
251
|
+
await this.#ensureDeps(dep);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
#create(record, scope) {
|
|
255
|
+
const deps = record.links.map((dep) => this.#instance(dep, scope));
|
|
256
|
+
try {
|
|
257
|
+
return record.create(deps);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
throw creationError(record, error);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
#instance(record, scope) {
|
|
264
|
+
if (record.scope === 'singleton')
|
|
265
|
+
return record.instance;
|
|
266
|
+
if (record.scope === 'request') {
|
|
267
|
+
if (!scope) {
|
|
268
|
+
throw new Error(`${tokenName(record.token)} is request-scoped and can only be resolved while handling a request`);
|
|
269
|
+
}
|
|
270
|
+
if (record.supplied) {
|
|
271
|
+
if (!scope.values.has(record.token)) {
|
|
272
|
+
throw new Error(`This request scope has no value for ${tokenName(record.token)}`);
|
|
273
|
+
}
|
|
274
|
+
return scope.values.get(record.token);
|
|
275
|
+
}
|
|
276
|
+
if (scope.instances.has(record))
|
|
277
|
+
return scope.instances.get(record);
|
|
278
|
+
const value = this.#createSync(record, scope);
|
|
279
|
+
scope.instances.set(record, value);
|
|
280
|
+
scope.created.push({ record, value });
|
|
281
|
+
return value;
|
|
282
|
+
}
|
|
283
|
+
return this.#createSync(record, scope);
|
|
284
|
+
}
|
|
285
|
+
#createSync(record, scope) {
|
|
286
|
+
const value = this.#create(record, scope);
|
|
287
|
+
if (record.kind === 'factory' && value instanceof Promise) {
|
|
288
|
+
value.catch(() => undefined);
|
|
289
|
+
const kind = record.scope === 'request' ? 'Request-scoped' : 'Transient';
|
|
290
|
+
throw new Error(`${kind} provider ${tokenName(record.token)} in ${record.module.name} returned a Promise; only singletons may be async`);
|
|
291
|
+
}
|
|
292
|
+
return value;
|
|
293
|
+
}
|
|
294
|
+
#assertReady() {
|
|
295
|
+
if (this.#state !== 'ready')
|
|
296
|
+
throw new Error('The container is not initialized; call init() first');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function lookup(module, token) {
|
|
300
|
+
const own = module.own.get(token);
|
|
301
|
+
if (own)
|
|
302
|
+
return own;
|
|
303
|
+
const hits = new Map();
|
|
304
|
+
for (const imported of module.imports) {
|
|
305
|
+
const hit = imported.exported.get(token);
|
|
306
|
+
if (hit && !hits.has(hit))
|
|
307
|
+
hits.set(hit, imported.name);
|
|
308
|
+
}
|
|
309
|
+
if (hits.size > 1)
|
|
310
|
+
return { ambiguous: [...hits.values()] };
|
|
311
|
+
return hits.keys().next().value;
|
|
312
|
+
}
|
|
313
|
+
function exportEntry(module, entry) {
|
|
314
|
+
const imported = module.imports.find((m) => m.definition === entry);
|
|
315
|
+
if (imported) {
|
|
316
|
+
for (const [token, record] of imported.exported)
|
|
317
|
+
module.exported.set(token, record);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (!isToken(entry)) {
|
|
321
|
+
throw new TypeError(`Invalid export in ${module.name}: expected a token or an imported module${entry === undefined ? ' (is there a circular import?)' : ''}`);
|
|
322
|
+
}
|
|
323
|
+
const hit = lookup(module, entry);
|
|
324
|
+
if (!hit) {
|
|
325
|
+
throw new Error(`${module.name} exports ${tokenName(entry)}, which it neither provides nor imports`);
|
|
326
|
+
}
|
|
327
|
+
if ('ambiguous' in hit) {
|
|
328
|
+
throw new Error(`${module.name} exports ${tokenName(entry)}, which more than one import provides (${hit.ambiguous.join(', ')})`);
|
|
329
|
+
}
|
|
330
|
+
module.exported.set(entry, hit);
|
|
331
|
+
}
|
|
332
|
+
/** Disposes in reverse order, continuing past failures. */
|
|
333
|
+
async function disposeAll(created) {
|
|
334
|
+
const errors = [];
|
|
335
|
+
for (const { record, value } of [...created].reverse()) {
|
|
336
|
+
try {
|
|
337
|
+
await disposeValue(record, value);
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
errors.push(error);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (errors.length > 0) {
|
|
344
|
+
throw new AggregateError(errors, `Failed to dispose ${String(errors.length)} provider(s)`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
async function disposeValue(record, instance) {
|
|
348
|
+
if (record.dispose) {
|
|
349
|
+
await record.dispose(instance);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const value = instance;
|
|
353
|
+
const asyncDispose = value?.[Symbol.asyncDispose];
|
|
354
|
+
const syncDispose = value?.[Symbol.dispose];
|
|
355
|
+
if (typeof asyncDispose === 'function')
|
|
356
|
+
await asyncDispose.call(value);
|
|
357
|
+
else if (typeof syncDispose === 'function')
|
|
358
|
+
syncDispose.call(value);
|
|
359
|
+
}
|
|
360
|
+
function creationError(record, cause) {
|
|
361
|
+
return new Error(`Failed to create ${tokenName(record.token)} in ${record.module.name}`, {
|
|
362
|
+
cause,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function moduleName(definition) {
|
|
366
|
+
return definition.name ?? '(anonymous module)';
|
|
367
|
+
}
|
|
368
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgD,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AAyE5D,MAAM,cAAc,GAAiB;IACnC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,EAAE;IACX,GAAG,EAAE,IAAI,GAAG,EAAE;IACd,QAAQ,EAAE,IAAI,GAAG,EAAE;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,SAAS;IACX,QAAQ,GAAG,IAAI,GAAG,EAAkC,CAAC;IACrD,MAAM,CAAiB;IACvB,QAAQ,GAAqB,EAAE,CAAC;IAChC,UAAU,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC5C,WAAW,GAAG,IAAI,GAAG,EAAS,CAAC;IAC/B,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;IACtD,MAAM,GAAkD,KAAK,CAAC;IAE9D,YAAY,KAAkC,EAAE,UAA4B,EAAE;QAC5E,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE;YAChD,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,aAAa,MAAM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O,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;QACvF,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,UAA4B;IAC9C,OAAO,UAAU,CAAC,IAAI,IAAI,oBAAoB,CAAC;AACjD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Container } from './container.js';
|
|
2
|
+
export type { ContainerOptions, ModuleDefinition, ModuleDescription, ProviderDescription, RequestScope, } from './container.js';
|
|
3
|
+
export type { ClassProvider, FactoryProvider, Provider, Scope, ValueProvider } from './provider.js';
|
|
4
|
+
export { createToken } from './token.js';
|
|
5
|
+
export type { Class, Constructor, InjectionToken, ResolveTokens, Token, TokenType, } from './token.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EACV,KAAK,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,KAAK,EACL,SAAS,GACV,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAS3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Constructor, type Token } from './token.js';
|
|
2
|
+
/**
|
|
3
|
+
* `singleton`: one instance per app. `transient`: a new one per injection. `request`: one per
|
|
4
|
+
* request, created on first use and disposed after the handler.
|
|
5
|
+
*/
|
|
6
|
+
export type Scope = 'singleton' | 'transient' | 'request';
|
|
7
|
+
export interface ClassProvider<T = unknown> {
|
|
8
|
+
provide: Token<T>;
|
|
9
|
+
useClass: Constructor<T>;
|
|
10
|
+
scope?: Scope;
|
|
11
|
+
}
|
|
12
|
+
export interface ValueProvider<T = unknown> {
|
|
13
|
+
provide: Token<T>;
|
|
14
|
+
useValue: T;
|
|
15
|
+
}
|
|
16
|
+
export interface FactoryProvider<T = unknown> {
|
|
17
|
+
provide: Token<T>;
|
|
18
|
+
/** Receives `inject` in order. Only singleton factories may return a promise. */
|
|
19
|
+
useFactory: (...deps: never[]) => T | Promise<T>;
|
|
20
|
+
inject?: readonly Token[];
|
|
21
|
+
scope?: Scope;
|
|
22
|
+
/**
|
|
23
|
+
* Called with the created value on shutdown, or after the request for request scope. A method,
|
|
24
|
+
* so typed callbacks fit `Provider[]`.
|
|
25
|
+
*/
|
|
26
|
+
dispose?(value: T): unknown;
|
|
27
|
+
}
|
|
28
|
+
export type Provider<T = unknown> = Constructor<T> | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T>;
|
|
29
|
+
export interface ProviderSpec {
|
|
30
|
+
readonly token: Token;
|
|
31
|
+
readonly kind: 'class' | 'value' | 'factory';
|
|
32
|
+
readonly scope: Scope;
|
|
33
|
+
readonly deps: readonly Token[];
|
|
34
|
+
readonly create: (deps: unknown[]) => unknown;
|
|
35
|
+
readonly dispose: ((value: unknown) => unknown) | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Validates a provider and converts it to one internal shape. `where` labels errors. */
|
|
38
|
+
export declare function normalizeProvider(provider: unknown, where: string): ProviderSpec;
|
|
39
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -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