assemblerjs 1.1.16 → 1.1.17
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 +1 -1
- package/dist/index13.js +1 -1
- package/dist/index13.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/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 +1 -1
- package/dist/index22.mjs +1 -1
- package/dist/index23.js +1 -1
- package/dist/index23.mjs +1 -1
- package/dist/index24.js +1 -1
- package/dist/index24.mjs +1 -1
- package/dist/index32.js +101 -18
- package/dist/index32.mjs +101 -18
- package/dist/index33.js +24 -101
- package/dist/index33.mjs +24 -101
- package/dist/index34.js +18 -24
- package/dist/index34.mjs +18 -24
- package/dist/index4.js +3 -3
- package/dist/index4.mjs +3 -3
- package/dist/index40.js +4 -0
- package/dist/index40.mjs +4 -0
- 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 +15 -12
- package/dist/index51.mjs +15 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -853,7 +853,7 @@ declare class InjectableManager {
|
|
|
853
853
|
/**
|
|
854
854
|
* Get the injectables map for cycle detection and other analysis
|
|
855
855
|
*/
|
|
856
|
-
getInjectables(): Map<Identifier
|
|
856
|
+
getInjectables(): Map<Identifier<any>, any>;
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
declare interface InjectableRegistrar {
|
package/dist/index13.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const core = require('@assemblerjs/core');
|
|
6
|
-
const pointcutMatcher = require('./
|
|
6
|
+
const pointcutMatcher = require('./index33.js');
|
|
7
7
|
const affect = require('./index12.js');
|
|
8
8
|
const schema = require('./index30.js');
|
|
9
9
|
|
package/dist/index13.mjs
CHANGED
package/dist/index18.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const parameterDecoratorFactory = require('./index17.js');
|
|
6
|
-
const resolverStore = require('./
|
|
6
|
+
const resolverStore = require('./index34.js');
|
|
7
7
|
|
|
8
8
|
let ContextResolver = class ContextResolver {
|
|
9
9
|
resolve(e, r, t) {
|
package/dist/index18.mjs
CHANGED
package/dist/index19.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const parameterDecoratorFactory = require('./index17.js');
|
|
6
|
-
const resolverStore = require('./
|
|
6
|
+
const resolverStore = require('./index34.js');
|
|
7
7
|
|
|
8
8
|
let ConfigurationResolver = class ConfigurationResolver {
|
|
9
9
|
resolve(r, o, e, n) {
|
package/dist/index19.mjs
CHANGED
package/dist/index20.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const parameterDecoratorFactory = require('./index17.js');
|
|
6
|
-
const resolverStore = require('./
|
|
6
|
+
const resolverStore = require('./index34.js');
|
|
7
7
|
|
|
8
8
|
let DefinitionResolver = class DefinitionResolver {
|
|
9
9
|
resolve(e, r) {
|
package/dist/index20.mjs
CHANGED
package/dist/index21.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const parameterDecoratorFactory = require('./index17.js');
|
|
6
|
-
const resolverStore = require('./
|
|
6
|
+
const resolverStore = require('./index34.js');
|
|
7
7
|
|
|
8
8
|
let DisposeResolver = class DisposeResolver {
|
|
9
9
|
resolve(e, r, s) {
|
package/dist/index21.mjs
CHANGED
package/dist/index22.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reflection = require('./index29.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index34.js');
|
|
9
9
|
|
|
10
10
|
let UseResolver = class UseResolver {
|
|
11
11
|
resolve(r, o, t) {
|
package/dist/index22.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getOwnCustomMetadata } from './index29.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index34.mjs';
|
|
5
5
|
|
|
6
6
|
let UseResolver = class UseResolver {
|
|
7
7
|
resolve(r, o, t) {
|
package/dist/index23.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reflection = require('./index29.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index34.js');
|
|
9
9
|
|
|
10
10
|
let GlobalResolver = class GlobalResolver {
|
|
11
11
|
resolve(e, r, a) {
|
package/dist/index23.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getOwnCustomMetadata } from './index29.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index34.mjs';
|
|
5
5
|
|
|
6
6
|
let GlobalResolver = class GlobalResolver {
|
|
7
7
|
resolve(e, r, a) {
|
package/dist/index24.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reflection = require('./index29.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index34.js');
|
|
9
9
|
|
|
10
10
|
let OptionalResolver = class OptionalResolver {
|
|
11
11
|
resolve(o, t, n) {
|
package/dist/index24.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getParamTypes, getOwnCustomMetadata } from './index29.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index34.mjs';
|
|
5
5
|
|
|
6
6
|
let OptionalResolver = class OptionalResolver {
|
|
7
7
|
resolve(o, t, n) {
|
package/dist/index32.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/index32.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/index33.js
CHANGED
|
@@ -2,110 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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;
|
|
5
|
+
class PointcutMatcher {
|
|
6
|
+
static parse(t) {
|
|
7
|
+
const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
|
|
8
|
+
if (!e) {
|
|
9
|
+
throw new Error(`Invalid pointcut expression: ${t}`);
|
|
25
10
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
});
|
|
11
|
+
const [, c, r] = e;
|
|
12
|
+
return new ExecutionPointcutMatcher(c, r);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
let ExecutionPointcutMatcher = class ExecutionPointcutMatcher {
|
|
16
|
+
matches(t) {
|
|
17
|
+
const e = t.target.constructor.name;
|
|
18
|
+
const c = t.methodName;
|
|
19
|
+
return this.classRegex.test(e) && this.methodRegex.test(c);
|
|
44
20
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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;
|
|
21
|
+
patternToRegex(t) {
|
|
22
|
+
if (t === '*') {
|
|
23
|
+
return /.*/;
|
|
90
24
|
}
|
|
25
|
+
const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
26
|
+
return new RegExp(`^${e}$`);
|
|
91
27
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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();
|
|
28
|
+
constructor(t, e){
|
|
29
|
+
this.classRegex = this.patternToRegex(t);
|
|
30
|
+
this.methodRegex = this.patternToRegex(e);
|
|
108
31
|
}
|
|
109
|
-
}
|
|
32
|
+
};
|
|
110
33
|
|
|
111
|
-
exports.
|
|
34
|
+
exports.PointcutMatcher = PointcutMatcher;
|
package/dist/index33.mjs
CHANGED
|
@@ -1,107 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
1
|
+
class PointcutMatcher {
|
|
2
|
+
static parse(t) {
|
|
3
|
+
const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
|
|
4
|
+
if (!e) {
|
|
5
|
+
throw new Error(`Invalid pointcut expression: ${t}`);
|
|
21
6
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
});
|
|
7
|
+
const [, c, r] = e;
|
|
8
|
+
return new ExecutionPointcutMatcher(c, r);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
let ExecutionPointcutMatcher = class ExecutionPointcutMatcher {
|
|
12
|
+
matches(t) {
|
|
13
|
+
const e = t.target.constructor.name;
|
|
14
|
+
const c = t.methodName;
|
|
15
|
+
return this.classRegex.test(e) && this.methodRegex.test(c);
|
|
40
16
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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;
|
|
17
|
+
patternToRegex(t) {
|
|
18
|
+
if (t === '*') {
|
|
19
|
+
return /.*/;
|
|
86
20
|
}
|
|
21
|
+
const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
22
|
+
return new RegExp(`^${e}$`);
|
|
87
23
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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();
|
|
24
|
+
constructor(t, e){
|
|
25
|
+
this.classRegex = this.patternToRegex(t);
|
|
26
|
+
this.methodRegex = this.patternToRegex(e);
|
|
104
27
|
}
|
|
105
|
-
}
|
|
28
|
+
};
|
|
106
29
|
|
|
107
|
-
export {
|
|
30
|
+
export { PointcutMatcher };
|
package/dist/index34.js
CHANGED
|
@@ -2,33 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
class
|
|
6
|
-
static
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
class ResolverStore {
|
|
6
|
+
static register(e, r) {
|
|
7
|
+
this.resolvers.set(e, r);
|
|
8
|
+
}
|
|
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}`);
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
return new ExecutionPointcutMatcher(c, r);
|
|
14
|
+
return new r();
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
matches(t) {
|
|
17
|
-
const e = t.target.constructor.name;
|
|
18
|
-
const c = t.methodName;
|
|
19
|
-
return this.classRegex.test(e) && this.methodRegex.test(c);
|
|
16
|
+
static hasResolver(e) {
|
|
17
|
+
return this.resolvers.has(e);
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /.*/;
|
|
24
|
-
}
|
|
25
|
-
const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
26
|
-
return new RegExp(`^${e}$`);
|
|
19
|
+
static getRegisteredTypes() {
|
|
20
|
+
return Array.from(this.resolvers.keys());
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
this.methodRegex = this.patternToRegex(e);
|
|
22
|
+
static clear() {
|
|
23
|
+
this.resolvers.clear();
|
|
31
24
|
}
|
|
32
|
-
}
|
|
25
|
+
}
|
|
26
|
+
ResolverStore.resolvers = new Map();
|
|
33
27
|
|
|
34
|
-
exports.
|
|
28
|
+
exports.ResolverStore = ResolverStore;
|
package/dist/index34.mjs
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
class
|
|
2
|
-
static
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
class ResolverStore {
|
|
2
|
+
static register(e, r) {
|
|
3
|
+
this.resolvers.set(e, r);
|
|
4
|
+
}
|
|
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}`);
|
|
6
9
|
}
|
|
7
|
-
|
|
8
|
-
return new ExecutionPointcutMatcher(c, r);
|
|
10
|
+
return new r();
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
matches(t) {
|
|
13
|
-
const e = t.target.constructor.name;
|
|
14
|
-
const c = t.methodName;
|
|
15
|
-
return this.classRegex.test(e) && this.methodRegex.test(c);
|
|
12
|
+
static hasResolver(e) {
|
|
13
|
+
return this.resolvers.has(e);
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return /.*/;
|
|
20
|
-
}
|
|
21
|
-
const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
22
|
-
return new RegExp(`^${e}$`);
|
|
15
|
+
static getRegisteredTypes() {
|
|
16
|
+
return Array.from(this.resolvers.keys());
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
this.methodRegex = this.patternToRegex(e);
|
|
18
|
+
static clear() {
|
|
19
|
+
this.resolvers.clear();
|
|
27
20
|
}
|
|
28
|
-
}
|
|
21
|
+
}
|
|
22
|
+
ResolverStore.resolvers = new Map();
|
|
29
23
|
|
|
30
|
-
export {
|
|
24
|
+
export { ResolverStore };
|
package/dist/index4.js
CHANGED
|
@@ -15,7 +15,7 @@ const eventManager = require('./index6.js');
|
|
|
15
15
|
class Assembler extends eventManager.EventManager {
|
|
16
16
|
static enableDebug(e) {
|
|
17
17
|
debugLogger.DebugLogger.enable(e);
|
|
18
|
-
if (e?.detectCycles === true) {
|
|
18
|
+
if (e?.enabled !== false && e?.detectCycles === true) {
|
|
19
19
|
cycleDetector.CycleDetector.enable();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -28,8 +28,8 @@ class Assembler extends eventManager.EventManager {
|
|
|
28
28
|
const a = performance.now();
|
|
29
29
|
r.logBuildStart(e);
|
|
30
30
|
const n = new Assembler();
|
|
31
|
-
const
|
|
32
|
-
const c =
|
|
31
|
+
const o = new assemblerBuilder.AssemblerBuilder(n);
|
|
32
|
+
const c = o.build(e, t);
|
|
33
33
|
const l = performance.now() - a;
|
|
34
34
|
r.logBuildEnd(e, l);
|
|
35
35
|
return c;
|
package/dist/index4.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { EventManager } from './index6.mjs';
|
|
|
11
11
|
class Assembler extends EventManager {
|
|
12
12
|
static enableDebug(e) {
|
|
13
13
|
DebugLogger.enable(e);
|
|
14
|
-
if (e?.detectCycles === true) {
|
|
14
|
+
if (e?.enabled !== false && e?.detectCycles === true) {
|
|
15
15
|
CycleDetector.enable();
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -24,8 +24,8 @@ class Assembler extends EventManager {
|
|
|
24
24
|
const a = performance.now();
|
|
25
25
|
r.logBuildStart(e);
|
|
26
26
|
const n = new Assembler();
|
|
27
|
-
const
|
|
28
|
-
const c =
|
|
27
|
+
const o = new AssemblerBuilder(n);
|
|
28
|
+
const c = o.build(e, t);
|
|
29
29
|
const l = performance.now() - a;
|
|
30
30
|
r.logBuildEnd(e, l);
|
|
31
31
|
return c;
|
package/dist/index40.js
CHANGED
|
@@ -154,6 +154,10 @@ class DebugLogger {
|
|
|
154
154
|
return DebugLogger.instance;
|
|
155
155
|
}
|
|
156
156
|
static enable(o) {
|
|
157
|
+
if (o?.enabled === false) {
|
|
158
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
157
161
|
DebugLogger.instance = new ActiveDebugLogger();
|
|
158
162
|
if (o) {
|
|
159
163
|
DebugLogger.instance.configure(o);
|
package/dist/index40.mjs
CHANGED
|
@@ -150,6 +150,10 @@ class DebugLogger {
|
|
|
150
150
|
return DebugLogger.instance;
|
|
151
151
|
}
|
|
152
152
|
static enable(o) {
|
|
153
|
+
if (o?.enabled === false) {
|
|
154
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
153
157
|
DebugLogger.instance = new ActiveDebugLogger();
|
|
154
158
|
if (o) {
|
|
155
159
|
DebugLogger.instance.configure(o);
|
package/dist/index49.js
CHANGED
package/dist/index49.mjs
CHANGED
package/dist/index50.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const dependencies = require('./index51.js');
|
|
6
|
-
const transversalWeaver = require('./
|
|
6
|
+
const transversalWeaver = require('./index32.js');
|
|
7
7
|
const helpers = require('./index31.js');
|
|
8
8
|
|
|
9
9
|
class InjectableBuilder {
|
package/dist/index50.mjs
CHANGED
package/dist/index51.js
CHANGED
|
@@ -10,8 +10,11 @@ const transversalManager = require('./index13.js');
|
|
|
10
10
|
|
|
11
11
|
const o = new WeakMap();
|
|
12
12
|
const c = (e, t)=>{
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (!e || typeof e !== 'object' || Array.isArray(e)) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
for (const [r, n] of Object.entries(e)){
|
|
17
|
+
if (n.includes(t)) {
|
|
15
18
|
return r;
|
|
16
19
|
}
|
|
17
20
|
}
|
|
@@ -19,13 +22,13 @@ const c = (e, t)=>{
|
|
|
19
22
|
};
|
|
20
23
|
const resolveInjectableParameters = (o, a)=>{
|
|
21
24
|
const i = [];
|
|
22
|
-
const l = reflection.getParamTypes(o.concrete);
|
|
23
|
-
const u = helpers.getDecoratedParametersIndexes(o.concrete);
|
|
25
|
+
const l = o.concrete ? reflection.getParamTypes(o.concrete) : [];
|
|
26
|
+
const u = o.concrete ? helpers.getDecoratedParametersIndexes(o.concrete) : [];
|
|
24
27
|
for(let e = 0; e < l.length; e++){
|
|
25
28
|
const t = c(u, e);
|
|
26
29
|
if (t) {
|
|
27
|
-
const
|
|
28
|
-
i.push(
|
|
30
|
+
const n = parameterResolver_factory.ParameterResolverFactory.getResolver(t);
|
|
31
|
+
i.push(n.resolve(e, o, o.concrete, a));
|
|
29
32
|
} else {
|
|
30
33
|
const t = l[e];
|
|
31
34
|
if (decorators.isTransversal(t)) {
|
|
@@ -50,21 +53,21 @@ const resolveDependencies = (r)=>{
|
|
|
50
53
|
if (o.has(r)) {
|
|
51
54
|
return o.get(r);
|
|
52
55
|
}
|
|
53
|
-
const
|
|
54
|
-
const
|
|
56
|
+
const n = [];
|
|
57
|
+
const s = reflection.getParamTypes(r);
|
|
55
58
|
const c = helpers.getDecoratedParametersIndexes(r);
|
|
56
59
|
let a = 0;
|
|
57
|
-
for (const e of
|
|
60
|
+
for (const e of s){
|
|
58
61
|
const t = Object.values(c).some((e)=>e.includes(a));
|
|
59
62
|
if (t) {
|
|
60
63
|
a++;
|
|
61
64
|
continue;
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
n.push(e);
|
|
64
67
|
a++;
|
|
65
68
|
}
|
|
66
|
-
o.set(r,
|
|
67
|
-
return
|
|
69
|
+
o.set(r, n);
|
|
70
|
+
return n;
|
|
68
71
|
};
|
|
69
72
|
|
|
70
73
|
exports.resolveDependencies = resolveDependencies;
|
package/dist/index51.mjs
CHANGED
|
@@ -6,8 +6,11 @@ import { TransversalManager } from './index13.mjs';
|
|
|
6
6
|
|
|
7
7
|
const o = new WeakMap();
|
|
8
8
|
const c = (e, t)=>{
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (!e || typeof e !== 'object' || Array.isArray(e)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
for (const [r, n] of Object.entries(e)){
|
|
13
|
+
if (n.includes(t)) {
|
|
11
14
|
return r;
|
|
12
15
|
}
|
|
13
16
|
}
|
|
@@ -15,13 +18,13 @@ const c = (e, t)=>{
|
|
|
15
18
|
};
|
|
16
19
|
const resolveInjectableParameters = (o, a)=>{
|
|
17
20
|
const i = [];
|
|
18
|
-
const l = getParamTypes(o.concrete);
|
|
19
|
-
const u = getDecoratedParametersIndexes(o.concrete);
|
|
21
|
+
const l = o.concrete ? getParamTypes(o.concrete) : [];
|
|
22
|
+
const u = o.concrete ? getDecoratedParametersIndexes(o.concrete) : [];
|
|
20
23
|
for(let e = 0; e < l.length; e++){
|
|
21
24
|
const t = c(u, e);
|
|
22
25
|
if (t) {
|
|
23
|
-
const
|
|
24
|
-
i.push(
|
|
26
|
+
const n = ParameterResolverFactory.getResolver(t);
|
|
27
|
+
i.push(n.resolve(e, o, o.concrete, a));
|
|
25
28
|
} else {
|
|
26
29
|
const t = l[e];
|
|
27
30
|
if (isTransversal(t)) {
|
|
@@ -46,21 +49,21 @@ const resolveDependencies = (r)=>{
|
|
|
46
49
|
if (o.has(r)) {
|
|
47
50
|
return o.get(r);
|
|
48
51
|
}
|
|
49
|
-
const
|
|
50
|
-
const
|
|
52
|
+
const n = [];
|
|
53
|
+
const s = getParamTypes(r);
|
|
51
54
|
const c = getDecoratedParametersIndexes(r);
|
|
52
55
|
let a = 0;
|
|
53
|
-
for (const e of
|
|
56
|
+
for (const e of s){
|
|
54
57
|
const t = Object.values(c).some((e)=>e.includes(a));
|
|
55
58
|
if (t) {
|
|
56
59
|
a++;
|
|
57
60
|
continue;
|
|
58
61
|
}
|
|
59
|
-
|
|
62
|
+
n.push(e);
|
|
60
63
|
a++;
|
|
61
64
|
}
|
|
62
|
-
o.set(r,
|
|
63
|
-
return
|
|
65
|
+
o.set(r, n);
|
|
66
|
+
return n;
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
export { resolveDependencies, resolveInjectableParameters };
|
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.
|
|
4
|
+
"version": "1.1.17",
|
|
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",
|