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.
- package/dist/index11.js +2 -2
- package/dist/index11.mjs +2 -2
- package/dist/index13.js +2 -2
- package/dist/index13.mjs +2 -2
- package/dist/index16.js +1 -1
- package/dist/index16.mjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index17.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/index2.js +2 -2
- package/dist/index2.mjs +2 -2
- 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 +3 -3
- package/dist/index22.mjs +3 -3
- package/dist/index23.js +3 -3
- package/dist/index23.mjs +3 -3
- package/dist/index24.js +2 -2
- package/dist/index24.mjs +2 -2
- package/dist/index25.js +1 -1
- package/dist/index25.mjs +1 -1
- package/dist/index26.js +1 -1
- package/dist/index26.mjs +1 -1
- package/dist/index29.js +158 -17
- package/dist/index29.mjs +157 -14
- package/dist/index3.js +1 -1
- package/dist/index3.mjs +1 -1
- package/dist/index30.js +43 -100
- package/dist/index30.mjs +43 -98
- package/dist/index31.js +71 -32
- package/dist/index31.mjs +71 -31
- package/dist/index32.js +51 -154
- package/dist/index32.mjs +51 -153
- package/dist/index33.js +28 -47
- package/dist/index33.mjs +28 -47
- package/dist/index34.js +161 -65
- package/dist/index34.mjs +161 -65
- package/dist/index35.js +58 -50
- package/dist/index35.mjs +58 -50
- package/dist/index36.js +18 -32
- package/dist/index36.mjs +15 -32
- package/dist/index37.js +16 -169
- package/dist/index37.mjs +16 -169
- package/dist/index38.js +100 -56
- package/dist/index38.mjs +98 -56
- package/dist/index39.js +101 -18
- package/dist/index39.mjs +101 -18
- package/dist/index4.js +7 -7
- package/dist/index4.mjs +7 -7
- package/dist/index40.js +24 -101
- package/dist/index40.mjs +24 -101
- package/dist/index41.js +36 -24
- package/dist/index41.mjs +35 -24
- package/dist/index42.js +29 -49
- package/dist/index42.mjs +28 -49
- package/dist/index44.js +49 -29
- package/dist/index44.mjs +49 -28
- package/dist/index45.js +42 -26
- package/dist/index45.mjs +42 -26
- 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/dist/index51.js +1 -1
- package/dist/index51.mjs +1 -1
- package/package.json +1 -1
package/dist/index38.js
CHANGED
|
@@ -2,68 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const constants = require('./index28.js');
|
|
6
|
+
const reflection = require('./index36.js');
|
|
7
|
+
const helpers = require('./index3.js');
|
|
8
|
+
|
|
9
|
+
const n = {
|
|
10
|
+
singleton: {
|
|
11
|
+
test: (r)=>typeof r === 'boolean' || typeof r === 'undefined',
|
|
12
|
+
throw: ()=>{
|
|
13
|
+
throw new Error(`'singleton' property must be of type 'boolean' or 'undefined'.`);
|
|
14
|
+
},
|
|
15
|
+
transform: (r)=>{
|
|
16
|
+
return typeof r === 'undefined' ? true : r ? true : false;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
events: {
|
|
20
|
+
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
21
|
+
throw: ()=>{
|
|
22
|
+
throw new Error(`'events' property must be an array of strings or 'undefined'.`);
|
|
23
|
+
},
|
|
24
|
+
transform: (r)=>r
|
|
25
|
+
},
|
|
26
|
+
inject: {
|
|
27
|
+
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
28
|
+
throw: ()=>{
|
|
29
|
+
throw new Error(`'inject' property must be an array of tuples of length 1, 2 or 3.`);
|
|
30
|
+
},
|
|
31
|
+
transform: (r)=>r
|
|
32
|
+
},
|
|
33
|
+
use: {
|
|
34
|
+
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>{
|
|
35
|
+
if (!Array.isArray(r) || r.length !== 2) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const e = r[1];
|
|
39
|
+
return typeof e !== 'undefined';
|
|
40
|
+
}),
|
|
41
|
+
throw: ()=>{
|
|
42
|
+
throw new Error(`'use' property must be an array of tuples of length 2 with [identifier, instance | factory].`);
|
|
43
|
+
},
|
|
44
|
+
transform: (r)=>r
|
|
45
|
+
},
|
|
46
|
+
engage: {
|
|
47
|
+
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
48
|
+
throw: ()=>{
|
|
49
|
+
throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
|
|
50
|
+
},
|
|
51
|
+
transform: (r)=>r
|
|
52
|
+
},
|
|
53
|
+
tags: {
|
|
54
|
+
test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
55
|
+
throw: ()=>{
|
|
56
|
+
throw new Error(`'tags' property must be a string or an array of strings.`);
|
|
57
|
+
},
|
|
58
|
+
transform: (r)=>typeof r === 'string' ? [
|
|
59
|
+
r
|
|
60
|
+
] : r
|
|
61
|
+
},
|
|
62
|
+
metadata: {
|
|
63
|
+
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
64
|
+
throw: ()=>{
|
|
65
|
+
throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
|
|
66
|
+
},
|
|
67
|
+
transform: (r)=>r
|
|
68
|
+
},
|
|
69
|
+
global: {
|
|
70
|
+
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
71
|
+
throw: ()=>{
|
|
72
|
+
throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
|
|
73
|
+
},
|
|
74
|
+
transform: (r)=>r
|
|
10
75
|
}
|
|
11
76
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const o = new Set();
|
|
20
|
-
if (this.hasCycleDFS(n, r, o, s, e)) {
|
|
21
|
-
const e = r.findIndex((e)=>e === n);
|
|
22
|
-
if (e >= 0) {
|
|
23
|
-
const s = r.slice(e).map((e)=>t(e));
|
|
24
|
-
c.push({
|
|
25
|
-
cycle: s,
|
|
26
|
-
path: s.join(' → ')
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
77
|
+
const validateDefinition = (r)=>{
|
|
78
|
+
const e = {
|
|
79
|
+
...r
|
|
80
|
+
};
|
|
81
|
+
for(const r in e){
|
|
82
|
+
if (!Object.keys(n).includes(r)) {
|
|
83
|
+
throw new Error(`Property '${r}' is not a valid assemblage definition property.`);
|
|
30
84
|
}
|
|
31
|
-
return c;
|
|
32
85
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return false;
|
|
86
|
+
for(const r in n){
|
|
87
|
+
const t = n[r].test;
|
|
88
|
+
const o = n[r].throw;
|
|
89
|
+
const s = n[r].transform;
|
|
90
|
+
if (!t(e[r])) {
|
|
91
|
+
o();
|
|
40
92
|
}
|
|
41
|
-
|
|
42
|
-
c.add(e);
|
|
43
|
-
const r = n.get(e);
|
|
44
|
-
if (r?.dependencies && r.dependencies.length > 0) {
|
|
45
|
-
for (const e of r.dependencies){
|
|
46
|
-
if (this.hasCycleDFS(e, t, c, s, n)) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
c.delete(e);
|
|
52
|
-
s.add(e);
|
|
53
|
-
return false;
|
|
93
|
+
e[r] = s(e[r]);
|
|
54
94
|
}
|
|
95
|
+
return e;
|
|
55
96
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
static enable() {
|
|
61
|
-
CycleDetector.instance = new ActiveCycleDetector();
|
|
97
|
+
const getDefinition = (e)=>{
|
|
98
|
+
if (!helpers.isAssemblage(e)) {
|
|
99
|
+
throw new Error(`Class '${e.name}' is not an assemblage or transversal.`);
|
|
62
100
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
101
|
+
return reflection.getOwnCustomMetadata(constants.ReflectValue.AssemblageDefinition, e);
|
|
102
|
+
};
|
|
103
|
+
const setDefinitionValue = (t, o, n)=>{
|
|
104
|
+
const s = getDefinition(n);
|
|
105
|
+
s[t] = o;
|
|
106
|
+
const a = validateDefinition(s);
|
|
107
|
+
reflection.defineCustomMetadata(constants.ReflectValue.AssemblageDefinition, a, n);
|
|
108
|
+
return a;
|
|
109
|
+
};
|
|
68
110
|
|
|
69
|
-
exports.
|
|
111
|
+
exports.getDefinition = getDefinition;
|
|
112
|
+
exports.setDefinitionValue = setDefinitionValue;
|
|
113
|
+
exports.validateDefinition = validateDefinition;
|
package/dist/index38.mjs
CHANGED
|
@@ -1,65 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
};
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ReflectValue } from './index28.mjs';
|
|
2
|
+
import { getOwnCustomMetadata, defineCustomMetadata } from './index36.mjs';
|
|
3
|
+
import { isAssemblage } from './index3.mjs';
|
|
4
|
+
|
|
5
|
+
const n = {
|
|
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
|
|
6
71
|
}
|
|
7
72
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
}
|
|
73
|
+
const validateDefinition = (r)=>{
|
|
74
|
+
const e = {
|
|
75
|
+
...r
|
|
76
|
+
};
|
|
77
|
+
for(const r in e){
|
|
78
|
+
if (!Object.keys(n).includes(r)) {
|
|
79
|
+
throw new Error(`Property '${r}' is not a valid assemblage definition property.`);
|
|
26
80
|
}
|
|
27
|
-
return c;
|
|
28
81
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return false;
|
|
82
|
+
for(const r in n){
|
|
83
|
+
const t = n[r].test;
|
|
84
|
+
const o = n[r].throw;
|
|
85
|
+
const s = n[r].transform;
|
|
86
|
+
if (!t(e[r])) {
|
|
87
|
+
o();
|
|
36
88
|
}
|
|
37
|
-
|
|
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;
|
|
89
|
+
e[r] = s(e[r]);
|
|
50
90
|
}
|
|
91
|
+
return e;
|
|
51
92
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
static enable() {
|
|
57
|
-
CycleDetector.instance = new ActiveCycleDetector();
|
|
93
|
+
const getDefinition = (e)=>{
|
|
94
|
+
if (!isAssemblage(e)) {
|
|
95
|
+
throw new Error(`Class '${e.name}' is not an assemblage or transversal.`);
|
|
58
96
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
97
|
+
return getOwnCustomMetadata(ReflectValue.AssemblageDefinition, e);
|
|
98
|
+
};
|
|
99
|
+
const setDefinitionValue = (t, o, n)=>{
|
|
100
|
+
const s = getDefinition(n);
|
|
101
|
+
s[t] = o;
|
|
102
|
+
const a = validateDefinition(s);
|
|
103
|
+
defineCustomMetadata(ReflectValue.AssemblageDefinition, a, n);
|
|
104
|
+
return a;
|
|
105
|
+
};
|
|
64
106
|
|
|
65
|
-
export {
|
|
107
|
+
export { getDefinition, setDefinitionValue, validateDefinition };
|
package/dist/index39.js
CHANGED
|
@@ -2,27 +2,110 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
static
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
const transversalManager = require('./index13.js');
|
|
6
|
+
const affect = require('./index12.js');
|
|
7
|
+
|
|
8
|
+
class TransversalWeaver {
|
|
9
|
+
static weave(n, r, o) {
|
|
10
|
+
const c = transversalManager.TransversalManager.getInstance(o);
|
|
11
|
+
const s = c.getAspectsForTarget(r);
|
|
12
|
+
const a = Object.getPrototypeOf(n);
|
|
13
|
+
const f = Object.getOwnPropertyNames(a).some((t)=>{
|
|
14
|
+
if (t === 'constructor') return false;
|
|
15
|
+
const n = Object.getOwnPropertyDescriptor(a, t);
|
|
16
|
+
if (!n) return false;
|
|
17
|
+
const r = n.value && typeof n.value === 'function';
|
|
18
|
+
const o = n.get && typeof n.get === 'function';
|
|
19
|
+
if (!r && !o) return false;
|
|
20
|
+
const c = affect.getAffectedMethods(a, t);
|
|
21
|
+
return c.length > 0;
|
|
22
|
+
});
|
|
23
|
+
if (s.length === 0 && !f) {
|
|
24
|
+
return n;
|
|
13
25
|
}
|
|
14
|
-
return new
|
|
26
|
+
return new Proxy(n, {
|
|
27
|
+
get (t, e, n) {
|
|
28
|
+
const r = Reflect.get(t, e, n);
|
|
29
|
+
if (typeof r !== 'function') {
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
return function(...n) {
|
|
33
|
+
const o = String(e);
|
|
34
|
+
const a = {
|
|
35
|
+
target: t,
|
|
36
|
+
methodName: o,
|
|
37
|
+
args: n
|
|
38
|
+
};
|
|
39
|
+
const f = c.getAdvicesForJoinPoint(a, s, t, e);
|
|
40
|
+
return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
15
44
|
}
|
|
16
|
-
static
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
45
|
+
static executeAdviceChain(t, e, n, r, o) {
|
|
46
|
+
const c = t.filter((t)=>t.type === 'before');
|
|
47
|
+
const s = t.filter((t)=>t.type === 'around');
|
|
48
|
+
const a = t.filter((t)=>t.type === 'after');
|
|
49
|
+
try {
|
|
50
|
+
for (const t of c){
|
|
51
|
+
const e = {
|
|
52
|
+
...o,
|
|
53
|
+
config: t.config
|
|
54
|
+
};
|
|
55
|
+
t.method.call(t.transversalInstance, e);
|
|
56
|
+
}
|
|
57
|
+
let t;
|
|
58
|
+
if (s.length > 0) {
|
|
59
|
+
t = this.buildAroundChain(s, e, n, r, o);
|
|
60
|
+
} else {
|
|
61
|
+
t = e.apply(n, r);
|
|
62
|
+
}
|
|
63
|
+
if (t instanceof Promise) {
|
|
64
|
+
return t.then((t)=>{
|
|
65
|
+
for (const e of a){
|
|
66
|
+
const n = {
|
|
67
|
+
...o,
|
|
68
|
+
result: t
|
|
69
|
+
};
|
|
70
|
+
e.method.call(e.transversalInstance, n);
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
}).catch((t)=>{
|
|
74
|
+
o.error = t;
|
|
75
|
+
throw t;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
for (const e of a){
|
|
79
|
+
const n = {
|
|
80
|
+
...o,
|
|
81
|
+
result: t,
|
|
82
|
+
config: e.config
|
|
83
|
+
};
|
|
84
|
+
e.method.call(e.transversalInstance, n);
|
|
85
|
+
}
|
|
86
|
+
return t;
|
|
87
|
+
} catch (t) {
|
|
88
|
+
o.error = t;
|
|
89
|
+
throw t;
|
|
90
|
+
}
|
|
21
91
|
}
|
|
22
|
-
static
|
|
23
|
-
|
|
92
|
+
static buildAroundChain(t, e, n, r, o) {
|
|
93
|
+
let c = 0;
|
|
94
|
+
const s = ()=>{
|
|
95
|
+
if (c < t.length) {
|
|
96
|
+
const e = t[c++];
|
|
97
|
+
const n = {
|
|
98
|
+
...o,
|
|
99
|
+
proceed: s,
|
|
100
|
+
config: e.config
|
|
101
|
+
};
|
|
102
|
+
return e.method.call(e.transversalInstance, n);
|
|
103
|
+
} else {
|
|
104
|
+
return e.apply(n, r);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return s();
|
|
24
108
|
}
|
|
25
109
|
}
|
|
26
|
-
ResolverStore.resolvers = new Map();
|
|
27
110
|
|
|
28
|
-
exports.
|
|
111
|
+
exports.TransversalWeaver = TransversalWeaver;
|
package/dist/index39.mjs
CHANGED
|
@@ -1,24 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
static
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { TransversalManager } from './index13.mjs';
|
|
2
|
+
import { getAffectedMethods } from './index12.mjs';
|
|
3
|
+
|
|
4
|
+
class TransversalWeaver {
|
|
5
|
+
static weave(n, r, o) {
|
|
6
|
+
const c = TransversalManager.getInstance(o);
|
|
7
|
+
const s = c.getAspectsForTarget(r);
|
|
8
|
+
const a = Object.getPrototypeOf(n);
|
|
9
|
+
const f = Object.getOwnPropertyNames(a).some((t)=>{
|
|
10
|
+
if (t === 'constructor') return false;
|
|
11
|
+
const n = Object.getOwnPropertyDescriptor(a, t);
|
|
12
|
+
if (!n) return false;
|
|
13
|
+
const r = n.value && typeof n.value === 'function';
|
|
14
|
+
const o = n.get && typeof n.get === 'function';
|
|
15
|
+
if (!r && !o) return false;
|
|
16
|
+
const c = getAffectedMethods(a, t);
|
|
17
|
+
return c.length > 0;
|
|
18
|
+
});
|
|
19
|
+
if (s.length === 0 && !f) {
|
|
20
|
+
return n;
|
|
9
21
|
}
|
|
10
|
-
return new
|
|
22
|
+
return new Proxy(n, {
|
|
23
|
+
get (t, e, n) {
|
|
24
|
+
const r = Reflect.get(t, e, n);
|
|
25
|
+
if (typeof r !== 'function') {
|
|
26
|
+
return r;
|
|
27
|
+
}
|
|
28
|
+
return function(...n) {
|
|
29
|
+
const o = String(e);
|
|
30
|
+
const a = {
|
|
31
|
+
target: t,
|
|
32
|
+
methodName: o,
|
|
33
|
+
args: n
|
|
34
|
+
};
|
|
35
|
+
const f = c.getAdvicesForJoinPoint(a, s, t, e);
|
|
36
|
+
return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
11
40
|
}
|
|
12
|
-
static
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
41
|
+
static executeAdviceChain(t, e, n, r, o) {
|
|
42
|
+
const c = t.filter((t)=>t.type === 'before');
|
|
43
|
+
const s = t.filter((t)=>t.type === 'around');
|
|
44
|
+
const a = t.filter((t)=>t.type === 'after');
|
|
45
|
+
try {
|
|
46
|
+
for (const t of c){
|
|
47
|
+
const e = {
|
|
48
|
+
...o,
|
|
49
|
+
config: t.config
|
|
50
|
+
};
|
|
51
|
+
t.method.call(t.transversalInstance, e);
|
|
52
|
+
}
|
|
53
|
+
let t;
|
|
54
|
+
if (s.length > 0) {
|
|
55
|
+
t = this.buildAroundChain(s, e, n, r, o);
|
|
56
|
+
} else {
|
|
57
|
+
t = e.apply(n, r);
|
|
58
|
+
}
|
|
59
|
+
if (t instanceof Promise) {
|
|
60
|
+
return t.then((t)=>{
|
|
61
|
+
for (const e of a){
|
|
62
|
+
const n = {
|
|
63
|
+
...o,
|
|
64
|
+
result: t
|
|
65
|
+
};
|
|
66
|
+
e.method.call(e.transversalInstance, n);
|
|
67
|
+
}
|
|
68
|
+
return t;
|
|
69
|
+
}).catch((t)=>{
|
|
70
|
+
o.error = t;
|
|
71
|
+
throw t;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
for (const e of a){
|
|
75
|
+
const n = {
|
|
76
|
+
...o,
|
|
77
|
+
result: t,
|
|
78
|
+
config: e.config
|
|
79
|
+
};
|
|
80
|
+
e.method.call(e.transversalInstance, n);
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
} catch (t) {
|
|
84
|
+
o.error = t;
|
|
85
|
+
throw t;
|
|
86
|
+
}
|
|
17
87
|
}
|
|
18
|
-
static
|
|
19
|
-
|
|
88
|
+
static buildAroundChain(t, e, n, r, o) {
|
|
89
|
+
let c = 0;
|
|
90
|
+
const s = ()=>{
|
|
91
|
+
if (c < t.length) {
|
|
92
|
+
const e = t[c++];
|
|
93
|
+
const n = {
|
|
94
|
+
...o,
|
|
95
|
+
proceed: s,
|
|
96
|
+
config: e.config
|
|
97
|
+
};
|
|
98
|
+
return e.method.call(e.transversalInstance, n);
|
|
99
|
+
} else {
|
|
100
|
+
return e.apply(n, r);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return s();
|
|
20
104
|
}
|
|
21
105
|
}
|
|
22
|
-
ResolverStore.resolvers = new Map();
|
|
23
106
|
|
|
24
|
-
export {
|
|
107
|
+
export { TransversalWeaver };
|
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('./index29.js');
|
|
7
|
+
const objectManager = require('./index30.js');
|
|
8
|
+
const hookManager = require('./index31.js');
|
|
9
|
+
const assemblerBuilder = require('./index32.js');
|
|
10
|
+
const contextProvider = require('./index33.js');
|
|
11
|
+
const debugLogger = require('./index34.js');
|
|
12
|
+
const cycleDetector = require('./index35.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 './index29.mjs';
|
|
3
|
+
import { ObjectManager } from './index30.mjs';
|
|
4
|
+
import { HookManager } from './index31.mjs';
|
|
5
|
+
import { AssemblerBuilder } from './index32.mjs';
|
|
6
|
+
import { ContextProvider } from './index33.mjs';
|
|
7
|
+
import { DebugLogger } from './index34.mjs';
|
|
8
|
+
import { CycleDetector } from './index35.mjs';
|
|
9
9
|
import { EventManager } from './index6.mjs';
|
|
10
10
|
|
|
11
11
|
class Assembler extends EventManager {
|