assemblerjs 1.1.24 → 1.1.26
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/README.md +1 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +15 -13
- package/dist/index.mjs +14 -13
- package/dist/index11.js +3 -3
- package/dist/index11.mjs +3 -3
- package/dist/index12.js +2 -2
- package/dist/index12.mjs +2 -2
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- package/dist/index14.js +168 -3
- package/dist/index14.mjs +168 -3
- package/dist/index15.js +4 -22
- package/dist/index15.mjs +4 -22
- package/dist/index16.js +20 -9
- package/dist/index16.mjs +20 -9
- package/dist/index17.js +9 -87
- package/dist/index17.mjs +9 -87
- package/dist/index18.js +88 -16
- package/dist/index18.mjs +88 -16
- package/dist/index19.js +10 -10
- package/dist/index19.mjs +10 -10
- package/dist/index2.js +3 -3
- package/dist/index2.mjs +3 -3
- package/dist/index20.js +10 -10
- package/dist/index20.mjs +10 -10
- package/dist/index21.js +10 -10
- package/dist/index21.mjs +10 -10
- package/dist/index22.js +11 -26
- package/dist/index22.mjs +11 -25
- package/dist/index23.js +22 -22
- package/dist/index23.mjs +21 -21
- package/dist/index24.js +25 -19
- package/dist/index24.mjs +24 -19
- package/dist/index25.js +23 -25
- package/dist/index25.mjs +23 -21
- package/dist/index26.js +26 -46
- package/dist/index26.mjs +22 -45
- package/dist/index27.js +50 -2
- package/dist/index27.mjs +47 -2
- package/dist/index28.js +2 -19
- package/dist/index28.mjs +2 -15
- package/dist/index29.js +17 -159
- package/dist/index29.mjs +15 -158
- package/dist/index3.js +2 -2
- package/dist/index3.mjs +2 -2
- package/dist/index30.js +17 -50
- package/dist/index30.mjs +14 -50
- package/dist/index31.js +99 -71
- package/dist/index31.mjs +97 -71
- package/dist/index32.js +154 -51
- package/dist/index32.mjs +153 -51
- package/dist/index33.js +47 -28
- package/dist/index33.mjs +47 -28
- package/dist/index34.js +65 -161
- package/dist/index34.mjs +65 -161
- package/dist/index35.js +50 -58
- package/dist/index35.mjs +50 -58
- package/dist/index36.js +32 -18
- package/dist/index36.mjs +32 -15
- package/dist/index37.js +169 -16
- package/dist/index37.mjs +169 -16
- package/dist/index38.js +56 -100
- package/dist/index38.mjs +56 -98
- package/dist/index4.js +7 -7
- package/dist/index4.mjs +7 -7
- package/dist/index40.js +17 -118
- package/dist/index40.mjs +17 -118
- package/dist/index42.js +49 -29
- package/dist/index42.mjs +49 -28
- package/dist/index44.js +29 -49
- package/dist/index44.mjs +28 -49
- package/dist/index45.js +5 -5
- package/dist/index45.mjs +5 -5
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.js +1 -1
- package/dist/index50.mjs +1 -1
- package/dist/index51.js +2 -2
- package/dist/index51.mjs +2 -2
- package/package.json +1 -1
package/dist/index38.mjs
CHANGED
|
@@ -1,107 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
singleton: {
|
|
7
|
-
test: (r)=>typeof r === 'boolean' || typeof r === 'undefined',
|
|
8
|
-
throw: ()=>{
|
|
9
|
-
throw new Error(`'singleton' property must be of type 'boolean' or 'undefined'.`);
|
|
10
|
-
},
|
|
11
|
-
transform: (r)=>{
|
|
12
|
-
return typeof r === 'undefined' ? true : r ? true : false;
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
events: {
|
|
16
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
17
|
-
throw: ()=>{
|
|
18
|
-
throw new Error(`'events' property must be an array of strings or 'undefined'.`);
|
|
19
|
-
},
|
|
20
|
-
transform: (r)=>r
|
|
21
|
-
},
|
|
22
|
-
inject: {
|
|
23
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
24
|
-
throw: ()=>{
|
|
25
|
-
throw new Error(`'inject' property must be an array of tuples of length 1, 2 or 3.`);
|
|
26
|
-
},
|
|
27
|
-
transform: (r)=>r
|
|
28
|
-
},
|
|
29
|
-
use: {
|
|
30
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>{
|
|
31
|
-
if (!Array.isArray(r) || r.length !== 2) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const e = r[1];
|
|
35
|
-
return typeof e !== 'undefined';
|
|
36
|
-
}),
|
|
37
|
-
throw: ()=>{
|
|
38
|
-
throw new Error(`'use' property must be an array of tuples of length 2 with [identifier, instance | factory].`);
|
|
39
|
-
},
|
|
40
|
-
transform: (r)=>r
|
|
41
|
-
},
|
|
42
|
-
engage: {
|
|
43
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
44
|
-
throw: ()=>{
|
|
45
|
-
throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
|
|
46
|
-
},
|
|
47
|
-
transform: (r)=>r
|
|
48
|
-
},
|
|
49
|
-
tags: {
|
|
50
|
-
test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
51
|
-
throw: ()=>{
|
|
52
|
-
throw new Error(`'tags' property must be a string or an array of strings.`);
|
|
53
|
-
},
|
|
54
|
-
transform: (r)=>typeof r === 'string' ? [
|
|
55
|
-
r
|
|
56
|
-
] : r
|
|
57
|
-
},
|
|
58
|
-
metadata: {
|
|
59
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
60
|
-
throw: ()=>{
|
|
61
|
-
throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
|
|
62
|
-
},
|
|
63
|
-
transform: (r)=>r
|
|
64
|
-
},
|
|
65
|
-
global: {
|
|
66
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
67
|
-
throw: ()=>{
|
|
68
|
-
throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
|
|
69
|
-
},
|
|
70
|
-
transform: (r)=>r
|
|
1
|
+
let AbstractCycleDetector = class AbstractCycleDetector {
|
|
2
|
+
};
|
|
3
|
+
let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
|
|
4
|
+
detect() {
|
|
5
|
+
return [];
|
|
71
6
|
}
|
|
72
7
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
8
|
+
let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
|
|
9
|
+
detect(e, t) {
|
|
10
|
+
const c = [];
|
|
11
|
+
const s = new Set();
|
|
12
|
+
for (const [n] of e){
|
|
13
|
+
if (s.has(n)) continue;
|
|
14
|
+
const r = [];
|
|
15
|
+
const o = new Set();
|
|
16
|
+
if (this.hasCycleDFS(n, r, o, s, e)) {
|
|
17
|
+
const e = r.findIndex((e)=>e === n);
|
|
18
|
+
if (e >= 0) {
|
|
19
|
+
const s = r.slice(e).map((e)=>t(e));
|
|
20
|
+
c.push({
|
|
21
|
+
cycle: s,
|
|
22
|
+
path: s.join(' → ')
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
80
26
|
}
|
|
27
|
+
return c;
|
|
81
28
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
29
|
+
hasCycleDFS(e, t, c, s, n) {
|
|
30
|
+
if (c.has(e)) {
|
|
31
|
+
t.push(e);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (s.has(e)) {
|
|
35
|
+
return false;
|
|
88
36
|
}
|
|
89
|
-
|
|
37
|
+
t.push(e);
|
|
38
|
+
c.add(e);
|
|
39
|
+
const r = n.get(e);
|
|
40
|
+
if (r?.dependencies && r.dependencies.length > 0) {
|
|
41
|
+
for (const e of r.dependencies){
|
|
42
|
+
if (this.hasCycleDFS(e, t, c, s, n)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
c.delete(e);
|
|
48
|
+
s.add(e);
|
|
49
|
+
return false;
|
|
90
50
|
}
|
|
91
|
-
return e;
|
|
92
51
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
52
|
+
class CycleDetector {
|
|
53
|
+
static getInstance() {
|
|
54
|
+
return CycleDetector.instance;
|
|
96
55
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
56
|
+
static enable() {
|
|
57
|
+
CycleDetector.instance = new ActiveCycleDetector();
|
|
58
|
+
}
|
|
59
|
+
static disable() {
|
|
60
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
106
64
|
|
|
107
|
-
export {
|
|
65
|
+
export { CycleDetector };
|
package/dist/index4.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const core = require('@assemblerjs/core');
|
|
6
|
-
const injectableManager = require('./
|
|
7
|
-
const objectManager = require('./
|
|
8
|
-
const hookManager = require('./
|
|
9
|
-
const assemblerBuilder = require('./
|
|
10
|
-
const contextProvider = require('./
|
|
11
|
-
const debugLogger = require('./
|
|
12
|
-
const cycleDetector = require('./
|
|
6
|
+
const injectableManager = require('./index32.js');
|
|
7
|
+
const objectManager = require('./index33.js');
|
|
8
|
+
const hookManager = require('./index34.js');
|
|
9
|
+
const assemblerBuilder = require('./index35.js');
|
|
10
|
+
const contextProvider = require('./index36.js');
|
|
11
|
+
const debugLogger = require('./index37.js');
|
|
12
|
+
const cycleDetector = require('./index38.js');
|
|
13
13
|
const eventManager = require('./index6.js');
|
|
14
14
|
|
|
15
15
|
class Assembler extends eventManager.EventManager {
|
package/dist/index4.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { clearInstance } from '@assemblerjs/core';
|
|
2
|
-
import { InjectableManager } from './
|
|
3
|
-
import { ObjectManager } from './
|
|
4
|
-
import { HookManager } from './
|
|
5
|
-
import { AssemblerBuilder } from './
|
|
6
|
-
import { ContextProvider } from './
|
|
7
|
-
import { DebugLogger } from './
|
|
8
|
-
import { CycleDetector } from './
|
|
2
|
+
import { InjectableManager } from './index32.mjs';
|
|
3
|
+
import { ObjectManager } from './index33.mjs';
|
|
4
|
+
import { HookManager } from './index34.mjs';
|
|
5
|
+
import { AssemblerBuilder } from './index35.mjs';
|
|
6
|
+
import { ContextProvider } from './index36.mjs';
|
|
7
|
+
import { DebugLogger } from './index37.mjs';
|
|
8
|
+
import { CycleDetector } from './index38.mjs';
|
|
9
9
|
import { EventManager } from './index6.mjs';
|
|
10
10
|
|
|
11
11
|
class Assembler extends EventManager {
|
package/dist/index40.js
CHANGED
|
@@ -2,128 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TransversalWeaver {
|
|
9
|
-
static registerCaller(e, t, r) {
|
|
10
|
-
this.callerRegistry.set(e, {
|
|
11
|
-
className: t,
|
|
12
|
-
identifier: r
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
static getCallerMetadata(e) {
|
|
16
|
-
return this.callerRegistry.get(e);
|
|
5
|
+
class ResolverStore {
|
|
6
|
+
static register(e, r) {
|
|
7
|
+
this.resolvers.set(e, r);
|
|
17
8
|
}
|
|
18
|
-
static
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const i = Object.getOwnPropertyNames(o).some((e)=>{
|
|
23
|
-
if (e === 'constructor') return false;
|
|
24
|
-
const r = Object.getOwnPropertyDescriptor(o, e);
|
|
25
|
-
if (!r) return false;
|
|
26
|
-
const n = r.value && typeof r.value === 'function';
|
|
27
|
-
const s = r.get && typeof r.get === 'function';
|
|
28
|
-
if (!n && !s) return false;
|
|
29
|
-
const a = affect.getAffectedMethods(o, e);
|
|
30
|
-
return a.length > 0;
|
|
31
|
-
});
|
|
32
|
-
if (c.length === 0 && !i) {
|
|
33
|
-
return r;
|
|
9
|
+
static getResolver(e) {
|
|
10
|
+
const r = this.resolvers.get(e);
|
|
11
|
+
if (!r) {
|
|
12
|
+
throw new Error(`No resolver found for decorator type: ${e}`);
|
|
34
13
|
}
|
|
35
|
-
|
|
36
|
-
get (e, t, r) {
|
|
37
|
-
const n = Reflect.get(e, t, r);
|
|
38
|
-
if (typeof n !== 'function') {
|
|
39
|
-
return n;
|
|
40
|
-
}
|
|
41
|
-
return function(...r) {
|
|
42
|
-
const s = String(t);
|
|
43
|
-
const o = TransversalWeaver.callerRegistry.get(this);
|
|
44
|
-
const i = {
|
|
45
|
-
target: e,
|
|
46
|
-
methodName: s,
|
|
47
|
-
args: r,
|
|
48
|
-
caller: o?.className,
|
|
49
|
-
callerIdentifier: o?.identifier
|
|
50
|
-
};
|
|
51
|
-
const l = a.getAdvicesForJoinPoint(i, c, e, t);
|
|
52
|
-
return TransversalWeaver.executeAdviceChain(l, n, e, r, i);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
TransversalWeaver.callerRegistry.set(l, {
|
|
57
|
-
className: n.name,
|
|
58
|
-
identifier: n.name
|
|
59
|
-
});
|
|
60
|
-
return l;
|
|
14
|
+
return new r();
|
|
61
15
|
}
|
|
62
|
-
static
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for (const e of a){
|
|
68
|
-
const t = {
|
|
69
|
-
...s,
|
|
70
|
-
config: e.config
|
|
71
|
-
};
|
|
72
|
-
e.method.call(e.transversalInstance, t);
|
|
73
|
-
}
|
|
74
|
-
let e;
|
|
75
|
-
if (c.length > 0) {
|
|
76
|
-
e = this.buildAroundChain(c, t, r, n, s);
|
|
77
|
-
} else {
|
|
78
|
-
e = t.apply(r, n);
|
|
79
|
-
}
|
|
80
|
-
if (e instanceof Promise) {
|
|
81
|
-
return e.then((e)=>{
|
|
82
|
-
for (const t of o){
|
|
83
|
-
const r = {
|
|
84
|
-
...s,
|
|
85
|
-
result: e
|
|
86
|
-
};
|
|
87
|
-
t.method.call(t.transversalInstance, r);
|
|
88
|
-
}
|
|
89
|
-
return e;
|
|
90
|
-
}).catch((e)=>{
|
|
91
|
-
s.error = e;
|
|
92
|
-
throw e;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
for (const t of o){
|
|
96
|
-
const r = {
|
|
97
|
-
...s,
|
|
98
|
-
result: e,
|
|
99
|
-
config: t.config
|
|
100
|
-
};
|
|
101
|
-
t.method.call(t.transversalInstance, r);
|
|
102
|
-
}
|
|
103
|
-
return e;
|
|
104
|
-
} catch (e) {
|
|
105
|
-
s.error = e;
|
|
106
|
-
throw e;
|
|
107
|
-
}
|
|
16
|
+
static hasResolver(e) {
|
|
17
|
+
return this.resolvers.has(e);
|
|
18
|
+
}
|
|
19
|
+
static getRegisteredTypes() {
|
|
20
|
+
return Array.from(this.resolvers.keys());
|
|
108
21
|
}
|
|
109
|
-
static
|
|
110
|
-
|
|
111
|
-
const c = ()=>{
|
|
112
|
-
if (a < e.length) {
|
|
113
|
-
const t = e[a++];
|
|
114
|
-
const r = {
|
|
115
|
-
...s,
|
|
116
|
-
proceed: c,
|
|
117
|
-
config: t.config
|
|
118
|
-
};
|
|
119
|
-
return t.method.call(t.transversalInstance, r);
|
|
120
|
-
} else {
|
|
121
|
-
return t.apply(r, n);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
return c();
|
|
22
|
+
static clear() {
|
|
23
|
+
this.resolvers.clear();
|
|
125
24
|
}
|
|
126
25
|
}
|
|
127
|
-
|
|
26
|
+
ResolverStore.resolvers = new Map();
|
|
128
27
|
|
|
129
|
-
exports.
|
|
28
|
+
exports.ResolverStore = ResolverStore;
|
package/dist/index40.mjs
CHANGED
|
@@ -1,125 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class TransversalWeaver {
|
|
5
|
-
static registerCaller(e, t, r) {
|
|
6
|
-
this.callerRegistry.set(e, {
|
|
7
|
-
className: t,
|
|
8
|
-
identifier: r
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
static getCallerMetadata(e) {
|
|
12
|
-
return this.callerRegistry.get(e);
|
|
1
|
+
class ResolverStore {
|
|
2
|
+
static register(e, r) {
|
|
3
|
+
this.resolvers.set(e, r);
|
|
13
4
|
}
|
|
14
|
-
static
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const i = Object.getOwnPropertyNames(o).some((e)=>{
|
|
19
|
-
if (e === 'constructor') return false;
|
|
20
|
-
const r = Object.getOwnPropertyDescriptor(o, e);
|
|
21
|
-
if (!r) return false;
|
|
22
|
-
const n = r.value && typeof r.value === 'function';
|
|
23
|
-
const s = r.get && typeof r.get === 'function';
|
|
24
|
-
if (!n && !s) return false;
|
|
25
|
-
const a = getAffectedMethods(o, e);
|
|
26
|
-
return a.length > 0;
|
|
27
|
-
});
|
|
28
|
-
if (c.length === 0 && !i) {
|
|
29
|
-
return r;
|
|
5
|
+
static getResolver(e) {
|
|
6
|
+
const r = this.resolvers.get(e);
|
|
7
|
+
if (!r) {
|
|
8
|
+
throw new Error(`No resolver found for decorator type: ${e}`);
|
|
30
9
|
}
|
|
31
|
-
|
|
32
|
-
get (e, t, r) {
|
|
33
|
-
const n = Reflect.get(e, t, r);
|
|
34
|
-
if (typeof n !== 'function') {
|
|
35
|
-
return n;
|
|
36
|
-
}
|
|
37
|
-
return function(...r) {
|
|
38
|
-
const s = String(t);
|
|
39
|
-
const o = TransversalWeaver.callerRegistry.get(this);
|
|
40
|
-
const i = {
|
|
41
|
-
target: e,
|
|
42
|
-
methodName: s,
|
|
43
|
-
args: r,
|
|
44
|
-
caller: o?.className,
|
|
45
|
-
callerIdentifier: o?.identifier
|
|
46
|
-
};
|
|
47
|
-
const l = a.getAdvicesForJoinPoint(i, c, e, t);
|
|
48
|
-
return TransversalWeaver.executeAdviceChain(l, n, e, r, i);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
TransversalWeaver.callerRegistry.set(l, {
|
|
53
|
-
className: n.name,
|
|
54
|
-
identifier: n.name
|
|
55
|
-
});
|
|
56
|
-
return l;
|
|
10
|
+
return new r();
|
|
57
11
|
}
|
|
58
|
-
static
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
for (const e of a){
|
|
64
|
-
const t = {
|
|
65
|
-
...s,
|
|
66
|
-
config: e.config
|
|
67
|
-
};
|
|
68
|
-
e.method.call(e.transversalInstance, t);
|
|
69
|
-
}
|
|
70
|
-
let e;
|
|
71
|
-
if (c.length > 0) {
|
|
72
|
-
e = this.buildAroundChain(c, t, r, n, s);
|
|
73
|
-
} else {
|
|
74
|
-
e = t.apply(r, n);
|
|
75
|
-
}
|
|
76
|
-
if (e instanceof Promise) {
|
|
77
|
-
return e.then((e)=>{
|
|
78
|
-
for (const t of o){
|
|
79
|
-
const r = {
|
|
80
|
-
...s,
|
|
81
|
-
result: e
|
|
82
|
-
};
|
|
83
|
-
t.method.call(t.transversalInstance, r);
|
|
84
|
-
}
|
|
85
|
-
return e;
|
|
86
|
-
}).catch((e)=>{
|
|
87
|
-
s.error = e;
|
|
88
|
-
throw e;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
for (const t of o){
|
|
92
|
-
const r = {
|
|
93
|
-
...s,
|
|
94
|
-
result: e,
|
|
95
|
-
config: t.config
|
|
96
|
-
};
|
|
97
|
-
t.method.call(t.transversalInstance, r);
|
|
98
|
-
}
|
|
99
|
-
return e;
|
|
100
|
-
} catch (e) {
|
|
101
|
-
s.error = e;
|
|
102
|
-
throw e;
|
|
103
|
-
}
|
|
12
|
+
static hasResolver(e) {
|
|
13
|
+
return this.resolvers.has(e);
|
|
14
|
+
}
|
|
15
|
+
static getRegisteredTypes() {
|
|
16
|
+
return Array.from(this.resolvers.keys());
|
|
104
17
|
}
|
|
105
|
-
static
|
|
106
|
-
|
|
107
|
-
const c = ()=>{
|
|
108
|
-
if (a < e.length) {
|
|
109
|
-
const t = e[a++];
|
|
110
|
-
const r = {
|
|
111
|
-
...s,
|
|
112
|
-
proceed: c,
|
|
113
|
-
config: t.config
|
|
114
|
-
};
|
|
115
|
-
return t.method.call(t.transversalInstance, r);
|
|
116
|
-
} else {
|
|
117
|
-
return t.apply(r, n);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
return c();
|
|
18
|
+
static clear() {
|
|
19
|
+
this.resolvers.clear();
|
|
121
20
|
}
|
|
122
21
|
}
|
|
123
|
-
|
|
22
|
+
ResolverStore.resolvers = new Map();
|
|
124
23
|
|
|
125
|
-
export {
|
|
24
|
+
export { ResolverStore };
|
package/dist/index42.js
CHANGED
|
@@ -2,33 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
resolve(t, e) {
|
|
7
|
-
const n = t.identifier;
|
|
8
|
-
if (this.cache.has(n)) {
|
|
9
|
-
return this.cache.get(n);
|
|
10
|
-
}
|
|
11
|
-
const o = t.build(e);
|
|
12
|
-
const r = e ? {
|
|
13
|
-
...t.configuration,
|
|
14
|
-
...e
|
|
15
|
-
} : t.configuration;
|
|
16
|
-
t.setSingletonInstance(o, r);
|
|
17
|
-
this.cache.set(n, o);
|
|
18
|
-
t.privateContext.prepareInitHook(o, t.configuration);
|
|
19
|
-
return o;
|
|
20
|
-
}
|
|
21
|
-
constructor(){
|
|
22
|
-
this.cache = new Map();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
class TransientStrategy {
|
|
26
|
-
resolve(t, e) {
|
|
27
|
-
const n = t.build(e);
|
|
28
|
-
t.privateContext.prepareInitHook(n, t.configuration);
|
|
29
|
-
return n;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
5
|
+
const core = require('@assemblerjs/core');
|
|
32
6
|
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
const i = (e)=>{
|
|
8
|
+
return {
|
|
9
|
+
identifier: e[0],
|
|
10
|
+
concrete: e[0],
|
|
11
|
+
configuration: {}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const c = (o)=>{
|
|
15
|
+
const i = ()=>core.isClass(o[0]) && core.isClass(o[1]);
|
|
16
|
+
const c = ()=>core.isClass(o[0]) && core.isObject(o[1]);
|
|
17
|
+
const s = ()=>core.pipe(core.conditionally({
|
|
18
|
+
if: ()=>i(),
|
|
19
|
+
then: ()=>{
|
|
20
|
+
return {
|
|
21
|
+
identifier: o[0],
|
|
22
|
+
concrete: o[1],
|
|
23
|
+
configuration: {}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}), core.conditionally({
|
|
27
|
+
if: ()=>c(),
|
|
28
|
+
then: ()=>{
|
|
29
|
+
return {
|
|
30
|
+
identifier: o[0],
|
|
31
|
+
concrete: o[0],
|
|
32
|
+
configuration: o[1]
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
else: (e)=>e
|
|
36
|
+
}))();
|
|
37
|
+
return s();
|
|
38
|
+
};
|
|
39
|
+
const s = (e)=>{
|
|
40
|
+
return {
|
|
41
|
+
identifier: e[0],
|
|
42
|
+
concrete: e[1],
|
|
43
|
+
configuration: e[2]
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const resolveInjectionTuple = (e)=>core.switchCase({
|
|
47
|
+
1: ()=>i(e),
|
|
48
|
+
2: ()=>c(e),
|
|
49
|
+
3: ()=>s(e)
|
|
50
|
+
}, ()=>{
|
|
51
|
+
throw new Error(`Injection tuple must be of length 1, 2 or 3.`);
|
|
52
|
+
})(e.length);
|
|
53
|
+
|
|
54
|
+
exports.resolveInjectionTuple = resolveInjectionTuple;
|
package/dist/index42.mjs
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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 };
|