Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ packages/react-devtools-inline/dist
packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/
packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/
packages/react-devtools-shell/dist
packages/react-devtools-timeline/dist
packages/react-devtools-timeline/static
packages/react-devtools-cdt-mcp/dist
packages/react-devtools-cdt-mcp/fixtures

Expand Down
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ module.exports = {
'packages/react-debug-tools/**/*.js',
'packages/react-devtools-extensions/**/*.js',
'packages/react-devtools-facade/**/*.js',
'packages/react-devtools-timeline/**/*.js',
'packages/react-native-renderer/**/*.js',
'packages/react-native-renderer/**/*.js',
'packages/eslint-plugin-react-hooks/**/*.js',
'packages/jest-react/**/*.js',
'packages/internal-test-utils/**/*.js',
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ packages/react-devtools-extensions/.tempUserDataDir
packages/react-devtools-fusebox/dist
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist
packages/react-devtools-timeline/dist
packages/react-devtools-cdt-mcp/dist
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ packages/react-devtools-inline/dist
packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/
packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/
packages/react-devtools-shell/dist
packages/react-devtools-timeline/dist
packages/react-devtools-timeline/static

# react compiler
compiler/**/dist
Expand Down
1 change: 0 additions & 1 deletion fixtures/devtools/scheduling-profiler/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions fixtures/devtools/scheduling-profiler/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions fixtures/devtools/scheduling-profiler/app.js

This file was deleted.

14 changes: 0 additions & 14 deletions fixtures/devtools/scheduling-profiler/index.html

This file was deleted.

78 changes: 0 additions & 78 deletions fixtures/devtools/scheduling-profiler/run.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react-devtools-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (process.env.NODE_ENV !== 'production') {
|---------------------------|-------------|
| `settings` | Optional. If not specified, or received as null, then default settings are used. Can be plain object or a Promise that resolves with the [plain settings object](#Settings). If Promise rejects, the console will not be patched and some console features from React DevTools will not work. |
| `shouldStartProfilingNow` | Optional. Whether to start profiling immediately after installing the hook. Defaults to `false`. |
| `profilingSettings` | Optional. Profiling settings used when `shouldStartProfilingNow` is `true`. Defaults to `{ recordChangeDescriptions: false, recordTimeline: false }`. |
| `profilingSettings` | Optional. Profiling settings used when `shouldStartProfilingNow` is `true`. Defaults to `{ recordChangeDescriptions: false }`. |
| `componentFilters` | Optional. Array or Promise that resolves to an array of component filters to apply before DevTools connects. Defaults to the built-in host component filter. See [Component filters](#component-filters) for the full spec. |

#### `Settings`
Expand Down
12 changes: 10 additions & 2 deletions packages/react-devtools-core/src/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {flushSync} from 'react-dom';
import {createRoot} from 'react-dom/client';
import Bridge from 'react-devtools-shared/src/bridge';
import Store from 'react-devtools-shared/src/devtools/store';
import {subscribeToStoreErrors} from 'react-devtools-shared/src/devtools/storeErrorLogger';
import {getSavedComponentFilters} from 'react-devtools-shared/src/utils';
import {registerDevToolsEventLogger} from 'react-devtools-shared/src/registerDevToolsEventLogger';
import {Server} from 'ws';
Expand Down Expand Up @@ -209,8 +210,14 @@ function onError({code, message}: $FlowFixMe) {

function openProfiler() {
// Mocked up bridge and store to allow the DevTools to be rendered
bridge = new Bridge({listen: () => () => {}, send: () => {}});
store = new Store(bridge, {});
const profilerBridge: FrontendBridge = new Bridge({
listen: () => () => {},
send: () => {},
});
const profilerStore = new Store(profilerBridge, {});
bridge = profilerBridge;
store = profilerStore;
subscribeToStoreErrors(profilerStore, profilerBridge);

// Ensure the Profiler tab is shown initially.
localStorageSetItem(
Expand Down Expand Up @@ -276,6 +283,7 @@ function initialize(socket: WebSocket) {
supportsTraceUpdates: true,
supportsClickToInspect: true,
});
subscribeToStoreErrors(store, bridge as any as FrontendBridge);

log('Connected');
statusListener('DevTools initialized.', 'devtools-connected');
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-extensions/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {flushSync} from 'react-dom';
import {createRoot} from 'react-dom/client';
import Bridge from 'react-devtools-shared/src/bridge';
import Store from 'react-devtools-shared/src/devtools/store';
import {subscribeToStoreErrors} from 'react-devtools-shared/src/devtools/storeErrorLogger';
import {getBrowserTheme} from '../utils';
import {
localStorageGetItem,
Expand Down Expand Up @@ -254,12 +255,11 @@ function createDevToolsInstance(): DevToolsInstance {
const store = new Store(bridge, {
isProfiling,
supportsReloadAndProfile: __IS_CHROME__ || __IS_EDGE__,
// At this time, the timeline can only parse Chrome performance profiles.
supportsTimeline: __IS_CHROME__,
supportsTraceUpdates: true,
supportsInspectMatchingDOMElement: true,
supportsClickToInspect: true,
});
subscribeToStoreErrors(store, bridge);

store.addListener('settingsUpdated', (hookSettings, componentFilters) => {
chrome.storage.local.set({...hookSettings, componentFilters});
Expand Down
5 changes: 0 additions & 5 deletions packages/react-devtools-facade/src/DevToolsFacade.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ export function installFacade(target?: any = globalThis): Facade {
profilingState.onPostCommit(root);
}
},
getInternalModuleRanges(): Array<[string, string]> {
return [];
},
registerInternalModuleStart() {},
registerInternalModuleStop() {},
};

Object.defineProperty(target, '__REACT_DEVTOOLS_GLOBAL_HOOK__', {
Expand Down
5 changes: 4 additions & 1 deletion packages/react-devtools-fusebox/src/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as React from 'react';
import {createRoot} from 'react-dom/client';
import Bridge from 'react-devtools-shared/src/bridge';
import Store from 'react-devtools-shared/src/devtools/store';
import {subscribeToStoreErrors} from 'react-devtools-shared/src/devtools/storeErrorLogger';
import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';

import type {
Expand All @@ -36,12 +37,14 @@ export function createBridge(wall?: Wall): FrontendBridge {
}

export function createStore(bridge: FrontendBridge, config?: Config): Store {
return new Store(bridge, {
const store = new Store(bridge, {
checkBridgeProtocolCompatibility: true,
supportsTraceUpdates: true,
supportsClickToInspect: true,
...config,
});
subscribeToStoreErrors(store, bridge);
return store;
}

type InitializationOptions = {
Expand Down
6 changes: 4 additions & 2 deletions packages/react-devtools-inline/src/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from 'react';
import {forwardRef} from 'react';
import Bridge from 'react-devtools-shared/src/bridge';
import Store from 'react-devtools-shared/src/devtools/store';
import {subscribeToStoreErrors} from 'react-devtools-shared/src/devtools/storeErrorLogger';
import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
import {getSavedComponentFilters} from 'react-devtools-shared/src/utils';

Expand All @@ -13,12 +14,13 @@ import type {Props} from 'react-devtools-shared/src/devtools/views/DevTools';
import type {Config} from 'react-devtools-shared/src/devtools/store';

export function createStore(bridge: FrontendBridge, config?: Config): Store {
return new Store(bridge, {
const store = new Store(bridge, {
checkBridgeProtocolCompatibility: true,
supportsTraceUpdates: true,
supportsTimeline: true,
...config,
});
subscribeToStoreErrors(store, bridge);
return store;
}

export function createBridge(contentWindow: any, wall?: Wall): FrontendBridge {
Expand Down
25 changes: 25 additions & 0 deletions packages/react-devtools-shared/src/Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,31 @@ export const logEvent: LogFunction =
}
: function logEvent() {};

export function logErrorEvent(
error: mixed,
componentStack: string | null,
): void {
const errorMessage =
typeof error === 'object' &&
error !== null &&
typeof error.message === 'string'
? error.message
: null;
const errorStack =
typeof error === 'object' &&
error !== null &&
typeof error.stack === 'string'
? error.stack
: null;

logEvent({
event_name: 'error',
error_message: errorMessage,
error_stack: errorStack,
error_component_stack: componentStack,
});
}

export const registerEventLogger: (logFunction: LogFunction) => () => void =
enableLogger === true
? function registerEventLogger(logFunction: LogFunction): () => void {
Expand Down
Loading
Loading