@@ -16,6 +16,7 @@ import {
1616 formatSlowest ,
1717 formatRerenders ,
1818 formatTimeline ,
19+ formatCommitDetail ,
1920} from './formatters.js' ;
2021import type { IpcCommand } from './types.js' ;
2122
@@ -39,7 +40,8 @@ Profiling:
3940 profile report <@c1 | id> Render report for component
4041 profile slow [--limit N] Slowest components (by avg)
4142 profile rerenders [--limit N] Most re-rendered components
42- profile timeline [--limit N] Commit timeline` ;
43+ profile timeline [--limit N] Commit timeline
44+ profile commit <N | #N> Detail for specific commit` ;
4345}
4446
4547function parseArgs ( argv : string [ ] ) : {
@@ -265,6 +267,27 @@ async function main(): Promise<void> {
265267 return ;
266268 }
267269
270+ if ( cmd0 === 'profile' && cmd1 === 'commit' ) {
271+ const raw = command [ 2 ] ;
272+ if ( ! raw ) {
273+ console . error ( 'Usage: devtools profile commit <N | #N>' ) ;
274+ process . exit ( 1 ) ;
275+ }
276+ const index = parseInt ( raw . replace ( / ^ # / , '' ) , 10 ) ;
277+ if ( isNaN ( index ) ) {
278+ console . error ( 'Usage: devtools profile commit <N | #N>' ) ;
279+ process . exit ( 1 ) ;
280+ }
281+ const resp = await sendCommand ( { type : 'profile-commit' , index } ) ;
282+ if ( resp . ok ) {
283+ console . log ( formatCommitDetail ( resp . data as any ) ) ;
284+ } else {
285+ console . error ( resp . error ) ;
286+ process . exit ( 1 ) ;
287+ }
288+ return ;
289+ }
290+
268291 if ( cmd0 === 'profile' && cmd1 === 'timeline' ) {
269292 const limit = flags [ 'limit' ] ? parseInt ( flags [ 'limit' ] as string , 10 ) : undefined ;
270293 const resp = await sendCommand ( { type : 'profile-timeline' , limit } ) ;
0 commit comments