Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove N-API implementation and v8.x support #643

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ env:
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
- NVS_VERSION=1.4.2
matrix:
- NODEJS_VERSION=node/6
- NODEJS_VERSION=node/8
- NODEJS_VERSION=node/10
- NODEJS_VERSION=node/12
- NODEJS_VERSION=node/13
Expand All @@ -22,7 +20,6 @@ matrix:
fast_finish: true
allow_failures:
- env: NODEJS_VERSION=nightly
- env: NODEJS_VERSION=node/6
sudo: false
cache:
directories:
Expand Down
1 change: 0 additions & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
],
'defines': ['NODE_MAJOR_VERSION=<@(NODE_MAJOR_VERSION)'],
'include_dirs': ["<!@(node -p \"require('../').include\")"],
'dependencies': ["<!(node -p \"require('../').gyp\")"],
'cflags': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ],
'cflags_cc': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ]
}
1 change: 0 additions & 1 deletion doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ To use **N-API** in a native module:

```gyp
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")"],
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
```

3. Decide whether the package will enable C++ exceptions in the N-API wrapper.
Expand Down
7 changes: 0 additions & 7 deletions external-napi/node_api.h

This file was deleted.

47 changes: 5 additions & 42 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,8 @@
var path = require('path');

var versionArray = process.version
.substr(1)
.replace(/-.*$/, '')
.split('.')
.map(function(item) {
return +item;
});

// TODO: Check if the main node semantic version is within multiple ranges,
// or detect presence of built-in N-API by some other mechanism TBD.

// We know which version of Node.js first shipped the incarnation of the API
// available in *this* package. So, if we find that the Node.js version is below
// that, we indicate that the API is missing from Node.js.
var isNodeApiBuiltin = (
versionArray[0] > 8 ||
(versionArray[0] == 8 && versionArray[1] >= 6) ||
(versionArray[0] == 6 && versionArray[1] >= 15) ||
(versionArray[0] == 6 && versionArray[1] >= 14 && versionArray[2] >= 2));

// The flag is not needed when the Node version is not 8, nor if the API is
// built-in, because we removed the flag at the same time as creating the final
// incarnation of the built-in API.
var needsFlag = (!isNodeApiBuiltin && versionArray[0] == 8);

var include = [__dirname];
var gyp = path.join(__dirname, 'src', 'node_api.gyp');

if (isNodeApiBuiltin) {
gyp += ':nothing';
} else {
gyp += ':node-api';
include.unshift(path.join(__dirname, 'external-napi'));
}
const path = require('path');

module.exports = {
include: include.map(function(item) {
return '"' + item + '"';
}).join(' '),
gyp: gyp,
isNodeApiBuiltin: isNodeApiBuiltin,
needsFlag: needsFlag
include: `"${__dirname}"`,
gyp: path.join(__dirname, 'nothing.gyp:nothing'),
isNodeApiBuiltin: true,
needsFlag: false
};
9 changes: 9 additions & 0 deletions node_api.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
'targets': [
{
'target_name': 'nothing',
'type': 'static_library',
'sources': [ 'nothing.c' ]
}
]
}
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
"safe-buffer": "^5.1.1"
},
"directories": {},
"gypfile": false,
"homepage": "https://github.com/nodejs/node-addon-api",
"keywords": [
"n-api",
Expand Down
4 changes: 0 additions & 4 deletions src/.gitignore

This file was deleted.

Loading