rerender-lens 0.4.0 → 0.7.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 +127 -0
- package/README.md +208 -359
- package/dist/{budget-LkNjGtRc.d.ts → budget-CA1MS7lB.d.cts} +20 -10
- package/dist/{budget-COBu7jBU.d.cts → budget-ok1VDJ4t.d.ts} +20 -10
- package/dist/cli.cjs +322 -53
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +322 -53
- package/dist/cli.js.map +1 -1
- package/dist/{devtools-BkCct3cJ.d.cts → devtools-Cl5n_52v.d.ts} +17 -2
- package/dist/{devtools-CZebzpF6.d.ts → devtools-UwQx2VYS.d.cts} +17 -2
- package/dist/index.cjs +537 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +137 -8
- package/dist/index.d.ts +137 -8
- package/dist/index.js +521 -50
- package/dist/index.js.map +1 -1
- package/dist/jest-setup.cjs +1690 -0
- package/dist/jest-setup.cjs.map +1 -0
- package/dist/jest-setup.d.cts +8 -0
- package/dist/jest-setup.d.ts +8 -0
- package/dist/jest-setup.js +1688 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/jest.cjs +1777 -0
- package/dist/jest.cjs.map +1 -0
- package/dist/jest.d.cts +23 -0
- package/dist/jest.d.ts +23 -0
- package/dist/jest.js +1768 -0
- package/dist/jest.js.map +1 -0
- package/dist/{notifiers-BjjGSHpp.d.ts → notifiers-B5poAEvE.d.cts} +8 -4
- package/dist/{notifiers-BGQtWKfX.d.cts → notifiers-CqQW0Eum.d.ts} +8 -4
- package/dist/playwright.cjs +230 -28
- package/dist/playwright.cjs.map +1 -1
- package/dist/playwright.d.cts +4 -4
- package/dist/playwright.d.ts +4 -4
- package/dist/playwright.js +230 -28
- package/dist/playwright.js.map +1 -1
- package/dist/relay.cjs +71 -19
- package/dist/relay.cjs.map +1 -1
- package/dist/relay.d.cts +25 -3
- package/dist/relay.d.ts +25 -3
- package/dist/relay.js +71 -19
- package/dist/relay.js.map +1 -1
- package/dist/rerender-lens.iife.js +457 -62
- package/dist/runner-report-Bvqoe89M.d.ts +46 -0
- package/dist/runner-report-CvpDg2zt.d.cts +46 -0
- package/dist/setup.cjs +209 -35
- package/dist/setup.cjs.map +1 -1
- package/dist/setup.js +209 -35
- package/dist/setup.js.map +1 -1
- package/dist/{types-BzUEVkxJ.d.cts → types-DwNN5cWe.d.cts} +82 -2
- package/dist/{types-BzUEVkxJ.d.ts → types-DwNN5cWe.d.ts} +82 -2
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vitest-setup.cjs +357 -44
- package/dist/vitest-setup.cjs.map +1 -1
- package/dist/vitest-setup.d.cts +4 -4
- package/dist/vitest-setup.d.ts +4 -4
- package/dist/vitest-setup.js +357 -44
- package/dist/vitest-setup.js.map +1 -1
- package/dist/vitest.cjs +420 -80
- package/dist/vitest.cjs.map +1 -1
- package/dist/vitest.d.cts +21 -39
- package/dist/vitest.d.ts +21 -39
- package/dist/vitest.js +421 -81
- package/dist/vitest.js.map +1 -1
- package/package.json +41 -4
- package/panel/panel.css +49 -0
- package/panel/panel.js +871 -353
|
@@ -32,7 +32,7 @@ type RenderTrigger =
|
|
|
32
32
|
/** More than one of the above. */
|
|
33
33
|
| 'mixed';
|
|
34
34
|
interface HookChange extends Change {
|
|
35
|
-
/** `useState`, `useReducer`, `useContext`, `useSyncExternalStore`, or `state` when the exact hook is unknown. */
|
|
35
|
+
/** `useState`, `useReducer`, `useContext`, `useSyncExternalStore`, `useDeferredValue` (dev builds), or `state` when the exact hook is unknown. */
|
|
36
36
|
hook: string;
|
|
37
37
|
/** Position of the hook in call order (0-based). */
|
|
38
38
|
index: number;
|
|
@@ -124,6 +124,12 @@ interface RenderReport {
|
|
|
124
124
|
path: string[];
|
|
125
125
|
/** True for `React.memo` components and `PureComponent` classes: props alone decide whether they re-render. */
|
|
126
126
|
memoized: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* True when React Compiler compiled the component (its fiber carries a `useMemoCache` cache). React still
|
|
129
|
+
* calls it when the parent renders, but its output is memoized per input, so a `parent` render with
|
|
130
|
+
* identical props is cheap and not reported as avoidable.
|
|
131
|
+
*/
|
|
132
|
+
compiled?: boolean;
|
|
127
133
|
/** Time spent in this component's own render (children excluded), in ms, when React exposes it (dev/profiling builds). */
|
|
128
134
|
selfDuration?: number;
|
|
129
135
|
/** Time spent rendering this component and everything below it that rendered in the same commit, in ms. */
|
|
@@ -135,6 +141,53 @@ interface RenderReport {
|
|
|
135
141
|
/** `performance.now()` (or `Date.now()`) when the report was produced. */
|
|
136
142
|
time: number;
|
|
137
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The fields the analysis helpers (`fixesFor`, `rankFixes`, `analyzeCommit`, `rankRootCauses`, `summarizeReports`, `summarize`) read,
|
|
146
|
+
* as a structural type: both a live `RenderReport` and the DevTools panel's serialized report satisfy
|
|
147
|
+
* it, so the panel and the library share one implementation without casts.
|
|
148
|
+
*/
|
|
149
|
+
interface ChangeLike {
|
|
150
|
+
path: string;
|
|
151
|
+
kind: ChangeKind;
|
|
152
|
+
prev?: unknown;
|
|
153
|
+
next?: unknown;
|
|
154
|
+
hook?: string;
|
|
155
|
+
index?: number;
|
|
156
|
+
provider?: {
|
|
157
|
+
component: string | null;
|
|
158
|
+
path: string[];
|
|
159
|
+
};
|
|
160
|
+
changedKeys?: string[];
|
|
161
|
+
totalKeys?: number;
|
|
162
|
+
custom?: string[];
|
|
163
|
+
}
|
|
164
|
+
interface ReportLike {
|
|
165
|
+
component: string;
|
|
166
|
+
avoidable: boolean;
|
|
167
|
+
trigger: string;
|
|
168
|
+
memoized?: boolean;
|
|
169
|
+
compiled?: boolean;
|
|
170
|
+
propChanges: ChangeLike[];
|
|
171
|
+
stateChanges: ChangeLike[];
|
|
172
|
+
hookChanges: ChangeLike[];
|
|
173
|
+
parent: {
|
|
174
|
+
name: string;
|
|
175
|
+
trigger: string;
|
|
176
|
+
} | null;
|
|
177
|
+
owner: string | null;
|
|
178
|
+
path: string[];
|
|
179
|
+
selfDuration?: number;
|
|
180
|
+
time: number;
|
|
181
|
+
/** Shared by every report of one React commit; the root-cause analysis groups by it. 0/absent = unknown. */
|
|
182
|
+
commitId?: number;
|
|
183
|
+
updaters?: string[];
|
|
184
|
+
commitCause?: string;
|
|
185
|
+
afterCommit?: number;
|
|
186
|
+
contexts?: {
|
|
187
|
+
name: string;
|
|
188
|
+
value: unknown;
|
|
189
|
+
}[];
|
|
190
|
+
}
|
|
138
191
|
type Notifier = (report: RenderReport) => void;
|
|
139
192
|
type ComponentMatcher = string | RegExp | ((displayName: string) => boolean);
|
|
140
193
|
interface Options {
|
|
@@ -171,7 +224,34 @@ interface Options {
|
|
|
171
224
|
/** Stop printing a component after this many reports (0 = unlimited). The notifier still receives them. Default 0. */
|
|
172
225
|
maxReportsPerComponent?: number;
|
|
173
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Why one component type is or is not tracked under the current options, in words a user can act on.
|
|
229
|
+
* Produced by `explainTracking`; `tracked` always agrees with `shouldTrack`.
|
|
230
|
+
*/
|
|
231
|
+
interface TrackingVerdict {
|
|
232
|
+
tracked: boolean;
|
|
233
|
+
/** One sentence: the rule that decided it. */
|
|
234
|
+
reason: string;
|
|
235
|
+
/** What to change to track it, when it is not tracked and something can be changed. */
|
|
236
|
+
fix?: string;
|
|
237
|
+
/** Display name, or `Anonymous` when the type has none. */
|
|
238
|
+
name: string;
|
|
239
|
+
/** `React.memo` component or `PureComponent` class. */
|
|
240
|
+
memoized: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** What the current options select, plus how much of the page they actually cover. In `info().tracking`. */
|
|
243
|
+
interface TrackingSummary {
|
|
244
|
+
/** `all` = every component, `memoized` = `React.memo`/`PureComponent` only, `marked` = only `track()` and `include`. */
|
|
245
|
+
mode: 'all' | 'memoized' | 'marked';
|
|
246
|
+
include: string[];
|
|
247
|
+
exclude: string[];
|
|
248
|
+
/** Distinct component names that rendered since `init`, and how many of those were tracked. */
|
|
249
|
+
renderedCount: number;
|
|
250
|
+
trackedCount: number;
|
|
251
|
+
/** True when more distinct names rendered than the counter keeps (`MAX_SEEN_COMPONENTS`); the counts are a floor. */
|
|
252
|
+
overflow: boolean;
|
|
253
|
+
}
|
|
174
254
|
/** Marker static: `MyComponent.rerenderLens = true` opts a component in. */
|
|
175
255
|
declare const MARKER: "rerenderLens";
|
|
176
256
|
|
|
177
|
-
export { type ChangeKind as C, type HookChange as H, MARKER as M, type Notifier as N, type Options as O, type ParentInfo as P, type RenderReport as R, type SourceLocation as S, type
|
|
257
|
+
export { type ChangeKind as C, type HookChange as H, MARKER as M, type Notifier as N, type Options as O, type ParentInfo as P, type RenderReport as R, type SourceLocation as S, type TrackingSummary as T, type TrackingVerdict as a, type ReportLike as b, type Change as c, type HookSnapshot as d, type CommitPriority as e, type CommitCause as f, type ChangeLike as g, type ComponentMatcher as h, type RenderTrigger as i };
|
|
@@ -32,7 +32,7 @@ type RenderTrigger =
|
|
|
32
32
|
/** More than one of the above. */
|
|
33
33
|
| 'mixed';
|
|
34
34
|
interface HookChange extends Change {
|
|
35
|
-
/** `useState`, `useReducer`, `useContext`, `useSyncExternalStore`, or `state` when the exact hook is unknown. */
|
|
35
|
+
/** `useState`, `useReducer`, `useContext`, `useSyncExternalStore`, `useDeferredValue` (dev builds), or `state` when the exact hook is unknown. */
|
|
36
36
|
hook: string;
|
|
37
37
|
/** Position of the hook in call order (0-based). */
|
|
38
38
|
index: number;
|
|
@@ -124,6 +124,12 @@ interface RenderReport {
|
|
|
124
124
|
path: string[];
|
|
125
125
|
/** True for `React.memo` components and `PureComponent` classes: props alone decide whether they re-render. */
|
|
126
126
|
memoized: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* True when React Compiler compiled the component (its fiber carries a `useMemoCache` cache). React still
|
|
129
|
+
* calls it when the parent renders, but its output is memoized per input, so a `parent` render with
|
|
130
|
+
* identical props is cheap and not reported as avoidable.
|
|
131
|
+
*/
|
|
132
|
+
compiled?: boolean;
|
|
127
133
|
/** Time spent in this component's own render (children excluded), in ms, when React exposes it (dev/profiling builds). */
|
|
128
134
|
selfDuration?: number;
|
|
129
135
|
/** Time spent rendering this component and everything below it that rendered in the same commit, in ms. */
|
|
@@ -135,6 +141,53 @@ interface RenderReport {
|
|
|
135
141
|
/** `performance.now()` (or `Date.now()`) when the report was produced. */
|
|
136
142
|
time: number;
|
|
137
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The fields the analysis helpers (`fixesFor`, `rankFixes`, `analyzeCommit`, `rankRootCauses`, `summarizeReports`, `summarize`) read,
|
|
146
|
+
* as a structural type: both a live `RenderReport` and the DevTools panel's serialized report satisfy
|
|
147
|
+
* it, so the panel and the library share one implementation without casts.
|
|
148
|
+
*/
|
|
149
|
+
interface ChangeLike {
|
|
150
|
+
path: string;
|
|
151
|
+
kind: ChangeKind;
|
|
152
|
+
prev?: unknown;
|
|
153
|
+
next?: unknown;
|
|
154
|
+
hook?: string;
|
|
155
|
+
index?: number;
|
|
156
|
+
provider?: {
|
|
157
|
+
component: string | null;
|
|
158
|
+
path: string[];
|
|
159
|
+
};
|
|
160
|
+
changedKeys?: string[];
|
|
161
|
+
totalKeys?: number;
|
|
162
|
+
custom?: string[];
|
|
163
|
+
}
|
|
164
|
+
interface ReportLike {
|
|
165
|
+
component: string;
|
|
166
|
+
avoidable: boolean;
|
|
167
|
+
trigger: string;
|
|
168
|
+
memoized?: boolean;
|
|
169
|
+
compiled?: boolean;
|
|
170
|
+
propChanges: ChangeLike[];
|
|
171
|
+
stateChanges: ChangeLike[];
|
|
172
|
+
hookChanges: ChangeLike[];
|
|
173
|
+
parent: {
|
|
174
|
+
name: string;
|
|
175
|
+
trigger: string;
|
|
176
|
+
} | null;
|
|
177
|
+
owner: string | null;
|
|
178
|
+
path: string[];
|
|
179
|
+
selfDuration?: number;
|
|
180
|
+
time: number;
|
|
181
|
+
/** Shared by every report of one React commit; the root-cause analysis groups by it. 0/absent = unknown. */
|
|
182
|
+
commitId?: number;
|
|
183
|
+
updaters?: string[];
|
|
184
|
+
commitCause?: string;
|
|
185
|
+
afterCommit?: number;
|
|
186
|
+
contexts?: {
|
|
187
|
+
name: string;
|
|
188
|
+
value: unknown;
|
|
189
|
+
}[];
|
|
190
|
+
}
|
|
138
191
|
type Notifier = (report: RenderReport) => void;
|
|
139
192
|
type ComponentMatcher = string | RegExp | ((displayName: string) => boolean);
|
|
140
193
|
interface Options {
|
|
@@ -171,7 +224,34 @@ interface Options {
|
|
|
171
224
|
/** Stop printing a component after this many reports (0 = unlimited). The notifier still receives them. Default 0. */
|
|
172
225
|
maxReportsPerComponent?: number;
|
|
173
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Why one component type is or is not tracked under the current options, in words a user can act on.
|
|
229
|
+
* Produced by `explainTracking`; `tracked` always agrees with `shouldTrack`.
|
|
230
|
+
*/
|
|
231
|
+
interface TrackingVerdict {
|
|
232
|
+
tracked: boolean;
|
|
233
|
+
/** One sentence: the rule that decided it. */
|
|
234
|
+
reason: string;
|
|
235
|
+
/** What to change to track it, when it is not tracked and something can be changed. */
|
|
236
|
+
fix?: string;
|
|
237
|
+
/** Display name, or `Anonymous` when the type has none. */
|
|
238
|
+
name: string;
|
|
239
|
+
/** `React.memo` component or `PureComponent` class. */
|
|
240
|
+
memoized: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** What the current options select, plus how much of the page they actually cover. In `info().tracking`. */
|
|
243
|
+
interface TrackingSummary {
|
|
244
|
+
/** `all` = every component, `memoized` = `React.memo`/`PureComponent` only, `marked` = only `track()` and `include`. */
|
|
245
|
+
mode: 'all' | 'memoized' | 'marked';
|
|
246
|
+
include: string[];
|
|
247
|
+
exclude: string[];
|
|
248
|
+
/** Distinct component names that rendered since `init`, and how many of those were tracked. */
|
|
249
|
+
renderedCount: number;
|
|
250
|
+
trackedCount: number;
|
|
251
|
+
/** True when more distinct names rendered than the counter keeps (`MAX_SEEN_COMPONENTS`); the counts are a floor. */
|
|
252
|
+
overflow: boolean;
|
|
253
|
+
}
|
|
174
254
|
/** Marker static: `MyComponent.rerenderLens = true` opts a component in. */
|
|
175
255
|
declare const MARKER: "rerenderLens";
|
|
176
256
|
|
|
177
|
-
export { type ChangeKind as C, type HookChange as H, MARKER as M, type Notifier as N, type Options as O, type ParentInfo as P, type RenderReport as R, type SourceLocation as S, type
|
|
257
|
+
export { type ChangeKind as C, type HookChange as H, MARKER as M, type Notifier as N, type Options as O, type ParentInfo as P, type RenderReport as R, type SourceLocation as S, type TrackingSummary as T, type TrackingVerdict as a, type ReportLike as b, type Change as c, type HookSnapshot as d, type CommitPriority as e, type CommitCause as f, type ChangeLike as g, type ComponentMatcher as h, type RenderTrigger as i };
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as Options } from './types-
|
|
1
|
+
import { O as Options } from './types-DwNN5cWe.cjs';
|
|
2
2
|
|
|
3
3
|
/** `Options` minus the parts that cannot be serialized into a module (functions). Matchers may be strings or RegExps. */
|
|
4
4
|
type VitePluginOptions = Omit<Options, 'notifier' | 'console' | 'include' | 'exclude'> & {
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as Options } from './types-
|
|
1
|
+
import { O as Options } from './types-DwNN5cWe.js';
|
|
2
2
|
|
|
3
3
|
/** `Options` minus the parts that cannot be serialized into a module (functions). Matchers may be strings or RegExps. */
|
|
4
4
|
type VitePluginOptions = Omit<Options, 'notifier' | 'console' | 'include' | 'exclude'> & {
|