assemblerjs 1.1.3 → 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/index.d.ts +3 -3
- 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 +71 -32
- package/dist/index31.mjs +71 -31
- package/dist/index32.js +37 -16
- package/dist/index32.mjs +37 -16
- package/dist/index33.js +68 -57
- package/dist/index33.mjs +68 -57
- package/dist/index34.js +38 -28
- package/dist/index34.mjs +38 -28
- package/dist/index35.js +28 -76
- package/dist/index35.mjs +28 -76
- package/dist/index36.js +132 -39
- package/dist/index36.mjs +132 -39
- package/dist/index37.js +39 -30
- package/dist/index37.mjs +38 -30
- package/dist/index38.js +97 -125
- package/dist/index38.mjs +97 -125
- package/dist/index39.js +24 -101
- package/dist/index39.mjs +24 -101
- package/dist/index4.js +8 -8
- package/dist/index4.mjs +8 -8
- package/dist/index40.js +18 -24
- package/dist/index40.mjs +18 -24
- package/dist/index44.js +2 -2
- package/dist/index44.mjs +2 -2
- package/dist/index48.js +1 -1
- package/dist/index48.mjs +1 -1
- package/dist/index49.js +2 -2
- package/dist/index49.mjs +2 -2
- package/dist/index50.js +12 -12
- package/dist/index50.mjs +12 -12
- package/package.json +1 -1
package/dist/index36.js
CHANGED
|
@@ -2,46 +2,139 @@
|
|
|
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
|
-
|
|
5
|
+
let NoOpDebugLogger = class NoOpDebugLogger {
|
|
6
|
+
configure(o) {}
|
|
7
|
+
log(o, e, t) {}
|
|
8
|
+
logBuildStart(o) {}
|
|
9
|
+
logBuildEnd(o, e) {}
|
|
10
|
+
logRegistration(o) {}
|
|
11
|
+
logHook(o, e, t) {}
|
|
12
|
+
logPhaseStart(o, e) {}
|
|
13
|
+
logPhaseEnd(o, e) {}
|
|
14
|
+
logResolution(o, e, t) {}
|
|
15
|
+
logConstruction(o) {}
|
|
16
|
+
};
|
|
17
|
+
let ActiveDebugLogger = class ActiveDebugLogger {
|
|
18
|
+
configure(o) {
|
|
19
|
+
this.options = {
|
|
20
|
+
...this.options,
|
|
21
|
+
...o,
|
|
22
|
+
logPhases: {
|
|
23
|
+
...this.options.logPhases,
|
|
24
|
+
...o.logPhases || {}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
logBuildStart(o) {
|
|
29
|
+
this.log('info', 'Build started', {
|
|
30
|
+
entry: o.name
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
logBuildEnd(o, e) {
|
|
34
|
+
const t = {
|
|
35
|
+
entry: o.name
|
|
36
|
+
};
|
|
37
|
+
if (e !== undefined) t.duration = `${e.toFixed(2)}ms`;
|
|
38
|
+
this.log('info', 'Build completed', t);
|
|
39
|
+
}
|
|
40
|
+
logRegistration(o) {
|
|
41
|
+
if (!this.shouldLog('registration')) return;
|
|
42
|
+
this.log('info', 'Registration', {
|
|
43
|
+
identifier: o.identifier?.name || String(o.identifier),
|
|
44
|
+
isSingleton: o.isSingleton,
|
|
45
|
+
dependencies: o.dependencies.map((o)=>o?.name || String(o)),
|
|
46
|
+
tags: o.tags
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
logHook(o, e, t) {
|
|
50
|
+
if (!this.shouldLog('hooks')) return;
|
|
51
|
+
const s = this.options.logTimings ? performance.now() : 0;
|
|
52
|
+
this.log('info', `Hook: ${o}`, {
|
|
53
|
+
target: e.constructor?.name || e.name,
|
|
54
|
+
config: t
|
|
55
|
+
});
|
|
56
|
+
if (this.options.logTimings) {
|
|
57
|
+
return ()=>{
|
|
58
|
+
const e = performance.now() - s;
|
|
59
|
+
this.log('info', `Hook: ${o} completed`, {
|
|
60
|
+
duration: `${e.toFixed(2)}ms`
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
logPhaseStart(o, e) {
|
|
66
|
+
this.log('info', `Phase: ${o} started`, e);
|
|
67
|
+
}
|
|
68
|
+
logPhaseEnd(o, e) {
|
|
69
|
+
const t = e !== undefined ? {
|
|
70
|
+
duration: `${e.toFixed(2)}ms`
|
|
71
|
+
} : undefined;
|
|
72
|
+
this.log('info', `Phase: ${o} ended`, t);
|
|
73
|
+
}
|
|
74
|
+
logResolution(o, e, t) {
|
|
75
|
+
if (!this.shouldLog('resolution')) return;
|
|
76
|
+
this.log('info', `Resolving: ${o}`, {
|
|
77
|
+
strategy: `${e} strategy`,
|
|
78
|
+
cache: t ? 'hit' : 'miss'
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
logConstruction(o) {
|
|
82
|
+
if (!this.shouldLog('construction')) return;
|
|
83
|
+
this.log('info', `Constructing: ${o}`);
|
|
84
|
+
}
|
|
85
|
+
shouldLog(o) {
|
|
86
|
+
return !this.options.logPhases || this.options.logPhases[o] !== false;
|
|
87
|
+
}
|
|
88
|
+
log(o, e, t) {
|
|
89
|
+
if (this.options.logger) {
|
|
90
|
+
this.options.logger(o, e, t);
|
|
91
|
+
} else {
|
|
92
|
+
const s = `[Assembler:${o}]`;
|
|
93
|
+
const i = this.options.useColors !== false ? this.colorize(o, s) : s;
|
|
94
|
+
const n = t ? ` ${JSON.stringify(t)}` : '';
|
|
95
|
+
console.log(`${i} ${e}${n}`);
|
|
24
96
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
97
|
+
}
|
|
98
|
+
colorize(o, e) {
|
|
99
|
+
const t = {
|
|
100
|
+
info: '\x1b[36m',
|
|
101
|
+
warn: '\x1b[33m',
|
|
102
|
+
error: '\x1b[31m',
|
|
103
|
+
reset: '\x1b[0m'
|
|
104
|
+
};
|
|
105
|
+
const s = t[o] || t.info;
|
|
106
|
+
return `${s}${e}${t.reset}`;
|
|
107
|
+
}
|
|
108
|
+
constructor(){
|
|
109
|
+
this.options = {
|
|
110
|
+
enabled: true,
|
|
111
|
+
logPhases: {
|
|
112
|
+
registration: true,
|
|
113
|
+
resolution: true,
|
|
114
|
+
construction: true,
|
|
115
|
+
hooks: true,
|
|
116
|
+
cache: true
|
|
117
|
+
},
|
|
118
|
+
logTimings: false,
|
|
119
|
+
logDependencyTree: true,
|
|
120
|
+
useColors: true
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
class DebugLogger {
|
|
125
|
+
static getInstance() {
|
|
126
|
+
return DebugLogger.instance;
|
|
127
|
+
}
|
|
128
|
+
static enable(o) {
|
|
129
|
+
DebugLogger.instance = new ActiveDebugLogger();
|
|
130
|
+
if (o) {
|
|
131
|
+
DebugLogger.instance.configure(o);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
static disable() {
|
|
135
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
44
136
|
}
|
|
45
137
|
}
|
|
138
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
46
139
|
|
|
47
|
-
exports.
|
|
140
|
+
exports.DebugLogger = DebugLogger;
|
package/dist/index36.mjs
CHANGED
|
@@ -1,43 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
let NoOpDebugLogger = class NoOpDebugLogger {
|
|
2
|
+
configure(o) {}
|
|
3
|
+
log(o, e, t) {}
|
|
4
|
+
logBuildStart(o) {}
|
|
5
|
+
logBuildEnd(o, e) {}
|
|
6
|
+
logRegistration(o) {}
|
|
7
|
+
logHook(o, e, t) {}
|
|
8
|
+
logPhaseStart(o, e) {}
|
|
9
|
+
logPhaseEnd(o, e) {}
|
|
10
|
+
logResolution(o, e, t) {}
|
|
11
|
+
logConstruction(o) {}
|
|
12
|
+
};
|
|
13
|
+
let ActiveDebugLogger = class ActiveDebugLogger {
|
|
14
|
+
configure(o) {
|
|
15
|
+
this.options = {
|
|
16
|
+
...this.options,
|
|
17
|
+
...o,
|
|
18
|
+
logPhases: {
|
|
19
|
+
...this.options.logPhases,
|
|
20
|
+
...o.logPhases || {}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
logBuildStart(o) {
|
|
25
|
+
this.log('info', 'Build started', {
|
|
26
|
+
entry: o.name
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
logBuildEnd(o, e) {
|
|
30
|
+
const t = {
|
|
31
|
+
entry: o.name
|
|
32
|
+
};
|
|
33
|
+
if (e !== undefined) t.duration = `${e.toFixed(2)}ms`;
|
|
34
|
+
this.log('info', 'Build completed', t);
|
|
35
|
+
}
|
|
36
|
+
logRegistration(o) {
|
|
37
|
+
if (!this.shouldLog('registration')) return;
|
|
38
|
+
this.log('info', 'Registration', {
|
|
39
|
+
identifier: o.identifier?.name || String(o.identifier),
|
|
40
|
+
isSingleton: o.isSingleton,
|
|
41
|
+
dependencies: o.dependencies.map((o)=>o?.name || String(o)),
|
|
42
|
+
tags: o.tags
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
logHook(o, e, t) {
|
|
46
|
+
if (!this.shouldLog('hooks')) return;
|
|
47
|
+
const s = this.options.logTimings ? performance.now() : 0;
|
|
48
|
+
this.log('info', `Hook: ${o}`, {
|
|
49
|
+
target: e.constructor?.name || e.name,
|
|
50
|
+
config: t
|
|
51
|
+
});
|
|
52
|
+
if (this.options.logTimings) {
|
|
53
|
+
return ()=>{
|
|
54
|
+
const e = performance.now() - s;
|
|
55
|
+
this.log('info', `Hook: ${o} completed`, {
|
|
56
|
+
duration: `${e.toFixed(2)}ms`
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
logPhaseStart(o, e) {
|
|
62
|
+
this.log('info', `Phase: ${o} started`, e);
|
|
63
|
+
}
|
|
64
|
+
logPhaseEnd(o, e) {
|
|
65
|
+
const t = e !== undefined ? {
|
|
66
|
+
duration: `${e.toFixed(2)}ms`
|
|
67
|
+
} : undefined;
|
|
68
|
+
this.log('info', `Phase: ${o} ended`, t);
|
|
69
|
+
}
|
|
70
|
+
logResolution(o, e, t) {
|
|
71
|
+
if (!this.shouldLog('resolution')) return;
|
|
72
|
+
this.log('info', `Resolving: ${o}`, {
|
|
73
|
+
strategy: `${e} strategy`,
|
|
74
|
+
cache: t ? 'hit' : 'miss'
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
logConstruction(o) {
|
|
78
|
+
if (!this.shouldLog('construction')) return;
|
|
79
|
+
this.log('info', `Constructing: ${o}`);
|
|
80
|
+
}
|
|
81
|
+
shouldLog(o) {
|
|
82
|
+
return !this.options.logPhases || this.options.logPhases[o] !== false;
|
|
83
|
+
}
|
|
84
|
+
log(o, e, t) {
|
|
85
|
+
if (this.options.logger) {
|
|
86
|
+
this.options.logger(o, e, t);
|
|
87
|
+
} else {
|
|
88
|
+
const s = `[Assembler:${o}]`;
|
|
89
|
+
const i = this.options.useColors !== false ? this.colorize(o, s) : s;
|
|
90
|
+
const n = t ? ` ${JSON.stringify(t)}` : '';
|
|
91
|
+
console.log(`${i} ${e}${n}`);
|
|
20
92
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
93
|
+
}
|
|
94
|
+
colorize(o, e) {
|
|
95
|
+
const t = {
|
|
96
|
+
info: '\x1b[36m',
|
|
97
|
+
warn: '\x1b[33m',
|
|
98
|
+
error: '\x1b[31m',
|
|
99
|
+
reset: '\x1b[0m'
|
|
100
|
+
};
|
|
101
|
+
const s = t[o] || t.info;
|
|
102
|
+
return `${s}${e}${t.reset}`;
|
|
103
|
+
}
|
|
104
|
+
constructor(){
|
|
105
|
+
this.options = {
|
|
106
|
+
enabled: true,
|
|
107
|
+
logPhases: {
|
|
108
|
+
registration: true,
|
|
109
|
+
resolution: true,
|
|
110
|
+
construction: true,
|
|
111
|
+
hooks: true,
|
|
112
|
+
cache: true
|
|
113
|
+
},
|
|
114
|
+
logTimings: false,
|
|
115
|
+
logDependencyTree: true,
|
|
116
|
+
useColors: true
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
class DebugLogger {
|
|
121
|
+
static getInstance() {
|
|
122
|
+
return DebugLogger.instance;
|
|
123
|
+
}
|
|
124
|
+
static enable(o) {
|
|
125
|
+
DebugLogger.instance = new ActiveDebugLogger();
|
|
126
|
+
if (o) {
|
|
127
|
+
DebugLogger.instance.configure(o);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
static disable() {
|
|
131
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
40
132
|
}
|
|
41
133
|
}
|
|
134
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
42
135
|
|
|
43
|
-
export {
|
|
136
|
+
export { DebugLogger };
|
package/dist/index37.js
CHANGED
|
@@ -2,36 +2,45 @@
|
|
|
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
|
-
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
|
-
};
|
|
5
|
+
const eventManager = require('./index6.js');
|
|
6
|
+
|
|
7
|
+
const registerEvents = (t, n)=>{
|
|
8
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
|
|
9
|
+
if (o) {
|
|
10
|
+
const e = n;
|
|
11
|
+
const o = e.channels;
|
|
12
|
+
for (const n of t.events){
|
|
13
|
+
if (!o.has(n)) e.addChannels(n);
|
|
14
|
+
if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
|
|
15
|
+
}
|
|
16
|
+
for (const e of t.events){
|
|
17
|
+
n.on(e, (...n)=>{
|
|
18
|
+
t.privateContext.emit(e, ...n);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
for (const e of t.events){
|
|
23
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
24
|
+
}
|
|
31
25
|
}
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
};
|
|
27
|
+
const unregisterEvents = (t, n)=>{
|
|
28
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
|
|
29
|
+
if (o) {
|
|
30
|
+
const e = n;
|
|
31
|
+
for (const n of t.events){
|
|
32
|
+
e.off(n);
|
|
33
|
+
}
|
|
34
|
+
e.removeChannels(...t.events);
|
|
35
|
+
t.privateContext.removeChannels(...t.events);
|
|
36
|
+
} else {
|
|
37
|
+
for (const e of t.events){
|
|
38
|
+
if (t.privateContext.events.has(e)) {
|
|
39
|
+
t.privateContext.removeChannels(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
|
-
}
|
|
43
|
+
};
|
|
36
44
|
|
|
37
|
-
exports.
|
|
45
|
+
exports.registerEvents = registerEvents;
|
|
46
|
+
exports.unregisterEvents = unregisterEvents;
|
package/dist/index37.mjs
CHANGED
|
@@ -1,33 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
};
|
|
1
|
+
import { EventManager } from './index6.mjs';
|
|
2
|
+
|
|
3
|
+
const registerEvents = (t, n)=>{
|
|
4
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof EventManager;
|
|
5
|
+
if (o) {
|
|
6
|
+
const e = n;
|
|
7
|
+
const o = e.channels;
|
|
8
|
+
for (const n of t.events){
|
|
9
|
+
if (!o.has(n)) e.addChannels(n);
|
|
10
|
+
if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
|
|
11
|
+
}
|
|
12
|
+
for (const e of t.events){
|
|
13
|
+
n.on(e, (...n)=>{
|
|
14
|
+
t.privateContext.emit(e, ...n);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
for (const e of t.events){
|
|
19
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
20
|
+
}
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
};
|
|
23
|
+
const unregisterEvents = (t, n)=>{
|
|
24
|
+
const o = t.concrete !== undefined && t.concrete.prototype instanceof EventManager;
|
|
25
|
+
if (o) {
|
|
26
|
+
const e = n;
|
|
27
|
+
for (const n of t.events){
|
|
28
|
+
e.off(n);
|
|
29
|
+
}
|
|
30
|
+
e.removeChannels(...t.events);
|
|
31
|
+
t.privateContext.removeChannels(...t.events);
|
|
32
|
+
} else {
|
|
33
|
+
for (const e of t.events){
|
|
34
|
+
if (t.privateContext.events.has(e)) {
|
|
35
|
+
t.privateContext.removeChannels(e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
|
-
}
|
|
39
|
+
};
|
|
32
40
|
|
|
33
|
-
export {
|
|
41
|
+
export { registerEvents, unregisterEvents };
|