Skip to content

v2.0.0

Choose a tag to compare

@NathanWalker NathanWalker released this 17 Nov 20:34
059b39b

Solid 2.0 support for NativeScript. Requires solid-js 2.x; stay on 0.1.x for Solid 1.8–1.9.

Breaking changes

  • Peer dependencies are now solid-js@^2.0.0, @solidjs/universal@^2.0.0, and @solidjs/babel-plugin@^2.0.0. babel-preset-solid is no longer used.
    npm install @nativescript-community/solid-js@^2 solid-js@^2 @solidjs/universal@^2
    npm install -D @solidjs/babel-plugin@^2
    npm uninstall babel-preset-solid solid-refresh
  • The renderer is built on @solidjs/universal; solid-js/universal no longer exists in Solid 2.
  • use is no longer exported. Solid 2 removed use: directives; pass a ref instead, e.g. ref={myDirective(options)}. Refs can be arrays.
  • spread() drops its isSVG argument, and effect() takes Solid 2's two-phase (compute, apply) form. Both only matter if you call the renderer directly.
  • The webpack config no longer registers solid-refresh. It has no Solid 2 release; NativeScript's own HMR still replaces modules.

Features

  • Re-exports Solid 2 control flow: For, Repeat, Show, Switch, Match, Loading, Reveal, Errored.
  • New ref and applyRef exports for Solid 2's compiled refs.
  • createElement applies the static props the compiler hoists.
  • Each compiled insertion point gets its own anchor, so sibling blocks keep source order when one of them renders empty.

Build

  • nativescript.webpack.js compiles with @solidjs/babel-plugin (generate: 'universal', hydratable: false).
  • solid-js, @solidjs/signals, and @solidjs/universal are pinned to their browser bundles. Solid 2 resolves the node condition to its SSR build, which renders once and never updates.
  • The @NativeClass transform loads typescript only when it runs, so JavaScript-only apps build without it.

Migrating an app

See the README's Upgrading from Solid 1.x section. In short: Suspense → Loading, ErrorBoundary → Errored, SuspenseList → Reveal, <Index> → <For keyed={false}>, onMount → onSettled, and solid-js/store is merged into solid-js. Event handlers keep the on: / oncapture: prefixes.

Full changelog: v0.1.2...v2.0.0 (#16)