2019-08-13 15:59:43 -07:00
|
|
|
{
|
|
|
|
|
"private": true,
|
|
|
|
|
"name": "react-devtools-shared",
|
|
|
|
|
"version": "0.0.0",
|
2021-09-07 11:44:49 -04:00
|
|
|
"scripts": {
|
|
|
|
|
"update-mock-source-maps": "babel-node --presets=@babel/preset-env,@babel/preset-flow ./src/hooks/__tests__/updateMockSourceMaps.js"
|
|
|
|
|
},
|
2019-08-26 13:43:09 -07:00
|
|
|
"devDependencies": {
|
|
|
|
|
"react-15": "npm:react@^15",
|
|
|
|
|
"react-dom-15": "npm:react-dom@^15"
|
|
|
|
|
},
|
2019-08-13 15:59:43 -07:00
|
|
|
"dependencies": {
|
2025-09-17 15:36:21 +02:00
|
|
|
"@babel/parser": "^7.28.3",
|
|
|
|
|
"@babel/preset-env": "7.26.9",
|
2021-09-07 11:44:49 -04:00
|
|
|
"@babel/preset-flow": "^7.10.4",
|
2020-08-20 23:47:16 +08:00
|
|
|
"@babel/runtime": "^7.11.2",
|
2025-09-17 15:36:21 +02:00
|
|
|
"@babel/traverse": "^7.28.3",
|
2021-08-11 14:43:25 -04:00
|
|
|
"@reach/menu-button": "^0.16.1",
|
|
|
|
|
"@reach/tooltip": "^0.16.0",
|
2019-08-13 15:59:43 -07:00
|
|
|
"clipboard-js": "^0.3.6",
|
Replace DevTools `semver` usages with `compare-versions` for smaller bundle size (#26122)
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.
Before submitting a pull request, please make sure the following is
done:
1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open
`chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
10. If you haven't already, complete the CLA.
Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->
## Summary
This PR:
- Replaces the existing usages of methods from the `semver` library in
the React DevTools source with an inlined version based on
https://www.npmjs.com/package/semver-compare.
This appears to drop the unminified bundle sizes of 3 separate
`react-devtools-extensions` build artifacts by about 50K:

## How did you test this change?
I was originally working on [a fork of React
DevTools](https://github.com/replayio/react/pull/2) for use with
https://replay.io , specifically our integration of the React DevTools
UI to show the React component tree while users are debugging a recorded
application.
As part of the dev work on that fork, I wanted to shrink the bundle size
of the extension's generated JS build artifacts. I noted that the
official NPM `semver` library was taking up a noticeable chunk of space
in the bundles, and saw that it's only being used in a handful of places
to do some very simple version string comparisons.
I was able to replace the `semver` imports and usages with a simple
alternate comparison function, and confirmed via hands-on checks and
console logging that the checks behaved the same way.
Given that, I wanted to upstream this particular change to help shrink
the real extension's bundle sizes.
I know that it's an extension, so bundle size isn't _as_ critical a
concern as it would be for a pure library. But, smaller download sizes
do benefit all users, and that also includes sites like CodeSandbox and
Replay that are using the React DevTools as a library as well.
I'm happy to tweak this PR if necessary. Thanks!
2023-02-08 20:00:22 -05:00
|
|
|
"compare-versions": "^5.0.3",
|
feat[devtools]: symbolicate source for inspected element (#28471)
Stacked on https://github.com/facebook/react/pull/28351, please review
only the last commit.
Top-level description of the approach:
1. Once user selects an element from the tree, frontend asks backend to
return the inspected element, this is where we simulate an error
happening in `render` function of the component and then we parse the
error stack. As an improvement, we should probably migrate from custom
implementation of error stack parser to `error-stack-parser` from npm.
2. When frontend receives the inspected element and this object is being
propagated, we create a Promise for symbolicated source, which is then
passed down to all components, which are using `source`.
3. These components use `use` hook for this promise and are wrapped in
Suspense.
Caching:
1. For browser extension, we cache Promises based on requested resource
+ key + column, also added use of
`chrome.devtools.inspectedWindow.getResource` API.
2. For standalone case (RN), we cache based on requested resource url,
we cache the content of it.
2024-03-05 12:32:11 +00:00
|
|
|
"jsc-safe-url": "^0.2.4",
|
2025-05-28 10:31:09 -04:00
|
|
|
"json5": "^2.2.3",
|
2019-08-15 09:53:22 -07:00
|
|
|
"local-storage-fallback": "^4.1.1",
|
2024-02-22 11:31:10 +00:00
|
|
|
"react-virtualized-auto-sizer": "^1.0.23",
|
2025-10-19 19:17:45 -07:00
|
|
|
"react-window": "^1.8.10",
|
|
|
|
|
"rbush": "4.0.1"
|
2019-08-13 15:59:43 -07:00
|
|
|
}
|
|
|
|
|
}
|