@@ -66,7 +66,7 @@ export class TutorialRunner {
66
66
private _currentTemplate : Files | undefined = undefined ;
67
67
private _currentFiles : Files | undefined = undefined ;
68
68
private _currentRunCommands : Commands | undefined = undefined ;
69
- private _terminal : ITerminal | undefined = undefined ;
69
+ private _output : ITerminal | undefined = undefined ;
70
70
private _packageJsonDirty = false ;
71
71
72
72
// this strongly assumes that there's a single package json which might not be true
@@ -287,8 +287,8 @@ export class TutorialRunner {
287
287
*
288
288
* @param terminal Terminal to hook up to WebContainer.
289
289
*/
290
- hookTerminal ( terminal : ITerminal ) {
291
- this . _terminal = terminal ;
290
+ hookOutputPanel ( terminal : ITerminal ) {
291
+ this . _output = terminal ;
292
292
293
293
if ( ! isWebContainerSupported ( ) ) {
294
294
terminal . write (
@@ -348,8 +348,8 @@ export class TutorialRunner {
348
348
}
349
349
}
350
350
351
- onTerminalResize ( ) {
352
- const { cols, rows } = this . _terminal ?? { } ;
351
+ onOutputResize ( ) {
352
+ const { cols, rows } = this . _output ?? { } ;
353
353
354
354
if ( cols && rows ) {
355
355
this . _currentCommandProcess ?. resize ( { cols, rows } ) ;
@@ -464,7 +464,7 @@ export class TutorialRunner {
464
464
}
465
465
466
466
private async _runCommands ( webcontainer : WebContainer , commands : Commands , signal : AbortSignal ) {
467
- clearTerminal ( this . _terminal ) ;
467
+ clearTerminal ( this . _output ) ;
468
468
469
469
const abortListener = ( ) => this . _currentCommandProcess ?. kill ( ) ;
470
470
signal . addEventListener ( 'abort' , abortListener , { once : true } ) ;
@@ -495,7 +495,7 @@ export class TutorialRunner {
495
495
496
496
// print newlines between commands to visually separate them from one another
497
497
if ( index > 0 ) {
498
- this . _terminal ?. write ( '\n' ) ;
498
+ this . _output ?. write ( '\n' ) ;
499
499
}
500
500
501
501
this . _currentCommandProcess = await this . _newProcess ( webcontainer , command . shellCommand ) ;
@@ -547,18 +547,18 @@ export class TutorialRunner {
547
547
private async _newProcess ( webcontainer : WebContainer , shellCommand : string ) {
548
548
const [ command , ...args ] = shellCommand . split ( ' ' ) ;
549
549
550
- this . _terminal ?. write ( `${ escapeCodes . magenta ( '❯' ) } ${ escapeCodes . green ( command ) } ${ args . join ( ' ' ) } \n` ) ;
550
+ this . _output ?. write ( `${ escapeCodes . magenta ( '❯' ) } ${ escapeCodes . green ( command ) } ${ args . join ( ' ' ) } \n` ) ;
551
551
552
552
const process = await webcontainer . spawn ( command , args , {
553
- terminal : this . _terminal
553
+ terminal : this . _output
554
554
? {
555
- cols : this . _terminal . cols ,
556
- rows : this . _terminal . rows ,
555
+ cols : this . _output . cols ,
556
+ rows : this . _output . rows ,
557
557
}
558
558
: undefined ,
559
559
} ) ;
560
560
561
- process . output . pipeTo ( new WritableStream ( { write : ( data ) => this . _terminal ?. write ( data ) } ) ) ;
561
+ process . output . pipeTo ( new WritableStream ( { write : ( data ) => this . _output ?. write ( data ) } ) ) ;
562
562
563
563
return process ;
564
564
}
0 commit comments