Commit 26f32a0
authored
Add react devtools profiler support (#1117)
This PR adds a new tool – React Profiler
React Profiler integration allows controlling (starting/stopping) of the
profile via React Devtools and also to open the profiles in a standalone
editor panel.
https://github.com/user-attachments/assets/b525808b-6eb1-4fa4-95ac-de052121e7de
Below is an overview of the changes made in this PR:
- We use devtools-hedless package to access react devtools' profiler
store to control the profiling
- When profiling is finished, we use the export method exposed via
devtools-headless package to dump the profile into a file and save under
'.reactprofile' extension
- We're implementing a new editor provider that can open '.reactprofile'
files. The editor uses the devtools-inline package to present the UI and
uses the profile import method from devtools-headless package to process
the profile data.
- We're adding buttons to the tools menu to initiate the profiling and
use the CPU profiling style indicator when the profiler is running.
- We're updating vite configuration – for some reason after adding a new
input, vite in release mode started splitting CSS into more chunks.
Before it was just main chunk and theme chunk. Instead of adding more
dependencies I decided it will be easier to force it to not do chunking
at all and use single style.css for all the webviews.
- We are adding additional options to the webview CSP because devtools
use JS's eval and also boot up a worker thread using blob URL.
### How Has This Been Tested:
1. Open IDE panel and wait for app to load
2. Click "Start React Profiler"
3. Observe a profiler indicator appear (similar as with the CPU
profiling)
4. Do something with the app
5. Click stop
6. The profiler will stop (indicator is gone) and a profile will be
automatically opened in a new editor tab
7. Run everything in release mode (DEV=false in weviewContentGenerator)
– check other panels like network to make sure vite changes didn't mess
something up1 parent ad6ab94 commit 26f32a0
File tree
18 files changed
+421
-57
lines changed- packages/vscode-extension
- assets
- src
- common
- panels
- project
- react-devtools-profiler
- webview
- components
- providers
- views
18 files changed
+421
-57
lines changedLoading
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
683 | 695 | | |
684 | 696 | | |
685 | 697 | | |
| |||
780 | 792 | | |
781 | 793 | | |
782 | 794 | | |
| 795 | + | |
783 | 796 | | |
784 | 797 | | |
| 798 | + | |
785 | 799 | | |
786 | 800 | | |
787 | 801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
72 | | - | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
| |||
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
| 57 | + | |
47 | 58 | | |
48 | 59 | | |
49 | 60 | | |
| |||
107 | 118 | | |
108 | 119 | | |
109 | 120 | | |
| 121 | + | |
110 | 122 | | |
111 | 123 | | |
112 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
113 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
114 | 131 | | |
115 | 132 | | |
116 | 133 | | |
| |||
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
122 | 147 | | |
123 | 148 | | |
124 | 149 | | |
| |||
130 | 155 | | |
131 | 156 | | |
132 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
133 | 185 | | |
134 | 186 | | |
135 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
214 | 220 | | |
215 | 221 | | |
216 | 222 | | |
| |||
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
294 | 317 | | |
295 | 318 | | |
296 | 319 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments