assemblerjs 1.1.21 → 1.1.23

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 (71) hide show
  1. package/dist/index11.js +2 -2
  2. package/dist/index11.mjs +2 -2
  3. package/dist/index13.js +2 -2
  4. package/dist/index13.mjs +2 -2
  5. package/dist/index16.js +1 -1
  6. package/dist/index16.mjs +1 -1
  7. package/dist/index17.js +1 -1
  8. package/dist/index17.mjs +1 -1
  9. package/dist/index18.js +1 -1
  10. package/dist/index18.mjs +1 -1
  11. package/dist/index19.js +1 -1
  12. package/dist/index19.mjs +1 -1
  13. package/dist/index2.js +2 -2
  14. package/dist/index2.mjs +2 -2
  15. package/dist/index20.js +1 -1
  16. package/dist/index20.mjs +1 -1
  17. package/dist/index21.js +1 -1
  18. package/dist/index21.mjs +1 -1
  19. package/dist/index22.js +3 -3
  20. package/dist/index22.mjs +3 -3
  21. package/dist/index23.js +3 -3
  22. package/dist/index23.mjs +3 -3
  23. package/dist/index24.js +2 -2
  24. package/dist/index24.mjs +2 -2
  25. package/dist/index25.js +1 -1
  26. package/dist/index25.mjs +1 -1
  27. package/dist/index26.js +1 -1
  28. package/dist/index26.mjs +1 -1
  29. package/dist/index29.js +158 -17
  30. package/dist/index29.mjs +157 -14
  31. package/dist/index3.js +1 -1
  32. package/dist/index3.mjs +1 -1
  33. package/dist/index30.js +43 -100
  34. package/dist/index30.mjs +43 -98
  35. package/dist/index31.js +71 -32
  36. package/dist/index31.mjs +71 -31
  37. package/dist/index32.js +51 -154
  38. package/dist/index32.mjs +51 -153
  39. package/dist/index33.js +28 -47
  40. package/dist/index33.mjs +28 -47
  41. package/dist/index34.js +161 -65
  42. package/dist/index34.mjs +161 -65
  43. package/dist/index35.js +58 -50
  44. package/dist/index35.mjs +58 -50
  45. package/dist/index36.js +18 -32
  46. package/dist/index36.mjs +15 -32
  47. package/dist/index37.js +16 -169
  48. package/dist/index37.mjs +16 -169
  49. package/dist/index38.js +100 -56
  50. package/dist/index38.mjs +98 -56
  51. package/dist/index39.js +101 -18
  52. package/dist/index39.mjs +101 -18
  53. package/dist/index4.js +7 -7
  54. package/dist/index4.mjs +7 -7
  55. package/dist/index40.js +24 -101
  56. package/dist/index40.mjs +24 -101
  57. package/dist/index41.js +36 -24
  58. package/dist/index41.mjs +35 -24
  59. package/dist/index42.js +29 -49
  60. package/dist/index42.mjs +28 -49
  61. package/dist/index44.js +49 -29
  62. package/dist/index44.mjs +49 -28
  63. package/dist/index45.js +42 -26
  64. package/dist/index45.mjs +42 -26
  65. package/dist/index49.js +1 -1
  66. package/dist/index49.mjs +1 -1
  67. package/dist/index50.js +2 -2
  68. package/dist/index50.mjs +2 -2
  69. package/dist/index51.js +1 -1
  70. package/dist/index51.mjs +1 -1
  71. package/package.json +1 -1
package/dist/index44.mjs CHANGED
@@ -1,29 +1,50 @@
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();
19
- }
20
- }
21
- class TransientStrategy {
22
- resolve(t, e) {
23
- const n = t.build(e);
24
- t.privateContext.prepareInitHook(n, t.configuration);
25
- return n;
26
- }
27
- }
1
+ import { switchCase, pipe, conditionally, isClass, isObject } from '@assemblerjs/core';
28
2
 
29
- export { SingletonStrategy, TransientStrategy };
3
+ const i = (e)=>{
4
+ return {
5
+ identifier: e[0],
6
+ concrete: e[0],
7
+ configuration: {}
8
+ };
9
+ };
10
+ const c = (o)=>{
11
+ const i = ()=>isClass(o[0]) && isClass(o[1]);
12
+ const c = ()=>isClass(o[0]) && isObject(o[1]);
13
+ const s = ()=>pipe(conditionally({
14
+ if: ()=>i(),
15
+ then: ()=>{
16
+ return {
17
+ identifier: o[0],
18
+ concrete: o[1],
19
+ configuration: {}
20
+ };
21
+ }
22
+ }), conditionally({
23
+ if: ()=>c(),
24
+ then: ()=>{
25
+ return {
26
+ identifier: o[0],
27
+ concrete: o[0],
28
+ configuration: o[1]
29
+ };
30
+ },
31
+ else: (e)=>e
32
+ }))();
33
+ return s();
34
+ };
35
+ const s = (e)=>{
36
+ return {
37
+ identifier: e[0],
38
+ concrete: e[1],
39
+ configuration: e[2]
40
+ };
41
+ };
42
+ const resolveInjectionTuple = (e)=>switchCase({
43
+ 1: ()=>i(e),
44
+ 2: ()=>c(e),
45
+ 3: ()=>s(e)
46
+ }, ()=>{
47
+ throw new Error(`Injection tuple must be of length 1, 2 or 3.`);
48
+ })(e.length);
49
+
50
+ export { resolveInjectionTuple };
package/dist/index45.js CHANGED
@@ -4,15 +4,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const core = require('@assemblerjs/core');
6
6
  const constants = require('./index28.js');
7
- const reflection = require('./index29.js');
8
- const debugLogger = require('./index37.js');
7
+ const reflection = require('./index36.js');
8
+ const debugLogger = require('./index34.js');
9
9
  const injectableBuilder = require('./index50.js');
10
10
  const dependencies = require('./index51.js');
11
- const helpers = require('./index31.js');
12
- const hookManager = require('./index34.js');
11
+ const helpers = require('./index41.js');
12
+ const hookManager = require('./index31.js');
13
13
  const helpers$1 = require('./index3.js');
14
14
  const use = require('./index43.js');
15
- const schema = require('./index30.js');
15
+ const schema = require('./index38.js');
16
16
  const decorators = require('./index11.js');
17
17
  const transversalManager = require('./index13.js');
18
18
 
@@ -120,9 +120,9 @@ class Injectable {
120
120
  }
121
121
  return this.cachedEvents;
122
122
  }
123
- constructor(t, e, r){
123
+ constructor(t, e, o){
124
124
  this.privateContext = e;
125
- this.publicContext = r;
125
+ this.publicContext = o;
126
126
  this.dependenciesIds = [];
127
127
  this.identifier = t.identifier;
128
128
  this.concrete = t.concrete;
@@ -135,6 +135,32 @@ class Injectable {
135
135
  if (this.concrete) {
136
136
  const t = debugLogger.DebugLogger.getInstance();
137
137
  reflection.defineCustomMetadata(constants.ReflectValue.AssemblageContext, this.publicContext, this.concrete);
138
+ if (this.globals) {
139
+ const e = Object.keys(this.globals);
140
+ const i = e.map((t)=>{
141
+ const e = this.globals[t];
142
+ return {
143
+ key: t,
144
+ value: e
145
+ };
146
+ });
147
+ if (e.length > 0) {
148
+ t.logPhaseStart('registrationGlobals', {
149
+ target: this.concrete?.name ?? String(this.identifier),
150
+ count: e.length,
151
+ keys: e,
152
+ values: i
153
+ });
154
+ }
155
+ for(const t in this.globals){
156
+ this.privateContext.addGlobal(t, this.globals[t]);
157
+ }
158
+ if (e.length > 0) {
159
+ t.logPhaseEnd('registrationGlobals', undefined, {
160
+ target: this.concrete?.name ?? String(this.identifier)
161
+ });
162
+ }
163
+ }
138
164
  for (const t of this.transversals){
139
165
  const e = this.resolveTransversalToInjection(t);
140
166
  this.privateContext.register(e);
@@ -157,10 +183,18 @@ class Injectable {
157
183
  if (typeof t === 'function') return t.name || t.toString();
158
184
  return String(t);
159
185
  });
186
+ const i = this.objects.map(([t, e])=>{
187
+ const i = typeof t === 'symbol' ? t.toString() : typeof t === 'function' ? t.name || t.toString() : String(t);
188
+ return {
189
+ key: i,
190
+ value: e
191
+ };
192
+ });
160
193
  t.logPhaseStart('registrationUse', {
161
194
  target: this.concrete?.name ?? String(this.identifier),
162
195
  count: this.objects.length,
163
- keys: e
196
+ keys: e,
197
+ values: i
164
198
  });
165
199
  }
166
200
  for (const t of this.objects){
@@ -200,24 +234,6 @@ class Injectable {
200
234
  }
201
235
  }
202
236
  this.dependenciesIds = this.concrete ? dependencies.resolveDependencies(this.concrete) : [];
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
- }
212
- for(const t in this.globals){
213
- this.privateContext.addGlobal(t, this.globals[t]);
214
- }
215
- if (e.length > 0) {
216
- t.logPhaseEnd('registrationGlobals', undefined, {
217
- target: this.concrete?.name ?? String(this.identifier)
218
- });
219
- }
220
- }
221
237
  }
