Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
42db363
Real JS modules win over the test API and declared types bind no values
devagrawal09 Nov 24, 2026
f30e1bb
Read generic and private types in foreign declarations.
devagrawal09 Nov 25, 2026
d103f95
Parse computed keys, casts, and multiline member chains.
devagrawal09 Nov 25, 2026
7065778
Run the expression fixture in declaration order.
devagrawal09 Nov 25, 2026
81aaa4a
Report diagnostics across a recovering module graph.
devagrawal09 Nov 25, 2026
5ad54b3
Type assertions parse in handlers, and a handler parse error stays on…
devagrawal09 Nov 25, 2026
adf0cc8
Visit computed keys during expression analysis.
devagrawal09 Nov 25, 2026
66e6758
Document foreign declaration type parameters and rows.
devagrawal09 Nov 25, 2026
7c0e41b
A write checks the source's type, not the type a branch narrowed it to.
devagrawal09 Nov 25, 2026
3f7da8d
A .d.rx is the type of its JS module, even when a .ts sits beside it.
devagrawal09 Nov 25, 2026
f4667d7
A handler reads a snapshot, so a view branch does not narrow it.
devagrawal09 Nov 25, 2026
a5e9030
A component's style that only matches another component in the file i…
devagrawal09 Nov 25, 2026
3805aeb
A handler parse error keeps a named habit when the statement reading …
devagrawal09 Nov 25, 2026
8b241fa
The notes list's row styles live on Row, the view they match.
devagrawal09 Nov 25, 2026
13e817d
The Solid oracle erases a type assertion, so a handler write of one k…
devagrawal09 Nov 25, 2026
5fc18a6
Cook escapes in strings and template literals.
devagrawal09 Nov 25, 2026
675cd04
Render empty JSX fragments without text.
devagrawal09 Nov 25, 2026
6ac4e3b
Preserve inline spaces in JSX text.
devagrawal09 Nov 25, 2026
3fefe8e
Let a declaration file import types from another .d.rx or an .rx expo…
devagrawal09 Nov 25, 2026
4fa970a
Flag a typed error boundary whose children an inner catch-all wraps.
devagrawal09 Nov 25, 2026
af9015f
Exercise imported declaration types through rx-tsc
devagrawal09 Nov 25, 2026
057644d
Bind the JS primitive before reading its value in rx-tsc test
devagrawal09 Nov 25, 2026
e417daf
Accept optional value parameters in JS declarations
devagrawal09 Nov 25, 2026
1ee3fe1
Verify optional arguments through rx-tsc
devagrawal09 Nov 25, 2026
1e998f6
Use the scenario notation for an empty frame
devagrawal09 Nov 25, 2026
ba60c70
Keep optional-declaration fixture independent of mock JS
devagrawal09 Nov 25, 2026
caa132d
Only diagnose a dead typed boundary when the inner fallback is static
devagrawal09 Nov 25, 2026
d303341
Complete language conformance and gate checker and lowering parity
devagrawal09 Nov 25, 2026
a2d1777
Keep indexed model reads in parity
devagrawal09 Nov 25, 2026
5b280a5
Key dev declarations and expose their resolved model
devagrawal09 Nov 25, 2026
0c54e01
Hydrate a dev client against non-dev server output
devagrawal09 Nov 25, 2026
81b0c7d
Preserve module keys in non-bundled lowering
devagrawal09 Nov 25, 2026
ad7d6de
Do not allocate foreign observation memos during hydration
devagrawal09 Nov 25, 2026
c700955
Wait for server function frames in the SSR runner
devagrawal09 Nov 25, 2026
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
44 changes: 42 additions & 2 deletions .github/workflows/compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,52 @@ name: compiler
on:
push:
branches: [main]
paths: ["compiler/**", ".github/workflows/compiler.yml"]
paths: ["compiler/**", "ref/**", "spec/**", "scenarios/**", "examples/**", ".github/workflows/compiler.yml"]
pull_request:
paths: ["compiler/**", ".github/workflows/compiler.yml"]
paths: ["compiler/**", "ref/**", "spec/**", "scenarios/**", "examples/**", ".github/workflows/compiler.yml"]
workflow_dispatch:

