Skip to content

Commit 5e7ebb5

Browse files
ryansolidClaude via Cursorcursoragent
committed
docs: name the Vite plugin as the owner of sourceNames.primitives
Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 63006d3 commit 5e7ebb5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎.changeset/compiler-source-names-primitives.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"@solidjs/signals": patch
44
---
55

6-
`transformSourceNames`: the `sourceNames.primitives` pass. Reactive primitives (`createSignal`, `createMemo`, `createOptimistic`, `createStore`, `createOptimisticStore`, `createProjection`) resolving to a `solid-js` / `@solidjs/signals` import are named after the identifier they are declared as — array pattern, binding, property key, or class field — prefixed with the enclosing non-component function (`createCounter.value`), never overriding an explicit `name`. Plain JavaScript in and out, so it runs on `.ts`/`.js` modules too.
6+
`transformSourceNames`: the pass behind the Vite plugin's `sourceNames.primitives` option (a `@solidjs/vite-plugin` option, not a compiler `transform()` option — the compiler exposes it as this standalone function). Reactive primitives (`createSignal`, `createMemo`, `createOptimistic`, `createStore`, `createOptimisticStore`, `createProjection`) resolving to a `solid-js` / `@solidjs/signals` import are named after the identifier they are declared as — array pattern, binding, property key, or class field — prefixed with the enclosing non-component function (`createCounter.value`), never overriding an explicit `name`. Plain JavaScript in and out, so it runs on `.ts`/`.js` modules too.
77

88
Stores honour `name`: `createStore(value, { name: "todos" })` labels its property nodes `todos.title` in attribution output instead of `store.title`; derived and optimistic stores name their property nodes alongside the projection node.

‎packages/compiler/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ The runtime module defaults to `@solidjs/web/server-functions`. Function IDs are
162162

163163
### Source names for primitives
164164

165-
`transformSourceNames(code, { filename?, sourceMap? })` is the `sourceNames.primitives` half: it names reactive primitives after the identifier they are declared as, so the dev and observe runtimes label graph nodes `count` / `doubled` / `todos.title` instead of `signal` / `computed` / `store.title`. It is plain JavaScript in and out (JSX passes through untouched), which is why it is its own pass rather than a `transform()` option — primitives live in `.ts`/`.js` modules as much as in components. `@solidjs/vite-plugin` runs it ahead of the JSX transform for the dev and `observe` postures.
165+
`transformSourceNames(code, { filename?, sourceMap? })` is the pass behind `@solidjs/vite-plugin`'s `sourceNames.primitives` option: it names reactive primitives after the identifier they are declared as, so the dev and observe runtimes label graph nodes `count` / `doubled` / `todos.title` instead of `signal` / `computed` / `store.title`. It is plain JavaScript in and out (JSX passes through untouched), which is why it is its own pass rather than a `transform()` option — primitives live in `.ts`/`.js` modules as much as in components. `@solidjs/vite-plugin` runs it ahead of the JSX transform for the dev and `observe` postures.
166166

167167
```js
168168
const [count, setCount] = createSignal(0); // createSignal(0, { name: "count" })

0 commit comments

Comments
 (0)