Skip to content

Commit 0ba5199

Browse files
committed
Merge main (the crate, #6; onSettled/onFlush, #10) into the editor work
Conflicts: Cargo.toml's crate-type comment (both builds use the cdylib), emit.rs's EF-7/EF-8 call and check.rs's returns_closure/hook check ported to the span-carrying AST (ExprKind/StmtKind), spec/11's decisions renumbered (main's 7 stays; the editor's are 8, 9, 10). The projection's BUILTINS and prelude take onSettled/onFlush (ref/crate.ts --project 170/170). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP4zNW5bnup8XRB8md
2 parents 28239fc + 7749fda commit 0ba5199

57 files changed

Lines changed: 3917 additions & 164 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/compiler.yml‎

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# The compiler's npm package, @reactivescript/compiler (compiler/): the crate's Node-API build for each platform,
2+
# each tested on its own runner, then published as one package per platform (@reactivescript/compiler-<platform>)
3+
# beside the main package, which loads the one that fits and carries the Vite front end (`/vite`).
4+
#
5+
# A release is a version bump merged to main (compiler/README.md, Releasing), once the repository variable RELEASES
6+
# is `on`: a version npm does not have is published by trusted publishing (OIDC, no token) and tagged
7+
# `compiler-v<version>`.
8+
name: compiler
9+
10+
on:
11+
push:
12+
branches: [main]
13+
paths: ["compiler/**", ".github/workflows/compiler.yml"]
14+
pull_request:
15+
paths: ["compiler/**", ".github/workflows/compiler.yml"]
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, test: true }
25+
- { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu, test: true }
26+
- { os: macos-latest, target: aarch64-apple-darwin, test: true }
27+
- { os: macos-latest, target: x86_64-apple-darwin, test: false } # cross-built on Apple silicon
28+
- { os: windows-latest, target: x86_64-pc-windows-msvc, test: true }
29+
runs-on: ${{ matrix.os }}
30+
defaults:
31+
run:
32+
working-directory: compiler
33+
shell: bash
34+
steps:
35+
- uses: actions/checkout@v5
36+
- uses: dtolnay/rust-toolchain@stable
37+
with:
38+
targets: ${{ matrix.target }}
39+
- uses: Swatinem/rust-cache@v2
40+
with:
41+
workspaces: compiler
42+
key: ${{ matrix.target }}
43+
- uses: actions/setup-node@v5
44+
with:
45+
node-version: 22
46+
- run: npm ci
47+
- name: Node-API build
48+
run: npx napi build --platform --release --strip --features node --target ${{ matrix.target }} --manifest-path ./Cargo.toml -- --lib
49+
- name: Test
50+
if: matrix.test
51+
run: npm test
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: binding-${{ matrix.target }}
55+
path: compiler/*.node
56+
if-no-files-found: error
57+
58+
# which version is new: on main only, after every platform built
59+
version:
60+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.RELEASES == 'on'
61+
needs: build
62+
runs-on: ubuntu-latest
63+
outputs:
64+
version: ${{ steps.v.outputs.version }}
65+
steps:
66+
- uses: actions/checkout@v5
67+
- id: v
68+
run: |
69+
v=$(node -p 'require("./compiler/package.json").version')
70+
if [ -z "$(npm view "@reactivescript/compiler@$v" version 2>/dev/null)" ]; then echo "version=$v" >> "$GITHUB_OUTPUT"; fi
71+
72+
publish:
73+
needs: version
74+
if: needs.version.outputs.version != ''
75+
runs-on: ubuntu-latest
76+
environment: release
77+
permissions:
78+
id-token: write # trusted publishing: npm takes the job's OIDC token, and adds provenance
79+
contents: write # the tag
80+
defaults:
81+
run:
82+
working-directory: compiler
83+
steps:
84+
- uses: actions/checkout@v5
85+
- uses: actions/download-artifact@v4
86+
with:
87+
pattern: binding-*
88+
path: compiler/artifacts
89+
merge-multiple: true
90+
- uses: actions/setup-node@v5
91+
with:
92+
node-version: 22
93+
registry-url: https://registry.npmjs.org
94+
- run: npm install -g npm@latest # trusted publishing needs npm 11.5.1 or later
95+
- run: npm ci
96+
- name: Platform packages
97+
run: |
98+
node scripts/sync-optional-deps.mjs
99+
npx napi artifacts --output-dir artifacts --npm-dir npm
100+
for d in npm/*/; do npm publish "$d" --access public; done
101+
- run: npm publish --access public
102+
- name: Tag
103+
working-directory: .
104+
run: git tag "compiler-v$V" && git push origin "compiler-v$V"
105+
env:
106+
V: ${{ needs.version.outputs.version }}

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules/
22
compiler/target/
3-
vite-plugin-rx/.out/
3+
compiler/*.node
4+
compiler/test/.out/
5+
compiler/artifacts/

‎CONTRIBUTING.md‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing
2+
3+
ReactiveScript is an early-stage language design. The spec is the product;
4+
the reference implementation in `ref/` exists to check it.
5+
6+
## How claims are made
7+
8+
Every behaviour claim is either a numbered rule (`E-n`, `H-n`, `AC-n`, …;
9+
see the README's *Rule IDs*) or a scenario under `scenarios/`
10+
(program → actions → frames → verdict). A change to the language comes
11+
with the rule it adds or amends and at least one scenario that shows it.
12+
`scenarios/TEMPLATE.md` is the starting point for a new one.
13+
14+
Decisions recorded in the spec as *ruled* with a date are settled; please
15+
open an issue rather than a PR to revisit one. Decisions marked *taken by
16+
default* are still open to change.
17+
18+
Semantics follow Solid 2.0 (`solidjs/solid@next`, pinned in
19+
`ref/SOLID_NEXT`). An open question in Solid's
20+
`packages/signals/docs/RULES-FUNDAMENTALS.md` is open here too. Where this
21+
spec diverges from Solid, the divergence is recorded as a `DV-n` in
22+
`spec/05-holds.md` or `spec/10-server.md`.
23+
24+
## Running the suite
25+
26+
Solid is built from its `next` branch at the pinned commit (needs pnpm and a
27+
Rust toolchain):
28+
29+
```sh
30+
sh ref/scripts/solid-next.sh # checks out and builds ../solid-next
31+
cd ref && npm install
32+
npm test # interpreter over every scenario
33+
npm run oracle # the same scenarios lowered onto Solid
34+
npm run compiled # compiled modules
35+
npm run ssr # streamed SSR + hydration in Chromium
36+
npm run types # TSX projection checked by TypeScript
37+
```
38+
39+
`ref/README.md` describes each runner. Please run the suite before opening a
40+
pull request and note any scenario whose result changed.
41+
42+
## Issues
43+
44+
Bug reports and questions are welcome as GitHub issues. For a semantics
45+
question, a small `.rx` program and the frames you expected is the most
46+
useful form.

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Ryan Carniato
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ semantics: equations by default, writes confined to imperative scope, ownership
55
and async (pending, holds, lanes) as things the compiler checks rather than the
66
runtime warns about.
77

8+
> **Status:** early design work. The spec, its scenarios and the reference
9+
> implementation change often, and nothing here is released. See
10+
> [CONTRIBUTING.md](CONTRIBUTING.md) to run the suite or propose a change.
11+
812
This repository is the **spec** and its **reference implementation**. The
913
production compiler is a separate Rust crate over Solid's own
1014
`solidjs-compiler` (`spec/11-compiler.md`): ReactiveScript parses, checks
@@ -88,3 +92,7 @@ Scenario IDs: `S-<area>-n` for the areas above (`S-core`, `S-region`,
8892
- *Superset of `.tsx`, no SFCs* — superseded: expressions and JSX are
8993
TS's verbatim and a file is a module (07 §1); declarations are keywords
9094
(`source`, `x = e`), as 07 rules.
95+
96+
## License
97+
98+
[MIT](LICENSE)

0 commit comments

Comments
 (0)