assemblerjs 1.1.4 → 1.1.5
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/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/index31.js +8 -3
- package/dist/index31.mjs +8 -3
- package/dist/index32.js +21 -9
- package/dist/index32.mjs +21 -9
- package/dist/index38.js +101 -18
- package/dist/index38.mjs +101 -18
- package/dist/index39.js +24 -101
- package/dist/index39.mjs +24 -101
- package/dist/index40.js +18 -24
- package/dist/index40.mjs +18 -24
- package/dist/index48.js +1 -1
- package/dist/index48.mjs +1 -1
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/package.json +1 -1
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('./index39.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('./index40.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('./index40.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('./index40.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('./index40.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('./index40.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 './index40.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('./index40.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 './index40.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('./index40.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 './index40.mjs';
|
|
5
5
|
|
|
6
6
|
let OptionalResolver = class OptionalResolver {
|
|
7
7
|
resolve(o, t, n) {
|
package/dist/index31.js
CHANGED
|
@@ -14,11 +14,16 @@ class InjectableManager {
|
|
|
14
14
|
this.privateContext = e;
|
|
15
15
|
this.publicContext = t;
|
|
16
16
|
}
|
|
17
|
-
register(
|
|
17
|
+
register(n, s = false) {
|
|
18
18
|
const a = debugLogger.DebugLogger.getInstance();
|
|
19
|
-
const c =
|
|
19
|
+
const c = s === true ? use.resolveInstanceInjectionTuple(n) : inject.resolveInjectionTuple(n);
|
|
20
20
|
if (this.has(c.identifier)) {
|
|
21
|
-
|
|
21
|
+
const e = `An assemblage is already registered with identifier '${c.identifier.name}'.`;
|
|
22
|
+
a.log('error', 'Duplicate registration', {
|
|
23
|
+
identifier: c.identifier.name,
|
|
24
|
+
error: e
|
|
25
|
+
});
|
|
26
|
+
throw new Error(e);
|
|
22
27
|
}
|
|
23
28
|
const l = injectable.Injectable.of(c, this.privateContext, this.publicContext);
|
|
24
29
|
a.logRegistration(l);
|
package/dist/index31.mjs
CHANGED
|
@@ -10,11 +10,16 @@ class InjectableManager {
|
|
|
10
10
|
this.privateContext = e;
|
|
11
11
|
this.publicContext = t;
|
|
12
12
|
}
|
|
13
|
-
register(
|
|
13
|
+
register(n, s = false) {
|
|
14
14
|
const a = DebugLogger.getInstance();
|
|
15
|
-
const c =
|
|
15
|
+
const c = s === true ? resolveInstanceInjectionTuple(n) : resolveInjectionTuple(n);
|
|
16
16
|
if (this.has(c.identifier)) {
|
|
17
|
-
|
|
17
|
+
const e = `An assemblage is already registered with identifier '${c.identifier.name}'.`;
|
|
18
|
+
a.log('error', 'Duplicate registration', {
|
|
19
|
+
identifier: c.identifier.name,
|
|
20
|
+
error: e
|
|
21
|
+
});
|
|
22
|
+
throw new Error(e);
|
|
18
23
|
}
|
|
19
24
|
const l = Injectable.of(c, this.privateContext, this.publicContext);
|
|
20
25
|
a.logRegistration(l);
|
package/dist/index32.js
CHANGED
|
@@ -2,22 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
+
const debugLogger = require('./index36.js');
|
|
6
|
+
|
|
5
7
|
class ObjectManager {
|
|
6
|
-
use(
|
|
7
|
-
if (this.has(
|
|
8
|
-
|
|
8
|
+
use(t, r) {
|
|
9
|
+
if (this.has(t)) {
|
|
10
|
+
const r = `A value is already registered with identifier '${String(t)}'.`;
|
|
11
|
+
debugLogger.DebugLogger.getInstance().log('error', 'Duplicate object registration', {
|
|
12
|
+
identifier: String(t),
|
|
13
|
+
error: r
|
|
14
|
+
});
|
|
15
|
+
throw new Error(r);
|
|
9
16
|
}
|
|
10
|
-
this.objects.set(
|
|
11
|
-
return
|
|
17
|
+
this.objects.set(t, r);
|
|
18
|
+
return r;
|
|
12
19
|
}
|
|
13
20
|
has(e) {
|
|
14
21
|
return this.objects.has(e);
|
|
15
22
|
}
|
|
16
|
-
require(
|
|
17
|
-
if (!this.objects.has(
|
|
18
|
-
|
|
23
|
+
require(t) {
|
|
24
|
+
if (!this.objects.has(t)) {
|
|
25
|
+
const r = `Injected object with identifier '${String(t)}' has not been registered.`;
|
|
26
|
+
debugLogger.DebugLogger.getInstance().log('error', 'Object not found', {
|
|
27
|
+
identifier: String(t),
|
|
28
|
+
error: r
|
|
29
|
+
});
|
|
30
|
+
throw new Error(r);
|
|
19
31
|
}
|
|
20
|
-
return this.objects.get(
|
|
32
|
+
return this.objects.get(t);
|
|
21
33
|
}
|
|
22
34
|
addGlobal(e, t) {
|
|
23
35
|
if (this.globals.has(e)) {
|
package/dist/index32.mjs
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
+
import { DebugLogger } from './index36.mjs';
|
|
2
|
+
|
|
1
3
|
class ObjectManager {
|
|
2
|
-
use(
|
|
3
|
-
if (this.has(
|
|
4
|
-
|
|
4
|
+
use(t, r) {
|
|
5
|
+
if (this.has(t)) {
|
|
6
|
+
const r = `A value is already registered with identifier '${String(t)}'.`;
|
|
7
|
+
DebugLogger.getInstance().log('error', 'Duplicate object registration', {
|
|
8
|
+
identifier: String(t),
|
|
9
|
+
error: r
|
|
10
|
+
});
|
|
11
|
+
throw new Error(r);
|
|
5
12
|
}
|
|
6
|
-
this.objects.set(
|
|
7
|
-
return
|
|
13
|
+
this.objects.set(t, r);
|
|
14
|
+
return r;
|
|
8
15
|
}
|
|
9
16
|
has(e) {
|
|
10
17
|
return this.objects.has(e);
|
|
11
18
|
}
|
|
12
|
-
require(
|
|
13
|
-
if (!this.objects.has(
|
|
14
|
-
|
|
19
|
+
require(t) {
|
|
20
|
+
if (!this.objects.has(t)) {
|
|
21
|
+
const r = `Injected object with identifier '${String(t)}' has not been registered.`;
|
|
22
|
+
DebugLogger.getInstance().log('error', 'Object not found', {
|
|
23
|
+
identifier: String(t),
|
|
24
|
+
error: r
|
|
25
|
+
});
|
|
26
|
+
throw new Error(r);
|
|
15
27
|
}
|
|
16
|
-
return this.objects.get(
|
|
28
|
+
return this.objects.get(t);
|
|
17
29
|
}
|
|
18
30
|
addGlobal(e, t) {
|
|
19
31
|
if (this.globals.has(e)) {
|
package/dist/index38.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/index38.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/index39.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/index39.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/index40.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/index40.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/index48.js
CHANGED
package/dist/index48.mjs
CHANGED
package/dist/index49.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const dependencies = require('./index50.js');
|
|
6
|
-
const transversalWeaver = require('./
|
|
6
|
+
const transversalWeaver = require('./index38.js');
|
|
7
7
|
const helpers = require('./index37.js');
|
|
8
8
|
|
|
9
9
|
class InjectableBuilder {
|
package/dist/index49.mjs
CHANGED
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.5",
|
|
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",
|