@solidjs/babel-plugin 2.0.0-rc.4 → 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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +33 -0
- package/README.md +38 -7
- package/index.js +3534 -25
- package/package.json +10 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -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
|
-
[32mcreated [1mindex.js[22m in [
|
|
10
|
+
[32mcreated [1mindex.js[22m in [1m3.3s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
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
|
+
|
|
15
|
+
## 2.0.0-rc.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 320f1f5: Universal text is text (#3127). The DOM and SSR generators splice static
|
|
20
|
+
text into an HTML template that a parser later unescapes, so they escape
|
|
21
|
+
static values and keep JSX entities as written. The universal generator
|
|
22
|
+
hands strings straight to the host — `createTextNode`, `setProp` — with no
|
|
23
|
+
parser downstream, so the escaping rendered literally (`{"<b>"}` showed as
|
|
24
|
+
`<b>`) and entities never decoded (`<` showed as `<`), leaving no
|
|
25
|
+
spelling that produced a literal `<` in static text under a custom
|
|
26
|
+
renderer. Universal-rendered element children now pass static values
|
|
27
|
+
through unescaped and decode JSX entities in text and string attributes,
|
|
28
|
+
matching what component children and fragment text always did. The flag
|
|
29
|
+
rides on the element, not the config, so `generate: "dynamic"` decides per
|
|
30
|
+
renderer. Applied to both compilers; the attribute half closed ten pinned
|
|
31
|
+
cross-mode parity divergences between them. Reported with the fix mapped
|
|
32
|
+
out by @antoinevanwel.
|
|
33
|
+
- 5230666: Fix hydration ids drifting after a reactive lone spread (#3105). A lone spread now passes its accessor straight to `spread()` on the client — no `mergeProps`, no memo, no hydration id — matching the server's existing pass-through fast path. The runtime resolves a function props source inside its own tracking scopes.
|
|
34
|
+
- e27dc29: `validate` now fails the compile instead of warning when a template's markup would be restructured by the browser's HTML parser (#3099). Once the validator fires the emitted positional walk is guaranteed not to match the browser-built DOM (crashed or silently misplaced bindings; desynced hydration under SSR), so warn-and-emit shipped certain breakage with the diagnostic buried in server logs. Errors now point at the offending JSX (code frame in Babel, line:col in the native compiler). `validate: false` remains the opt-out.
|
|
35
|
+
|
|
3
36
|
## 2.0.0-rc.4
|
|
4
37
|
|
|
5
38
|
### 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
|