assemblerjs 1.1.19 → 1.1.21
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 +4 -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 +11 -5
- package/dist/index22.mjs +11 -5
- package/dist/index23.js +13 -7
- package/dist/index23.mjs +13 -7
- package/dist/index24.js +1 -1
- package/dist/index24.mjs +1 -1
- package/dist/index31.js +35 -100
- package/dist/index31.mjs +34 -100
- package/dist/index32.js +152 -22
- package/dist/index32.mjs +151 -22
- package/dist/index33.js +35 -143
- package/dist/index33.mjs +35 -142
- package/dist/index34.js +70 -41
- package/dist/index34.mjs +70 -41
- package/dist/index35.js +49 -73
- package/dist/index35.mjs +49 -73
- package/dist/index36.js +29 -53
- package/dist/index36.mjs +29 -53
- package/dist/index37.js +170 -26
- package/dist/index37.mjs +170 -26
- package/dist/index38.js +48 -151
- package/dist/index38.mjs +48 -151
- package/dist/index39.js +16 -57
- package/dist/index39.mjs +16 -57
- package/dist/index4.js +7 -7
- package/dist/index4.mjs +7 -7
- package/dist/index40.js +100 -35
- package/dist/index40.mjs +100 -34
- package/dist/index41.js +24 -18
- package/dist/index41.mjs +24 -18
- package/dist/index45.js +54 -22
- package/dist/index45.mjs +54 -22
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.js +2 -2
- package/dist/index50.mjs +2 -2
- package/package.json +1 -1
package/dist/index37.mjs
CHANGED
|
@@ -1,33 +1,177 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
function e(e) {
|
|
2
|
+
if (e === undefined) return 'undefined';
|
|
3
|
+
if (e === null) return 'null';
|
|
4
|
+
if (typeof e === 'function') {
|
|
5
|
+
if (e.name) return e.name;
|
|
6
|
+
if (e.constructor?.name && e.constructor.name !== 'Function') {
|
|
7
|
+
return e.constructor.name;
|
|
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
|
+
}
|
|
14
45
|
};
|
|
15
46
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
addChannels: this.assembler.addChannels.bind(this.assembler),
|
|
25
|
-
removeChannels: this.assembler.removeChannels.bind(this.assembler)
|
|
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
|
|
26
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
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
logHook(o, t, n) {
|
|
69
|
+
if (!this.shouldLog('hooks')) return;
|
|
70
|
+
const i = this.options.logTimings ? performance.now() : 0;
|
|
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
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
logPhaseStart(e, o) {
|
|
85
|
+
this.log('info', `Phase: ${e} started`, o);
|
|
86
|
+
}
|
|
87
|
+
logPhaseEnd(e, o, t) {
|
|
88
|
+
const n = o !== undefined ? {
|
|
89
|
+
duration: `${o.toFixed(2)}ms`
|
|
90
|
+
} : {};
|
|
91
|
+
if (t) {
|
|
92
|
+
Object.assign(n, t);
|
|
93
|
+
}
|
|
94
|
+
this.log('info', `Phase: ${e} ended`, Object.keys(n).length > 0 ? n : undefined);
|
|
95
|
+
}
|
|
96
|
+
logResolution(e, o, t) {
|
|
97
|
+
if (!this.shouldLog('resolution')) return;
|
|
98
|
+
this.log('info', `Resolving: ${e}`, {
|
|
99
|
+
strategy: `${o} strategy`,
|
|
100
|
+
cache: t ? 'hit' : 'miss'
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
logConstruction(e) {
|
|
104
|
+
if (!this.shouldLog('construction')) return;
|
|
105
|
+
this.log('info', `Constructing: ${e}`);
|
|
106
|
+
}
|
|
107
|
+
logInjection(e, o) {
|
|
108
|
+
if (!this.shouldLog(e === 'use' ? 'injectionUse' : 'injectionGlobal')) return;
|
|
109
|
+
this.log('info', `Injecting: @${e === 'use' ? 'Use' : 'Global'}`, o);
|
|
110
|
+
}
|
|
111
|
+
shouldLog(e) {
|
|
112
|
+
return !this.options.logPhases || this.options.logPhases[e] !== false;
|
|
113
|
+
}
|
|
114
|
+
log(e, o, t) {
|
|
115
|
+
if (this.options.logger) {
|
|
116
|
+
this.options.logger(e, o, t);
|
|
117
|
+
} else {
|
|
118
|
+
const n = `[Assembler:${e}]`;
|
|
119
|
+
const i = this.options.useColors !== false ? this.colorize(e, n) : n;
|
|
120
|
+
if (t) {
|
|
121
|
+
console.log(`${i} ${o}`, t);
|
|
122
|
+
} else {
|
|
123
|
+
console.log(`${i} ${o}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
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
|
+
}
|
|
156
|
+
};
|
|
157
|
+
class DebugLogger {
|
|
158
|
+
static getInstance() {
|
|
159
|
+
return DebugLogger.instance;
|
|
160
|
+
}
|
|
161
|
+
static enable(e) {
|
|
162
|
+
if (e?.enabled === false) {
|
|
163
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
DebugLogger.instance = new ActiveDebugLogger();
|
|
167
|
+
if (e) {
|
|
168
|
+
DebugLogger.instance.configure(e);
|
|
169
|
+
}
|
|
27
170
|
}
|
|
28
|
-
|
|
29
|
-
|
|
171
|
+
static disable() {
|
|
172
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
30
173
|
}
|
|
31
174
|
}
|
|
175
|
+
DebugLogger.instance = new NoOpDebugLogger();
|
|
32
176
|
|
|
33
|
-
export {
|
|
177
|
+
export { DebugLogger };
|
package/dist/index38.js
CHANGED
|
@@ -2,171 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (o.constructor?.name && o.constructor.name !== 'Function') {
|
|
11
|
-
return o.constructor.name;
|
|
12
|
-
}
|
|
13
|
-
return 'AnonymousFunction';
|
|
14
|
-
}
|
|
15
|
-
if (typeof o === 'object') {
|
|
16
|
-
const e = o.constructor?.name;
|
|
17
|
-
if (e && e !== 'Object') {
|
|
18
|
-
return e;
|
|
19
|
-
}
|
|
20
|
-
if (o.name && typeof o.name === 'string') {
|
|
21
|
-
return o.name;
|
|
22
|
-
}
|
|
23
|
-
return '[Object]';
|
|
5
|
+
let AbstractCycleDetector = class AbstractCycleDetector {
|
|
6
|
+
};
|
|
7
|
+
let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
|
|
8
|
+
detect() {
|
|
9
|
+
return [];
|
|
24
10
|
}
|
|
25
|
-
return String(o);
|
|
26
|
-
}
|
|
27
|
-
let NoOpDebugLogger = class NoOpDebugLogger {
|
|
28
|
-
configure(o) {}
|
|
29
|
-
log(o, e, t) {}
|
|
30
|
-
logBuildStart(o) {}
|
|
31
|
-
logBuildEnd(o, e) {}
|
|
32
|
-
logRegistration(o) {}
|
|
33
|
-
logHook(o, e, t) {}
|
|
34
|
-
logPhaseStart(o, e) {}
|
|
35
|
-
logPhaseEnd(o, e, t) {}
|
|
36
|
-
logResolution(o, e, t) {}
|
|
37
|
-
logConstruction(o) {}
|
|
38
11
|
};
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
12
|
+
let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
|
|
13
|
+
detect(e, t) {
|
|
14
|
+
const c = [];
|
|
15
|
+
const s = new Set();
|
|
16
|
+
for (const [n] of e){
|
|
17
|
+
if (s.has(n)) continue;
|
|
18
|
+
const r = [];
|
|
19
|
+
const o = new Set();
|
|
20
|
+
if (this.hasCycleDFS(n, r, o, s, e)) {
|
|
21
|
+
const e = r.findIndex((e)=>e === n);
|
|
22
|
+
if (e >= 0) {
|
|
23
|
+
const s = r.slice(e).map((e)=>t(e));
|
|
24
|
+
c.push({
|
|
25
|
+
cycle: s,
|
|
26
|
+
path: s.join(' → ')
|
|
27
|
+
});
|
|
28
|
+
}
|
|
47
29
|
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
logBuildStart(o) {
|
|
51
|
-
this.log('info', 'Build started', {
|
|
52
|
-
entry: o.name
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
logBuildEnd(o, e) {
|
|
56
|
-
const t = {
|
|
57
|
-
entry: o.name
|
|
58
|
-
};
|
|
59
|
-
if (e !== undefined) t.duration = `${e.toFixed(2)}ms`;
|
|
60
|
-
this.log('info', 'Build completed', t);
|
|
61
|
-
}
|
|
62
|
-
logRegistration(e) {
|
|
63
|
-
if (!this.shouldLog('registration')) return;
|
|
64
|
-
this.log('info', 'Registration', {
|
|
65
|
-
identifier: o(e.identifier),
|
|
66
|
-
isSingleton: e.isSingleton,
|
|
67
|
-
dependencies: e.dependencies.map((e)=>o(e)),
|
|
68
|
-
tags: e.tags
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
logHook(e, t, n) {
|
|
72
|
-
if (!this.shouldLog('hooks')) return;
|
|
73
|
-
const s = this.options.logTimings ? performance.now() : 0;
|
|
74
|
-
this.log('info', `Hook: ${e}`, {
|
|
75
|
-
target: o(t),
|
|
76
|
-
config: n
|
|
77
|
-
});
|
|
78
|
-
if (this.options.logTimings) {
|
|
79
|
-
return ()=>{
|
|
80
|
-
const o = performance.now() - s;
|
|
81
|
-
this.log('info', `Hook: ${e} completed`, {
|
|
82
|
-
duration: `${o.toFixed(2)}ms`
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
30
|
}
|
|
31
|
+
return c;
|
|
86
32
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const n = e !== undefined ? {
|
|
92
|
-
duration: `${e.toFixed(2)}ms`
|
|
93
|
-
} : {};
|
|
94
|
-
if (t) {
|
|
95
|
-
Object.assign(n, t);
|
|
33
|
+
hasCycleDFS(e, t, c, s, n) {
|
|
34
|
+
if (c.has(e)) {
|
|
35
|
+
t.push(e);
|
|
36
|
+
return true;
|
|
96
37
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.log('info', `Constructing: ${o}`);
|
|
109
|
-
}
|
|
110
|
-
shouldLog(o) {
|
|
111
|
-
return !this.options.logPhases || this.options.logPhases[o] !== false;
|
|
112
|
-
}
|
|
113
|
-
log(o, e, t) {
|
|
114
|
-
if (this.options.logger) {
|
|
115
|
-
this.options.logger(o, e, t);
|
|
116
|
-
} else {
|
|
117
|
-
const n = `[Assembler:${o}]`;
|
|
118
|
-
const s = this.options.useColors !== false ? this.colorize(o, n) : n;
|
|
119
|
-
if (t) {
|
|
120
|
-
console.log(`${s} ${e}`, t);
|
|
121
|
-
} else {
|
|
122
|
-
console.log(`${s} ${e}`);
|
|
38
|
+
if (s.has(e)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
t.push(e);
|
|
42
|
+
c.add(e);
|
|
43
|
+
const r = n.get(e);
|
|
44
|
+
if (r?.dependencies && r.dependencies.length > 0) {
|
|
45
|
+
for (const e of r.dependencies){
|
|
46
|
+
if (this.hasCycleDFS(e, t, c, s, n)) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
123
49
|
}
|
|
124
50
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
info: '\x1b[36m',
|
|
129
|
-
warn: '\x1b[33m',
|
|
130
|
-
error: '\x1b[31m',
|
|
131
|
-
reset: '\x1b[0m'
|
|
132
|
-
};
|
|
133
|
-
const n = t[o] || t.info;
|
|
134
|
-
return `${n}${e}${t.reset}`;
|
|
135
|
-
}
|
|
136
|
-
constructor(){
|
|
137
|
-
this.options = {
|
|
138
|
-
enabled: true,
|
|
139
|
-
logPhases: {
|
|
140
|
-
registration: true,
|
|
141
|
-
resolution: true,
|
|
142
|
-
construction: true,
|
|
143
|
-
hooks: true,
|
|
144
|
-
cache: true
|
|
145
|
-
},
|
|
146
|
-
logTimings: false,
|
|
147
|
-
logDependencyTree: true,
|
|
148
|
-
useColors: true
|
|
149
|
-
};
|
|
51
|
+
c.delete(e);
|
|
52
|
+
s.add(e);
|
|
53
|
+
return false;
|
|
150
54
|
}
|
|
151
55
|
};
|
|
152
|
-
class
|
|
56
|
+
class CycleDetector {
|
|
153
57
|
static getInstance() {
|
|
154
|
-
return
|
|
58
|
+
return CycleDetector.instance;
|
|
155
59
|
}
|
|
156
|
-
static enable(
|
|
157
|
-
|
|
158
|
-
DebugLogger.instance = new NoOpDebugLogger();
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
DebugLogger.instance = new ActiveDebugLogger();
|
|
162
|
-
if (o) {
|
|
163
|
-
DebugLogger.instance.configure(o);
|
|
164
|
-
}
|
|
60
|
+
static enable() {
|
|
61
|
+
CycleDetector.instance = new ActiveCycleDetector();
|
|
165
62
|
}
|
|
166
63
|
static disable() {
|
|
167
|
-
|
|
64
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
168
65
|
}
|
|
169
66
|
}
|
|
170
|
-
|
|
67
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
171
68
|
|
|
172
|
-
exports.
|
|
69
|
+
exports.CycleDetector = CycleDetector;
|
package/dist/index38.mjs
CHANGED
|
@@ -1,168 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (o.constructor?.name && o.constructor.name !== 'Function') {
|
|
7
|
-
return o.constructor.name;
|
|
8
|
-
}
|
|
9
|
-
return 'AnonymousFunction';
|
|
10
|
-
}
|
|
11
|
-
if (typeof o === 'object') {
|
|
12
|
-
const e = o.constructor?.name;
|
|
13
|
-
if (e && e !== 'Object') {
|
|
14
|
-
return e;
|
|
15
|
-
}
|
|
16
|
-
if (o.name && typeof o.name === 'string') {
|
|
17
|
-
return o.name;
|
|
18
|
-
}
|
|
19
|
-
return '[Object]';
|
|
1
|
+
let AbstractCycleDetector = class AbstractCycleDetector {
|
|
2
|
+
};
|
|
3
|
+
let NoOpCycleDetector = class NoOpCycleDetector extends AbstractCycleDetector {
|
|
4
|
+
detect() {
|
|
5
|
+
return [];
|
|
20
6
|
}
|
|
21
|
-
return String(o);
|
|
22
|
-
}
|
|
23
|
-
let NoOpDebugLogger = class NoOpDebugLogger {
|
|
24
|
-
configure(o) {}
|
|
25
|
-
log(o, e, t) {}
|
|
26
|
-
logBuildStart(o) {}
|
|
27
|
-
logBuildEnd(o, e) {}
|
|
28
|
-
logRegistration(o) {}
|
|
29
|
-
logHook(o, e, t) {}
|
|
30
|
-
logPhaseStart(o, e) {}
|
|
31
|
-
logPhaseEnd(o, e, t) {}
|
|
32
|
-
logResolution(o, e, t) {}
|
|
33
|
-
logConstruction(o) {}
|
|
34
7
|
};
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
let ActiveCycleDetector = class ActiveCycleDetector extends AbstractCycleDetector {
|
|
9
|
+
detect(e, t) {
|
|
10
|
+
const c = [];
|
|
11
|
+
const s = new Set();
|
|
12
|
+
for (const [n] of e){
|
|
13
|
+
if (s.has(n)) continue;
|
|
14
|
+
const r = [];
|
|
15
|
+
const o = new Set();
|
|
16
|
+
if (this.hasCycleDFS(n, r, o, s, e)) {
|
|
17
|
+
const e = r.findIndex((e)=>e === n);
|
|
18
|
+
if (e >= 0) {
|
|
19
|
+
const s = r.slice(e).map((e)=>t(e));
|
|
20
|
+
c.push({
|
|
21
|
+
cycle: s,
|
|
22
|
+
path: s.join(' → ')
|
|
23
|
+
});
|
|
24
|
+
}
|
|
43
25
|
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
logBuildStart(o) {
|
|
47
|
-
this.log('info', 'Build started', {
|
|
48
|
-
entry: o.name
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
logBuildEnd(o, e) {
|
|
52
|
-
const t = {
|
|
53
|
-
entry: o.name
|
|
54
|
-
};
|
|
55
|
-
if (e !== undefined) t.duration = `${e.toFixed(2)}ms`;
|
|
56
|
-
this.log('info', 'Build completed', t);
|
|
57
|
-
}
|
|
58
|
-
logRegistration(e) {
|
|
59
|
-
if (!this.shouldLog('registration')) return;
|
|
60
|
-
this.log('info', 'Registration', {
|
|
61
|
-
identifier: o(e.identifier),
|
|
62
|
-
isSingleton: e.isSingleton,
|
|
63
|
-
dependencies: e.dependencies.map((e)=>o(e)),
|
|
64
|
-
tags: e.tags
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
logHook(e, t, n) {
|
|
68
|
-
if (!this.shouldLog('hooks')) return;
|
|
69
|
-
const s = this.options.logTimings ? performance.now() : 0;
|
|
70
|
-
this.log('info', `Hook: ${e}`, {
|
|
71
|
-
target: o(t),
|
|
72
|
-
config: n
|
|
73
|
-
});
|
|
74
|
-
if (this.options.logTimings) {
|
|
75
|
-
return ()=>{
|
|
76
|
-
const o = performance.now() - s;
|
|
77
|
-
this.log('info', `Hook: ${e} completed`, {
|
|
78
|
-
duration: `${o.toFixed(2)}ms`
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
26
|
}
|
|
27
|
+
return c;
|
|
82
28
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const n = e !== undefined ? {
|
|
88
|
-
duration: `${e.toFixed(2)}ms`
|
|
89
|
-
} : {};
|
|
90
|
-
if (t) {
|
|
91
|
-
Object.assign(n, t);
|
|
29
|
+
hasCycleDFS(e, t, c, s, n) {
|
|
30
|
+
if (c.has(e)) {
|
|
31
|
+
t.push(e);
|
|
32
|
+
return true;
|
|
92
33
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.log('info', `Constructing: ${o}`);
|
|
105
|
-
}
|
|
106
|
-
shouldLog(o) {
|
|
107
|
-
return !this.options.logPhases || this.options.logPhases[o] !== false;
|
|
108
|
-
}
|
|
109
|
-
log(o, e, t) {
|
|
110
|
-
if (this.options.logger) {
|
|
111
|
-
this.options.logger(o, e, t);
|
|
112
|
-
} else {
|
|
113
|
-
const n = `[Assembler:${o}]`;
|
|
114
|
-
const s = this.options.useColors !== false ? this.colorize(o, n) : n;
|
|
115
|
-
if (t) {
|
|
116
|
-
console.log(`${s} ${e}`, t);
|
|
117
|
-
} else {
|
|
118
|
-
console.log(`${s} ${e}`);
|
|
34
|
+
if (s.has(e)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
t.push(e);
|
|
38
|
+
c.add(e);
|
|
39
|
+
const r = n.get(e);
|
|
40
|
+
if (r?.dependencies && r.dependencies.length > 0) {
|
|
41
|
+
for (const e of r.dependencies){
|
|
42
|
+
if (this.hasCycleDFS(e, t, c, s, n)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
119
45
|
}
|
|
120
46
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
info: '\x1b[36m',
|
|
125
|
-
warn: '\x1b[33m',
|
|
126
|
-
error: '\x1b[31m',
|
|
127
|
-
reset: '\x1b[0m'
|
|
128
|
-
};
|
|
129
|
-
const n = t[o] || t.info;
|
|
130
|
-
return `${n}${e}${t.reset}`;
|
|
131
|
-
}
|
|
132
|
-
constructor(){
|
|
133
|
-
this.options = {
|
|
134
|
-
enabled: true,
|
|
135
|
-
logPhases: {
|
|
136
|
-
registration: true,
|
|
137
|
-
resolution: true,
|
|
138
|
-
construction: true,
|
|
139
|
-
hooks: true,
|
|
140
|
-
cache: true
|
|
141
|
-
},
|
|
142
|
-
logTimings: false,
|
|
143
|
-
logDependencyTree: true,
|
|
144
|
-
useColors: true
|
|
145
|
-
};
|
|
47
|
+
c.delete(e);
|
|
48
|
+
s.add(e);
|
|
49
|
+
return false;
|
|
146
50
|
}
|
|
147
51
|
};
|
|
148
|
-
class
|
|
52
|
+
class CycleDetector {
|
|
149
53
|
static getInstance() {
|
|
150
|
-
return
|
|
54
|
+
return CycleDetector.instance;
|
|
151
55
|
}
|
|
152
|
-
static enable(
|
|
153
|
-
|
|
154
|
-
DebugLogger.instance = new NoOpDebugLogger();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
DebugLogger.instance = new ActiveDebugLogger();
|
|
158
|
-
if (o) {
|
|
159
|
-
DebugLogger.instance.configure(o);
|
|
160
|
-
}
|
|
56
|
+
static enable() {
|
|
57
|
+
CycleDetector.instance = new ActiveCycleDetector();
|
|
161
58
|
}
|
|
162
59
|
static disable() {
|
|
163
|
-
|
|
60
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
164
61
|
}
|
|
165
62
|
}
|
|
166
|
-
|
|
63
|
+
CycleDetector.instance = new NoOpCycleDetector();
|
|
167
64
|
|
|
168
|
-
export {
|
|
65
|
+
export { CycleDetector };
|