Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4d24913
feat(rust-plugin): add native Rust StyleX compiler
mellyeliu Nov 5, 2026
73c163f
feat(unplugin): add opt-in compiler: 'rust'
mellyeliu Nov 5, 2026
a00ec3e
ci: build and test the Rust compiler
mellyeliu Nov 5, 2026
7b8ee8e
fix(rust-plugin): make the CI suites portable
mellyeliu Nov 5, 2026
6b0eaf1
fix(rust-plugin): run every native suite on Windows
mellyeliu Nov 5, 2026
05b4169
fix(rust-plugin): print generated JSX attribute strings like Babel
mellyeliu Nov 5, 2026
6fc3a50
fix(rust-plugin): pass benchmark inputs as data
mellyeliu Nov 5, 2026
7ea888a
chore(rust-plugin): vendor the StyleX SWC core crates at 0.19.2
mellyeliu Nov 6, 2026
d856f70
fix(rust-plugin): align the vendored StyleX core with the Babel plugin
mellyeliu Nov 6, 2026
8886663
feat(rust-plugin): compile StyleX through the vendored core
mellyeliu Nov 6, 2026
179c2ef
test(rust-plugin): cover the compiler against the Babel plugin and Ja…
mellyeliu Nov 6, 2026
ec25ee0
ci(rust-plugin): build, lint and test the compiler on every platform
mellyeliu Nov 6, 2026
a2ce0e7
docs(rust-plugin): document the compiler, its provenance and licenses
mellyeliu Nov 6, 2026
df616bb
style(rust-plugin): format the compiler and vendored crates
mellyeliu Nov 6, 2026
34559b6
ci(rust-plugin): satisfy the repository spelling, lint and Prettier c…
mellyeliu Nov 6, 2026
eda6409
fix(rust-plugin): keep napi out of builds without the node feature
mellyeliu Nov 6, 2026
91e0110
fix(rust-plugin): split the debug short path on every separator the p…
mellyeliu Nov 6, 2026
2aed60f
test(rust-plugin): resolve the rewriteAliases fixture through its rea…
mellyeliu Nov 6, 2026
3b0768d
test(rust-plugin): read a file URL from the path it names, escapes de…
mellyeliu Nov 6, 2026
2bc43e8
fix(rust-plugin): read a file URL through its local path, not its raw…
mellyeliu Nov 6, 2026
e542f37
test(rust-plugin): use the running V8 error text and resolved filename
mellyeliu Nov 6, 2026
41e049f
test(evaluator): require the full logical stack claim to be usable
mellyeliu Nov 6, 2026
59159c3
fix(evaluator): reserve platform stack overhead outside the logical c…
mellyeliu Nov 6, 2026
5cc24f7
test(rust-plugin): compare path-resolver results as paths on every pl…
mellyeliu Nov 6, 2026
764b602
fix(rust-plugin): read Windows paths with `/` when building package s…
mellyeliu Nov 6, 2026
406dbfd
test(rust-plugin): compare the logged import path as a path on every …
mellyeliu Nov 6, 2026
8193e30
test(rust-plugin): compare debug labels with Babel inside, outside an…
mellyeliu Nov 6, 2026
2a721dc
fix(rust-plugin): measure debug labels from their root as Node's path…
mellyeliu Nov 6, 2026
c887fa6
docs(rust-plugin): record the debug-label measure in PROVENANCE
mellyeliu Nov 6, 2026
a3cd282
test(rust-plugin): resolve the coverage and arrow-failure fixture pat…
mellyeliu Nov 6, 2026
dbd5e21
test(rust-plugin): give each theme-group end-to-end test its own fixt…
mellyeliu Nov 6, 2026
a6cf61a
test(rust-plugin): compile deep calls, members, patterns and blocks o…
mellyeliu Nov 6, 2026
59aaca9
test(rust-plugin): claim stack for the crates' deep parse fixtures
mellyeliu Nov 6, 2026
cb6eec1
test(evaluator): size deep fixture stacks before recursive parsing
mellyeliu Nov 6, 2026
f405fd7
test(evaluator): bound the largest fixture stack from measured parser…
mellyeliu Nov 6, 2026
df31dea
test(evaluator): protect every enumerated deep parser fixture at CI s…
mellyeliu Nov 6, 2026
357804d
test(evaluator): pin shared fixture parser stack isolation
mellyeliu Nov 6, 2026
ab7b4db
test(evaluator): give every fixture parse the production parser stack…
mellyeliu Nov 6, 2026
693a69f
test(rust-plugin): spell the map-origin label with the platform separ…
mellyeliu Nov 6, 2026
0cc1b86
fix(rust-plugin): rethrow a host exception without running JavaScript…
mellyeliu Nov 6, 2026
5bd59ab
docs(rust-plugin): record the Rust-API binding-memo follow-up in PROV…
mellyeliu Nov 6, 2026
ed1a6b3
test(evaluator): reproduce retained parameter-map memo collisions and…
mellyeliu Nov 6, 2026
8d582c6
fix(evaluator): exclude call-time bindings and confirm exact static m…
mellyeliu Nov 6, 2026
d8fbc5f
fix(evaluator): confirm hash buckets with retained subtree witnesses
mellyeliu Nov 6, 2026
387fb0b
test(evaluator): pin scoped witnesses and a valid Babel reduce helper
mellyeliu Nov 6, 2026
4eaf99d
test(evaluator): confirm exact memo hits and refusal bucket misses
mellyeliu Nov 6, 2026
af25382
ci(rust-plugin): run the memo parameter-identity Node test
mellyeliu Nov 6, 2026
7f4a00c
perf(rust-plugin): build the Node addon as a fat-LTO cdylib
mellyeliu Nov 6, 2026
caa0a15
test(rust-plugin): compare the debug label under an input source map …
mellyeliu Nov 6, 2026
a185971
refactor(rust-plugin): drop the input-source-map debug-label path
mellyeliu Nov 6, 2026
230905f
chore(unplugin): leave the bundler integration out of the Rust compil…
mellyeliu Nov 6, 2026
05ca6dc
ci(rust-plugin): check the built addon for build-machine paths
mellyeliu Nov 6, 2026
4404db9
fix(rust-plugin): keep the build path out of the macOS install name
mellyeliu Nov 6, 2026
e30e5a3
test(evaluator): pin hole-first length diagnostics to unchanged Babel
mellyeliu Nov 6, 2026
398b080
test(evaluator): verify both API paths for hole-first diagnostics
mellyeliu Nov 6, 2026
5ad9d6e
fix(evaluator): match Babel diagnostics for hole-first literal lengths
mellyeliu Nov 6, 2026
0889a94
fix(evaluator): preserve the hole-first diagnostic trailing newline
mellyeliu Nov 6, 2026
b800f98
test(evaluator): pin general source-hole refusals to executed Babel
mellyeliu Nov 6, 2026
02e695a
test(evaluator): distinguish receiver-hole calls from spread-operand …
mellyeliu Nov 6, 2026
6a6c6d8
fix(evaluator): refuse source-literal holes consistently with Babel
mellyeliu Nov 6, 2026
d746554
test(evaluator): keep argument-hole faults distinct from receiver calls
mellyeliu Nov 6, 2026
80449fb
test(evaluator): preserve base frames for spread-operand hole faults
mellyeliu Nov 6, 2026
2f63565
fix(evaluator): retain base formatting for spread-operand hole failures
mellyeliu Nov 6, 2026
4e1b197
docs(rust-plugin): mark the patched SWC parser files as modified
mellyeliu Nov 6, 2026
22c456d
docs(rust-plugin): trim comments
mellyeliu Nov 6, 2026
a35edd0
docs(rust-plugin): trim comments in the Rust integration tests
mellyeliu Nov 6, 2026
5a9700a
docs(rust-plugin): trim comments in the small vendored crates
mellyeliu Nov 6, 2026
d2f8054
docs(rust-plugin): trim comments in stylex-constants and stylex-struc…
mellyeliu Nov 6, 2026
f7c2fe2
docs(stylex-transform): trim comments
mellyeliu Nov 6, 2026
1438f1e
docs(stylex-css): trim comments
mellyeliu Nov 6, 2026
2e07587
docs(stylex-css-parser): trim comments
mellyeliu Nov 6, 2026
3ca5e15
docs(evaluator): trim comments
mellyeliu Nov 6, 2026
05de5d3
docs(rust-plugin): tighten the README, provenance, notice and vendor …
mellyeliu Nov 6, 2026
ba18368
chore(rust-plugin): deduplicate the dependency license texts
mellyeliu Nov 6, 2026
cd983d3
fix(rust-plugin): make the license check independent of cargo's color…
mellyeliu Nov 6, 2026
04708ad
perf(rust-plugin): compare the re-parsed module without copying it
mellyeliu Nov 6, 2026
6c707b3
test(rust-plugin): drop copied tests whose coverage is already covered
mellyeliu Nov 6, 2026
e5b07cc
test(rust-plugin): drop copied test functions whose coverage is alrea…
mellyeliu Nov 6, 2026
5845f0c
test(rust-plugin): keep platform-specific tests the Linux coverage ma…
mellyeliu Nov 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ module.exports = {
'**/*.d.ts',
'**/pages.gen.ts',
'**/devtools-extension/extension/**',
// Test fixtures of the vendored StyleX SWC crates
'packages/@stylexjs/rust-plugin/crates/**/fixtures/**',
],
overrides: [
{
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/rust-compiler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: rust-compiler

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'packages/@stylexjs/rust-plugin/**'
- 'packages/@stylexjs/babel-plugin/**'
- 'packages/@stylexjs/shared/**'
- 'packages/style-value-parser/**'
- '.github/workflows/rust-compiler.yml'
push:
branches: ['main', 'feat/stylex-rust-port']
paths:
- 'packages/@stylexjs/rust-plugin/**'
- 'packages/@stylexjs/babel-plugin/**'
- 'packages/@stylexjs/shared/**'
- 'packages/style-value-parser/**'
- '.github/workflows/rust-compiler.yml'

permissions:
contents: read

jobs:
native:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['22.x', '24.x']
runs-on: ${{ matrix.os }}
timeout-minutes: 90
defaults:
run:
shell: bash
env:
CARGO_BUILD_JOBS: '2'
steps:
# Keep sources byte-identical to the repository (rustfmt checks Unix
# newlines) and allow the deepest vendored paths.
- name: Configure Git for Windows checkouts
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --system core.longpaths true
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node }}
cache: yarn
cache-dependency-path: yarn.lock
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: '1.96.1'
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: packages/@stylexjs/rust-plugin
# Formatting and lint fail fast, before the release build.
- name: Rust formatting
run:
cargo fmt --manifest-path packages/@stylexjs/rust-plugin/Cargo.toml --
--check
- name: Rust lint
run: |
cargo clippy --locked --manifest-path packages/@stylexjs/rust-plugin/Cargo.toml --all-targets -- -D warnings
cargo clippy --locked --manifest-path packages/@stylexjs/rust-plugin/Cargo.toml --features node --lib -- -D warnings
- run: corepack prepare yarn@1.22.22 --activate
- run: yarn install --frozen-lockfile --ignore-scripts
- name: Build the JavaScript packages the suites import
run:
npm run build --workspace=style-value-parser
--workspace=@stylexjs/shared --workspace=@stylexjs/stylex
--workspace=@stylexjs/babel-plugin
- name: Build native compiler
env:
STYLEX_NATIVE_TEST_HOOKS: '1'
run: npm run build:native --workspace=@stylexjs/rust-plugin
- name: Check the addon for build-machine paths
run: node packages/@stylexjs/rust-plugin/scripts/check-binary-paths.cjs
- name: Rust dependency license inventory is current
if: runner.os == 'Linux' && matrix.node == '24.x'
working-directory: packages/@stylexjs/rust-plugin
# The build fetched only Linux crates; the inventory covers every target.
run: |
cargo fetch --locked
node scripts/licenses.cjs --check
# The unchanged JS suite hardcodes POSIX paths in snapshots and mocks, so
# it does not pass on Windows even with the JS compiler; there the native
# run is compared test for test against the JS compiler instead.
- name: Current Babel reference suite
if: runner.os != 'Windows'
run: node packages/@stylexjs/rust-plugin/scripts/parity.cjs babel
- name:
Rust, native API, bundler, and unchanged Babel suites on the native
compiler
env:
STYLEX_PARITY_MODE:
${{ runner.os == 'Windows' && 'compare' || 'rust' }}
run: npm run test:native --workspace=@stylexjs/rust-plugin

