#compiler #framework #jsx #javascript #surplus

bin+lib surplus-compiler

Surplus javascript framework core compiler transform

2 unstable releases

0.2.0 Jan 19, 2024
0.1.0 Jan 6, 2024

#2165 in Development tools

Custom license

31KB
623 lines

Surplus Compiler

This is the base Surplus compiler transformer logic, and a basic CLI utility called surplus-transform.

NOTE: This is only the compiler; it does not include the runtime.

Rust Usage

Check the docs. For now, running cargo doc --open is the best way.

For the CLI utility, run cargo run -- --help for usage.

Javascript Usage

npm install @surplus/compiler

The compiler is usable via a WASM module.

NOTE: The JavaScript package and the Rust crate do not necessarily share the same version numbers. To the extent possible, major and minors will remain synchronized.

import compileSurplus from '@surplus/compiler';

console.log(
	compileSurplus(
		`<div>Hello!</div>`,

		/* Optional arguments (defaults shown) */
		{
			global: '$$S',
			emitRuntimeImport: true
		}
	)
);

License

Licensed under the MIT License.


lib.rs:

The Surplus compiler is an OXC-based transformer that compiles JSX to Surplus runtime calls.

Further, the crate provides a surplus-transform utility for simple and one-off transformations, which takes standard input and writes to standard output.

For more information check https://github.com/surplus.

Dependencies

~8–16MB
~216K SLoC