Skip to content

Commit cc9af6d

Browse files
motiz88Brian Vaughn
authored andcommitted
[WIP] DevTools: Support named hooks for >1 module in a bundle (facebook#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>
1 parent be76f61 commit cc9af6d

25 files changed

+694
-222
lines changed

packages/react-devtools-extensions/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"update-mock-source-maps": "node ./src/__tests__/updateMockSourceMaps.js"
2020
},
2121
"devDependencies": {
22+
"acorn-jsx": "^5.2.0",
2223
"@babel/core": "^7.11.1",
2324
"@babel/plugin-proposal-class-properties": "^7.10.4",
2425
"@babel/plugin-transform-flow-strip-types": "^7.10.4",
@@ -44,6 +45,10 @@
4445
"open": "^7.0.2",
4546
"os-name": "^3.1.0",
4647
"raw-loader": "^3.1.0",
48+
"rollup": "^1.19.4",
49+
"rollup-plugin-babel": "^4.0.1",
50+
"rollup-plugin-commonjs": "^9.3.4",
51+
"rollup-plugin-node-resolve": "^2.1.1",
4752
"source-map": "^0.8.0-beta.0",
4853
"style-loader": "^0.23.1",
4954
"web-ext": "^3.0.0",

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/bundle/index.js

+198
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/bundle/index.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/ComponentWithCustomHook.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)