@solidjs/babel-plugin 2.0.0-rc.5 → 2.0.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@ src/shared/transform.ts -> src/ssr/element.ts -> src/shared/transform.ts
7
7
  src/shared/transform.ts -> src/universal/element.ts -> src/shared/transform.ts
8
8
  src/shared/transform.ts -> src/shared/component.ts -> src/shared/transform.ts
9
9
  src/shared/transform.ts -> src/shared/fragment.ts -> src/shared/transform.ts
10
- created index.js in 2.6s
10
+ created index.js in 3.3s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @solidjs/babel-plugin
2
2
 
3
+ ## 2.0.0-rc.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e7fa73: Reject authored TSRX lazy destructuring in Solid while retaining deferred patterns generated for keyed loops and catch clauses.
8
+ - bbff5e0: Direct `value`/`checked` (and other stateful DOM property) bindings no longer overwrite pre-hydration user input during the hydration claim pass (#3182). Hydratable compiled output now routes locked DOM properties through `setProperty`, which skips writes on hydrating nodes and carries the `<select value>` microtask and input/textarea nullish special cases.
9
+ - cdbd584: Assign static `<select value>` values through the live DOM property so the matching option is selected consistently with reactive values.
10
+ - 5a1abb3: Compile TSRX loops with an index but no explicit key using Solid's non-keyed callback shape.
11
+ - 82868c6: Support recursive lazy destructuring, lazy arrow parameters, per-read defaults, computed keys, rest views, standalone assignments, accessor-backed keyed-loop and catch patterns, and JavaScript-correct writes and updates across the Babel and native TSRX frontends.
12
+ - 774aad5: Add compile-time scoped styles, CSS sidecar output, style class maps, and style refs to both TSRX frontends.
13
+ - c9c16cb: Add an experimental TSRX syntax frontend to both compilers. `.tsrx` sources (routed by filename with the new `syntax: "auto" | "jsx" | "tsrx"` option) desugar `@if`/`@else`, `@for … @empty`, `@switch`/`@case`, `@try`/`@catch`/`@pending`, `@{}` statement containers, and lazy destructuring (`&{}`/`&[]`) into the shared Solid JSX lowering, producing byte-identical output from both compilers. The Babel plugin loads the optional `@tsrx/core` peer dependency lazily; the native compiler ships the frontend behind the default-on `tsrx` cargo feature (statement containers in expression position are rejected with a structured diagnostic pending upstream oxc-tsrx support).
14
+
3
15
  ## 2.0.0-rc.5
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -86,7 +86,7 @@ Omitted options are the Solid 2.0 defaults that used to live in `babel-preset-so
86
86
  hydratable: true
87
87
  }
88
88
  ]
89
- ]
89
+ ];
90
90
  }
91
91
  ```
92
92
 
@@ -99,6 +99,13 @@ Omitted options are the Solid 2.0 defaults that used to live in `babel-preset-so
99
99
 
100
100
  Runtime module the compiled output imports helpers from. Use the same module for SSR; switch `generate` instead.
101
101
 
102
+ ### syntax
103
+
104
+ - Type: `'auto' | 'jsx' | 'tsrx'`
105
+ - Default: `'auto'`
106
+
107
+ Source syntax frontend. `"auto"` routes `.tsrx` files through the TSRX frontend and everything else through standard JSX; `"tsrx"` forces TSRX for every file; `"jsx"` disables TSRX routing entirely. See [TSRX](#tsrx-experimental).
108
+
102
109
  ### generate
103
110
 
104
111
  - Type: `'dom' | 'ssr' | 'universal' | 'dynamic'`
@@ -206,12 +213,7 @@ Restrict JSX transformation to files whose `@jsxImportSource` pragma matches.
206
213
 
207
214
  ```js
208
215
  {
209
- plugins: [
210
- [
211
- "@solidjs/babel-plugin",
212
- { requireImportSource: "@solidjs/web" }
213
- ]
214
- ]
216
+ plugins: [["@solidjs/babel-plugin", { requireImportSource: "@solidjs/web" }]];
215
217
  }
216
218
  ```
217
219
 
@@ -234,6 +236,35 @@ Inline style attributes in templates when the value is a string or `Record<strin
234
236
 
235
237
  SSR-only: emit behavior-claim (`_bnd`) markers for `ref` / `on*` on intrinsic elements.
236
238
 
239
+ ## TSRX (experimental)
240
+
241
+ TSRX (TypeScript Render Extensions) is a syntax for declarative UI. `.tsrx` sources desugar to the same Solid JSX this plugin already compiles: `@if`/`@else`, `@for … @empty`, `@switch`/`@case`, and `@try`/`@catch`/`@pending` lower to the corresponding control-flow components (`Show`, `For`, `Switch`/`Match`, `Errored`, `Loading`), and `@{}` statement containers mix setup statements with rendered elements.
242
+
243
+ ```tsrx
244
+ export function TodoList({ items }) @{
245
+ <ul>
246
+ <style>
247
+ li { padding-block: 0.25rem; }
248
+ </style>
249
+ @for (const item of items; index i; key item.id) {
250
+ <li>{i + 1}. {item.text}</li>
251
+ } @empty {
252
+ <li>No todos</li>
253
+ }
254
+ </ul>
255
+ }
256
+ ```
257
+
258
+ Requirements and behavior:
259
+
260
+ - Compiling `.tsrx` sources requires the optional peer dependency `@tsrx/core` and Node.js >= 22.12. It loads lazily on first TSRX routing, so plain JSX users never pay for it.
261
+ - Routing is filename-based by default (`syntax: "auto"`), so Babel must receive a `filename`.
262
+ - Desugared constructs rely on the `builtIns` auto-imports, so those components must exist in `moduleName`.
263
+ - Scoped `<style>` blocks are removed at compile time, matching native and dynamic elements receive a `tsrx-<hash>` class, and the scoped/pruned stylesheet is returned as `result.metadata.css` with `result.metadata.cssHash`. Style expressions produce class-map objects, `<style ref={styles}>` initializes a class map, and `:global(...)` opts selectors out of scoping. The plugin emits no runtime style helper; a bundler integration must emit the CSS metadata.
264
+ - Solid rejects authored TSRX lazy destructuring (`&{ … }` / `&[ … ]`). Keep accessor calls and reactive property reads explicit in Solid source.
265
+ - Destructured bindings in keyed `@for` loops and `@catch` clauses stay deferred against Solid's item and error accessors, including nested patterns, defaults, computed keys, and rest.
266
+ - The native compiler ([`@solidjs/compiler`](../compiler)) compiles the same sources to byte-identical output.
267
+
237
268
  ## Special Binding
238
269
 
239
270
  ### ref