@solidjs/compiler 2.0.0-rc.7 → 2.0.0-rc.9
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/README.md +10 -3
- package/index.js +1 -0
- package/package.json +7 -7
- package/types.d.ts +14 -1
package/README.md
CHANGED
|
@@ -95,11 +95,11 @@ Scoped `<style>` blocks are compile-time only. The compiler removes the style el
|
|
|
95
95
|
|
|
96
96
|
Solid rejects authored TSRX lazy destructuring (`&{ … }` / `&[ … ]`). Keep accessor calls and reactive property reads explicit in Solid source.
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
Control-flow bindings pass through exactly as authored. `@for … index` and `@for … key` hand the callback the item as an accessor (and the index as an accessor under a custom key), and `@catch (err, reset)` receives Solid's `ErrorAccessor` — write `item()`, `i()`, `err()` as you would in JSX. Destructuring a binding in one of those positions is rejected with a diagnostic, since there is nothing to destructure; the default keyed `@for` item is a raw value and destructures as usual.
|
|
99
99
|
|
|
100
100
|
The frontend uses the community [oxc-tsrx](https://github.com/tsrx-org/oxc) parser at a pinned revision. Statement containers can be used as function bodies, statements, expressions (`const x = @{ … }`), and JSX children or expression containers. See `documentation/tsrx/frontend-notes.md` in the repository for the full frontend notes.
|
|
101
101
|
|
|
102
|
-
`projectTsrxForTypecheck(source, { filename })` is an experimental compiler-owned projection for editor and typecheck integrations. It returns independently typecheckable
|
|
102
|
+
`projectTsrxForTypecheck(source, { filename })` is an experimental compiler-owned projection for editor and typecheck integrations. It returns independently typecheckable TSX without running the DOM/SSR/universal transforms, injecting collision-safe imports for generated Solid control-flow and dynamic-element helpers. The tooling-only path recovers common incomplete editor snapshots while normal compilation remains strict. The result also includes an authored `.tsrx` source map, exact equal-text `mappings`, processed `css`/`cssHash`, and parser-authored embedded CSS/raw-script regions. Mapping and embedded offsets use JavaScript UTF-16 string coordinates. The ranges deliberately omit generated-only text; host adapters such as Volar attach feature capabilities to them.
|
|
103
103
|
|
|
104
104
|
### Source maps
|
|
105
105
|
|
|
@@ -113,6 +113,7 @@ Pass `sourceMap: true` to receive a JSON source map string in `result.map`. For
|
|
|
113
113
|
- `generate`: `"dom"`, `"ssr"`, `"universal"`, or `"dynamic"` (default `"dom"`)
|
|
114
114
|
- `hydratable`
|
|
115
115
|
- `dev`
|
|
116
|
+
- `componentNames`: emit the source tag name as `createComponent`'s third argument (`createComponent(Home, props, "Home")`) so dev/observe runtimes label owners after minification; the production runtimes ignore it. DOM and SSR output (SSR keeps the `createComponent` call it otherwise inlines to `Comp(props)`); not universal or dynamic
|
|
116
117
|
- `sourceMap`
|
|
117
118
|
- `contextToCustomElements` (default `true`)
|
|
118
119
|
- `delegateEvents`
|
|
@@ -150,7 +151,13 @@ result.code;
|
|
|
150
151
|
result.functions; // [{ id, name, exports }] for manifest building
|
|
151
152
|
```
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
A function-level `"use server"` function is extracted out of its lexical position, so it may only reference its own parameters and locals, module top-level bindings, and globals. Capturing anything else is a compile error. That includes `this` and `arguments` in a marked arrow, which an arrow takes from the function it was written in. Use a `function` if the server function needs its own `this` or `arguments`.
|
|
155
|
+
|
|
156
|
+
A function-level directive only works where the pass can extract the function: a function declaration (at any nesting depth), a function expression, or an arrow with a block body. Methods, getters, and setters are never extracted, so a directive on one is a compile error rather than a directive that silently does nothing. Assign a function to a property instead.
|
|
157
|
+
|
|
158
|
+
A module-level `"use server"` module can only export server functions. Its client build is rebuilt from those exports alone, so anything else would be missing from the browser bundle. Re-exports, `export *`, class and enum exports, destructured exports, and exports declared without an initializer are compile errors naming the export and its position. Type-only and `declare` exports are erased and are fine.
|
|
159
|
+
|
|
160
|
+
The runtime module defaults to `@solidjs/web/server-functions`. Function IDs are `<name>-<xxhash32(root-relative path)>`, the same in every env. The name is the function's dotted binding path, such as `handlers.save`, built from every named container on the way down (variable bindings, property keys, class names, class members, and named functions), so an id identifies a function by where it is bound rather than by its position in the file. Adding, removing, or reordering functions does not move the ids of the others. There are also experimental `transformLazy` and `transformRefresh` passes.
|
|
154
161
|
|
|
155
162
|
## Rust compiler core
|
|
156
163
|
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/compiler",
|
|
3
3
|
"description": "Solid's native Oxc JSX compiler",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.9",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"emnapi": "^1.11.3"
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
65
|
-
"@solidjs/compiler-darwin-x64": "2.0.0-rc.
|
|
66
|
-
"@solidjs/compiler-darwin-arm64": "2.0.0-rc.
|
|
67
|
-
"@solidjs/compiler-linux-x64-gnu": "2.0.0-rc.
|
|
68
|
-
"@solidjs/compiler-linux-arm64-gnu": "2.0.0-rc.
|
|
69
|
-
"@solidjs/compiler-win32-x64-msvc": "2.0.0-rc.
|
|
70
|
-
"@solidjs/compiler-wasm32-wasi": "2.0.0-rc.
|
|
65
|
+
"@solidjs/compiler-darwin-x64": "2.0.0-rc.9",
|
|
66
|
+
"@solidjs/compiler-darwin-arm64": "2.0.0-rc.9",
|
|
67
|
+
"@solidjs/compiler-linux-x64-gnu": "2.0.0-rc.9",
|
|
68
|
+
"@solidjs/compiler-linux-arm64-gnu": "2.0.0-rc.9",
|
|
69
|
+
"@solidjs/compiler-win32-x64-msvc": "2.0.0-rc.9",
|
|
70
|
+
"@solidjs/compiler-wasm32-wasi": "2.0.0-rc.9"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/types.d.ts
CHANGED
|
@@ -12,6 +12,15 @@ export interface TransformOptions {
|
|
|
12
12
|
generate?: "dom" | "ssr" | "universal" | "dynamic";
|
|
13
13
|
hydratable?: boolean;
|
|
14
14
|
dev?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Emit the source tag name as a third `createComponent` argument
|
|
17
|
+
* (`createComponent(Home, props, "Home")`) so dev/observe runtimes can
|
|
18
|
+
* label owners after minification renames the function. DOM and SSR
|
|
19
|
+
* output (SSR keeps the `createComponent` call it would otherwise inline
|
|
20
|
+
* to `Comp(props)`); not universal or dynamic. The production runtimes
|
|
21
|
+
* ignore the argument.
|
|
22
|
+
*/
|
|
23
|
+
componentNames?: boolean;
|
|
15
24
|
sourceMap?: boolean;
|
|
16
25
|
contextToCustomElements?: boolean;
|
|
17
26
|
delegateEvents?: boolean;
|
|
@@ -131,8 +140,12 @@ export interface TransformDirectivesOptions {
|
|
|
131
140
|
|
|
132
141
|
/** One extracted server function, for building a bundler manifest. */
|
|
133
142
|
export interface ServerFunctionMeta {
|
|
134
|
-
/** The wire ID (`<hash
|
|
143
|
+
/** The wire ID (`<name>-<hash>[-<ordinal>]`). */
|
|
135
144
|
id: string;
|
|
145
|
+
/**
|
|
146
|
+
* The dotted binding path that names the function, such as
|
|
147
|
+
* `handlers.save`. `anonymous` when no enclosing binding applies.
|
|
148
|
+
*/
|
|
136
149
|
name: string;
|
|
137
150
|
/** Export names bound to this function (module-level directives only). */
|
|
138
151
|
exports: string[];
|