Change8

@solidjs/compiler@2.0.0-rc.4

📦 solid-jsView on GitHub →
8 features🐛 18 fixes🔧 11 symbols

Summary

This release enhances Hot Module Replacement (HMR) by correctly registering component bindings and improves "use server" export handling for better server-side composition. It also refines native compiler options and patch-channel contract for increased stability.

Migration Steps

  1. If using the `@refresh component` pragma, ensure it is applied to call-shaped top-level bindings that are components.
  2. If encountering issues with "use server" exports, ensure they are functions; non-function exports will now cause boot errors.
  3. If using `patchDriver`, ensure it is explicitly enabled via `@solidjs/vite-plugin` or equivalent configuration to reach the native core.

✨ New Features

  • Component bindings produced by factory calls (styled(...), HOCs, tagged templates) are now registered during the refresh (HMR) pass, preventing stale exports.
  • The `@refresh component` pragma can be used to assert that a call-shaped top-level binding is a component.
  • Module-level "use server" exports now register by value, ensuring server-side wrappers compose onto every call path and patterns like `withDelay(fn, 400)` work for server mocks.
  • Anonymous default expressions in "use server" modules are now synthesized and registered.
  • Bare function children in hydratable mode are now scope-wrapped, ensuring owner IDs sync across server and client.
  • The native compiler unwraps TS casts in the allocate-ids predicate to match Babel's scope emission.
  • The native compiler's JS loader now accepts the `patchDriver` option and normalizes its boolean opt-in.
  • The compiler now prefers a local development build (`compiler.node`) over the installed `@solidjs/compiler-*` platform package when loading the native binding.

🐛 Bug Fixes

  • Fixed an issue where component exports could become permanently stale due to HMR.
  • Ensured that edits to modules with registered components do not cause unnecessary remounts of consumers.
  • Fixed an issue where the native compiler's JS loader would reject the `patchDriver` option.
  • Corrected the behavior where a local build of the compiler could be silently ignored in favor of a published release.
  • Prevented stray non-function exports in "use server" modules from causing dead references by throwing loud boot errors.
  • Fixed an issue where anonymous default expressions in "use server" modules were silently dropped.
  • Resolved memory leaks in patch-channel contract by ensuring ordinary `patchDriver` registrations unbind with their owner.
  • Ensured merged transitions correctly move their held-patch stash.
  • Improved optimistic drain error isolation and boundary routing.
  • Excluded accessor-bearing records at admission to prevent issues.
  • Demoted patches to tracked effect fallbacks when records acquire accessors.
  • Ensured writable projection arrays emit setter row ops at their fold-commit visibility moment.
  • Resolved chained backings to the ultimate owner in row-ops/slot registrations.
  • Fixed duplicate key matching to be occurrence-aware instead of first-wins.
  • Corrected a typo in the production dev-token (`_DX_DEV_`).
  • Ensured `patchDriver: true` normalizes identically in Babel and the native loader.
  • Fixed a scope-emission desync for `{call() as any}` children in the native compiler.
  • Addressed hydration ID parity issues by treating syntactic function expressions as scope-eligible.

Affected Symbols