File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
var path = require ( 'path' ) ;
2
2
3
+ // We know which version of Node.js first shipped the incarnation of the API
4
+ // available in *this* package. So, if we find that the Node.js version is below
5
+ // that, we indicate that the API is missing from Node.js.
6
+ function getNodeApiBuiltin ( ) {
7
+ var versionArray = process . version
8
+ . substr ( 1 )
9
+ . split ( '.' )
10
+ . map ( function ( item ) {
11
+ return + item ;
12
+ } ) ;
13
+ return versionArray [ 0 ] >= 8 && versionArray [ 1 ] >= 4 && versionArray [ 2 ] >= 0 ;
14
+ }
15
+
3
16
// TODO: Check if the main node semantic version is within multiple ranges,
4
17
// or detect presence of built-in N-API by some other mechanism TBD.
5
- var isNodeApiBuiltin = process . versions . modules >= 52 ; // Node 8.x
18
+ var isNodeApiBuiltin = getNodeApiBuiltin ( ) ;
6
19
7
20
var include = path . join ( __dirname , 'src' ) ;
8
21
var gyp = path . join ( __dirname , 'src' , 'node_api.gyp' ) ;
You can’t perform that action at this time.
0 commit comments