Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Changelog

## Unreleased
## 0.3.0

`@reactivescript/compiler`, `@reactivescript/runtime`, `@reactivescript/language-server` and the editor extension,
together.

**Breaking**

- `UNGUARDED_SNAPSHOT` (R-8) is stricter: an `errored` region or `disabled` covers a failure only when it reads the
value. A region whose content reads `x` only under `pending? x` never shows its fallback, so it no longer counts
(#58).

**New**

- Solid libraries (MO-10): declare a primitive once in a `.d.rx` (`export pure fn createToggle(v: boolean): [ref
boolean, (v: boolean) => void]`) and use it like .rx: it is called once, `ref` arguments go in as accessors, readers
are read without a call, and setters are io. A package's `.d.rx` sits beside the file its import resolves to.
`guide/libraries.md`.
`guide/libraries.md` (#57).
- The guide (shipped in `@reactivescript/compiler`) places data by its lifetime: what a visit, a write or the screen
needs, with a module only for data whose writes outlive their page (#58, #59).

**Fixed**

- `refresh` of a keyed equation re-asks it. It used to re-ask nothing in compiled code (#58).

## 0.2.0

Expand Down
2 changes: 1 addition & 1 deletion compiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "reactivescript"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
description = "ReactiveScript's compiler (spec/11): parse, check, resolve, and lower through Solid's solidjs-compiler"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion compiler/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/compiler-darwin-arm64",
"version": "0.2.0",
"version": "0.3.0",
"cpu": [
"arm64"
],
Expand Down
2 changes: 1 addition & 1 deletion compiler/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/compiler-darwin-x64",
"version": "0.2.0",
"version": "0.3.0",
"cpu": [
"x64"
],
Expand Down
2 changes: 1 addition & 1 deletion compiler/npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/compiler-linux-arm64-gnu",
"version": "0.2.0",
"version": "0.3.0",
"cpu": [
"arm64"
],
Expand Down
2 changes: 1 addition & 1 deletion compiler/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/compiler-linux-x64-gnu",
"version": "0.2.0",
"version": "0.3.0",
"cpu": [
"x64"
],
Expand Down
2 changes: 1 addition & 1 deletion compiler/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/compiler-wasm32-wasi",
"version": "0.2.0",
"version": "0.3.0",
"main": "compiler.wasi.cjs",
"browser": "compiler.wasi-browser.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion compiler/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/compiler-win32-x64-msvc",
"version": "0.2.0",
"version": "0.3.0",
"cpu": [
"x64"
],
Expand Down
4 changes: 2 additions & 2 deletions compiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@reactivescript/compiler",
"description": "ReactiveScript's compiler, in process through Node-API, and its front end for @solidjs/vite-plugin",
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@reactivescript/runtime",
"description": "ReactiveScript's runtime (spec/11 CP-4a): createApp and the __rt helpers compiled .rx calls, over Solid, for the browser and the server",
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
30 changes: 29 additions & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h1>ReactiveScript</h1>
<a class="btn" href="https://github.com/solidjs/reactivescript/blob/main/guide/language.md">Read the guide</a>
<a class="btn" href="https://github.com/solidjs/reactivescript">GitHub</a>
</div>
<p class="status"><b>Experimental · 0.2.</b> Files are <code>.rx</code> and compile to plain Solid 2.0. Releases follow Solid 2.0's release candidates, so expect breaking changes until Solid 2.0 is final.</p>
<p class="status"><b>Experimental · 0.3.</b> Files are <code>.rx</code> and compile to plain Solid 2.0. Releases follow Solid 2.0's release candidates, so expect breaking changes until Solid 2.0 is final.</p>

<h2>Mistakes of shape become errors</h2>
<p>In Solid you already write UIs as derivations over signals. Most of what goes wrong is a shape mistake: writing to something that should be derived, writing during a computation, reading async data with no loading or error boundary above it. ReactiveScript makes those things the checker refuses, the way Rust refuses a borrow.</p>
Expand All @@ -102,6 +102,19 @@ <h2>Mistakes of shape become errors</h2>
<p>Write to the equation instead, <code>double := 4</code>, and the checker refuses it, in your editor and in CI:</p>
<pre class="err"><code>counter.rx:5:3 - error WRITE_TO_NON_SOURCE: double is an equation: only sources are written (W-1)</code></pre>

<h2>Destructure props, keep them live</h2>
<p>In Solid, destructuring props reads them once and the component stops updating. In .rx, destructure them right in the parameter list: every name follows its prop, defaults and rest included.</p>
<pre><span class="fname">inbox.rx</span><code><span class="k">component</span> Badge({ label, tone = <span class="s">"info"</span>, ...rest }: { label: string; tone?: string; count: number }) {
&lt;span class={tone}&gt;{label}: {rest.count}&lt;/span&gt;
}

<span class="k">export default component</span> Inbox() {
<span class="w">source</span> user := { name: <span class="s">"Ada"</span>, unread: <span class="t">3</span> }

&lt;Badge label={user.name} count={user.unread} /&gt; <span class="c">// Badge updates when user changes</span>
&lt;button onClick={() =&gt; { user := { ...user, unread: <span class="t">0</span> } }}&gt;Mark read&lt;/button&gt;
}</code></pre>

<h2>Async is just <code>await</code></h2>
<p>Put an <code>await</code> in an equation. The checker tracks that the value can be pending and can fail, and asks you to say what to show in both cases.</p>
<pre><span class="fname">profile.rx</span><code><span class="k">import pure</span> { fetchUser } <span class="k">from</span> <span class="s">"./api"</span>
Expand Down Expand Up @@ -186,6 +199,7 @@ <h2>Every word is a Solid primitive</h2>
<tr><td><code>y = x * 2</code></td><td><code>createMemo</code>, <code>createProjection</code></td></tr>
<tr><td><code>user = await fetchUser(id)</code></td><td>an async <code>createMemo</code></td></tr>
<tr><td><code>guess likes := likes + 1</code></td><td><code>createOptimistic</code></td></tr>
<tr><td><code>component C({ label, ...rest })</code></td><td><code>props.label</code>, <code>omit(props, "label")</code></td></tr>
<tr><td><code>action send() { … }</code></td><td><code>action</code></td></tr>
<tr><td><code>effect (x) { … }</code></td><td><code>createEffect(compute, apply)</code></td></tr>
<tr><td><code>loading</code> / <code>errored</code></td><td><code>&lt;Loading&gt;</code> / <code>&lt;Errored&gt;</code></td></tr>
Expand All @@ -197,6 +211,19 @@ <h2>Every word is a Solid primitive</h2>
<div class="card"><h3>The spec is the product</h3><p>Every behaviour is a numbered rule or an executable scenario, checked against Solid itself.</p></div>
</div>

<h2>Use any Solid library</h2>
<p>A Solid library is plain JavaScript, and .rx can use any of them: solid-primitives, a design system's hooks, your own <code>create*</code> helpers. Declare what you use once, in a <code>.d.rx</code> beside it, and the checker holds every use to that declaration. A <code>ref</code> is an accessor: you pass and read plain values, and the compiler adds the calls.</p>
<pre><span class="fname">media.d.rx</span><code><span class="c">// beside ./media.js, which re-exports it from @solid-primitives/media</span>
<span class="k">export pure fn</span> createMediaQuery(query: string): <span class="w">ref</span> boolean</code></pre>
<pre><span class="fname">nav.rx</span><code><span class="k">import</span> { createMediaQuery } <span class="k">from</span> <span class="s">"./media.js"</span>

<span class="k">export default component</span> Nav() {
wide = createMediaQuery(<span class="s">"(min-width: 768px)"</span>) <span class="c">// runs once; read it like any equation</span>

&lt;nav&gt;{<span class="k">if</span> wide { &lt;Links /&gt; } <span class="k">else</span> { &lt;Menu /&gt; }}&lt;/nav&gt;
}</code></pre>
<p>A package can ship its own <code>.d.rx</code> beside its build, and then there's nothing to declare. See <a href="https://github.com/solidjs/reactivescript/blob/main/guide/libraries.md">Using Solid libraries</a>.</p>

<h2 id="install">Install</h2>
<p><b>In a Solid app (Vite).</b> Install the compiler and the runtime beside Solid 2.0. Solid's Vite plugin (3.0.0-next.57 or later) finds the compiler and compiles <code>.rx</code> on its own, so <code>vite.config.js</code> stays as it is.</p>
<pre><code>npm i solid-js@next @solidjs/web@next @solidjs/signals@next @reactivescript/runtime
Expand All @@ -215,6 +242,7 @@ <h2>Learn more</h2>
<ul class="links">
<li><a href="https://github.com/solidjs/reactivescript/blob/main/guide/language.md">The language on one page</a> <span>: the whole working language</span></li>
<li><a href="https://github.com/solidjs/reactivescript/blob/main/guide/async.md">Talking to a server</a> <span>: async, guesses and what waits</span></li>
<li><a href="https://github.com/solidjs/reactivescript/blob/main/guide/libraries.md">Solid libraries</a> <span>: declare a library once in a <code>.d.rx</code></span></li>
<li><a href="https://github.com/solidjs/reactivescript/blob/main/guide/diagnostics.md">Diagnostics</a> <span>: every error code, why, and the fix</span></li>
<li><a href="https://github.com/solidjs/reactivescript/tree/main/spec">The spec</a> <span>: the language as numbered rules</span></li>
<li><a href="https://github.com/solidjs/reactivescript/tree/main/examples">Examples</a> <span>: real apps in <code>.rx</code></span></li>
Expand Down
4 changes: 2 additions & 2 deletions tooling/rx-language-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tooling/rx-language-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/language-server",
"version": "0.2.0",
"version": "0.3.0",
"description": "The .rx language server (spec/11 CP-8): Volar over the crate's TSX projection, TypeScript's answers mapped back onto .rx, the crate's own diagnostics; rx-tsc type-checks .rx from the command line.",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion tooling/vscode-rx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ artifact of a run of the repository's `editor` workflow, or build one (below),
then run **Extensions: Install from VSIX…** in the command palette, or

```sh
code --install-extension reactivescript-0.2.0.vsix
code --install-extension reactivescript-0.3.0.vsix
```

The project needs a `tsconfig.json` with Solid's JSX (`"jsx": "preserve"`,
Expand Down
4 changes: 2 additions & 2 deletions tooling/vscode-rx/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tooling/vscode-rx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "reactivescript",
"displayName": "ReactiveScript",
"description": "ReactiveScript (.rx, .d.rx): highlighting, and TypeScript's types, hover, go to definition, completion and errors through the .rx language server, with the compiler's own diagnostics; ```rx blocks highlighted in Markdown.",
"version": "0.2.0",
"version": "0.3.0",
"publisher": "solidjs",
"license": "MIT",
"icon": "icon.png",
Expand Down
Loading