@solidjs/compiler 2.0.0-rc.7 → 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 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
- The runtime module defaults to `@solidjs/web/server-functions`. Function IDs use `xxhash32(root-relative path)-<count>` (name-suffixed with `env: "development"`). There are also experimental `transformLazy` and `transformRefresh` passes.
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",
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.7",
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.7",
66
- "@solidjs/compiler-darwin-arm64": "2.0.0-rc.7",
67
- "@solidjs/compiler-linux-x64-gnu": "2.0.0-rc.7",
68
- "@solidjs/compiler-linux-arm64-gnu": "2.0.0-rc.7",
69
- "@solidjs/compiler-win32-x64-msvc": "2.0.0-rc.7",
70
- "@solidjs/compiler-wasm32-wasi": "2.0.0-rc.7"
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;
@@ -131,8 +138,12 @@ export interface TransformDirectivesOptions {
131
138
 
132
139
  /** One extracted server function, for building a bundler manifest. */
133
140
  export interface ServerFunctionMeta {
134
- /** The wire ID (`<hash>-<count>[-<name>]`). */
141
+ /** The wire ID (`<name>-<hash>[-<ordinal>]`). */
135
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
+ */
136
147
  name: string;
137
148
  /** Export names bound to this function (module-level directives only). */
138
149
  exports: string[];