-
Notifications
You must be signed in to change notification settings - Fork 47.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This represents a virtual renderer that connects to the Flight Client. This will initially only be used to track console logs but could be expanded to more.
- Loading branch information
1 parent
da3471d
commit f046fe9
Showing
3 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
packages/react-devtools-shared/src/backend/flight/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,101 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import type {DevToolsHook, ReactRenderer, RendererInterface} from '../types'; | ||
|
||
import { | ||
patchConsoleUsingWindowValues, | ||
registerRenderer as registerRendererWithConsole, | ||
} from '../console'; | ||
|
||
export function attach( | ||
hook: DevToolsHook, | ||
rendererID: number, | ||
renderer: ReactRenderer, | ||
global: Object, | ||
): RendererInterface { | ||
patchConsoleUsingWindowValues(); | ||
registerRendererWithConsole(renderer); | ||
|
||
return { | ||
cleanup() {}, | ||
clearErrorsAndWarnings() {}, | ||
clearErrorsForElementID() {}, | ||
clearWarningsForElementID() {}, | ||
getSerializedElementValueByPath() {}, | ||
deletePath() {}, | ||
findHostInstancesForElementID() { | ||
return null; | ||
}, | ||
flushInitialOperations() {}, | ||
getBestMatchForTrackedPath() { | ||
return null; | ||
}, | ||
getDisplayNameForElementID() { | ||
return null; | ||
}, | ||
getNearestMountedDOMNode() { | ||
return null; | ||
}, | ||
getElementIDForHostInstance() { | ||
return null; | ||
}, | ||
getInstanceAndStyle() { | ||
return { | ||
instance: null, | ||
style: null, | ||
}; | ||
}, | ||
getOwnersList() { | ||
return null; | ||
}, | ||
getPathForElement() { | ||
return null; | ||
}, | ||
getProfilingData() { | ||
throw new Error('getProfilingData not supported by this renderer'); | ||
}, | ||
handleCommitFiberRoot() {}, | ||
handleCommitFiberUnmount() {}, | ||
handlePostCommitFiberRoot() {}, | ||
hasElementWithId() { | ||
return false; | ||
}, | ||
inspectElement( | ||
requestID: number, | ||
id: number, | ||
path: Array<string | number> | null, | ||
) { | ||
return { | ||
id, | ||
responseID: requestID, | ||
type: 'not-found', | ||
}; | ||
}, | ||
logElementToConsole() {}, | ||
patchConsoleForStrictMode() {}, | ||
getElementAttributeByPath() {}, | ||
getElementSourceFunctionById() {}, | ||
overrideError() {}, | ||
overrideSuspense() {}, | ||
overrideValueAtPath() {}, | ||
renamePath() {}, | ||
renderer, | ||
setTraceUpdatesEnabled() {}, | ||
setTrackedPath() {}, | ||
startProfiling() {}, | ||
stopProfiling() {}, | ||
storeAsGlobal() {}, | ||
unpatchConsoleForStrictMode() {}, | ||
updateComponentFilters() {}, | ||
getEnvironmentNames() { | ||
return []; | ||
}, | ||
}; | ||
} |
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