node-addon-api 2.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +1 -4
- package/CHANGELOG.md +172 -10
- package/README.md +81 -30
- package/appveyor.yml +3 -14
- package/benchmark/README.md +47 -0
- package/benchmark/binding.gyp +25 -0
- package/benchmark/function_args.cc +217 -0
- package/benchmark/function_args.js +60 -0
- package/benchmark/index.js +34 -0
- package/benchmark/property_descriptor.cc +91 -0
- package/benchmark/property_descriptor.js +37 -0
- package/common.gypi +21 -0
- package/doc/addon.md +157 -0
- package/doc/array.md +81 -0
- package/doc/array_buffer.md +4 -0
- package/doc/async_worker.md +33 -4
- package/doc/{async_progress_worker.md → async_worker_variants.md} +115 -3
- package/doc/bigint.md +7 -2
- package/doc/boolean.md +4 -0
- package/doc/buffer.md +4 -0
- package/doc/class_property_descriptor.md +3 -3
- package/doc/creating_a_release.md +5 -5
- package/doc/dataview.md +4 -0
- package/doc/date.md +2 -2
- package/doc/env.md +69 -0
- package/doc/error.md +5 -0
- package/doc/external.md +4 -0
- package/doc/function.md +109 -1
- package/doc/hierarchy.md +91 -0
- package/doc/instance_wrap.md +408 -0
- package/doc/name.md +29 -0
- package/doc/object.md +44 -1
- package/doc/object_lifetime_management.md +1 -1
- package/doc/object_wrap.md +219 -215
- package/doc/promises.md +5 -0
- package/doc/property_descriptor.md +64 -9
- package/doc/setup.md +1 -2
- package/doc/string.md +5 -1
- package/doc/symbol.md +5 -1
- package/doc/typed_array.md +4 -0
- package/doc/typed_array_of.md +4 -0
- package/doc/value.md +166 -104
- package/except.gypi +16 -0
- package/index.js +7 -41
- package/napi-inl.h +1116 -400
- package/napi.h +414 -142
- package/node_api.gyp +9 -0
- package/noexcept.gypi +16 -0
- package/{src/nothing.c → nothing.c} +0 -0
- package/package.json +63 -1
- package/tools/README.md +4 -4
- package/tools/conversion.js +4 -8
- package/doc/basic_types.md +0 -423
- package/doc/working_with_javascript_values.md +0 -14
- package/external-napi/node_api.h +0 -7
- package/src/node_api.cc +0 -3655
- package/src/node_api.gyp +0 -21
- package/src/node_api.h +0 -588
- package/src/node_api_types.h +0 -115
- package/src/node_internals.cc +0 -142
- package/src/node_internals.h +0 -157
- package/src/util-inl.h +0 -38
- package/src/util.h +0 -7
package/index.js
CHANGED
|
@@ -1,45 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
const path = require('path');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
.substr(1)
|
|
5
|
-
.replace(/-.*$/, '')
|
|
6
|
-
.split('.')
|
|
7
|
-
.map(function(item) {
|
|
8
|
-
return +item;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// TODO: Check if the main node semantic version is within multiple ranges,
|
|
12
|
-
// or detect presence of built-in N-API by some other mechanism TBD.
|
|
13
|
-
|
|
14
|
-
// We know which version of Node.js first shipped the incarnation of the API
|
|
15
|
-
// available in *this* package. So, if we find that the Node.js version is below
|
|
16
|
-
// that, we indicate that the API is missing from Node.js.
|
|
17
|
-
var isNodeApiBuiltin = (
|
|
18
|
-
versionArray[0] > 8 ||
|
|
19
|
-
(versionArray[0] == 8 && versionArray[1] >= 6) ||
|
|
20
|
-
(versionArray[0] == 6 && versionArray[1] >= 15) ||
|
|
21
|
-
(versionArray[0] == 6 && versionArray[1] >= 14 && versionArray[2] >= 2));
|
|
22
|
-
|
|
23
|
-
// The flag is not needed when the Node version is not 8, nor if the API is
|
|
24
|
-
// built-in, because we removed the flag at the same time as creating the final
|
|
25
|
-
// incarnation of the built-in API.
|
|
26
|
-
var needsFlag = (!isNodeApiBuiltin && versionArray[0] == 8);
|
|
27
|
-
|
|
28
|
-
var include = [__dirname];
|
|
29
|
-
var gyp = path.join(__dirname, 'src', 'node_api.gyp');
|
|
30
|
-
|
|
31
|
-
if (isNodeApiBuiltin) {
|
|
32
|
-
gyp += ':nothing';
|
|
33
|
-
} else {
|
|
34
|
-
gyp += ':node-api';
|
|
35
|
-
include.unshift(path.join(__dirname, 'external-napi'));
|
|
36
|
-
}
|
|
3
|
+
const include_dir = path.relative('.', __dirname);
|
|
37
4
|
|
|
38
5
|
module.exports = {
|
|
39
|
-
include:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
needsFlag: needsFlag
|
|
6
|
+
include: `"${__dirname}"`, // deprecated, can be removed as part of 4.0.0
|
|
7
|
+
include_dir,
|
|
8
|
+
gyp: path.join(include_dir, 'node_api.gyp:nothing'),
|
|
9
|
+
isNodeApiBuiltin: true,
|
|
10
|
+
needsFlag: false
|
|
45
11
|
};
|