docs.rs failed to build deno_napi-0.188.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
deno_napi-0.187.0
napi
This directory contains source for Deno's Node-API implementation. It depends on
napi_sym and deno_napi.
Files are generally organized the same as in Node.js's implementation to ease in ensuring compatibility.
Adding a new function
Add the symbol name to
ext/napi/sym/symbol_exports.json.
{
"symbols": [
...
"napi_get_undefined",
- "napi_get_null"
+ "napi_get_null",
+ "napi_get_boolean"
]
}
Determine where to place the implementation. napi_get_boolean is related to JS
values so we will place it in js_native_api.rs. If something is not clear,
just create a new file module.
See napi_sym for writing the implementation:
Update the generated symbol lists using the script:
deno run --allow-write tools/napi/generate_symbols_lists.js
Add a test in /tests/napi. You can also refer to Node.js
test suite for Node-API.
// tests/napi/boolean_test.js
import from "./common.js";
const lib = ;
;
// tests/napi/src/boolean.rs
use napi_ok;
use napi_boolean;
use *;
extern "C"
// tests/napi/src/lib.rs
+ mod boolean;
...
#[no_mangle]
unsafe extern "C" fn napi_register_module_v1(
env: napi_env,
exports: napi_value,
) -> napi_value {
...
+ boolean::init(env, exports);
exports
}
Run the test using cargo test -p tests/napi.