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.
Files changed (48) hide show
  1. package/dist/index.d.ts +4 -0
  2. package/dist/index13.js +1 -1
  3. package/dist/index13.mjs +1 -1
  4. package/dist/index18.js +1 -1
  5. package/dist/index18.mjs +1 -1
  6. package/dist/index19.js +1 -1
  7. package/dist/index19.mjs +1 -1
  8. package/dist/index20.js +1 -1
  9. package/dist/index20.mjs +1 -1
  10. package/dist/index21.js +1 -1
  11. package/dist/index21.mjs +1 -1
  12. package/dist/index22.js +11 -5
  13. package/dist/index22.mjs +11 -5
  14. package/dist/index23.js +13 -7
  15. package/dist/index23.mjs +13 -7
  16. package/dist/index24.js +1 -1
  17. package/dist/index24.mjs +1 -1
  18. package/dist/index31.js +35 -100
  19. package/dist/index31.mjs +34 -100
  20. package/dist/index32.js +152 -22
  21. package/dist/index32.mjs +151 -22
  22. package/dist/index33.js +35 -143
  23. package/dist/index33.mjs +35 -142
  24. package/dist/index34.js +70 -41
  25. package/dist/index34.mjs +70 -41
  26. package/dist/index35.js +49 -73
  27. package/dist/index35.mjs +49 -73
  28. package/dist/index36.js +29 -53
  29. package/dist/index36.mjs +29 -53
  30. package/dist/index37.js +170 -26
  31. package/dist/index37.mjs +170 -26
  32. package/dist/index38.js +48 -151
  33. package/dist/index38.mjs +48 -151
  34. package/dist/index39.js +16 -57
  35. package/dist/index39.mjs +16 -57
  36. package/dist/index4.js +7 -7
  37. package/dist/index4.mjs +7 -7
  38. package/dist/index40.js +100 -35
  39. package/dist/index40.mjs +100 -34
  40. package/dist/index41.js +24 -18
  41. package/dist/index41.mjs +24 -18
  42. package/dist/index45.js +54 -22
  43. package/dist/index45.mjs +54 -22
  44. package/dist/index49.js +1 -1
  45. package/dist/index49.mjs +1 -1
  46. package/dist/index50.js +2 -2
  47. package/dist/index50.mjs +2 -2
  48. 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('./index40.js');
11
- const hookManager = require('./index35.js');
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, s) {
20
- return new Injectable(t, e, s);
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 s = t[1];
29
- if (core.isClass(s)) {
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, o){
123
+ constructor(t, e, r){
123
124
  this.privateContext = e;
124
- this.publicContext = o;
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, s] = t;
154
- const i = use.isFactory(s);
167
+ const [e, i] = t;
168
+ const s = use.isFactory(i);
155
169
  if (typeof e === 'string' || typeof e === 'symbol') {
156
- const t = i ? s() : s;
170
+ const t = s ? i() : i;
157
171
  this.privateContext.use(e, t);
158
172
  continue;
159
173
  }
160
- if (this.isSingleton && i) {
161
- const t = s();
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
- const t = transversalManager.TransversalManager.getInstance(this.publicContext);
171
- for (const e of this.transversals){
172
- t.registerTransversal(e, this.privateContext);
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 e of this.injections){
175
- const [s] = e;
176
- if (decorators.isTransversal(s)) {
177
- const i = e.length > 1 ? e : [
178
- s
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
- t.registerTransversal(i, this.privateContext);
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 './index40.mjs';
7
- import { HookManager } from './index35.mjs';
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, s) {
16
- return new Injectable(t, e, s);
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 s = t[1];
25
- if (isClass(s)) {
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, o){
119
+ constructor(t, e, r){
119
120
  this.privateContext = e;
120
- this.publicContext = o;
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, s] = t;
150
- const i = isFactory(s);
163
+ const [e, i] = t;
164
+ const s = isFactory(i);
151
165
  if (typeof e === 'string' || typeof e === 'symbol') {
152
- const t = i ? s() : s;
166
+ const t = s ? i() : i;
153
167
  this.privateContext.use(e, t);
154
168
  continue;
155
169
  }
156
- if (this.isSingleton && i) {
157
- const t = s();
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
- const t = TransversalManager.getInstance(this.publicContext);
167
- for (const e of this.transversals){
168
- t.registerTransversal(e, this.privateContext);
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 e of this.injections){
171
- const [s] = e;
172
- if (isTransversal(s)) {
173
- const i = e.length > 1 ? e : [
174
- s
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
- t.registerTransversal(i, this.privateContext);
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const resolverStore = require('./index41.js');
5
+ const resolverStore = require('./index39.js');
6
6
 
7
7
  class ParameterResolverFactory {
8
8
  static getResolver(r) {
package/dist/index49.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ResolverStore } from './index41.mjs';
1
+ import { ResolverStore } from './index39.mjs';
2
2
 
3
3
  class ParameterResolverFactory {
4
4
  static getResolver(r) {
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('./index31.js');
7
- const helpers = require('./index40.js');
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 './index31.mjs';
3
- import { registerEvents } from './index40.mjs';
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.19",
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",