assemblerjs 1.1.1 → 1.1.3
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.d.ts +53 -8
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index18.mjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index19.mjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index20.mjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index21.mjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index22.mjs +1 -1
- package/dist/index23.js +1 -1
- package/dist/index23.mjs +1 -1
- package/dist/index24.js +1 -1
- package/dist/index24.mjs +1 -1
- package/dist/index27.js +1 -1
- package/dist/index27.mjs +1 -1
- package/dist/index30.js +8 -2
- package/dist/index30.mjs +8 -2
- package/dist/index31.js +38 -20
- package/dist/index31.mjs +37 -20
- package/dist/index32.js +17 -58
- package/dist/index32.mjs +17 -58
- package/dist/index33.js +57 -20
- package/dist/index33.mjs +57 -20
- package/dist/index34.js +23 -57
- package/dist/index34.mjs +23 -57
- package/dist/index35.js +75 -27
- package/dist/index35.mjs +75 -27
- package/dist/index36.js +39 -29
- package/dist/index36.mjs +39 -29
- package/dist/index37.js +30 -39
- package/dist/index37.mjs +30 -38
- package/dist/index38.js +125 -97
- package/dist/index38.mjs +125 -97
- package/dist/index39.js +101 -24
- package/dist/index39.mjs +101 -24
- package/dist/index4.js +21 -8
- package/dist/index4.mjs +21 -8
- package/dist/index40.js +28 -48
- package/dist/index40.mjs +28 -48
- package/dist/index41.js +43 -3
- package/dist/index41.mjs +43 -3
- package/dist/index42.js +22 -28
- package/dist/index42.mjs +21 -27
- package/dist/index43.js +26 -169
- package/dist/index43.mjs +25 -169
- package/dist/index44.js +192 -940
- package/dist/index44.mjs +192 -940
- package/dist/index45.js +942 -2
- package/dist/index45.mjs +942 -2
- package/dist/index46.js +2 -2
- package/dist/index46.mjs +2 -2
- package/dist/index47.js +2 -14
- package/dist/index47.mjs +2 -14
- package/dist/index48.js +9 -23
- package/dist/index48.mjs +9 -23
- package/dist/index49.js +32 -55
- package/dist/index49.mjs +32 -54
- package/dist/index50.js +67 -0
- package/dist/index50.mjs +62 -0
- package/package.json +1 -1
package/dist/index43.mjs
CHANGED
|
@@ -1,173 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return [
|
|
20
|
-
e[0]
|
|
21
|
-
];
|
|
22
|
-
} else if (e.length === 2) {
|
|
23
|
-
const s = e[1];
|
|
24
|
-
if (isClass(s)) {
|
|
25
|
-
return [
|
|
26
|
-
e[0],
|
|
27
|
-
e[1]
|
|
28
|
-
];
|
|
29
|
-
} else {
|
|
30
|
-
return [
|
|
31
|
-
e[0],
|
|
32
|
-
e[1]
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
return [
|
|
37
|
-
e[0],
|
|
38
|
-
e[1],
|
|
39
|
-
e[2]
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
dispose() {
|
|
44
|
-
if (this.singletonInstance) {
|
|
45
|
-
unregisterEvents(this, this.singletonInstance);
|
|
46
|
-
HookManager.callHook(this.singletonInstance, 'onDispose', this.publicContext, this.mergedConfiguration || this.configuration);
|
|
47
|
-
clearInstance(this.singletonInstance, this.concrete);
|
|
48
|
-
}
|
|
49
|
-
clearInstance(this, Injectable);
|
|
50
|
-
}
|
|
51
|
-
build(e) {
|
|
52
|
-
return this.builder.build(e);
|
|
53
|
-
}
|
|
54
|
-
setSingletonInstance(e, t) {
|
|
55
|
-
this.singletonInstance = e;
|
|
56
|
-
if (t) {
|
|
57
|
-
this.mergedConfiguration = t;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
get definition() {
|
|
61
|
-
if (!this.cachedDefinition) {
|
|
62
|
-
this.cachedDefinition = getDefinition(this.concrete) || {};
|
|
63
|
-
}
|
|
64
|
-
return this.cachedDefinition;
|
|
65
|
-
}
|
|
66
|
-
get isSingleton() {
|
|
67
|
-
return this.definition.singleton ?? false;
|
|
68
|
-
}
|
|
69
|
-
get dependencies() {
|
|
70
|
-
return this.dependenciesIds;
|
|
1
|
+
class SingletonStrategy {
|
|
2
|
+
resolve(t, e) {
|
|
3
|
+
const n = t.identifier;
|
|
4
|
+
if (this.cache.has(n)) {
|
|
5
|
+
return this.cache.get(n);
|
|
6
|
+
}
|
|
7
|
+
const o = t.build(e);
|
|
8
|
+
const r = e ? {
|
|
9
|
+
...t.configuration,
|
|
10
|
+
...e
|
|
11
|
+
} : t.configuration;
|
|
12
|
+
t.setSingletonInstance(o, r);
|
|
13
|
+
this.cache.set(n, o);
|
|
14
|
+
t.privateContext.prepareInitHook(o, t.configuration);
|
|
15
|
+
return o;
|
|
16
|
+
}
|
|
17
|
+
constructor(){
|
|
18
|
+
this.cache = new Map();
|
|
71
19
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
return this.cachedInjections;
|
|
80
|
-
}
|
|
81
|
-
get objects() {
|
|
82
|
-
if (this.cachedObjects === undefined) {
|
|
83
|
-
this.cachedObjects = this.definition.use || [];
|
|
84
|
-
}
|
|
85
|
-
return this.cachedObjects;
|
|
86
|
-
}
|
|
87
|
-
get transversals() {
|
|
88
|
-
if (this.cachedTransversals === undefined) {
|
|
89
|
-
this.cachedTransversals = this.definition.engage || [];
|
|
90
|
-
}
|
|
91
|
-
return this.cachedTransversals;
|
|
92
|
-
}
|
|
93
|
-
get tags() {
|
|
94
|
-
if (this.cachedTags === undefined) {
|
|
95
|
-
this.cachedTags = this.definition.tags || [];
|
|
96
|
-
}
|
|
97
|
-
return Array.isArray(this.cachedTags) ? this.cachedTags : [
|
|
98
|
-
this.cachedTags
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
get globals() {
|
|
102
|
-
if (this.cachedGlobals === undefined) {
|
|
103
|
-
this.cachedGlobals = this.definition.global;
|
|
104
|
-
}
|
|
105
|
-
return this.cachedGlobals;
|
|
106
|
-
}
|
|
107
|
-
get events() {
|
|
108
|
-
if (this.cachedEvents === undefined) {
|
|
109
|
-
this.cachedEvents = this.definition.events || [];
|
|
110
|
-
}
|
|
111
|
-
return this.cachedEvents;
|
|
112
|
-
}
|
|
113
|
-
constructor(e, t, r){
|
|
114
|
-
this.privateContext = t;
|
|
115
|
-
this.publicContext = r;
|
|
116
|
-
this.dependenciesIds = [];
|
|
117
|
-
this.identifier = e.identifier;
|
|
118
|
-
this.concrete = e.concrete;
|
|
119
|
-
this.configuration = e.configuration;
|
|
120
|
-
if (process.env.NODE_ENV !== 'production' && !isAssemblage(this.concrete)) {
|
|
121
|
-
throw new Error(`Class '${this.concrete.name}' is not an Assemblage.`);
|
|
122
|
-
}
|
|
123
|
-
this.builder = new InjectableBuilder(this);
|
|
124
|
-
defineCustomMetadata(ReflectValue.AssemblageContext, this.publicContext, this.concrete);
|
|
125
|
-
for (const e of this.transversals){
|
|
126
|
-
const t = this.resolveTransversalToInjection(e);
|
|
127
|
-
this.privateContext.register(t);
|
|
128
|
-
}
|
|
129
|
-
for (const e of this.injections){
|
|
130
|
-
const [t] = e;
|
|
131
|
-
if (isTransversal(t)) {
|
|
132
|
-
this.privateContext.register(e);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
for (const e of this.injections){
|
|
136
|
-
const [t] = e;
|
|
137
|
-
if (!isTransversal(t)) {
|
|
138
|
-
this.privateContext.register(e);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
for (const e of this.objects){
|
|
142
|
-
if (typeof e[0] === 'string' || typeof e[0] === 'symbol') {
|
|
143
|
-
this.privateContext.use(e[0], e[1]);
|
|
144
|
-
} else {
|
|
145
|
-
this.privateContext.register(e, true);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const a = TransversalManager.getInstance(this.publicContext);
|
|
149
|
-
for (const e of this.transversals){
|
|
150
|
-
a.registerTransversal(e, this.privateContext);
|
|
151
|
-
}
|
|
152
|
-
for (const e of this.injections){
|
|
153
|
-
const [t] = e;
|
|
154
|
-
if (isTransversal(t)) {
|
|
155
|
-
const s = e.length > 1 ? e : [
|
|
156
|
-
t
|
|
157
|
-
];
|
|
158
|
-
a.registerTransversal(s, this.privateContext);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
this.dependenciesIds = resolveDependencies(this.concrete);
|
|
162
|
-
if (this.globals) {
|
|
163
|
-
for(const e in this.globals){
|
|
164
|
-
this.privateContext.addGlobal(e, this.globals[e]);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (e.instance) {
|
|
168
|
-
this.singletonInstance = e.instance;
|
|
169
|
-
}
|
|
20
|
+
}
|
|
21
|
+
class TransientStrategy {
|
|
22
|
+
resolve(t, e) {
|
|
23
|
+
const n = t.build(e);
|
|
24
|
+
t.privateContext.prepareInitHook(n, t.configuration);
|
|
25
|
+
return n;
|
|
170
26
|
}
|
|
171
27
|
}
|
|
172
28
|
|
|
173
|
-
export {
|
|
29
|
+
export { SingletonStrategy, TransientStrategy };
|