node18:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '18.x'
cache: yarn
cache-dependency-path: yarn.lock
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: '1.96.1'
- uses: Swatinem/rust-cache@v2
with:
workspaces: packages/@stylexjs/rust-plugin
- run: corepack prepare yarn@1.22.22 --activate
- run: yarn install --frozen-lockfile --ignore-scripts --ignore-engines
- name: Build the JavaScript packages the suites import
run:
npm run build --workspace=style-value-parser
--workspace=@stylexjs/shared --workspace=@stylexjs/stylex
--workspace=@stylexjs/babel-plugin
- run: npm run build:native --workspace=@stylexjs/rust-plugin
env:
STYLEX_NATIVE_TEST_HOOKS: '1'
- name:
Native API, Babel adapter, and bundler plugin on the oldest supported
Node
run:
node --test
packages/@stylexjs/rust-plugin/tests/babel_facade_current.cjs
packages/@stylexjs/rust-plugin/tests/native_api_current.cjs
packages/@stylexjs/rust-plugin/tests/host_boundary_current.cjs
packages/@stylexjs/rust-plugin/tests/babel_validation_current.cjs
packages/@stylexjs/rust-plugin/tests/creation_data_boundary_current.cjs
packages/@stylexjs/rust-plugin/tests/compiled_consumer_current.cjs
packages/@stylexjs/rust-plugin/tests/named_env_callee_site_current.cjs
packages/@stylexjs/rust-plugin/tests/host_memo_current.cjs
packages/@stylexjs/rust-plugin/tests/creation_callback_effects_current.cjs
packages/@stylexjs/rust-plugin/tests/theme_projection_current.cjs
packages/@stylexjs/rust-plugin/tests/count_refusal_current.cjs
packages/@stylexjs/rust-plugin/tests/memo_parameter_identity_current.cjs
13 changes: 13 additions & 0 deletions .github/workflows/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ extend-exclude = [
"packages/**/__tests__/",
# Fixture data has lots of typos
"packages/benchmarks/**/fixtures/",
# Vendored third-party crate
"packages/@stylexjs/rust-plugin/vendor/",
# Vendored StyleX SWC crates: upstream identifiers and test data
"packages/@stylexjs/rust-plugin/crates/",
# Third-party crate names and verbatim license texts
"packages/@stylexjs/rust-plugin/LICENSE_PROVENANCE.json",
"packages/@stylexjs/rust-plugin/RUST_DEPENDENCY_LICENSES.md",
"packages/@stylexjs/rust-plugin/scripts/licenses-supplement.json",
"packages/@stylexjs/rust-plugin/THIRD_PARTY_NOTICES.md",
]

[default.extend-words]
# Ignore false-positives
stylex = "stylex"
nd = "nd"

[default.extend-identifiers]
# A generated StyleX variable hash used in test fixtures
kLKAdn = "kLKAdn"
7 changes: 7 additions & 0 deletions packages/@stylexjs/rust-plugin/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Every text file in this package is LF in the working tree, on Windows as well,
# matching the vendored stylex-swc-plugin. Git decides what is text by content.
* text=auto eol=lf
vendor/** -text
tests/fixtures/** -text
# Verbatim third-party license texts, some with CRLF line endings.
RUST_DEPENDENCY_LICENSES.md -text
5 changes: 5 additions & 0 deletions packages/@stylexjs/rust-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target/
/native/
*.tgz
!crates/stylex-path-resolver/fixtures/**/node_modules
!crates/stylex-path-resolver/fixtures/**/node_modules/**
Loading
Loading