2020-09-30 15:34:26 +09:00
|
|
|
#[macro_use]
|
|
|
|
extern crate napi_derive;
|
|
|
|
|
2020-12-29 19:03:10 +09:00
|
|
|
use napi::{Env, JsObject, Result};
|
2020-09-30 15:34:26 +09:00
|
|
|
|
2021-06-22 00:09:13 +09:00
|
|
|
#[cfg(all(
|
|
|
|
target_arch = "x86_64",
|
|
|
|
not(target_env = "musl"),
|
|
|
|
not(debug_assertions)
|
|
|
|
))]
|
2020-12-21 17:10:30 +09:00
|
|
|
#[global_allocator]
|
|
|
|
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
|
|
|
|
2020-09-30 15:34:26 +09:00
|
|
|
mod async_compute;
|
2020-12-21 17:10:30 +09:00
|
|
|
mod buffer;
|
2021-05-14 00:36:39 +09:00
|
|
|
mod create_array;
|
2020-12-29 19:03:10 +09:00
|
|
|
mod get_set_property;
|
2021-05-14 00:36:39 +09:00
|
|
|
mod get_value_from_js;
|
2020-09-30 15:34:26 +09:00
|
|
|
mod noop;
|
|
|
|
mod plus;
|
2021-06-03 00:03:47 +09:00
|
|
|
mod query;
|
2020-09-30 15:34:26 +09:00
|
|
|
|
2020-11-25 18:42:14 +09:00
|
|
|
#[module_exports]
|
2020-12-29 19:03:10 +09:00
|
|
|
fn init(mut exports: JsObject, env: Env) -> Result<()> {
|
2020-11-25 18:42:14 +09:00
|
|
|
exports.create_named_method("noop", noop::noop)?;
|
2020-09-30 15:34:26 +09:00
|
|
|
|
2020-11-25 18:42:14 +09:00
|
|
|
async_compute::register_js(&mut exports)?;
|
2020-12-21 17:10:30 +09:00
|
|
|
buffer::register_js(&mut exports)?;
|
2020-11-25 18:42:14 +09:00
|
|
|
plus::register_js(&mut exports)?;
|
2020-12-29 19:03:10 +09:00
|
|
|
get_set_property::register_js(&mut exports, &env)?;
|
2021-05-14 00:36:39 +09:00
|
|
|
create_array::register_js(&mut exports)?;
|
|
|
|
get_value_from_js::register_js(&mut exports)?;
|
2021-06-03 00:03:47 +09:00
|
|
|
query::register_js(&mut exports)?;
|
2020-09-30 15:34:26 +09:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|