222
238
  if (t.instance) {
223
239
  this.singletonInstance = t.instance;
package/dist/index45.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { isClass, clearInstance } from '@assemblerjs/core';
2
2
  import { ReflectValue } from './index28.mjs';
3
- import { defineCustomMetadata } from './index29.mjs';
4
- import { DebugLogger } from './index37.mjs';
3
+ import { defineCustomMetadata } from './index36.mjs';
4
+ import { DebugLogger } from './index34.mjs';
5
5
  import { InjectableBuilder } from './index50.mjs';
6
6
  import { resolveDependencies } from './index51.mjs';
7
- import { unregisterEvents } from './index31.mjs';
8
- import { HookManager } from './index34.mjs';
7
+ import { unregisterEvents } from './index41.mjs';
8
+ import { HookManager } from './index31.mjs';
9
9
  import { isAssemblage } from './index3.mjs';
10
10
  import { isFactory } from './index43.mjs';
11
- import { getDefinition } from './index30.mjs';
11
+ import { getDefinition } from './index38.mjs';
12
12
  import { isTransversal } from './index11.mjs';
13
13
  import { TransversalManager } from './index13.mjs';
14
14
 
@@ -116,9 +116,9 @@ class Injectable {
116
116
  }
117
117
  return this.cachedEvents;
118
118
  }
119
- constructor(t, e, r){
119
+ constructor(t, e, o){
120
120
  this.privateContext = e;
121
- this.publicContext = r;
121
+ this.publicContext = o;
122
122
  this.dependenciesIds = [];
123
123
  this.identifier = t.identifier;
124
124
  this.concrete = t.concrete;
@@ -131,6 +131,32 @@ class Injectable {
131
131
  if (this.concrete) {
132
132
  const t = DebugLogger.getInstance();
133
133
  defineCustomMetadata(ReflectValue.AssemblageContext, this.publicContext, this.concrete);
134
+ if (this.globals) {
135
+ const e = Object.keys(this.globals);
136
+ const i = e.map((t)=>{
137
+ const e = this.globals[t];
138
+ return {
139
+ key: t,
140
+ value: e
141
+ };
142
+ });
143
+ if (e.length > 0) {
144
+ t.logPhaseStart('registrationGlobals', {
145
+ target: this.concrete?.name ?? String(this.identifier),
146
+ count: e.length,
147
+ keys: e,
148
+ values: i
149
+ });
150
+ }
151
+ for(const t in this.globals){
152
+ this.privateContext.addGlobal(t, this.globals[t]);
153
+ }
154
+ if (e.length > 0) {
155
+ t.logPhaseEnd('registrationGlobals', undefined, {
156
+ target: this.concrete?.name ?? String(this.identifier)
157
+ });
158
+ }
159
+ }
134
160
  for (const t of this.transversals){
135
161
  const e = this.resolveTransversalToInjection(t);
136
162
  this.privateContext.register(e);
@@ -153,10 +179,18 @@ class Injectable {
153
179
  if (typeof t === 'function') return t.name || t.toString();
154
180
  return String(t);
155
181
  });
182
+ const i = this.objects.map(([t, e])=>{
183
+ const i = typeof t === 'symbol' ? t.toString() : typeof t === 'function' ? t.name || t.toString() : String(t);
184
+ return {
185
+ key: i,
186
+ value: e
187
+ };
188
+ });
156
189
  t.logPhaseStart('registrationUse', {
157
190
  target: this.concrete?.name ?? String(this.identifier),
158
191
  count: this.objects.length,
159
- keys: e
192
+ keys: e,
193
+ values: i
160
194
  });
161
195
  }
162
196
  for (const t of this.objects){
@@ -196,24 +230,6 @@ class Injectable {
196
230
  }
197
231
  }
198
232
  this.dependenciesIds = this.concrete ? resolveDependencies(this.concrete) : [];
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
- }
208
- for(const t in this.globals){
209
- this.privateContext.addGlobal(t, this.globals[t]);
210
- }
211
- if (e.length > 0) {
212
- t.logPhaseEnd('registrationGlobals', undefined, {
213
- target: this.concrete?.name ?? String(this.identifier)
214
- });
215
- }
216
- }
217
233
  }
218
234
  if (t.instance) {
219
235
  this.singletonInstance = 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('./index39.js');
5
+ const resolverStore = require('./index37.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 './index39.mjs';
1
+ import { ResolverStore } from './index37.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('./index40.js');
7
- const helpers = require('./index31.js');
6
+ const transversalWeaver = require('./index39.js');
7
+ const helpers = require('./index41.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 './index40.mjs';
3
- import { registerEvents } from './index31.mjs';
2
+ import { TransversalWeaver } from './index39.mjs';
3
+ import { registerEvents } from './index41.mjs';
4
4
 
5
5
  class InjectableBuilder {
6
6
  build(i) {
package/dist/index51.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const reflection = require('./index29.js');
5
+ const reflection = require('./index36.js');
6
6
  const helpers = require('./index25.js');
7
7
  const parameterResolver_factory = require('./index49.js');
8
8
  const decorators = require('./index11.js');
package/dist/index51.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getParamTypes } from './index29.mjs';
1
+ import { getParamTypes } from './index36.mjs';
2
2
  import { getDecoratedParametersIndexes } from './index25.mjs';
3
3
  import { ParameterResolverFactory } from './index49.mjs';
4
4
  import { isTransversal } from './index11.mjs';
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.21",
4
+ "version": "1.1.23",
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",