2018-04-28 17:26:38 +09:00
|
|
|
#[macro_use]
|
2020-07-15 01:43:20 +09:00
|
|
|
extern crate napi;
|
2020-04-26 21:21:45 +09:00
|
|
|
#[macro_use]
|
2020-07-15 01:43:20 +09:00
|
|
|
extern crate napi_derive;
|
2020-08-26 01:07:27 +09:00
|
|
|
#[macro_use]
|
|
|
|
extern crate serde_derive;
|
2018-04-28 17:26:38 +09:00
|
|
|
|
2020-09-02 18:05:53 +09:00
|
|
|
use napi::{Module, Result};
|
2020-07-01 21:44:29 +09:00
|
|
|
|
2020-07-03 01:31:50 +09:00
|
|
|
#[cfg(napi4)]
|
|
|
|
mod libuv;
|
2020-07-08 01:59:09 +09:00
|
|
|
#[cfg(napi4)]
|
|
|
|
mod napi4;
|
2020-07-01 21:44:29 +09:00
|
|
|
#[cfg(napi5)]
|
|
|
|
mod napi5;
|
2020-07-10 20:14:32 +09:00
|
|
|
#[cfg(napi6)]
|
|
|
|
mod napi6;
|
2020-08-26 01:07:27 +09:00
|
|
|
#[cfg(napi4)]
|
|
|
|
mod tokio_rt;
|
2018-04-28 17:26:38 +09:00
|
|
|
|
2020-06-21 20:10:06 +09:00
|
|
|
mod buffer;
|
2020-08-03 00:31:22 +09:00
|
|
|
mod class;
|
2020-07-18 03:00:48 +09:00
|
|
|
mod either;
|
2020-09-02 18:05:53 +09:00
|
|
|
mod env;
|
|
|
|
mod error;
|
2020-06-21 20:10:06 +09:00
|
|
|
mod external;
|
2020-07-08 01:59:09 +09:00
|
|
|
mod function;
|
|
|
|
mod napi_version;
|
2020-09-02 18:05:53 +09:00
|
|
|
mod object;
|
2020-08-26 01:07:27 +09:00
|
|
|
mod serde;
|
2020-08-03 15:34:58 +09:00
|
|
|
mod string;
|
2020-06-21 20:10:06 +09:00
|
|
|
mod symbol;
|
|
|
|
mod task;
|
2018-04-28 17:26:38 +09:00
|
|
|
|
2020-07-08 01:59:09 +09:00
|
|
|
use napi_version::get_napi_version;
|
2020-05-11 01:28:06 +09:00
|
|
|
|
2020-06-21 20:10:06 +09:00
|
|
|
register_module!(test_module, init);
|
2020-05-11 01:28:06 +09:00
|
|
|
|
2020-06-21 20:10:06 +09:00
|
|
|
fn init(module: &mut Module) -> Result<()> {
|
2020-07-03 01:31:50 +09:00
|
|
|
module.create_named_method("getNapiVersion", get_napi_version)?;
|
2020-09-02 18:05:53 +09:00
|
|
|
error::register_js(module)?;
|
|
|
|
string::register_js(module)?;
|
|
|
|
serde::register_js(module)?;
|
|
|
|
task::register_js(module)?;
|
|
|
|
external::register_js(module)?;
|
|
|
|
buffer::register_js(module)?;
|
|
|
|
either::register_js(module)?;
|
|
|
|
symbol::register_js(module)?;
|
|
|
|
function::register_js(module)?;
|
|
|
|
class::register_js(module)?;
|
|
|
|
env::register_js(module)?;
|
|
|
|
object::register_js(module)?;
|
2020-07-03 01:31:50 +09:00
|
|
|
#[cfg(napi4)]
|
2020-09-02 18:05:53 +09:00
|
|
|
napi4::register_js(module)?;
|
2020-07-03 01:31:50 +09:00
|
|
|
#[cfg(napi4)]
|
2020-09-02 18:05:53 +09:00
|
|
|
tokio_rt::register_js(module)?;
|
2020-07-08 01:59:09 +09:00
|
|
|
#[cfg(napi4)]
|
2020-09-02 18:05:53 +09:00
|
|
|
libuv::read_file::register_js(module)?;
|
2020-07-01 21:44:29 +09:00
|
|
|
#[cfg(napi5)]
|
2020-09-02 18:05:53 +09:00
|
|
|
napi5::register_js(module)?;
|
2020-07-10 20:14:32 +09:00
|
|
|
#[cfg(napi6)]
|
2020-09-02 18:05:53 +09:00
|
|
|
napi6::register_js(module)?;
|
2020-06-21 20:10:06 +09:00
|
|
|
Ok(())
|
2018-04-28 17:26:38 +09:00
|
|
|
}
|