Skip to content

Commit 65b93cd

Browse files
author
Brian Vaughn
committed
Merge remote-tracking branch 'devtools-merge/master' into devtools-v4-merge
2 parents 21d6395 + 56b1c20 commit 65b93cd

File tree

375 files changed

+68507
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

375 files changed

+68507
-0
lines changed

extension/.circleci/config.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/node:10.12.0
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/mongo:3.4.4
16+
17+
working_directory: ~/repo
18+
19+
steps:
20+
- checkout
21+
22+
# Download and cache dependencies
23+
- restore_cache:
24+
name: Restore node_modules cache
25+
keys:
26+
- v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
27+
- v1-node-{{ arch }}-{{ .Branch }}-
28+
- v1-node-{{ arch }}-
29+
30+
- run:
31+
name: Nodejs Version
32+
command: node --version
33+
34+
- run:
35+
name: Install Packages
36+
command: yarn install --frozen-lockfile
37+
38+
- save_cache:
39+
name: Save node_modules cache
40+
key: v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
41+
paths:
42+
- node_modules
43+
44+
- run:
45+
name: Check formatting
46+
command: yarn prettier:ci
47+
48+
- run:
49+
name: Check lint
50+
command: yarn lint:ci
51+
52+
- run:
53+
name: Check Flow
54+
command: yarn flow
55+
56+
- run:
57+
name: Test Packages
58+
command: yarn test

extension/.eslintignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules
2+
3+
shells/browser/chrome/build
4+
shells/browser/firefox/build
5+
shells/browser/shared/build
6+
shells/dev/dist
7+
packages/react-devtools-core/dist
8+
packages/react-devtools-inline/dist
9+
vendor
10+
*.js.snap
11+
12+
package-lock.json
13+
yarn.lock

extension/.eslintrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": ["react-app","plugin:prettier/recommended"],
3+
"plugins": ["react-hooks"],
4+
"rules": {
5+
"jsx-a11y/anchor-has-content": "off",
6+
"no-loop-func": "off",
7+
"react-hooks/exhaustive-deps": "error",
8+
"react-hooks/rules-of-hooks": "error"
9+
},
10+
"settings": {
11+
"version": "detect"
12+
},
13+
"globals": {
14+
"__DEV__": "readonly",
15+
"__TEST__": "readonly",
16+
"jasmine": "readonly",
17+
"spyOn": "readonly"
18+
}
19+
}

