From 9b4beb83e92b224d754c98ad4a346978353e854b Mon Sep 17 00:00:00 2001 From: Markus <28785953+MarkusJx@users.noreply.github.com> Date: Mon, 9 Oct 2023 05:18:34 +0200 Subject: [PATCH] chore(napi): make napi_register_module_v1 pub (#1747) * feat(napi): make napi_register_module_v1 pub * docs: add safety section * chore: format doc comment --- crates/napi/src/bindgen_runtime/module_register.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/napi/src/bindgen_runtime/module_register.rs b/crates/napi/src/bindgen_runtime/module_register.rs index a5bbba31..aa4f3e8c 100644 --- a/crates/napi/src/bindgen_runtime/module_register.rs +++ b/crates/napi/src/bindgen_runtime/module_register.rs @@ -350,7 +350,14 @@ unsafe extern "C" fn napi_register_wasm_v1( #[cfg(not(feature = "noop"))] #[no_mangle] -unsafe extern "C" fn napi_register_module_v1( +/// Register the n-api module exports. +/// +/// # Safety +/// This method is meant to be called by Node.js while importing the n-api module. +/// Only call this method if the current module is **not** imported by a node-like runtime. +/// +/// Arguments `env` and `exports` must **not** be null. +pub unsafe extern "C" fn napi_register_module_v1( env: sys::napi_env, exports: sys::napi_value, ) -> sys::napi_value {