rerender-lens 0.3.0 → 0.5.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 +118 -0
- package/README.md +192 -353
- package/dist/{budget-COBu7jBU.d.cts → budget-BnJlYwrV.d.ts} +20 -10
- package/dist/{budget-LkNjGtRc.d.ts → budget-CRswn-nC.d.cts} +20 -10
- package/dist/cli.cjs +248 -31
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +248 -31
- package/dist/cli.js.map +1 -1
- package/dist/{devtools-BHGUUo-p.d.ts → devtools-BYWat7nQ.d.ts} +17 -3
- package/dist/{devtools-DmhWiWcN.d.cts → devtools-DJi_6AfJ.d.cts} +17 -3
- package/dist/index.cjs +635 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -8
- package/dist/index.d.ts +131 -8
- package/dist/index.js +620 -110
- package/dist/index.js.map +1 -1
- package/dist/jest-setup.cjs +1673 -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 +1671 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/jest.cjs +1760 -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 +1751 -0
- package/dist/jest.js.map +1 -0
- package/dist/{notifiers-BjjGSHpp.d.ts → notifiers-DwKlvv4H.d.cts} +8 -4
- package/dist/{notifiers-BGQtWKfX.d.cts → notifiers-FNzKHs0a.d.ts} +8 -4
- package/dist/playwright.cjs +235 -30
- package/dist/playwright.cjs.map +1 -1
- package/dist/playwright.d.cts +8 -6
- package/dist/playwright.d.ts +8 -6
- package/dist/playwright.js +235 -31
- package/dist/playwright.js.map +1 -1
- package/dist/relay.cjs +10 -2
- package/dist/relay.cjs.map +1 -1
- package/dist/relay.js +10 -2
- package/dist/relay.js.map +1 -1
- package/dist/rerender-lens.iife.js +1100 -337
- package/dist/runner-report-B8Sc3FZO.d.cts +46 -0
- package/dist/runner-report-CW8X5RwK.d.ts +46 -0
- package/dist/setup.cjs +308 -95
- package/dist/setup.cjs.map +1 -1
- package/dist/setup.js +308 -95
- package/dist/setup.js.map +1 -1
- package/dist/{types-BzUEVkxJ.d.cts → types-DW5-N2XH.d.cts} +55 -2
- package/dist/{types-BzUEVkxJ.d.ts → types-DW5-N2XH.d.ts} +55 -2
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vitest-setup.cjs +452 -87
- 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 +452 -87
- package/dist/vitest-setup.js.map +1 -1
- package/dist/vitest.cjs +515 -123
- 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 +516 -124
- package/dist/vitest.js.map +1 -1
- package/package.json +41 -5
- package/panel/panel.css +1 -34
- package/panel/panel.js +865 -713
|
@@ -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 {
|
|
@@ -174,4 +227,4 @@ interface Options {
|
|
|
174
227
|
/** Marker static: `MyComponent.rerenderLens = true` opts a component in. */
|
|
175
228
|
declare const MARKER: "rerenderLens";
|
|
176
229
|
|
|
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
|
|
230
|
+
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 ReportLike as a, type Change as b, type HookSnapshot as c, type CommitPriority as d, type CommitCause as e, type ChangeLike as f, type ComponentMatcher as g, type RenderTrigger as h };
|
|
@@ -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 {
|
|
@@ -174,4 +227,4 @@ interface Options {
|
|
|
174
227
|
/** Marker static: `MyComponent.rerenderLens = true` opts a component in. */
|
|
175
228
|
declare const MARKER: "rerenderLens";
|
|
176
229
|
|
|
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
|
|
230
|
+
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 ReportLike as a, type Change as b, type HookSnapshot as c, type CommitPriority as d, type CommitCause as e, type ChangeLike as f, type ComponentMatcher as g, type RenderTrigger as h };
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as Options } from './types-
|
|
1
|
+
import { O as Options } from './types-DW5-N2XH.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-DW5-N2XH.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'> & {
|