index.md 3.7 KB

napi-build-utils

A set of utilities to assist developers of tools that build N-API native add-ons.

The main repository can be found here.

napi-build-utils.isNapiRuntime(runtime) ⇒ boolean

Implements a consistent name of napi for N-API runtimes.

Kind: static method of napi-build-utils

Param Type Description
runtime string The runtime string.

napi-build-utils.isSupportedVersion(napiVersion) ⇒ boolean

Determines whether the specified N-API version is supported by both the currently running Node instance and the package.

Kind: static method of napi-build-utils

Param Type Description
napiVersion string The N-API version to check.

napi-build-utils.logUnsupportedVersion(napiVersion, log)

Issues a warning to the supplied log if the N-API version is not supported by the current Node instance or if the N-API version is not supported by the package.

Kind: static method of napi-build-utils

Param Type Description
napiVersion string The N-API version to check.
log Object The log object to which the warnings are to be issued. Must implement the warn method.

napi-build-utils.getBestNapiBuildVersion() ⇒ number | undefined

Returns the best N-API version to build given the highest N-API version supported by the current Node instance and the N-API versions supported by the package, or undefined if a suitable N-API version cannot be determined.

The best build version is the greatest N-API version supported by the package that is less than or equal to the highest N-API version supported by the current Node instance.

Kind: static method of napi-build-utils

napi-build-utils.getNapiBuildVersions() ⇒ Array.<string>

Returns an array of N-API versions supported by the package.

Kind: static method of napi-build-utils

napi-build-utils.getNapiVersion() ⇒ string | undefined

Returns the highest N-API version supported by the current node instance or undefined if N-API is not supported.

Kind: static method of napi-build-utils