@ipxjs/refract 0.10.1 → 0.10.2

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/README.md CHANGED
@@ -158,9 +158,10 @@ subsequent renders to the same container.
158
158
 
159
159
  ### DevTools hook integration
160
160
 
161
- Refract emits commit and unmount events when a hook is present at
161
+ Call `setDevtoolsHook(...)` to enable commit and unmount events. Refract uses
162
+ the explicit hook you provide, or falls back to
162
163
  `window.__REFRACT_DEVTOOLS_GLOBAL_HOOK__` (or `globalThis` in non-browser
163
- environments). You can also set the hook directly with `setDevtoolsHook`.
164
+ environments) when called with no argument.
164
165
 
165
166
  ```ts
166
167
  import { setDevtoolsHook } from "refract";
@@ -229,7 +230,7 @@ The values below are from a local run on February 17, 2026.
229
230
  | Refract (`core+context`) | 10.66 kB | 4.00 kB |
230
231
  | Refract (`core+memo`) | 10.70 kB | 3.97 kB |
231
232
  | Refract (`core+security`) | 10.93 kB | 4.03 kB |
232
- | Refract (`refract`) | 17.15 kB | 6.23 kB |
233
+ | Refract (`refract`) | 14.45 kB | 5.28 kB |
233
234
  | React | 189.74 kB | 59.52 kB |
234
235
  | Preact | 14.46 kB | 5.95 kB |
235
236
 
@@ -239,7 +240,7 @@ The CI preset (`make bench-ci`, 40 measured + 5 warmup runs) enforces default
239
240
  guardrails (`DCL p95 <= 16ms`, `DCL sd <= 2ms`).
240
241
 
241
242
  From this snapshot, Refract `core` gzip JS is about 15.9x smaller than React,
242
- and the full `refract` entrypoint is about 9.6x smaller.
243
+ and the full `refract` entrypoint is about 11.3x smaller.
243
244
 
244
245
  ### Component Combination Benchmarks (Vitest)
245
246
 
@@ -344,7 +345,7 @@ How Refract compares to React and Preact:
344
345
  | **Ecosystem** | | | |
345
346
  | DevTools | Basic (hook API) | Yes | Yes |
346
347
  | React compatibility layer | Partial⁶ | N/A | Yes⁷ |
347
- | **Bundle Size (gzip, JS)** | ~3.7-6.3 kB⁴ | ~59.5 kB | ~6.0 kB |
348
+ | **Bundle Size (gzip, JS)** | ~3.7-5.3 kB⁴ | ~59.5 kB | ~6.0 kB |
348
349
 
349
350
  ¹ Preact supports both `class` and `className`.
350
351
  ² Preact has partial Suspense support via `preact/compat`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipxjs/refract",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "A minimal React-like virtual DOM library with an optional React compat layer",
5
5
  "type": "module",
6
6
  "main": "src/refract/index.ts",
@@ -32,6 +32,7 @@ export interface RefractDevtoolsHook {
32
32
  let explicitHook: RefractDevtoolsHook | null | undefined = undefined;
33
33
  let activeHook: RefractDevtoolsHook | null = null;
34
34
  let activeRendererId = 1;
35
+ let commitReporterRegistered = false;
35
36
 
36
37
  const containerIds = new WeakMap<Node, number>();
37
38
  let nextContainerId = 1;
@@ -40,6 +41,7 @@ const fiberIds = new WeakMap<Fiber, number>();
40
41
  let nextFiberId = 1;
41
42
 
42
43
  export function setDevtoolsHook(hook?: RefractDevtoolsHook | null): void {
44
+ ensureDevtoolsCommitReporting();
43
45
  explicitHook = hook;
44
46
  activeHook = null;
45
47
  activeRendererId = 1;
@@ -68,7 +70,11 @@ export function reportDevtoolsCommit(rootFiber: Fiber, deletions: Fiber[]): void
68
70
  }
69
71
  }
70
72
 
71
- registerCommitHandler(reportDevtoolsCommit);
73
+ function ensureDevtoolsCommitReporting(): void {
74
+ if (commitReporterRegistered) return;
75
+ commitReporterRegistered = true;
76
+ registerCommitHandler(reportDevtoolsCommit);
77
+ }
72
78
 
73
79
  function resolveHook(): RefractDevtoolsHook | null {
74
80
  if (explicitHook !== undefined) return explicitHook;