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