jobs:
parity:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { name: checker, flags: "" }
- { name: lowering, flags: "--lower" }
- { name: dev lowering, flags: "--lower --dev" }
name: parity (${{ matrix.name }})
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.99.1
- uses: Swatinem/rust-cache@v2
with:
workspaces: compiler
- uses: actions/setup-node@v5
with:
node-version: 24
- uses: pnpm/action-setup@v4
with:
version: 11.1.1
- run: sh ref/scripts/solid-next.sh
- run: npm ci --prefix ref
- if: matrix.flags == ''
run: npm --prefix ref run crate
- if: matrix.flags != ''
# Keep local lowering strict. In CI, tolerate only the named, existing
# mismatches until they are fixed; a crash or a different set fails.
run: |
log=$(mktemp)
status=0
npm --prefix ref run crate -- ${{ matrix.flags }} >"$log" 2>&1 || status=$?
cat "$log"
test "$status" -le 1
grep -Eq '^[0-9]+/[0-9]+ programs lowered alike' "$log"
diff -u ref/lowering-baseline.txt <(grep '^FAIL ' "$log" || true)

build:
strategy:
fail-fast: false
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## Unreleased

**Breaking**

- MO-8c: a real `./api` implementation beside the importing module wins over the injected test API, even if
`createApp({ api })` is set. A test API call with no injected implementation now throws `MISSING_TEST_API`.
- `DEAD_TYPED_BOUNDARY` rejects a typed error boundary proven shadowed by an inner catch-all. Put the typed
boundary inside the catch-all.
- `STYLE_SCOPE` rejects a style block outside a supported style scope; move it into the component that owns the view.
- String and template escapes are cooked in the compiler; programs relying on the previous literal backslashes
must escape those backslashes explicitly.
- Multiline JSX whitespace follows the view whitespace rules (07 §4). Use an explicit `{" "}` where spacing
between pieces must survive.

**Changed**

- `catch` follows only an `await`: `await f(x) catch (e) => alt` makes a matching rejection the answer. A `catch` after
Expand Down
2 changes: 2 additions & 0 deletions compiler/Cargo.lock

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

