mirror of
https://github.com/facebook/react.git
synced 2026-02-21 19:31:52 +00:00
[DevTools] Remove experimental __IS_INTERNAL_MCP_BUILD__ flag and related code (#35755)
This is unused.
This commit is contained in:
@@ -507,7 +507,6 @@ module.exports = {
|
||||
__IS_FIREFOX__: 'readonly',
|
||||
__IS_EDGE__: 'readonly',
|
||||
__IS_NATIVE__: 'readonly',
|
||||
__IS_INTERNAL_MCP_BUILD__: 'readonly',
|
||||
__IS_INTERNAL_VERSION__: 'readonly',
|
||||
chrome: 'readonly',
|
||||
},
|
||||
|
||||
@@ -72,7 +72,6 @@ module.exports = {
|
||||
__IS_CHROME__: false,
|
||||
__IS_EDGE__: false,
|
||||
__IS_NATIVE__: true,
|
||||
__IS_INTERNAL_MCP_BUILD__: false,
|
||||
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-core"`,
|
||||
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
|
||||
'process.env.GITHUB_URL': `"${GITHUB_URL}"`,
|
||||
|
||||
@@ -91,7 +91,6 @@ module.exports = {
|
||||
__IS_FIREFOX__: false,
|
||||
__IS_CHROME__: false,
|
||||
__IS_EDGE__: false,
|
||||
__IS_INTERNAL_MCP_BUILD__: false,
|
||||
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-core"`,
|
||||
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
|
||||
'process.env.EDITOR_URL': EDITOR_URL != null ? `"${EDITOR_URL}"` : null,
|
||||
|
||||
@@ -34,8 +34,6 @@ const IS_FIREFOX = process.env.IS_FIREFOX === 'true';
|
||||
const IS_EDGE = process.env.IS_EDGE === 'true';
|
||||
const IS_INTERNAL_VERSION = process.env.FEATURE_FLAG_TARGET === 'extension-fb';
|
||||
|
||||
const IS_INTERNAL_MCP_BUILD = process.env.IS_INTERNAL_MCP_BUILD === 'true';
|
||||
|
||||
const featureFlagTarget = process.env.FEATURE_FLAG_TARGET || 'extension-oss';
|
||||
|
||||
let statsFileName = `webpack-stats.${featureFlagTarget}.${__DEV__ ? 'development' : 'production'}`;
|
||||
@@ -48,9 +46,6 @@ if (IS_FIREFOX) {
|
||||
if (IS_EDGE) {
|
||||
statsFileName += `.edge`;
|
||||
}
|
||||
if (IS_INTERNAL_MCP_BUILD) {
|
||||
statsFileName += `.mcp`;
|
||||
}
|
||||
statsFileName += '.json';
|
||||
|
||||
const babelOptions = {
|
||||
@@ -139,7 +134,6 @@ module.exports = {
|
||||
__IS_FIREFOX__: IS_FIREFOX,
|
||||
__IS_EDGE__: IS_EDGE,
|
||||
__IS_NATIVE__: false,
|
||||
__IS_INTERNAL_MCP_BUILD__: IS_INTERNAL_MCP_BUILD,
|
||||
__IS_INTERNAL_VERSION__: IS_INTERNAL_VERSION,
|
||||
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-extensions"`,
|
||||
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
|
||||
|
||||
@@ -85,7 +85,6 @@ module.exports = {
|
||||
__IS_CHROME__: false,
|
||||
__IS_FIREFOX__: false,
|
||||
__IS_EDGE__: false,
|
||||
__IS_INTERNAL_MCP_BUILD__: false,
|
||||
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-fusebox"`,
|
||||
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
|
||||
'process.env.EDITOR_URL': EDITOR_URL != null ? `"${EDITOR_URL}"` : null,
|
||||
|
||||
@@ -77,7 +77,6 @@ module.exports = {
|
||||
__IS_FIREFOX__: false,
|
||||
__IS_EDGE__: false,
|
||||
__IS_NATIVE__: false,
|
||||
__IS_INTERNAL_MCP_BUILD__: false,
|
||||
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-inline"`,
|
||||
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
|
||||
'process.env.EDITOR_URL': EDITOR_URL != null ? `"${EDITOR_URL}"` : null,
|
||||
|
||||
@@ -8871,86 +8871,6 @@ export function attach(
|
||||
return unresolvedSource;
|
||||
}
|
||||
|
||||
type InternalMcpFunctions = {
|
||||
__internal_only_getComponentTree?: Function,
|
||||
};
|
||||
|
||||
const internalMcpFunctions: InternalMcpFunctions = {};
|
||||
if (__IS_INTERNAL_MCP_BUILD__) {
|
||||
// eslint-disable-next-line no-inner-declarations
|
||||
function __internal_only_getComponentTree(): string {
|
||||
let treeString = '';
|
||||
|
||||
function buildTreeString(
|
||||
instance: DevToolsInstance,
|
||||
prefix: string = '',
|
||||
isLastChild: boolean = true,
|
||||
): void {
|
||||
if (!instance) return;
|
||||
|
||||
const name =
|
||||
(instance.kind !== VIRTUAL_INSTANCE
|
||||
? getDisplayNameForFiber(instance.data)
|
||||
: instance.data.name) || 'Unknown';
|
||||
|
||||
const id = instance.id !== undefined ? instance.id : 'unknown';
|
||||
|
||||
if (name !== 'createRoot()') {
|
||||
treeString +=
|
||||
prefix +
|
||||
(isLastChild ? '└── ' : '├── ') +
|
||||
name +
|
||||
' (id: ' +
|
||||
id +
|
||||
')\n';
|
||||
}
|
||||
|
||||
const childPrefix = prefix + (isLastChild ? ' ' : '│ ');
|
||||
|
||||
let childCount = 0;
|
||||
let tempChild = instance.firstChild;
|
||||
while (tempChild !== null) {
|
||||
childCount++;
|
||||
tempChild = tempChild.nextSibling;
|
||||
}
|
||||
|
||||
let child = instance.firstChild;
|
||||
let currentChildIndex = 0;
|
||||
|
||||
while (child !== null) {
|
||||
currentChildIndex++;
|
||||
const isLastSibling = currentChildIndex === childCount;
|
||||
buildTreeString(child, childPrefix, isLastSibling);
|
||||
child = child.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
const rootInstances: Array<DevToolsInstance> = [];
|
||||
idToDevToolsInstanceMap.forEach(instance => {
|
||||
if (instance.parent === null || instance.parent.parent === null) {
|
||||
rootInstances.push(instance);
|
||||
}
|
||||
});
|
||||
|
||||
if (rootInstances.length > 0) {
|
||||
for (let i = 0; i < rootInstances.length; i++) {
|
||||
const isLast = i === rootInstances.length - 1;
|
||||
buildTreeString(rootInstances[i], '', isLast);
|
||||
if (!isLast) {
|
||||
treeString += '\n';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
treeString = 'No component tree found.';
|
||||
}
|
||||
|
||||
return treeString;
|
||||
}
|
||||
|
||||
internalMcpFunctions.__internal_only_getComponentTree =
|
||||
__internal_only_getComponentTree;
|
||||
}
|
||||
|
||||
return {
|
||||
cleanup,
|
||||
clearErrorsAndWarnings,
|
||||
@@ -8994,6 +8914,5 @@ export function attach(
|
||||
supportsTogglingSuspense,
|
||||
updateComponentFilters,
|
||||
getEnvironmentNames,
|
||||
...internalMcpFunctions,
|
||||
};
|
||||
}
|
||||
|
||||
1
scripts/flow/react-devtools.js
vendored
1
scripts/flow/react-devtools.js
vendored
@@ -16,6 +16,5 @@ declare const __IS_FIREFOX__: boolean;
|
||||
declare const __IS_CHROME__: boolean;
|
||||
declare const __IS_EDGE__: boolean;
|
||||
declare const __IS_NATIVE__: boolean;
|
||||
declare const __IS_INTERNAL_MCP_BUILD__: boolean;
|
||||
|
||||
declare const chrome: any;
|
||||
|
||||
@@ -15,7 +15,6 @@ global.__IS_FIREFOX__ = false;
|
||||
global.__IS_CHROME__ = false;
|
||||
global.__IS_EDGE__ = false;
|
||||
global.__IS_NATIVE__ = false;
|
||||
global.__IS_INTERNAL_MCP_BUILD__ = false;
|
||||
|
||||
const ReactVersionTestingAgainst = process.env.REACT_VERSION || ReactVersion;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user