@oclif/core 2.6.0 → 2.6.1
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/lib/performance.js +9 -2
- package/package.json +1 -1
package/lib/performance.js
CHANGED
|
@@ -33,6 +33,8 @@ class Performance {
|
|
|
33
33
|
return settings_1.settings.performanceEnabled ?? false;
|
|
34
34
|
}
|
|
35
35
|
static get results() {
|
|
36
|
+
if (!Performance.enabled)
|
|
37
|
+
return [];
|
|
36
38
|
if (Performance._results.length > 0)
|
|
37
39
|
return Performance._results;
|
|
38
40
|
throw new Error('Perf results not available. Did you forget to call await Performance.collect()?');
|
|
@@ -41,6 +43,8 @@ class Performance {
|
|
|
41
43
|
return Performance.results.find(r => r.name === name);
|
|
42
44
|
}
|
|
43
45
|
static get highlights() {
|
|
46
|
+
if (!Performance.enabled)
|
|
47
|
+
return {};
|
|
44
48
|
if (Performance._highlights)
|
|
45
49
|
return Performance._highlights;
|
|
46
50
|
throw new Error('Perf results not available. Did you forget to call await Performance.collect()?');
|
|
@@ -69,7 +73,10 @@ class Performance {
|
|
|
69
73
|
return;
|
|
70
74
|
if (Performance._results.length > 0)
|
|
71
75
|
return;
|
|
72
|
-
|
|
76
|
+
const markers = Object.values(Performance.markers);
|
|
77
|
+
if (markers.length === 0)
|
|
78
|
+
return;
|
|
79
|
+
for (const marker of markers.filter(m => !m.stopped)) {
|
|
73
80
|
marker.stop();
|
|
74
81
|
}
|
|
75
82
|
return new Promise(resolve => {
|
|
@@ -128,7 +135,7 @@ class Performance {
|
|
|
128
135
|
resolve();
|
|
129
136
|
});
|
|
130
137
|
perfObserver.observe({ entryTypes: ['measure'], buffered: true });
|
|
131
|
-
for (const marker of
|
|
138
|
+
for (const marker of markers) {
|
|
132
139
|
try {
|
|
133
140
|
marker.measure();
|
|
134
141
|
}
|