assemblerjs 1.1.24 → 1.1.26
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/README.md +1 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +15 -13
- package/dist/index.mjs +14 -13
- package/dist/index11.js +3 -3
- package/dist/index11.mjs +3 -3
- package/dist/index12.js +2 -2
- package/dist/index12.mjs +2 -2
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- package/dist/index14.js +168 -3
- package/dist/index14.mjs +168 -3
- package/dist/index15.js +4 -22
- package/dist/index15.mjs +4 -22
- package/dist/index16.js +20 -9
- package/dist/index16.mjs +20 -9
- package/dist/index17.js +9 -87
- package/dist/index17.mjs +9 -87
- package/dist/index18.js +88 -16
- package/dist/index18.mjs +88 -16
- package/dist/index19.js +10 -10
- package/dist/index19.mjs +10 -10
- package/dist/index2.js +3 -3
- package/dist/index2.mjs +3 -3
- package/dist/index20.js +10 -10
- package/dist/index20.mjs +10 -10
- package/dist/index21.js +10 -10
- package/dist/index21.mjs +10 -10
- package/dist/index22.js +11 -26
- package/dist/index22.mjs +11 -25
- package/dist/index23.js +22 -22
- package/dist/index23.mjs +21 -21
- package/dist/index24.js +25 -19
- package/dist/index24.mjs +24 -19
- package/dist/index25.js +23 -25
- package/dist/index25.mjs +23 -21
- package/dist/index26.js +26 -46
- package/dist/index26.mjs +22 -45
- package/dist/index27.js +50 -2
- package/dist/index27.mjs +47 -2
- package/dist/index28.js +2 -19
- package/dist/index28.mjs +2 -15
- package/dist/index29.js +17 -159
- package/dist/index29.mjs +15 -158
- package/dist/index3.js +2 -2
- package/dist/index3.mjs +2 -2
- package/dist/index30.js +17 -50
- package/dist/index30.mjs +14 -50
- package/dist/index31.js +99 -71
- package/dist/index31.mjs +97 -71
- package/dist/index32.js +154 -51
- package/dist/index32.mjs +153 -51
- package/dist/index33.js +47 -28
- package/dist/index33.mjs +47 -28
- package/dist/index34.js +65 -161
- package/dist/index34.mjs +65 -161
- package/dist/index35.js +50 -58
- package/dist/index35.mjs +50 -58
- package/dist/index36.js +32 -18
- package/dist/index36.mjs +32 -15
- package/dist/index37.js +169 -16
- package/dist/index37.mjs +169 -16
- package/dist/index38.js +56 -100
- package/dist/index38.mjs +56 -98
- package/dist/index4.js +7 -7
- package/dist/index4.mjs +7 -7
- package/dist/index40.js +17 -118
- package/dist/index40.mjs +17 -118
- 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 +5 -5
- package/dist/index45.mjs +5 -5
- 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 +2 -2
- package/dist/index51.mjs +2 -2
- package/package.json +1 -1
package/dist/index34.mjs
CHANGED
|
@@ -1,177 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return 'AnonymousFunction';
|
|
10
|
-
}
|
|
11
|
-
if (typeof e === 'object') {
|
|
12
|
-
const o = e.constructor?.name;
|
|
13
|
-
if (o && o !== 'Object') {
|
|
14
|
-
return o;
|
|
15
|
-
}
|
|
16
|
-
if (e.name && typeof e.name === 'string') {
|
|
17
|
-
return e.name;
|
|
18
|
-
}
|
|
19
|
-
return '[Object]';
|
|
20
|
-
}
|
|
21
|
-
return String(e);
|
|
22
|
-
}
|
|
23
|
-
let NoOpDebugLogger = class NoOpDebugLogger {
|
|
24
|
-
configure(e) {}
|
|
25
|
-
log(e, o, t) {}
|
|
26
|
-
logBuildStart(e) {}
|
|
27
|
-
logBuildEnd(e, o) {}
|
|
28
|
-
logRegistration(e) {}
|
|
29
|
-
logHook(e, o, t) {}
|
|
30
|
-
logPhaseStart(e, o) {}
|
|
31
|
-
logPhaseEnd(e, o, t) {}
|
|
32
|
-
logResolution(e, o, t) {}
|
|
33
|
-
logConstruction(e) {}
|
|
34
|
-
logInjection(e, o) {}
|
|
35
|
-
};
|
|
36
|
-
let ActiveDebugLogger = class ActiveDebugLogger {
|
|
37
|
-
configure(e) {
|
|
38
|
-
this.options = {
|
|
39
|
-
...this.options,
|
|
40
|
-
...e,
|
|
41
|
-
logPhases: {
|
|
42
|
-
...this.options.logPhases,
|
|
43
|
-
...e.logPhases || {}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
logBuildStart(e) {
|
|
48
|
-
this.log('info', 'Build started', {
|
|
49
|
-
entry: e.name
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
logBuildEnd(e, o) {
|
|
53
|
-
const t = {
|
|
54
|
-
entry: e.name
|
|
55
|
-
};
|
|
56
|
-
if (o !== undefined) t.duration = `${o.toFixed(2)}ms`;
|
|
57
|
-
this.log('info', 'Build completed', t);
|
|
58
|
-
}
|
|
59
|
-
logRegistration(o) {
|
|
60
|
-
if (!this.shouldLog('registration')) return;
|
|
61
|
-
this.log('info', 'Registration', {
|
|
62
|
-
identifier: e(o.identifier),
|
|
63
|
-
isSingleton: o.isSingleton,
|
|
64
|
-
dependencies: o.dependencies.map((o)=>e(o)),
|
|
65
|
-
tags: o.tags
|
|
1
|
+
import { isAsync } from '@assemblerjs/core';
|
|
2
|
+
import { DebugLogger } from './index37.mjs';
|
|
3
|
+
|
|
4
|
+
class HookManager {
|
|
5
|
+
prepareInitHook(o, t) {
|
|
6
|
+
this.initCache.push({
|
|
7
|
+
instance: o,
|
|
8
|
+
configuration: t
|
|
66
9
|
});
|
|
10
|
+
return this.initCache;
|
|
67
11
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.log('info', `Hook: ${o}`, {
|
|
72
|
-
target: e(t),
|
|
73
|
-
config: n
|
|
74
|
-
});
|
|
75
|
-
if (this.options.logTimings) {
|
|
76
|
-
return ()=>{
|
|
77
|
-
const e = performance.now() - i;
|
|
78
|
-
this.log('info', `Hook: ${o} completed`, {
|
|
79
|
-
duration: `${e.toFixed(2)}ms`
|
|
80
|
-
});
|
|
81
|
-
};
|
|
12
|
+
callInitHooks(o) {
|
|
13
|
+
for (const t of this.initCache){
|
|
14
|
+
HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
|
|
82
15
|
}
|
|
83
16
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
duration: `${o.toFixed(2)}ms`
|
|
90
|
-
} : {};
|
|
91
|
-
if (t) {
|
|
92
|
-
Object.assign(n, t);
|
|
17
|
+
callInitedHooks(o) {
|
|
18
|
+
for (const t of [
|
|
19
|
+
...this.initCache
|
|
20
|
+
].reverse()){
|
|
21
|
+
HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
|
|
93
22
|
}
|
|
94
|
-
this.log('info', `Phase: ${e} ended`, Object.keys(n).length > 0 ? n : undefined);
|
|
95
23
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
this.log('info', `Resolving: ${e}`, {
|
|
99
|
-
strategy: `${o} strategy`,
|
|
100
|
-
cache: t ? 'hit' : 'miss'
|
|
101
|
-
});
|
|
24
|
+
clearCache() {
|
|
25
|
+
this.initCache.length = 0;
|
|
102
26
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.log('info', `Constructing: ${e}`);
|
|
27
|
+
getCache() {
|
|
28
|
+
return this.initCache;
|
|
106
29
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.log('info', `Injecting: @${e === 'use' ? 'Use' : 'Global'}`, o);
|
|
110
|
-
}
|
|
111
|
-
shouldLog(e) {
|
|
112
|
-
return !this.options.logPhases || this.options.logPhases[e] !== false;
|
|
30
|
+
constructor(){
|
|
31
|
+
this.initCache = [];
|
|
113
32
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
33
|
+
}
|
|
34
|
+
HookManager.callHook = (e, i, n, a)=>{
|
|
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);
|
|
124
57
|
}
|
|
58
|
+
} else {
|
|
59
|
+
if (r) r();
|
|
60
|
+
t();
|
|
125
61
|
}
|
|
126
|
-
}
|
|
127
|
-
colorize(e, o) {
|
|
128
|
-
const t = {
|
|
129
|
-
info: '\x1b[36m',
|
|
130
|
-
warn: '\x1b[33m',
|
|
131
|
-
error: '\x1b[31m',
|
|
132
|
-
reset: '\x1b[0m'
|
|
133
|
-
};
|
|
134
|
-
const n = t[e] || t.info;
|
|
135
|
-
return `${n}${o}${t.reset}`;
|
|
136
|
-
}
|
|
137
|
-
constructor(){
|
|
138
|
-
this.options = {
|
|
139
|
-
enabled: true,
|
|
140
|
-
logPhases: {
|
|
141
|
-
registration: true,
|
|
142
|
-
registrationUse: true,
|
|
143
|
-
registrationGlobals: true,
|
|
144
|
-
resolution: true,
|
|
145
|
-
construction: true,
|
|
146
|
-
hooks: true,
|
|
147
|
-
cache: true,
|
|
148
|
-
injectionUse: true,
|
|
149
|
-
injectionGlobal: true
|
|
150
|
-
},
|
|
151
|
-
logTimings: false,
|
|
152
|
-
logDependencyTree: true,
|
|
153
|
-
useColors: true
|
|
154
|
-
};
|
|
155
|
-
}
|
|
62
|
+
});
|
|
156
63
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (
|
|
163
|
-
|
|
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();
|
|
164
72
|
return;
|
|
165
73
|
}
|
|
166
|
-
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
static disable() {
|
|
172
|
-
DebugLogger.instance = new NoOpDebugLogger();
|
|
74
|
+
s.bind(e)(n, a);
|
|
75
|
+
if (r) r();
|
|
76
|
+
} else {
|
|
77
|
+
if (r) r();
|
|
173
78
|
}
|
|
174
|
-
}
|
|
175
|
-
DebugLogger.instance = new NoOpDebugLogger();
|
|
79
|
+
};
|
|
176
80
|
|
|
177
|
-
export {
|
|
81
|
+
export { HookManager };
|
package/dist/index35.js
CHANGED
|
@@ -2,68 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
const hookManager = require('./index34.js');
|
|
6
|
+
const debugLogger = require('./index37.js');
|
|
7
|
+
const cycleDetector = require('./index38.js');
|
|
8
|
+
const injectableManager = require('./index32.js');
|
|
9
|
+
const schema = require('./index31.js');
|
|
10
|
+
|
|
11
|
+
class AssemblerBuilder {
|
|
12
|
+
build(n, r) {
|
|
13
|
+
const i = debugLogger.DebugLogger.getInstance();
|
|
14
|
+
schema.setDefinitionValue('singleton', true, n);
|
|
15
|
+
i.logPhaseStart('registration');
|
|
16
|
+
const l = this.assembler.register([
|
|
17
|
+
n
|
|
18
|
+
]);
|
|
19
|
+
const c = this.assembler.injectableManager.getRegisteredIdentifiers();
|
|
20
|
+
i.logPhaseEnd('registration', undefined, {
|
|
21
|
+
registered: c
|
|
22
|
+
});
|
|
23
|
+
const h = cycleDetector.CycleDetector.getInstance().detect(this.assembler.injectableManager.getInjectables(), (e)=>injectableManager.formatIdentifier(e));
|
|
24
|
+
if (h.length > 0) {
|
|
25
|
+
for (const e of h){
|
|
26
|
+
i.log('error', 'Circular dependency detected', {
|
|
27
|
+
cycle: e.cycle,
|
|
28
|
+
path: e.path
|
|
29
|
+
});
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (s.has(e)) {
|
|
39
|
-
return false;
|
|
32
|
+
i.logPhaseStart('resolution');
|
|
33
|
+
const g = this.assembler.require(l.identifier, r);
|
|
34
|
+
i.logPhaseEnd('resolution');
|
|
35
|
+
const m = this.assembler.hookManager.getCache().find((e)=>e.instance === g);
|
|
36
|
+
if (!m) {
|
|
37
|
+
throw new Error('Root instance not found in assemblages cache.');
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
static getInstance() {
|
|
58
|
-
return CycleDetector.instance;
|
|
59
|
-
}
|
|
60
|
-
static enable() {
|
|
61
|
-
CycleDetector.instance = new ActiveCycleDetector();
|
|
39
|
+
const b = this.assembler.hookManager.getCache().indexOf(m);
|
|
40
|
+
this.assembler.hookManager.getCache().splice(b, 1);
|
|
41
|
+
i.logPhaseStart('hooks:onInit');
|
|
42
|
+
this.assembler.hookManager.callInitHooks(this.assembler.publicContext);
|
|
43
|
+
const d = r ? {
|
|
44
|
+
...l.configuration,
|
|
45
|
+
...r
|
|
46
|
+
} : l.configuration;
|
|
47
|
+
hookManager.HookManager.callHookImmediate(g, 'onInit', this.assembler.publicContext, d);
|
|
48
|
+
i.logPhaseEnd('hooks:onInit');
|
|
49
|
+
i.logPhaseStart('hooks:onInited');
|
|
50
|
+
this.assembler.hookManager.callInitedHooks(this.assembler.publicContext);
|
|
51
|
+
hookManager.HookManager.callHookImmediate(g, 'onInited', this.assembler.publicContext, d);
|
|
52
|
+
i.logPhaseEnd('hooks:onInited');
|
|
53
|
+
this.assembler.hookManager.clearCache();
|
|
54
|
+
return g;
|
|
62
55
|
}
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
constructor(e){
|
|
57
|
+
this.assembler = e;
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
|
-
CycleDetector.instance = new NoOpCycleDetector();
|
|
68
60
|
|
|
69
|
-
exports.
|
|
61
|
+
exports.AssemblerBuilder = AssemblerBuilder;
|
package/dist/index35.mjs
CHANGED
|
@@ -1,65 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
};
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { HookManager } from './index34.mjs';
|
|
2
|
+
import { DebugLogger } from './index37.mjs';
|
|
3
|
+
import { CycleDetector } from './index38.mjs';
|
|
4
|
+
import { formatIdentifier } from './index32.mjs';
|
|
5
|
+
import { setDefinitionValue } from './index31.mjs';
|
|
6
|
+
|
|
7
|
+
class AssemblerBuilder {
|
|
8
|
+
build(n, r) {
|
|
9
|
+
const i = DebugLogger.getInstance();
|
|
10
|
+
setDefinitionValue('singleton', true, n);
|
|
11
|
+
i.logPhaseStart('registration');
|
|
12
|
+
const l = this.assembler.register([
|
|
13
|
+
n
|
|
14
|
+
]);
|
|
15
|
+
const c = this.assembler.injectableManager.getRegisteredIdentifiers();
|
|
16
|
+
i.logPhaseEnd('registration', undefined, {
|
|
17
|
+
registered: c
|
|
18
|
+
});
|
|
19
|
+
const h = CycleDetector.getInstance().detect(this.assembler.injectableManager.getInjectables(), (e)=>formatIdentifier(e));
|
|
20
|
+
if (h.length > 0) {
|
|
21
|
+
for (const e of h){
|
|
22
|
+
i.log('error', 'Circular dependency detected', {
|
|
23
|
+
cycle: e.cycle,
|
|
24
|
+
path: e.path
|
|
25
|
+
});
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
if (s.has(e)) {
|
|
35
|
-
return false;
|
|
28
|
+
i.logPhaseStart('resolution');
|
|
29
|
+
const g = this.assembler.require(l.identifier, r);
|
|
30
|
+
i.logPhaseEnd('resolution');
|
|
31
|
+
const m = this.assembler.hookManager.getCache().find((e)=>e.instance === g);
|
|
32
|
+
if (!m) {
|
|
33
|
+
throw new Error('Root instance not found in assemblages cache.');
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
static getInstance() {
|
|
54
|
-
return CycleDetector.instance;
|
|
55
|
-
}
|
|
56
|
-
static enable() {
|
|
57
|
-
CycleDetector.instance = new ActiveCycleDetector();
|
|
35
|
+
const b = this.assembler.hookManager.getCache().indexOf(m);
|
|
36
|
+
this.assembler.hookManager.getCache().splice(b, 1);
|
|
37
|
+
i.logPhaseStart('hooks:onInit');
|
|
38
|
+
this.assembler.hookManager.callInitHooks(this.assembler.publicContext);
|
|
39
|
+
const d = r ? {
|
|
40
|
+
...l.configuration,
|
|
41
|
+
...r
|
|
42
|
+
} : l.configuration;
|
|
43
|
+
HookManager.callHookImmediate(g, 'onInit', this.assembler.publicContext, d);
|
|
44
|
+
i.logPhaseEnd('hooks:onInit');
|
|
45
|
+
i.logPhaseStart('hooks:onInited');
|
|
46
|
+
this.assembler.hookManager.callInitedHooks(this.assembler.publicContext);
|
|
47
|
+
HookManager.callHookImmediate(g, 'onInited', this.assembler.publicContext, d);
|
|
48
|
+
i.logPhaseEnd('hooks:onInited');
|
|
49
|
+
this.assembler.hookManager.clearCache();
|
|
50
|
+
return g;
|
|
58
51
|
}
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
constructor(e){
|
|
53
|
+
this.assembler = e;
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
|
-
CycleDetector.instance = new NoOpCycleDetector();
|
|
64
56
|
|
|
65
|
-
export {
|
|
57
|
+
export { AssemblerBuilder };
|
package/dist/index36.js
CHANGED
|
@@ -2,22 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
class ContextProvider {
|
|
6
|
+
createPublicContext() {
|
|
7
|
+
return {
|
|
8
|
+
has: this.assembler.has.bind(this.assembler),
|
|
9
|
+
require: this.assembler.require.bind(this.assembler),
|
|
10
|
+
concrete: this.assembler.concrete.bind(this.assembler),
|
|
11
|
+
tagged: this.assembler.tagged.bind(this.assembler),
|
|
12
|
+
dispose: this.assembler.dispose.bind(this.assembler),
|
|
13
|
+
global: this.assembler.global.bind(this.assembler),
|
|
14
|
+
on: this.assembler.on.bind(this.assembler),
|
|
15
|
+
once: this.assembler.once.bind(this.assembler),
|
|
16
|
+
off: this.assembler.off.bind(this.assembler),
|
|
17
|
+
events: this.assembler.channels
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
createPrivateContext(s) {
|
|
21
|
+
return {
|
|
22
|
+
...s,
|
|
23
|
+
register: this.assembler.register.bind(this.assembler),
|
|
24
|
+
use: this.assembler.use.bind(this.assembler),
|
|
25
|
+
addGlobal: this.assembler.addGlobal.bind(this.assembler),
|
|
26
|
+
prepareInitHook: this.assembler.prepareInitHook.bind(this.assembler),
|
|
27
|
+
emit: this.assembler.emit.bind(this.assembler),
|
|
28
|
+
addChannels: this.assembler.addChannels.bind(this.assembler),
|
|
29
|
+
removeChannels: this.assembler.removeChannels.bind(this.assembler)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
constructor(s){
|
|
33
|
+
this.assembler = s;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
6
36
|
|
|
7
|
-
|
|
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);
|
|
12
|
-
};
|
|
13
|
-
const getOwnCustomMetadata = (t, o)=>{
|
|
14
|
-
return Reflect.getOwnMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
|
|
15
|
-
};
|
|
16
|
-
const getParamTypes = (e)=>{
|
|
17
|
-
return Reflect.getMetadata(constants.ReflectParamTypes, e) || [];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.defineCustomMetadata = defineCustomMetadata;
|
|
21
|
-
exports.getCustomMetadata = getCustomMetadata;
|
|
22
|
-
exports.getOwnCustomMetadata = getOwnCustomMetadata;
|
|
23
|
-
exports.getParamTypes = getParamTypes;
|
|
37
|
+
exports.ContextProvider = ContextProvider;
|
package/dist/index36.mjs
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
class ContextProvider {
|
|
2
|
+
createPublicContext() {
|
|
3
|
+
return {
|
|
4
|
+
has: this.assembler.has.bind(this.assembler),
|
|
5
|
+
require: this.assembler.require.bind(this.assembler),
|
|
6
|
+
concrete: this.assembler.concrete.bind(this.assembler),
|
|
7
|
+
tagged: this.assembler.tagged.bind(this.assembler),
|
|
8
|
+
dispose: this.assembler.dispose.bind(this.assembler),
|
|
9
|
+
global: this.assembler.global.bind(this.assembler),
|
|
10
|
+
on: this.assembler.on.bind(this.assembler),
|
|
11
|
+
once: this.assembler.once.bind(this.assembler),
|
|
12
|
+
off: this.assembler.off.bind(this.assembler),
|
|
13
|
+
events: this.assembler.channels
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
createPrivateContext(s) {
|
|
17
|
+
return {
|
|
18
|
+
...s,
|
|
19
|
+
register: this.assembler.register.bind(this.assembler),
|
|
20
|
+
use: this.assembler.use.bind(this.assembler),
|
|
21
|
+
addGlobal: this.assembler.addGlobal.bind(this.assembler),
|
|
22
|
+
prepareInitHook: this.assembler.prepareInitHook.bind(this.assembler),
|
|
23
|
+
emit: this.assembler.emit.bind(this.assembler),
|
|
24
|
+
addChannels: this.assembler.addChannels.bind(this.assembler),
|
|
25
|
+
removeChannels: this.assembler.removeChannels.bind(this.assembler)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
constructor(s){
|
|
29
|
+
this.assembler = s;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
2
32
|
|
|
3
|
-
|
|
4
|
-
Reflect.defineMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o, n);
|
|
5
|
-
};
|
|
6
|
-
const getCustomMetadata = (t, o)=>{
|
|
7
|
-
return Reflect.getMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
|
|
8
|
-
};
|
|
9
|
-
const getOwnCustomMetadata = (t, o)=>{
|
|
10
|
-
return Reflect.getOwnMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
|
|
11
|
-
};
|
|
12
|
-
const getParamTypes = (e)=>{
|
|
13
|
-
return Reflect.getMetadata(ReflectParamTypes, e) || [];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { defineCustomMetadata, getCustomMetadata, getOwnCustomMetadata, getParamTypes };
|
|
33
|
+
export { ContextProvider };
|