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 20, 2021
1 parent 3f62dec commit dd7d036
Show file tree
Hide file tree
Showing 50 changed files with 771 additions and 895 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
16 changes: 2 additions & 14 deletions packages/react-devtools-scheduling-profiler/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# Experimental React Concurrent Mode Profiler
# React Concurrent Mode Profiler

https://react-devtools-scheduling-profiler.vercel.app/

## Setting up continuous deployment with CircleCI and Vercel

These instructions are intended for internal use, but may be useful if you are setting up a custom production deployment of the scheduling profiler.

1. Create a Vercel token at https://vercel.com/account/tokens.
2. Configure CircleCI:
1. In CircleCI, navigate to the repository's Project Settings.
2. In the Advanced tab, ensure that "Pass secrets to builds from forked pull requests" is set to false.
3. In the Environment Variables tab, add the Vercel token as a new `SCHEDULING_PROFILER_DEPLOY_VERCEL_TOKEN` environment variable.

The Vercel project will be created when the deploy job runs.
This package contains the new/experimental "scheduling profiler" for React 18. This profiler exists as its own project because it was initially deployed as a standalone app. It has since been moved into the DevTools Profiler under the "Scheduling" tab. This package will likely eventually be moved into `react-devtools-shared`.
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.

34 changes: 0 additions & 34 deletions packages/react-devtools-scheduling-profiler/src/App.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.CanvasPage {
position: absolute;
top: 0.5rem;
bottom: 0.5rem;
left: 0.5rem;
right: 0.5rem;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
7 changes: 4 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 Expand Up @@ -243,6 +243,7 @@ function AutoSizedCanvas({data, height, width}: AutoSizedCanvasProps) {
defaultFrame,
reactMeasuresHorizontalPanAndZoomView,
flamechartHorizontalPanAndZoomView,
canvasRef,
);

const rootView = new View(
Expand Down
17 changes: 9 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,10 @@
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-tooltip-background);
border: 1px solid var(border);
box-shadow: 1px 1px 2px var(--color-shadow);
color: var(--color-tooltip-text);
font-size: 11px;
}

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

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

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

0 comments on commit dd7d036

Please sign in to comment.