DocsCLINAPI Config

NAPI Config

The config schema of NAPI-RS.

💡
All the fields in napi is optional.

Schema

{
  napi?: {
    name?: string
    triples?: {
      defaults?: boolean,
      additional?: string[]
    },
    package?: {
      name?: string
    },
    npmClient?: string
  }
}
FieldDefaultDescription
nameindexThe binary file name of generated .node file. Eg [NAME].[TRIPLE?].node becomes index.win32-x64-msvc.node
triples.defaultstrueWhether to enable the default triples.
The default triples is ['x86_64-apple-darwin', 'x86_64-unknown-linux-gnu', 'x86_64-pc-windows-msvc'].
triples.additional[]Additional triples besides the default triples you want to build. Target triples could be found in the output of rustup target list command.
package.nameundefinedOverride the name field in package.json. See Build#js-package-name for usage.
npmClientnpmSpecify a different NPM client for usage when executing NPM actions such as publishing.

What is target triple

See rustc/platform-support and LLVM/CrossCompilation

Targets are identified by their “target triple” which is the string to inform the compiler what kind of output that should be produced.

The triple has the general format <arch><sub>-<vendor>-<sys>-<abi>, where:

  • arch = x86_64, i386, arm, thumb, mips, etc.
  • sub = for ex. on ARM: v5, v6m, v7a, v7m, etc.
  • vendor = pc, apple, nvidia, ibm, etc.
  • sys = none, linux, win32, darwin, cuda, etc.
  • abi = eabi, gnu, android, macho, elf, etc.