extension/.flowconfig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[ignore]
2+
.*/react/node_modules/.*
3+
.*/electron/node_modules/.*
4+
.*node_modules/archiver-utils
5+
.*node_modules/babel.*
6+
.*node_modules/browserify-zlib/.*
7+
.*node_modules/gh-pages/.*
8+
.*node_modules/invariant/.*
9+
.*node_modules/json-loader.*
10+
.*node_modules/json5.*
11+
.*node_modules/node-libs-browser.*
12+
.*node_modules/webpack.*
13+
.*node_modules/fbjs/flow.*
14+
.*node_modules/web-ext.*
15+
shells/browser/chrome/build/*
16+
shells/browser/firefox/build/*
17+
shells/dev/build/*
18+
19+
[include]
20+
21+
[libs]
22+
/flow-typed/
23+
./flow.js
24+
25+
[lints]
26+
27+
[options]
28+
server.max_workers=4
29+
esproposal.class_instance_fields=enable
30+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
31+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
32+
suppress_comment=\\(.\\|\n\\)*\\$FlowIgnore
33+
module.name_mapper='^src' ->'<PROJECT_ROOT>/src'
34+
35+
[strict]

extension/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/shells/browser/chrome/*.crx
2+
/shells/browser/chrome/*.pem
3+
/shells/browser/firefox/*.xpi
4+
/shells/browser/firefox/*.pem
5+
/shells/browser/shared/build
6+
/packages/react-devtools-core/dist
7+
/packages/react-devtools-inline/dist
8+
/shells/dev/dist
9+
build
10+
/node_modules
11+
/packages/react-devtools-core/node_modules
12+
/packages/react-devtools-inline/node_modules
13+
/packages/react-devtools/node_modules
14+
npm-debug.log
15+
yarn-error.log
16+
.DS_Store
17+
yarn-error.log
18+
.vscode
19+
.idea
20+
.watchmanconfig
21+
*.pem

extension/.prettierignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
3+
shells/browser/chrome/build
4+
shells/browser/firefox/build
5+
shells/dev/build
6+
vendor
7+
8+
package-lock.json
9+
yarn.lock

extension/.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5"
4+
}

extension/CHANGELOG.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# React DevTools changelog
2+
3+
<!-- ## [Unreleased]
4+
<details>
5+
<summary>
6+
Changes that have landed in master but are not yet released.
7+
Click to see more.
8+
</summary>
9+
10+
<!-- Upcoming changes go here
11+
</details> -->
12+
13+
## 4.0.0 (release date TBD)
14+
15+
### General changes
16+
17+
#### Improved performance
18+
The legacy DevTools extension used to add significant performance overhead, making it unusable for some larger React applications. That overhead has been effectively eliminated in version 4.
19+
20+
[Learn more](https://github.com/bvaughn/react-devtools-experimental/blob/master/OVERVIEW.md) about the performance optimizations that made this possible.
21+
22+
#### Component stacks
23+
24+
React component authors have often requested a way to log warnings that include the React ["component stack"](https://reactjs.org/docs/error-boundaries.html#component-stack-traces). DevTools now provides an option to automatically append this information to warnings (`console.warn`) and errors (`console.error`).
25+
26+
![Example console warning with component stack added](https://user-images.githubusercontent.com/29597/62228120-eec3da80-b371-11e9-81bb-018c1e577389.png)
27+
28+
It can be disabled in the general settings panel:
29+
30+
![Settings panel showing "component stacks" option](https://user-images.githubusercontent.com/29597/62227882-8f65ca80-b371-11e9-8a4e-5d27011ad1aa.png)
31+
32+
### Components tree changes
33+
34+
#### Component filters
35+
36+
Large component trees can sometimes be hard to navigate. DevTools now provides a way to filter components so that you can hide ones you're not interested in seeing.
37+
38+
![Component filter demo video](https://user-images.githubusercontent.com/29597/62229209-0bf9a880-b374-11e9-8f84-cebd6c1a016b.gif)
39+
40+
Host nodes (e.g. HTML `<div>`, React Native `View`) are now hidden by default, but you can see them by disabling that filter.
41+
42+
Filter preferences are remembered between sessions.
43+
44+
#### No more in-line props
45+
46+
Components in the tree no longer show in-line props. This was done to [make DevTools faster](https://github.com/bvaughn/react-devtools-experimental/blob/master/OVERVIEW.md) and to make it easier to browse larger component trees.
47+
48+
You can view a component's props, state, and hooks by selecting it:
49+
50+
![Inspecting props](https://user-images.githubusercontent.com/29597/62303001-37da6400-b430-11e9-87fd-10a94df88efa.png)
51+
52+
#### "Rendered by" list
53+
54+
In React, an element's "owner" refers the thing that rendered it. Sometimes an element's parent is also its owner, but usually they're different. This distinction is important because props come from owners.
55+
56+
![Example code](https://user-images.githubusercontent.com/29597/62229551-bbcf1600-b374-11e9-8411-8ff411f4f847.png)
57+
58+
When you are debugging an unexpected prop value, you can save time if you skip over the parents.
59+
60+
DevTools v4 adds a new "rendered by" list in the right hand pane that allows you to quickly step through the list of owners to speed up your debugging.
61+
62+
![Example video showing the "rendered by" list](https://user-images.githubusercontent.com/29597/62229747-4152c600-b375-11e9-9930-3f6b3b92be7a.gif)
63+
64+
#### Owners tree
65+
66+
The inverse of the "rendered by" list is called the "owners tree". It is the list of things rendered by a particular component- (the things it "owns"). This view is kind of like looking at the source of the component's render method, and can be a helpful way to explore large, unfamiliar React applications.
67+
68+
Double click a component to view the owners tree and click the "x" button to return to the full component tree:
69+
70+
![Demo showing "owners tree" feature](https://user-images.githubusercontent.com/29597/62229452-84f90000-b374-11e9-818a-61eec6be0bb4.gif)
71+
72+
#### No more horizontal scrolling
73+
74+
Deeply nested components used to require both vertical and horizontal scrolling to see, making it easy to "get lost" within large component trees. DevTools now dynamically adjusts nesting indentation to eliminate horizontal scrolling.
75+
76+
![Video demonstration dynamic indentation to eliminate horizontal scrolling](https://user-images.githubusercontent.com/29597/62246661-f8ad0400-b398-11e9-885f-284f150a6d76.gif)
77+
78+
#### Improved hooks support
79+
80+
Hooks now have the same level of support as props and state: values can be edited, arrays and objects can be drilled into, etc.
81+
82+
![Video demonstrating hooks support](https://user-images.githubusercontent.com/29597/62230532-d86c4d80-b376-11e9-8629-1b2129b210d6.gif)
83+
84+
#### Improved search UX
85+
86+
Legacy DevTools search filtered the components tree to show matching nodes as roots. This made the overall structure of the application harder to reason about, because it displayed ancestors as siblings.
87+
88+
Search results are now shown inline similar to the browser's find-in-page search.
89+
90+
![Video demonstrating the search UX](https://user-images.githubusercontent.com/29597/62230923-c63edf00-b377-11e9-9f95-aa62ddc8f62c.gif)
91+
92+
#### Higher order components
93+
94+
[Higher order components](https://reactjs.org/docs/higher-order-components.html) (or HOCs) often provide a [custom `displayName`](https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging) following a convention of `withHOC(InnerComponentName)` in order to make it easier to identify components in React warnings and in DevTools.
95+
96+
The new Components tree formats these HOC names (along with several built-in utilities like `React.memo` and `React.forwardRef`) as a special badge to the right of the decorated component name.
97+
98+
![Screenshot showing HOC badges](https://user-images.githubusercontent.com/29597/62302774-c4385700-b42f-11e9-9ef4-49c5f18d6276.png)
99+
100+
Components decorated with multiple HOCs show the topmost badge and a count. Selecting the component shows all of the HOCs badges in the properties panel.
101+
102+
![Screenshot showing a component with multiple HOC badges](https://user-images.githubusercontent.com/29597/62303729-7fadbb00-b431-11e9-8685-45f5ab52b30b.png)
103+
104+
#### Suspense toggle
105+
106+
React's experimental [Suspense API](https://reactjs.org/docs/react-api.html#suspense) lets components "wait" for something before rendering. `<Suspense>` components can be used to specify loading states when components deeper in the tree are waiting to render.
107+
108+
DevTools lets you test these loading states with a new toggle:
109+
110+
![Video demonstrating suspense toggle UI](https://user-images.githubusercontent.com/29597/62231446-e15e1e80-b378-11e9-92d4-086751dc65fc.gif)
111+
112+
### Profiler changes
113+
114+
#### Reload and profile
115+
116+
The profiler is a powerful tool for performance tuning React components. Legacy DevTools supported profiling, but only after it detected a profiling-capable version of React. Because of this there was no way to profile the initial _mount_ (one of the most performance sensitive parts) of an application.
117+
118+
This feature is now supported with a "reload and profile" action:
119+
120+
![Video demonstrating the reload-and-profile feature](https://user-images.githubusercontent.com/29597/62233455-7a8f3400-b37d-11e9-9563-ec334bfb2572.gif)
121+
122+
#### Import/export
123+
124+
Profiler data can now be exported and shared with other developers to enable easier collaboration.
125+
126+
![Video demonstrating exporting and importing profiler data](https://user-images.githubusercontent.com/29597/62233911-6566d500-b37e-11e9-9052-692378c92538.gif)
127+
128+
Exports include all commits, timings, interactions, etc.
129+
130+
#### "Why did this render?"
131+
132+
"Why did this render?" is a common question when profiling. The profiler now helps answer this question by recording which props and state change between renders.
133+
134+
![Video demonstrating profiler "why did this render?" feature](https://user-images.githubusercontent.com/29597/62234698-0f932c80-b380-11e9-8cf3-a5183af0c388.gif)
135+
136+
Because this feature adds a small amount of overhead, it can be disabled in the profiler settings panel.
137+
138+
#### Component renders list
139+
140+
The profiler now displays a list of each time the selected component rendered during a profiling session, along with the duration of each render. This list can be used to quickly jump between commits when analyzing the performance of a specific component.
141+
142+
![Video demonstrating profiler's component renders list](https://user-images.githubusercontent.com/29597/62234547-bcb97500-b37f-11e9-9615-54fba8b574b9.gif)

0 commit comments

Comments
 (0)