assemblerjs 1.1.19 → 1.1.21
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 +4 -0
- 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 +11 -5
- package/dist/index22.mjs +11 -5
- package/dist/index23.js +13 -7
- package/dist/index23.mjs +13 -7
- package/dist/index24.js +1 -1
- package/dist/index24.mjs +1 -1
- package/dist/index31.js +35 -100
- package/dist/index31.mjs +34 -100
- package/dist/index32.js +152 -22
- package/dist/index32.mjs +151 -22
- package/dist/index33.js +35 -143
- package/dist/index33.mjs +35 -142
- package/dist/index34.js +70 -41
- package/dist/index34.mjs +70 -41
- package/dist/index35.js +49 -73
- package/dist/index35.mjs +49 -73
- package/dist/index36.js +29 -53
- package/dist/index36.mjs +29 -53
- package/dist/index37.js +170 -26
- package/dist/index37.mjs +170 -26
- package/dist/index38.js +48 -151
- package/dist/index38.mjs +48 -151
- package/dist/index39.js +16 -57
- package/dist/index39.mjs +16 -57
- package/dist/index4.js +7 -7
- package/dist/index4.mjs +7 -7
- package/dist/index40.js +100 -35
- package/dist/index40.mjs +100 -34
- package/dist/index41.js +24 -18
- package/dist/index41.mjs +24 -18
- package/dist/index45.js +54 -22
- package/dist/index45.mjs +54 -22
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.js +2 -2
- package/dist/index50.mjs +2 -2
- package/package.json +1 -1
package/dist/index45.js
CHANGED
|
@@ -5,10 +5,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const core = require('@assemblerjs/core');
|
|
6
6
|
const constants = require('./index28.js');
|
|
7
7
|
const reflection = require('./index29.js');
|
|
8
|
+
const debugLogger = require('./index37.js');
|
|
8
9
|
const injectableBuilder = require('./index50.js');
|
|
9
10
|
const dependencies = require('./index51.js');
|
|
10
|
-
const helpers = require('./
|
|
11
|
-
const hookManager = require('./
|
|
11
|
+
const helpers = require('./index31.js');
|
|
12
|
+
const hookManager = require('./index34.js');
|
|
12
13
|
const helpers$1 = require('./index3.js');
|
|
13
14
|
const use = require('./index43.js');
|
|
14
15
|
const schema = require('./index30.js');
|
|
@@ -16,8 +17,8 @@ const decorators = require('./index11.js');
|
|
|
16
17
|
const transversalManager = require('./index13.js');
|
|
17
18
|
|
|
18
19
|
class Injectable {
|
|
19
|
-
static of(t, e,
|
|
20
|
-
return new Injectable(t, e,
|
|
20
|
+
static of(t, e, i) {
|
|
21
|
+
return new Injectable(t, e, i);
|
|
21
22
|
}
|
|
22
23
|
resolveTransversalToInjection(t) {
|
|
23
24
|
if (t.length === 1) {
|
|
@@ -25,8 +26,8 @@ class Injectable {
|
|
|
25
26
|
t[0]
|
|
26
27
|
];
|
|
27
28
|
} else if (t.length === 2) {
|
|
28
|
-
const
|
|
29
|
-
if (core.isClass(
|
|
29
|
+
const i = t[1];
|
|
30
|
+
if (core.isClass(i)) {
|
|
30
31
|
return [
|
|
31
32
|
t[0],
|
|
32
33
|
t[1]
|
|
@@ -119,9 +120,9 @@ class Injectable {
|
|
|
119
120
|
}
|
|
120
121
|
return this.cachedEvents;
|
|
121
122
|
}
|
|
122
|
-
constructor(t, e,
|
|
123
|
+
constructor(t, e, r){
|
|
123
124
|
this.privateContext = e;
|
|
124
|
-
this.publicContext =
|
|
125
|
+
this.publicContext = r;
|
|
125
126
|
this.dependenciesIds = [];
|
|
126
127
|
this.identifier = t.identifier;
|
|
127
128
|
this.concrete = t.concrete;
|
|
@@ -132,6 +133,7 @@ class Injectable {
|
|
|
132
133
|
}
|
|
133
134
|
this.builder = new injectableBuilder.InjectableBuilder(this);
|
|
134
135
|
if (this.concrete) {
|
|
136
|
+
const t = debugLogger.DebugLogger.getInstance();
|
|
135
137
|
reflection.defineCustomMetadata(constants.ReflectValue.AssemblageContext, this.publicContext, this.concrete);
|
|
136
138
|
for (const t of this.transversals){
|
|
137
139
|
const e = this.resolveTransversalToInjection(t);
|
|
@@ -149,16 +151,28 @@ class Injectable {
|
|
|
149
151
|
this.privateContext.register(t);
|
|
150
152
|
}
|
|
151
153
|
}
|
|
154
|
+
if (this.objects.length > 0) {
|
|
155
|
+
const e = this.objects.map(([t])=>{
|
|
156
|
+
if (typeof t === 'symbol') return t.toString();
|
|
157
|
+
if (typeof t === 'function') return t.name || t.toString();
|
|
158
|
+
return String(t);
|
|
159
|
+
});
|
|
160
|
+
t.logPhaseStart('registrationUse', {
|
|
161
|
+
target: this.concrete?.name ?? String(this.identifier),
|
|
162
|
+
count: this.objects.length,
|
|
163
|
+
keys: e
|
|
164
|
+
});
|
|
165
|
+
}
|
|
152
166
|
for (const t of this.objects){
|
|
153
|
-
const [e,
|
|
154
|
-
const
|
|
167
|
+
const [e, i] = t;
|
|
168
|
+
const s = use.isFactory(i);
|
|
155
169
|
if (typeof e === 'string' || typeof e === 'symbol') {
|
|
156
|
-
const t =
|
|
170
|
+
const t = s ? i() : i;
|
|
157
171
|
this.privateContext.use(e, t);
|
|
158
172
|
continue;
|
|
159
173
|
}
|
|
160
|
-
if (this.isSingleton &&
|
|
161
|
-
const t =
|
|
174
|
+
if (this.isSingleton && s) {
|
|
175
|
+
const t = i();
|
|
162
176
|
this.privateContext.register([
|
|
163
177
|
e,
|
|
164
178
|
t
|
|
@@ -167,24 +181,42 @@ class Injectable {
|
|
|
167
181
|
this.privateContext.register(t, true);
|
|
168
182
|
}
|
|
169
183
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
if (this.objects.length > 0) {
|
|
185
|
+
t.logPhaseEnd('registrationUse', undefined, {
|
|
186
|
+
target: this.concrete?.name ?? String(this.identifier)
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const e = transversalManager.TransversalManager.getInstance(this.publicContext);
|
|
190
|
+
for (const t of this.transversals){
|
|
191
|
+
e.registerTransversal(t, this.privateContext);
|
|
173
192
|
}
|
|
174
|
-
for (const
|
|
175
|
-
const [
|
|
176
|
-
if (decorators.isTransversal(
|
|
177
|
-
const
|
|
178
|
-
|
|
193
|
+
for (const t of this.injections){
|
|
194
|
+
const [i] = t;
|
|
195
|
+
if (decorators.isTransversal(i)) {
|
|
196
|
+
const s = t.length > 1 ? t : [
|
|
197
|
+
i
|
|
179
198
|
];
|
|
180
|
-
|
|
199
|
+
e.registerTransversal(s, this.privateContext);
|
|
181
200
|
}
|
|
182
201
|
}
|
|
183
202
|
this.dependenciesIds = this.concrete ? dependencies.resolveDependencies(this.concrete) : [];
|
|
184
203
|
if (this.globals) {
|
|
204
|
+
const e = Object.keys(this.globals);
|
|
205
|
+
if (e.length > 0) {
|
|
206
|
+
t.logPhaseStart('registrationGlobals', {
|
|
207
|
+
target: this.concrete?.name ?? String(this.identifier),
|
|
208
|
+
count: e.length,
|
|
209
|
+
keys: e
|
|
210
|
+
});
|
|
211
|
+
}
|
|
185
212
|
for(const t in this.globals){
|
|
186
213
|
this.privateContext.addGlobal(t, this.globals[t]);
|
|
187
214
|
}
|
|
215
|
+
if (e.length > 0) {
|
|
216
|
+
t.logPhaseEnd('registrationGlobals', undefined, {
|
|
217
|
+
target: this.concrete?.name ?? String(this.identifier)
|
|
218
|
+
});
|
|
219
|
+
}
|
|
188
220
|
}
|
|
189
221
|
}
|
|
190
222
|
if (t.instance) {
|
package/dist/index45.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isClass, clearInstance } from '@assemblerjs/core';
|
|
2
2
|
import { ReflectValue } from './index28.mjs';
|
|
3
3
|
import { defineCustomMetadata } from './index29.mjs';
|
|
4
|
+
import { DebugLogger } from './index37.mjs';
|
|
4
5
|
import { InjectableBuilder } from './index50.mjs';
|
|
5
6
|
import { resolveDependencies } from './index51.mjs';
|
|
6
|
-
import { unregisterEvents } from './
|
|
7
|
-
import { HookManager } from './
|
|
7
|
+
import { unregisterEvents } from './index31.mjs';
|
|
8
|
+
import { HookManager } from './index34.mjs';
|
|
8
9
|
import { isAssemblage } from './index3.mjs';
|
|
9
10
|
import { isFactory } from './index43.mjs';
|
|
10
11
|
import { getDefinition } from './index30.mjs';
|
|
@@ -12,8 +13,8 @@ import { isTransversal } from './index11.mjs';
|
|
|
12
13
|
import { TransversalManager } from './index13.mjs';
|
|
13
14
|
|
|
14
15
|
class Injectable {
|
|
15
|
-
static of(t, e,
|
|
16
|
-
return new Injectable(t, e,
|
|
16
|
+
static of(t, e, i) {
|
|
17
|
+
return new Injectable(t, e, i);
|
|
17
18
|
}
|
|
18
19
|
resolveTransversalToInjection(t) {
|
|
19
20
|
if (t.length === 1) {
|
|
@@ -21,8 +22,8 @@ class Injectable {
|
|
|
21
22
|
t[0]
|
|
22
23
|
];
|
|
23
24
|
} else if (t.length === 2) {
|
|
24
|
-
const
|
|
25
|
-
if (isClass(
|
|
25
|
+
const i = t[1];
|
|
26
|
+
if (isClass(i)) {
|
|
26
27
|
return [
|
|
27
28
|
t[0],
|
|
28
29
|
t[1]
|
|
@@ -115,9 +116,9 @@ class Injectable {
|
|
|
115
116
|
}
|
|
116
117
|
return this.cachedEvents;
|
|
117
118
|
}
|
|
118
|
-
constructor(t, e,
|
|
119
|
+
constructor(t, e, r){
|
|
119
120
|
this.privateContext = e;
|
|
120
|
-
this.publicContext =
|
|
121
|
+
this.publicContext = r;
|
|
121
122
|
this.dependenciesIds = [];
|
|
122
123
|
this.identifier = t.identifier;
|
|
123
124
|
this.concrete = t.concrete;
|
|
@@ -128,6 +129,7 @@ class Injectable {
|
|
|
128
129
|
}
|
|
129
130
|
this.builder = new InjectableBuilder(this);
|
|
130
131
|
if (this.concrete) {
|
|
132
|
+
const t = DebugLogger.getInstance();
|
|
131
133
|
defineCustomMetadata(ReflectValue.AssemblageContext, this.publicContext, this.concrete);
|
|
132
134
|
for (const t of this.transversals){
|
|
133
135
|
const e = this.resolveTransversalToInjection(t);
|
|
@@ -145,16 +147,28 @@ class Injectable {
|
|
|
145
147
|
this.privateContext.register(t);
|
|
146
148
|
}
|
|
147
149
|
}
|
|
150
|
+
if (this.objects.length > 0) {
|
|
151
|
+
const e = this.objects.map(([t])=>{
|
|
152
|
+
if (typeof t === 'symbol') return t.toString();
|
|
153
|
+
if (typeof t === 'function') return t.name || t.toString();
|
|
154
|
+
return String(t);
|
|
155
|
+
});
|
|
156
|
+
t.logPhaseStart('registrationUse', {
|
|
157
|
+
target: this.concrete?.name ?? String(this.identifier),
|
|
158
|
+
count: this.objects.length,
|
|
159
|
+
keys: e
|
|
160
|
+
});
|
|
161
|
+
}
|
|
148
162
|
for (const t of this.objects){
|
|
149
|
-
const [e,
|
|
150
|
-
const
|
|
163
|
+
const [e, i] = t;
|
|
164
|
+
const s = isFactory(i);
|
|
151
165
|
if (typeof e === 'string' || typeof e === 'symbol') {
|
|
152
|
-
const t =
|
|
166
|
+
const t = s ? i() : i;
|
|
153
167
|
this.privateContext.use(e, t);
|
|
154
168
|
continue;
|
|
155
169
|
}
|
|
156
|
-
if (this.isSingleton &&
|
|
157
|
-
const t =
|
|
170
|
+
if (this.isSingleton && s) {
|
|
171
|
+
const t = i();
|
|
158
172
|
this.privateContext.register([
|
|
159
173
|
e,
|
|
160
174
|
t
|
|
@@ -163,24 +177,42 @@ class Injectable {
|
|
|
163
177
|
this.privateContext.register(t, true);
|
|
164
178
|
}
|
|
165
179
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
180
|
+
if (this.objects.length > 0) {
|
|
181
|
+
t.logPhaseEnd('registrationUse', undefined, {
|
|
182
|
+
target: this.concrete?.name ?? String(this.identifier)
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const e = TransversalManager.getInstance(this.publicContext);
|
|
186
|
+
for (const t of this.transversals){
|
|
187
|
+
e.registerTransversal(t, this.privateContext);
|
|
169
188
|
}
|
|
170
|
-
for (const
|
|
171
|
-
const [
|
|
172
|
-
if (isTransversal(
|
|
173
|
-
const
|
|
174
|
-
|
|
189
|
+
for (const t of this.injections){
|
|
190
|
+
const [i] = t;
|
|
191
|
+
if (isTransversal(i)) {
|
|
192
|
+
const s = t.length > 1 ? t : [
|
|
193
|
+
i
|
|
175
194
|
];
|
|
176
|
-
|
|
195
|
+
e.registerTransversal(s, this.privateContext);
|
|
177
196
|
}
|
|
178
197
|
}
|
|
179
198
|
this.dependenciesIds = this.concrete ? resolveDependencies(this.concrete) : [];
|
|
180
199
|
if (this.globals) {
|
|
200
|
+
const e = Object.keys(this.globals);
|
|
201
|
+
if (e.length > 0) {
|
|
202
|
+
t.logPhaseStart('registrationGlobals', {
|
|
203
|
+
target: this.concrete?.name ?? String(this.identifier),
|
|
204
|
+
count: e.length,
|
|
205
|
+
keys: e
|
|
206
|
+
});
|
|
207
|
+
}
|
|
181
208
|
for(const t in this.globals){
|
|
182
209
|
this.privateContext.addGlobal(t, this.globals[t]);
|
|
183
210
|
}
|
|
211
|
+
if (e.length > 0) {
|
|
212
|
+
t.logPhaseEnd('registrationGlobals', undefined, {
|
|
213
|
+
target: this.concrete?.name ?? String(this.identifier)
|
|
214
|
+
});
|
|
215
|
+
}
|
|
184
216
|
}
|
|
185
217
|
}
|
|
186
218
|
if (t.instance) {
|
package/dist/index49.js
CHANGED
package/dist/index49.mjs
CHANGED
package/dist/index50.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const dependencies = require('./index51.js');
|
|
6
|
-
const transversalWeaver = require('./
|
|
7
|
-
const helpers = require('./
|
|
6
|
+
const transversalWeaver = require('./index40.js');
|
|
7
|
+
const helpers = require('./index31.js');
|
|
8
8
|
|
|
9
9
|
class InjectableBuilder {
|
|
10
10
|
build(i) {
|
package/dist/index50.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveInjectableParameters } from './index51.mjs';
|
|
2
|
-
import { TransversalWeaver } from './
|
|
3
|
-
import { registerEvents } from './
|
|
2
|
+
import { TransversalWeaver } from './index40.mjs';
|
|
3
|
+
import { registerEvents } from './index31.mjs';
|
|
4
4
|
|
|
5
5
|
class InjectableBuilder {
|
|
6
6
|
build(i) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assemblerjs",
|
|
3
3
|
"description": "A general purpose Dependency Injection library for node and browser.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.21",
|
|
5
5
|
"author": "Benoît LAHOZ <info@benoitlahoz.io>",
|
|
6
6
|
"bugs": "https://github.com/benoitlahoz/assemblerjs/issues",
|
|
7
7
|
"homepage": "https://github.com/benoitlahoz/assemblerjs#README",
|