4719caa643
* feat(napi): support to use tuple with either (#1993) `Either` uses `ValidateNapiValue` + `TypeName` to validate and report error on value not being matched. So there's no way to remove these super traits from it. So I implemented these types to `Tuple` types. * feat(napi): support `Return` generic of ThreadsafeFunction * depracate JsFunction * CalleeHandled tsfn should handle Result in callback * Pass env to call_with_return_value callback * Fix compile * clippy fix * Fix electron test * Function args --------- Co-authored-by: Hana <andywangsy@gmail.com>
77 lines
1.8 KiB
Rust
77 lines
1.8 KiB
Rust
#![allow(unused_variables)]
|
|
#![allow(clippy::uninlined_format_args)]
|
|
#![allow(deprecated)]
|
|
|
|
#[macro_use]
|
|
extern crate napi_derive;
|
|
#[macro_use]
|
|
extern crate serde_derive;
|
|
|
|
use napi::{Env, JsObject, Result};
|
|
|
|
mod cleanup_env;
|
|
#[cfg(feature = "latest")]
|
|
mod napi4;
|
|
#[cfg(feature = "latest")]
|
|
mod napi5;
|
|
#[cfg(feature = "latest")]
|
|
mod napi6;
|
|
#[cfg(feature = "latest")]
|
|
mod napi7;
|
|
#[cfg(feature = "latest")]
|
|
mod napi8;
|
|
#[cfg(feature = "latest")]
|
|
mod tokio_rt;
|
|
|
|
mod array;
|
|
mod arraybuffer;
|
|
mod buffer;
|
|
mod class;
|
|
mod either;
|
|
mod env;
|
|
mod error;
|
|
mod external;
|
|
mod function;
|
|
mod global;
|
|
mod napi_version;
|
|
mod object;
|
|
mod serde;
|
|
mod string;
|
|
mod symbol;
|
|
mod task;
|
|
|
|
use napi_version::get_napi_version;
|
|
|
|
#[module_exports]
|
|
fn init(mut exports: JsObject, env: Env) -> Result<()> {
|
|
exports.create_named_method("getNapiVersion", get_napi_version)?;
|
|
array::register_js(&mut exports)?;
|
|
error::register_js(&mut exports)?;
|
|
string::register_js(&mut exports)?;
|
|
serde::register_js(&mut exports)?;
|
|
task::register_js(&mut exports)?;
|
|
external::register_js(&mut exports)?;
|
|
arraybuffer::register_js(&mut exports)?;
|
|
buffer::register_js(&mut exports)?;
|
|
either::register_js(&mut exports)?;
|
|
symbol::register_js(&mut exports)?;
|
|
function::register_js(&mut exports)?;
|
|
class::register_js(&mut exports)?;
|
|
env::register_js(&mut exports)?;
|
|
object::register_js(&mut exports)?;
|
|
global::register_js(&mut exports)?;
|
|
cleanup_env::register_js(&mut exports)?;
|
|
#[cfg(feature = "latest")]
|
|
napi4::register_js(&mut exports, &env)?;
|
|
#[cfg(feature = "latest")]
|
|
tokio_rt::register_js(&mut exports)?;
|
|
#[cfg(feature = "latest")]
|
|
napi5::register_js(&mut exports)?;
|
|
#[cfg(feature = "latest")]
|
|
napi6::register_js(&mut exports)?;
|
|
#[cfg(feature = "latest")]
|
|
napi7::register_js(&mut exports)?;
|
|
#[cfg(feature = "latest")]
|
|
napi8::register_js(&mut exports)?;
|
|
Ok(())
|
|
}
|