-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[DevTools] Remove renderer.js from extension build (#26234)"
This reverts commit fcf2187.
- Loading branch information
1 parent
85bb7b6
commit 4a345c0
Showing
9 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/react-devtools-extensions/src/contentScripts/renderer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* In order to support reload-and-profile functionality, the renderer needs to be injected before any other scripts. | ||
* Since it is a complex file (with imports) we can't just toString() it like we do with the hook itself, | ||
* So this entry point (one of the web_accessible_resources) provides a way to eagerly inject it. | ||
* The hook will look for the presence of a global __REACT_DEVTOOLS_ATTACH__ and attach an injected renderer early. | ||
* The normal case (not a reload-and-profile) will not make use of this entry point though. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import {attach} from 'react-devtools-shared/src/backend/renderer'; | ||
import {SESSION_STORAGE_RELOAD_AND_PROFILE_KEY} from 'react-devtools-shared/src/constants'; | ||
import {sessionStorageGetItem} from 'react-devtools-shared/src/storage'; | ||
|
||
if ( | ||
sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true' && | ||
!window.hasOwnProperty('__REACT_DEVTOOLS_ATTACH__') | ||
) { | ||
Object.defineProperty( | ||
window, | ||
'__REACT_DEVTOOLS_ATTACH__', | ||
({ | ||
enumerable: false, | ||
// This property needs to be configurable to allow third-party integrations | ||
// to attach their own renderer. Note that using third-party integrations | ||
// is not officially supported. Use at your own risk. | ||
configurable: true, | ||
get() { | ||
return attach; | ||
}, | ||
}: Object), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters