Skip to content

@solidjs/babel-plugin@2.0.0-rc.14

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 08 Oct 02:12
· 39 commits to main since this release
8d23a5a

Patch Changes

  • 59fb244: SSR hoistProps skips TypeScript type positions when collecting captures, so on authored TSX (types parsed, stripped later) a typeof x query or a type named like a value no longer captures that value, or forces the literal fallback when it is reassigned (#3828).

  • 3c1f809: Preserve /* istanbul ignore … */ and /* c8 ignore … */ block comments written as JSX children on the generated component children getter. Line comments are not carried.

  • 98b916d: Fix compiled SSR output that renders style="" or class="" for null and undefined. Babel and the native compiler now omit these attributes on elements without a spread.

  • 98d35b9: Fix computed keys in compiled SSR style objects (builds without serverComponents). A computed key's name got no ;, so style={{ color: "red", [k]: v }} rendered color:redtop:1px and the browser dropped both declarations. Hydration keeps the server's inline style, so they stayed dropped. A nullish first value also no longer leaves a leading ;. Both compilers now pass a multi-entry object to a new ssrStyleProperties(name, value, …) helper, which writes the separator only between the entries it writes; a single entry keeps ssrStyleProperty.

  • 4f67697: Breaking: only on followed by an uppercase letter (onClick, onPointerDown) is an event handler. Lowercase on* names (onclick, onmouseover) are plain attributes everywhere:

    • Both compilers compile onclick={expr} like any other attribute (setAttribute, reactive when expr is dynamic) instead of binding a delegated or native event, and SSR renders it as an escaped attribute instead of dropping it. A leftover 1.x on:click={fn} is likewise a plain namespaced attribute (it previously compiled to addEventListener(":click", fn)).
    • @solidjs/web spread/assign set lowercase on* keys as attributes, the server spread walk renders them, and useHead applies lowercase on* attributes (camelCase handler names stay skipped). ssrAttribute escapes a function value instead of interpolating its source raw.
    • @solidjs/html and @solidjs/h elements wrap a function passed to a lowercase on* in a getter like any other attribute; only onXxx and ref are exempt.
    • @solidjs/html components follow @solidjs/h's rule: every zero-argument function prop, onXxx handlers and ref included, is a getter, so a component handler must declare its event argument (onClick=${e => …}).
    • New dev-only check LOWERCASE_EVENT_ATTRIBUTE (added to the DiagnosticCode union): warns once per attribute name when a function is set on a lowercase on* (or on:) attribute, naming the camelCase handler to use.
  • 7513131: Preserve the source location of captured references in SSR props constructors so source maps point to the authored expression, including dynamic TSRX tags.