rerender-lens 0.2.0 → 0.3.0
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.
- package/CHANGELOG.md +69 -0
- package/README.md +146 -5
- package/dist/budget-COBu7jBU.d.cts +64 -0
- package/dist/budget-LkNjGtRc.d.ts +64 -0
- package/dist/cli.cjs +458 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +4 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +452 -0
- package/dist/cli.js.map +1 -0
- package/dist/devtools-BHGUUo-p.d.ts +244 -0
- package/dist/devtools-DmhWiWcN.d.cts +244 -0
- package/dist/index.cjs +652 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -336
- package/dist/index.d.ts +40 -336
- package/dist/index.js +636 -24
- package/dist/index.js.map +1 -1
- package/dist/notifiers-BGQtWKfX.d.cts +90 -0
- package/dist/notifiers-BjjGSHpp.d.ts +90 -0
- package/dist/playwright.cjs +196 -0
- package/dist/playwright.cjs.map +1 -0
- package/dist/playwright.d.cts +35 -0
- package/dist/playwright.d.ts +35 -0
- package/dist/playwright.js +184 -0
- package/dist/playwright.js.map +1 -0
- package/dist/relay.cjs +166 -0
- package/dist/relay.cjs.map +1 -0
- package/dist/relay.d.cts +41 -0
- package/dist/relay.d.ts +41 -0
- package/dist/relay.js +161 -0
- package/dist/relay.js.map +1 -0
- package/dist/rerender-lens.iife.js +1717 -0
- package/dist/setup.cjs +1510 -0
- package/dist/setup.cjs.map +1 -0
- package/dist/setup.d.cts +2 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.js +1508 -0
- package/dist/setup.js.map +1 -0
- package/dist/types-BzUEVkxJ.d.cts +177 -0
- package/dist/types-BzUEVkxJ.d.ts +177 -0
- package/dist/vite.cjs +113 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +84 -0
- package/dist/vite.d.ts +84 -0
- package/dist/vite.js +103 -0
- package/dist/vite.js.map +1 -0
- package/dist/vitest-setup.cjs +1299 -0
- package/dist/vitest-setup.cjs.map +1 -0
- package/dist/vitest-setup.d.cts +8 -0
- package/dist/vitest-setup.d.ts +8 -0
- package/dist/vitest-setup.js +1297 -0
- package/dist/vitest-setup.js.map +1 -0
- package/dist/vitest.cjs +1360 -0
- package/dist/vitest.cjs.map +1 -0
- package/dist/vitest.d.cts +52 -0
- package/dist/vitest.d.ts +52 -0
- package/dist/vitest.js +1351 -0
- package/dist/vitest.js.map +1 -0
- package/package.json +84 -4
- package/panel/panel.css +418 -0
- package/panel/panel.html +12 -0
- package/panel/panel.js +3325 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,136 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** A new React element that renders the same type with deep-equal props. Avoidable. */
|
|
8
|
-
| 'element'
|
|
9
|
-
/** The value genuinely changed. */
|
|
10
|
-
| 'different'
|
|
11
|
-
/** Key was added. */
|
|
12
|
-
| 'added'
|
|
13
|
-
/** Key was removed. */
|
|
14
|
-
| 'removed';
|
|
15
|
-
interface Change {
|
|
16
|
-
/** Dot path from the root, e.g. `style.color` or `items[2]`. */
|
|
17
|
-
path: string;
|
|
18
|
-
kind: ChangeKind;
|
|
19
|
-
prev: unknown;
|
|
20
|
-
next: unknown;
|
|
21
|
-
}
|
|
22
|
-
/** What caused a re-render. */
|
|
23
|
-
type RenderTrigger =
|
|
24
|
-
/** At least one prop genuinely changed. */
|
|
25
|
-
'props'
|
|
26
|
-
/** Props are equal by value, but the parent re-rendered. Wrap in React.memo. */
|
|
27
|
-
| 'parent'
|
|
28
|
-
/** Own state (useState/useReducer/this.setState) changed. */
|
|
29
|
-
| 'state'
|
|
30
|
-
/** A non-state hook value (useContext, useSyncExternalStore) changed. */
|
|
31
|
-
| 'hooks'
|
|
32
|
-
/** More than one of the above. */
|
|
33
|
-
| 'mixed';
|
|
34
|
-
interface HookChange extends Change {
|
|
35
|
-
/** `useState`, `useReducer`, `useContext`, `useSyncExternalStore`, or `state` when the exact hook is unknown. */
|
|
36
|
-
hook: string;
|
|
37
|
-
/** Position of the hook in call order (0-based). */
|
|
38
|
-
index: number;
|
|
39
|
-
/** `useContext` only: the component that renders the nearest matching Provider, and its ancestry. */
|
|
40
|
-
provider?: {
|
|
41
|
-
component: string | null;
|
|
42
|
-
path: string[];
|
|
43
|
-
};
|
|
44
|
-
/** `useContext` only, object values: top-level keys whose value changed (shallow), and how many keys the value has. */
|
|
45
|
-
changedKeys?: string[];
|
|
46
|
-
totalKeys?: number;
|
|
47
|
-
}
|
|
48
|
-
/** Scheduler priority of the commit, as React reports it to the DevTools hook (transitions run at `normal`). */
|
|
49
|
-
type CommitPriority = 'immediate' | 'user-blocking' | 'normal' | 'low' | 'idle';
|
|
50
|
-
interface ParentInfo {
|
|
51
|
-
/** Display name of the nearest ancestor component that also rendered in this commit. */
|
|
52
|
-
name: string;
|
|
53
|
-
/** Why that ancestor rendered. */
|
|
54
|
-
trigger: RenderTrigger;
|
|
55
|
-
}
|
|
56
|
-
/** Where a component's element was created (React <= 18: `_debugSource`; React 19: parsed from `_debugStack`). */
|
|
57
|
-
interface SourceLocation {
|
|
58
|
-
fileName: string;
|
|
59
|
-
lineNumber?: number;
|
|
60
|
-
columnNumber?: number;
|
|
61
|
-
}
|
|
62
|
-
interface RenderReport {
|
|
63
|
-
/** Display name of the tracked component. */
|
|
64
|
-
component: string;
|
|
65
|
-
/** Stable id of this component instance (fiber) across its lifetime. */
|
|
66
|
-
instanceId: number;
|
|
67
|
-
/** Monotonic id of the React commit that produced this report. Reports from one commit share it. 0 for `useWhyRerender`. */
|
|
68
|
-
commitId: number;
|
|
69
|
-
/** Priority React assigned to the commit: `immediate` for discrete input (clicks, keys), `user-blocking` for continuous input, `normal` for transitions and async updates. */
|
|
70
|
-
commitPriority?: CommitPriority;
|
|
71
|
-
/** Monotonic per-instance update count (1 = first update; mount is never reported). */
|
|
72
|
-
renderCount: number;
|
|
73
|
-
trigger: RenderTrigger;
|
|
74
|
-
/** True when the re-render produced no genuine change in props, state, or hooks. */
|
|
75
|
-
avoidable: boolean;
|
|
76
|
-
props: {
|
|
77
|
-
prev: Record<string, unknown>;
|
|
78
|
-
next: Record<string, unknown>;
|
|
79
|
-
};
|
|
80
|
-
propChanges: Change[];
|
|
81
|
-
/** Class components only. */
|
|
82
|
-
stateChanges: Change[];
|
|
83
|
-
/** Function components: state hooks and contexts that changed. */
|
|
84
|
-
hookChanges: HookChange[];
|
|
85
|
-
/** Nearest ancestor that rendered in the same commit, or null when the update started here. */
|
|
86
|
-
parent: ParentInfo | null;
|
|
87
|
-
/** Component that created this element (dev builds only). */
|
|
88
|
-
owner: string | null;
|
|
89
|
-
/** Component ancestry from the root down to this component, display names only. */
|
|
90
|
-
path: string[];
|
|
91
|
-
/** True for `React.memo` components and `PureComponent` classes: props alone decide whether they re-render. */
|
|
92
|
-
memoized: boolean;
|
|
93
|
-
/** Time spent in this component's own render (children excluded), in ms, when React exposes it (dev/profiling builds). */
|
|
94
|
-
selfDuration?: number;
|
|
95
|
-
/** Time spent rendering this component and everything below it that rendered in the same commit, in ms. */
|
|
96
|
-
treeDuration?: number;
|
|
97
|
-
/** Source location of the element that rendered this component, when React exposes it (dev builds). */
|
|
98
|
-
source?: SourceLocation;
|
|
99
|
-
/** Human-readable explanations and suggested fixes. */
|
|
100
|
-
reasons: string[];
|
|
101
|
-
/** `performance.now()` (or `Date.now()`) when the report was produced. */
|
|
102
|
-
time: number;
|
|
103
|
-
}
|
|
104
|
-
type Notifier = (report: RenderReport) => void;
|
|
105
|
-
type ComponentMatcher = string | RegExp | ((displayName: string) => boolean);
|
|
106
|
-
interface Options {
|
|
107
|
-
/** Track every `React.memo`-wrapped component and every `PureComponent`. Default false. */
|
|
108
|
-
trackAllMemoized?: boolean;
|
|
109
|
-
/** Track every component, memoized or not. Noisy. Default false. */
|
|
110
|
-
trackAllComponents?: boolean;
|
|
111
|
-
/** Components to track by display name (string = exact match). */
|
|
112
|
-
include?: ComponentMatcher[];
|
|
113
|
-
/** Components never to track, even when marked. */
|
|
114
|
-
exclude?: ComponentMatcher[];
|
|
115
|
-
/** Diff hook state and contexts of function components. Default true. */
|
|
116
|
-
trackHooks?: boolean;
|
|
117
|
-
/** Report re-renders caused by genuine changes too, not only avoidable ones. Default false. */
|
|
118
|
-
logAll?: boolean;
|
|
119
|
-
/** Do not print to the console. Reports still reach `notifier`. Default false. */
|
|
120
|
-
silent?: boolean;
|
|
121
|
-
/** Receive every report. Combine several with `combineNotifiers`. */
|
|
122
|
-
notifier?: Notifier;
|
|
123
|
-
/** Use `console.groupCollapsed` instead of `console.group`. Default true. */
|
|
124
|
-
collapse?: boolean;
|
|
125
|
-
/** Console-like sink used for printing. Default `console`. */
|
|
126
|
-
console?: Pick<Console, 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'warn'>;
|
|
127
|
-
/** Skip commits caused by Fast Refresh / hot module replacement. Default true. */
|
|
128
|
-
ignoreHotReload?: boolean;
|
|
129
|
-
/** Stop printing a component after this many reports (0 = unlimited). The notifier still receives them. Default 0. */
|
|
130
|
-
maxReportsPerComponent?: number;
|
|
131
|
-
}
|
|
132
|
-
/** Marker static: `MyComponent.rerenderLens = true` opts a component in. */
|
|
133
|
-
declare const MARKER: "rerenderLens";
|
|
1
|
+
import { O as Options, C as ChangeKind, a as Change, H as HookChange, b as HookSnapshot, P as ParentInfo, c as CommitPriority, S as SourceLocation, d as CommitCause, R as RenderReport } from './types-BzUEVkxJ.js';
|
|
2
|
+
export { e as ComponentMatcher, M as MARKER, N as Notifier, f as RenderTrigger } from './types-BzUEVkxJ.js';
|
|
3
|
+
import { F as Fiber } from './devtools-BHGUUo-p.js';
|
|
4
|
+
export { C as ChannelCommand, a as ChannelReply, D as DEFAULT_CHANNEL, b as DEVTOOLS_MARKER, c as DevtoolsBridge, d as DevtoolsMessage, e as DevtoolsNotifierOptions, H as HelloPayload, I as InspectResult, P as PROTOCOL_VERSION, f as PullResult, R as RendererInfo, S as SerializableOptions, g as createDevtoolsNotifier, h as deserializeOptions, i as ensureDevtoolsHook, j as getRenderers, k as isProductionReact, s as serialize, l as serializeOptions } from './devtools-BHGUUo-p.js';
|
|
5
|
+
export { B as Budget, a as BudgetResult, b as BudgetViolation, F as Fix, d as FixKind, R as RankedFix, e as assertWithinBudget, g as avoidableCounts, c as checkBudget, h as fixKey, i as fixesFor, f as formatFixes, r as rankFixes, t as toBudget } from './budget-LkNjGtRc.js';
|
|
6
|
+
export { C as Collector, a as CompareRow, b as Comparison, S as SessionSummary, c as combineNotifiers, d as compareSummaries, e as createCollector, f as formatComparison, p as parseExport, s as summarizeReports } from './notifiers-BjjGSHpp.js';
|
|
134
7
|
|
|
135
8
|
declare function getDisplayName(type: unknown): string;
|
|
136
9
|
/** Decide whether a component type is tracked under the given options. */
|
|
@@ -153,84 +26,25 @@ declare function isEnabled(): boolean;
|
|
|
153
26
|
declare function track<T>(component: T, name?: string): T;
|
|
154
27
|
|
|
155
28
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
29
|
+
* Custom hook names, opt-in (`resolveHookNames`). React keeps no record of which custom hook
|
|
30
|
+
* called a primitive, so, like React DevTools, we re-run the component once with a stand-in
|
|
31
|
+
* dispatcher: every primitive records the call stack, and the frames between the primitive and the
|
|
32
|
+
* component are the custom hooks. Values come from the fiber's real hook nodes so the component
|
|
33
|
+
* takes the same code path. Results are cached per component type; a throwing render yields no names.
|
|
159
34
|
*/
|
|
160
35
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
interface Fiber {
|
|
170
|
-
tag: number;
|
|
171
|
-
key: unknown;
|
|
172
|
-
type: unknown;
|
|
173
|
-
elementType: unknown;
|
|
174
|
-
stateNode: unknown;
|
|
175
|
-
memoizedProps: Record<string, unknown> | null;
|
|
176
|
-
memoizedState: unknown;
|
|
177
|
-
alternate: Fiber | null;
|
|
178
|
-
child: Fiber | null;
|
|
179
|
-
sibling: Fiber | null;
|
|
180
|
-
return: Fiber | null;
|
|
181
|
-
flags?: number;
|
|
182
|
-
/** React 16 name for `flags`. */
|
|
183
|
-
effectTag?: number;
|
|
184
|
-
dependencies?: {
|
|
185
|
-
firstContext: ContextDependency | null;
|
|
186
|
-
} | null;
|
|
187
|
-
_debugOwner?: {
|
|
188
|
-
type?: unknown;
|
|
189
|
-
name?: string;
|
|
190
|
-
} | null;
|
|
191
|
-
_debugHookTypes?: string[] | null;
|
|
192
|
-
/** React <= 18 with the JSX dev transform. */
|
|
193
|
-
_debugSource?: {
|
|
194
|
-
fileName?: string;
|
|
195
|
-
lineNumber?: number;
|
|
196
|
-
columnNumber?: number;
|
|
197
|
-
} | null;
|
|
198
|
-
/** React 19: an Error captured where the element was created. */
|
|
199
|
-
_debugStack?: {
|
|
200
|
-
stack?: string;
|
|
201
|
-
} | string | null;
|
|
202
|
-
actualDuration?: number;
|
|
203
|
-
}
|
|
204
|
-
interface FiberRoot {
|
|
205
|
-
current: Fiber;
|
|
206
|
-
}
|
|
207
|
-
/** What `react-dom` passes to `hook.inject`. */
|
|
208
|
-
interface RendererInfo {
|
|
209
|
-
version?: string;
|
|
210
|
-
/** 1 = development build, 0 = production build. */
|
|
211
|
-
bundleType?: number;
|
|
212
|
-
rendererPackageName?: string;
|
|
213
|
-
}
|
|
214
|
-
interface DevtoolsHook {
|
|
215
|
-
renderers: Map<number, unknown>;
|
|
216
|
-
supportsFiber: boolean;
|
|
217
|
-
inject(renderer: unknown): number;
|
|
218
|
-
onCommitFiberRoot?: (id: number, root: FiberRoot, priority?: unknown, didError?: boolean) => void;
|
|
219
|
-
onCommitFiberUnmount?: (id: number, fiber: Fiber) => void;
|
|
220
|
-
onScheduleFiberRoot?: (id: number, root: FiberRoot, children: unknown) => void;
|
|
221
|
-
onPostCommitFiberRoot?: (id: number, root: FiberRoot) => void;
|
|
222
|
-
isDisabled?: boolean;
|
|
223
|
-
}
|
|
36
|
+
/** `currentDispatcherRef` as react-dom injects it: `{ current }` (React 16-18) or the shared internals `{ H }` (React 19). */
|
|
37
|
+
type DispatcherRef = {
|
|
38
|
+
current?: unknown;
|
|
39
|
+
H?: unknown;
|
|
40
|
+
};
|
|
41
|
+
/** Function names in the frames between our dispatcher and the component (innermost first). */
|
|
42
|
+
declare function customHooksFromStack(stack: string, componentName: string, marker: string): string[];
|
|
224
43
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* that unless the React DevTools extension or Fast Refresh already created it.
|
|
44
|
+
* Custom hook chain per hook node index for a rendered function-component fiber. Empty map when the
|
|
45
|
+
* replay fails, when the dispatcher ref is missing, or when the node count does not match.
|
|
228
46
|
*/
|
|
229
|
-
declare function
|
|
230
|
-
/** The renderers React registered on the hook (version and dev/prod bundle type). */
|
|
231
|
-
declare function getRenderers(): RendererInfo[];
|
|
232
|
-
/** True when every registered React renderer is a production build (names minified, no hook labels). */
|
|
233
|
-
declare function isProductionReact(): boolean;
|
|
47
|
+
declare function resolveHookNames(fiber: Fiber, ref: DispatcherRef | null | undefined): Map<number, string[]>;
|
|
234
48
|
|
|
235
49
|
type HookOptions = Pick<Options, 'notifier' | 'silent' | 'console' | 'collapse' | 'logAll'>;
|
|
236
50
|
/**
|
|
@@ -273,6 +87,12 @@ interface BuildInput {
|
|
|
273
87
|
propChanges: Change[];
|
|
274
88
|
stateChanges?: Change[];
|
|
275
89
|
hookChanges?: HookChange[];
|
|
90
|
+
hookState?: HookSnapshot[];
|
|
91
|
+
contexts?: {
|
|
92
|
+
name: string;
|
|
93
|
+
value: unknown;
|
|
94
|
+
}[];
|
|
95
|
+
state?: Record<string, unknown>;
|
|
276
96
|
parent?: ParentInfo | null;
|
|
277
97
|
owner?: string | null;
|
|
278
98
|
path?: string[];
|
|
@@ -283,141 +103,25 @@ interface BuildInput {
|
|
|
283
103
|
commitId?: number;
|
|
284
104
|
commitPriority?: CommitPriority;
|
|
285
105
|
source?: SourceLocation;
|
|
106
|
+
updaters?: string[];
|
|
107
|
+
commitCause?: CommitCause;
|
|
108
|
+
afterCommit?: number;
|
|
109
|
+
key?: string | null;
|
|
286
110
|
}
|
|
111
|
+
/** `useCart › useState#0` when custom hook names are known, else `useState #0`. */
|
|
112
|
+
declare const hookLabel: (c: {
|
|
113
|
+
hook: string;
|
|
114
|
+
index: number;
|
|
115
|
+
custom?: string[];
|
|
116
|
+
}) => string;
|
|
117
|
+
/** Store-specific advice for a `useSyncExternalStore` snapshot that is a new reference with equal contents. */
|
|
118
|
+
declare function storeAdvice(custom: string[] | undefined): string;
|
|
287
119
|
declare function buildReport(input: BuildInput): RenderReport;
|
|
288
120
|
declare function summarize(report: RenderReport): string;
|
|
289
121
|
/** Default notifier: prints a console group per report. */
|
|
290
122
|
declare function printReport(report: RenderReport, options: Options): void;
|
|
291
123
|
|
|
292
|
-
interface Collector {
|
|
293
|
-
/** Every report received, in order. */
|
|
294
|
-
readonly reports: RenderReport[];
|
|
295
|
-
/** Reports where `avoidable` is true. */
|
|
296
|
-
readonly avoidable: RenderReport[];
|
|
297
|
-
/** Pass this to `init({ notifier })`. */
|
|
298
|
-
readonly notifier: Notifier;
|
|
299
|
-
clear(): void;
|
|
300
|
-
/** Throws with a readable message if any avoidable re-render was recorded. */
|
|
301
|
-
assertNoAvoidable(): void;
|
|
302
|
-
}
|
|
303
|
-
/** Collect reports in memory. Meant for tests. */
|
|
304
|
-
declare function createCollector(): Collector;
|
|
305
|
-
declare function combineNotifiers(...notifiers: Array<Notifier | undefined | null | false>): Notifier;
|
|
306
|
-
|
|
307
|
-
declare const DEVTOOLS_MARKER: "__rerenderLens";
|
|
308
|
-
/** Bumped when the message shape or bridge API changes in a way the panel must know about. */
|
|
309
|
-
declare const PROTOCOL_VERSION = 2;
|
|
310
|
-
interface DevtoolsMessage {
|
|
311
|
-
[DEVTOOLS_MARKER]: true;
|
|
312
|
-
version: number;
|
|
313
|
-
type: 'report' | 'clear' | 'hello';
|
|
314
|
-
payload?: unknown;
|
|
315
|
-
}
|
|
316
|
-
/** Payload of a `hello` message. */
|
|
317
|
-
interface HelloPayload {
|
|
318
|
-
/** Buffered reports available for `replay()` / `pull()`. */
|
|
319
|
-
count: number;
|
|
320
|
-
/** Library version. */
|
|
321
|
-
library: string;
|
|
322
|
-
protocol: number;
|
|
323
|
-
react: RendererInfo[];
|
|
324
|
-
/** True when every React renderer on the page is a production build. */
|
|
325
|
-
production: boolean;
|
|
326
|
-
enabled: boolean;
|
|
327
|
-
options: SerializableOptions;
|
|
328
|
-
/** Who created this bridge: the page's own `init` call, or the extension's injected copy. */
|
|
329
|
-
source: 'page' | 'extension';
|
|
330
|
-
/** True when the extension injected a copy of the library into this page (whether or not it is the active one). */
|
|
331
|
-
injected: boolean;
|
|
332
|
-
/** Roots React scheduled (dev builds) and commits observed since `init`; the gap is work that never committed. */
|
|
333
|
-
scheduled: number;
|
|
334
|
-
commits: number;
|
|
335
|
-
}
|
|
336
|
-
declare global {
|
|
337
|
-
interface Window {
|
|
338
|
-
/** Set by the extension's inject script: version of the injected library. */
|
|
339
|
-
__RERENDER_LENS_INJECTED__?: string;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
/** `Options` with matchers as strings (`"Name"` or `"/regex/flags"`) and no functions. */
|
|
343
|
-
interface SerializableOptions {
|
|
344
|
-
trackAllMemoized?: boolean;
|
|
345
|
-
trackAllComponents?: boolean;
|
|
346
|
-
include?: string[];
|
|
347
|
-
exclude?: string[];
|
|
348
|
-
trackHooks?: boolean;
|
|
349
|
-
logAll?: boolean;
|
|
350
|
-
silent?: boolean;
|
|
351
|
-
collapse?: boolean;
|
|
352
|
-
ignoreHotReload?: boolean;
|
|
353
|
-
maxReportsPerComponent?: number;
|
|
354
|
-
}
|
|
355
|
-
interface DevtoolsNotifierOptions {
|
|
356
|
-
/** How many reports to keep for `replay()`. Default 300. */
|
|
357
|
-
bufferSize?: number;
|
|
358
|
-
/** Where to post. Default `window`. */
|
|
359
|
-
target?: Pick<Window, 'postMessage'>;
|
|
360
|
-
/** Max serialization depth. Default 6. */
|
|
361
|
-
maxDepth?: number;
|
|
362
|
-
/** Flash the DOM of components that re-rendered avoidably. Default false; toggle later with `flashAvoidable`. */
|
|
363
|
-
flashAvoidable?: boolean;
|
|
364
|
-
/** Reported in `info()`. The extension's inject script passes `'extension'`. Default `'page'`. */
|
|
365
|
-
source?: 'page' | 'extension';
|
|
366
|
-
}
|
|
367
|
-
interface InspectResult {
|
|
368
|
-
component: string;
|
|
369
|
-
instanceId: number | null;
|
|
370
|
-
tracked: boolean;
|
|
371
|
-
path: string[];
|
|
372
|
-
/** Serialized reports for this instance, oldest first. */
|
|
373
|
-
reports: unknown[];
|
|
374
|
-
}
|
|
375
|
-
interface PullResult {
|
|
376
|
-
/** Sequence number of the newest report included; pass it back as `since`. */
|
|
377
|
-
seq: number;
|
|
378
|
-
reports: unknown[];
|
|
379
|
-
/** True when the caller missed reports that fell out of the buffer. */
|
|
380
|
-
dropped: boolean;
|
|
381
|
-
}
|
|
382
|
-
interface DevtoolsBridge {
|
|
383
|
-
/** Re-post every buffered report (a panel that opened late calls this). */
|
|
384
|
-
replay(): void;
|
|
385
|
-
clear(): void;
|
|
386
|
-
readonly size: number;
|
|
387
|
-
readonly version: number;
|
|
388
|
-
/** Library version. */
|
|
389
|
-
readonly library: string;
|
|
390
|
-
/** Everything the panel shows in its status line. */
|
|
391
|
-
info(): HelloPayload;
|
|
392
|
-
/** Reports newer than `since`. Lets a panel poll without any content script. */
|
|
393
|
-
pull(since?: number): PullResult;
|
|
394
|
-
/** Merge options at runtime; matchers are strings (`"/^Grid/"` becomes a RegExp). */
|
|
395
|
-
configure(options: SerializableOptions): SerializableOptions;
|
|
396
|
-
getOptions(): SerializableOptions;
|
|
397
|
-
/** Outline the DOM of an instance in the page; `null` clears. */
|
|
398
|
-
highlight(instanceId: number | null): boolean;
|
|
399
|
-
/** Turn the avoidable-render flash on or off. */
|
|
400
|
-
flashAvoidable(on: boolean): void;
|
|
401
|
-
/** Re-render details for a DOM node (DevTools' `$0`). */
|
|
402
|
-
inspect(node: unknown): InspectResult | null;
|
|
403
|
-
}
|
|
404
|
-
declare global {
|
|
405
|
-
interface Window {
|
|
406
|
-
__RERENDER_LENS_DEVTOOLS__?: DevtoolsBridge;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
/** Convert a report into a structured-clone-safe value (functions, elements, cycles removed). */
|
|
410
|
-
declare function serialize(value: unknown, maxDepth?: number, seen?: WeakSet<object>, depth?: number): unknown;
|
|
411
|
-
/** The current options in a JSON-safe form (function matchers and custom consoles are dropped). */
|
|
412
|
-
declare function serializeOptions(o: Options): SerializableOptions;
|
|
413
|
-
declare function deserializeOptions(o: SerializableOptions): Options;
|
|
414
|
-
/**
|
|
415
|
-
* A notifier that posts every report on `window` for a DevTools extension to pick up.
|
|
416
|
-
* Also installs `window.__RERENDER_LENS_DEVTOOLS__` with `replay()` / `clear()` / `pull()` and friends.
|
|
417
|
-
*/
|
|
418
|
-
declare function createDevtoolsNotifier(options?: DevtoolsNotifierOptions): Notifier;
|
|
419
|
-
|
|
420
124
|
/** Library version, injected by the build; "dev" when running from source. */
|
|
421
125
|
declare const VERSION: string;
|
|
422
126
|
|
|
423
|
-
export {
|
|
127
|
+
export { Change, ChangeKind, CommitCause, CommitPriority, type DispatcherRef, HookChange, HookSnapshot, Options, ParentInfo, RenderReport, SourceLocation, VERSION, buildReport, classify, configure, customHooksFromStack, deepEqual, diffRecords, disable, getDisplayName, hookLabel, init, isEnabled, printReport, resolveHookNames, shouldTrack, storeAdvice, summarize, track, useWhyRerender };
|