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
40 changes: 16 additions & 24 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ wasmtime-wasi = "49.0.2"
wasmtime-wizer = "49.0.2"
wasm-opt = "0.116.1"
anyhow = "1.0"
javy = { path = "crates/javy", version = "8.1.1-alpha.1" }
javy = { path = "crates/javy", version = "9.0.0-alpha.1" }
tempfile = "3.27.0"
tokio = "1"
uuid = { version = "1.23", features = ["v4"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/dylib_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn test_dylib_with_error() -> Result<()> {
assert!(res.is_err());

let e = res.err().unwrap();
let expected_log_output = "Error: foo error\n at foo (function.mjs:1:27)\n at <anonymous> (function.mjs:1:49)\n\n";
let expected_log_output = "Error: foo error\n at foo (function.mjs:1:28)\n at <anonymous> (function.mjs:1:49)\n\n";
assert_eq!(
expected_log_output,
e.downcast_ref::<RunnerError>().unwrap().stderr
Expand Down
10 changes: 5 additions & 5 deletions crates/cli/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn test_empty(builder: &mut Builder) -> Result<()> {
let mut runner = builder.input("empty.js").build()?;

let (_, _, fuel_consumed) = run(&mut runner, vec![]);
assert_fuel_consumed_within_threshold(18_909, fuel_consumed);
assert_fuel_consumed_within_threshold(16_943, fuel_consumed);
Ok(())
}

Expand All @@ -31,7 +31,7 @@ fn test_fib(builder: &mut Builder) -> Result<()> {

let (output, _, fuel_consumed) = run_with_u8s(&mut runner, 5);
assert_eq!(8, output);
assert_fuel_consumed_within_threshold(64_557, fuel_consumed);
assert_fuel_consumed_within_threshold(61_850, fuel_consumed);
Ok(())
}

Expand Down Expand Up @@ -81,7 +81,7 @@ fn test_console_log(builder: &mut Builder) -> Result<()> {
let (output, logs, fuel_consumed) = run(&mut runner, vec![]);
assert_eq!(b"hello world from console.log\n".to_vec(), output);
assert_eq!("hello world from console.error\n", logs.as_str());
assert_fuel_consumed_within_threshold(30_652, fuel_consumed);
assert_fuel_consumed_within_threshold(29_037, fuel_consumed);
Ok(())
}

Expand Down Expand Up @@ -337,7 +337,7 @@ fn test_exported_default_arrow_fn(builder: &mut Builder) -> Result<()> {

let (_, logs, fuel_consumed) = run_fn(&mut runner, "default", vec![]);
assert_eq!(logs, "42\n");
assert_fuel_consumed_within_threshold(33_889, fuel_consumed);
assert_fuel_consumed_within_threshold(31_151, fuel_consumed);
Ok(())
}

Expand All @@ -350,7 +350,7 @@ fn test_exported_default_fn(builder: &mut Builder) -> Result<()> {
.build()?;
let (_, logs, fuel_consumed) = run_fn(&mut runner, "default", vec![]);
assert_eq!(logs, "42\n");
assert_fuel_consumed_within_threshold(35_195, fuel_consumed);
assert_fuel_consumed_within_threshold(32_857, fuel_consumed);
Ok(())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ expression: wat
(type (;0;) (func))
(type (;1;) (func (param i32 i32 i32 i32) (result i32)))
(type (;2;) (func (param i32 i32 i32 i32 i32)))
(import "javy-default-plugin-v4" "cabi_realloc" (func (;0;) (type 1) (param i32 i32 i32 i32) (result i32)))
(import "javy-default-plugin-v4" "invoke" (func (;1;) (type 2) (param i32 i32 i32 i32 i32)))
(import "javy-default-plugin-v4" "memory" (memory (;0;) 0))
(import "javy-default-plugin-v5" "cabi_realloc" (func (;0;) (type 1) (param i32 i32 i32 i32) (result i32)))
(import "javy-default-plugin-v5" "invoke" (func (;1;) (type 2) (param i32 i32 i32 i32 i32)))
(import "javy-default-plugin-v5" "memory" (memory (;0;) 0))
(export "_start" (func 4))
(export "log" (func 2))
(export "log2" (func 3))
Expand Down Expand Up @@ -88,7 +88,7 @@ expression: wat
i32.const 0
call 1
)
(data (;0;) "\1a\c7\14e}\07\01\18function.mjs\01\06log\01\08log2\01\0econsole\01(Hello from function!\01*Hello from function2!\014Hello from top-level scope\0d\e4\03\00\02\00\00\e6\03\00\01\e8\03\00\00\00\0c \0a\01\a8\01\00\00\00\03\00\02\02\1f\00\e6\03\00\06\e8\03\01\06\0cC\0a\01\e6\03\00\00\00\03\00\00\00\13\008\f5\00\00\00A\f3\00\00\00\04\f6\00\00\00$\01\00)\e4\03\01\07\04\03\034\10\00\0cC\0a\01\e8\03\00\00\00\03\00\00\00\13\008\f5\00\00\00A\f3\00\00\00\04\f7\00\00\00$\01\00)\e4\03\05\08\04\03\054\10\00\08\f0\08\c5\00\e7\c5\01\e8)8\f5\00\00\00A\f3\00\00\00\04\f8\00\00\00$\01\00\0e\06/\e4\03\01\01\06\00\0a\10\004\10\00")
(data (;0;) "\1c\c7\14e}\07\01\18function.mjs\01\06log\01\08log2\01\0econsole\01(Hello from function!\01*Hello from function2!\014Hello from top-level scope\0d\e4\03\00\02\00\00\e6\03\00\01\e8\03\00\00\00\0c \0a\01\a8\01\00\00\00\03\00\02\02\1f\00\e6\03\00\06\e8\03\01\06\0cC\0a\01\e6\03\00\00\00\03\00\00\00\13\008\f5\00\00\00A\f3\00\00\00\04\f6\00\00\00$\01\00)\e4\03\01\07\04\03\034\10\00\0cC\0a\01\e8\03\00\00\00\03\00\00\00\13\008\f5\00\00\00A\f3\00\00\00\04\f7\00\00\00$\01\00)\e4\03\05\08\04\03\054\10\00\08\f0\08\c5\00\e7\c5\01\e8)8\f5\00\00\00A\f3\00\00\00\04\f8\00\00\00$\01\00\0e\06/\e4\03\01\01\06\00\0a\10\004\10\00")
(data (;1;) "log")
(data (;2;) "log2")
(@producers
Expand Down
4 changes: 4 additions & 0 deletions crates/javy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Bumped rquickjs to 0.14.0. The bytecode format has changed in a breaking way.

## [8.1.0] - 2026-07-30

### Added
Expand Down
6 changes: 3 additions & 3 deletions crates/javy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "javy"
version = "8.1.1-alpha.1"
version = "9.0.0-alpha.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand All @@ -14,12 +14,12 @@ targets = ["wasip1", "wasip2"]

[dependencies]
anyhow = { workspace = true }
rquickjs = { version = "0.12.0", features = [
rquickjs = { version = "0.14.0", features = [
"array-buffer",
"bindgen",
"disable-assertions",
] }
rquickjs-serde = { version = "0.6.1", optional = true }
rquickjs-serde = { version = "0.8.0", optional = true }
serde = { workspace = true, default-features = true, features = ["derive"] }
serde_json = { workspace = true, optional = true }
serde-transcode = { version = "1.1", optional = true }
Expand Down
8 changes: 5 additions & 3 deletions crates/javy/src/apis/stream_io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ fn write(args: Args<'_>) -> Result<Value<'_>> {
.as_object()
.ok_or_else(|| anyhow!("Data must be an Object"))?
.as_array_buffer()
.ok_or_else(|| anyhow!("Data must be an ArrayBuffer"))?
.as_bytes()
.ok_or_else(|| anyhow!("Could not represent data as &[u8]"))?;
.ok_or_else(|| anyhow!("Data must be an ArrayBuffer"))?;
// SAFETY: No JavaScript runs while the slice is alive; it is only read by
// the synchronous stdout/stderr write below.
let data =
unsafe { data.as_bytes() }.ok_or_else(|| anyhow!("Could not represent data as &[u8]"))?;

let offset = offset
.as_number()
Expand Down
6 changes: 4 additions & 2 deletions crates/javy/src/apis/text_encoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ fn decode(args: Args<'_>) -> Result<Value<'_>> {
.as_object()
.ok_or_else(|| anyhow!("buffer must be an object"))?
.as_array_buffer()
.ok_or_else(|| anyhow!("buffer must be an ArrayBuffer"))?
.as_bytes()
.ok_or_else(|| anyhow!("buffer must be an ArrayBuffer"))?;
// SAFETY: No JavaScript runs while the slice is alive; it is only read
// during UTF-8 decoding below.
let buffer = unsafe { buffer.as_bytes() }
.ok_or_else(|| anyhow!("Couldn't retrive &[u8] from buffer"))?;

let byte_offset = args[1]
Expand Down
6 changes: 6 additions & 0 deletions crates/plugin-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Updated `javy` to 9.0.0-alpha.1, which bumps rquickjs to 0.14.0. If you are
using a plugin for dynamic linking, you are strongly encouraged to change
the import namespace.

## [7.1.0] - 2026-06-30

### Added
Expand Down
2 changes: 1 addition & 1 deletion crates/plugin-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "javy-plugin-api"
version = "7.1.1-alpha.1"
version = "8.0.0-alpha.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::shared_config::SharedConfig;

mod shared_config;

import_namespace!("javy-default-plugin-v4");
import_namespace!("javy-default-plugin-v5");

fn config() -> Config {
// Read shared config JSON in from stdin.
Expand Down
2 changes: 1 addition & 1 deletion crates/runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Plugin {
Self::InvalidUser => "invalid-plugin",
// Could try and derive this but not going to for now since tests
// will break if it changes.
Self::Default | Self::DefaultAsUser => "javy-default-plugin-v4",
Self::Default | Self::DefaultAsUser => "javy-default-plugin-v5",
Self::UserWasiP1 { .. } => "test-plugin-wasip1",
Self::UserWasiP2 { .. } => "test-plugin-wasip2",
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs-using-dynamic-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Run:
$ echo 'console.log("hello world!");' > my_code.js
$ javy emit-plugin -o plugin.wasm
$ javy build -C dynamic -C plugin=plugin.wasm -o my_code.wasm my_code.js
$ wasmtime run --preload javy-default-plugin-v4=plugin.wasm my_code.wasm
$ wasmtime run --preload javy-default-plugin-v5=plugin.wasm my_code.wasm
hello world!
```
2 changes: 1 addition & 1 deletion docs/docs-using-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async function runJavy(pluginModule, embeddedModule, input) {
wasi.getImportObject(),
);
const instance = await WebAssembly.instantiate(embeddedModule, {
"javy-default-plugin-v4": pluginInstance.exports,
"javy-default-plugin-v5": pluginInstance.exports,
});

// Javy plugin is a WASI reactor see https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md?plain=1
Expand Down
Loading