Skip to content

Commit

Permalink
[WIP] DevTools: Support named hooks for >1 module in a bundle (facebo…
Browse files Browse the repository at this point in the history
…ok#21790)

* Add named hooks test case built with Rollup

* Fix prepareStackTrace unpatching, remove sourceURL

* Prettier

* Resolve source map URL/path relative to the script

* Add failing tests for multi-module bundle

* Parse hook names from multiple modules in a bundle

* Create a HookSourceData per location key (file, line, column).
* Cache the source map per runtime URL ( = file part of location key).
* Don't store sourceMapContents - only store a consumer instance.
* Look up original source URLs in the source map correctly.
* Cache the code + AST per original URL.
* Fix off-by-one column number lookup.
* Some naming and typing tweaks related to the above.
* Stop storing the consumer outside the with() callback, which is a bug.

* Lint fix for 8d8dd25

* Added devDependencies to react-devtools-extensions package.json

* Added some debug logging and TODO comments

* Added additional DEBUG logging to hook names cache

Co-authored-by: Brian Vaughn <bvaughn@fb.com>
  • Loading branch information
2 people authored and zhengjitf committed Apr 15, 2022
1 parent be76f61 commit cc9af6d
Show file tree
Hide file tree
Showing 25 changed files with 694 additions and 222 deletions.
5 changes: 5 additions & 0 deletions packages/react-devtools-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"update-mock-source-maps": "node ./src/__tests__/updateMockSourceMaps.js"
},
"devDependencies": {
"acorn-jsx": "^5.2.0",
"@babel/core": "^7.11.1",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-transform-flow-strip-types": "^7.10.4",
Expand All @@ -44,6 +45,10 @@
"open": "^7.0.2",
"os-name": "^3.1.0",
"raw-loader": "^3.1.0",
"rollup": "^1.19.4",
"rollup-plugin-babel": "^4.0.1",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^2.1.1",
"source-map": "^0.8.0-beta.0",
"style-loader": "^0.23.1",
"web-ext": "^3.0.0",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cc9af6d

Please sign in to comment.