Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 23b571e

Browse files
committed
Convert binding to N-API
1 parent 7293699 commit 23b571e

38 files changed

+1340
-888
lines changed

.travis.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,31 @@ compiler: gcc
44

55
jobs:
66
include:
7+
- stage: lint
8+
node_js: "12"
9+
os: linux
10+
install: npm install --ignore-scripts
11+
script: npm run lint || exit 1;
12+
13+
- stage: test
14+
node_js: "13"
15+
os: linux
16+
- stage: test
17+
node_js: "13"
18+
os: osx
719
- stage: test
820
node_js: "12"
921
os: linux
10-
before_script: npm run lint || exit 1;
1122
after_success: npm run-script coverage;
12-
- stage: platform-test
23+
- stage: test
1324
node_js: "12"
1425
os: osx
15-
- stage: platform-test
26+
- stage: test
1627
node_js: "10"
1728
os: linux
18-
- stage: platform-test
29+
- stage: test
1930
node_js: "10"
2031
os: osx
21-
- stage: platform-test
22-
node_js: "13"
23-
os: linux
24-
- stage: platform-test
25-
node_js: "13"
26-
os: osx
2732

2833
addons:
2934
apt:

binding.gyp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@
2727
'SetChecksum': 'true'
2828
}
2929
},
30+
'cflags!': [ '-fno-exceptions' ],
31+
'cflags_cc!': [ '-fno-exceptions' ],
3032
'xcode_settings': {
3133
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
3234
'CLANG_CXX_LIBRARY': 'libc++',
3335
'OTHER_LDFLAGS': [],
3436
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
3537
'MACOSX_DEPLOYMENT_TARGET': '10.7'
3638
},
39+
"dependencies": [
40+
'<!(node -p "require(\'node-addon-api\').gyp")'
41+
],
3742
'include_dirs': [
38-
'<!(node -e "require(\'nan\')")',
43+
'<!@(node -p "require(\'node-addon-api\').include")',
3944
],
4045
'conditions': [
4146
['libsass_ext == "" or libsass_ext == "no"', {

lib/extensions.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@ function getBinaryName() {
203203
binaryName = [
204204
platform, '-',
205205
process.arch, '-',
206-
process.versions.modules
206+
// Use the lowest support N-API version possible as it gives us
207+
// least amount of binary churn. Because N-API versions are additive
208+
// We can opt-in to later versions as we choose to adopt new API features.
209+
//
210+
// See https://nodejs.org/api/n-api.html#n_api_n_api_version_matrix
211+
Math.min(process.versions.napi, 3),
207212
].join('');
208213
}
209214

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@
6363
"meow": "^5.0.0",
6464
"mkdirp": "^0.5.1",
6565
"nan": "^2.14.0",
66+
"node-addon-api": "^1.7.1",
6667
"npmlog": "^4.0.0",
6768
"request": "^2.88.0",
6869
"sass-graph": "^3.0.4",
6970
"stdout-stream": "^1.4.1",
70-
"true-case-path": "^2.2.1"
71+
"true-case-path": "^2.2.1",
72+
"unicode-9.0.0": "^0.7.5"
7173
},
7274
"devDependencies": {
7375
"coveralls": "^3.0.7",

0 commit comments

Comments
 (0)