@adimm/x-injection 0.4.0 → 0.5.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/dist/index.cjs +175 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -85
- package/dist/index.d.ts +117 -85
- package/dist/index.js +166 -132
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -11,34 +11,35 @@ var e, i = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Objec
|
|
|
11
11
|
enumerable: !0
|
|
12
12
|
});
|
|
13
13
|
})(s, {
|
|
14
|
-
AppModule: () =>
|
|
14
|
+
AppModule: () => Y,
|
|
15
15
|
GLOBAL_APP_MODULE_ID: () => d,
|
|
16
|
-
GlobalAppModule: () =>
|
|
16
|
+
GlobalAppModule: () => H,
|
|
17
17
|
GlobalContainer: () => X,
|
|
18
|
-
Inject: () =>
|
|
19
|
-
InjectFromBase: () =>
|
|
18
|
+
Inject: () => E,
|
|
19
|
+
InjectFromBase: () => D,
|
|
20
20
|
Injectable: () => I,
|
|
21
21
|
InjectionScope: () => a,
|
|
22
|
-
MultiInject: () =>
|
|
23
|
-
Named: () =>
|
|
24
|
-
Optional: () =>
|
|
25
|
-
PostConstruct: () =>
|
|
26
|
-
PreDestroy: () =>
|
|
27
|
-
ProviderModule: () =>
|
|
28
|
-
ProviderModuleHelpers: () =>
|
|
29
|
-
ProviderTokenHelpers: () =>
|
|
30
|
-
Tagged: () =>
|
|
22
|
+
MultiInject: () => P,
|
|
23
|
+
Named: () => B,
|
|
24
|
+
Optional: () => j,
|
|
25
|
+
PostConstruct: () => k,
|
|
26
|
+
PreDestroy: () => A,
|
|
27
|
+
ProviderModule: () => z,
|
|
28
|
+
ProviderModuleHelpers: () => l,
|
|
29
|
+
ProviderTokenHelpers: () => p,
|
|
30
|
+
Tagged: () => R,
|
|
31
31
|
Unmanaged: () => q,
|
|
32
|
-
XInjectionDynamicExportsOutOfRange: () =>
|
|
33
|
-
XInjectionError: () =>
|
|
34
|
-
XInjectionProviderModuleDisposedError: () =>
|
|
35
|
-
XInjectionProviderModuleError: () =>
|
|
36
|
-
XInjectionProviderModuleMissingIdentifierError: () =>
|
|
32
|
+
XInjectionDynamicExportsOutOfRange: () => V,
|
|
33
|
+
XInjectionError: () => N,
|
|
34
|
+
XInjectionProviderModuleDisposedError: () => G,
|
|
35
|
+
XInjectionProviderModuleError: () => U,
|
|
36
|
+
XInjectionProviderModuleMissingIdentifierError: () => W,
|
|
37
37
|
bindingScopeToInjectionScope: () => h,
|
|
38
38
|
injectionScopeToBindingScope: () => u,
|
|
39
|
-
isClass: () =>
|
|
40
|
-
isClassOrFunction: () =>
|
|
41
|
-
|
|
39
|
+
isClass: () => v,
|
|
40
|
+
isClassOrFunction: () => g,
|
|
41
|
+
isFunction: () => y,
|
|
42
|
+
isPlainObject: () => m
|
|
42
43
|
}), module.exports = (e = s, ((e, o, s, d) => {
|
|
43
44
|
if (o && "object" == typeof o || "function" == typeof o) for (let c of n(o)) r.call(e, c) || c === s || i(e, c, {
|
|
44
45
|
get: () => o[c],
|
|
@@ -82,44 +83,49 @@ function h(e) {
|
|
|
82
83
|
|
|
83
84
|
o(u, "injectionScopeToBindingScope"), o(h, "bindingScopeToInjectionScope");
|
|
84
85
|
|
|
85
|
-
var l, f
|
|
86
|
+
var p, l, f = require("@inversifyjs/core");
|
|
87
|
+
|
|
88
|
+
function v(e) {
|
|
89
|
+
return "function" == typeof e && Function.prototype.toString.call(e).startsWith("class ");
|
|
90
|
+
}
|
|
86
91
|
|
|
87
92
|
function g(e) {
|
|
88
|
-
return "function" == typeof e
|
|
93
|
+
return "function" == typeof e;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
function
|
|
96
|
+
function y(e) {
|
|
97
|
+
return "function" == typeof e && !Function.prototype.toString.call(e).startsWith("class ");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function S(e) {
|
|
92
101
|
return "[object Object]" === Object.prototype.toString.call(e);
|
|
93
102
|
}
|
|
94
103
|
|
|
95
|
-
function
|
|
96
|
-
if (!1 ===
|
|
104
|
+
function m(e) {
|
|
105
|
+
if (!1 === S(e)) return !1;
|
|
97
106
|
const i = e.constructor;
|
|
98
107
|
if (void 0 === i) return !0;
|
|
99
108
|
const t = i.prototype;
|
|
100
|
-
return !1 !==
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function S(e) {
|
|
104
|
-
return "function" == typeof e;
|
|
109
|
+
return !1 !== S(t) && !1 !== t.hasOwnProperty("isPrototypeOf");
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
function I(e) {
|
|
108
113
|
return void 0 === e ? (0, c.injectable)() : (0, c.injectable)(u(e));
|
|
109
114
|
}
|
|
110
115
|
|
|
111
|
-
o(
|
|
116
|
+
o(v, "isClass"), o(g, "isClassOrFunction"), o(y, "isFunction"), o(S, "isObject"),
|
|
117
|
+
o(m, "isPlainObject"), function(e) {
|
|
112
118
|
function i(e) {
|
|
113
|
-
return
|
|
119
|
+
return S(e) && "useClass" in e;
|
|
114
120
|
}
|
|
115
121
|
function t(e) {
|
|
116
|
-
return
|
|
122
|
+
return S(e) && "useValue" in e;
|
|
117
123
|
}
|
|
118
124
|
function n(e) {
|
|
119
|
-
return
|
|
125
|
+
return S(e) && "useFactory" in e;
|
|
120
126
|
}
|
|
121
127
|
function r(e) {
|
|
122
|
-
return "string" == typeof e || "symbol" == typeof e || g(e)
|
|
128
|
+
return "string" == typeof e || "symbol" == typeof e || g(e);
|
|
123
129
|
}
|
|
124
130
|
function s(e) {
|
|
125
131
|
return r(e) ? e : e.provide;
|
|
@@ -128,32 +134,46 @@ o(g, "isClass"), o(v, "isObject"), o(y, "isPlainObject"), function(e) {
|
|
|
128
134
|
return e.map((e => s(e)));
|
|
129
135
|
}
|
|
130
136
|
function c(e, i) {
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
return v(e) ? {
|
|
138
|
+
...i,
|
|
139
|
+
provide: i?.provide ?? e,
|
|
140
|
+
useClass: i?.useClass ?? e
|
|
141
|
+
} : y(e) ? {
|
|
142
|
+
...i,
|
|
143
|
+
provide: i?.provide ?? e,
|
|
144
|
+
useFactory: i?.useFactory ?? e
|
|
145
|
+
} : {
|
|
146
|
+
...e,
|
|
147
|
+
...i
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function a(e, i) {
|
|
151
|
+
return p(e) ?? l(e) ?? i;
|
|
135
152
|
}
|
|
136
153
|
function u(e) {
|
|
137
|
-
|
|
154
|
+
if (S(e)) return e;
|
|
155
|
+
}
|
|
156
|
+
function p(e) {
|
|
157
|
+
const i = u(e);
|
|
138
158
|
if (i) return i.scope;
|
|
139
159
|
}
|
|
140
160
|
function l(e) {
|
|
141
161
|
const i = s(e);
|
|
142
|
-
if (!
|
|
143
|
-
const t = (0,
|
|
162
|
+
if (!v(i)) return;
|
|
163
|
+
const t = (0, f.getClassMetadata)(i)?.scope;
|
|
144
164
|
return t ? h(t) : void 0;
|
|
145
165
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
166
|
+
function S(e) {
|
|
167
|
+
return m(e) && "object" == typeof e && "provide" in e;
|
|
148
168
|
}
|
|
149
169
|
o(i, "isClassToken"), e.isClassToken = i, o(t, "isValueToken"), e.isValueToken = t,
|
|
150
170
|
o(n, "isFactoryToken"), e.isFactoryToken = n, o(r, "isProviderIdentifier"), e.isProviderIdentifier = r,
|
|
151
171
|
o(s, "toServiceIdentifier"), e.toServiceIdentifier = s, o(d, "toServiceIdentifiers"),
|
|
152
|
-
e.toServiceIdentifiers = d, o(c, "
|
|
153
|
-
o(a, "
|
|
154
|
-
e.
|
|
155
|
-
o(
|
|
156
|
-
}(
|
|
172
|
+
e.toServiceIdentifiers = d, o(c, "toDependencyProviderWithOptions"), e.toDependencyProviderWithOptions = c,
|
|
173
|
+
o(a, "getInjectionScopeByPriority"), e.getInjectionScopeByPriority = a, o(u, "tryGetProviderOptions"),
|
|
174
|
+
e.tryGetProviderOptions = u, o(p, "tryGetScopeFromProvider"), e.tryGetScopeFromProvider = p,
|
|
175
|
+
o(l, "tryGetDecoratorScopeFromClass"), e.tryGetDecoratorScopeFromClass = l, o(S, "hasProvideProperty");
|
|
176
|
+
}(p || (p = {})), function(e) {
|
|
157
177
|
function i(e) {
|
|
158
178
|
return e;
|
|
159
179
|
}
|
|
@@ -162,86 +182,86 @@ o(g, "isClass"), o(v, "isObject"), o(y, "isPlainObject"), function(e) {
|
|
|
162
182
|
}
|
|
163
183
|
o(i, "buildInternalConstructorParams"), e.buildInternalConstructorParams = i, o(t, "isDynamicExport"),
|
|
164
184
|
e.isDynamicExport = t;
|
|
165
|
-
}(
|
|
185
|
+
}(l || (l = {})), o(I, "Injectable");
|
|
166
186
|
|
|
167
|
-
var
|
|
187
|
+
var b = require("inversify");
|
|
168
188
|
|
|
169
|
-
function
|
|
170
|
-
return (0,
|
|
189
|
+
function E(e) {
|
|
190
|
+
return (0, b.inject)(p.toServiceIdentifier(e));
|
|
171
191
|
}
|
|
172
192
|
|
|
173
|
-
o(
|
|
193
|
+
o(E, "Inject");
|
|
174
194
|
|
|
175
|
-
var
|
|
195
|
+
var T = require("inversify");
|
|
176
196
|
|
|
177
|
-
function
|
|
178
|
-
return (0,
|
|
197
|
+
function P(e) {
|
|
198
|
+
return (0, T.multiInject)(p.toServiceIdentifier(e));
|
|
179
199
|
}
|
|
180
200
|
|
|
181
|
-
o(
|
|
201
|
+
o(P, "MultiInject");
|
|
182
202
|
|
|
183
203
|
var _ = require("inversify");
|
|
184
204
|
|
|
185
|
-
function
|
|
205
|
+
function D(e) {
|
|
186
206
|
return (0, _.injectFromBase)(e);
|
|
187
207
|
}
|
|
188
208
|
|
|
189
|
-
o(
|
|
209
|
+
o(D, "InjectFromBase");
|
|
190
210
|
|
|
191
211
|
var w = require("inversify");
|
|
192
212
|
|
|
193
|
-
function
|
|
213
|
+
function B(e) {
|
|
194
214
|
return (0, w.named)(e);
|
|
195
215
|
}
|
|
196
216
|
|
|
197
|
-
o(
|
|
217
|
+
o(B, "Named");
|
|
198
218
|
|
|
199
|
-
var
|
|
219
|
+
var M = require("inversify");
|
|
200
220
|
|
|
201
|
-
function
|
|
202
|
-
return (0,
|
|
221
|
+
function j() {
|
|
222
|
+
return (0, M.optional)();
|
|
203
223
|
}
|
|
204
224
|
|
|
205
|
-
o(
|
|
225
|
+
o(j, "Optional");
|
|
206
226
|
|
|
207
|
-
var
|
|
227
|
+
var C = require("inversify");
|
|
208
228
|
|
|
209
|
-
function
|
|
210
|
-
return (0,
|
|
229
|
+
function k() {
|
|
230
|
+
return (0, C.postConstruct)();
|
|
211
231
|
}
|
|
212
232
|
|
|
213
|
-
o(
|
|
233
|
+
o(k, "PostConstruct");
|
|
214
234
|
|
|
215
|
-
var
|
|
235
|
+
var x = require("inversify");
|
|
216
236
|
|
|
217
|
-
function
|
|
218
|
-
return (0,
|
|
237
|
+
function A() {
|
|
238
|
+
return (0, x.preDestroy)();
|
|
219
239
|
}
|
|
220
240
|
|
|
221
|
-
o(
|
|
241
|
+
o(A, "PreDestroy");
|
|
222
242
|
|
|
223
|
-
var
|
|
243
|
+
var O = require("inversify");
|
|
224
244
|
|
|
225
|
-
function
|
|
226
|
-
return (0,
|
|
245
|
+
function R(e, i) {
|
|
246
|
+
return (0, O.tagged)(e, i);
|
|
227
247
|
}
|
|
228
248
|
|
|
229
|
-
o(
|
|
249
|
+
o(R, "Tagged");
|
|
230
250
|
|
|
231
|
-
var
|
|
251
|
+
var F = require("inversify");
|
|
232
252
|
|
|
233
253
|
function q() {
|
|
234
|
-
return (0,
|
|
254
|
+
return (0, F.unmanaged)();
|
|
235
255
|
}
|
|
236
256
|
|
|
237
257
|
o(q, "Unmanaged");
|
|
238
258
|
|
|
239
|
-
var
|
|
259
|
+
var N = class e extends Error {
|
|
240
260
|
static {
|
|
241
261
|
o(this, "XInjectionError");
|
|
242
262
|
}
|
|
243
263
|
name=e.name;
|
|
244
|
-
},
|
|
264
|
+
}, U = class e extends Error {
|
|
245
265
|
static {
|
|
246
266
|
o(this, "XInjectionProviderModuleError");
|
|
247
267
|
}
|
|
@@ -249,7 +269,7 @@ var F = class e extends Error {
|
|
|
249
269
|
constructor(e, i) {
|
|
250
270
|
super(`{ProviderModule.${e.toString()}} => ${i}`);
|
|
251
271
|
}
|
|
252
|
-
},
|
|
272
|
+
}, G = class e extends U {
|
|
253
273
|
static {
|
|
254
274
|
o(this, "XInjectionProviderModuleDisposedError");
|
|
255
275
|
}
|
|
@@ -257,7 +277,7 @@ var F = class e extends Error {
|
|
|
257
277
|
constructor(e) {
|
|
258
278
|
super(e, "Has been disposed! You can re-initialize it by using the `_lazyInit` method.");
|
|
259
279
|
}
|
|
260
|
-
},
|
|
280
|
+
}, V = class e extends U {
|
|
261
281
|
static {
|
|
262
282
|
o(this, "XInjectionDynamicExportsOutOfRange");
|
|
263
283
|
}
|
|
@@ -265,7 +285,7 @@ var F = class e extends Error {
|
|
|
265
285
|
constructor(e) {
|
|
266
286
|
super(e, `The 'ProviderModule.${e.toString()}' is trying to dynamically export providers/modules out of the declared range of the static exports!`);
|
|
267
287
|
}
|
|
268
|
-
},
|
|
288
|
+
}, W = class e extends U {
|
|
269
289
|
static {
|
|
270
290
|
o(this, "XInjectionProviderModuleMissingIdentifierError");
|
|
271
291
|
}
|
|
@@ -275,7 +295,7 @@ var F = class e extends Error {
|
|
|
275
295
|
}
|
|
276
296
|
}, X = new (require("inversify").Container)({
|
|
277
297
|
defaultScope: "Singleton"
|
|
278
|
-
}), L = require("inversify"),
|
|
298
|
+
}), L = require("inversify"), $ = class {
|
|
279
299
|
static {
|
|
280
300
|
o(this, "ProviderModuleUtils");
|
|
281
301
|
}
|
|
@@ -288,30 +308,27 @@ var F = class e extends Error {
|
|
|
288
308
|
this.module = e, this.moduleNaked = e.toNaked();
|
|
289
309
|
}
|
|
290
310
|
bindToContainer(e, i) {
|
|
291
|
-
return
|
|
292
|
-
}
|
|
293
|
-
bindManyToContainer(e, i) {
|
|
294
|
-
e.forEach((e => this.bindToContainer(e, i)));
|
|
311
|
+
return p.isProviderIdentifier(e) ? this.bindSelfTokenToContainer(e, i) : p.isClassToken(e) ? this.bindClassTokenToContainer(e, i) : p.isValueToken(e) ? this.bindValueTokenToContainer(e) : !!p.isFactoryToken(e) && this.bindFactoryTokenToContainer(e, i);
|
|
295
312
|
}
|
|
296
313
|
bindSelfTokenToContainer(e, i) {
|
|
297
|
-
return this.setBindingScope(e, this.container.bind(
|
|
314
|
+
return this.setBindingScope(e, this.container.bind(p.toServiceIdentifier(e)).toSelf(), i),
|
|
298
315
|
this.moduleNaked.__isCurrentBound(e);
|
|
299
316
|
}
|
|
300
317
|
bindClassTokenToContainer(e, i) {
|
|
301
|
-
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(
|
|
318
|
+
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(p.toServiceIdentifier(e)).to(e.useClass), i))),
|
|
302
319
|
this.moduleNaked.__isCurrentBound(e);
|
|
303
320
|
}
|
|
304
321
|
bindValueTokenToContainer(e) {
|
|
305
|
-
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.container.bind(
|
|
322
|
+
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.container.bind(p.toServiceIdentifier(e)).toConstantValue(e.useValue))),
|
|
306
323
|
this.moduleNaked.__isCurrentBound(e);
|
|
307
324
|
}
|
|
308
325
|
bindFactoryTokenToContainer(e, i) {
|
|
309
|
-
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(
|
|
326
|
+
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(p.toServiceIdentifier(e)).toResolvedValue(e.useFactory, p.toServiceIdentifiers(e.inject ?? [])), i))),
|
|
310
327
|
this.moduleNaked.__isCurrentBound(e);
|
|
311
328
|
}
|
|
312
329
|
setBindingScope(e, i, t) {
|
|
313
|
-
if (
|
|
314
|
-
switch (
|
|
330
|
+
if (p.isValueToken(e)) return i;
|
|
331
|
+
switch (p.getInjectionScopeByPriority(e, t)) {
|
|
315
332
|
case a.Singleton:
|
|
316
333
|
return i.inSingletonScope();
|
|
317
334
|
|
|
@@ -323,16 +340,16 @@ var F = class e extends Error {
|
|
|
323
340
|
}
|
|
324
341
|
}
|
|
325
342
|
setWhenBinding(e, i) {
|
|
326
|
-
if (
|
|
343
|
+
if (p.isProviderIdentifier(e)) return i;
|
|
327
344
|
const t = e.when;
|
|
328
345
|
return t ? i.when(t) : i;
|
|
329
346
|
}
|
|
330
347
|
setBindingOnEvent(e, i) {
|
|
331
|
-
if (
|
|
348
|
+
if (p.isProviderIdentifier(e)) return;
|
|
332
349
|
const t = e;
|
|
333
350
|
t.onEvent?.activation && i.onActivation(t.onEvent.activation), t.onEvent?.deactivation && i.onDeactivation(t.onEvent.deactivation);
|
|
334
351
|
}
|
|
335
|
-
},
|
|
352
|
+
}, z = class e {
|
|
336
353
|
static {
|
|
337
354
|
o(this, "ProviderModule");
|
|
338
355
|
}
|
|
@@ -344,14 +361,16 @@ var F = class e extends Error {
|
|
|
344
361
|
dynamicExports;
|
|
345
362
|
onReady;
|
|
346
363
|
onDispose;
|
|
364
|
+
importedProvidersMap;
|
|
347
365
|
moduleUtils;
|
|
366
|
+
imports;
|
|
348
367
|
providers;
|
|
368
|
+
importedProviders;
|
|
349
369
|
exports;
|
|
350
|
-
imports;
|
|
351
370
|
registeredBindingSideEffects;
|
|
352
371
|
constructor({identifier: e, imports: i, providers: t, exports: n, defaultScope: r, dynamicExports: o, onReady: s, onDispose: d, ...c}) {
|
|
353
372
|
const a = c;
|
|
354
|
-
this.identifier = this.setIdentifier(e), this.isAppModule = a.isAppModule ?? !1,
|
|
373
|
+
this.identifier = this.setIdentifier(e), this.isDisposed = a.isDisposed ?? !1, this.isAppModule = a.isAppModule ?? !1,
|
|
355
374
|
this.isAppModule || this._lazyInit({
|
|
356
375
|
imports: i,
|
|
357
376
|
providers: t,
|
|
@@ -370,24 +389,40 @@ var F = class e extends Error {
|
|
|
370
389
|
}
|
|
371
390
|
getMany(...e) {
|
|
372
391
|
return e.map((e => {
|
|
373
|
-
const i =
|
|
392
|
+
const i = m(e) && "provider" in e;
|
|
374
393
|
return this.get(i ? e.provider : e, !!i && e.isOptional);
|
|
375
394
|
}));
|
|
376
395
|
}
|
|
377
396
|
onActivationEvent(e, i) {
|
|
378
|
-
this.container.onActivation(
|
|
397
|
+
this.shouldThrowIfDisposed(), this.container.onActivation(p.toServiceIdentifier(e), i);
|
|
379
398
|
}
|
|
380
399
|
onDeactivationEvent(e, i) {
|
|
381
|
-
this.container.onDeactivation(
|
|
400
|
+
this.shouldThrowIfDisposed(), this.container.onDeactivation(p.toServiceIdentifier(e), i);
|
|
382
401
|
}
|
|
383
402
|
toNaked() {
|
|
384
403
|
return this;
|
|
385
404
|
}
|
|
405
|
+
clone(i) {
|
|
406
|
+
let t = [ ...this.providers ];
|
|
407
|
+
return i?.providersMap && (t = t.map((e => i.providersMap(e, this, !1)))), new e(l.buildInternalConstructorParams({
|
|
408
|
+
isAppModule: this.isAppModule,
|
|
409
|
+
identifier: this.identifier,
|
|
410
|
+
isDisposed: this.isDisposed,
|
|
411
|
+
defaultScope: this.defaultScope.native,
|
|
412
|
+
dynamicExports: this.dynamicExports,
|
|
413
|
+
onReady: this.onReady,
|
|
414
|
+
onDispose: this.onDispose,
|
|
415
|
+
importedProvidersMap: i?.importedProvidersMap,
|
|
416
|
+
imports: [ ...this.imports ],
|
|
417
|
+
providers: t,
|
|
418
|
+
exports: [ ...this.exports ]
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
386
421
|
toString() {
|
|
387
422
|
return this.identifier?.description ?? "Unknown";
|
|
388
423
|
}
|
|
389
424
|
setIdentifier(e) {
|
|
390
|
-
if (!e) throw new
|
|
425
|
+
if (!e) throw new W(this);
|
|
391
426
|
return e;
|
|
392
427
|
}
|
|
393
428
|
prepareContainer(e) {
|
|
@@ -399,7 +434,7 @@ var F = class e extends Error {
|
|
|
399
434
|
}
|
|
400
435
|
injectImportedModules(i) {
|
|
401
436
|
i && 0 !== i.length && i.forEach((i => {
|
|
402
|
-
if ("GlobalAppModule" === i.toString()) throw new
|
|
437
|
+
if ("GlobalAppModule" === i.toString()) throw new U(this, "The 'GlobalAppModule' can't be imported!");
|
|
403
438
|
const t = i._getExportableModulesAndProviders(), n = i.dynamicExports?.(this, t);
|
|
404
439
|
void 0 !== n && this.shouldThrowWhenModuleDynamicExportsDontMatchTheStaticExports(i, t, n),
|
|
405
440
|
(n ?? t).forEach((t => {
|
|
@@ -407,17 +442,18 @@ var F = class e extends Error {
|
|
|
407
442
|
const e = t.toNaked();
|
|
408
443
|
return void this.injectImportedModules([ e ]);
|
|
409
444
|
}
|
|
410
|
-
const n = t
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
445
|
+
const n = t, r = this.importedProvidersMap({
|
|
446
|
+
scope: p.getInjectionScopeByPriority(n, i.defaultScope.native),
|
|
447
|
+
provide: p.toServiceIdentifier(n),
|
|
448
|
+
useFactory: o((() => i.get(n)), "useFactory")
|
|
449
|
+
}, n, i);
|
|
450
|
+
this.importedProviders.set(i, [ ...this.importedProviders.get(i) ?? [], r ]), this.moduleUtils.bindToContainer(r, i.defaultScope.native),
|
|
451
|
+
i._onUnbind(n, (() => this.__unbind(r)));
|
|
416
452
|
}));
|
|
417
453
|
}));
|
|
418
454
|
}
|
|
419
455
|
injectProviders() {
|
|
420
|
-
this.
|
|
456
|
+
this.providers.forEach((e => this.moduleUtils.bindToContainer(e, this.defaultScope.native)));
|
|
421
457
|
}
|
|
422
458
|
registerBindingSideEffect(e, i, t) {
|
|
423
459
|
this.registeredBindingSideEffects.has(e) || this.registeredBindingSideEffects.set(e, {
|
|
@@ -437,28 +473,27 @@ var F = class e extends Error {
|
|
|
437
473
|
this.registeredBindingSideEffects.delete(e)) : this.registeredBindingSideEffects.forEach((({onUnbindEffects: e}) => e.forEach((e => e())))));
|
|
438
474
|
}
|
|
439
475
|
shouldThrowWhenModuleDynamicExportsDontMatchTheStaticExports(e, i, t) {
|
|
440
|
-
if (t.length > i.length || t.some((e => !i.includes(e)))) throw new
|
|
476
|
+
if (t.length > i.length || t.some((e => !i.includes(e)))) throw new V(e);
|
|
441
477
|
}
|
|
442
478
|
shouldThrowIfDisposed() {
|
|
443
|
-
if (null === this.container) throw new
|
|
444
|
-
}
|
|
445
|
-
_importedDependencyFactory(e, i) {
|
|
446
|
-
return i.get(e);
|
|
479
|
+
if (null === this.container) throw new G(this);
|
|
447
480
|
}
|
|
448
481
|
async _dispose() {
|
|
449
482
|
await (this.onDispose?.(this)), await this.__unbindAll(), this.container = null,
|
|
450
|
-
this.imports = null, this.providers = null, this.
|
|
451
|
-
this.registeredBindingSideEffects = null, this.isDisposed = !0;
|
|
483
|
+
this.imports = null, this.providers = null, this.importedProviders = null, this.exports = null,
|
|
484
|
+
this.dynamicExports = null, this.registeredBindingSideEffects = null, this.isDisposed = !0;
|
|
452
485
|
}
|
|
453
486
|
_lazyInit({imports: e = [], providers: i = [], exports: t = [], defaultScope: n = a.Singleton, dynamicExports: r, onReady: o, onDispose: s, ...d}) {
|
|
454
|
-
this.isDisposed = !1, this.imports = e, this.providers = i, this.
|
|
487
|
+
return this.isDisposed = !1, this.imports = e, this.providers = i, this.importedProviders = d.importedProviders ?? new Map,
|
|
488
|
+
this.exports = t, this.defaultScope = {
|
|
455
489
|
native: n,
|
|
456
490
|
inversify: u(n)
|
|
457
|
-
}, this.dynamicExports = r, this.onReady = o, this.onDispose = s, this.
|
|
491
|
+
}, this.dynamicExports = r, this.onReady = o, this.onDispose = s, this.importedProvidersMap = d.importedProvidersMap ?? (e => e),
|
|
492
|
+
this.container = this.prepareContainer({
|
|
458
493
|
...d
|
|
459
|
-
}), this.moduleUtils = new
|
|
494
|
+
}), this.moduleUtils = new $(this), this.registeredBindingSideEffects = new Map,
|
|
460
495
|
this.injectImportedModules(this._getImportedModules()), this.injectProviders(),
|
|
461
|
-
this.onReady?.(this);
|
|
496
|
+
this.onReady?.(this), this;
|
|
462
497
|
}
|
|
463
498
|
_getImportedModules() {
|
|
464
499
|
return this.shouldThrowIfDisposed(), this.imports;
|
|
@@ -483,26 +518,26 @@ var F = class e extends Error {
|
|
|
483
518
|
}
|
|
484
519
|
__bind(e) {
|
|
485
520
|
this.shouldThrowIfDisposed();
|
|
486
|
-
const i = this.container.bind(
|
|
521
|
+
const i = this.container.bind(p.toServiceIdentifier(e));
|
|
487
522
|
return this.invokeRegisteredBindingSideEffects(e, "onBind"), i;
|
|
488
523
|
}
|
|
489
524
|
__get(e, i) {
|
|
490
|
-
return this.shouldThrowIfDisposed(), this.container.get(
|
|
525
|
+
return this.shouldThrowIfDisposed(), this.container.get(p.toServiceIdentifier(e), i);
|
|
491
526
|
}
|
|
492
527
|
async __getAsync(e, i) {
|
|
493
|
-
return this.shouldThrowIfDisposed(), this.container.getAsync(
|
|
528
|
+
return this.shouldThrowIfDisposed(), this.container.getAsync(p.toServiceIdentifier(e), i);
|
|
494
529
|
}
|
|
495
530
|
__getAll(e, i) {
|
|
496
|
-
return this.shouldThrowIfDisposed(), this.container.getAll(
|
|
531
|
+
return this.shouldThrowIfDisposed(), this.container.getAll(p.toServiceIdentifier(e), i);
|
|
497
532
|
}
|
|
498
533
|
async __getAllAsync(e, i) {
|
|
499
|
-
return this.shouldThrowIfDisposed(), this.container.getAllAsync(
|
|
534
|
+
return this.shouldThrowIfDisposed(), this.container.getAllAsync(p.toServiceIdentifier(e), i);
|
|
500
535
|
}
|
|
501
536
|
__isBound(e, i) {
|
|
502
|
-
return this.shouldThrowIfDisposed(), this.container.isBound(
|
|
537
|
+
return this.shouldThrowIfDisposed(), this.container.isBound(p.toServiceIdentifier(e), i);
|
|
503
538
|
}
|
|
504
539
|
__isCurrentBound(e, i) {
|
|
505
|
-
return this.shouldThrowIfDisposed(), this.container.isCurrentBound(
|
|
540
|
+
return this.shouldThrowIfDisposed(), this.container.isCurrentBound(p.toServiceIdentifier(e), i);
|
|
506
541
|
}
|
|
507
542
|
__takeSnapshot() {
|
|
508
543
|
this.shouldThrowIfDisposed(), this.container.snapshot();
|
|
@@ -512,39 +547,39 @@ var F = class e extends Error {
|
|
|
512
547
|
}
|
|
513
548
|
async __rebind(e) {
|
|
514
549
|
this.shouldThrowIfDisposed();
|
|
515
|
-
const i = await this.container.rebind(
|
|
550
|
+
const i = await this.container.rebind(p.toServiceIdentifier(e));
|
|
516
551
|
return this.invokeRegisteredBindingSideEffects(e, "onRebind"), i;
|
|
517
552
|
}
|
|
518
553
|
__rebindSync(e) {
|
|
519
554
|
this.shouldThrowIfDisposed();
|
|
520
|
-
const i = this.container.rebindSync(
|
|
555
|
+
const i = this.container.rebindSync(p.toServiceIdentifier(e));
|
|
521
556
|
return this.invokeRegisteredBindingSideEffects(e, "onRebind"), i;
|
|
522
557
|
}
|
|
523
558
|
async __unbind(e) {
|
|
524
|
-
this.shouldThrowIfDisposed(), await this.container.unbind(
|
|
559
|
+
this.shouldThrowIfDisposed(), await this.container.unbind(p.toServiceIdentifier(e)),
|
|
525
560
|
this.removeRegisteredBindingSideEffects(e);
|
|
526
561
|
}
|
|
527
562
|
__unbindSync(e) {
|
|
528
|
-
this.shouldThrowIfDisposed(), this.container.unbindSync(
|
|
563
|
+
this.shouldThrowIfDisposed(), this.container.unbindSync(p.toServiceIdentifier(e)),
|
|
529
564
|
this.removeRegisteredBindingSideEffects(e);
|
|
530
565
|
}
|
|
531
566
|
async __unbindAll() {
|
|
532
567
|
this.shouldThrowIfDisposed(), await this.container.unbindAll(), this.removeRegisteredBindingSideEffects("all");
|
|
533
568
|
}
|
|
534
|
-
},
|
|
569
|
+
}, H = class extends z {
|
|
535
570
|
static {
|
|
536
571
|
o(this, "GlobalAppModule");
|
|
537
572
|
}
|
|
538
573
|
nakedModule=this;
|
|
539
574
|
isLoaded=!1;
|
|
540
575
|
constructor() {
|
|
541
|
-
super(
|
|
576
|
+
super(l.buildInternalConstructorParams({
|
|
542
577
|
identifier: Symbol(d),
|
|
543
578
|
isAppModule: !0
|
|
544
579
|
}));
|
|
545
580
|
}
|
|
546
581
|
register(e) {
|
|
547
|
-
if (this.isLoaded) throw new
|
|
582
|
+
if (this.isLoaded) throw new N(`The '${this.toString()}' has already been registered!`);
|
|
548
583
|
return this.nakedModule._lazyInit(e), this.isLoaded = !0, this;
|
|
549
584
|
}
|
|
550
585
|
toNaked() {
|
|
@@ -553,4 +588,4 @@ var F = class e extends Error {
|
|
|
553
588
|
async _dispose() {
|
|
554
589
|
this.isLoaded = !1, super._dispose();
|
|
555
590
|
}
|
|
556
|
-
},
|
|
591
|
+
}, Y = new H;//# sourceMappingURL=index.cjs.map
|