Write signals as variables

solid-labels is a compiler for Solid 2.0. Read and assign $signal like any variable, and your bundler gets the accessor and setter calls.

npm install -D solid-labels unplugin-solid-labels
pnpm add -D solid-labels unplugin-solid-labels
yarn add -D solid-labels unplugin-solid-labels
bun add -D solid-labels unplugin-solid-labels
You writeEditable
let count = $signal(0);
const double = $memo(count * 2);

function increment() {
  count += 1;
}
Solid gets
import { createSignal as _createSignal } from "solid-js";
import { createMemo as _createMemo } from "solid-js";
let [count, setcount_1] = _createSignal(0);
const double = _createMemo(() => count() * 2);

function increment() {
  setcount_1(current_1 => current_1 += 1);
}
import { createSignal as _createSignal } from "solid-js";
import { createMemo as _createMemo } from "solid-js";
let [count, setcount_1] = _createSignal(0, { name: "count" });
const double = _createMemo(() => count() * 2, { name: "double" });

function increment() {
  setcount_1(current_1 => current_1 += 1);
}

53% less to type

The same counter and effect, counted in characters without whitespace.

By hand12 lines, 290 characters
import { createSignal, createMemo, createEffect } from 'solid-js';

const [count, setCount] = createSignal(0);
const double = createMemo(() => count() * 2);

createEffect(
  () => [count(), double()],
  ([count, double]) => {
    document.title = `${count} doubled is ${double}`;
  },
);

function increment() {
  setCount((current) => current + 1);
}
With solid-labels8 lines, 137 characters
let count = $signal(0);
const double = $memo(count * 2);

$effect(() => {
  document.title = `${count} doubled is ${double}`;
});

function increment() {
  count += 1;
}

Hand-written code uses solid-js@2.0.0.

What the compiler writes for you

Four jobs you stop doing.

Against writing it by hand

Solid 2.0 either way. Your source differs.

Tasksolid-labelsSolid by hand
Read a signalcountcount()
Write a signalcount += 1setCount((c) => c + 1)
Effect dependenciesFound by the compilerListed in a separate function
ImportsAdded by the compilerWritten by you
Reactive readsLook like plain readsVisible as calls
Build stepNeeds a bundler pluginWorks with Solid's plugin alone

Questions

Does solid-labels add code to my bundle?

No. The package has no runtime. The compiler runs inside your bundler, and the output imports only from solid-js and @solidjs/web.

Which Solid version does it support?

Solid 2.0 (tested with solid-js@2.0.0). For Solid 1.x, install solid-labels@0.17.

Which bundlers work?

Vite, Rollup and Bun through unplugin-solid-labels. Anything else can call compile() from solid-labels/compiler.

Does TypeScript understand $signal?

Yes. One /// <reference types="solid-labels" /> line declares every compile-time function globally, with full types.

Can I debug the code I wrote?

The compiler edits only the spans it rewrites, so the rest of your file keeps its formatting. Source maps cover every character.

Do I have to convert a whole project?

No. Files without compile-time functions pass through unchanged, so you can start with one component.

What does it cost?

Nothing. solid-labels is MIT licensed.

Write your first $signal

npm install -D solid-labels unplugin-solid-labels
pnpm add -D solid-labels unplugin-solid-labels
yarn add -D solid-labels unplugin-solid-labels
bun add -D solid-labels unplugin-solid-labels