2 changes: 2 additions & 0 deletions compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ node = ["dep:napi", "dep:napi-derive"]
[dependencies]
indexmap = "2"
regex = "1"
htmlize = { version = "1", features = ["unescape"] }
dragonbox_ecma = "0.1"
serde_json = { version = "1", features = ["preserve_order"] }
# CP-1b: Solid's compiler, at the commit ref/ runs on (ref/SOLID_NEXT), and the Oxc release it is built against (CP-1c:
# the program crosses the seam, so the versions must match)
Expand Down
4 changes: 3 additions & 1 deletion compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ cargo build --release
target/release/rxc check ../examples/todo.rx # diagnostics
target/release/rxc check --json ../examples/todo.rx # … with ranges, for an editor or an agent (CP-8d)
target/release/rxc project ../examples/todo.rx # the TSX projection, with mappings onto .rx (CP-8c)
target/release/rxc model ../examples/todo.rx # the resolved model, as JSON
target/release/rxc model ../examples/todo.rx # the resolved model, as JSON (keys relative to the cwd, CP-6f)
target/release/rxc serve # a language server's requests, a JSON line each (CP-8e)
cargo build --lib --release --target wasm32-unknown-unknown # … the same requests as WebAssembly (src/wasm.rs), what the server loads
target/release/rxc compile ../examples/todo.rx --out out # modules (dom; --target ssr|universal), source maps onto .rx, style.css
target/release/rxc app ../examples/todo.rx # the same as JSON, imports by .rx path: what the Vite front end gets
target/release/rxc app ../examples/todo.rx --dev # a dev build: creating calls under __rt.key (CP-4b; --root dir, else the cwd); also compile
target/release/rxc check --spa ../examples/todo.rx # a client-only build: a first load nothing holds is an error (08 CN-3d); also compile, app
npm --prefix ../ref run crate # CP-5: the crate against ref/ on every program
npm --prefix ../ref run crate -- --project # … and the TSX projection, text for text, every mapping checked
RX_CRATE=1 npm --prefix ../ref run types # the types scenarios, on the crate's projection
npm --prefix ../ref run crate -- --lower # … and the lowered JavaScript, for every target, and its source maps
npm --prefix ../ref run crate -- --lower --dev # … the same for dev builds
RX_CRATE=1 npm --prefix ../ref run compiled # the scenarios, run on the crate's output
RX_CRATE=1 npm --prefix ../ref run ssr # … served and hydrated from the crate's output
```
Expand Down
11 changes: 9 additions & 2 deletions compiler/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-was
/**
* `rxc app`'s answer, as JSON text: the program `entry` (an absolute path) starts, for `target` (dom, ssr or
* universal; dom by default) over `module_name` (`@solidjs/web` by default). `spa`: a client-only build (dom, not
* hydratable), checked under 08 CN-3d.
* hydratable), checked under 08 CN-3d. `dev`: a dev build — each source's and equation's creating calls run under its
* key (`__rt.key`), its module relative to `root` (the process's cwd by default).
*/
export declare function app(entry: string, target?: string | undefined | null, moduleName?: string | undefined | null, spa?: boolean | undefined | null): string
export declare function app(entry: string, target?: string | undefined | null, moduleName?: string | undefined | null, spa?: boolean | undefined | null, dev?: boolean | undefined | null, root?: string | undefined | null): string

/**
* `rxc model`'s answer, as JSON text: the resolved model (CP-6) of every module the programs `entries` (absolute paths)
* start, each once, with module paths and keys relative to `root` (the process's cwd by default).
*/
export declare function model(entries: Array<string>, root?: string | undefined | null): string
1 change: 1 addition & 0 deletions compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,3 +836,4 @@ function __napiStampBindingTarget(exportsObject, target) {
module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
module.exports = nativeBinding
module.exports.app = nativeBinding.app
module.exports.model = nativeBinding.model
43 changes: 39 additions & 4 deletions compiler/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! A program compiled for a bundler (spec/11 CP-4b): every module of the program `entry` starts, through Solid's
//! compiler for `target`, each importing its dependencies by `.rx` path, with the program's stylesheet. What `rxc app`
//! prints and the Node-API build (`src/node.rs`) returns to `@reactivescript/compiler/vite`.
use crate::check::check_modules;
use crate::emit::{compile_linked, lower_view, Target};
use crate::check::{check_modules, check_modules_in};
use crate::emit::{lower_view, Target};
use crate::model::module_key;
use crate::modules::load_modules;
use serde_json::{json, Map, Value};
use std::path::Path;
Expand All @@ -26,6 +27,12 @@ pub fn target(name: &str) -> Target {
/// `{entry, css, modules: {path: {code, map, css}}}` (the program's stylesheet, and each module's own), or `{diagnostics: [...]}` / `{error}`. `entry` is an absolute path.
/// `spa`: a client-only build, checked under 08 CN-3d.
pub fn app(entry: &str, target: Target, module_name: &str, spa: bool) -> Value {
app_dev(entry, target, module_name, spa, None)
}

/// `app`, for a dev build when `dev` is set: each source's and equation's creating calls run under its key
/// (`emit::compile_dev`); `dev` is the project root the keys' modules are relative to.
pub fn app_dev(entry: &str, target: Target, module_name: &str, spa: bool, dev: Option<&str>) -> Value {
// module keys are POSIX paths (`modules::join_path`); Windows takes `D:/a/b.rx` as it takes `D:\a\b.rx`
let entry = &entry.replace('\\', "/");
(|| {
Expand All @@ -43,15 +50,43 @@ pub fn app(entry: &str, target: Target, module_name: &str, spa: bool) -> Value {
if !checked.diags.is_empty() {
return Err(json!({ "diagnostics": checked.diags.iter().map(|d| { let mut j = d.to_json(); if j["file"].is_null() { j["file"] = json!(set.entry); } j }).collect::<Vec<_>>() }));
}
let out = compile_linked(&set, &[], true).map_err(|e| json!({ "error": format!("{entry}: not compiled: {}", e.0) }))?;
let out = crate::emit::compile_dev(&set, &[], true, dev).map_err(|e| json!({ "error": format!("{entry}: not compiled: {}", e.0) }))?;
let mut modules = Map::new();
for (name, module) in &out.files {
let path = &out.paths[name];
let text = read_disk(path).unwrap_or_default();
let l = lower_view(module, path, target, module_name, Some((path, &text))).map_err(|e| json!({ "error": e }))?;
modules.insert(path.clone(), json!({ "code": l.code, "map": l.map, "css": out.module_css[name] }));
}
Ok(json!({ "entry": set.entry, "css": out.css, "modules": modules }))
let mut result = json!({ "entry": set.entry, "css": out.css, "modules": modules });
if dev.is_some() {
result["declarations"] = json!(set.declarations.keys().collect::<Vec<_>>());
}
Ok(result)
})()
.unwrap_or_else(|e| e)
}

/// `rxc model`'s answer for the programs `entries` start (absolute paths): each module's resolved model (CP-6) once, in
/// load order, its `file` and its symbols' keys relative to `root`. `{error}` when an entry does not load.
pub fn model(entries: &[String], root: &str) -> Value {
let mut out: Vec<Value> = vec![];
let mut seen = std::collections::HashSet::new();
for entry in entries {
let entry = entry.replace('\\', "/");
let set = match load_modules(&entry, &read_disk) {
Ok(s) => s,
Err(e) => return json!({ "error": e.0 }),
};
let checked = check_modules_in(&set, false, Some(root));
for p in &set.order {
if !seen.insert(p.clone()) {
continue;
}
let mut m = checked.models[p].clone();
m["file"] = json!(module_key(p, Some(root)));
out.push(m);
}
}
Value::Array(out)
}
5 changes: 5 additions & 0 deletions compiler/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum TplPart {
#[derive(Debug, Clone)]
pub enum Field {
Kv { key: String, v: Expr },
Computed { key: Expr, v: Expr },
Spread(Expr),
}

Expand Down Expand Up @@ -83,6 +84,7 @@ pub enum ExprKind {
Call { f: Box<Expr>, args: Vec<Expr> },
Arr(Vec<Expr>),
Rec(Vec<Field>),
As { e: Box<Expr>, ty: String },
/// `stmts`: a statement-bodied arrow (imperative scope, 07 §5)
Fn { params: Vec<String>, body: Box<Expr>, stmts: Option<Vec<Stmt>> },
/// ST-3
Expand Down Expand Up @@ -420,6 +422,7 @@ impl Expr {
ExprKind::Call { .. } => "call",
ExprKind::Arr(_) => "arr",
ExprKind::Rec(_) => "rec",
ExprKind::As { .. } => "as",
ExprKind::Fn { .. } => "fn",
ExprKind::Draft { .. } => "draft",
ExprKind::Use(_) => "use",
Expand All @@ -443,6 +446,7 @@ impl Expr {
ExprKind::Pre { name, init } => obj(vec![("k", k), ("name", s(name)), ("init", ob(init))]),
ExprKind::Peek(e) | ExprKind::Latest(e) | ExprKind::Pending(e) | ExprKind::Spread(e) | ExprKind::Throw(e) => obj(vec![("k", k), ("e", b(e))]),
ExprKind::Omit { e, keys } => obj(vec![("k", k), ("e", b(e)), ("keys", Some(strs(keys)))]),
ExprKind::As { e, ty } => obj(vec![("k", k), ("e", b(e)), ("ty", s(ty))]),
ExprKind::Await { e, init, stream } => obj(vec![("k", k), ("e", b(e)), ("init", ob(init)), ("stream", Some(Value::Bool(*stream)))]),
ExprKind::If { c, t, f } => obj(vec![("k", k), ("c", b(c)), ("t", b(t)), ("f", b(f))]),
ExprKind::Tpl(parts) => obj(vec![
Expand All @@ -462,6 +466,7 @@ impl Expr {
.iter()
.map(|f| match f {
Field::Kv { key, v } => obj(vec![("key", s(key)), ("v", Some(v.to_json()))]),
Field::Computed { key, v } => obj(vec![("computed", Some(key.to_json())), ("v", Some(v.to_json()))]),
Field::Spread(e) => obj(vec![("spread", Some(e.to_json()))]),
})
.collect(),
Expand Down
Loading
Loading