Skip to content

Commit

Permalink
Import scheduling profiler into DevTools Profiler tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jul 16, 2021
1 parent 3101872 commit 7dd57d3
Show file tree
Hide file tree
Showing 35 changed files with 225 additions and 687 deletions.
33 changes: 25 additions & 8 deletions packages/react-devtools-core/webpack.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ const __DEV__ = NODE_ENV === 'development';

const DEVTOOLS_VERSION = getVersionString();

const babelOptions = {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
};

module.exports = {
mode: __DEV__ ? 'development' : 'production',
devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
Expand Down Expand Up @@ -62,17 +71,25 @@ module.exports = {
],
module: {
rules: [
{
test: /\.worker\.js$/,
use: [
{
loader: 'worker-loader',
options: {
inline: 'no-fallback',
},
},
{
loader: 'babel-loader',
options: babelOptions,
},
],
},
{
test: /\.js$/,
loader: 'babel-loader',
options: {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
},
options: babelOptions,
},
{
test: /\.css$/,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-extensions/firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

"devtools_page": "main.html",

"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"content_security_policy": "script-src 'self' 'unsafe-eval' blob:; object-src 'self'",
"web_accessible_resources": [
"main.html",
"panel.html",
Expand Down
4 changes: 3 additions & 1 deletion packages/react-devtools-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"chrome-launch": "^1.1.4",
"crx": "^5.0.0",
"css-loader": "^1.0.1",
"file-loader": "^6.1.0",
"firefox-profile": "^1.0.2",
"fs-extra": "^4.0.2",
"jest-fetch-mock": "^3.0.3",
Expand All @@ -55,7 +56,8 @@
"web-ext": "^3.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
"webpack-dev-server": "^3.10.3",
"worker-loader": "^3.0.3"
},
"dependencies": {
"web-ext": "^4"
Expand Down
33 changes: 25 additions & 8 deletions packages/react-devtools-extensions/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ const DEVTOOLS_VERSION = getVersionString();

const featureFlagTarget = process.env.FEATURE_FLAG_TARGET || 'extension-oss';

const babelOptions = {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
};

module.exports = {
mode: __DEV__ ? 'development' : 'production',
devtool: __DEV__ ? 'cheap-module-eval-source-map' : false,
Expand Down Expand Up @@ -81,17 +90,25 @@ module.exports = {
],

rules: [
{
test: /\.worker\.js$/,
use: [
{
loader: 'worker-loader',
options: {
inline: 'no-fallback',
},
},
{
loader: 'babel-loader',
options: babelOptions,
},
],
},
{
test: /\.js$/,
loader: 'babel-loader',
options: {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
},
options: babelOptions,
},
{
test: /\.css$/,
Expand Down
4 changes: 3 additions & 1 deletion packages/react-devtools-inline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
"babel-loader": "^8.0.4",
"cross-env": "^3.1.4",
"css-loader": "^1.0.1",
"file-loader": "^6.1.0",
"raw-loader": "^3.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
"webpack-dev-server": "^3.10.3",
"worker-loader": "^3.0.3"
}
}
33 changes: 25 additions & 8 deletions packages/react-devtools-inline/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ const __DEV__ = NODE_ENV === 'development';

const DEVTOOLS_VERSION = getVersionString();

const babelOptions = {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
};

module.exports = {
mode: __DEV__ ? 'development' : 'production',
devtool: __DEV__ ? 'eval-cheap-source-map' : 'source-map',
Expand Down Expand Up @@ -65,17 +74,25 @@ module.exports = {
],
module: {
rules: [
{
test: /\.worker\.js$/,
use: [
{
loader: 'worker-loader',
options: {
inline: 'no-fallback',
},
},
{
loader: 'babel-loader',
options: babelOptions,
},
],
},
{
test: /\.js$/,
loader: 'babel-loader',
options: {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
},
options: babelOptions,
},
{
test: /\.css$/,
Expand Down
36 changes: 0 additions & 36 deletions packages/react-devtools-scheduling-profiler/buildUtils.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react-devtools-scheduling-profiler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "react-devtools-scheduling-profiler",
"version": "0.0.0",
"version": "4.14.0",
"license": "MIT",
"scripts": {
"build": "cross-env NODE_ENV=production cross-env TARGET=remote webpack --config webpack.config.js",
Expand Down
19 changes: 0 additions & 19 deletions packages/react-devtools-scheduling-profiler/src/App.css

This file was deleted.

13 changes: 1 addition & 12 deletions packages/react-devtools-scheduling-profiler/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@ import '@reach/tooltip/styles.css';
import * as React from 'react';

import {SchedulingProfiler} from './SchedulingProfiler';
import {useBrowserTheme, useDisplayDensity} from './hooks';

import styles from './App.css';
import 'react-devtools-shared/src/devtools/views/root.css';

export default function App() {
useBrowserTheme();
useDisplayDensity();

return (
<div className={styles.DevTools}>
<div className={styles.TabContent}>
<SchedulingProfiler />
</div>
</div>
);
return <SchedulingProfiler />;
}
6 changes: 3 additions & 3 deletions packages/react-devtools-scheduling-profiler/src/CanvasPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ import {
import {COLORS} from './content-views/constants';

import EventTooltip from './EventTooltip';
import ContextMenu from './context/ContextMenu';
import ContextMenuItem from './context/ContextMenuItem';
import useContextMenu from './context/useContextMenu';
import ContextMenu from 'react-devtools-shared/src/devtools/ContextMenu/ContextMenu';
import ContextMenuItem from 'react-devtools-shared/src/devtools/ContextMenu/ContextMenuItem';
import useContextMenu from 'react-devtools-shared/src/devtools/ContextMenu/useContextMenu';
import {getBatchRange} from './utils/getBatchRange';

import styles from './CanvasPage.css';
Expand Down
16 changes: 8 additions & 8 deletions packages/react-devtools-scheduling-profiler/src/EventTooltip.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
padding: 0.25rem;
user-select: none;
pointer-events: none;
background-color: #ffffff;
border: 1px solid #ccc;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
background-color: var(--color-background);
border: 1px solid var(border);
box-shadow: 1px 1px 2px var(--color-shadow);
font-size: 11px;
}

Expand All @@ -26,7 +26,7 @@
}

.DetailsGridLabel {
color: #666;
color: var(--color-dim);
text-align: right;
}

Expand Down Expand Up @@ -56,14 +56,14 @@
line-height: 1.5;
-webkit-mask-image: linear-gradient(
180deg,
#fff,
#fff 5em,
var(--color-background),
var(--color-background) 5em,
transparent
);
mask-image: linear-gradient(
180deg,
#fff,
#fff 5em,
var(--color-background),
var(--color-background) 5em,
transparent
);
white-space: pre;
Expand Down
Loading

0 comments on commit 7dd57d3

Please sign in to comment.