@@ -305,10 +305,6 @@ function writeManifest(manifest: BatchManifest): void {
305305 writeFileSync ( manifest . manifestPath , JSON . stringify ( manifest , null , 2 ) + "\n" , "utf8" ) ;
306306}
307307
308- function emitJsonEvent ( event : Record < string , unknown > , json : boolean ) : void {
309- if ( json ) console . log ( JSON . stringify ( event ) ) ;
310- }
311-
312308async function renderBatchRow (
313309 row : PreparedBatchRow ,
314310 manifest : BatchManifest ,
@@ -322,11 +318,6 @@ async function renderBatchRow(
322318 manifestRow . status = "running" ;
323319 manifestRow . startedAt = new Date ( ) . toISOString ( ) ;
324320 writeManifest ( manifest ) ;
325- emitJsonEvent (
326- { type : "batch-row-start" , index : row . index , outputPath : row . outputPath } ,
327- options . json ,
328- ) ;
329-
330321 if ( ! options . quiet && ! options . json ) {
331322 console . log ( c . dim ( `Batch row ${ row . index } : ${ row . outputPath } ` ) ) ;
332323 }
@@ -339,31 +330,12 @@ async function renderBatchRow(
339330 manifestRow . renderTimeMs = result . renderTimeMs ;
340331 manifestRow . completedAt = new Date ( ) . toISOString ( ) ;
341332 writeManifest ( manifest ) ;
342- emitJsonEvent (
343- {
344- type : "batch-row-complete" ,
345- index : row . index ,
346- outputPath : row . outputPath ,
347- durationMs : manifestRow . durationMs ,
348- renderTimeMs : manifestRow . renderTimeMs ,
349- } ,
350- options . json ,
351- ) ;
352333 return true ;
353334 } catch ( error : unknown ) {
354335 manifestRow . status = "failed" ;
355336 manifestRow . error = errorMessage ( error ) ;
356337 manifestRow . completedAt = new Date ( ) . toISOString ( ) ;
357338 writeManifest ( manifest ) ;
358- emitJsonEvent (
359- {
360- type : "batch-row-error" ,
361- index : row . index ,
362- outputPath : row . outputPath ,
363- error : manifestRow . error ,
364- } ,
365- options . json ,
366- ) ;
367339 if ( ! options . quiet && ! options . json ) {
368340 console . log ( c . error ( ` Row ${ row . index } failed: ${ manifestRow . error } ` ) ) ;
369341 }
@@ -423,17 +395,19 @@ export async function runBatchRender(options: RunBatchRenderOptions): Promise<Ba
423395
424396 if ( stopLaunching ) markUnstartedRowsSkipped ( manifest ) ;
425397 writeManifest ( manifest ) ;
426- emitJsonEvent (
427- {
428- type : "batch-complete" ,
429- manifestPath : manifest . manifestPath ,
430- total : manifest . total ,
431- completed : manifest . completed ,
432- failed : manifest . failed ,
433- skipped : manifest . skipped ,
434- } ,
435- options . json ,
436- ) ;
398+ if ( options . json ) {
399+ console . log (
400+ JSON . stringify ( {
401+ type : "batch-complete" ,
402+ manifestPath : manifest . manifestPath ,
403+ total : manifest . total ,
404+ completed : manifest . completed ,
405+ failed : manifest . failed ,
406+ skipped : manifest . skipped ,
407+ rows : manifest . rows ,
408+ } ) ,
409+ ) ;
410+ }
437411
438412 if ( ! options . quiet && ! options . json ) {
439413 console . log ( "" ) ;
0 commit comments