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
2 changes: 1 addition & 1 deletion Cargo.standalone.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmer-napi"
version = "0.703.0"
version = "0.704.0"
description = "NAPI library for Wasmer WebAssembly runtime"
edition = "2024"
license = "MIT"
Expand Down
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmer-napi"
version = "0.703.0"
version = "0.704.0"
description = "NAPI library for Wasmer WebAssembly runtime"
edition = "2024"
license = "MIT"
Expand Down Expand Up @@ -36,16 +36,16 @@ cli = [
anyhow = "1"
# This manifest is consumed as `wasmer/lib/napi`, so Wasmer dependencies must
# stay relative to that checkout. Standalone builds use Cargo.standalone.toml.
wasmer = { version = "=7.3.0", path = "../api", default-features = false }
wasmer = { version = "=7.4.0", path = "../api", default-features = false }

# This dependencies are ONLY needed for testing napi in Wasm locally
wasmer-cache = { version = "=7.3.0", path = "../cache", optional = true }
wasmer-c-api-imports = { version = "=7.3.0", path = "../c-api-imports", optional = true, default-features = false }
wasmer-types = { version = "=7.3.0", path = "../types", optional = true }
wasmer-cache = { version = "=7.4.0", path = "../cache", optional = true }
wasmer-c-api-imports = { version = "=7.4.0", path = "../c-api-imports", optional = true, default-features = false }
wasmer-types = { version = "=7.4.0", path = "../types", optional = true }
# Non-optional: the guest callback trampoline re-raises guest WASI process
# exits (`WasiError::Exit`) through the N-API import layers, so `mod guest`
# (always compiled) needs the WASIX error type in every build.
virtual-fs = { version = "=0.703.0", path = "../virtual-fs", optional = true }
virtual-fs = { version = "=0.704.0", path = "../virtual-fs", optional = true }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
enum-iterator = "2.3.0"
offset-allocator = "0.2.0"
Expand All @@ -54,15 +54,15 @@ offset-allocator = "0.2.0"
js-sys = { version = "0.3", optional = true }
wasm-bindgen = { version = "0.2.120", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
wasmer-wasix = { version = "=0.703.0", path = "../wasix", default-features = false, features = [
wasmer-wasix = { version = "=0.704.0", path = "../wasix", default-features = false, features = [
"js",
] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wasmer = { version = "=7.3.0", path = "../api", default-features = false, features = [
wasmer = { version = "=7.4.0", path = "../api", default-features = false, features = [
"sys-default",
] }
wasmer-wasix = { version = "=0.703.0", path = "../wasix", default-features = false, features = [
wasmer-wasix = { version = "=0.704.0", path = "../wasix", default-features = false, features = [
"sys",
] }

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NAPI_NATIVE_TEST_OUT_DIR ?= $(abspath $(BUILD_WASIX_NAPI_DIR)/native)
NAPI_WASIX_TEST_OUT_DIR ?= $(abspath $(BUILD_WASIX_NAPI_DIR)/wasm32-wasix/release)
NAPI_V8_CTEST_ARGS ?= -E 'SandboxGlobalThisAndMarkerAreNotEnumerableForDeepFreeze'
NAPI_QUICKJS_CTEST_ARGS ?= -E 'SandboxGlobalThisAndMarkerAreNotEnumerableForDeepFreeze'
NAPI_V8_PREBUILT_VERSION ?= 11.9.7
NAPI_V8_PREBUILT_VERSION ?= 11.9.8
NAPI_V8_PLATFORM :=
NAPI_V8_DIST_ROOT ?=
NAPI_V8_CARGO_DIST_ROOT ?=
Expand All @@ -37,6 +37,8 @@ endif
else ifeq ($(UNAME_S),Linux)
ifeq ($(UNAME_M),x86_64)
NAPI_V8_PLATFORM := linux-amd64
else ifeq ($(UNAME_M),aarch64)
NAPI_V8_PLATFORM := linux-arm64
endif
endif
ifeq ($(NAPI_V8_DIST_ROOT),)
Expand Down
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
path::{Path, PathBuf},
};

const PREBUILT_V8_VERSION: &str = "11.9.7";
const PREBUILT_V8_VERSION: &str = "11.9.8";

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum V8Method {
Expand Down Expand Up @@ -391,6 +391,7 @@ fn prebuilt_asset_name() -> Result<(&'static str, &'static str), String> {
("macos", "aarch64", _) => Ok(("v8-darwin-aarch64.tar.xz", "darwin-arm64")),
("macos", "x86_64", _) => Ok(("v8-darwin-amd64.tar.xz", "darwin-amd64")),
("linux", "x86_64", "gnu") => Ok(("v8-linux-amd64.tar.xz", "linux-amd64")),
("linux", "aarch64", "gnu") => Ok(("v8-linux-arm64.tar.xz", "linux-arm64")),
("linux", "x86_64", "musl") => Ok(("v8-linux-musl-amd64.tar.xz", "linux-musl-amd64")),
("android", "aarch64", _) => Ok(("v8-android-arm64.tar.xz", "android-arm64")),
("windows", "x86_64", _) => Ok(("v8-windows-amd64.tar.xz", "windows-amd64")),
Expand Down
8 changes: 4 additions & 4 deletions src/guest/napi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ fn guest_napi_create_string_utf8(
let s = unsafe {
snapi_bridge_create_string_utf8(
snapi_env(&env, e),
sb.as_ptr() as *const i8,
sb.as_ptr() as *const std::ffi::c_char,
sb.len() as u32,
&mut out,
)
Expand Down Expand Up @@ -1821,7 +1821,7 @@ fn guest_napi_create_string_latin1(
let s = unsafe {
snapi_bridge_create_string_latin1(
snapi_env(&env, e),
sb.as_ptr() as *const i8,
sb.as_ptr() as *const std::ffi::c_char,
sb.len() as u32,
&mut out,
)
Expand Down Expand Up @@ -3560,7 +3560,7 @@ fn guest_napi_define_class(
};

let mut prop_names_c: Vec<CString> = Vec::with_capacity(pc as usize);
let mut prop_names_ptrs: Vec<*const i8> = Vec::with_capacity(pc as usize);
let mut prop_names_ptrs: Vec<*const std::ffi::c_char> = Vec::with_capacity(pc as usize);
let mut prop_name_ids: Vec<u32> = Vec::with_capacity(pc as usize);
let mut prop_types: Vec<u32> = Vec::with_capacity(pc as usize);
let mut prop_value_ids: Vec<u32> = Vec::with_capacity(pc as usize);
Expand Down Expand Up @@ -3746,7 +3746,7 @@ fn guest_napi_define_properties(
};

let mut prop_names_c: Vec<CString> = Vec::with_capacity(pc as usize);
let mut prop_names_ptrs: Vec<*const i8> = Vec::with_capacity(pc as usize);
let mut prop_names_ptrs: Vec<*const std::ffi::c_char> = Vec::with_capacity(pc as usize);
let mut prop_name_ids: Vec<u32> = Vec::with_capacity(pc as usize);
let mut prop_types: Vec<u32> = Vec::with_capacity(pc as usize);
let mut prop_value_ids: Vec<u32> = Vec::with_capacity(pc as usize);
Expand Down
42 changes: 25 additions & 17 deletions src/snapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// C++ bridge FFI declarations (from napi_bridge_init.cc)
// ============================================================

use core::ffi::c_void;
use core::ffi::{c_char, c_void};

#[repr(C)]
pub struct SnapiEnvState {
Expand Down Expand Up @@ -54,7 +54,7 @@ unsafe extern "C" {
pub fn snapi_bridge_init() -> i32;
pub fn snapi_bridge_set_v8_worker_thread_count(count: u32) -> i32;
pub fn snapi_bridge_unofficial_configure_runtime(
engine_flags: *const i8,
engine_flags: *const c_char,
engine_flags_length: u32,
) -> i32;
pub fn snapi_bridge_unofficial_create_env(
Expand Down Expand Up @@ -162,7 +162,7 @@ unsafe extern "C" {
) -> i32;
pub fn snapi_bridge_unofficial_create_private_symbol(
env: SnapiEnv,
str_ptr: *const i8,
str_ptr: *const c_char,
wasm_length: u32,
out_id: *mut u32,
) -> i32;
Expand Down Expand Up @@ -431,13 +431,13 @@ unsafe extern "C" {
pub fn snapi_bridge_get_global(env: SnapiEnv, out_id: *mut u32) -> i32;
pub fn snapi_bridge_create_string_utf8(
env: SnapiEnv,
str_ptr: *const i8,
str_ptr: *const c_char,
wasm_length: u32,
out_id: *mut u32,
) -> i32;
pub fn snapi_bridge_create_string_latin1(
env: SnapiEnv,
str_ptr: *const i8,
str_ptr: *const c_char,
wasm_length: u32,
out_id: *mut u32,
) -> i32;
Expand All @@ -456,14 +456,14 @@ unsafe extern "C" {
pub fn snapi_bridge_get_value_string_utf8(
env: SnapiEnv,
id: u32,
buf: *mut i8,
buf: *mut c_char,
bufsize: usize,
result: *mut usize,
) -> i32;
pub fn snapi_bridge_get_value_string_latin1(
env: SnapiEnv,
id: u32,
buf: *mut i8,
buf: *mut c_char,
bufsize: usize,
result: *mut usize,
) -> i32;
Expand Down Expand Up @@ -521,19 +521,19 @@ unsafe extern "C" {
pub fn snapi_bridge_set_named_property(
env: SnapiEnv,
obj_id: u32,
name: *const i8,
name: *const c_char,
val_id: u32,
) -> i32;
pub fn snapi_bridge_get_named_property(
env: SnapiEnv,
obj_id: u32,
name: *const i8,
name: *const c_char,
out_id: *mut u32,
) -> i32;
pub fn snapi_bridge_has_named_property(
env: SnapiEnv,
obj_id: u32,
name: *const i8,
name: *const c_char,
result: *mut i32,
) -> i32;
pub fn snapi_bridge_set_element(env: SnapiEnv, obj_id: u32, index: u32, val_id: u32) -> i32;
Expand Down Expand Up @@ -591,9 +591,17 @@ unsafe extern "C" {
out_id: *mut u32,
) -> i32;
pub fn snapi_bridge_throw(env: SnapiEnv, error_id: u32) -> i32;
pub fn snapi_bridge_throw_error(env: SnapiEnv, code: *const i8, msg: *const i8) -> i32;
pub fn snapi_bridge_throw_type_error(env: SnapiEnv, code: *const i8, msg: *const i8) -> i32;
pub fn snapi_bridge_throw_range_error(env: SnapiEnv, code: *const i8, msg: *const i8) -> i32;
pub fn snapi_bridge_throw_error(env: SnapiEnv, code: *const c_char, msg: *const c_char) -> i32;
pub fn snapi_bridge_throw_type_error(
env: SnapiEnv,
code: *const c_char,
msg: *const c_char,
) -> i32;
pub fn snapi_bridge_throw_range_error(
env: SnapiEnv,
code: *const c_char,
msg: *const c_char,
) -> i32;
pub fn snapi_bridge_is_exception_pending(env: SnapiEnv, result: *mut i32) -> i32;
pub fn snapi_bridge_get_and_clear_last_exception(env: SnapiEnv, out_id: *mut u32) -> i32;
// Symbol
Expand Down Expand Up @@ -941,7 +949,7 @@ unsafe extern "C" {
// Callback system
pub fn snapi_bridge_create_function(
env: SnapiEnv,
utf8name: *const i8,
utf8name: *const c_char,
name_len: u32,
reg_id: u32,
out_id: *mut u32,
Expand Down Expand Up @@ -979,11 +987,11 @@ unsafe extern "C" {
// napi_define_class
pub fn snapi_bridge_define_class(
env: SnapiEnv,
utf8name: *const i8,
utf8name: *const c_char,
name_len: u32,
ctor_reg_id: u32,
prop_count: u32,
prop_names: *const *const i8,
prop_names: *const *const c_char,
prop_name_ids: *const u32,
prop_types: *const u32,
prop_value_ids: *const u32,
Expand All @@ -997,7 +1005,7 @@ unsafe extern "C" {
env: SnapiEnv,
obj_id: u32,
prop_count: u32,
prop_names: *const *const i8,
prop_names: *const *const c_char,
prop_name_ids: *const u32,
prop_types: *const u32,
prop_value_ids: *const u32,
Expand Down
5 changes: 4 additions & 1 deletion tests/build-test-native.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

PREBUILT_V8_VERSION="11.9.7"
PREBUILT_V8_VERSION="11.9.8"

if [[ $# -ne 1 ]]; then
echo "usage: $0 <test-name>" >&2
Expand Down Expand Up @@ -84,6 +84,9 @@ resolve_cached_prebuilt_v8() {
linux/x86_64)
platform_name="linux-amd64"
;;
linux/aarch64)
platform_name="linux-arm64"
;;
*)
return 1
;;
Expand Down
12 changes: 10 additions & 2 deletions v8/cmake/NapiV8Resolver.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(NAPI_V8_PREBUILT_VERSION "11.9.2")
set(NAPI_V8_PREBUILT_VERSION "11.9.8")
set(NAPI_V8_PREBUILT_BASE_URL
"https://github.com/wasmerio/v8-custom-builds/releases/download/${NAPI_V8_PREBUILT_VERSION}")

Expand Down Expand Up @@ -109,7 +109,15 @@ function(_napi_v8_prebuilt_strategy out_ok out_include out_library out_extra out
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))
set(_platform "darwin-arm64")
set(_asset "v8-darwin-arm64.tar.xz")
set(_asset "v8-darwin-aarch64.tar.xz")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"))
set(_platform "darwin-amd64")
set(_asset "v8-darwin-amd64.tar.xz")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))
set(_platform "linux-arm64")
set(_asset "v8-linux-arm64.tar.xz")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"))
set(_platform "linux-amd64")
Expand Down
Loading