Skip to content

Prepare Wouter 4: modern browser baseline and stronger types - #571

Merged
molefrog merged 1 commit into
v3from
codex/next-major-browser-baseline
Sep 5, 2026
Merged

Prepare Wouter 4: modern browser baseline and stronger types#571
molefrog merged 1 commit into
v3from
codex/next-major-browser-baseline

Conversation

@molefrog

@molefrog molefrog commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Wouter 4 raises the compatibility baseline to remove obsolete fallbacks, reduce package size, and improve TypeScript inference. This PR is based on v3.11.0 and keeps its React 18 memory-routing fixes and regression tests.

Compatibility and runtime

  • Require React 18.2+ and TypeScript 5.2+; retain Preact 10.x support.
  • Target ES2022 with native URL, History, and event APIs. Keep the README requirement concise, with browser coverage estimates and the feature audit in specs/browser-support.md.
  • Remove the React external-store shim and legacy hook/browser fallbacks. Retain the snapshot-getter workaround needed by React 18 and the lightweight Preact adapter.
  • Use Object.hasOwn() to fix optional-parameter caching when parameter names change while their values remain undefined.

TypeScript

Improve route-literal inference, optional and repeated parameters, typed memory navigation state, search setters, custom parsers, refs, and public hook declarations. Keep the type assertions in the existing package test/*.test-d.ts(x) layout and add strict consumer checks for bundler, NodeNext, and legacy Node resolution.

Validation

  • 251 runtime tests pass with 100% source line coverage, including React and Preact SSR.
  • Repository type checks, strict consumer checks, lint, and all size limits pass.
  • CI covers React 18.2.0, 18.3.1, and 19.0.0, plus TypeScript 5.2.2/workspace and React 18/19 declarations across three resolution modes.
  • Compared with v3.11.0 using Bun 1.4.0 and identical dependency versions, the dependency-inclusive React core decreases from 2,641 to 2,388 bytes gzip (9.6%); the Preact core decreases from 2,510 to 2,482 bytes (1.1%). Framework code is excluded.

Both packages are versioned 4.0.0-next.0. Migration notes and reproducible size measurements are included in the compatibility audit.

Target ES2022, require React 18.2 and TypeScript 5.2, and retain Preact 10 support. Remove obsolete compatibility code, fix optional parameter caching, and improve route and navigation declarations.

Add framework and type compatibility matrices, SSR coverage, and dependency-inclusive size measurements. Verified runtime tests, all supported React versions, strict type consumers, lint, formatting, package exports, and bundle limits.
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

size-limit report 馃摝

Path Size
packages/wouter/src/index.js 2.08 KB (-8.98% 馃斀)
packages/wouter/src/use-browser-location.js 346 B (-37.66% 馃斀)
packages/wouter/src/memory-location.js 520 B (-28.67% 馃斀)
packages/wouter/src/use-hash-location.js 486 B (-32.5% 馃斀)
packages/wouter-preact/src/index.js 2.17 KB (-0.14% 馃斀)
packages/wouter-preact/src/use-browser-location.js 462 B (-5.33% 馃斀)
packages/wouter-preact/src/use-hash-location.js 605 B (-6.21% 馃斀)
packages/wouter-preact/src/memory-location.js 634 B (-4.52% 馃斀)

@molefrog
molefrog merged commit a7505a6 into v3 Sep 5, 2026
10 checks passed
@molefrog
molefrog deleted the codex/next-major-browser-baseline branch September 5, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant