Skip to content

refactor!: rename to @tanstack/redact and consolidate into single package#2

Merged
tannerlinsley merged 2 commits intomainfrom
taren/unruffled-satoshi-81426b
Apr 28, 2026
Merged

refactor!: rename to @tanstack/redact and consolidate into single package#2
tannerlinsley merged 2 commits intomainfrom
taren/unruffled-satoshi-81426b

Conversation

@tannerlinsley
Copy link
Copy Markdown
Member

Summary

  • 6 packages → 1: @tanstack/{react,react-dom,react-dom-server,dom-core,scheduler,dom-vite} collapse into @tanstack/redact with subpath exports (./jsx-runtime, ./dom, ./dom-client, ./dom-test-utils, ./server, ./scheduler, ./vite, ./features/*, ./_all).
  • Public API renames: Vite plugin tanstackDom()redact(), types TanStackDom*Redact*.
  • Released as @tanstack/redact@0.0.1 on npm (fresh package, fresh version — old @tanstack/{react,…}@0.1.0-alpha.* packages are deprecated).
  • ReactSharedInternals is now a globalThis-stashed singleton via Symbol.for, so duplicate package copies (Cloudflare worker noExternal: true inlined + deps_ssr pre-bundled, pnpm strict + tarball install, etc.) share state. SSR dispatcher installed by one copy is visible to hooks called through the other.
  • useSyncExternalStoreWithSelector properly exported from the main entry — was added to hooks.ts previously but missed in index.ts's re-export, breaking link-time consumers via the use-sync-external-store/shim alias (e.g. @tanstack/react-store).
  • Vite plugin's ALIASES map reordered so most-specific subpath aliases (react-dom/server, react-dom/client, …) match before less-specific prefixes (react-dom). The new layout doesn't preserve the prefix-coincidence the previous order relied on.
  • tests/public-exports.test.ts: inline-snapshots every public subpath's named-export set, guarding against silent link-time export drift.

Test plan

  • pnpm test707/707 unit + integration tests pass
  • node scripts/build.mjs — clean build, 233 files in dist
  • node scripts/size.mjs — full preset 9.07 KB gz, nano 6.75 KB gz (no regression)
  • npm publish --dry-run — package metadata clean
  • Cloudflare dev mode end-to-end on tannerlinsley.com: SSR renders 25 KB HTML, client hydrates ($_TSR cleaned up after hydrate fires), SPA navigation works without full reload, browser console clean
  • Published to npm as @tanstack/redact@0.0.1 under latest tag

Breaking changes

This is a name-and-layout change — the entire previous API moved to a new package and new shape. The old @tanstack/{react,react-dom,…} packages will be deprecated separately with a npm deprecate redirect.

…ngle package

The previous 6-package layout (@tanstack/{react,react-dom,react-dom-server,
dom-core,scheduler,dom-vite}) was performing a contract we don't have —
React only splits react/react-dom because the renderer is theoretically
swappable. We have one renderer. The split was buying us nothing concrete
and costing real debugging hours (workspace:* version mismatches on
pnpm pack, ReactSharedInternals duplication when one copy was inlined via
Cloudflare's noExternal and another pre-bundled into deps_ssr).

Now ships as a single @tanstack/redact (0.1.0-alpha.10) with subpath
exports:
  /                   react entry
  /jsx-runtime
  /dom                createPortal, flushSync, resource hint stubs
  /dom-client         createRoot, hydrateRoot
  /dom-test-utils
  /server             renderToString, renderToReadableStream, …
  /scheduler
  /vite               redact() plugin (was tanstackDom)
  /features/*         per-feature index/full/stub modules for bundler
                      aliasing without the Vite plugin
  /_all               registration primitives (registerRenderer,
                      registerTypeMatcher, installCapability, …) +
                      core types for custom-feature authors

Public API renames:
  tanstackDom()      -> redact()
  TanStackDom*       -> Redact*

Cross-cutting fixes captured in this commit:
  - ReactSharedInternals stashed on globalThis under a registered
    Symbol so duplicate package copies (Cloudflare worker noExternal +
    deps_ssr pre-bundle, pnpm strict + tarball install, etc.) share
    a single backing object. SSR dispatcher installed by one copy is
    visible to hooks called through the other.
  - Add useSyncExternalStoreWithSelector to the main entry's named
    exports — was added to hooks.ts in a prior change but missed in
    the index.ts re-export, breaking link-time consumers via the
    use-sync-external-store/shim alias (e.g. @tanstack/react-store).
  - Vite plugin's ALIASES map reordered so most-specific subpath
    aliases (react-dom/server, react-dom/client, …) match before less-
    specific prefixes (react-dom). The new layout doesn't preserve the
    old prefix-coincidence the previous order relied on.
  - tests/public-exports.test.ts: inline-snapshots every public
    subpath's named-export set, guarding against silent link-time
    drift from missing re-exports.

All 707 tests pass. Sizes: full preset 9.07 KB gz, nano 6.75 KB gz.
The previous 0.1.0-alpha.* numbering was inherited from the now-deprecated
multi-package layout (@tanstack/{react,react-dom,react-dom-server,
dom-core,scheduler,dom-vite}). @tanstack/redact has zero published
versions on npm — start the package's history fresh at 0.0.1 and drop
the 'next' dist-tag (no need to gate against a stale 'latest' on a
brand-new package).
@tannerlinsley tannerlinsley merged commit a230cf8 into main Apr 28, 2026
@tannerlinsley tannerlinsley deleted the taren/unruffled-satoshi-81426b branch April 28, 2026 05:46
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