|
| 1 | +/** |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + * |
| 7 | + * @flow |
| 8 | + */ |
| 9 | + |
| 10 | +import type {DevToolsHook, ReactRenderer, RendererInterface} from '../types'; |
| 11 | + |
| 12 | +import { |
| 13 | + patchConsoleUsingWindowValues, |
| 14 | + registerRenderer as registerRendererWithConsole, |
| 15 | +} from '../console'; |
| 16 | + |
| 17 | +export function attach( |
| 18 | + hook: DevToolsHook, |
| 19 | + rendererID: number, |
| 20 | + renderer: ReactRenderer, |
| 21 | + global: Object, |
| 22 | +): RendererInterface { |
| 23 | + patchConsoleUsingWindowValues(); |
| 24 | + registerRendererWithConsole(renderer); |
| 25 | + |
| 26 | + return { |
| 27 | + cleanup() {}, |
| 28 | + clearErrorsAndWarnings() {}, |
| 29 | + clearErrorsForElementID() {}, |
| 30 | + clearWarningsForElementID() {}, |
| 31 | + getSerializedElementValueByPath() {}, |
| 32 | + deletePath() {}, |
| 33 | + findHostInstancesForElementID() { |
| 34 | + return null; |
| 35 | + }, |
| 36 | + flushInitialOperations() {}, |
| 37 | + getBestMatchForTrackedPath() { |
| 38 | + return null; |
| 39 | + }, |
| 40 | + getDisplayNameForElementID() { |
| 41 | + return null; |
| 42 | + }, |
| 43 | + getNearestMountedDOMNode() { |
| 44 | + return null; |
| 45 | + }, |
| 46 | + getElementIDForHostInstance() { |
| 47 | + return null; |
| 48 | + }, |
| 49 | + getInstanceAndStyle() { |
| 50 | + return { |
| 51 | + instance: null, |
| 52 | + style: null, |
| 53 | + }; |
| 54 | + }, |
| 55 | + getOwnersList() { |
| 56 | + return null; |
| 57 | + }, |
| 58 | + getPathForElement() { |
| 59 | + return null; |
| 60 | + }, |
| 61 | + getProfilingData() { |
| 62 | + throw new Error('getProfilingData not supported by this renderer'); |
| 63 | + }, |
| 64 | + handleCommitFiberRoot() {}, |
| 65 | + handleCommitFiberUnmount() {}, |
| 66 | + handlePostCommitFiberRoot() {}, |
| 67 | + hasElementWithId() { |
| 68 | + return false; |
| 69 | + }, |
| 70 | + inspectElement( |
| 71 | + requestID: number, |
| 72 | + id: number, |
| 73 | + path: Array<string | number> | null, |
| 74 | + ) { |
| 75 | + return { |
| 76 | + id, |
| 77 | + responseID: requestID, |
| 78 | + type: 'not-found', |
| 79 | + }; |
| 80 | + }, |
| 81 | + logElementToConsole() {}, |
| 82 | + patchConsoleForStrictMode() {}, |
| 83 | + getElementAttributeByPath() {}, |
| 84 | + getElementSourceFunctionById() {}, |
| 85 | + overrideError() {}, |
| 86 | + overrideSuspense() {}, |
| 87 | + overrideValueAtPath() {}, |
| 88 | + renamePath() {}, |
| 89 | + renderer, |
| 90 | + setTraceUpdatesEnabled() {}, |
| 91 | + setTrackedPath() {}, |
| 92 | + startProfiling() {}, |
| 93 | + stopProfiling() {}, |
| 94 | + storeAsGlobal() {}, |
| 95 | + unpatchConsoleForStrictMode() {}, |
| 96 | + updateComponentFilters() {}, |
| 97 | + getEnvironmentNames() { |
| 98 | + return []; |
| 99 | + }, |
| 100 | + }; |
| 101 | +} |
0 commit comments