@@ -8871,86 +8871,6 @@ export function attach(
88718871 return unresolvedSource ;
88728872 }
88738873
8874- type InternalMcpFunctions = {
8875- __internal_only_getComponentTree ?: Function ,
8876- } ;
8877-
8878- const internalMcpFunctions : InternalMcpFunctions = { } ;
8879- if ( __IS_INTERNAL_MCP_BUILD__ ) {
8880- // eslint-disable-next-line no-inner-declarations
8881- function __internal_only_getComponentTree ( ) : string {
8882- let treeString = '' ;
8883-
8884- function buildTreeString (
8885- instance : DevToolsInstance ,
8886- prefix : string = '' ,
8887- isLastChild : boolean = true ,
8888- ) : void {
8889- if ( ! instance ) return ;
8890-
8891- const name =
8892- ( instance . kind !== VIRTUAL_INSTANCE
8893- ? getDisplayNameForFiber ( instance . data )
8894- : instance . data . name ) || 'Unknown' ;
8895-
8896- const id = instance . id !== undefined ? instance . id : 'unknown' ;
8897-
8898- if ( name !== 'createRoot()' ) {
8899- treeString +=
8900- prefix +
8901- ( isLastChild ? '└── ' : '├── ' ) +
8902- name +
8903- ' (id: ' +
8904- id +
8905- ')\n' ;
8906- }
8907-
8908- const childPrefix = prefix + ( isLastChild ? ' ' : '│ ' ) ;
8909-
8910- let childCount = 0 ;
8911- let tempChild = instance . firstChild ;
8912- while ( tempChild !== null ) {
8913- childCount ++ ;
8914- tempChild = tempChild . nextSibling ;
8915- }
8916-
8917- let child = instance . firstChild ;
8918- let currentChildIndex = 0 ;
8919-
8920- while ( child !== null ) {
8921- currentChildIndex ++ ;
8922- const isLastSibling = currentChildIndex === childCount ;
8923- buildTreeString ( child , childPrefix , isLastSibling ) ;
8924- child = child . nextSibling ;
8925- }
8926- }
8927-
8928- const rootInstances : Array < DevToolsInstance > = [];
8929- idToDevToolsInstanceMap.forEach(instance => {
8930- if ( instance . parent === null || instance . parent . parent === null ) {
8931- rootInstances . push ( instance ) ;
8932- }
8933- } ) ;
8934-
8935- if ( rootInstances . length > 0 ) {
8936- for ( let i = 0 ; i < rootInstances . length ; i ++ ) {
8937- const isLast = i === rootInstances . length - 1 ;
8938- buildTreeString ( rootInstances [ i ] , '' , isLast ) ;
8939- if ( ! isLast ) {
8940- treeString += '\n' ;
8941- }
8942- }
8943- } else {
8944- treeString = 'No component tree found.' ;
8945- }
8946-
8947- return treeString ;
8948- }
8949-
8950- internalMcpFunctions . __internal_only_getComponentTree =
8951- __internal_only_getComponentTree ;
8952- }
8953-
89548874 return {
89558875 cleanup ,
89568876 clearErrorsAndWarnings,
@@ -8994,6 +8914,5 @@ export function attach(
89948914 supportsTogglingSuspense,
89958915 updateComponentFilters,
89968916 getEnvironmentNames,
8997- ...internalMcpFunctions ,
89988917 } ;
89998918}
0 commit comments