Better processedList capture
MODIFY
packages/@romejs/cli-diagnostics/printAdvice.ts
packages/@romejs/cli-diagnostics/printAdvice.ts
@@ -351,7 +351,7 @@ function printStacktrace(
opts.reporter.processedList(
frames,
- (frame, display) => {
+ (reporter, frame) => {
const {
filename,
object,
@@ -406,6 +406,8 @@ function printStacktrace(
}
}
+ reporter.logAll(logParts.join(' '));
+
if (
shownCodeFrames < 2 &&
filename !== undefined &&
@@ -430,15 +432,16 @@ function printStacktrace(
sourceText: code,
},
},
- opts,
+ {
+ ...opts,
+ reporter,
+ },
);
if (!skipped) {
- opts.reporter.br(true);
+ reporter.br(true);
shownCodeFrames++;
}
}
-
- display(logParts.join(' '));
},
{
ordered: true,

MODIFY
packages/@romejs/cli-reporter/Reporter.ts
packages/@romejs/cli-reporter/Reporter.ts
@@ -1090,7 +1090,7 @@ export default class Reporter {
processedList<T>(
items: Array<T>,
- callback: (item: T, display: (str: string) => void) => void,
+ callback: (reporter: Reporter, item: T) => void,
opts: ListOptions = {},
): {
truncated: boolean;
@@ -1112,14 +1112,13 @@ export default class Reporter {
let buff = '';
for (const item of items) {
- const stream = this.attachCaptureStream('markup');
- callback(
- item,
- (str) => {
- buff += `<li>${str}${stream.read()}</li>`;
- },
- );
+ const reporter = this.fork({
+ streams: [],
+ });
+ const stream = reporter.attachCaptureStream('markup');
+ callback(reporter, item);
stream.remove();
+ buff += `<li>${stream.read()}</li>`;
}
if (opts.ordered) {
@@ -1137,7 +1136,13 @@ export default class Reporter {
}
list(items: Array<string>, opts: ListOptions = {}) {
- return this.processedList(items, (str, display) => display(str), opts);
+ return this.processedList(
+ items,
+ (reporter, str) => {
+ reporter.logAll(str, {newline: false});
+ },
+ opts,
+ );
}
progress(opts?: ReporterProgressOptions): ReporterProgress {

Better processedList capture