assemblerjs 1.1.10 → 1.1.12

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 CHANGED
@@ -848,6 +848,7 @@ declare class InjectableManager {
848
848
  tagged(...tags: string[]): unknown[];
849
849
  dispose(): void;
850
850
  get size(): number;
851
+ getRegisteredIdentifiers(): string[];
851
852
  }
852
853
 
853
854
  declare interface InjectableRegistrar {
package/dist/index31.js CHANGED
@@ -60,9 +60,9 @@ class InjectableManager {
60
60
  this.privateContext = e;
61
61
  this.publicContext = t;
62
62
  }
63
- register(i, o = false) {
63
+ register(i, s = false) {
64
64
  const c = debugLogger.DebugLogger.getInstance();
65
- const a = o === true ? use.resolveInstanceInjectionTuple(i) : inject.resolveInjectionTuple(i);
65
+ const a = s === true ? use.resolveInstanceInjectionTuple(i) : inject.resolveInjectionTuple(i);
66
66
  if (this.has(a.identifier)) {
67
67
  const e = `An assemblage is already registered with identifier '${a.identifier.name}'.`;
68
68
  c.log('error', 'Duplicate registration', {
@@ -87,12 +87,12 @@ class InjectableManager {
87
87
  const t = this.resolvingStack.has(e);
88
88
  const r = t ? 'Circular dependency detected' : 'Dependency not registered';
89
89
  const i = a(e);
90
- const o = f(e);
90
+ const s = f(e);
91
91
  const c = t ? `Circular dependency detected: '${i}' is already being resolved.` : `Dependency '${i}' has not been registered (Class/Service not found in current assemblies).`;
92
92
  debugLogger.DebugLogger.getInstance().log('error', r, {
93
93
  identifier: i,
94
94
  caller: n ? a(n) : 'unknown',
95
- type: o,
95
+ type: s,
96
96
  error: c
97
97
  });
98
98
  throw new Error(c);
@@ -132,6 +132,9 @@ class InjectableManager {
132
132
  get size() {
133
133
  return this.injectables.size;
134
134
  }
135
+ getRegisteredIdentifiers() {
136
+ return Array.from(this.injectables.keys()).map((e)=>e?.name || String(e));
137
+ }
135
138
  constructor(){
136
139
  this.injectables = new Map();
137
140
  this.resolvingStack = new Set();
package/dist/index31.mjs CHANGED
@@ -56,9 +56,9 @@ class InjectableManager {
56
56
  this.privateContext = e;
57
57
  this.publicContext = t;
58
58
  }
59
- register(i, o = false) {
59
+ register(i, s = false) {
60
60
  const c = DebugLogger.getInstance();
61
- const a = o === true ? resolveInstanceInjectionTuple(i) : resolveInjectionTuple(i);
61
+ const a = s === true ? resolveInstanceInjectionTuple(i) : resolveInjectionTuple(i);
62
62
  if (this.has(a.identifier)) {
63
63
  const e = `An assemblage is already registered with identifier '${a.identifier.name}'.`;
64
64
  c.log('error', 'Duplicate registration', {
@@ -83,12 +83,12 @@ class InjectableManager {
83
83
  const t = this.resolvingStack.has(e);
84
84
  const r = t ? 'Circular dependency detected' : 'Dependency not registered';
85
85
  const i = a(e);
86
- const o = f(e);
86
+ const s = f(e);
87
87
  const c = t ? `Circular dependency detected: '${i}' is already being resolved.` : `Dependency '${i}' has not been registered (Class/Service not found in current assemblies).`;
88
88
  DebugLogger.getInstance().log('error', r, {
89
89
  identifier: i,
90
90
  caller: n ? a(n) : 'unknown',
91
- type: o,
91
+ type: s,
92
92
  error: c
93
93
  });
94
94
  throw new Error(c);
@@ -128,6 +128,9 @@ class InjectableManager {
128
128
  get size() {
129
129
  return this.injectables.size;
130
130
  }
131
+ getRegisteredIdentifiers() {
132
+ return Array.from(this.injectables.keys()).map((e)=>e?.name || String(e));
133
+ }
131
134
  constructor(){
132
135
  this.injectables = new Map();
133
136
  this.resolvingStack = new Set();
package/dist/index34.js CHANGED
@@ -14,30 +14,33 @@ class AssemblerBuilder {
14
14
  const r = this.assembler.register([
15
15
  t
16
16
  ]);
17
- n.logPhaseEnd('registration');
17
+ const i = this.assembler.injectableManager.getRegisteredIdentifiers();
18
+ n.logPhaseEnd('registration', undefined, {
19
+ registered: i
20
+ });
18
21
  n.logPhaseStart('resolution');
19
- const i = this.assembler.require(r.identifier, a);
22
+ const l = this.assembler.require(r.identifier, a);
20
23
  n.logPhaseEnd('resolution');
21
- const l = this.assembler.hookManager.getCache().find((e)=>e.instance === i);
22
- if (!l) {
24
+ const h = this.assembler.hookManager.getCache().find((e)=>e.instance === l);
25
+ if (!h) {
23
26
  throw new Error('Root instance not found in assemblages cache.');
24
27
  }
25
- const h = this.assembler.hookManager.getCache().indexOf(l);
26
- this.assembler.hookManager.getCache().splice(h, 1);
28
+ const g = this.assembler.hookManager.getCache().indexOf(h);
29
+ this.assembler.hookManager.getCache().splice(g, 1);
27
30
  n.logPhaseStart('hooks:onInit');
28
31
  this.assembler.hookManager.callInitHooks(this.assembler.publicContext);
29
32
  const c = a ? {
30
33
  ...r.configuration,
31
34
  ...a
32
35
  } : r.configuration;
33
- hookManager.HookManager.callHookImmediate(i, 'onInit', this.assembler.publicContext, c);
36
+ hookManager.HookManager.callHookImmediate(l, 'onInit', this.assembler.publicContext, c);
34
37
  n.logPhaseEnd('hooks:onInit');
35
38
  n.logPhaseStart('hooks:onInited');
36
39
  this.assembler.hookManager.callInitedHooks(this.assembler.publicContext);
37
- hookManager.HookManager.callHookImmediate(i, 'onInited', this.assembler.publicContext, c);
40
+ hookManager.HookManager.callHookImmediate(l, 'onInited', this.assembler.publicContext, c);
38
41
  n.logPhaseEnd('hooks:onInited');
39
42
  this.assembler.hookManager.clearCache();
40
- return i;
43
+ return l;
41
44
  }
42
45
  constructor(e){
43
46
  this.assembler = e;
package/dist/index34.mjs CHANGED
@@ -10,30 +10,33 @@ class AssemblerBuilder {
10
10
  const r = this.assembler.register([
11
11
  t
12
12
  ]);
13
- n.logPhaseEnd('registration');
13
+ const i = this.assembler.injectableManager.getRegisteredIdentifiers();
14
+ n.logPhaseEnd('registration', undefined, {
15
+ registered: i
16
+ });
14
17
  n.logPhaseStart('resolution');
15
- const i = this.assembler.require(r.identifier, a);
18
+ const l = this.assembler.require(r.identifier, a);
16
19
  n.logPhaseEnd('resolution');
17
- const l = this.assembler.hookManager.getCache().find((e)=>e.instance === i);
18
- if (!l) {
20
+ const h = this.assembler.hookManager.getCache().find((e)=>e.instance === l);
21
+ if (!h) {
19
22
  throw new Error('Root instance not found in assemblages cache.');
20
23
  }
21
- const h = this.assembler.hookManager.getCache().indexOf(l);
22
- this.assembler.hookManager.getCache().splice(h, 1);
24
+ const g = this.assembler.hookManager.getCache().indexOf(h);
25
+ this.assembler.hookManager.getCache().splice(g, 1);
23
26
  n.logPhaseStart('hooks:onInit');
24
27
  this.assembler.hookManager.callInitHooks(this.assembler.publicContext);
25
28
  const c = a ? {
26
29
  ...r.configuration,
27
30
  ...a
28
31
  } : r.configuration;
29
- HookManager.callHookImmediate(i, 'onInit', this.assembler.publicContext, c);
32
+ HookManager.callHookImmediate(l, 'onInit', this.assembler.publicContext, c);
30
33
  n.logPhaseEnd('hooks:onInit');
31
34
  n.logPhaseStart('hooks:onInited');
32
35
  this.assembler.hookManager.callInitedHooks(this.assembler.publicContext);
33
- HookManager.callHookImmediate(i, 'onInited', this.assembler.publicContext, c);
36
+ HookManager.callHookImmediate(l, 'onInited', this.assembler.publicContext, c);
34
37
  n.logPhaseEnd('hooks:onInited');
35
38
  this.assembler.hookManager.clearCache();
36
- return i;
39
+ return l;
37
40
  }
38
41
  constructor(e){
39
42
  this.assembler = e;
package/dist/index36.js CHANGED
@@ -32,7 +32,7 @@ let NoOpDebugLogger = class NoOpDebugLogger {
32
32
  logRegistration(o) {}
33
33
  logHook(o, e, t) {}
34
34
  logPhaseStart(o, e) {}
35
- logPhaseEnd(o, e) {}
35
+ logPhaseEnd(o, e, t) {}
36
36
  logResolution(o, e, t) {}
37
37
  logConstruction(o) {}
38
38
  };
@@ -87,11 +87,14 @@ let ActiveDebugLogger = class ActiveDebugLogger {
87
87
  logPhaseStart(o, e) {
88
88
  this.log('info', `Phase: ${o} started`, e);
89
89
  }
90
- logPhaseEnd(o, e) {
91
- const t = e !== undefined ? {
90
+ logPhaseEnd(o, e, t) {
91
+ const n = e !== undefined ? {
92
92
  duration: `${e.toFixed(2)}ms`
93
- } : undefined;
94
- this.log('info', `Phase: ${o} ended`, t);
93
+ } : {};
94
+ if (t) {
95
+ Object.assign(n, t);
96
+ }
97
+ this.log('info', `Phase: ${o} ended`, Object.keys(n).length > 0 ? n : undefined);
95
98
  }
96
99
  logResolution(o, e, t) {
97
100
  if (!this.shouldLog('resolution')) return;
@@ -113,8 +116,11 @@ let ActiveDebugLogger = class ActiveDebugLogger {
113
116
  } else {
114
117
  const n = `[Assembler:${o}]`;
115
118
  const i = this.options.useColors !== false ? this.colorize(o, n) : n;
116
- const s = t ? ` ${JSON.stringify(t)}` : '';
117
- console.log(`${i} ${e}${s}`);
119
+ if (t) {
120
+ console.log(`${i} ${e}`, t);
121
+ } else {
122
+ console.log(`${i} ${e}`);
123
+ }
118
124
  }
119
125
  }
120
126
  colorize(o, e) {
package/dist/index36.mjs CHANGED
@@ -28,7 +28,7 @@ let NoOpDebugLogger = class NoOpDebugLogger {
28
28
  logRegistration(o) {}
29
29
  logHook(o, e, t) {}
30
30
  logPhaseStart(o, e) {}
31
- logPhaseEnd(o, e) {}
31
+ logPhaseEnd(o, e, t) {}
32
32
  logResolution(o, e, t) {}
33
33
  logConstruction(o) {}
34
34
  };
@@ -83,11 +83,14 @@ let ActiveDebugLogger = class ActiveDebugLogger {
83
83
  logPhaseStart(o, e) {
84
84
  this.log('info', `Phase: ${o} started`, e);
85
85
  }
86
- logPhaseEnd(o, e) {
87
- const t = e !== undefined ? {
86
+ logPhaseEnd(o, e, t) {
87
+ const n = e !== undefined ? {
88
88
  duration: `${e.toFixed(2)}ms`
89
- } : undefined;
90
- this.log('info', `Phase: ${o} ended`, t);
89
+ } : {};
90
+ if (t) {
91
+ Object.assign(n, t);
92
+ }
93
+ this.log('info', `Phase: ${o} ended`, Object.keys(n).length > 0 ? n : undefined);
91
94
  }
92
95
  logResolution(o, e, t) {
93
96
  if (!this.shouldLog('resolution')) return;
@@ -109,8 +112,11 @@ let ActiveDebugLogger = class ActiveDebugLogger {
109
112
  } else {
110
113
  const n = `[Assembler:${o}]`;
111
114
  const i = this.options.useColors !== false ? this.colorize(o, n) : n;
112
- const s = t ? ` ${JSON.stringify(t)}` : '';
113
- console.log(`${i} ${e}${s}`);
115
+ if (t) {
116
+ console.log(`${i} ${e}`, t);
117
+ } else {
118
+ console.log(`${i} ${e}`);
119
+ }
114
120
  }
115
121
  }
116
122
  colorize(o, e) {
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.10",
4
+ "version": "1.1.12",
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",