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

Commit 439d98a

Browse files
committed
Convert binding to N-API
1 parent b186df6 commit 439d98a

38 files changed

+1347
-888
lines changed

.travis.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,37 @@ env:
66
global:
77
- SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
88

9+
stages:
10+
- lint
11+
- test
12+
913
jobs:
1014
include:
15+
- stage: lint
16+
node_js: "12"
17+
os: linux
18+
install: npm install --ignore-scripts
19+
script: npm run lint || exit 1;
20+
21+
- stage: test
22+
node_js: "13"
23+
os: linux
24+
- stage: test
25+
node_js: "13"
26+
os: osx
1127
- stage: test
1228
node_js: "12"
1329
os: linux
14-
before_script: npm run lint || exit 1;
1530
after_success: npm run-script coverage;
16-
- stage: platform-test
31+
- stage: test
1732
node_js: "12"
1833
os: osx
19-
- stage: platform-test
34+
- stage: test
2035
node_js: "10"
2136
os: linux
22-
- stage: platform-test
37+
- stage: test
2338
node_js: "10"
2439
os: osx
25-
- stage: platform-test
26-
node_js: "13"
27-
os: linux
28-
- stage: platform-test
29-
node_js: "13"
30-
os: osx
3140

3241
addons:
3342
apt:

binding.gyp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,23 @@
2727
'SetChecksum': 'true'
2828
}
2929
},
30+
'cflags!': [ '-fno-exceptions' ],
31+
'cflags_cc!': [ '-fno-exceptions' ],
3032
'xcode_settings': {
3133
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
34+
'OTHER_CPLUSPLUSFLAGS': [
35+
'-std=c++11'
36+
],
3237
'CLANG_CXX_LIBRARY': 'libc++',
3338
'OTHER_LDFLAGS': [],
3439
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
3540
'MACOSX_DEPLOYMENT_TARGET': '10.7'
3641
},
42+
"dependencies": [
43+
'<!(node -p "require(\'node-addon-api\').gyp")'
44+
],
3745
'include_dirs': [
38-
'<!(node -e "require(\'nan\')")',
46+
'<!@(node -p "require(\'node-addon-api\').include")',
3947
],
4048
'conditions': [
4149
['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)