bippy 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
4
3
  /**
5
4
  * @license bippy
6
5
  *
@@ -11,7 +10,7 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
11
10
  */
12
11
 
13
12
  // src/rdt-hook.ts
14
- var version = "0.2.10";
13
+ var version = "0.2.12";
15
14
  var BIPPY_INSTRUMENTATION_STRING = `bippy-${version}`;
16
15
  var NO_OP = () => {
17
16
  };
@@ -98,34 +97,17 @@ var getRDTHook = (onActive) => {
98
97
  patchRDTHook(onActive);
99
98
  return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
100
99
  };
101
- var registerServiceWorker = async () => {
102
- if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
103
- return;
104
- }
105
- console.log("import.meta.url", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SMK2GONO.cjs', document.baseURI).href)));
106
- let path = "./sw.js";
107
- if ((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SMK2GONO.cjs', document.baseURI).href)).includes(".vite/deps")) {
108
- path = "../../node_modules/bippy/dist/sw.js";
109
- }
110
- try {
111
- const url = new URL(path, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SMK2GONO.cjs', document.baseURI).href)));
112
- const res = await fetch(url, { method: "HEAD" });
113
- if (res.ok) {
114
- await navigator.serviceWorker.register(url, {
115
- // scope: '/',
116
- });
117
- }
118
- } catch {
119
- }
100
+ var isClientEnvironment = () => {
101
+ return Boolean(
102
+ typeof window !== "undefined" && (window.document?.createElement || window.navigator?.product === "ReactNative")
103
+ );
120
104
  };
121
105
  try {
122
- if (typeof window !== "undefined" && // @ts-expect-error `document` may not be defined in some enviroments
123
- (window.document?.createElement || window.navigator?.product === "ReactNative")) {
106
+ if (isClientEnvironment()) {
124
107
  installRDTHook();
125
108
  }
126
109
  } catch {
127
110
  }
128
- var INSTALL_HOOK_SCRIPT_STRING = "(()=>{try{var t=()=>{};const n=new Map;let o=0;globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__={checkDCE:t,supportsFiber:!0,supportsFlight:!0,hasUnsupportedRendererAttached:!1,renderers:n,onCommitFiberRoot:t,onCommitFiberUnmount:t,onPostCommitFiberRoot:t,inject(t){var e=++o;return n.set(e,t),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__._instrumentationIsActive=!0,e},_instrumentationIsActive:!1}}catch{}})()";
129
111
 
130
112
  // src/core.ts
131
113
  var FunctionComponentTag = 0;
@@ -746,7 +728,6 @@ exports.HostHoistableTag = HostHoistableTag;
746
728
  exports.HostRootTag = HostRootTag;
747
729
  exports.HostSingletonTag = HostSingletonTag;
748
730
  exports.HostTextTag = HostTextTag;
749
- exports.INSTALL_HOOK_SCRIPT_STRING = INSTALL_HOOK_SCRIPT_STRING;
750
731
  exports.LegacyHiddenComponentTag = LegacyHiddenComponentTag;
751
732
  exports.MemoComponentTag = MemoComponentTag;
752
733
  exports.OffscreenComponentTag = OffscreenComponentTag;
@@ -772,6 +753,7 @@ exports.hasMemoCache = hasMemoCache;
772
753
  exports.hasRDTHook = hasRDTHook;
773
754
  exports.installRDTHook = installRDTHook;
774
755
  exports.instrument = instrument;
756
+ exports.isClientEnvironment = isClientEnvironment;
775
757
  exports.isCompositeFiber = isCompositeFiber;
776
758
  exports.isHostFiber = isHostFiber;
777
759
  exports.isInstrumentationActive = isInstrumentationActive;
@@ -782,7 +764,6 @@ exports.isValidFiber = isValidFiber;
782
764
  exports.mountFiberRecursively = mountFiberRecursively;
783
765
  exports.onCommitFiberRoot = onCommitFiberRoot;
784
766
  exports.patchRDTHook = patchRDTHook;
785
- exports.registerServiceWorker = registerServiceWorker;
786
767
  exports.secure = secure;
787
768
  exports.setFiberId = setFiberId;
788
769
  exports.shouldFilterFiber = shouldFilterFiber;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license bippy
3
+ *
4
+ * Copyright (c) Aiden Bai, Million Software, Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ // src/install-hook-script-string.ts
11
+ var INSTALL_HOOK_SCRIPT_STRING = "(()=>{try{var t=()=>{};const n=new Map;let o=0;globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__={checkDCE:t,supportsFiber:!0,supportsFlight:!0,hasUnsupportedRendererAttached:!1,renderers:n,onCommitFiberRoot:t,onCommitFiberUnmount:t,onPostCommitFiberRoot:t,inject(t){var e=++o;return n.set(e,t),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__._instrumentationIsActive=!0,e},_instrumentationIsActive:!1,_script:!0}}catch{}})()";
12
+
13
+ export { INSTALL_HOOK_SCRIPT_STRING };
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  // src/rdt-hook.ts
11
- var version = "0.2.10";
11
+ var version = "0.2.12";
12
12
  var BIPPY_INSTRUMENTATION_STRING = `bippy-${version}`;
13
13
  var NO_OP = () => {
14
14
  };
@@ -95,34 +95,17 @@ var getRDTHook = (onActive) => {
95
95
  patchRDTHook(onActive);
96
96
  return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
97
97
  };
98
- var registerServiceWorker = async () => {
99
- if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
100
- return;
101
- }
102
- console.log("import.meta.url", import.meta.url);
103
- let path = "./sw.js";
104
- if (import.meta.url.includes(".vite/deps")) {
105
- path = "../../node_modules/bippy/dist/sw.js";
106
- }
107
- try {
108
- const url = new URL(path, import.meta.url);
109
- const res = await fetch(url, { method: "HEAD" });
110
- if (res.ok) {
111
- await navigator.serviceWorker.register(url, {
112
- // scope: '/',
113
- });
114
- }
115
- } catch {
116
- }
98
+ var isClientEnvironment = () => {
99
+ return Boolean(
100
+ typeof window !== "undefined" && (window.document?.createElement || window.navigator?.product === "ReactNative")
101
+ );
117
102
  };
118
103
  try {
119
- if (typeof window !== "undefined" && // @ts-expect-error `document` may not be defined in some enviroments
120
- (window.document?.createElement || window.navigator?.product === "ReactNative")) {
104
+ if (isClientEnvironment()) {
121
105
  installRDTHook();
122
106
  }
123
107
  } catch {
124
108
  }
125
- var INSTALL_HOOK_SCRIPT_STRING = "(()=>{try{var t=()=>{};const n=new Map;let o=0;globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__={checkDCE:t,supportsFiber:!0,supportsFlight:!0,hasUnsupportedRendererAttached:!1,renderers:n,onCommitFiberRoot:t,onCommitFiberUnmount:t,onPostCommitFiberRoot:t,inject(t){var e=++o;return n.set(e,t),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__._instrumentationIsActive=!0,e},_instrumentationIsActive:!1}}catch{}})()";
126
109
 
127
110
  // src/core.ts
128
111
  var FunctionComponentTag = 0;
@@ -727,4 +710,4 @@ var onCommitFiberRoot = (handler) => {
727
710
  );
728
711
  };
729
712
 
730
- export { BIPPY_INSTRUMENTATION_STRING, CONCURRENT_MODE_NUMBER, CONCURRENT_MODE_SYMBOL_STRING, ClassComponentTag, ContextConsumerTag, DEPRECATED_ASYNC_MODE_SYMBOL_STRING, DehydratedSuspenseComponentTag, ELEMENT_TYPE_SYMBOL_STRING, ForwardRefTag, FragmentTag, FunctionComponentTag, HostComponentTag, HostHoistableTag, HostRootTag, HostSingletonTag, HostTextTag, INSTALL_HOOK_SCRIPT_STRING, LegacyHiddenComponentTag, MemoComponentTag, OffscreenComponentTag, SimpleMemoComponentTag, SuspenseComponentTag, TRANSITIONAL_ELEMENT_TYPE_SYMBOL_STRING, createFiberVisitor, detectReactBuildType, didFiberCommit, didFiberRender, fiberIdMap, getDisplayName, getFiberFromHostInstance, getFiberId, getFiberStack, getMutatedHostFibers, getNearestHostFiber, getNearestHostFibers, getRDTHook, getTimings, getType, hasMemoCache, hasRDTHook, installRDTHook, instrument, isCompositeFiber, isHostFiber, isInstrumentationActive, isReactRefresh, isRealReactDevtools, isValidElement, isValidFiber, mountFiberRecursively, onCommitFiberRoot, patchRDTHook, registerServiceWorker, secure, setFiberId, shouldFilterFiber, traverseContexts, traverseEffects, traverseFiber, traverseProps, traverseRenderedFibers, traverseState, unmountFiber, unmountFiberChildrenRecursively, updateFiberRecursively, version };
713
+ export { BIPPY_INSTRUMENTATION_STRING, CONCURRENT_MODE_NUMBER, CONCURRENT_MODE_SYMBOL_STRING, ClassComponentTag, ContextConsumerTag, DEPRECATED_ASYNC_MODE_SYMBOL_STRING, DehydratedSuspenseComponentTag, ELEMENT_TYPE_SYMBOL_STRING, ForwardRefTag, FragmentTag, FunctionComponentTag, HostComponentTag, HostHoistableTag, HostRootTag, HostSingletonTag, HostTextTag, LegacyHiddenComponentTag, MemoComponentTag, OffscreenComponentTag, SimpleMemoComponentTag, SuspenseComponentTag, TRANSITIONAL_ELEMENT_TYPE_SYMBOL_STRING, createFiberVisitor, detectReactBuildType, didFiberCommit, didFiberRender, fiberIdMap, getDisplayName, getFiberFromHostInstance, getFiberId, getFiberStack, getMutatedHostFibers, getNearestHostFiber, getNearestHostFibers, getRDTHook, getTimings, getType, hasMemoCache, hasRDTHook, installRDTHook, instrument, isClientEnvironment, isCompositeFiber, isHostFiber, isInstrumentationActive, isReactRefresh, isRealReactDevtools, isValidElement, isValidFiber, mountFiberRecursively, onCommitFiberRoot, patchRDTHook, secure, setFiberId, shouldFilterFiber, traverseContexts, traverseEffects, traverseFiber, traverseProps, traverseRenderedFibers, traverseState, unmountFiber, unmountFiberChildrenRecursively, updateFiberRecursively, version };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @license bippy
5
+ *
6
+ * Copyright (c) Aiden Bai, Million Software, Inc.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+
12
+ // src/install-hook-script-string.ts
13
+ var INSTALL_HOOK_SCRIPT_STRING = "(()=>{try{var t=()=>{};const n=new Map;let o=0;globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__={checkDCE:t,supportsFiber:!0,supportsFlight:!0,hasUnsupportedRendererAttached:!1,renderers:n,onCommitFiberRoot:t,onCommitFiberUnmount:t,onPostCommitFiberRoot:t,inject(t){var e=++o;return n.set(e,t),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__._instrumentationIsActive=!0,e},_instrumentationIsActive:!1,_script:!0}}catch{}})()";
14
+
15
+ exports.INSTALL_HOOK_SCRIPT_STRING = INSTALL_HOOK_SCRIPT_STRING;
@@ -0,0 +1,261 @@
1
+ import * as React from 'react';
2
+ import { FiberRoot, Fiber as Fiber$1, ReactContext, Lanes } from 'react-reconciler';
3
+
4
+ interface ReactDevToolsGlobalHook {
5
+ checkDCE: (fn: unknown) => void;
6
+ supportsFiber: boolean;
7
+ supportsFlight: boolean;
8
+ renderers: Map<number, ReactRenderer>;
9
+ hasUnsupportedRendererAttached: boolean;
10
+ onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: void | number) => void;
11
+ onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
12
+ onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
13
+ inject: (renderer: ReactRenderer) => number;
14
+ _instrumentationSource?: string;
15
+ _instrumentationIsActive?: boolean;
16
+ _sw?: boolean;
17
+ }
18
+ /**
19
+ * Represents a react-internal Fiber node.
20
+ */
21
+ type Fiber<T = any> = Omit<Fiber$1, 'stateNode' | 'dependencies' | 'child' | 'sibling' | 'return' | 'alternate' | 'memoizedProps' | 'pendingProps' | 'memoizedState' | 'updateQueue'> & {
22
+ stateNode: T;
23
+ dependencies: Dependencies | null;
24
+ child: Fiber | null;
25
+ sibling: Fiber | null;
26
+ return: Fiber | null;
27
+ alternate: Fiber | null;
28
+ memoizedProps: Props;
29
+ pendingProps: Props;
30
+ memoizedState: MemoizedState;
31
+ updateQueue: {
32
+ lastEffect: Effect | null;
33
+ [key: string]: unknown;
34
+ };
35
+ };
36
+ interface ReactRenderer {
37
+ version: string;
38
+ bundleType: 0 | 1;
39
+ findFiberByHostInstance?: (hostInstance: unknown) => Fiber | null;
40
+ }
41
+ interface ContextDependency<T> {
42
+ context: ReactContext<T>;
43
+ memoizedValue: T;
44
+ observedBits: number;
45
+ next: ContextDependency<unknown> | null;
46
+ }
47
+ interface Dependencies {
48
+ lanes: Lanes;
49
+ firstContext: ContextDependency<unknown> | null;
50
+ }
51
+ interface Effect {
52
+ next: Effect | null;
53
+ create: (...args: unknown[]) => unknown;
54
+ destroy: ((...args: unknown[]) => unknown) | null;
55
+ deps: unknown[] | null;
56
+ tag: number;
57
+ [key: string]: unknown;
58
+ }
59
+ interface MemoizedState {
60
+ memoizedState: unknown;
61
+ next: MemoizedState | null;
62
+ [key: string]: unknown;
63
+ }
64
+ interface Props {
65
+ [key: string]: unknown;
66
+ }
67
+ declare global {
68
+ var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook;
69
+ }
70
+
71
+ declare const FunctionComponentTag = 0;
72
+ declare const ClassComponentTag = 1;
73
+ declare const HostRootTag = 3;
74
+ declare const HostComponentTag = 5;
75
+ declare const HostTextTag = 6;
76
+ declare const FragmentTag = 7;
77
+ declare const ContextConsumerTag = 9;
78
+ declare const ForwardRefTag = 11;
79
+ declare const SuspenseComponentTag = 13;
80
+ declare const MemoComponentTag = 14;
81
+ declare const SimpleMemoComponentTag = 15;
82
+ declare const DehydratedSuspenseComponentTag = 18;
83
+ declare const OffscreenComponentTag = 22;
84
+ declare const LegacyHiddenComponentTag = 23;
85
+ declare const HostHoistableTag = 26;
86
+ declare const HostSingletonTag = 27;
87
+ declare const CONCURRENT_MODE_NUMBER = 60111;
88
+ declare const ELEMENT_TYPE_SYMBOL_STRING = "Symbol(react.element)";
89
+ declare const TRANSITIONAL_ELEMENT_TYPE_SYMBOL_STRING = "Symbol(react.transitional.element)";
90
+ declare const CONCURRENT_MODE_SYMBOL_STRING = "Symbol(react.concurrent_mode)";
91
+ declare const DEPRECATED_ASYNC_MODE_SYMBOL_STRING = "Symbol(react.async_mode)";
92
+ /**
93
+ * Returns `true` if object is a React Element.
94
+ *
95
+ * @see https://react.dev/reference/react/isValidElement
96
+ */
97
+ declare const isValidElement: (element: unknown) => element is React.ReactElement;
98
+ /**
99
+ * Returns `true` if object is a React Fiber.
100
+ */
101
+ declare const isValidFiber: (fiber: unknown) => fiber is Fiber;
102
+ /**
103
+ * Returns `true` if fiber is a host fiber. Host fibers are DOM nodes in react-dom, `View` in react-native, etc.
104
+ *
105
+ * @see https://reactnative.dev/architecture/glossary#host-view-tree-and-host-view
106
+ */
107
+ declare const isHostFiber: (fiber: Fiber) => boolean;
108
+ /**
109
+ * Returns `true` if fiber is a composite fiber. Composite fibers are fibers that can render (like functional components, class components, etc.)
110
+ *
111
+ * @see https://reactnative.dev/architecture/glossary#react-composite-components
112
+ */
113
+ declare const isCompositeFiber: (fiber: Fiber) => boolean;
114
+ /**
115
+ * Traverses up or down a {@link Fiber}'s contexts, return `true` to stop and select the current and previous context value.
116
+ */
117
+ declare const traverseContexts: (fiber: Fiber, selector: (nextValue: ContextDependency<unknown> | null | undefined, prevValue: ContextDependency<unknown> | null | undefined) => boolean | void) => boolean;
118
+ /**
119
+ * Traverses up or down a {@link Fiber}'s states, return `true` to stop and select the current and previous state value.
120
+ */
121
+ declare const traverseState: (fiber: Fiber, selector: (nextValue: MemoizedState | null | undefined, prevValue: MemoizedState | null | undefined) => boolean | void) => boolean;
122
+ /**
123
+ * Traverses up or down a {@link Fiber}'s effects that cause state changes, return `true` to stop and select the current and previous effect value.
124
+ */
125
+ declare const traverseEffects: (fiber: Fiber, selector: (nextValue: Effect | null | undefined, prevValue: Effect | null | undefined) => boolean | void) => boolean;
126
+ /**
127
+ * Traverses up or down a {@link Fiber}'s props, return `true` to stop and select the current and previous props value.
128
+ */
129
+ declare const traverseProps: (fiber: Fiber, selector: (propName: string, nextValue: unknown, prevValue: unknown) => boolean | void) => boolean;
130
+ /**
131
+ * Returns `true` if the {@link Fiber} has rendered. Note that this does not mean the fiber has rendered in the current commit, just that it has rendered in the past.
132
+ */
133
+ declare const didFiberRender: (fiber: Fiber) => boolean;
134
+ /**
135
+ * Returns `true` if the {@link Fiber} has committed. Note that this does not mean the fiber has committed in the current commit, just that it has committed in the past.
136
+ */
137
+ declare const didFiberCommit: (fiber: Fiber) => boolean;
138
+ /**
139
+ * Returns all host {@link Fiber}s that have committed and rendered.
140
+ */
141
+ declare const getMutatedHostFibers: (fiber: Fiber) => Fiber[];
142
+ /**
143
+ * Returns the stack of {@link Fiber}s from the current fiber to the root fiber.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * [fiber, fiber.return, fiber.return.return, ...]
148
+ * ```
149
+ */
150
+ declare const getFiberStack: (fiber: Fiber) => Fiber[];
151
+ /**
152
+ * Returns `true` if the {@link Fiber} should be filtered out during reconciliation.
153
+ */
154
+ declare const shouldFilterFiber: (fiber: Fiber) => boolean;
155
+ /**
156
+ * Returns the nearest host {@link Fiber} to the current {@link Fiber}.
157
+ */
158
+ declare const getNearestHostFiber: (fiber: Fiber, ascending?: boolean) => Fiber | null;
159
+ /**
160
+ * Returns all host {@link Fiber}s in the tree that are associated with the current {@link Fiber}.
161
+ */
162
+ declare const getNearestHostFibers: (fiber: Fiber) => Fiber[];
163
+ /**
164
+ * Traverses up or down a {@link Fiber}, return `true` to stop and select a node.
165
+ */
166
+ declare const traverseFiber: (fiber: Fiber | null, selector: (node: Fiber) => boolean | void, ascending?: boolean) => Fiber | null;
167
+ /**
168
+ * Returns the timings of the {@link Fiber}.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * const { selfTime, totalTime } = getTimings(fiber);
173
+ * console.log(selfTime, totalTime);
174
+ * ```
175
+ */
176
+ declare const getTimings: (fiber?: Fiber | null | undefined) => {
177
+ selfTime: number;
178
+ totalTime: number;
179
+ };
180
+ /**
181
+ * Returns `true` if the {@link Fiber} uses React Compiler's memo cache.
182
+ */
183
+ declare const hasMemoCache: (fiber: Fiber) => boolean;
184
+ /**
185
+ * Returns the type (e.g. component definition) of the {@link Fiber}
186
+ */
187
+ declare const getType: (type: unknown) => React.ComponentType<unknown> | null;
188
+ /**
189
+ * Returns the display name of the {@link Fiber}.
190
+ */
191
+ declare const getDisplayName: (type: unknown) => string | null;
192
+ /**
193
+ * Returns the build type of the React renderer.
194
+ */
195
+ declare const detectReactBuildType: (renderer: ReactRenderer) => "development" | "production";
196
+ /**
197
+ * Returns `true` if bippy's instrumentation is active.
198
+ */
199
+ declare const isInstrumentationActive: () => boolean;
200
+ type RenderPhase = 'mount' | 'update' | 'unmount';
201
+ type RenderHandler = <S>(fiber: Fiber, phase: RenderPhase, state?: S) => unknown;
202
+ declare const fiberIdMap: WeakMap<Fiber, number>;
203
+ declare const setFiberId: (fiber: Fiber, id?: number) => void;
204
+ declare const getFiberId: (fiber: Fiber) => number;
205
+ declare const mountFiberRecursively: (onRender: RenderHandler, firstChild: Fiber, traverseSiblings: boolean) => void;
206
+ declare const updateFiberRecursively: (onRender: RenderHandler, nextFiber: Fiber, prevFiber: Fiber, parentFiber: Fiber | null) => void;
207
+ declare const unmountFiber: (onRender: RenderHandler, fiber: Fiber) => void;
208
+ declare const unmountFiberChildrenRecursively: (onRender: RenderHandler, fiber: Fiber) => void;
209
+ /**
210
+ * Creates a fiber visitor function. Must pass a fiber root and a render handler.
211
+ * @example
212
+ * traverseRenderedFibers(root, (fiber, phase) => {
213
+ * console.log(phase)
214
+ * })
215
+ */
216
+ declare const traverseRenderedFibers: (root: FiberRoot, onRender: RenderHandler) => void;
217
+ /**
218
+ * @deprecated use `traverseRenderedFibers` instead
219
+ */
220
+ declare const createFiberVisitor: ({ onRender, }: {
221
+ onRender: RenderHandler;
222
+ onError: (error: unknown) => unknown;
223
+ }) => (<S>(_rendererID: number, root: FiberRoot | Fiber, _state?: S) => void);
224
+ interface InstrumentationOptions {
225
+ onCommitFiberRoot?: (rendererID: number, root: FiberRoot, priority: void | number) => unknown;
226
+ onCommitFiberUnmount?: (rendererID: number, fiber: Fiber) => unknown;
227
+ onPostCommitFiberRoot?: (rendererID: number, root: FiberRoot) => unknown;
228
+ onActive?: () => unknown;
229
+ name?: string;
230
+ }
231
+ /**
232
+ * Instruments the DevTools hook.
233
+ * @example
234
+ * const hook = instrument({
235
+ * onActive() {
236
+ * console.log('initialized');
237
+ * },
238
+ * onCommitFiberRoot(rendererID, root) {
239
+ * console.log('fiberRoot', root.current)
240
+ * },
241
+ * });
242
+ */
243
+ declare const instrument: (options: InstrumentationOptions) => ReactDevToolsGlobalHook;
244
+ declare const getFiberFromHostInstance: <T>(hostInstance: T) => Fiber | null;
245
+ declare const secure: (options: InstrumentationOptions, secureOptions?: {
246
+ minReactMajorVersion?: number;
247
+ dangerouslyRunInProduction?: boolean;
248
+ onError?: (error?: unknown) => unknown;
249
+ installCheckTimeout?: number;
250
+ }) => InstrumentationOptions;
251
+ /**
252
+ * a wrapper around the {@link instrument} function that sets the `onCommitFiberRoot` hook.
253
+ *
254
+ * @example
255
+ * onCommitFiberRoot((root) => {
256
+ * console.log(root.current);
257
+ * });
258
+ */
259
+ declare const onCommitFiberRoot: (handler: (root: FiberRoot) => void) => ReactDevToolsGlobalHook;
260
+
261
+ export { traverseRenderedFibers as $, traverseFiber as A, getTimings as B, ClassComponentTag as C, DehydratedSuspenseComponentTag as D, ELEMENT_TYPE_SYMBOL_STRING as E, FunctionComponentTag as F, hasMemoCache as G, HostRootTag as H, getType as I, getDisplayName as J, detectReactBuildType as K, LegacyHiddenComponentTag as L, MemoComponentTag as M, isInstrumentationActive as N, OffscreenComponentTag as O, type RenderPhase as P, type RenderHandler as Q, type ReactDevToolsGlobalHook as R, SuspenseComponentTag as S, TRANSITIONAL_ELEMENT_TYPE_SYMBOL_STRING as T, fiberIdMap as U, setFiberId as V, getFiberId as W, mountFiberRecursively as X, updateFiberRecursively as Y, unmountFiber as Z, unmountFiberChildrenRecursively as _, HostComponentTag as a, createFiberVisitor as a0, type InstrumentationOptions as a1, instrument as a2, getFiberFromHostInstance as a3, secure as a4, onCommitFiberRoot as a5, type Fiber as a6, type ReactRenderer as a7, type ContextDependency as a8, type Dependencies as a9, type Effect as aa, type MemoizedState as ab, type Props as ac, HostTextTag as b, FragmentTag as c, ContextConsumerTag as d, ForwardRefTag as e, SimpleMemoComponentTag as f, HostHoistableTag as g, HostSingletonTag as h, CONCURRENT_MODE_NUMBER as i, CONCURRENT_MODE_SYMBOL_STRING as j, DEPRECATED_ASYNC_MODE_SYMBOL_STRING as k, isValidElement as l, isValidFiber as m, isHostFiber as n, isCompositeFiber as o, traverseState as p, traverseEffects as q, traverseProps as r, didFiberRender as s, traverseContexts as t, didFiberCommit as u, getMutatedHostFibers as v, getFiberStack as w, shouldFilterFiber as x, getNearestHostFiber as y, getNearestHostFibers as z };