Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

napi-build-utils

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

napi-build-utils - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

30

index.js

@@ -40,7 +40,7 @@ 'use strict'

*
* @param {string} napiVerison The N-API version to check.
* @param {string} napiVersion The N-API version to check.
* @returns {boolean}
*/
exports.isSupportedVersion = function (napiVerison) {
var version = parseInt(napiVerison, 10)
exports.isSupportedVersion = function (napiVersion) {
var version = parseInt(napiVersion, 10)
return version <= exports.getNapiVersion() && exports.packageSupportsVersion(version)

@@ -54,11 +54,11 @@ }

*
* @param {number} napiVerison The N-API version to check.
* @param {number} napiVersion The N-API version to check.
* @returns {boolean}
* @private
*/
exports.packageSupportsVersion = function (napiVerison) {
exports.packageSupportsVersion = function (napiVersion) {
if (pkg.binary && pkg.binary.napi_versions &&
pkg.binary.napi_versions instanceof Array) {
for (var i = 0; i < pkg.binary.napi_versions.length; i++) {
if (pkg.binary.napi_versions[i] === napiVerison) return true
if (pkg.binary.napi_versions[i] === napiVersion) return true
};

@@ -74,12 +74,12 @@ };

*
* @param {string} napiVerison The N-API version to check.
* @param {string} napiVersion The N-API version to check.
* @param {Object} log The log object to which the warnings are to be issued.
* Must implement the `warn` method.
*/
exports.logUnsupportedVersion = function (napiVerison, log) {
if (!exports.isSupportedVersion(napiVerison)) {
if (exports.packageSupportsVersion(napiVerison)) {
log.warn('This Node instance does not support N-API version ' + napiVerison)
exports.logUnsupportedVersion = function (napiVersion, log) {
if (!exports.isSupportedVersion(napiVersion)) {
if (exports.packageSupportsVersion(napiVersion)) {
log.warn('This Node instance does not support N-API version ' + napiVersion)
} else {
log.warn('This package does not support N-API version ' + napiVerison)
log.warn('This package does not support N-API version ' + napiVersion)
}

@@ -102,3 +102,3 @@ }

*
* `prebuild` is an array of objects in the form `{runtime: 'napi': target: '2'}`.
* `prebuild` is an array of objects in the form `{runtime: 'napi', target: '2'}`.
* The array contains the list of N-API versions that are supported by both the

@@ -114,3 +114,3 @@ * package being built and the currently running Node instance.

* @param {(Array<string>|string)} target The N-API version(s) to check. Target is
* @param {Object} prebuild A config object created by the `prebuild` package.
* @param {Array<Object>} prebuild A config object created by the `prebuild` package.
* @param {Object} log The log object to which the warnings are to be issued.

@@ -187,3 +187,3 @@ * Must implement the `warn` method.

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

@@ -190,0 +190,0 @@ * @returns {Array<string>}

@@ -13,4 +13,4 @@ <a name="module_napi-build-utils"></a>

* [.isNapiRuntime(runtime)](#module_napi-build-utils.isNapiRuntime) ⇒ <code>boolean</code>
* [.isSupportedVersion(napiVerison)](#module_napi-build-utils.isSupportedVersion) ⇒ <code>boolean</code>
* [.logUnsupportedVersion(napiVerison, log)](#module_napi-build-utils.logUnsupportedVersion)
* [.isSupportedVersion(napiVersion)](#module_napi-build-utils.isSupportedVersion) ⇒ <code>boolean</code>
* [.logUnsupportedVersion(napiVersion, log)](#module_napi-build-utils.logUnsupportedVersion)
* [.getBestNapiBuildVersion()](#module_napi-build-utils.getBestNapiBuildVersion) ⇒ <code>number</code> \| <code>undefined</code>

@@ -33,3 +33,3 @@ * [.getNapiBuildVersions()](#module_napi-build-utils.getNapiBuildVersions) ⇒ <code>Array.&lt;string&gt;</code>

### napi-build-utils.isSupportedVersion(napiVerison) ⇒ <code>boolean</code>
### napi-build-utils.isSupportedVersion(napiVersion) ⇒ <code>boolean</code>
Determines whether the specified N-API version is supported

@@ -42,7 +42,7 @@ by both the currently running Node instance and the package.

| --- | --- | --- |
| napiVerison | <code>string</code> | The N-API version to check. |
| napiVersion | <code>string</code> | The N-API version to check. |
<a name="module_napi-build-utils.logUnsupportedVersion"></a>
### napi-build-utils.logUnsupportedVersion(napiVerison, log)
### napi-build-utils.logUnsupportedVersion(napiVersion, log)
Issues a warning to the supplied log if the N-API version is not supported

@@ -56,3 +56,3 @@ by the current Node instance or if the N-API version is not supported

| --- | --- | --- |
| napiVerison | <code>string</code> | The N-API version to check. |
| napiVersion | <code>string</code> | The N-API version to check. |
| log | <code>Object</code> | The log object to which the warnings are to be issued. Must implement the `warn` method. |

@@ -76,3 +76,3 @@

### napi-build-utils.getNapiBuildVersions() ⇒ <code>Array.&lt;string&gt;</code>
Returns an array of N-APi versions supported by the package.
Returns an array of N-API versions supported by the package.

@@ -79,0 +79,0 @@ **Kind**: static method of [<code>napi-build-utils</code>](#module_napi-build-utils)

{
"name": "napi-build-utils",
"version": "1.0.1",
"version": "1.0.2",
"description": "A set of utilities to assist developers of tools that build N-API native add-ons",

@@ -13,3 +13,5 @@ "main": "index.js",

"keywords": [
"n-api"
"n-api",
"prebuild",
"prebuild-install"
],

@@ -16,0 +18,0 @@ "author": "Jim Schlight",

@@ -17,3 +17,3 @@ # napi-build-utils

Unlike the modules this code is designed to facilite building, this module is written entirely in JavaScript.
Unlike the modules this code is designed to facilitate building, this module is written entirely in JavaScript.

@@ -26,3 +26,3 @@ ## Quick start

The module exports a set of functions documented [here](./index.md). For exmaple:
The module exports a set of functions documented [here](./index.md). For example:

@@ -29,0 +29,0 @@ ```javascript

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc