Sign in

    napi-mbt

    Generate and build Node-API bindings for MoonBit.

    Download zip
    Author
    Version
    0.3.7
    License
    MIT
    Last updated
    yesterday
    Downloads
    100

    #⚡ napi-mbt

    A Native Node-API (N-API) Toolchain, Code Generator, and Runtime for MoonBit

    MoonBit Mooncakes CI License: MIT Platform Node-API


    #📖 Overview

    napi-mbt is an end-to-end toolchain and runtime library that compiles MoonBit native packages (preferred_target = "native") into ABI-stable Node.js .node addons.

    Without writing C/C++ boilerplate by hand, napi-mbt parses your MoonBit package with an embedded Tree-sitter MoonBit grammar and automatically produces:

    • Native Node-API C glue with strict boundary validation and deterministic resource cleanup
    • Compiled .node native addons via moon build --target native and host C toolchains (MSVC, GCC, or Clang)
    • Dual-mode JavaScript loaders supporting both CommonJS (index.cjs) and ES Modules (index.mjs)
    • Strict TypeScript declarations (index.d.ts) matching your MoonBit signatures
    • Cross-platform npm package manifests for per-platform binary distribution (optionalDependencies)

    Crucially, napi-mbt-cli is a standalone native binary. You can install it directly via Mooncakes (moon install) or GitHub Releases—running the CLI itself does not require Node.js or npm.


    #✨ Key Highlights

    CapabilityDescription
    🎯 Zero-Boilerplate ExportsExport pub fn and pub async fn with #export_name("..."), alongside owned pub struct and pub enum value types. Native classes are configured cleanly in napi-mbt.json.
    🛡️ Strict Boundary ValidationRejects NaN, ±Infinity, fractional floats passed to integers, out-of-range 32-bit/64-bit numbers, and invalid UTF-16/Buffer inputs at the C boundary before entering MoonBit.
    ⚡ Full Async & Concurrency StackSupports cancellable pub async fn Promises (moonbitlang/async@0.22.4 + libuv with AbortSignal), native C worker pool tasks (nativeTasks), isolated MoonBit worker process pools (workerTasks), awaited JS Promises (NapiJsPromise), and demand-driven async streams (NapiAsyncIterator).
    🧱 Safe Classes & CallbacksNative classes include constructors, static factories, getters/setters, methods, and explicit idempotent .dispose(). Callbacks support typed MoonBit signatures (Args) -> Ret raise, returned closures with .dispose(), and threadsafe functions (NapiCallback).
    🔒 Isolated, Cached BuildsCompiles inside isolated workspaces without mutating user source files. Includes content-addressed build caching, watch mode (--watch), and native symbol collision inspection (nm / dumpbin).
    📦 Precise ABI & Engine RangesTargets N-API v4 by default and automatically raises the required N-API level (up to v10) only when higher-level features are used, computing the exact engines.node intersection in package.json.


    #🖥️ Platform & Node.js Support

    #Native Host Targets

    napi-mbt builds native addons for the current host architecture and C runtime:

    OSArchitectureC Runtime / ToolchainPackage Platform Triple
    Windowsx64MSVC (cl / MSBuild + Windows SDK)win32-x64-msvc
    Linuxx64, arm64glibc (gcc / clang)linux-x64-gnu, linux-arm64-gnu
    Linuxx64, arm64musl (Alpine native toolchain)linux-x64-musl, linux-arm64-musl
    macOSx64, arm64Apple Clang (Xcode / Command Line Tools)darwin-x64, darwin-arm64

    [!NOTE] Cross-architecture compilation is intentionally rejected unless running on a matching host toolchain. On Linux (gnu and musl), compiler probes and output ELF dynamic dependencies (PT_INTERP / DT_NEEDED) are verified before installing .node binaries and again during prepublish. See Support Policy and Platform Validation.

    #Node-API Feature Matrix

    Feature SurfaceMinimum N-APIMinimum Node.js Consumer Baseline
    Scalars (Int, UInt, Double, Bool), UTF-16 String, owned struct / enum / Array / Map1Node 10.16.0 (CJS) / 12.20.0 (Dual CJS+ESM)
    Native classes (NapiClass) & callback lifecycle3Node 10.16.0 (CJS) / 12.20.0 (Dual CJS+ESM)
    Stored / threadsafe callbacks (NapiCallback, default CLI target)4>=12.20.0 <13 \|\| >=14.13.1 (Dual default)
    Exact 64-bit Int64 / UInt64 (bigint)6Node 10.7.0+ (intersected with loader mode)
    Bytes (Buffer) & synchronous borrowed NapiBufferView7Node 10.16.0+ (intersected with loader mode)
    External/zero-copy Buffer, ArrayBuffer, DataView and BigInt typed arrays7Node 10.16.0+ (intersected with loader mode)
    pub async fn, NapiTask, NapiJsPromise, NapiAsyncIterator, async host cleanup8>=12.22.0 <13 \|\| >=14.17.0 <15 \|\| >=15.12.0 <16 \|\| >=16.0.0
    Freeze/seal and type tags8Node 12.22.0+ (intersected with loader mode)
    Symbol.for, SyntaxError and module filename9Node 18.0.0+ (intersected with loader mode)
    Property keys, external strings and ArrayBuffer-backed Buffer views10Node 22.0.0+ (intersected with loader mode)
    Web ReadableStream helper (*Stream)8Node 18.0.0+

    CI continuously validates Node 22, 24, and 26, alongside minimum-version consumer compatibility gates and Windows/Linux memory-leak verification.


    #📦 Quick Start

    #1. Install the CLI

    Install napi-mbt-cli from Mooncakes using the MoonBit toolchain:

    moon install unmbt/napi-mbt/cmd/napi-mbt-cli

    This installs the executable to ~/.moon/bin/napi-mbt-cli (%USERPROFILE%\.moon\bin\napi-mbt-cli.exe on Windows). Prebuilt archives for Windows, Linux, and macOS are also available on GitHub Releases with SHA256SUMS.txt and build provenance attestations.

    Verify your host compiler, CMake, and MoonBit environment at any time:

    napi-mbt-cli doctor

    #2. Scaffold and Build a New Addon

    napi-mbt-cli init my-addon cd my-addon moon update moon check napi-mbt-cli build

    Generated projects declare "preferred_target": "native" in moon.mod, default to N-API 4, and enable both CommonJS and ESM loaders.

    #3. Write MoonBit & Call from JavaScript / TypeScript

    Define your exports in lib.mbt:

    ///|
    pub(all) struct Summary {
    label : String
    total : Int
    }

    ///|
    #export_name("summarize")
    pub fn summarize(label : String, values : Array[Int]) -> Summary raise {
    if label.is_empty() {
    fail("label must not be empty")
    }
    let mut total = 0
    for v in values {
    total += v
    }
    { label, total }
    }

    Rebuild with napi-mbt-cli build and consume the generated addon from ES Modules, CommonJS, or TypeScript:

    import { summarize } from './index.mjs'; // or: const { summarize } = require('./index.cjs'); console.log(summarize('orders', [10, 20, 30])); // => { label: 'orders', total: 60 }


    #🧬 Type System & Runtime Capabilities

    napi-mbt enforces strict, predictable conversions across the MoonBit <-> Node.js boundary:

    MoonBit TypeJavaScript / TypeScriptSemantics & Boundary Guarantees
    Int, UIntnumberChecked 32-bit signed ([-2^31, 2^31 - 1]) and unsigned ([0, 2^32 - 1]) integers; rejects NaN, ±Infinity, and fractions.
    Int64, UInt64bigintChecked 64-bit signed/unsigned BigInt (N-API 6); rejects out-of-range 64-bit values.
    Double, Float, Bool, Unitnumber, boolean, voidPreserves IEEE-754 values, including NaN and ±Infinity.
    StringstringDirect UTF-16 string conversion without intermediate UTF-8 transcoding.
    BytesBufferOwned byte copy across the boundary (N-API 7); safe to store and return from async functions.
    NapiBufferViewBufferZero-copy synchronous borrow (N-API 7); valid only during the synchronous call frame.
    NapiObject / NapiFunction / NapiArrayJavaScript object/function/arrayEnvironment-bound low-level handles for properties, calls, construction, prototypes and instanceof; never cross async or worker boundaries.
    NapiInt8Array / NapiUint8Array / NapiUint8ClampedArray / NapiInt16Array / NapiUint16Array / NapiInt32Array / NapiUint32Array / NapiFloat32Array / NapiFloat64Array / NapiArrayBufferCorresponding JavaScript TypedArrays / ArrayBufferOwned typed-array and ArrayBuffer copies; 8/16-bit elements use range-safe MoonBit integer arrays.
    NapiBigInt64Array / NapiBigUint64Array / NapiDataViewBigInt64Array / BigUint64Array / DataViewOwned copies; detached and shared backing stores are rejected.
    NapiExternal and external helpersExternal / Buffer / ArrayBuffer / stringExplicit caller-managed pointers or GC-retained Bytes backing stores; use owned wrappers when a copy is required.
    NapiDateDateCopies the ECMAScript millisecond time value and rejects invalid dates at the boundary (N-API 5).
    NapiSymbolsymbolRetains symbol identity with an environment-owned reference; the description is used only when creating one.
    NapiSet[T]Set<T>Copies insertion order through JavaScript Set and recursively applies the same converter.
    T?, Array[T], Map[String, T], (A, B, ...), JsonT \| null, Array<T>, Record<string, T>, [A, B, ...], JsonValueRecursive structural validation; Option::None maps to null (and accepts null or undefined on input).
    pub struct / pub enumObject / Discriminated UnionExported structs map to typed JS objects; enums map to variant name string or { tag: "Variant", args: [...] } discriminated unions.
    Configured Class (napi-mbt.json)class with dispose()Native handle wrapping with constructors, static factories, properties, methods, and deterministic disposal.
    (Args) -> Ret raise / NapiCallback(...args) => RetSupports synchronous call-scoped invocations, returned closures with dispose(), and threadsafe functions (N-API 4).
    pub async fn(...) -> TPromise<T> (with { signal?: AbortSignal })Runs on the embedded moonbitlang/async@0.22.4 + libuv loop (N-API 8) with cooperative cancellation.
    NapiJsPromise[T]Promise<T>Awaits JavaScript Promises inside MoonBit async fn exports with typed resolution.
    NapiAsyncIterator[T]AsyncIterableIterator<T> & ReadableStream<T>Demand-driven streaming input/output with backpressure and early consumer cancellation (return()).
    NapiTypedThreadsafeFunction[T]Threadsafe producer to JS callbackEncodes T to copied Bytes on a producer thread; the owner-thread callback receives a Buffer.
    NapiIterator[T]IterableIterator<T>Consumes JavaScript Iterables synchronously and releases callback resources on close or exhaustion.
    nativeTasks / workerTasks (napi-mbt.json)Promise<T> / Worker PoolOffloads C jobs to the libuv threadpool (nativeTasks) or pure MoonBit jobs to isolated Node worker process pools (workerTasks).


    #🛠️ CLI Reference

    napi-mbt-cli <command> [directory] [options]

    CommandDescription
    init <dir>Create the official addon template (--name <name>, --force).
    generate [dir]Generate bindings and loaders (--check to validate without writing files).
    build [dir]Build the native addon in isolation (--release, --watch, --no-cache, --dry-run, --verbose, --target <t>, --output-dir <p>).
    clean [dir]Remove this project's persistent build cache (--cache).
    doctor [dir]Check the native compiler, linker, and platform SDK (--json).
    prepublish [dir]Validate release artifacts and prepare npm platform package metadata (--target <t>).
    targetsList supported host target profiles.

    Common flags:
    • --help, -h: Print help information.
    • --version, -V: Print CLI version.

    #How the Isolated Build Pipeline Works

    1. Source & Export Analysis: napi-mbt-cli parses your .mbt files (#export_name) and napi-mbt.json, checking supported signatures and inferring the minimum N-API version.
    2. Non-Invasive Workspace Staging: The CLI prepares an isolated build workspace under .napi-mbt/cache/ (or a temporary directory) without modifying your source tree.
    3. Native Compilation & Linking: moon build --target native compiles MoonBit packages and stubs to native artifacts, linking with the generated Node-API C shim (napi_glue.c), embedded node-api-headers, and (when async is used) the moonbitlang/async libuv bridge.
    4. Symbol & Loader Emission: Exported symbols are verified against C runtime collisions (nm/dumpbin), .node binaries are copied to the artifact directory, and index.cjs, index.mjs, and index.d.ts are emitted.


    #📚 Documentation & Examples

    #Documentation Guides

    #Standalone Examples

    The examples/ directory contains 10 standalone addon projects covering the main usage patterns, with executable JS tests and TypeScript consumers:

    ExampleDemonstrated Capabilities
    examples/hello-addonDual CJS/ESM imports and strict scalar boundary checks
    examples/structured-dataStructs/enums, optional fields, records, JSON, tuples, Date, Symbol, Set and synchronous iterators
    examples/native-classStateful class handles configured in napi-mbt.json, getters/setters, a factory export, and .dispose()
    examples/callbacksStored synchronous callbacks, returned closures and JS exception propagation
    examples/async-fileNative file I/O, AbortSignal cancellation, recovery and JS Promise input
    examples/binary-processingOwned Bytes (Buffer) vs. zero-copy synchronous NapiBufferView and TypedArrays
    examples/native-tasksC worker-pool jobs (nativeTasks), cancellation, and composition with MoonBit async fn
    examples/worker-tasksPure MoonBit CPU-bound computation in isolated Node worker process pools (workerTasks)
    examples/streamsNapiAsyncIterator input/output, backpressure, cancellation, and Web ReadableStream
    examples/advanced-apiEnvironment-bound low-level handles, External/zero-copy values, owned DataView/BigInt arrays, N-API 8/9/10 helpers, and typed TSFN

    To materialize any example into a standalone directory and run its test suite:

    moon run examples/setup.mbtx examples/hello-addon ../my-hello-addon cd ../my-hello-addon pnpm test


    #🧪 Development & Validation

    This repository pins MoonBit 0.10.17+093cb8f9c, CMake 4.4.4, and moonbitlang/async@0.22.4. Common repository validation commands:

    moon run scripts/toolchain-check.mbtx # Verify pinned MoonBit, CMake, and host toolchain moon check # Typecheck all MoonBit packages moon test # Run unit, whitebox, and blackbox tests moon run scripts/docs-check.mbtx # Verify Markdown links and documentation gates moon run scripts/release-check.mbtx # Verify module version and lockfile hygiene moon run scripts/examples-test.mbtx # Package the CLI and build/test all 10 standalone examples

    See Development Workflow and Validation Record for the complete verification suite.


    #📄 License & Third-Party Notices

    #Project License

    napi-mbt is licensed under the MIT License.

    #Third-Party Components & Licenses

    napi-mbt vendors parser sources under internal/syntax/vendor/ and embeds C headers and async runtime glue inside internal/assets/data/resources.json. When packaging napi-mbt-cli release archives (scripts/package-cli.mbtx), all corresponding license files are distributed under the archive's licenses/ directory:

    ComponentVersion / SourceUsage in napi-mbtLicenseRepository / Archive License Path
    Tree-sitter C Runtimev0.26.8 (cd5b087c) · tree-sitter/tree-sitterVendored C parser runtime for MoonBit AST analysisMITinternal/syntax/vendor/TREE-SITTER-LICENSE (licenses/TREE-SITTER-LICENSE)
    Unicode Character DatabaseUnicode Consortium (bundled in Tree-sitter)Unicode character tables in Tree-sitter lexerUnicode-DFS-2016internal/syntax/vendor/runtime/unicode/LICENSE (licenses/UNICODE-LICENSE)
    Tree-sitter MoonBit GrammarCommit 190881df (ABI 15) · unmbt/tree-sitter-moonbitVendored MoonBit grammar tables (parser.c / scanner.c)Apache-2.0 AND MITinternal/syntax/vendor/GRAMMAR-LICENSE (licenses/GRAMMAR-LICENSE)
    Node-API Headers (node-api-headers)v1.9.0 · nodejs/node-api-headersEmbedded node_api.h & js_native_api.h headers for standalone buildsMITEmbedded in internal/assets/data/resources.json (licenses/NODE-API-LICENSE)
    MoonBit Async Runtime (moonbitlang/async)v0.22.4 · moonbitlang/asyncEmbedded native async event-loop bridge and runtime supportApache-2.0Embedded in internal/assets/data/resources.json (licenses/MOONBIT-ASYNC-LICENSE)
    libuv Headers & Declarationslibuv/libuvEmbedded libuv declarations for Node.js event-loop integrationMITEmbedded in internal/assets/data/resources.json (licenses/LIBUV-LICENSE)

    NapiError

    pub(all) suberror NapiError {
    JavaScriptException(NapiReference)
    ApiError(status~ : Int, kind~ : NapiErrorKind, code~ : String, context~ : String)
    }

    NapiArguments

    #external
    pub type NapiArguments

    NapiArguments::get

    fn NapiArguments::get(self : NapiArguments, env : NapiEnv, index : Int) -> NapiValue raise NapiError

    NapiArguments::require

    fn NapiArguments::require(self : NapiArguments, count : Int) -> Unit raise NapiError

    NapiArray

    pub struct NapiArray {
    // private fields
    }

    NapiArray::from_value

    fn NapiArray::from_value(env : NapiEnv, value : NapiValue) -> NapiArray raise NapiError

    NapiArray::get

    fn NapiArray::get(self : NapiArray, env : NapiEnv, index : Int) -> NapiValue raise NapiError

    NapiArray::length

    fn NapiArray::length(self : NapiArray, env : NapiEnv) -> Int raise NapiError

    NapiArray::new

    fn NapiArray::new(env : NapiEnv, length : Int) -> NapiArray raise NapiError

    NapiArray::set

    fn NapiArray::set(self : NapiArray, env : NapiEnv, index : Int, value : NapiValue) -> Unit raise NapiError

    NapiArray::value

    fn NapiArray::value(self : NapiArray) -> NapiValue

    NapiArrayBuffer

    pub struct NapiArrayBuffer {
    // private fields
    }

    An owned immutable byte sequence, copied from/to an independent ArrayBuffer.

    NapiArrayBuffer::byte_length

    fn NapiArrayBuffer::byte_length(self : NapiArrayBuffer) -> Int

    NapiArrayBuffer::from_bytes

    fn NapiArrayBuffer::from_bytes(data : Bytes) -> NapiArrayBuffer

    NapiArrayBuffer::to_bytes

    fn NapiArrayBuffer::to_bytes(self : NapiArrayBuffer) -> Bytes

    NapiBigInt64Array

    pub struct NapiBigInt64Array {
    // private fields
    }

    Owned signed 64-bit BigInt elements copied from/to JavaScript.

    NapiBigInt64Array::length

    fn NapiBigInt64Array::length(self : NapiBigInt64Array) -> Int

    NapiBigInt64Array::new

    fn NapiBigInt64Array::new(values : Array[Int64]) -> NapiBigInt64Array

    NapiBigInt64Array::to_array

    fn NapiBigInt64Array::to_array(self : NapiBigInt64Array) -> Array[Int64]

    NapiBigUint64Array

    pub struct NapiBigUint64Array {
    // private fields
    }

    Owned unsigned 64-bit BigInt elements copied from/to JavaScript.

    NapiBigUint64Array::length

    fn NapiBigUint64Array::length(self : NapiBigUint64Array) -> Int

    NapiBigUint64Array::new

    fn NapiBigUint64Array::new(values : Array[UInt64]) -> NapiBigUint64Array

    NapiBigUint64Array::to_array

    fn NapiBigUint64Array::to_array(self : NapiBigUint64Array) -> Array[UInt64]

    NapiBufferView

    pub struct NapiBufferView {
    env : NapiEnv
    value : NapiValue
    is_alive : Bool
    }

    NapiBufferView::invalidate

    fn NapiBufferView::invalidate(self : NapiBufferView) -> Unit

    Invalidates a borrowed Buffer view after the callback returns.

    NapiBufferView::length

    fn NapiBufferView::length(self : NapiBufferView) -> Int raise NapiError

    NapiBufferView::load8

    fn NapiBufferView::load8(self : NapiBufferView, offset : Int) -> Int raise NapiError

    NapiBufferView::store8

    fn NapiBufferView::store8(self : NapiBufferView, offset : Int, val : Int) -> Unit raise NapiError

    NapiCallback

    pub type NapiCallback

    An owned reference to a JavaScript function. The reference belongs to its creating environment; dispose is idempotent and GC is a fallback.

    NapiCallback::call

    fn NapiCallback::call(self : NapiCallback, args : NapiValue) -> NapiValue raise NapiError

    NapiCallback::dispose

    fn NapiCallback::dispose(self : NapiCallback) -> Unit raise NapiError

    NapiCallback::environment

    fn NapiCallback::environment(self : NapiCallback) -> NapiEnv raise NapiError

    NapiCallback::new

    fn NapiCallback::new(env : NapiEnv, value : NapiValue) -> NapiCallback raise NapiError

    NapiCallbackInfo

    #external
    pub type NapiCallbackInfo

    NapiDataView

    pub struct NapiDataView {
    // private fields
    }

    An owned DataView snapshot. The snapshot is copied on input; use napi_external_buffer when a mutable zero-copy view is required.

    NapiDataView::byte_length

    fn NapiDataView::byte_length(self : NapiDataView) -> Int

    NapiDataView::from_bytes

    fn NapiDataView::from_bytes(data : Bytes) -> NapiDataView

    NapiDataView::to_bytes

    fn NapiDataView::to_bytes(self : NapiDataView) -> Bytes

    NapiDate

    pub struct NapiDate {
    // private fields
    }

    A JavaScript Date represented by its ECMAScript time value in milliseconds. Invalid dates are rejected at the N-API boundary.

    NapiDate::milliseconds

    fn NapiDate::milliseconds(self : NapiDate) -> Double

    NapiDate::new

    fn NapiDate::new(milliseconds : Double) -> NapiDate

    NapiDeferred

    #external
    pub type NapiDeferred

    NapiEnv

    #external
    pub type NapiEnv

    NapiErrorKind

    pub(all) enum NapiErrorKind {
    Error
    TypeError
    RangeError
    }

    NapiEscapableHandleScope

    #external
    pub type NapiEscapableHandleScope

    Opaque handle to an escapable N-API handle scope.

    NapiEscapableHandleScopeGuard

    pub struct NapiEscapableHandleScopeGuard {
    env : NapiEnv
    scope : NapiEscapableHandleScope
    closed : Bool
    }

    NapiEscapableHandleScopeGuard::close

    NapiEscapableHandleScopeGuard::escape

    NapiEscapableHandleScopeGuard::open

    NapiExternal

    pub struct NapiExternal {
    // private fields
    }

    NapiExternal::data

    fn NapiExternal::data(self : NapiExternal, env : NapiEnv) -> UnmanagedBuffer raise NapiError

    NapiExternal::from_value

    fn NapiExternal::from_value(env : NapiEnv, value : NapiValue) -> NapiExternal raise NapiError

    NapiExternal::new

    NapiExternal::value

    fn NapiExternal::value(self : NapiExternal) -> NapiValue

    NapiExternalBuffer

    pub struct NapiExternalBuffer {
    // private fields
    }

    NapiExternalBuffer::from_bytes

    fn NapiExternalBuffer::from_bytes(data : Bytes) -> NapiExternalBuffer

    NapiExternalBuffer::length

    fn NapiExternalBuffer::length(self : NapiExternalBuffer) -> Int

    NapiExternalBuffer::to_bytes

    fn NapiExternalBuffer::to_bytes(self : NapiExternalBuffer) -> Bytes

    NapiFloat32Array

    pub struct NapiFloat32Array {
    // private fields
    }

    Owned data copied from/to JavaScript. No JavaScript handles or borrowed storage.

    NapiFloat32Array::length

    fn NapiFloat32Array::length(self : NapiFloat32Array) -> Int

    NapiFloat32Array::new

    fn NapiFloat32Array::new(values : Array[Float]) -> NapiFloat32Array

    NapiFloat32Array::to_array

    fn NapiFloat32Array::to_array(self : NapiFloat32Array) -> Array[Float]

    NapiFloat64Array

    pub struct NapiFloat64Array {
    // private fields
    }

    Owned data copied from/to JavaScript. No JavaScript handles or borrowed storage.

    NapiFloat64Array::length

    fn NapiFloat64Array::length(self : NapiFloat64Array) -> Int

    NapiFloat64Array::new

    fn NapiFloat64Array::new(values : Array[Double]) -> NapiFloat64Array

    NapiFloat64Array::to_array

    fn NapiFloat64Array::to_array(self : NapiFloat64Array) -> Array[Double]

    NapiFunction

    pub struct NapiFunction {
    // private fields
    }

    NapiFunction::call

    fn NapiFunction::call(self : NapiFunction, env : NapiEnv, receiver : NapiValue, args : Array[NapiValue]) -> NapiValue raise NapiError

    NapiFunction::from_value

    fn NapiFunction::from_value(env : NapiEnv, value : NapiValue) -> NapiFunction raise NapiError

    NapiFunction::new_instance

    fn NapiFunction::new_instance(self : NapiFunction, env : NapiEnv, args : Array[NapiValue]) -> NapiObject raise NapiError

    NapiFunction::value

    fn NapiFunction::value(self : NapiFunction) -> NapiValue

    NapiHandleScope

    #external
    pub type NapiHandleScope

    Opaque handle to a synchronous N-API handle scope.

    NapiHandleScopeGuard

    pub struct NapiHandleScopeGuard {
    env : NapiEnv
    scope : NapiHandleScope
    closed : Bool
    }

    NapiHandleScopeGuard::close

    fn NapiHandleScopeGuard::close(self : NapiHandleScopeGuard) -> Unit raise NapiError

    NapiHandleScopeGuard::open

    NapiInt16Array

    pub struct NapiInt16Array {
    // private fields
    }

    Owned signed 16-bit elements copied from/to JavaScript.

    NapiInt16Array::length

    fn NapiInt16Array::length(self : NapiInt16Array) -> Int

    NapiInt16Array::new

    fn NapiInt16Array::new(values : Array[Int]) -> NapiInt16Array

    NapiInt16Array::to_array

    fn NapiInt16Array::to_array(self : NapiInt16Array) -> Array[Int]

    NapiInt32Array

    pub struct NapiInt32Array {
    // private fields
    }

    Owned data copied from/to JavaScript. No JavaScript handles or borrowed storage.

    NapiInt32Array::length

    fn NapiInt32Array::length(self : NapiInt32Array) -> Int

    NapiInt32Array::new

    fn NapiInt32Array::new(values : Array[Int]) -> NapiInt32Array

    NapiInt32Array::to_array

    fn NapiInt32Array::to_array(self : NapiInt32Array) -> Array[Int]

    NapiInt8Array

    pub struct NapiInt8Array {
    // private fields
    }

    Owned signed 8-bit elements copied from/to JavaScript.

    NapiInt8Array::length

    fn NapiInt8Array::length(self : NapiInt8Array) -> Int

    NapiInt8Array::new

    fn NapiInt8Array::new(values : Array[Int]) -> NapiInt8Array

    NapiInt8Array::to_array

    fn NapiInt8Array::to_array(self : NapiInt8Array) -> Array[Int]

    NapiIterator

    pub struct NapiIterator[T] {
    // private fields
    }

    A synchronous iterator owned by the current Node environment.

    NapiIterator::close

    fn[T] NapiIterator::close(self : NapiIterator[T]) -> Unit raise

    NapiIterator::new

    fn[T] NapiIterator::new(next : () -> T? raise, close? : () -> Unit raise) -> NapiIterator[T] raise NapiError

    NapiIterator::next

    fn[T] NapiIterator::next(self : NapiIterator[T]) -> T? raise

    NapiObject

    pub struct NapiObject {
    // private fields
    }

    NapiObject::define_property

    fn NapiObject::define_property(self : NapiObject, env : NapiEnv, key : String, value : NapiValue, attributes : Int) -> Unit raise NapiError

    NapiObject::from_value

    fn NapiObject::from_value(env : NapiEnv, value : NapiValue) -> NapiObject raise NapiError

    NapiObject::get

    fn NapiObject::get(self : NapiObject, env : NapiEnv, key : String) -> NapiValue raise NapiError

    NapiObject::has

    fn NapiObject::has(self : NapiObject, env : NapiEnv, key : String) -> Bool raise NapiError

    NapiObject::is_instance_of

    fn NapiObject::is_instance_of(self : NapiObject, env : NapiEnv, ctor : NapiFunction) -> Bool raise NapiError

    NapiObject::keys

    fn NapiObject::keys(self : NapiObject, env : NapiEnv) -> Array[String] raise NapiError

    NapiObject::prototype

    fn NapiObject::prototype(self : NapiObject, env : NapiEnv) -> NapiObject raise NapiError

    NapiObject::set

    fn NapiObject::set(self : NapiObject, env : NapiEnv, key : String, value : NapiValue) -> Unit raise NapiError

    NapiObject::value

    fn NapiObject::value(self : NapiObject) -> NapiValue

    NapiPromise

    pub struct NapiPromise {
    promise : NapiValue
    deferred : NapiDeferred
    settled : Bool
    }

    NapiReference

    pub type NapiReference

    An owned, environment-bound JavaScript value, safe across handle scopes.

    NapiReference::dispose

    fn NapiReference::dispose(self : NapiReference) -> Unit raise NapiError

    NapiReference::get

    fn NapiReference::get(self : NapiReference, env : NapiEnv) -> NapiValue raise NapiError

    NapiReference::new

    fn NapiReference::new(env : NapiEnv, value : NapiValue) -> NapiReference raise NapiError

    NapiSet

    pub struct NapiSet[T] {
    // private fields
    }

    A copied JavaScript Set. The elements are converted by the generated adapter, so this container does not impose MoonBit Eq/Hash constraints.

    NapiSet::length

    fn[T] NapiSet::length(self : NapiSet[T]) -> Int

    NapiSet::new

    fn[T] NapiSet::new(values : Array[T]) -> NapiSet[T]

    NapiSet::to_array

    fn[T] NapiSet::to_array(self : NapiSet[T]) -> Array[T]

    NapiSymbol

    pub struct NapiSymbol {
    // private fields
    }

    An owned reference to a JavaScript Symbol in its creating environment.

    NapiSymbol::new

    fn NapiSymbol::new(env : NapiEnv, description : String) -> NapiSymbol raise NapiError

    NapiThreadsafeFunction

    #external
    pub type NapiThreadsafeFunction

    NapiTsfnCallMode

    pub(all) enum NapiTsfnCallMode {
    Nonblocking
    Blocking
    }

    NapiTsfnReleaseMode

    pub(all) enum NapiTsfnReleaseMode {
    Release
    Abort
    }

    NapiTsfnStatus

    pub(all) enum NapiTsfnStatus {
    Accepted
    QueueFull
    Closing
    }

    NapiTypeTag

    pub struct NapiTypeTag {
    high : UInt64
    low : UInt64
    }

    NapiTypeTag::new

    fn NapiTypeTag::new(high : UInt64, low : UInt64) -> NapiTypeTag

    NapiTypedThreadsafeFunction

    pub struct NapiTypedThreadsafeFunction[T] {
    // private fields
    }

    NapiTypedThreadsafeFunction::abort

    Stop delivery and release one producer count. Do not use this producer again.

    NapiTypedThreadsafeFunction::acquire

    NapiTypedThreadsafeFunction::call

    Prefer Nonblocking on the owner thread; Blocking on a full queue can deadlock.

    NapiTypedThreadsafeFunction::new

    fn[T] NapiTypedThreadsafeFunction::new(env : NapiEnv, callback : NapiValue, max_queue_size : Int, encode : (T) -> Bytes) -> NapiTypedThreadsafeFunction[T] raise NapiError

    Creation owns one producer count. Release it when finished. This wrapper does not automatically release or prevent use after the last release.

    NapiTypedThreadsafeFunction::release

    NapiTypedThreadsafeFunction::try_call

    NapiUint16Array

    pub struct NapiUint16Array {
    // private fields
    }

    Owned unsigned 16-bit elements copied from/to JavaScript.

    NapiUint16Array::length

    fn NapiUint16Array::length(self : NapiUint16Array) -> Int

    NapiUint16Array::new

    fn NapiUint16Array::new(values : Array[UInt]) -> NapiUint16Array

    NapiUint16Array::to_array

    fn NapiUint16Array::to_array(self : NapiUint16Array) -> Array[UInt]

    NapiUint32Array

    pub struct NapiUint32Array {
    // private fields
    }

    Owned data copied from/to JavaScript. No JavaScript handles or borrowed storage.

    NapiUint32Array::length

    fn NapiUint32Array::length(self : NapiUint32Array) -> Int

    NapiUint32Array::new

    fn NapiUint32Array::new(values : Array[UInt]) -> NapiUint32Array

    NapiUint32Array::to_array

    fn NapiUint32Array::to_array(self : NapiUint32Array) -> Array[UInt]

    NapiUint8Array

    pub struct NapiUint8Array {
    // private fields
    }

    Owned data copied from/to JavaScript. No JavaScript handles or borrowed storage.

    NapiUint8Array::length

    fn NapiUint8Array::length(self : NapiUint8Array) -> Int

    NapiUint8Array::new

    fn NapiUint8Array::new(values : Array[Byte]) -> NapiUint8Array

    NapiUint8Array::to_array

    fn NapiUint8Array::to_array(self : NapiUint8Array) -> Array[Byte]

    NapiUint8ClampedArray

    pub struct NapiUint8ClampedArray {
    // private fields
    }

    Owned unsigned 8-bit clamped elements copied from/to JavaScript.

    NapiUint8ClampedArray::length

    NapiUint8ClampedArray::new

    NapiUint8ClampedArray::to_array

    fn NapiUint8ClampedArray::to_array(self : NapiUint8ClampedArray) -> Array[Byte]

    NapiValue

    #external
    pub type NapiValue

    NapiValueType

    pub enum NapiValueType {
    Undefined
    Null
    Boolean
    Number
    String
    Symbol
    Object
    Function
    External
    BigInt
    }

    UnmanagedBuffer

    #external
    pub type UnmanagedBuffer

    NAPI_MBT_RUNTIME_VERSION

    let NAPI_MBT_RUNTIME_VERSION : String

    add

    fn add(a : Int, b : Int) -> Int

    check_bool

    fn check_bool(b : Bool) -> Bool

    check_double

    fn check_double(d : Double) -> Double

    concat

    fn concat(a : String, b : String) -> String

    get_Bool

    fn get_Bool(env : NapiEnv, val : NapiValue) -> Bool raise NapiError

    get_Bytes

    fn get_Bytes(env : NapiEnv, val : NapiValue) -> Bytes raise NapiError

    get_Double

    fn get_Double(env : NapiEnv, val : NapiValue) -> Double raise NapiError

    get_Float

    fn get_Float(env : NapiEnv, value : NapiValue) -> Float raise NapiError

    get_Int

    fn get_Int(env : NapiEnv, val : NapiValue) -> Int raise NapiError

    get_Int64

    fn get_Int64(env : NapiEnv, value : NapiValue) -> Int64 raise NapiError

    get_NapiArrayBuffer

    fn get_NapiArrayBuffer(env : NapiEnv, value : NapiValue) -> NapiArrayBuffer raise NapiError

    get_NapiBigInt64Array

    fn get_NapiBigInt64Array(env : NapiEnv, value : NapiValue) -> NapiBigInt64Array raise NapiError

    get_NapiBigUint64Array

    fn get_NapiBigUint64Array(env : NapiEnv, value : NapiValue) -> NapiBigUint64Array raise NapiError

    get_NapiBufferView

    fn get_NapiBufferView(env : NapiEnv, val : NapiValue) -> NapiBufferView raise NapiError

    get_NapiDataView

    fn get_NapiDataView(env : NapiEnv, value : NapiValue) -> NapiDataView raise NapiError

    get_NapiFloat32Array

    fn get_NapiFloat32Array(env : NapiEnv, value : NapiValue) -> NapiFloat32Array raise NapiError

    get_NapiFloat64Array

    fn get_NapiFloat64Array(env : NapiEnv, value : NapiValue) -> NapiFloat64Array raise NapiError

    get_NapiInt16Array

    fn get_NapiInt16Array(env : NapiEnv, value : NapiValue) -> NapiInt16Array raise NapiError

    get_NapiInt32Array

    fn get_NapiInt32Array(env : NapiEnv, value : NapiValue) -> NapiInt32Array raise NapiError

    get_NapiInt8Array

    fn get_NapiInt8Array(env : NapiEnv, value : NapiValue) -> NapiInt8Array raise NapiError

    get_NapiUint16Array

    fn get_NapiUint16Array(env : NapiEnv, value : NapiValue) -> NapiUint16Array raise NapiError

    get_NapiUint32Array

    fn get_NapiUint32Array(env : NapiEnv, value : NapiValue) -> NapiUint32Array raise NapiError

    get_NapiUint8Array

    fn get_NapiUint8Array(env : NapiEnv, value : NapiValue) -> NapiUint8Array raise NapiError

    get_NapiUint8ClampedArray

    fn get_NapiUint8ClampedArray(env : NapiEnv, value : NapiValue) -> NapiUint8ClampedArray raise NapiError

    get_String

    fn get_String(env : NapiEnv, val : NapiValue) -> String raise NapiError

    get_UInt

    fn get_UInt(env : NapiEnv, value : NapiValue) -> UInt raise NapiError

    get_UInt64

    fn get_UInt64(env : NapiEnv, value : NapiValue) -> UInt64 raise NapiError

    mutate_buffer

    fn mutate_buffer(view : NapiBufferView) -> Unit raise NapiError

    napi_adjust_external_memory

    fn napi_adjust_external_memory(env : NapiEnv, change : Int64) -> Int64 raise NapiError

    napi_array_get

    fn napi_array_get(env : NapiEnv, value : NapiValue, index : Int) -> NapiValue raise NapiError

    napi_array_length

    fn napi_array_length(env : NapiEnv, value : NapiValue) -> Int raise NapiError

    napi_array_new

    fn napi_array_new(env : NapiEnv, length : Int) -> NapiValue raise NapiError

    napi_array_set

    fn napi_array_set(env : NapiEnv, value : NapiValue, index : Int, element : NapiValue) -> Unit raise NapiError

    napi_bigint_from_int64

    fn napi_bigint_from_int64(env : NapiEnv, value : Int64) -> NapiValue raise NapiError

    napi_bigint_from_uint64

    fn napi_bigint_from_uint64(env : NapiEnv, value : UInt64) -> NapiValue raise NapiError

    napi_bigint_to_int64

    fn napi_bigint_to_int64(env : NapiEnv, value : NapiValue) -> (Int64, Bool) raise NapiError

    Reads a signed BigInt and returns the value plus the lossless flag.

    napi_bigint_to_uint64

    fn napi_bigint_to_uint64(env : NapiEnv, value : NapiValue) -> (UInt64, Bool) raise NapiError

    Reads an unsigned BigInt and returns the value plus the lossless flag.

    napi_buffer_from_arraybuffer

    fn napi_buffer_from_arraybuffer(env : NapiEnv, arraybuffer : NapiValue, offset : Int, length : Int) -> NapiValue raise NapiError

    napi_check_depth

    fn napi_check_depth(depth : Int) -> Unit raise NapiError

    napi_check_object_type_tag

    fn napi_check_object_type_tag(env : NapiEnv, object : NapiValue, tag : NapiTypeTag) -> Bool raise NapiError

    napi_class_dispose

    fn napi_class_dispose(env : NapiEnv, value : NapiValue, type_id : Int) -> Unit raise NapiError

    napi_class_handle

    fn napi_class_handle(env : NapiEnv, value : NapiValue, type_id : Int) -> UnmanagedBuffer raise NapiError

    napi_closure_new

    fn napi_closure_new(env : NapiEnv, callback : (NapiEnv, NapiArguments) -> NapiValue) -> NapiValue raise NapiError

    napi_coerce_to_string

    fn napi_coerce_to_string(env : NapiEnv, value : NapiValue) -> String raise NapiError

    napi_detach_arraybuffer

    fn napi_detach_arraybuffer(env : NapiEnv, value : NapiValue) -> Unit raise NapiError

    napi_enter_value

    fn napi_enter_value(env : NapiEnv, value : NapiValue, path : Array[NapiValue]) -> Unit raise NapiError

    napi_error_value

    fn napi_error_value(env : NapiEnv, error : Error) -> NapiValue raise NapiError

    napi_external_arraybuffer

    fn napi_external_arraybuffer(env : NapiEnv, data : Bytes) -> NapiValue raise NapiError

    napi_external_buffer

    fn napi_external_buffer(env : NapiEnv, data : Bytes) -> NapiValue raise NapiError

    napi_external_string_latin1

    fn napi_external_string_latin1(env : NapiEnv, value : Bytes) -> (NapiValue, Bool) raise NapiError

    napi_field_get

    fn napi_field_get(env : NapiEnv, value : NapiValue, name : String, required : Bool) -> NapiValue raise NapiError

    napi_field_set

    fn napi_field_set(env : NapiEnv, value : NapiValue, name : String, field : NapiValue) -> Unit raise NapiError

    napi_get_instance_data

    fn napi_get_instance_data(env : NapiEnv) -> UnmanagedBuffer raise NapiError

    napi_global

    fn napi_global(env : NapiEnv) -> NapiValue raise NapiError

    napi_is_detached_arraybuffer

    fn napi_is_detached_arraybuffer(env : NapiEnv, value : NapiValue) -> Bool raise NapiError

    napi_is_nullish

    fn napi_is_nullish(env : NapiEnv, value : NapiValue) -> Bool raise NapiError

    napi_key_get

    fn napi_key_get(env : NapiEnv, value : NapiValue, key : String) -> NapiValue raise NapiError

    napi_key_set

    fn napi_key_set(env : NapiEnv, value : NapiValue, key : String, field : NapiValue) -> Unit raise NapiError

    napi_mbt_adapter_add

    fn napi_mbt_adapter_add(env : NapiEnv, a0 : NapiValue, a1 : NapiValue) -> NapiValue

    napi_mbt_adapter_check_bool

    fn napi_mbt_adapter_check_bool(env : NapiEnv, a0 : NapiValue) -> NapiValue

    napi_mbt_adapter_check_double

    fn napi_mbt_adapter_check_double(env : NapiEnv, a0 : NapiValue) -> NapiValue

    napi_mbt_adapter_concat

    fn napi_mbt_adapter_concat(env : NapiEnv, a0 : NapiValue, a1 : NapiValue) -> NapiValue

    napi_mbt_adapter_mutate_buffer

    fn napi_mbt_adapter_mutate_buffer(env : NapiEnv, a0 : NapiValue) -> NapiValue

    napi_mbt_adapter_roundtrip_bytes

    fn napi_mbt_adapter_roundtrip_bytes(env : NapiEnv, a0 : NapiValue) -> NapiValue

    napi_module_file_name

    fn napi_module_file_name(env : NapiEnv) -> String raise NapiError

    napi_null

    fn napi_null(env : NapiEnv) -> NapiValue raise NapiError

    napi_object_freeze

    fn napi_object_freeze(env : NapiEnv, object : NapiValue) -> Unit raise NapiError

    napi_object_keys

    fn napi_object_keys(env : NapiEnv, value : NapiValue) -> Array[String] raise NapiError

    napi_object_new

    fn napi_object_new(env : NapiEnv) -> NapiValue raise NapiError

    napi_object_seal

    fn napi_object_seal(env : NapiEnv, object : NapiValue) -> Unit raise NapiError

    napi_promise_is

    fn napi_promise_is(env : NapiEnv, value : NapiValue) -> Bool raise NapiError

    Returns whether a value is a JavaScript Promise.

    napi_promise_new

    fn napi_promise_new(env : NapiEnv) -> NapiPromise raise NapiError

    Promise support is available in Node-API v1.

    napi_promise_reject

    fn napi_promise_reject(env : NapiEnv, promise : NapiPromise, reason : NapiValue) -> Unit raise NapiError

    napi_promise_resolve

    fn napi_promise_resolve(env : NapiEnv, promise : NapiPromise, value : NapiValue) -> Unit raise NapiError

    napi_property_key

    fn napi_property_key(env : NapiEnv, value : String) -> NapiValue raise NapiError

    napi_read_json

    fn napi_read_json(env : NapiEnv, value : NapiValue, path : Array[NapiValue]) -> Json raise NapiError

    napi_require_object

    fn napi_require_object(env : NapiEnv, value : NapiValue) -> Unit raise NapiError

    napi_set_instance_data

    fn napi_set_instance_data(env : NapiEnv, data : UnmanagedBuffer) -> Unit raise NapiError

    napi_set_new

    fn napi_set_new(env : NapiEnv, values : NapiValue) -> NapiValue raise NapiError

    napi_set_values

    fn napi_set_values(env : NapiEnv, value : NapiValue) -> NapiValue raise NapiError

    napi_strict_equal

    fn napi_strict_equal(env : NapiEnv, a : NapiValue, b : NapiValue) -> Bool raise NapiError

    napi_symbol_for

    fn napi_symbol_for(env : NapiEnv, description : String) -> NapiSymbol raise NapiError

    napi_syntax_error

    fn napi_syntax_error(env : NapiEnv, code : String, message : String) -> NapiValue raise NapiError

    napi_threadsafe_function_acquire

    fn napi_threadsafe_function_acquire(func : NapiThreadsafeFunction) -> NapiTsfnStatus raise NapiError

    napi_threadsafe_function_call

    fn napi_threadsafe_function_call(func : NapiThreadsafeFunction, data : UnmanagedBuffer, mode : NapiTsfnCallMode) -> NapiTsfnStatus raise NapiError

    napi_threadsafe_function_create

    fn napi_threadsafe_function_create(env : NapiEnv, func : NapiValue, async_resource : NapiValue, async_resource_name : NapiValue, max_queue_size : Int, initial_thread_count : Int, finalize_data : UnmanagedBuffer, finalize_cb : UnmanagedBuffer, context : UnmanagedBuffer, call_js_cb : UnmanagedBuffer) -> NapiThreadsafeFunction raise NapiError

    Creates a Threadsafe Function. Callback pointers are opaque unmanaged pointers supplied by a C layer.

    napi_threadsafe_function_release

    fn napi_threadsafe_function_release(func : NapiThreadsafeFunction, mode : NapiTsfnReleaseMode) -> NapiTsfnStatus raise NapiError

    Threadsafe Function lifecycle helper. Threadsafe Functions require N-API v4.

    napi_throw_syntax_error

    fn napi_throw_syntax_error(env : NapiEnv, code : String, message : String) -> Unit raise NapiError

    napi_type_tag_object

    fn napi_type_tag_object(env : NapiEnv, object : NapiValue, tag : NapiTypeTag) -> Unit raise NapiError

    napi_undefined

    fn napi_undefined(env : NapiEnv) -> NapiValue raise NapiError

    napi_value_type

    fn napi_value_type(env : NapiEnv, value : NapiValue) -> NapiValueType raise NapiError

    napi_version

    fn napi_version(env : NapiEnv) -> UInt raise NapiError

    napi_write_json

    fn napi_write_json(env : NapiEnv, value : Json, depth : Int) -> NapiValue raise NapiError

    roundtrip_bytes

    fn roundtrip_bytes(b : Bytes) -> Bytes

    set_Bool

    fn set_Bool(env : NapiEnv, val : Bool) -> NapiValue raise NapiError

    set_Bytes

    fn set_Bytes(env : NapiEnv, val : Bytes) -> NapiValue raise NapiError

    set_Double

    fn set_Double(env : NapiEnv, val : Double) -> NapiValue raise NapiError

    set_Float

    fn set_Float(env : NapiEnv, value : Float) -> NapiValue raise NapiError

    set_Int

    fn set_Int(env : NapiEnv, val : Int) -> NapiValue raise NapiError

    set_Int64

    fn set_Int64(env : NapiEnv, value : Int64) -> NapiValue raise NapiError

    set_NapiArrayBuffer

    fn set_NapiArrayBuffer(env : NapiEnv, value : NapiArrayBuffer) -> NapiValue raise NapiError

    set_NapiBigInt64Array

    fn set_NapiBigInt64Array(env : NapiEnv, value : NapiBigInt64Array) -> NapiValue raise NapiError

    set_NapiBigUint64Array

    fn set_NapiBigUint64Array(env : NapiEnv, value : NapiBigUint64Array) -> NapiValue raise NapiError

    set_NapiDataView

    fn set_NapiDataView(env : NapiEnv, value : NapiDataView) -> NapiValue raise NapiError

    set_NapiFloat32Array

    fn set_NapiFloat32Array(env : NapiEnv, value : NapiFloat32Array) -> NapiValue raise NapiError

    set_NapiFloat64Array

    fn set_NapiFloat64Array(env : NapiEnv, value : NapiFloat64Array) -> NapiValue raise NapiError

    set_NapiInt16Array

    fn set_NapiInt16Array(env : NapiEnv, value : NapiInt16Array) -> NapiValue raise NapiError

    set_NapiInt32Array

    fn set_NapiInt32Array(env : NapiEnv, value : NapiInt32Array) -> NapiValue raise NapiError

    set_NapiInt8Array

    fn set_NapiInt8Array(env : NapiEnv, value : NapiInt8Array) -> NapiValue raise NapiError

    set_NapiUint16Array

    fn set_NapiUint16Array(env : NapiEnv, value : NapiUint16Array) -> NapiValue raise NapiError

    set_NapiUint32Array

    fn set_NapiUint32Array(env : NapiEnv, value : NapiUint32Array) -> NapiValue raise NapiError

    set_NapiUint8Array

    fn set_NapiUint8Array(env : NapiEnv, value : NapiUint8Array) -> NapiValue raise NapiError

    set_NapiUint8ClampedArray

    fn set_NapiUint8ClampedArray(env : NapiEnv, value : NapiUint8ClampedArray) -> NapiValue raise NapiError

    set_String

    fn set_String(env : NapiEnv, val : String) -> NapiValue raise NapiError

    set_UInt

    fn set_UInt(env : NapiEnv, value : UInt) -> NapiValue raise NapiError

    set_UInt64

    fn set_UInt64(env : NapiEnv, value : UInt64) -> NapiValue raise NapiError

    set_Unit

    fn set_Unit(env : NapiEnv, _val : Unit) -> NapiValue raise NapiError