why-hydration 0.1.3 → 0.1.5

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 CHANGED
@@ -1,5 +1,85 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 7b16e20: Fix the inspector lifecycle, bound detection cost, and close detection gaps.
8
+
9
+ **Lifecycle**
10
+
11
+ - `createHydrationInspector()` is no longer dead after a React Strict Mode
12
+ remount. Its `<Provider>` only ever stopped the controller, so Strict Mode's
13
+ setup → cleanup → setup left the documented Vite/CRA/Remix integration
14
+ silently doing nothing for the rest of the session.
15
+ - The dev check no longer requires a `process` global. Vite, Rollup and esbuild
16
+ substitute `process.env.NODE_ENV` without defining `process` itself, which
17
+ compiled the old `typeof process !== 'undefined'` guard down to `false` and
18
+ disabled the inspector entirely in those bundlers.
19
+ - Scheduling races an animation frame against a timer, so a page that is hidden
20
+ at load — where the browser suspends `requestAnimationFrame` outright — is
21
+ still inspected.
22
+ - The console capture hands `console.error` back correctly when the same
23
+ listener subscribes twice, and its message cap now drops past-cap messages
24
+ instead of recording-but-forwarding them (which broke dedup exactly when the
25
+ cap was meant to engage).
26
+
27
+ **Cost**
28
+
29
+ - A burst of React warnings arriving in one frame triggers one diff pass rather
30
+ than one per warning.
31
+ - Captured server markup is parsed once per root and reused across the settling
32
+ window instead of being re-parsed on every pass.
33
+ - Retained warning text is bounded, so an app erroring in a render loop cannot
34
+ grow the per-pass cost without limit.
35
+
36
+ **Detection**
37
+
38
+ - `date-time` no longer fires on ordinary values. `Date.parse` accepts almost
39
+ anything — `100` is the year 100, `server-0` is the year 2000 — so prices,
40
+ counts and ids were being diagnosed as a clock or timezone drift. A value must
41
+ now look like a date by shape.
42
+ - Arabic formatting mismatches are detected when both sides use the same digit
43
+ script: grouping/decimal separators, field order and times in Arabic-Indic and
44
+ Persian digits previously fell through to `unknown`.
45
+ - Values differing only by invisible bidirectional control marks (LRM/RLM/ALM,
46
+ isolates) are detected and named. Different ICU versions emit different marks
47
+ for the same `Intl` call, so Node and the browser routinely produce strings
48
+ that look identical and are not.
49
+ - Report values are no longer truncated mid surrogate pair.
50
+
51
+ **Overlay**
52
+
53
+ - A panel re-mounted after being dismissed no longer reports a stale count or
54
+ promise scrolling it cannot do.
55
+
56
+ Note for anyone consuming `report.cause.category` in an `onReport` sink: the
57
+ `date-time` and `locale-format` fixes change which category some mismatches
58
+ resolve to.
59
+
60
+ ## 0.1.4
61
+
62
+ - **License: restored MIT.** Re-added `LICENSE` (MIT) and set
63
+ `"license": "MIT"` in `package.json`; the file is included in the published
64
+ npm tarball.
65
+ - **RTL support for the overlay.** Fixed a real bug: the CSS `all` shorthand
66
+ used to reset the overlay's Shadow DOM styles deliberately excludes
67
+ `direction`/`unicode-bidi` (per the CSS spec), so a host page with
68
+ `<html dir="rtl">` leaked `direction: rtl` into the overlay, flipping its
69
+ flex/grid layout and text alignment (verified against a real browser). The
70
+ overlay now explicitly forces `direction: ltr` on its shadow host and panel,
71
+ so it always renders left-to-right — matching its English content —
72
+ regardless of the host page's directionality. No configuration needed.
73
+ - **README rewritten** for technical accuracy and completeness: corrected the
74
+ cause-category priority order (`third-party-dom-mutation` runs before
75
+ `browser-only-api`/`viewport-branching`, not after), corrected the stale
76
+ "diffs once, first divergence" description of the detection pipeline to
77
+ match the current collect-all/settling-window/LCS-alignment behavior,
78
+ documented the full `createHydrationInspector`/`OverlayOptions`/
79
+ `HydrationSnapshotScript` API surface (including the previously-undocumented
80
+ `roots` option), added a "What is a hydration mismatch" primer, an RTL
81
+ section, and a table of contents.
82
+
3
83
  ## 0.1.3
4
84
 
5
85
  Stability + accuracy overhaul from running on a large production Next.js app.
@@ -70,7 +150,7 @@ Router, React 18 & 19). **0.1.0 is broken in Next.js — use 0.1.1 or later.**
70
150
  the browser-normalized live DOM (`#hex` → `rgb()`, spacing) no longer produce
71
151
  a false `unknown` mismatch.
72
152
  - **`typesVersions`** added so subpath types resolve under `moduleResolution:
73
- "node"` (fixes `next build` type errors in apps using classic resolution).
153
+ "node"` (fixes `next build` type errors in apps using classic resolution).
74
154
 
75
155
  Verified live: locale-format, non-deterministic-value, date-time, and
76
156
  browser-only-api classify correctly in App Router and Pages Router; the tool is
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Razan Aboushi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.