ditox 1.3.0 → 2.0.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/README.md +5 -5
- package/dist/{index.d.ts → browser/index.d.ts} +18 -10
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/cjs/ditox.d.ts +125 -0
- package/dist/cjs/ditox.js +210 -0
- package/dist/cjs/ditox.js.map +1 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/modules.d.ts +124 -0
- package/dist/cjs/modules.js +110 -0
- package/dist/cjs/modules.js.map +1 -0
- package/{src/utils.js.flow → dist/cjs/utils.d.ts} +21 -60
- package/dist/cjs/utils.js +98 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/ditox.d.ts +125 -0
- package/{lib/index.js → dist/esm/ditox.js} +10 -196
- package/dist/esm/ditox.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/modules.d.ts +124 -0
- package/dist/esm/modules.js +103 -0
- package/dist/esm/modules.js.map +1 -0
- package/dist/esm/utils.d.ts +74 -0
- package/dist/esm/utils.js +88 -0
- package/dist/esm/utils.js.map +1 -0
- package/{lib → dist/umd}/index.d.ts +18 -10
- package/dist/umd/index.js +2 -0
- package/dist/umd/index.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +113 -96
- package/docs/classes/{resolvererror.md → ResolverError.md} +14 -12
- package/package.json +16 -17
- package/src/ditox.test.ts +10 -1
- package/src/index.ts +8 -9
- package/src/modules.test.ts +79 -5
- package/src/modules.ts +33 -17
- package/src/utils.ts +4 -4
- package/CHANGELOG.md +0 -99
- package/dist/index.browser.js +0 -2
- package/dist/index.browser.js.flow +0 -4
- package/dist/index.browser.js.map +0 -1
- package/dist/index.js +0 -406
- package/dist/index.js.flow +0 -4
- package/dist/index.js.map +0 -1
- package/dist/index.module.d.ts +0 -293
- package/dist/index.module.js +0 -388
- package/dist/index.module.js.flow +0 -4
- package/dist/index.module.js.map +0 -1
- package/dist/index.umd.d.ts +0 -293
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.flow +0 -4
- package/dist/index.umd.js.map +0 -1
- package/lib/index.js.flow +0 -4
- package/lib/index.js.map +0 -1
- package/mod.ts +0 -2
- package/src/ditox.js.flow +0 -131
- package/src/index.js.flow +0 -34
- package/src/modules.js.flow +0 -146
|
@@ -8,25 +8,25 @@ ResolverError is thrown by the resolver when a token is not found in a container
|
|
|
8
8
|
|
|
9
9
|
- `Error`
|
|
10
10
|
|
|
11
|
-
↳
|
|
11
|
+
↳ **`ResolverError`**
|
|
12
12
|
|
|
13
13
|
## Table of contents
|
|
14
14
|
|
|
15
15
|
### Constructors
|
|
16
16
|
|
|
17
|
-
- [constructor](
|
|
17
|
+
- [constructor](ResolverError.md#constructor)
|
|
18
18
|
|
|
19
19
|
### Properties
|
|
20
20
|
|
|
21
|
-
- [message](
|
|
22
|
-
- [name](
|
|
23
|
-
- [stack](
|
|
24
|
-
- [prepareStackTrace](
|
|
25
|
-
- [stackTraceLimit](
|
|
21
|
+
- [message](ResolverError.md#message)
|
|
22
|
+
- [name](ResolverError.md#name)
|
|
23
|
+
- [stack](ResolverError.md#stack)
|
|
24
|
+
- [prepareStackTrace](ResolverError.md#preparestacktrace)
|
|
25
|
+
- [stackTraceLimit](ResolverError.md#stacktracelimit)
|
|
26
26
|
|
|
27
27
|
### Methods
|
|
28
28
|
|
|
29
|
-
- [captureStackTrace](
|
|
29
|
+
- [captureStackTrace](ResolverError.md#capturestacktrace)
|
|
30
30
|
|
|
31
31
|
## Constructors
|
|
32
32
|
|
|
@@ -46,7 +46,7 @@ Error.constructor
|
|
|
46
46
|
|
|
47
47
|
#### Defined in
|
|
48
48
|
|
|
49
|
-
[packages/ditox/src/ditox.ts:
|
|
49
|
+
[packages/ditox/src/ditox.ts:61](https://github.com/mnasyrov/ditox/blob/8c2302d/packages/ditox/src/ditox.ts#L61)
|
|
50
50
|
|
|
51
51
|
## Properties
|
|
52
52
|
|
|
@@ -60,7 +60,7 @@ Error.message
|
|
|
60
60
|
|
|
61
61
|
#### Defined in
|
|
62
62
|
|
|
63
|
-
node_modules/typescript/lib/lib.es5.d.ts:
|
|
63
|
+
node_modules/typescript/lib/lib.es5.d.ts:1023
|
|
64
64
|
|
|
65
65
|
___
|
|
66
66
|
|
|
@@ -74,7 +74,7 @@ Error.name
|
|
|
74
74
|
|
|
75
75
|
#### Defined in
|
|
76
76
|
|
|
77
|
-
node_modules/typescript/lib/lib.es5.d.ts:
|
|
77
|
+
node_modules/typescript/lib/lib.es5.d.ts:1022
|
|
78
78
|
|
|
79
79
|
___
|
|
80
80
|
|
|
@@ -88,7 +88,7 @@ Error.stack
|
|
|
88
88
|
|
|
89
89
|
#### Defined in
|
|
90
90
|
|
|
91
|
-
node_modules/typescript/lib/lib.es5.d.ts:
|
|
91
|
+
node_modules/typescript/lib/lib.es5.d.ts:1024
|
|
92
92
|
|
|
93
93
|
___
|
|
94
94
|
|
|
@@ -102,6 +102,8 @@ ___
|
|
|
102
102
|
|
|
103
103
|
Optional override for formatting stack traces
|
|
104
104
|
|
|
105
|
+
**`see`** https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
106
|
+
|
|
105
107
|
##### Parameters
|
|
106
108
|
|
|
107
109
|
| Name | Type |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ditox",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Powerful dependency injection container for building modular apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mikhail Nasyrov <mikhail@mnasyrov.com> (https://github.com/mnasyrov)",
|
|
7
7
|
"homepage": "https://github.com/mnasyrov/ditox",
|
|
@@ -22,31 +22,30 @@
|
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=12"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"types": "dist/index.d.ts",
|
|
25
|
+
"main": "dist/cjs/index.js",
|
|
26
|
+
"module": "dist/esm/index.js",
|
|
27
|
+
"jsnext:main": "dist/esm/index.js",
|
|
28
|
+
"unpkg": "dist/umd/index.js",
|
|
29
|
+
"umd:main": "dist/umd/index.js",
|
|
30
|
+
"browser": "dist/browser/index.js",
|
|
31
|
+
"react-native": "dist/browser/index.js",
|
|
32
|
+
"types": "dist/esm/index.d.ts",
|
|
34
33
|
"source": "src/index.ts",
|
|
35
34
|
"sideEffects": false,
|
|
36
35
|
"files": [
|
|
37
36
|
"dist",
|
|
38
37
|
"docs",
|
|
39
|
-
"lib",
|
|
40
38
|
"src",
|
|
41
39
|
"LICENSE",
|
|
42
|
-
"mod.ts",
|
|
43
40
|
"README.md"
|
|
44
41
|
],
|
|
45
42
|
"scripts": {
|
|
46
43
|
"clean": "shx rm -rf dist lib",
|
|
47
|
-
"test-deno": "deno test test-deno",
|
|
48
|
-
"build": "rollup
|
|
49
|
-
"
|
|
44
|
+
"test-deno": "npm run build:rollup && deno test test-deno",
|
|
45
|
+
"build": "npm run build:cjs && npm run build:esm && npm run build:rollup",
|
|
46
|
+
"build:cjs": "tsc -p tsconfig.build.json --outDir dist/cjs --module commonjs",
|
|
47
|
+
"build:esm": "tsc -p tsconfig.build.json --outDir dist/esm --module es2015",
|
|
48
|
+
"build:rollup": "rollup -c"
|
|
50
49
|
},
|
|
51
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "b725c9fbdca6b771f8b77c4f43eec7f324fa2c7e"
|
|
52
51
|
}
|
package/src/ditox.test.ts
CHANGED
|
@@ -508,7 +508,16 @@ describe('Container', () => {
|
|
|
508
508
|
|
|
509
509
|
it('should throw ResolverError in case a value is not provided', () => {
|
|
510
510
|
const container = createContainer();
|
|
511
|
-
expect(() => container.resolve(
|
|
511
|
+
expect(() => container.resolve(token('test'))).toThrowError(
|
|
512
|
+
new ResolverError(`Token "test" is not provided`),
|
|
513
|
+
);
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
it('should throw ResolverError with an empty name in case a token is not resolved', () => {
|
|
517
|
+
const container = createContainer();
|
|
518
|
+
expect(() => container.resolve(token())).toThrowError(
|
|
519
|
+
new ResolverError(`Token "" is not provided`),
|
|
520
|
+
);
|
|
512
521
|
});
|
|
513
522
|
|
|
514
523
|
it('should resolve a value from the parent container', () => {
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {token, optional, ResolverError, createContainer} from './ditox';
|
|
2
|
+
export type {
|
|
2
3
|
RequiredToken,
|
|
3
4
|
OptionalToken,
|
|
4
5
|
Token,
|
|
5
|
-
token,
|
|
6
|
-
optional,
|
|
7
|
-
ResolverError,
|
|
8
6
|
FactoryScope,
|
|
9
7
|
FactoryOptions,
|
|
10
8
|
Container,
|
|
11
|
-
createContainer,
|
|
12
9
|
} from './ditox';
|
|
13
10
|
|
|
14
11
|
export {
|
|
@@ -22,12 +19,14 @@ export {
|
|
|
22
19
|
} from './utils';
|
|
23
20
|
|
|
24
21
|
export {
|
|
25
|
-
Module,
|
|
26
|
-
ModuleDeclaration,
|
|
27
|
-
BindModuleOptions,
|
|
28
|
-
ModuleBindingEntry,
|
|
29
22
|
bindModule,
|
|
30
23
|
bindModules,
|
|
31
24
|
declareModule,
|
|
32
25
|
declareModuleBindings,
|
|
33
26
|
} from './modules';
|
|
27
|
+
export type {
|
|
28
|
+
Module,
|
|
29
|
+
ModuleDeclaration,
|
|
30
|
+
BindModuleOptions,
|
|
31
|
+
ModuleBindingEntry,
|
|
32
|
+
} from './modules';
|
package/src/modules.test.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Module,
|
|
8
8
|
ModuleDeclaration,
|
|
9
9
|
} from './modules';
|
|
10
|
+
import {injectable} from './utils';
|
|
10
11
|
|
|
11
12
|
describe('bindModule()', () => {
|
|
12
13
|
type TestQueries = {getValue: () => number};
|
|
@@ -22,7 +23,7 @@ describe('bindModule()', () => {
|
|
|
22
23
|
getValue: () => 1,
|
|
23
24
|
},
|
|
24
25
|
}),
|
|
25
|
-
|
|
26
|
+
exports: {
|
|
26
27
|
queries: QUERIES_TOKEN,
|
|
27
28
|
},
|
|
28
29
|
};
|
|
@@ -154,6 +155,77 @@ describe('bindModule()', () => {
|
|
|
154
155
|
container.removeAll();
|
|
155
156
|
expect(destroy).toBeCalledTimes(1);
|
|
156
157
|
});
|
|
158
|
+
|
|
159
|
+
it('should bind modules and binding entries from "imports" to the container', () => {
|
|
160
|
+
type TestModule = Module<{value: number}>;
|
|
161
|
+
|
|
162
|
+
const MODULE1_TOKEN = token<TestModule>();
|
|
163
|
+
const MODULE1: ModuleDeclaration<TestModule> = {
|
|
164
|
+
token: MODULE1_TOKEN,
|
|
165
|
+
factory: () => ({value: 1}),
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const MODULE2_TOKEN = token<TestModule>();
|
|
169
|
+
const MODULE2: ModuleDeclaration<TestModule> = {
|
|
170
|
+
token: MODULE2_TOKEN,
|
|
171
|
+
factory: () => ({value: 2}),
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const MODULE2_ALTERED: ModuleDeclaration<TestModule> = {
|
|
175
|
+
token: MODULE2_TOKEN,
|
|
176
|
+
factory: () => ({value: 22}),
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const parent = createContainer();
|
|
180
|
+
bindModule(parent, MODULE2);
|
|
181
|
+
|
|
182
|
+
const container = createContainer(parent);
|
|
183
|
+
bindModule(
|
|
184
|
+
container,
|
|
185
|
+
declareModule({
|
|
186
|
+
factory: () => ({}),
|
|
187
|
+
imports: [
|
|
188
|
+
MODULE1,
|
|
189
|
+
{module: MODULE2_ALTERED, options: {scope: 'scoped'}},
|
|
190
|
+
],
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
expect(parent.get(MODULE1_TOKEN)).toBeUndefined();
|
|
195
|
+
expect(parent.get(MODULE2_TOKEN)?.value).toBe(2);
|
|
196
|
+
|
|
197
|
+
expect(container.get(MODULE1_TOKEN)?.value).toBe(1);
|
|
198
|
+
expect(container.get(MODULE2_TOKEN)?.value).toBe(22);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should call beforeBinding() before importing modules from "imports"', () => {
|
|
202
|
+
const ARG_TOKEN = token<string>('arg');
|
|
203
|
+
const RESULT_TOKEN = token<string>('result');
|
|
204
|
+
|
|
205
|
+
type TestModule = Module<{value: string}>;
|
|
206
|
+
|
|
207
|
+
const MODULE1: ModuleDeclaration<TestModule> = declareModule({
|
|
208
|
+
beforeBinding: (container) =>
|
|
209
|
+
container.bindValue(ARG_TOKEN, container.resolve(ARG_TOKEN) + '2'),
|
|
210
|
+
factory: injectable((arg) => ({value: arg + '3'}), ARG_TOKEN),
|
|
211
|
+
exports: {value: RESULT_TOKEN},
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const container = createContainer();
|
|
215
|
+
bindModule(
|
|
216
|
+
container,
|
|
217
|
+
declareModule({
|
|
218
|
+
factory: () => ({}),
|
|
219
|
+
beforeBinding: (container) => {
|
|
220
|
+
container.bindValue(ARG_TOKEN, '1');
|
|
221
|
+
},
|
|
222
|
+
imports: [MODULE1],
|
|
223
|
+
}),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
expect(container.resolve(ARG_TOKEN)).toBe('12');
|
|
227
|
+
expect(container.resolve(RESULT_TOKEN)).toBe('123');
|
|
228
|
+
});
|
|
157
229
|
});
|
|
158
230
|
|
|
159
231
|
describe('bindModules()', () => {
|
|
@@ -204,7 +276,7 @@ describe('declareModule()', () => {
|
|
|
204
276
|
const MODULE = declareModule({
|
|
205
277
|
token: MODULE_TOKEN,
|
|
206
278
|
factory: () => ({value: 1}),
|
|
207
|
-
|
|
279
|
+
exports: {value: VALUE_TOKEN},
|
|
208
280
|
});
|
|
209
281
|
|
|
210
282
|
bindModule(container, MODULE);
|
|
@@ -218,7 +290,7 @@ describe('declareModule()', () => {
|
|
|
218
290
|
const VALUE_TOKEN = token<number>();
|
|
219
291
|
const MODULE = declareModule({
|
|
220
292
|
factory: () => ({value: 1}),
|
|
221
|
-
|
|
293
|
+
exports: {value: VALUE_TOKEN},
|
|
222
294
|
});
|
|
223
295
|
|
|
224
296
|
bindModule(container, MODULE);
|
|
@@ -233,13 +305,13 @@ describe('declareModuleBindings()', () => {
|
|
|
233
305
|
const VALUE1_TOKEN = token<number>();
|
|
234
306
|
const MODULE1 = declareModule({
|
|
235
307
|
factory: () => ({value: 1}),
|
|
236
|
-
|
|
308
|
+
exports: {value: VALUE1_TOKEN},
|
|
237
309
|
});
|
|
238
310
|
|
|
239
311
|
const VALUE2_TOKEN = token<number>();
|
|
240
312
|
const MODULE2 = declareModule({
|
|
241
313
|
factory: () => ({value: 2}),
|
|
242
|
-
|
|
314
|
+
exports: {value: VALUE2_TOKEN},
|
|
243
315
|
});
|
|
244
316
|
|
|
245
317
|
const MODULE_BINDINGS = declareModuleBindings([MODULE1, MODULE2]);
|
|
@@ -247,5 +319,7 @@ describe('declareModuleBindings()', () => {
|
|
|
247
319
|
bindModule(container, MODULE_BINDINGS);
|
|
248
320
|
expect(container.get(VALUE1_TOKEN)).toBe(1);
|
|
249
321
|
expect(container.get(VALUE2_TOKEN)).toBe(2);
|
|
322
|
+
|
|
323
|
+
expect(container.get(MODULE_BINDINGS.token)).toEqual({});
|
|
250
324
|
});
|
|
251
325
|
});
|
package/src/modules.ts
CHANGED
|
@@ -38,7 +38,7 @@ type GetModuleProps<T> = T extends Module<infer Props> ? Props : never;
|
|
|
38
38
|
* destroy: () => transport.close(),
|
|
39
39
|
* }
|
|
40
40
|
* },
|
|
41
|
-
*
|
|
41
|
+
* exports: {
|
|
42
42
|
* logger: LOGGER_TOKEN,
|
|
43
43
|
* },
|
|
44
44
|
* };
|
|
@@ -48,14 +48,24 @@ export type ModuleDeclaration<T extends Module<AnyObject>> = {
|
|
|
48
48
|
/** Token for the module */
|
|
49
49
|
token: Token<T>;
|
|
50
50
|
|
|
51
|
+
/** Modules for binding */
|
|
52
|
+
imports?: ReadonlyArray<ModuleBindingEntry>;
|
|
53
|
+
|
|
51
54
|
/** Factory of the module */
|
|
52
55
|
factory: (container: Container) => T;
|
|
53
56
|
|
|
54
57
|
/** Dictionary of module properties which are bound to tokens. */
|
|
55
|
-
|
|
58
|
+
exports?: {
|
|
56
59
|
[K in keyof GetModuleProps<T>]?: Token<GetModuleProps<T>[K]>;
|
|
57
60
|
};
|
|
58
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Dictionary of module properties which are bound to tokens.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated Use `exports` property.
|
|
66
|
+
*/
|
|
67
|
+
exportedProps?: ModuleDeclaration<T>['exports'];
|
|
68
|
+
|
|
59
69
|
/** Callback could be used to prepare an environment. It is called before binding the module. */
|
|
60
70
|
beforeBinding?: (container: Container) => void;
|
|
61
71
|
|
|
@@ -74,6 +84,13 @@ export type BindModuleOptions = {
|
|
|
74
84
|
scope?: 'scoped' | 'singleton';
|
|
75
85
|
};
|
|
76
86
|
|
|
87
|
+
export type ModuleBindingEntry =
|
|
88
|
+
| ModuleDeclaration<AnyObject>
|
|
89
|
+
| {
|
|
90
|
+
module: ModuleDeclaration<AnyObject>;
|
|
91
|
+
options: BindModuleOptions;
|
|
92
|
+
};
|
|
93
|
+
|
|
77
94
|
/**
|
|
78
95
|
* Binds the dependency module to the container
|
|
79
96
|
* @param container - Dependency container.
|
|
@@ -90,21 +107,27 @@ export function bindModule<T extends Module<AnyObject>>(
|
|
|
90
107
|
moduleDeclaration: ModuleDeclaration<T>,
|
|
91
108
|
options?: BindModuleOptions,
|
|
92
109
|
): void {
|
|
93
|
-
const {token,
|
|
110
|
+
const {token, imports, factory, beforeBinding, afterBinding} =
|
|
94
111
|
moduleDeclaration;
|
|
112
|
+
const exports = moduleDeclaration.exports ?? moduleDeclaration.exportedProps;
|
|
113
|
+
|
|
95
114
|
const scope = options?.scope;
|
|
96
115
|
|
|
97
116
|
if (beforeBinding) {
|
|
98
117
|
beforeBinding(container);
|
|
99
118
|
}
|
|
100
119
|
|
|
120
|
+
if (imports) {
|
|
121
|
+
bindModules(container, imports);
|
|
122
|
+
}
|
|
123
|
+
|
|
101
124
|
const exportedValueTokens = new Set<Token<unknown>>();
|
|
102
125
|
|
|
103
|
-
if (
|
|
104
|
-
const keys = Object.keys(
|
|
126
|
+
if (exports) {
|
|
127
|
+
const keys = Object.keys(exports);
|
|
105
128
|
|
|
106
129
|
keys.forEach((valueKey) => {
|
|
107
|
-
const valueToken =
|
|
130
|
+
const valueToken = exports[valueKey];
|
|
108
131
|
if (valueToken) {
|
|
109
132
|
exportedValueTokens.add(valueToken);
|
|
110
133
|
|
|
@@ -134,13 +157,6 @@ export function bindModule<T extends Module<AnyObject>>(
|
|
|
134
157
|
}
|
|
135
158
|
}
|
|
136
159
|
|
|
137
|
-
export type ModuleBindingEntry =
|
|
138
|
-
| ModuleDeclaration<AnyObject>
|
|
139
|
-
| {
|
|
140
|
-
module: ModuleDeclaration<AnyObject>;
|
|
141
|
-
options: BindModuleOptions;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
160
|
/**
|
|
145
161
|
* Binds dependency modules to the container
|
|
146
162
|
*
|
|
@@ -149,7 +165,7 @@ export type ModuleBindingEntry =
|
|
|
149
165
|
*/
|
|
150
166
|
export function bindModules(
|
|
151
167
|
container: Container,
|
|
152
|
-
modules:
|
|
168
|
+
modules: ReadonlyArray<ModuleBindingEntry>,
|
|
153
169
|
): void {
|
|
154
170
|
modules.forEach((entry) => {
|
|
155
171
|
if ('module' in entry) {
|
|
@@ -176,7 +192,7 @@ export function bindModules(
|
|
|
176
192
|
* destroy: () => transport.close(),
|
|
177
193
|
* }
|
|
178
194
|
* },
|
|
179
|
-
*
|
|
195
|
+
* exports: {
|
|
180
196
|
* logger: LOGGER_TOKEN,
|
|
181
197
|
* },
|
|
182
198
|
* });
|
|
@@ -195,10 +211,10 @@ export function declareModule<T>(
|
|
|
195
211
|
* @param modules - module declaration entries
|
|
196
212
|
*/
|
|
197
213
|
export function declareModuleBindings(
|
|
198
|
-
modules:
|
|
214
|
+
modules: ReadonlyArray<ModuleBindingEntry>,
|
|
199
215
|
): ModuleDeclaration<Module> {
|
|
200
216
|
return declareModule({
|
|
201
217
|
factory: () => ({}),
|
|
202
|
-
|
|
218
|
+
imports: modules,
|
|
203
219
|
});
|
|
204
220
|
}
|
package/src/utils.ts
CHANGED
|
@@ -13,7 +13,7 @@ type TokenProps<Props extends ValuesProps> = {
|
|
|
13
13
|
*/
|
|
14
14
|
export function bindMultiValue<T>(
|
|
15
15
|
container: Container,
|
|
16
|
-
token: Token<
|
|
16
|
+
token: Token<ReadonlyArray<T>>,
|
|
17
17
|
value: T,
|
|
18
18
|
): void {
|
|
19
19
|
const prevValues = container.get(token) ?? [];
|
|
@@ -29,7 +29,7 @@ export function getValues<
|
|
|
29
29
|
Tokens extends Token<unknown>[],
|
|
30
30
|
Values extends {
|
|
31
31
|
[K in keyof Tokens]: Tokens[K] extends Token<infer V> ? V : never;
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
33
|
>(container: Container, ...tokens: Tokens): Values {
|
|
34
34
|
return tokens.map(container.get) as Values;
|
|
35
35
|
}
|
|
@@ -42,7 +42,7 @@ export function resolveValues<
|
|
|
42
42
|
Tokens extends Token<unknown>[],
|
|
43
43
|
Values extends {
|
|
44
44
|
[K in keyof Tokens]: Tokens[K] extends Token<infer V> ? V : never;
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
46
|
>(container: Container, ...tokens: Tokens): Values {
|
|
47
47
|
return tokens.map(container.resolve) as Values;
|
|
48
48
|
}
|
|
@@ -58,7 +58,7 @@ export function injectable<
|
|
|
58
58
|
Values extends {
|
|
59
59
|
[K in keyof Tokens]: Tokens[K] extends Token<infer V> ? V : never;
|
|
60
60
|
},
|
|
61
|
-
Result
|
|
61
|
+
Result,
|
|
62
62
|
>(
|
|
63
63
|
this: unknown,
|
|
64
64
|
factory: (...params: Values) => Result,
|
package/CHANGELOG.md
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [1.3.0](https://github.com/mnasyrov/ditox/compare/v1.2.0...v1.3.0) (2021-08-04)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* `declareModule()` and `declareModuleBindings()` utility functions ([990ffe7](https://github.com/mnasyrov/ditox/commit/990ffe79af37c6ee56738b6ac7e9c071818d10f7))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [1.2.0](https://github.com/mnasyrov/ditox/compare/v1.1.0...v1.2.0) (2021-06-20)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Bug Fixes
|
|
21
|
-
|
|
22
|
-
* Fixed resolving a singleton registered in the parent. ([224c595](https://github.com/mnasyrov/ditox/commit/224c59585e43c68cc23e6abf521ecad09aeb1c7a))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* `bindModules()` utility function. ([e62d6c3](https://github.com/mnasyrov/ditox/commit/e62d6c3332f991b8e3943ad269bd6e76cb6a266c))
|
|
28
|
-
* Dependency modules ([d01d333](https://github.com/mnasyrov/ditox/commit/d01d33347788c7eeeaee014fa794684ffbd4b2e7))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# [1.1.0](https://github.com/mnasyrov/ditox/compare/v1.0.2...v1.1.0) (2021-04-17)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Bug Fixes
|
|
38
|
-
|
|
39
|
-
* Fixed typings and arity for `getValues()`, `resolveValues()` and `injectable()`. ([92f57dc](https://github.com/mnasyrov/ditox/commit/92f57dcc1777c4c622d61c68196db3d48f3fa186))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Features
|
|
43
|
-
|
|
44
|
-
* `Container.hasToken()` for checking token presence. ([56043ae](https://github.com/mnasyrov/ditox/commit/56043aec494481cc624b30d81e33df33a8273e63))
|
|
45
|
-
* Utilities for resolving object properties by tokens ([d4a41e8](https://github.com/mnasyrov/ditox/commit/d4a41e8d777540905a4bc15fc22bcb06a85cf90a))
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## [1.0.1](https://github.com/mnasyrov/ditox/compare/v1.0.0...v1.0.1) (2021-03-04)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### Bug Fixes
|
|
55
|
-
|
|
56
|
-
* Fixed bundled typings for Typescript ([7b1499e](https://github.com/mnasyrov/ditox/commit/7b1499e7cf1506f24f72387d83a055e6a4d3c336))
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [1.0.0](https://github.com/mnasyrov/ditox/compare/v0.5.4...v1.0.0) (2021-02-28)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package ditox
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## [0.5.4](https://github.com/mnasyrov/ditox/compare/v0.5.3...v0.5.4) (2021-02-28)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package ditox
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## [0.5.3](https://github.com/mnasyrov/ditox/compare/v0.5.2...v0.5.3) (2021-02-25)
|
|
79
|
-
|
|
80
|
-
**Note:** Version bump only for package ditox
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## [0.5.1](https://github.com/mnasyrov/ditox/compare/v0.5.0...v0.5.1) (2021-02-25)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package ditox
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# [0.5.0](https://github.com/mnasyrov/ditox/compare/v0.4.1...v0.5.0) (2021-02-24)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### Features
|
|
98
|
-
|
|
99
|
-
* Introduced @ditox/react - tooling for React apps ([cd9c9db](https://github.com/mnasyrov/ditox/commit/cd9c9db9d65fda468f0e740c49e090757f1ac73a))
|
package/dist/index.browser.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var o=function(n,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,n){o.__proto__=n}||function(o,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(o[t]=n[t])})(n,t)};var n=function(){return(n=Object.assign||function(o){for(var n,t=1,r=arguments.length;t<r;t++)for(var e in n=arguments[t])Object.prototype.hasOwnProperty.call(n,e)&&(o[e]=n[e]);return o}).apply(this,arguments)};function t(o,n,t){if(t||2===arguments.length)for(var r,e=0,i=n.length;e<i;e++)!r&&e in n||(r||(r=Array.prototype.slice.call(n,0,e)),r[e]=n[e]);return o.concat(r||n)}function r(o){return{symbol:Symbol(o)}}function e(o,n){return{symbol:o.symbol,isOptional:!0,optionalValue:n}}var i=function(n){function t(o){var t=this.constructor,r=n.call(this,o)||this;return Object.setPrototypeOf(r,t.prototype),r.name="ResolverError",r}return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=n}o(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,n),t}(Error),u=r("ditox.Container"),c=r("ditox.ParentContainer"),a=r("ditox.Resolver"),l=Symbol(),s=function(){throw new Error("FAKE_FACTORY")},f=r("ditox.FactoriesMap");function v(o){return o.symbol===u.symbol||o.symbol===c.symbol||o.symbol===a.symbol}function y(o){var n=new Map,t=new Map,r={bindValue:function(o,t){v(o)||n.set(o.symbol,t)},bindFactory:function(o,n,r){v(o)||t.set(o.symbol,{factory:n,options:r})},remove:function(o){var r;if(!v(o)){var e=null===(r=t.get(o.symbol))||void 0===r?void 0:r.options;e&&y(o.symbol,e),n.delete(o.symbol),t.delete(o.symbol)}},removeAll:function(){t.forEach((function(o,n){o.options&&y(n,o.options)})),n.clear(),t.clear(),p()},hasToken:function(r){var e;return n.has(r.symbol)||t.has(r.symbol)||null!==(e=null==o?void 0:o.hasToken(r))&&void 0!==e&&e},get:function(o){var n=e(o,r);return n!==l?n:o.isOptional?o.optionalValue:void 0},resolve:function(o){var n,t=e(o,r);if(t!==l)return t;if(o.isOptional)return o.optionalValue;throw new i('Token "'+(null!==(n=o.symbol.description)&&void 0!==n?n:"")+'" is not provided')}};function e(e,i){var u=n.get(e.symbol),c=void 0!==u||n.has(e.symbol);if(c&&i===r)return u;var f,v,y=t.get(e.symbol);if(y&&y.factory!==s)switch(f=y.options,null!==(v=null==f?void 0:f.scope)&&void 0!==v?v:"singleton"){case"singleton":if(c)return u;if(null==o?void 0:o.hasToken(e))break;var p=y.factory(r);return r.bindValue(e,p),p;case"scoped":var d=y.factory(i);return i.bindValue(e,d),i!==r&&i.bindFactory(e,s,y.options),d;case"transient":return y.factory(i)}if(c)return u;var b=null==o?void 0:o.get(a);return b?b(e,i):l}function y(o,t){var r=function(o){return void 0===o.scope||"scoped"===o.scope||"singleton"===o.scope?o.onRemoved:void 0}(t);if(r){var e=n.get(o);(void 0!==e||n.has(o))&&r(e)}}function p(){n.set(u.symbol,r),n.set(a.symbol,e),n.set(f.symbol,t),o&&n.set(c.symbol,o)}return p(),r}function p(o,n,r){var e,i=t(t([],null!==(e=o.get(n))&&void 0!==e?e:[]),[r]);o.bindValue(n,i)}function d(o){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.map(o.get)}function b(o){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.map(o.resolve)}function m(o){for(var n=this,r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return function(e){var i=b.apply(void 0,t([e],r));return o.apply(n,i)}}function h(o,t){var r=n({},t);return Object.keys(r).forEach((function(n){return r[n]=o.get(r[n])})),r}function g(o,t){var r=n({},t);return Object.keys(r).forEach((function(n){return r[n]=o.resolve(r[n])})),r}function O(o,n){return function(t){var r=g(t,n);return o(r)}}function w(o,n,t){var r=n.token,e=n.factory,i=n.exportedProps,u=n.beforeBinding,c=n.afterBinding,a=null==t?void 0:t.scope;u&&u(o);var l=new Set;i&&Object.keys(i).forEach((function(n){var t=i[n];t&&(l.add(t),o.bindFactory(t,m((function(o){return o[n]}),r),{scope:a}))}));o.bindFactory(r,e,{scope:a,onRemoved:function(n){n.destroy&&n.destroy(),l.forEach((function(n){return o.remove(n)})),l.clear()}}),c&&c(o)}function k(o,n){n.forEach((function(n){"module"in n?w(o,n.module,n.options):w(o,n)}))}function E(o){var t;return n(n({},o),{token:null!==(t=o.token)&&void 0!==t?t:r()})}function j(o){return E({factory:function(){return{}},beforeBinding:function(n){return k(n,o)}})}export{i as ResolverError,w as bindModule,k as bindModules,p as bindMultiValue,y as createContainer,E as declareModule,j as declareModuleBindings,h as getProps,d as getValues,m as injectable,O as injectableProps,e as optional,g as resolveProps,b as resolveValues,r as token};
|
|
2
|
-
//# sourceMappingURL=index.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","sources":["../../../node_modules/tslib/tslib.es6.js","../src/ditox.ts","../src/utils.ts","../src/modules.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || from);\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n",null,null,null],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__assign","assign","t","s","i","n","arguments","length","apply","this","__spreadArray","to","from","pack","ar","l","slice","concat","token","description","symbol","Symbol","optional","optionalValue","isOptional","message","_super","_this","_newTarget","name","TypeError","String","__","constructor","create","__extends","Error","CONTAINER","PARENT_CONTAINER","RESOLVER","NOT_FOUND","FAKE_FACTORY","FACTORIES_MAP","isInternalToken","createContainer","parentContainer","values","Map","factories","container","bindValue","value","set","bindFactory","factory","options","remove","get","executeOnRemoved","delete","removeAll","forEach","context","tokenSymbol","clear","bindInternalTokens","hasToken","has","resolver","resolve","ResolverError","origin","hasValue","undefined","factoryContext","scope","value_1","value_2","parentResolver","onRemoved","getOnRemoved","bindMultiValue","nextValues","getValues","_i","tokens","map","resolveValues","injectable","getProps","obj","keys","key","resolveProps","injectableProps","bindModule","moduleDeclaration","exportedProps","beforeBinding","afterBinding","exportedValueTokens","Set","valueKey","valueToken","add","module","destroy","bindModules","modules","entry","declareModule","declaration","declareModuleBindings"],"mappings":"AAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,MAC3EN,EAAGC,IAWrB,IAAIS,EAAW,WAQlB,OAPAA,EAAWR,OAAOS,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIR,KADTO,EAAIG,UAAUF,GACOZ,OAAOK,UAAUC,eAAeC,KAAKI,EAAGP,KAAIM,EAAEN,GAAKO,EAAEP,IAE9E,OAAOM,IAEKM,MAAMC,KAAMH,YA6HzB,SAASI,EAAcC,EAAIC,EAAMC,GACpC,GAAIA,GAA6B,IAArBP,UAAUC,OAAc,IAAK,IAA4BO,EAAxBV,EAAI,EAAGW,EAAIH,EAAKL,OAAYH,EAAIW,EAAGX,KACxEU,GAAQV,KAAKQ,IACRE,IAAIA,EAAKnB,MAAME,UAAUmB,MAAMjB,KAAKa,EAAM,EAAGR,IAClDU,EAAGV,GAAKQ,EAAKR,IAGrB,OAAOO,EAAGM,OAAOH,GAAMF,YC7IXM,EAASC,GACvB,MAAO,CAACC,OAAQC,OAAOF,aAcTG,EACdJ,EACAK,GAEA,MAAO,CACLH,OAAQF,EAAME,OACdI,YAAY,EACZD,mCAQF,WAAYE,4BACVC,YAAMD,gBACNjC,OAAOC,eAAekC,EAAMC,EAAW/B,WACvC8B,EAAKE,KAAO,kBAEhB,OD1CO,SAAmBvC,EAAGC,GACzB,GAAi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