assemblerjs 1.1.15 → 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 +5 -0
- 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/index27.js +1 -1
- package/dist/index27.mjs +1 -1
- package/dist/index31.js +38 -20
- package/dist/index31.mjs +37 -20
- package/dist/index32.js +93 -142
- package/dist/index32.mjs +93 -142
- package/dist/index33.js +23 -45
- package/dist/index33.mjs +23 -45
- package/dist/index34.js +16 -73
- package/dist/index34.mjs +16 -73
- package/dist/index35.js +156 -42
- package/dist/index35.mjs +155 -42
- package/dist/index36.js +47 -28
- package/dist/index36.mjs +47 -28
- package/dist/index37.js +66 -149
- package/dist/index37.mjs +66 -149
- package/dist/index38.js +48 -98
- package/dist/index38.mjs +48 -98
- package/dist/index39.js +29 -26
- package/dist/index39.mjs +29 -26
- package/dist/index4.js +11 -6
- package/dist/index4.mjs +11 -6
- package/dist/index40.js +158 -32
- package/dist/index40.mjs +158 -31
- package/dist/index41.js +61 -46
- package/dist/index41.mjs +61 -46
- package/dist/index42.js +44 -18
- package/dist/index42.mjs +44 -17
- package/dist/index43.js +22 -28
- package/dist/index43.mjs +21 -27
- package/dist/index44.js +940 -192
- package/dist/index44.mjs +940 -192
- package/dist/index45.js +2 -942
- package/dist/index45.mjs +2 -942
- package/dist/index46.js +2 -2
- package/dist/index46.mjs +2 -2
- package/dist/index47.js +29 -2
- package/dist/index47.mjs +28 -2
- package/dist/index48.js +189 -9
- package/dist/index48.mjs +189 -9
- package/dist/index49.js +9 -34
- package/dist/index49.mjs +9 -34
- package/dist/index50.js +32 -59
- package/dist/index50.mjs +32 -58
- package/dist/index51.js +74 -0
- package/dist/index51.mjs +69 -0
- package/package.json +1 -1
package/dist/index32.mjs
CHANGED
|
@@ -1,156 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DebugLogger } from './index37.mjs';
|
|
4
|
-
import { isClass } from '@assemblerjs/core';
|
|
5
|
-
import { resolveInstanceInjectionTuple } from './index42.mjs';
|
|
6
|
-
import { resolveInjectionTuple } from './index41.mjs';
|
|
7
|
-
import { Injectable } from './index44.mjs';
|
|
1
|
+
import { TransversalManager } from './index13.mjs';
|
|
2
|
+
import { getAffectedMethods } from './index12.mjs';
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
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;
|
|
16
21
|
}
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (t.length > 100) {
|
|
34
|
-
return t.substring(0, 100) + '...';
|
|
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
|
+
};
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
} catch {
|
|
38
|
-
return '[UnknownObject]';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return String(e);
|
|
42
|
-
}
|
|
43
|
-
function f(e) {
|
|
44
|
-
if (isClass(e)) {
|
|
45
|
-
const t = e.prototype && Object.getOwnPropertyNames(e.prototype).length > 1;
|
|
46
|
-
return t ? 'class' : 'class';
|
|
47
|
-
}
|
|
48
|
-
if (typeof e === 'function') return 'function';
|
|
49
|
-
if (typeof e === 'string') return 'string';
|
|
50
|
-
if (typeof e === 'symbol') return 'symbol';
|
|
51
|
-
if (typeof e === 'object' && e !== null) return 'object';
|
|
52
|
-
return 'unknown';
|
|
53
|
-
}
|
|
54
|
-
class InjectableManager {
|
|
55
|
-
setContexts(e, t) {
|
|
56
|
-
this.privateContext = e;
|
|
57
|
-
this.publicContext = t;
|
|
58
|
-
}
|
|
59
|
-
register(i, s = false) {
|
|
60
|
-
const c = DebugLogger.getInstance();
|
|
61
|
-
const a = s === true ? resolveInstanceInjectionTuple(i) : resolveInjectionTuple(i);
|
|
62
|
-
if (this.has(a.identifier)) {
|
|
63
|
-
const e = `An assemblage is already registered with identifier '${a.identifier.name}'.`;
|
|
64
|
-
c.log('error', 'Duplicate registration', {
|
|
65
|
-
identifier: a.identifier.name,
|
|
66
|
-
error: e
|
|
67
|
-
});
|
|
68
|
-
throw new Error(e);
|
|
69
|
-
}
|
|
70
|
-
const f = Injectable.of(a, this.privateContext, this.publicContext);
|
|
71
|
-
c.logRegistration(f);
|
|
72
|
-
this.injectables.set(f.identifier, f);
|
|
73
|
-
if (f.concrete) {
|
|
74
|
-
HookManager.callHook(f.concrete, 'onRegister', this.publicContext, f.configuration);
|
|
75
|
-
}
|
|
76
|
-
return f;
|
|
77
|
-
}
|
|
78
|
-
has(e) {
|
|
79
|
-
return this.injectables.has(e);
|
|
39
|
+
});
|
|
80
40
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
identifier: s,
|
|
93
|
-
caller: n ? a(n) : 'unknown',
|
|
94
|
-
type: c,
|
|
95
|
-
error: d
|
|
96
|
-
};
|
|
97
|
-
if (u !== undefined) {
|
|
98
|
-
p.paramIndex = u;
|
|
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);
|
|
99
52
|
}
|
|
100
|
-
|
|
101
|
-
|
|
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);
|
|
102
58
|
}
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
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
|
+
});
|
|
106
73
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return this.singletonStrategy.resolve(r, t);
|
|
115
|
-
} else {
|
|
116
|
-
return this.transientStrategy.resolve(r, t);
|
|
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);
|
|
117
81
|
}
|
|
118
|
-
|
|
119
|
-
|
|
82
|
+
return t;
|
|
83
|
+
} catch (t) {
|
|
84
|
+
o.error = t;
|
|
85
|
+
throw t;
|
|
120
86
|
}
|
|
121
87
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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);
|
|
132
101
|
}
|
|
133
|
-
}
|
|
134
|
-
return
|
|
135
|
-
}
|
|
136
|
-
dispose() {
|
|
137
|
-
for (const [e, t] of this.injectables){
|
|
138
|
-
t.dispose();
|
|
139
|
-
}
|
|
140
|
-
this.resolvingStack.clear();
|
|
141
|
-
}
|
|
142
|
-
get size() {
|
|
143
|
-
return this.injectables.size;
|
|
144
|
-
}
|
|
145
|
-
getRegisteredIdentifiers() {
|
|
146
|
-
return Array.from(this.injectables.keys()).map((e)=>e?.name || String(e));
|
|
147
|
-
}
|
|
148
|
-
constructor(){
|
|
149
|
-
this.injectables = new Map();
|
|
150
|
-
this.resolvingStack = new Set();
|
|
151
|
-
this.singletonStrategy = new SingletonStrategy();
|
|
152
|
-
this.transientStrategy = new TransientStrategy();
|
|
102
|
+
};
|
|
103
|
+
return s();
|
|
153
104
|
}
|
|
154
105
|
}
|
|
155
106
|
|
|
156
|
-
export {
|
|
107
|
+
export { TransversalWeaver };
|
package/dist/index33.js
CHANGED
|
@@ -2,55 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
class ObjectManager {
|
|
11
|
-
use(r, o) {
|
|
12
|
-
if (this.has(r)) {
|
|
13
|
-
const o = typeof r === 'symbol' ? r.toString() : String(r);
|
|
14
|
-
const s = `Object/value '${o}' is already registered (cannot register twice).`;
|
|
15
|
-
debugLogger.DebugLogger.getInstance().log('error', 'Duplicate object/value registration', {
|
|
16
|
-
identifier: o,
|
|
17
|
-
type: t(r),
|
|
18
|
-
error: s
|
|
19
|
-
});
|
|
20
|
-
throw new Error(s);
|
|
5
|
+
class PointcutMatcher {
|
|
6
|
+
static parse(t) {
|
|
7
|
+
const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
|
|
8
|
+
if (!e) {
|
|
9
|
+
throw new Error(`Invalid pointcut expression: ${t}`);
|
|
21
10
|
}
|
|
22
|
-
|
|
23
|
-
return
|
|
11
|
+
const [, c, r] = e;
|
|
12
|
+
return new ExecutionPointcutMatcher(c, r);
|
|
24
13
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const s = `Object/value '${o}' has not been registered in the object store.`;
|
|
32
|
-
debugLogger.DebugLogger.getInstance().log('error', 'Object/value not found', {
|
|
33
|
-
identifier: o,
|
|
34
|
-
type: t(r),
|
|
35
|
-
error: s
|
|
36
|
-
});
|
|
37
|
-
throw new Error(s);
|
|
38
|
-
}
|
|
39
|
-
return this.objects.get(r);
|
|
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);
|
|
40
20
|
}
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
|
|
21
|
+
patternToRegex(t) {
|
|
22
|
+
if (t === '*') {
|
|
23
|
+
return /.*/;
|
|
44
24
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
global(e) {
|
|
48
|
-
return this.globals.get(e);
|
|
25
|
+
const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
26
|
+
return new RegExp(`^${e}$`);
|
|
49
27
|
}
|
|
50
|
-
constructor(){
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
28
|
+
constructor(t, e){
|
|
29
|
+
this.classRegex = this.patternToRegex(t);
|
|
30
|
+
this.methodRegex = this.patternToRegex(e);
|
|
53
31
|
}
|
|
54
|
-
}
|
|
32
|
+
};
|
|
55
33
|
|
|
56
|
-
exports.
|
|
34
|
+
exports.PointcutMatcher = PointcutMatcher;
|
package/dist/index33.mjs
CHANGED
|
@@ -1,52 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
class ObjectManager {
|
|
7
|
-
use(r, o) {
|
|
8
|
-
if (this.has(r)) {
|
|
9
|
-
const o = typeof r === 'symbol' ? r.toString() : String(r);
|
|
10
|
-
const s = `Object/value '${o}' is already registered (cannot register twice).`;
|
|
11
|
-
DebugLogger.getInstance().log('error', 'Duplicate object/value registration', {
|
|
12
|
-
identifier: o,
|
|
13
|
-
type: t(r),
|
|
14
|
-
error: s
|
|
15
|
-
});
|
|
16
|
-
throw new Error(s);
|
|
1
|
+
class PointcutMatcher {
|
|
2
|
+
static parse(t) {
|
|
3
|
+
const e = t.match(/^execution\(([^.]+)\.([^)]+)\)$/);
|
|
4
|
+
if (!e) {
|
|
5
|
+
throw new Error(`Invalid pointcut expression: ${t}`);
|
|
17
6
|
}
|
|
18
|
-
|
|
19
|
-
return
|
|
7
|
+
const [, c, r] = e;
|
|
8
|
+
return new ExecutionPointcutMatcher(c, r);
|
|
20
9
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const s = `Object/value '${o}' has not been registered in the object store.`;
|
|
28
|
-
DebugLogger.getInstance().log('error', 'Object/value not found', {
|
|
29
|
-
identifier: o,
|
|
30
|
-
type: t(r),
|
|
31
|
-
error: s
|
|
32
|
-
});
|
|
33
|
-
throw new Error(s);
|
|
34
|
-
}
|
|
35
|
-
return this.objects.get(r);
|
|
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);
|
|
36
16
|
}
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
17
|
+
patternToRegex(t) {
|
|
18
|
+
if (t === '*') {
|
|
19
|
+
return /.*/;
|
|
40
20
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
global(e) {
|
|
44
|
-
return this.globals.get(e);
|
|
21
|
+
const e = t.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
22
|
+
return new RegExp(`^${e}$`);
|
|
45
23
|
}
|
|
46
|
-
constructor(){
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
24
|
+
constructor(t, e){
|
|
25
|
+
this.classRegex = this.patternToRegex(t);
|
|
26
|
+
this.methodRegex = this.patternToRegex(e);
|
|
49
27
|
}
|
|
50
|
-
}
|
|
28
|
+
};
|
|
51
29
|
|
|
52
|
-
export {
|
|
30
|
+
export { PointcutMatcher };
|
package/dist/index34.js
CHANGED
|
@@ -2,84 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class HookManager {
|
|
9
|
-
prepareInitHook(o, t) {
|
|
10
|
-
this.initCache.push({
|
|
11
|
-
instance: o,
|
|
12
|
-
configuration: t
|
|
13
|
-
});
|
|
14
|
-
return this.initCache;
|
|
15
|
-
}
|
|
16
|
-
callInitHooks(o) {
|
|
17
|
-
for (const t of this.initCache){
|
|
18
|
-
HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
|
|
19
|
-
}
|
|
5
|
+
class ResolverStore {
|
|
6
|
+
static register(e, r) {
|
|
7
|
+
this.resolvers.set(e, r);
|
|
20
8
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
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}`);
|
|
26
13
|
}
|
|
14
|
+
return new r();
|
|
27
15
|
}
|
|
28
|
-
|
|
29
|
-
this.
|
|
16
|
+
static hasResolver(e) {
|
|
17
|
+
return this.resolvers.has(e);
|
|
30
18
|
}
|
|
31
|
-
|
|
32
|
-
return this.
|
|
19
|
+
static getRegisteredTypes() {
|
|
20
|
+
return Array.from(this.resolvers.keys());
|
|
33
21
|
}
|
|
34
|
-
|
|
35
|
-
this.
|
|
22
|
+
static clear() {
|
|
23
|
+
this.resolvers.clear();
|
|
36
24
|
}
|
|
37
25
|
}
|
|
38
|
-
|
|
39
|
-
const c = debugLogger.DebugLogger.getInstance();
|
|
40
|
-
const r = c.logHook(i, e, a);
|
|
41
|
-
return new Promise((t, c)=>{
|
|
42
|
-
const s = e[i];
|
|
43
|
-
if (s) {
|
|
44
|
-
if (core.isAsync(s)) {
|
|
45
|
-
s.bind(e)(n, a).then(()=>{
|
|
46
|
-
if (r) r();
|
|
47
|
-
t();
|
|
48
|
-
}).catch((o)=>{
|
|
49
|
-
if (r) r();
|
|
50
|
-
c(o);
|
|
51
|
-
});
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
s.bind(e)(n, a);
|
|
56
|
-
if (r) r();
|
|
57
|
-
t();
|
|
58
|
-
} catch (o) {
|
|
59
|
-
if (r) r();
|
|
60
|
-
c(o);
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
if (r) r();
|
|
64
|
-
t();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
HookManager.callHookImmediate = (e, i, n, a)=>{
|
|
69
|
-
const c = debugLogger.DebugLogger.getInstance();
|
|
70
|
-
const r = c.logHook(i, e, a);
|
|
71
|
-
const s = e[i];
|
|
72
|
-
if (s) {
|
|
73
|
-
if (core.isAsync(s)) {
|
|
74
|
-
s.bind(e)(n, a).catch(()=>{});
|
|
75
|
-
if (r) r();
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
s.bind(e)(n, a);
|
|
79
|
-
if (r) r();
|
|
80
|
-
} else {
|
|
81
|
-
if (r) r();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
26
|
+
ResolverStore.resolvers = new Map();
|
|
84
27
|
|
|
85
|
-
exports.
|
|
28
|
+
exports.ResolverStore = ResolverStore;
|
package/dist/index34.mjs
CHANGED
|
@@ -1,81 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class HookManager {
|
|
5
|
-
prepareInitHook(o, t) {
|
|
6
|
-
this.initCache.push({
|
|
7
|
-
instance: o,
|
|
8
|
-
configuration: t
|
|
9
|
-
});
|
|
10
|
-
return this.initCache;
|
|
11
|
-
}
|
|
12
|
-
callInitHooks(o) {
|
|
13
|
-
for (const t of this.initCache){
|
|
14
|
-
HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
|
|
15
|
-
}
|
|
1
|
+
class ResolverStore {
|
|
2
|
+
static register(e, r) {
|
|
3
|
+
this.resolvers.set(e, r);
|
|
16
4
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
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}`);
|
|
22
9
|
}
|
|
10
|
+
return new r();
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
this.
|
|
12
|
+
static hasResolver(e) {
|
|
13
|
+
return this.resolvers.has(e);
|
|
26
14
|
}
|
|
27
|
-
|
|
28
|
-
return this.
|
|
15
|
+
static getRegisteredTypes() {
|
|
16
|
+
return Array.from(this.resolvers.keys());
|
|
29
17
|
}
|
|
30
|
-
|
|
31
|
-
this.
|
|
18
|
+
static clear() {
|
|
19
|
+
this.resolvers.clear();
|
|
32
20
|
}
|
|
33
21
|
}
|
|
34
|
-
|
|
35
|
-
const c = DebugLogger.getInstance();
|
|
36
|
-
const r = c.logHook(i, e, a);
|
|
37
|
-
return new Promise((t, c)=>{
|
|
38
|
-
const s = e[i];
|
|
39
|
-
if (s) {
|
|
40
|
-
if (isAsync(s)) {
|
|
41
|
-
s.bind(e)(n, a).then(()=>{
|
|
42
|
-
if (r) r();
|
|
43
|
-
t();
|
|
44
|
-
}).catch((o)=>{
|
|
45
|
-
if (r) r();
|
|
46
|
-
c(o);
|
|
47
|
-
});
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
s.bind(e)(n, a);
|
|
52
|
-
if (r) r();
|
|
53
|
-
t();
|
|
54
|
-
} catch (o) {
|
|
55
|
-
if (r) r();
|
|
56
|
-
c(o);
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
if (r) r();
|
|
60
|
-
t();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
HookManager.callHookImmediate = (e, i, n, a)=>{
|
|
65
|
-
const c = DebugLogger.getInstance();
|
|
66
|
-
const r = c.logHook(i, e, a);
|
|
67
|
-
const s = e[i];
|
|
68
|
-
if (s) {
|
|
69
|
-
if (isAsync(s)) {
|
|
70
|
-
s.bind(e)(n, a).catch(()=>{});
|
|
71
|
-
if (r) r();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
s.bind(e)(n, a);
|
|
75
|
-
if (r) r();
|
|
76
|
-
} else {
|
|
77
|
-
if (r) r();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
22
|
+
ResolverStore.resolvers = new Map();
|
|
80
23
|
|
|
81
|
-
export {
|
|
24
|
+
export { ResolverStore };
|