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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,132 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
Highlights: verdicts pinned for modern React (Compiler output, `use()`, transitions, Suspense),
|
|
6
|
+
a Jest integration, React 17 and 18 in CI, several apps on one relay, a commit timeline in the
|
|
7
|
+
panel, a docs site that answers "how do I start", a relay that authenticates off loopback, and a
|
|
8
|
+
panel that tells you why a component is not tracked. Details, newest first:
|
|
9
|
+
|
|
10
|
+
- **The relay authenticates when it is not on loopback.** `npx rerender-lens panel --host 0.0.0.0`
|
|
11
|
+
now generates a token, prints it inside the URL and refuses `/events`, `/message` and `/status`
|
|
12
|
+
without it, because reports carry your app's prop, state and context values. Pass the printed URL
|
|
13
|
+
to the app and the panel and both pick the token up; `--token` sets your own, `--no-token` opts
|
|
14
|
+
out with a warning. Loopback is unchanged and needs no secret.
|
|
15
|
+
- A nightly job records what the library costs per commit on a large tree (`npm run e2e:perf`,
|
|
16
|
+
3,000 and 10,000 memoized rows) and fails when a commit blows its budget. On a laptop the worst
|
|
17
|
+
commit is about 32 ms at both sizes: the cost is flat in tree size because the per-commit cap
|
|
18
|
+
stops the walk. The extension README now documents that the package ships no remote code and no
|
|
19
|
+
`eval` beyond `chrome.devtools.inspectedWindow.eval`, under MV3's default content security
|
|
20
|
+
policy.
|
|
21
|
+
- **"Why is this component not tracked?"** New `explainTracking(type, options)` returns the same
|
|
22
|
+
decision as `shouldTrack` plus the rule that made it and what to change, and the bridge carries
|
|
23
|
+
it: `info().tracking` (mode, include/exclude, and how many distinct components rendered since
|
|
24
|
+
`init` versus how many were tracked), `inspect(node).tracking`, and a new `explain(node | instanceId)`
|
|
25
|
+
command that also works over the BroadcastChannel and the relay. The panel's empty state now says
|
|
26
|
+
"tracking every React.memo and PureComponent; 42 components rendered, 3 of them tracked" and
|
|
27
|
+
offers *Track every component* and *Track components matching…*; the Elements sidebar shows the
|
|
28
|
+
verdict, the reason and a *Track this component* button for the selected element. Additive:
|
|
29
|
+
the protocol stays at 2.
|
|
30
|
+
- **The docs site is a product page.** A landing page that answers "how do I start with my
|
|
31
|
+
bundler" (Vite, Next.js, Webpack, any app through the relay, the extension, tests) with the
|
|
32
|
+
snippets lifted straight out of the README so they cannot drift, the README as the guide, the
|
|
33
|
+
extension guide, a generated API reference for every entry point, and a hosted copy of the panel
|
|
34
|
+
running its demo data so you can click around before installing anything. A published release
|
|
35
|
+
recaptures the screenshots before building, so they never show an old panel.
|
|
36
|
+
- **Several apps on one relay.** `npx rerender-lens panel` now gives each connected app an id and a
|
|
37
|
+
label (its address), tells the app its id so what it posts is stamped, and sends panels the
|
|
38
|
+
roster. The panel shows a picker when more than one app is connected, watches one at a time and
|
|
39
|
+
addresses its commands to that app, so a host app and a microfrontend (or two pages, or two
|
|
40
|
+
machines) no longer interleave into one stream. A panel or a library that knows nothing about
|
|
41
|
+
ids behaves exactly as before, and the protocol stays at 2.
|
|
42
|
+
- The side panel and the DevTools panel are now covered by a test that changes a setting in one and
|
|
43
|
+
reads it back in the other, in both directions.
|
|
44
|
+
- **Panel: a commit timeline strip above the tree.** One bar per React commit, oldest left, height
|
|
45
|
+
on a sqrt scale of the commit's render count and filled from the bottom with its avoidable share.
|
|
46
|
+
Click a bar to open that commit in the Commits view; drag across bars to brush a time window, and
|
|
47
|
+
the tree, Offenders, Fixes, Commits and the live stream all narrow to it (a chip in the strip
|
|
48
|
+
header says how wide the window is and how many reports it holds; `Esc` or the chip clears it).
|
|
49
|
+
Bars are focusable, labelled ("commit 12, 4 renders, 3 avoidable, 8 seconds ago") and navigable
|
|
50
|
+
with the arrow keys. The strip collapses from its chevron (persisted per origin), draws at most
|
|
51
|
+
the 200 most recent commits, and repaints on the same `LEFT_RENDER_INTERVAL` throttle as the
|
|
52
|
+
other heavy views once the buffer passes 200 reports.
|
|
53
|
+
|
|
54
|
+
- **Jest.** `rerender-lens/jest` and `rerender-lens/jest/setup`: the same deal as the Vitest
|
|
55
|
+
integration — one `setupFilesAfterEnv` line collects every avoidable re-render, and the reporter
|
|
56
|
+
(`reporters: [['rerender-lens/jest', { budget }]]`) prints the run's ranked fixes and root causes,
|
|
57
|
+
writes a panel-compatible export and fails the run on a budget violation. The runner-agnostic half
|
|
58
|
+
(the JSONL hand-off between workers and the reporter, the per-file setup, the finish logic) moved
|
|
59
|
+
to `src/runner-report.ts`, so Vitest and Jest share one implementation. A real Jest run in
|
|
60
|
+
`test/jest/` (jsdom, babel-jest, the package resolved by name) is its own CI job: it asserts the
|
|
61
|
+
reporter exits non-zero with a budget of zero and exits 0 with a budget that fits.
|
|
62
|
+
|
|
63
|
+
- **React 17 in CI, and the peer range is now honest.** `npm run test:react17` runs the unit suite
|
|
64
|
+
against React 17 alongside `test:react18`, so `react >= 16.8` is a tested claim rather than an
|
|
65
|
+
assumption. The harness became version-agnostic (`act` from `react` or `react-dom/test-utils`, a
|
|
66
|
+
shim for the root API React 17 does not have). What React 17 cannot give you is now documented in
|
|
67
|
+
the README's compatibility table and said once at runtime: React only records the value a
|
|
68
|
+
component read from a context from 18 on, so on 17 a context change is reported as a plain parent
|
|
69
|
+
re-render; updaters and effect-loop detection need React 18's updater tracking.
|
|
70
|
+
- **Report a problem** in the panel's Settings drawer: opens a GitHub issue prefilled with the
|
|
71
|
+
extension and library versions, React version, options, overhead, the truncation count and the
|
|
72
|
+
buffer totals, and nothing from the page. `extension/store/QA.md` gains the scale, relay and
|
|
73
|
+
help checks.
|
|
74
|
+
- **Verdicts on modern React.** A fixture matrix (`test/modern.test.ts`, and `/modern.html` in the
|
|
75
|
+
example) pins the verdict for React Compiler output, `use(promise)`, `startTransition`, Suspense
|
|
76
|
+
fallback → content, `useSyncExternalStore` selectors, render props, `forwardRef` + `memo` refs,
|
|
77
|
+
classes with `shouldComponentUpdate`, `useDeferredValue` and `useId`; the README gains the table
|
|
78
|
+
"What counts as avoidable". Fixes that came out of it: components compiled by React Compiler carry
|
|
79
|
+
`compiled: true` (detected from the `useMemoCache` slots on the fiber) and a parent-triggered render
|
|
80
|
+
with identical props is no longer avoidable (the output is memoized; nothing to fix); content
|
|
81
|
+
re-rendered because a Suspense boundary above it resolved is explained instead of flagged; a new
|
|
82
|
+
`ref` object per render is reported as `deep-equal` on `ref` with `useRef` advice instead of a
|
|
83
|
+
spurious `ref.current` change; the deferred second render of `useDeferredValue` is a `hooks` render
|
|
84
|
+
(dev builds) rather than an avoidable parent render, and never counts as an effect → setState loop;
|
|
85
|
+
class components get PureComponent / `shouldComponentUpdate` advice instead of `React.memo`. The
|
|
86
|
+
panel shows the compiled flag.
|
|
87
|
+
|
|
88
|
+
## 0.5.0
|
|
89
|
+
|
|
90
|
+
Highlights: root causes in the CLI and test reporters, React 18 in CI, Next.js verified end to
|
|
91
|
+
end, one analysis implementation shared by the panel and the library, and Web Store assets
|
|
92
|
+
generated by script. Details, newest first:
|
|
93
|
+
|
|
94
|
+
- **README and docs site.** The README is half its length: a "pick a way in" table, one section
|
|
95
|
+
per entry point, and the reference tables trimmed to what you read. The docs site gains a hero
|
|
96
|
+
with the recording, a sticky table of contents and a cleaner layout; `docs/PLAN.md` holds the
|
|
97
|
+
plan for what comes next.
|
|
98
|
+
- **Store assets.** `npm run store:media` renders the five 1280x800 screenshots and the two promo
|
|
99
|
+
tiles the Chrome Web Store asks for into `extension/store/media/`; the e2e suite also checks the
|
|
100
|
+
panel stays responsive with 20,000 buffered reports (`panel.html?demo&flood=20000`).
|
|
101
|
+
- Root causes outside the panel. The commit analysis the DevTools panel had (`analyzeCommit`,
|
|
102
|
+
`rootCauseOf`, `contextAttribution`, `cascadeTree`, `rootCauseSummary`) moved into the library
|
|
103
|
+
(`src/causes.ts`, exported from `rerender-lens`) with `groupByCommit`, `rankRootCauses` and
|
|
104
|
+
`formatRootCauses` on top; the panel imports it. `formatFixes` (the CLI `fixes` command, the
|
|
105
|
+
Vitest reporter, `collector.assertNoAvoidable`, budget failures) now ends with a "Root causes"
|
|
106
|
+
section when the reports carry `commitId` (`<Page> (state) started 3 commits, 12 avoidable
|
|
107
|
+
re-renders`), and `rerender-lens causes export.json` prints that table alone.
|
|
108
|
+
- The DevTools panel and the library now share one implementation of fixes (`fixesFor`,
|
|
109
|
+
`rankFixes`), session summaries (`summarizeReports`/`summarizeSession`,
|
|
110
|
+
`compareSummaries`/`compareSessions`) and diff paths (`firstDifferentPath`, `diffLeaves`), typed
|
|
111
|
+
over a structural `ReportLike`. Library fixes gain the `snippet` and the context/provider
|
|
112
|
+
attribution the panel had; ranked fixes also carry the first 50 `reports` they apply to.
|
|
113
|
+
- **Next.js, verified.** `examples/next` starts the library from `instrumentation-client.ts` with
|
|
114
|
+
`rerender-lens/setup` and reaches the relay panel; `npm run e2e:next` drives it in Chromium
|
|
115
|
+
(CI too). Two bugs it found: `rerender-lens/setup` read `process.env[key]` dynamically, which no
|
|
116
|
+
bundler inlines, so `NEXT_PUBLIC_RERENDER_LENS_RELAY` was never seen and the entry also ran in
|
|
117
|
+
production builds; and a panel that opened after the app had connected to the relay never
|
|
118
|
+
attached (the relay now greets each panel with the current app count, and the panel sends its
|
|
119
|
+
first command only after that greeting, so no reply is lost to the connection race).
|
|
120
|
+
- **React 18 in CI.** `npm run test:react18` runs the whole unit suite against React 18 (CI job
|
|
121
|
+
`react18`). It found one bug: with React 18 the custom hook name replay listed React's own
|
|
122
|
+
`useState` wrapper as if it were a custom hook (`useState › useCounter › useCart`); frames named
|
|
123
|
+
like a React primitive are now skipped.
|
|
124
|
+
- The panel re-reads `info()` every 3 s while connected, so the overhead readout, the enabled
|
|
125
|
+
flag and the "reports skipped" banner stay current instead of reflecting the moment it attached.
|
|
126
|
+
- `npm run test:built` (in `check` and CI) loads the three built vendor scripts in order and drives
|
|
127
|
+
a React re-render through them; before, that test always skipped in CI because tests ran
|
|
128
|
+
before the build.
|
|
129
|
+
|
|
3
130
|
## 0.4.0
|
|
4
131
|
|
|
5
132
|
Highlights: the panel for any app with `npx rerender-lens panel`, Vitest and Playwright
|