assemblerjs 1.1.18 → 1.1.20
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 +2 -2
- package/dist/index22.mjs +2 -2
- package/dist/index23.js +2 -2
- package/dist/index23.mjs +2 -2
- 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 +15 -38
- package/dist/index29.mjs +12 -37
- package/dist/index3.js +1 -1
- package/dist/index3.mjs +1 -1
- package/dist/index30.js +100 -151
- package/dist/index30.mjs +98 -150
- package/dist/index31.js +143 -35
- package/dist/index31.mjs +142 -35
- package/dist/index32.js +41 -70
- package/dist/index32.mjs +41 -70
- package/dist/index33.js +73 -49
- package/dist/index33.mjs +73 -49
- package/dist/index34.js +53 -29
- package/dist/index34.mjs +53 -29
- package/dist/index35.js +26 -161
- package/dist/index35.mjs +26 -161
- package/dist/index36.js +151 -48
- package/dist/index36.mjs +151 -48
- package/dist/index37.js +61 -15
- package/dist/index37.mjs +61 -12
- package/dist/index38.js +33 -100
- package/dist/index38.mjs +32 -98
- 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 +18 -24
- package/dist/index41.mjs +18 -24
- 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 +49 -24
- package/dist/index45.mjs +49 -24
- 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/index37.js
CHANGED
|
@@ -2,22 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const defineCustomMetadata = (t, o, n)=>{
|
|
8
|
-
Reflect.defineMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o, n);
|
|
9
|
-
};
|
|
10
|
-
const getCustomMetadata = (t, o)=>{
|
|
11
|
-
return Reflect.getMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
|
|
5
|
+
let AbstractCycleDetector = class AbstractCycleDetector {
|
|
12
6
|
};
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
|
|
8
|
+
detect() {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
15
11
|
};
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
|
|
13
|
+
detect(e, t) {
|
|
14
|
+
const c = [];
|
|
15
|
+
const s = new Set();
|
|
16
|
+
for (const [n] of e){
|
|
17
|
+
if (s.has(n)) continue;
|
|
18
|
+
const r = [];
|
|
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
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return c;
|
|
32
|
+
}
|
|
33
|
+
hasCycleDFS(e, t, c, s, n) {
|
|
34
|
+
if (c.has(e)) {
|
|
35
|
+
t.push(e);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (s.has(e)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
t.push(e);
|
|
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;
|
|
54
|
+
}
|
|
18
55
|
};
|
|
56
|
+
class CycleDetector {
|
|
57
|
+
static getInstance() {
|
|
58
|
+
return CycleDetector.instance;
|
|
59
|
+
}
|
|
60
|
+
static enable() {
|
|
61
|
+
CycleDetector.instance = new ActiveCycleDetector();
|
|
62
|
+
}
|
|
63
|
+
static disable() {
|
|
64
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
19
68
|
|
|
20
|
-
exports.
|
|
21
|
-
exports.getCustomMetadata = getCustomMetadata;
|
|
22
|
-
exports.getOwnCustomMetadata = getOwnCustomMetadata;
|
|
23
|
-
exports.getParamTypes = getParamTypes;
|
|
69
|
+
exports.CycleDetector = CycleDetector;
|
package/dist/index37.mjs
CHANGED
|
@@ -1,16 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const defineCustomMetadata = (t, o, n)=>{
|
|
4
|
-
Reflect.defineMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o, n);
|
|
5
|
-
};
|
|
6
|
-
const getCustomMetadata = (t, o)=>{
|
|
7
|
-
return Reflect.getMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
|
|
1
|
+
let AbstractCycleDetector = class AbstractCycleDetector {
|
|
8
2
|
};
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
|
|
4
|
+
detect() {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return c;
|
|
28
|
+
}
|
|
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;
|
|
36
|
+
}
|
|
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;
|
|
50
|
+
}
|
|
14
51
|
};
|
|
52
|
+
class CycleDetector {
|
|
53
|
+
static getInstance() {
|
|
54
|
+
return CycleDetector.instance;
|
|
55
|
+
}
|
|
56
|
+
static enable() {
|
|
57
|
+
CycleDetector.instance = new ActiveCycleDetector();
|
|
58
|
+
}
|
|
59
|
+
static disable() {
|
|
60
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
15
64
|
|
|
16
|
-
export {
|
|
65
|
+
export { CycleDetector };
|
package/dist/index38.js
CHANGED
|
@@ -2,112 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const reflection = require('./index37.js');
|
|
7
|
-
const helpers = require('./index3.js');
|
|
5
|
+
const eventManager = require('./index6.js');
|
|
8
6
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const registerEvents = (t, n)=>{
|
|
8
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
|
|
9
|
+
if (o) {
|
|
10
|
+
const e = n;
|
|
11
|
+
const o = e.channels;
|
|
12
|
+
for (const n of t.events){
|
|
13
|
+
if (!o.has(n)) e.addChannels(n);
|
|
14
|
+
if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
75
|
-
}
|
|
76
|
-
};
|
|
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.`);
|
|
16
|
+
for (const e of t.events){
|
|
17
|
+
n.on(e, (...n)=>{
|
|
18
|
+
t.privateContext.emit(e, ...n);
|
|
19
|
+
});
|
|
84
20
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const o = n[r].throw;
|
|
89
|
-
const s = n[r].transform;
|
|
90
|
-
if (!t(e[r])) {
|
|
91
|
-
o();
|
|
21
|
+
} else {
|
|
22
|
+
for (const e of t.events){
|
|
23
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
92
24
|
}
|
|
93
|
-
e[r] = s(e[r]);
|
|
94
25
|
}
|
|
95
|
-
return e;
|
|
96
26
|
};
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
27
|
+
const unregisterEvents = (t, n)=>{
|
|
28
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
|
|
29
|
+
if (o) {
|
|
30
|
+
const e = n;
|
|
31
|
+
for (const n of t.events){
|
|
32
|
+
e.off(n);
|
|
33
|
+
}
|
|
34
|
+
e.removeChannels(...t.events);
|
|
35
|
+
t.privateContext.removeChannels(...t.events);
|
|
36
|
+
} else {
|
|
37
|
+
for (const e of t.events){
|
|
38
|
+
if (t.privateContext.events.has(e)) {
|
|
39
|
+
t.privateContext.removeChannels(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
100
42
|
}
|
|
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
43
|
};
|
|
110
44
|
|
|
111
|
-
exports.
|
|
112
|
-
exports.
|
|
113
|
-
exports.validateDefinition = validateDefinition;
|
|
45
|
+
exports.registerEvents = registerEvents;
|
|
46
|
+
exports.unregisterEvents = unregisterEvents;
|
package/dist/index38.mjs
CHANGED
|
@@ -1,107 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getOwnCustomMetadata, defineCustomMetadata } from './index37.mjs';
|
|
3
|
-
import { isAssemblage } from './index3.mjs';
|
|
1
|
+
import { EventManager } from './index6.mjs';
|
|
4
2
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
const registerEvents = (t, n)=>{
|
|
4
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof EventManager;
|
|
5
|
+
if (o) {
|
|
6
|
+
const e = n;
|
|
7
|
+
const o = e.channels;
|
|
8
|
+
for (const n of t.events){
|
|
9
|
+
if (!o.has(n)) e.addChannels(n);
|
|
10
|
+
if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
71
|
-
}
|
|
72
|
-
};
|
|
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.`);
|
|
12
|
+
for (const e of t.events){
|
|
13
|
+
n.on(e, (...n)=>{
|
|
14
|
+
t.privateContext.emit(e, ...n);
|
|
15
|
+
});
|
|
80
16
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const o = n[r].throw;
|
|
85
|
-
const s = n[r].transform;
|
|
86
|
-
if (!t(e[r])) {
|
|
87
|
-
o();
|
|
17
|
+
} else {
|
|
18
|
+
for (const e of t.events){
|
|
19
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
88
20
|
}
|
|
89
|
-
e[r] = s(e[r]);
|
|
90
21
|
}
|
|
91
|
-
return e;
|
|
92
22
|
};
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
23
|
+
const unregisterEvents = (t, n)=>{
|
|
24
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof EventManager;
|
|
25
|
+
if (o) {
|
|
26
|
+
const e = n;
|
|
27
|
+
for (const n of t.events){
|
|
28
|
+
e.off(n);
|
|
29
|
+
}
|
|
30
|
+
e.removeChannels(...t.events);
|
|
31
|
+
t.privateContext.removeChannels(...t.events);
|
|
32
|
+
} else {
|
|
33
|
+
for (const e of t.events){
|
|
34
|
+
if (t.privateContext.events.has(e)) {
|
|
35
|
+
t.privateContext.removeChannels(e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
96
38
|
}
|
|
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
39
|
};
|
|
106
40
|
|
|
107
|
-
export {
|
|
41
|
+
export { registerEvents, unregisterEvents };
|
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;
|