@solidjs/compiler 2.0.0-rc.6 → 2.0.0-rc.8
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 +8 -1
- package/index.js +2 -17
- package/package.json +7 -7
- package/types.d.ts +12 -10
package/README.md
CHANGED
|
@@ -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`: DOM output only — emit the source tag name as `createComponent`'s third argument (`createComponent(Home, props, "Home")`) so dev/observe runtimes label owners after minification; the production runtime ignores it
|
|
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
|
@@ -261,6 +261,7 @@ const nativeOptionKeys = new Set([
|
|
|
261
261
|
"generate",
|
|
262
262
|
"hydratable",
|
|
263
263
|
"dev",
|
|
264
|
+
"componentNames",
|
|
264
265
|
"sourceMap",
|
|
265
266
|
"contextToCustomElements",
|
|
266
267
|
"delegateEvents",
|
|
@@ -278,10 +279,7 @@ const nativeOptionKeys = new Set([
|
|
|
278
279
|
"omitLastClosingTag",
|
|
279
280
|
"serverComponents",
|
|
280
281
|
"builtIns",
|
|
281
|
-
"renderers"
|
|
282
|
-
// Patch-mode dual driver (stage 2, dormant by default): accepted so an
|
|
283
|
-
// explicit opt-in reaches the native core (napi maps to patch_driver).
|
|
284
|
-
"patchDriver"
|
|
282
|
+
"renderers"
|
|
285
283
|
]);
|
|
286
284
|
|
|
287
285
|
function validateOptions(code, options) {
|
|
@@ -324,19 +322,6 @@ function validateOptions(code, options) {
|
|
|
324
322
|
nativeOptions.validate = value;
|
|
325
323
|
continue;
|
|
326
324
|
}
|
|
327
|
-
if (key === "patchDriver") {
|
|
328
|
-
if (typeof value !== "string" && typeof value !== "boolean") {
|
|
329
|
-
throw new TypeError(
|
|
330
|
-
"@solidjs/compiler `patchDriver` option must be a string import name or boolean"
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
// The napi wrapper mapping collapses boolean `true` into
|
|
334
|
-
// Wrapper::Default, which patch_driver treats as disabled (dormant
|
|
335
|
-
// default). Normalize the boolean opt-in to the default import name so
|
|
336
|
-
// it survives the native mapping.
|
|
337
|
-
nativeOptions.patchDriver = value === true ? "patchDriver" : value;
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
325
|
if (nativeOptionKeys.has(key)) {
|
|
341
326
|
if (key === "renderers") validateRenderers(value);
|
|
342
327
|
nativeOptions[key] = value;
|
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.8",
|
|
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.8",
|
|
66
|
+
"@solidjs/compiler-darwin-arm64": "2.0.0-rc.8",
|
|
67
|
+
"@solidjs/compiler-linux-x64-gnu": "2.0.0-rc.8",
|
|
68
|
+
"@solidjs/compiler-linux-arm64-gnu": "2.0.0-rc.8",
|
|
69
|
+
"@solidjs/compiler-win32-x64-msvc": "2.0.0-rc.8",
|
|
70
|
+
"@solidjs/compiler-wasm32-wasi": "2.0.0-rc.8"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/types.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ 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 output only;
|
|
19
|
+
* the production runtime ignores the argument.
|
|
20
|
+
*/
|
|
21
|
+
componentNames?: boolean;
|
|
15
22
|
sourceMap?: boolean;
|
|
16
23
|
contextToCustomElements?: boolean;
|
|
17
24
|
delegateEvents?: boolean;
|
|
@@ -27,15 +34,6 @@ export interface TransformOptions {
|
|
|
27
34
|
omitNestedClosingTags?: boolean;
|
|
28
35
|
omitLastClosingTag?: boolean;
|
|
29
36
|
serverComponents?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Patch-mode dual driver (dormant by default): `true` or an import name
|
|
32
|
-
* (`"patchDriver"`) opts compiled templates whose bindings are pure member
|
|
33
|
-
* reads of one subject into the store patch channel. The loader normalizes
|
|
34
|
-
* `true` to the default import name (the napi wrapper mapping treats bare
|
|
35
|
-
* booleans as "default", which this option reads as disabled).
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
patchDriver?: boolean | string;
|
|
39
37
|
/** Default `["For", "Show", "Switch", "Match", "Loading", "Reveal", "Portal", "Repeat", "Dynamic", "Errored"]`. */
|
|
40
38
|
builtIns?: string[];
|
|
41
39
|
requireImportSource?: false | string;
|
|
@@ -140,8 +138,12 @@ export interface TransformDirectivesOptions {
|
|
|
140
138
|
|
|
141
139
|
/** One extracted server function, for building a bundler manifest. */
|
|
142
140
|
export interface ServerFunctionMeta {
|
|
143
|
-
/** The wire ID (`<hash
|
|
141
|
+
/** The wire ID (`<name>-<hash>[-<ordinal>]`). */
|
|
144
142
|
id: string;
|
|
143
|
+
/**
|
|
144
|
+
* The dotted binding path that names the function, such as
|
|
145
|
+
* `handlers.save`. `anonymous` when no enclosing binding applies.
|
|
146
|
+
*/
|
|
145
147
|
name: string;
|
|
146
148
|
/** Export names bound to this function (module-level directives only). */
|
|
147
149
|
exports: string[];
|