@@ -4,13 +4,13 @@ import {CLIError, error, exit, warn} from '../errors'
44import { Debug , collectUsableIds , getCommandIdPermutations } from './util'
55import { Hook , Hooks , PJSON , Topic } from '../interfaces'
66import { Plugin as IPlugin , Options } from '../interfaces/plugin'
7+ import { OCLIF_MARKER_OWNER , Performance } from '../performance'
78import { URL , fileURLToPath } from 'node:url'
89import { arch , userInfo as osUserInfo , release , tmpdir , type } from 'node:os'
910import { compact , isProd } from '../util/util'
1011import { getHomeDir , getPlatform } from '../util/os'
11- import { join , sep } from 'node:path'
12+ import { join , sep } from 'node:path'
1213import { Command } from '../command'
13- import { Performance } from '../performance'
1414import PluginLoader from './plugin-loader'
1515import WSL from 'is-wsl'
1616import { format } from 'node:util'
@@ -153,9 +153,8 @@ export class Config implements IConfig {
153153
154154 // eslint-disable-next-line complexity
155155 public async load ( ) : Promise < void > {
156- settings . performanceEnabled =
157- ( settings . performanceEnabled === undefined ? this . options . enablePerf : settings . performanceEnabled ) ?? false
158- const marker = Performance . mark ( 'config.load' )
156+ settings . performanceEnabled = ( settings . performanceEnabled === undefined ? this . options . enablePerf : settings . performanceEnabled ) ?? false
157+ const marker = Performance . mark ( OCLIF_MARKER_OWNER , 'config.load' )
159158 this . pluginLoader = new PluginLoader ( { root : this . options . root , plugins : this . options . plugins } )
160159 Config . _rootPlugin = await this . pluginLoader . loadRoot ( )
161160
@@ -235,7 +234,7 @@ export class Config implements IConfig {
235234 }
236235
237236 async loadPluginsAndCommands ( opts ?: { force : boolean } ) : Promise < void > {
238- const pluginsMarker = Performance . mark ( 'config.loadAllPlugins' )
237+ const pluginsMarker = Performance . mark ( OCLIF_MARKER_OWNER , 'config.loadAllPlugins' )
239238 const { plugins, errors} = await this . pluginLoader . loadChildren ( {
240239 devPlugins : this . options . devPlugins ,
241240 userPlugins : this . options . userPlugins ,
@@ -247,7 +246,7 @@ export class Config implements IConfig {
247246 this . plugins = plugins
248247 pluginsMarker ?. stop ( )
249248
250- const commandsMarker = Performance . mark ( 'config.loadAllCommands' )
249+ const commandsMarker = Performance . mark ( OCLIF_MARKER_OWNER , 'config.loadAllCommands' )
251250 for ( const plugin of this . plugins . values ( ) ) {
252251 this . loadCommands ( plugin )
253252 this . loadTopics ( plugin )
@@ -266,7 +265,7 @@ export class Config implements IConfig {
266265 timeout ?: number ,
267266 captureErrors ?: boolean ,
268267 ) : Promise < Hook . Result < Hooks [ T ] [ 'return' ] > > {
269- const marker = Performance . mark ( `config.runHook#${ event } ` )
268+ const marker = Performance . mark ( OCLIF_MARKER_OWNER , `config.runHook#${ event } ` )
270269 debug ( 'start %s hook' , event )
271270 const search = ( m : any ) : Hook < T > => {
272271 if ( typeof m === 'function' ) return m
@@ -314,7 +313,7 @@ export class Config implements IConfig {
314313 const hooks = p . hooks [ event ] || [ ]
315314
316315 for ( const hook of hooks ) {
317- const marker = Performance . mark ( `config.runHook#${ p . name } (${ hook } )` )
316+ const marker = Performance . mark ( OCLIF_MARKER_OWNER , `config.runHook#${ p . name } (${ hook } )` )
318317 try {
319318 /* eslint-disable no-await-in-loop */
320319 const { isESM, module, filePath} = await loadWithData ( p , join ( p . root , hook ) )
@@ -358,7 +357,7 @@ export class Config implements IConfig {
358357 argv : string [ ] = [ ] ,
359358 cachedCommand : Command . Loadable | null = null ,
360359 ) : Promise < T > {
361- const marker = Performance . mark ( `config.runCommand#${ id } ` )
360+ const marker = Performance . mark ( OCLIF_MARKER_OWNER , `config.runCommand#${ id } ` )
362361 debug ( 'runCommand %s %o' , id , argv )
363362 let c = cachedCommand ?? this . findCommand ( id )
364363 if ( ! c ) {
@@ -681,7 +680,7 @@ export class Config implements IConfig {
681680 }
682681
683682 private loadCommands ( plugin : IPlugin ) {
684- const marker = Performance . mark ( `config.loadCommands#${ plugin . name } ` , { plugin : plugin . name } )
683+ const marker = Performance . mark ( OCLIF_MARKER_OWNER , `config.loadCommands#${ plugin . name } ` , { plugin : plugin . name } )
685684 for ( const command of plugin . commands ) {
686685 // set canonical command id
687686 if ( this . _commands . has ( command . id ) ) {
@@ -731,7 +730,7 @@ export class Config implements IConfig {
731730 }
732731
733732 private loadTopics ( plugin : IPlugin ) {
734- const marker = Performance . mark ( `config.loadTopics#${ plugin . name } ` , { plugin : plugin . name } )
733+ const marker = Performance . mark ( OCLIF_MARKER_OWNER , `config.loadTopics#${ plugin . name } ` , { plugin : plugin . name } )
735734 for ( const topic of compact ( plugin . topics ) ) {
736735 const existing = this . _topics . get ( topic . name )
737736 if ( existing ) {
0 commit comments