Skip to content

Commit 47c75df

Browse files
authored
Merge pull request #39 from solidjs/claude/project-thread-k44bg2
Release 0.1.0: versions, install and quickstart
2 parents ce1f5fe + d693ed0 commit 47c75df

24 files changed

Lines changed: 460 additions & 157 deletions

File tree

‎.github/workflows/compiler.yml‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- { os: macos-latest, target: aarch64-apple-darwin, test: true }
2727
- { os: macos-latest, target: x86_64-apple-darwin, test: false } # cross-built on Apple silicon
2828
- { os: windows-latest, target: x86_64-pc-windows-msvc, test: true }
29+
- { os: ubuntu-latest, target: wasm32-wasip1-threads, test: true } # @reactivescript/compiler-wasm32-wasi: WebContainers, musl, Windows on ARM
2930
runs-on: ${{ matrix.os }}
3031
defaults:
3132
run:
@@ -45,14 +46,25 @@ jobs:
4546
node-version: 22
4647
- run: npm ci
4748
- name: Node-API build
48-
run: npx napi build --platform --release --strip --features node --target ${{ matrix.target }} --manifest-path ./Cargo.toml -- --lib
49+
# RUSTC: napi-build finds crt1-reactor.o from it for WASI; the rustup proxy's name gives a module that
50+
# deadlocks before its threads start (as @solidjs/compiler's workflow notes)
51+
run: RUSTC="$(rustup which rustc)" npx napi build --platform --release --strip --features node --target ${{ matrix.target }} --manifest-path ./Cargo.toml -- --lib
4952
- name: Test
5053
if: matrix.test
5154
run: npm test
55+
env:
56+
NAPI_RS_FORCE_WASI: ${{ matrix.target == 'wasm32-wasip1-threads' && '1' || '' }}
5257
- uses: actions/upload-artifact@v4
5358
with:
5459
name: binding-${{ matrix.target }}
55-
path: compiler/*.node
60+
path: |
61+
compiler/*.node
62+
compiler/compiler.wasm32-wasi.wasm
63+
compiler/compiler.wasi.cjs
64+
compiler/compiler.wasi.d.cts
65+
compiler/compiler.wasi-browser.js
66+
compiler/wasi-worker.mjs
67+
compiler/wasi-worker-browser.mjs
5668
if-no-files-found: error
5769

5870
# which version is new: on main only, after every platform built

‎.github/workflows/editor.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,13 @@ jobs:
139139
- name: VS Marketplace
140140
if: vars.AZURE_CLIENT_ID != '' || env.VSCE_PAT != ''
141141
run: npx --yes @vscode/vsce publish --packagePath ./*.vsix ${{ vars.AZURE_CLIENT_ID != '' && '--azure-credential' || '' }}
142+
# Open VSX takes the job's OIDC token (trusted publishing, ovsx 1.4) when the repository variable OVSX_TRUSTED is
143+
# `on` and the `solidjs` namespace lists this workflow as a trusted publisher, else the secret OVSX_PAT
142144
- name: Open VSX
143-
if: env.OVSX_PAT != ''
144-
run: npx --yes ovsx publish ./*.vsix -p "$OVSX_PAT"
145+
if: vars.OVSX_TRUSTED == 'on' || env.OVSX_PAT != ''
146+
run: npx --yes ovsx@^1.4.0 publish ./*.vsix ${{ vars.OVSX_TRUSTED == 'on' && '--trusted-publishing' || '-p "$OVSX_PAT"' }}
145147
- name: Tag
146-
if: vars.AZURE_CLIENT_ID != '' || env.VSCE_PAT != '' || env.OVSX_PAT != ''
148+
if: vars.AZURE_CLIENT_ID != '' || env.VSCE_PAT != '' || vars.OVSX_TRUSTED == 'on' || env.OVSX_PAT != ''
147149
run: git tag "vscode-v$V" && git push origin "vscode-v$V"
148150
env:
149151
V: ${{ needs.versions.outputs.vscode }}

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ compiler/target/
33
compiler/*.node
44
compiler/test/.out/
55
compiler/artifacts/
6+
compiler/*.wasm
7+
compiler/browser.js
8+
compiler/compiler.wasi.cjs
9+
compiler/compiler.wasi.d.cts
10+
compiler/compiler.wasi-browser.js
11+
compiler/wasi-worker.mjs
12+
compiler/wasi-worker-browser.mjs

‎README.md‎

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ A small language for reactive UIs that carries
55
*language* semantics, and checks them before your code runs. Files are `.rx`;
66
they compile to plain Solid 2.0.
77

8-
> **Status:** early design work. The spec, its scenarios and the reference
9-
> implementation change often, and nothing here is released. See
8+
> **Status:** experimental, 0.1. The spec, its scenarios and the compiler
9+
> still change often, and releases follow Solid 2.0's release candidates. See
1010
> [CONTRIBUTING.md](CONTRIBUTING.md) to run the suite or propose a change.
1111
1212
## Why
@@ -107,13 +107,49 @@ TSX projection ([spec/13](spec/13-types.md)). For whole apps, start with
107107
| [`tooling/rx-language-server`](tooling/rx-language-server) | the `.rx` language server: TypeScript's hover, go to definition, rename, completion and type errors on `.rx`, plus the checker's diagnostics with their rules |
108108
| [`tooling/vscode-rx`](tooling/vscode-rx) | the VS Code extension: highlighting, and the language server |
109109

110-
Nothing is published yet. `@reactivescript/compiler`,
111-
`@reactivescript/runtime` and `@reactivescript/language-server` will go to
112-
npm, and the extension to the VS Marketplace and Open VSX
113-
([`tooling/RELEASING.md`](tooling/RELEASING.md)). In Vite, the compiler is a
114-
front end that Solid's Vite plugin loads on its own when the package is
115-
installed; that support is merged in Solid's plugin but not yet released
116-
([`compiler/README.md`](compiler/README.md)).
110+
## Install
111+
112+
ReactiveScript 0.1 is experimental. It follows Solid 2.0's release
113+
candidates, so expect breaking changes until Solid 2.0 is final.
114+
115+
**In a Solid app (Vite).** Install the compiler and the runtime beside Solid
116+
2.0:
117+
118+
```sh
119+
npm i solid-js@next @solidjs/web@next @solidjs/signals@next @reactivescript/runtime
120+
npm i -D vite @solidjs/vite-plugin @reactivescript/compiler
121+
```
122+
123+
Keep `solid()` in `vite.config.js` as it is. Solid's Vite plugin
124+
(3.0.0-next.57 or later) finds the compiler and compiles `.rx` on its own
125+
(spec/11 CP-7).
126+
127+
```rx
128+
// src/app.rx
129+
export default component App() {
130+
source count := 0
131+
doubled = count * 2
132+
<button onClick={() => { count := count + 1 }}>{count} × 2 = {doubled}</button>
133+
}
134+
```
135+
136+
```js
137+
// src/main.js
138+
import { createApp } from "@reactivescript/runtime";
139+
import main from "./app.rx";
140+
141+
const app = createApp({ root: document.getElementById("app") });
142+
app.mount(main(app));
143+
```
144+
145+
**In an editor.** Install the ReactiveScript extension (publisher
146+
`solidjs`) from the VS Code Marketplace, or from Open VSX for Cursor
147+
and VSCodium. It brings highlighting and the language server. Other editors
148+
can run the language server on its own: `npx @reactivescript/language-server
149+
--stdio` ([`tooling/rx-language-server`](tooling/rx-language-server)).
150+
151+
How releases are made: [`tooling/RELEASING.md`](tooling/RELEASING.md) and
152+
[`compiler/README.md`](compiler/README.md).
117153

118154
## Try it
119155

@@ -129,11 +165,9 @@ node --experimental-strip-types ref/run.ts # run every scen
129165
Running the scenarios on Solid itself needs Solid's `next` branch built from
130166
source (pnpm and a Rust toolchain); see [CONTRIBUTING.md](CONTRIBUTING.md) and
131167
[`ref/README.md`](ref/README.md). The compiler builds with Cargo
132-
([`compiler/README.md`](compiler/README.md)). For the editor, install a
133-
`.vsix` from a run of the repository's `editor` workflow, or build one
134-
([`tooling/vscode-rx/README.md`](tooling/vscode-rx/README.md)); other editors
135-
use the language server directly
136-
([`tooling/rx-language-server`](tooling/rx-language-server)).
168+
([`compiler/README.md`](compiler/README.md)). To try an unreleased editor build, install a `.vsix` from a run of the
169+
repository's `editor` workflow, or build one
170+
([`tooling/vscode-rx/README.md`](tooling/vscode-rx/README.md)).
137171

138172
## Reading the spec
139173

‎compiler/Cargo.lock‎

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎compiler/Cargo.toml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "reactivescript"
3-
version = "0.0.0"
3+
version = "0.1.0"
44
edition = "2021"
55
description = "ReactiveScript's compiler (spec/11): parse, check, resolve, and lower through Solid's solidjs-compiler"
66
license = "MIT"
@@ -32,11 +32,11 @@ oxc_ast = "0.144"
3232
oxc_span = "0.144"
3333
oxc_sourcemap = "8.1"
3434
oxc_syntax = "0.144"
35-
napi = { version = "3.12", default-features = false, features = ["napi4"], optional = true }
36-
napi-derive = { version = "3.6", optional = true }
35+
napi = { version = "=3.12.1", default-features = false, features = ["napi4"], optional = true }
36+
napi-derive = { version = "=3.6.3", optional = true }
3737

3838
[build-dependencies]
39-
napi-build = "2.4"
39+
napi-build = "=2.4.1" # held with napi and napi-derive: the WASI build's emnapi setup (build.rs) is written for this set
4040

4141
[profile.release]
4242
debug = false

‎compiler/README.md‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ RX_CRATE=1 npm --prefix ../ref run ssr # … served and hydrated from
4848
The crate's Node-API build (`--features node`, `src/node.rs`) is the npm
4949
package `@reactivescript/compiler`, with one binary per platform
5050
(`@reactivescript/compiler-<platform>`, in `npm/`) as `@solidjs/compiler`
51-
ships. Its `/vite` export (`vite.mjs`) is ReactiveScript's front end for
51+
ships, plus `@reactivescript/compiler-wasm32-wasi`, the same build for
52+
`wasm32-wasip1-threads`, which loads wherever no binary fits (WebContainers
53+
such as StackBlitz, musl, Windows on ARM). Build it with
54+
`RUSTC="$(rustup which rustc)" npx napi build --platform --release --strip
55+
--features node --target wasm32-wasip1-threads -- --lib`, and test it with
56+
`NAPI_RS_FORCE_WASI=1 npm test`. `build.rs` sets up emnapi for it as
57+
`@solidjs/compiler`'s does, and the napi crates are held at the versions that
58+
setup works with. Its `/vite` export (`vite.mjs`) is ReactiveScript's front end for
5259
Solid's Vite plugin, which loads it on its own: an app installs the package
5360
and keeps `solid()` as it is (spec/11 CP-7, decision 7).
5461

@@ -59,7 +66,7 @@ SOLID_VITE_PLUGIN=../../solid-vite-plugin node test/vite.mjs # every example a
5966
```
6067

6168
`test/vite.mjs` needs a built checkout of solid-vite-plugin with built-in
62-
`.rx` (solidjs/solid-vite-plugin#471) until a release has it.
69+
`.rx` (solidjs/solid-vite-plugin#471, released in 3.0.0-next.57); it does not take the package from npm yet.
6370

6471
What happens to a `.rx` module in Vite:
6572

@@ -82,8 +89,7 @@ The app mounts a program with `createApp` from `@reactivescript/runtime`
8289
(`../runtime`, CP-4a), as the examples do.
8390

8491
Not yet: hot updates of `.rx` modules are untested; server rendering in Vite
85-
needs a request-scoped app for server functions to run in; no WebAssembly
86-
fallback for platforms without a binary.
92+
needs a request-scoped app for server functions to run in.
8793

8894
### Releasing
8995

@@ -99,11 +105,11 @@ tags it `compiler-v<version>`.
99105
`runtime` workflow, tagged `runtime-v<version>`.
100106

101107
Once, by hand: npm sets up trusted publishing only on a package that
102-
exists, so each of the seven packages needs a placeholder first,
108+
exists, so each of the eight packages needs a placeholder first,
103109

104110
```sh
105111
npm login
106-
for p in runtime compiler compiler-darwin-x64 compiler-darwin-arm64 compiler-linux-x64-gnu compiler-linux-arm64-gnu compiler-win32-x64-msvc; do
112+
for p in runtime compiler compiler-darwin-x64 compiler-darwin-arm64 compiler-linux-x64-gnu compiler-linux-arm64-gnu compiler-win32-x64-msvc compiler-wasm32-wasi; do
107113
npx setup-npm-trusted-publish "@reactivescript/$p"
108114
done
109115
```

0 commit comments

Comments
 (0)