koffi 2.7.1 → 2.7.3

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -2
  3. package/build/koffi/darwin_arm64/koffi.node +0 -0
  4. package/build/koffi/darwin_x64/koffi.node +0 -0
  5. package/build/koffi/freebsd_arm64/koffi.node +0 -0
  6. package/build/koffi/freebsd_ia32/koffi.node +0 -0
  7. package/build/koffi/freebsd_x64/koffi.node +0 -0
  8. package/build/koffi/linux_arm32hf/koffi.node +0 -0
  9. package/build/koffi/linux_arm64/koffi.node +0 -0
  10. package/build/koffi/linux_ia32/koffi.node +0 -0
  11. package/build/koffi/linux_riscv64hf64/koffi.node +0 -0
  12. package/build/koffi/linux_x64/koffi.node +0 -0
  13. package/build/koffi/openbsd_ia32/koffi.node +0 -0
  14. package/build/koffi/openbsd_x64/koffi.node +0 -0
  15. package/build/koffi/win32_arm64/koffi.node +0 -0
  16. package/build/koffi/win32_ia32/koffi.node +0 -0
  17. package/build/koffi/win32_x64/koffi.node +0 -0
  18. package/doc/misc.md +1 -1
  19. package/doc/unions.md +2 -2
  20. package/index.d.ts +2 -1
  21. package/index.js +23 -23
  22. package/indirect.js +23 -23
  23. package/package.json +2 -2
  24. package/src/core/libcc/brotli.cc +16 -24
  25. package/src/core/libcc/libcc.cc +63 -69
  26. package/src/core/libcc/libcc.hh +103 -110
  27. package/src/core/libcc/lz4.cc +18 -25
  28. package/src/core/libcc/miniz.cc +10 -18
  29. package/src/koffi/src/call.cc +1 -1
  30. package/src/koffi/src/util.cc +7 -13
  31. package/src/koffi/src/util.hh +9 -1
  32. package/vendor/node-addon-api/CHANGELOG.md +76 -0
  33. package/vendor/node-addon-api/LICENSE.md +2 -6
  34. package/vendor/node-addon-api/README.md +10 -9
  35. package/vendor/node-addon-api/benchmark/binding.gyp +4 -4
  36. package/vendor/node-addon-api/common.gypi +1 -2
  37. package/vendor/node-addon-api/doc/array.md +1 -1
  38. package/vendor/node-addon-api/doc/async_worker_variants.md +16 -16
  39. package/vendor/node-addon-api/doc/cmake-js.md +1 -1
  40. package/vendor/node-addon-api/doc/env.md +11 -0
  41. package/vendor/node-addon-api/doc/hierarchy.md +2 -0
  42. package/vendor/node-addon-api/doc/setup.md +53 -71
  43. package/vendor/node-addon-api/doc/syntax_error.md +66 -0
  44. package/vendor/node-addon-api/doc/value.md +2 -0
  45. package/vendor/node-addon-api/index.js +2 -1
  46. package/vendor/node-addon-api/napi-inl.h +68 -65
  47. package/vendor/node-addon-api/napi.h +15 -5
  48. package/vendor/node-addon-api/node_addon_api.gyp +32 -0
  49. package/vendor/node-addon-api/package.json +14 -3
  50. package/vendor/node-addon-api/test/addon.cc +7 -1
  51. package/vendor/node-addon-api/test/addon.js +5 -9
  52. package/vendor/node-addon-api/test/addon_data.cc +3 -3
  53. package/vendor/node-addon-api/test/addon_data.js +16 -38
  54. package/vendor/node-addon-api/test/bigint.cc +0 -1
  55. package/vendor/node-addon-api/test/binding.cc +12 -1
  56. package/vendor/node-addon-api/test/binding.gyp +10 -8
  57. package/vendor/node-addon-api/test/child_processes/addon.js +11 -0
  58. package/vendor/node-addon-api/test/child_processes/addon_data.js +24 -0
  59. package/vendor/node-addon-api/test/child_processes/objectwrap_function.js +22 -0
  60. package/vendor/node-addon-api/test/child_processes/threadsafe_function_exception.js +33 -0
  61. package/vendor/node-addon-api/test/child_processes/typed_threadsafe_function_exception.js +19 -0
  62. package/vendor/node-addon-api/test/common/index.js +57 -3
  63. package/vendor/node-addon-api/test/env_misc.cc +25 -0
  64. package/vendor/node-addon-api/test/env_misc.js +12 -0
  65. package/vendor/node-addon-api/test/error.cc +47 -0
  66. package/vendor/node-addon-api/test/error.js +16 -0
  67. package/vendor/node-addon-api/test/index.js +5 -0
  68. package/vendor/node-addon-api/test/objectwrap_function.cc +10 -12
  69. package/vendor/node-addon-api/test/objectwrap_function.js +4 -20
  70. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_exception.cc +50 -0
  71. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_exception.js +20 -0
  72. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_exception.cc +39 -0
  73. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_exception.js +13 -0
@@ -156,7 +156,15 @@ T GetNumber(Napi::Value value)
156
156
  RG_UNREACHABLE();
157
157
  }
158
158
 
159
- Size WideStringLength(const char16_t *str16, Size max);
159
+ template <typename T>
160
+ Size NullTerminatedLength(const T *ptr, Size max)
161
+ {
162
+ Size len = 0;
163
+ while (len < max && ptr[len]) {
164
+ len++;
165
+ }
166
+ return len;
167
+ }
160
168
 
161
169
  Napi::Object DecodeObject(Napi::Env env, const uint8_t *origin, const TypeInfo *type);
162
170
  void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type);
@@ -1,5 +1,81 @@
1
1
  # node-addon-api Changelog
2
2
 
3
+ ## 2024-01-18 Version 7.1.0, @legendecas
4
+
5
+ ### Notable changes
6
+
7
+ #### API
8
+
9
+ - Add Env::GetModuleFileName
10
+ - Add SyntaxError
11
+ - Allow NAPI\_VERSION env var and templatize AttachData callback
12
+ - Add common gyp dependency targets.
13
+
14
+ ### Commits
15
+
16
+ * \[[`864fed488c`](https://github.com/nodejs/node-addon-api/commit/864fed488c)] - build(deps): bump github/codeql-action from 3.22.12 to 3.23.0 (dependabot\[bot]) [#1428](https://github.com/nodejs/node-addon-api/pull/1428)
17
+ * \[[`81a8d43130`](https://github.com/nodejs/node-addon-api/commit/81a8d43130)] - build(deps): bump actions/dependency-review-action from 3.1.4 to 3.1.5 (dependabot\[bot]) [#1427](https://github.com/nodejs/node-addon-api/pull/1427)
18
+ * \[[`e20088941b`](https://github.com/nodejs/node-addon-api/commit/e20088941b)] - build(deps): bump github/codeql-action from 3.22.11 to 3.22.12 (dependabot\[bot]) [#1426](https://github.com/nodejs/node-addon-api/pull/1426)
19
+ * \[[`76c7b12e4e`](https://github.com/nodejs/node-addon-api/commit/76c7b12e4e)] - build(deps): bump actions/setup-node from 4.0.0 to 4.0.1 (dependabot\[bot]) [#1425](https://github.com/nodejs/node-addon-api/pull/1425)
20
+ * \[[`cd58edde1d`](https://github.com/nodejs/node-addon-api/commit/cd58edde1d)] - build(deps): bump actions/upload-artifact from 3.1.3 to 4.0.0 (dependabot\[bot]) [#1424](https://github.com/nodejs/node-addon-api/pull/1424)
21
+ * \[[`0fd1b9e0e1`](https://github.com/nodejs/node-addon-api/commit/0fd1b9e0e1)] - build(deps): bump github/codeql-action from 2.22.8 to 3.22.11 (dependabot\[bot]) [#1423](https://github.com/nodejs/node-addon-api/pull/1423)
22
+ * \[[`c181b19d68`](https://github.com/nodejs/node-addon-api/commit/c181b19d68)] - build(deps): bump actions/stale from 8.0.0 to 9.0.0 (dependabot\[bot]) [#1418](https://github.com/nodejs/node-addon-api/pull/1418)
23
+ * \[[`6fa67791a1`](https://github.com/nodejs/node-addon-api/commit/6fa67791a1)] - build(deps): bump actions/setup-python from 4.7.1 to 5.0.0 (dependabot\[bot]) [#1417](https://github.com/nodejs/node-addon-api/pull/1417)
24
+ * \[[`1fff346fa6`](https://github.com/nodejs/node-addon-api/commit/1fff346fa6)] - build(deps): bump actions/dependency-review-action from 3.1.3 to 3.1.4 (dependabot\[bot]) [#1415](https://github.com/nodejs/node-addon-api/pull/1415)
25
+ * \[[`ecb9690fe5`](https://github.com/nodejs/node-addon-api/commit/ecb9690fe5)] - build(deps): bump github/codeql-action from 2.22.7 to 2.22.8 (dependabot\[bot]) [#1414](https://github.com/nodejs/node-addon-api/pull/1414)
26
+ * \[[`969547b871`](https://github.com/nodejs/node-addon-api/commit/969547b871)] - build(deps): bump github/codeql-action from 2.22.5 to 2.22.7 (dependabot\[bot]) [#1413](https://github.com/nodejs/node-addon-api/pull/1413)
27
+ * \[[`183d1522a9`](https://github.com/nodejs/node-addon-api/commit/183d1522a9)] - build(deps): bump step-security/harden-runner from 2.6.0 to 2.6.1 (dependabot\[bot]) [#1412](https://github.com/nodejs/node-addon-api/pull/1412)
28
+ * \[[`25f977724a`](https://github.com/nodejs/node-addon-api/commit/25f977724a)] - build(deps): bump actions/dependency-review-action from 3.1.0 to 3.1.3 (dependabot\[bot]) [#1410](https://github.com/nodejs/node-addon-api/pull/1410)
29
+ * \[[`f6d125a407`](https://github.com/nodejs/node-addon-api/commit/f6d125a407)] - build(deps): bump actions/setup-python from 4.7.0 to 4.7.1 (dependabot\[bot]) [#1406](https://github.com/nodejs/node-addon-api/pull/1406)
30
+ * \[[`ce78a39ec7`](https://github.com/nodejs/node-addon-api/commit/ce78a39ec7)] - build(deps): bump github/codeql-action from 2.22.4 to 2.22.5 (dependabot\[bot]) [#1400](https://github.com/nodejs/node-addon-api/pull/1400)
31
+ * \[[`dc211ebb48`](https://github.com/nodejs/node-addon-api/commit/dc211ebb48)] - build(deps): bump actions/setup-node from 3.8.1 to 4.0.0 (dependabot\[bot]) [#1398](https://github.com/nodejs/node-addon-api/pull/1398)
32
+ * \[[`cab559e3bd`](https://github.com/nodejs/node-addon-api/commit/cab559e3bd)] - build(deps): bump ossf/scorecard-action from 2.3.0 to 2.3.1 (dependabot\[bot]) [#1397](https://github.com/nodejs/node-addon-api/pull/1397)
33
+ * \[[`f71ff5582d`](https://github.com/nodejs/node-addon-api/commit/f71ff5582d)] - build(deps): bump github/codeql-action from 2.22.3 to 2.22.4 (dependabot\[bot]) [#1396](https://github.com/nodejs/node-addon-api/pull/1396)
34
+ * \[[`21c1d08680`](https://github.com/nodejs/node-addon-api/commit/21c1d08680)] - build(deps): bump actions/checkout from 4.1.0 to 4.1.1 (dependabot\[bot]) [#1394](https://github.com/nodejs/node-addon-api/pull/1394)
35
+ * \[[`e4eec0939c`](https://github.com/nodejs/node-addon-api/commit/e4eec0939c)] - build(deps): bump github/codeql-action from 2.21.9 to 2.22.3 (dependabot\[bot]) [#1393](https://github.com/nodejs/node-addon-api/pull/1393)
36
+ * \[[`94f3459474`](https://github.com/nodejs/node-addon-api/commit/94f3459474)] - build(deps): bump ossf/scorecard-action from 2.2.0 to 2.3.0 (dependabot\[bot]) [#1388](https://github.com/nodejs/node-addon-api/pull/1388)
37
+ * \[[`90a741ef10`](https://github.com/nodejs/node-addon-api/commit/90a741ef10)] - build(deps): bump step-security/harden-runner from 2.5.1 to 2.6.0 (dependabot\[bot]) [#1386](https://github.com/nodejs/node-addon-api/pull/1386)
38
+ * \[[`7e1aa06132`](https://github.com/nodejs/node-addon-api/commit/7e1aa06132)] - Update LICENSE.md (Michael Dawson) [#1385](https://github.com/nodejs/node-addon-api/pull/1385)
39
+ * \[[`0a0612362e`](https://github.com/nodejs/node-addon-api/commit/0a0612362e)] - build(deps): bump github/codeql-action from 2.21.7 to 2.21.9 (dependabot\[bot]) [#1384](https://github.com/nodejs/node-addon-api/pull/1384)
40
+ * \[[`47bd430da2`](https://github.com/nodejs/node-addon-api/commit/47bd430da2)] - build(deps): bump actions/checkout from 4.0.0 to 4.1.0 (dependabot\[bot]) [#1383](https://github.com/nodejs/node-addon-api/pull/1383)
41
+ * \[[`b3f7f73cb9`](https://github.com/nodejs/node-addon-api/commit/b3f7f73cb9)] - build(deps): bump actions/dependency-review-action from 3.0.8 to 3.1.0 (dependabot\[bot]) [#1377](https://github.com/nodejs/node-addon-api/pull/1377)
42
+ * \[[`12c1655387`](https://github.com/nodejs/node-addon-api/commit/12c1655387)] - build(deps): bump github/codeql-action from 2.21.6 to 2.21.7 (dependabot\[bot]) [#1380](https://github.com/nodejs/node-addon-api/pull/1380)
43
+ * \[[`6abed318e4`](https://github.com/nodejs/node-addon-api/commit/6abed318e4)] - build(deps): bump github/codeql-action from 2.21.5 to 2.21.6 (dependabot\[bot]) [#1378](https://github.com/nodejs/node-addon-api/pull/1378)
44
+ * \[[`89eda59930`](https://github.com/nodejs/node-addon-api/commit/89eda59930)] - build(deps): bump actions/upload-artifact from 3.1.2 to 3.1.3 (dependabot\[bot]) [#1376](https://github.com/nodejs/node-addon-api/pull/1376)
45
+ * \[[`90870dbffa`](https://github.com/nodejs/node-addon-api/commit/90870dbffa)] - build(deps): bump actions/checkout from 3.6.0 to 4.0.0 (dependabot\[bot]) [#1375](https://github.com/nodejs/node-addon-api/pull/1375)
46
+ * \[[`b860793eff`](https://github.com/nodejs/node-addon-api/commit/b860793eff)] - build(deps): bump github/codeql-action from 2.21.2 to 2.21.5 (dependabot\[bot]) [#1372](https://github.com/nodejs/node-addon-api/pull/1372)
47
+ * \[[`f9b9974b4a`](https://github.com/nodejs/node-addon-api/commit/f9b9974b4a)] - build(deps): bump actions/checkout from 3.5.3 to 3.6.0 (dependabot\[bot]) [#1371](https://github.com/nodejs/node-addon-api/pull/1371)
48
+ * \[[`9596e3de2d`](https://github.com/nodejs/node-addon-api/commit/9596e3de2d)] - build(deps): bump actions/setup-node from 3.7.0 to 3.8.1 (dependabot\[bot]) [#1370](https://github.com/nodejs/node-addon-api/pull/1370)
49
+ * \[[`e969210747`](https://github.com/nodejs/node-addon-api/commit/e969210747)] - build(deps): bump actions/dependency-review-action from 3.0.6 to 3.0.8 (dependabot\[bot]) [#1368](https://github.com/nodejs/node-addon-api/pull/1368)
50
+ * \[[`13ef96a5a9`](https://github.com/nodejs/node-addon-api/commit/13ef96a5a9)] - build(deps): bump step-security/harden-runner from 2.5.0 to 2.5.1 (dependabot\[bot]) [#1364](https://github.com/nodejs/node-addon-api/pull/1364)
51
+ * \[[`9776d148b3`](https://github.com/nodejs/node-addon-api/commit/9776d148b3)] - build(deps): bump github/codeql-action from 2.21.1 to 2.21.2 (dependabot\[bot]) [#1358](https://github.com/nodejs/node-addon-api/pull/1358)
52
+ * \[[`59dc6be097`](https://github.com/nodejs/node-addon-api/commit/59dc6be097)] - build(deps): bump github/codeql-action from 2.21.0 to 2.21.1 (dependabot\[bot]) [#1357](https://github.com/nodejs/node-addon-api/pull/1357)
53
+ * \[[`5e72796cd5`](https://github.com/nodejs/node-addon-api/commit/5e72796cd5)] - build(deps): bump step-security/harden-runner from 2.4.1 to 2.5.0 (dependabot\[bot]) [#1356](https://github.com/nodejs/node-addon-api/pull/1356)
54
+ * \[[`4e62db45e4`](https://github.com/nodejs/node-addon-api/commit/4e62db45e4)] - build(deps): bump github/codeql-action from 2.20.3 to 2.21.0 (dependabot\[bot]) [#1353](https://github.com/nodejs/node-addon-api/pull/1353)
55
+ * \[[`0c093a33e8`](https://github.com/nodejs/node-addon-api/commit/0c093a33e8)] - build(deps): bump github/codeql-action from 2.20.1 to 2.20.3 (dependabot\[bot]) [#1349](https://github.com/nodejs/node-addon-api/pull/1349)
56
+ * \[[`5523b2d3fa`](https://github.com/nodejs/node-addon-api/commit/5523b2d3fa)] - build(deps): bump actions/setup-node from 3.6.0 to 3.7.0 (dependabot\[bot]) [#1348](https://github.com/nodejs/node-addon-api/pull/1348)
57
+ * \[[`afa494ef7f`](https://github.com/nodejs/node-addon-api/commit/afa494ef7f)] - Add Node.js version restrictions (Ingo Fischer) [#1340](https://github.com/nodejs/node-addon-api/pull/1340)
58
+ * \[[`ac4c87f660`](https://github.com/nodejs/node-addon-api/commit/ac4c87f660)] - build(deps): bump ossf/scorecard-action from 2.0.6 to 2.2.0 (dependabot\[bot]) [#1344](https://github.com/nodejs/node-addon-api/pull/1344)
59
+ * \[[`47aeb6689d`](https://github.com/nodejs/node-addon-api/commit/47aeb6689d)] - build(deps): bump github/codeql-action from 2.2.12 to 2.20.1 (dependabot\[bot]) [#1343](https://github.com/nodejs/node-addon-api/pull/1343)
60
+ * \[[`bd45a8fffc`](https://github.com/nodejs/node-addon-api/commit/bd45a8fffc)] - build(deps): bump step-security/harden-runner from 2.3.0 to 2.4.1 (dependabot\[bot]) [#1342](https://github.com/nodejs/node-addon-api/pull/1342)
61
+ * \[[`343a1e1708`](https://github.com/nodejs/node-addon-api/commit/343a1e1708)] - build(deps-dev): bump fs-extra from 9.1.0 to 11.1.1 (dependabot\[bot]) [#1335](https://github.com/nodejs/node-addon-api/pull/1335)
62
+ * \[[`4168c10182`](https://github.com/nodejs/node-addon-api/commit/4168c10182)] - build(deps): bump actions/stale from 5.2.1 to 8.0.0 (dependabot\[bot]) [#1333](https://github.com/nodejs/node-addon-api/pull/1333)
63
+ * \[[`1c182abd1f`](https://github.com/nodejs/node-addon-api/commit/1c182abd1f)] - build(deps): bump actions/dependency-review-action from 2.5.1 to 3.0.6 (dependabot\[bot]) [#1331](https://github.com/nodejs/node-addon-api/pull/1331)
64
+ * \[[`717a61931d`](https://github.com/nodejs/node-addon-api/commit/717a61931d)] - build(deps): bump actions/checkout from 3.5.2 to 3.5.3 (dependabot\[bot]) [#1329](https://github.com/nodejs/node-addon-api/pull/1329)
65
+ * \[[`d605d62c89`](https://github.com/nodejs/node-addon-api/commit/d605d62c89)] - **chore**: lock python version in actions (Chengzhong Wu) [#1403](https://github.com/nodejs/node-addon-api/pull/1403)
66
+ * \[[`734e3f2509`](https://github.com/nodejs/node-addon-api/commit/734e3f2509)] - **doc**: fix rendering of code blocks in list (Tobias Nießen) [#1401](https://github.com/nodejs/node-addon-api/pull/1401)
67
+ * \[[`dfdf6eb6e6`](https://github.com/nodejs/node-addon-api/commit/dfdf6eb6e6)] - **doc**: add missing title IsBigInt (Marx) [#1352](https://github.com/nodejs/node-addon-api/pull/1352)
68
+ * \[[`8850997f38`](https://github.com/nodejs/node-addon-api/commit/8850997f38)] - **doc**: fix typo AsyncProgressWorker::ExecutionProgress (JerryZhongJ) [#1350](https://github.com/nodejs/node-addon-api/pull/1350)
69
+ * \[[`8192a471a1`](https://github.com/nodejs/node-addon-api/commit/8192a471a1)] - **docs**: fixed Broken Links (Ömer AKGÜL) [#1405](https://github.com/nodejs/node-addon-api/pull/1405)
70
+ * \[[`16a18c047a`](https://github.com/nodejs/node-addon-api/commit/16a18c047a)] - **fix**: handle c++ exception in TSFN callback (Chengzhong Wu) [#1345](https://github.com/nodejs/node-addon-api/pull/1345)
71
+ * \[[`ab14347080`](https://github.com/nodejs/node-addon-api/commit/ab14347080)] - **gyp**: add common targets (Chengzhong Wu) [#1389](https://github.com/nodejs/node-addon-api/pull/1389)
72
+ * \[[`fa3518bc08`](https://github.com/nodejs/node-addon-api/commit/fa3518bc08)] - **src**: remove duplicate buffer info calls (Chengzhong Wu) [#1354](https://github.com/nodejs/node-addon-api/pull/1354)
73
+ * \[[`b83e453e6e`](https://github.com/nodejs/node-addon-api/commit/b83e453e6e)] - **src**: add Env::GetModuleFileName (Kevin Eady) [#1327](https://github.com/nodejs/node-addon-api/pull/1327)
74
+ * \[[`d9828c6264`](https://github.com/nodejs/node-addon-api/commit/d9828c6264)] - **src**: add SyntaxError (Kevin Eady) [#1326](https://github.com/nodejs/node-addon-api/pull/1326)
75
+ * \[[`c52e764bb2`](https://github.com/nodejs/node-addon-api/commit/c52e764bb2)] - **src,test,build**: allow NAPI\_VERSION env var and templatize AttachData callback (Gabriel Schulhof) [#1399](https://github.com/nodejs/node-addon-api/pull/1399)
76
+ * \[[`8f028d630a`](https://github.com/nodejs/node-addon-api/commit/8f028d630a)] - **test**: remove experimental flag from bigint (Gabriel Schulhof) [#1395](https://github.com/nodejs/node-addon-api/pull/1395)
77
+ * \[[`414be9e000`](https://github.com/nodejs/node-addon-api/commit/414be9e000)] - **test**: run interfering tests in their own process (Gabriel Schulhof) [#1325](https://github.com/nodejs/node-addon-api/pull/1325)
78
+
3
79
  ## 2023-06-13 Version 7.0.0, @KevinEady
4
80
 
5
81
  ### Notable changes
@@ -1,13 +1,9 @@
1
1
  The MIT License (MIT)
2
- =====================
3
2
 
4
- Copyright (c) 2017 Node.js API collaborators
5
- -----------------------------------
6
-
7
- *Node.js API collaborators listed at <https://github.com/nodejs/node-addon-api#collaborators>*
3
+ Copyright (c) 2017 [Node.js API collaborators](https://github.com/nodejs/node-addon-api#collaborators)
8
4
 
9
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
6
 
11
7
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
8
 
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -70,7 +70,7 @@ and node-addon-api.
70
70
  - **[Contributors](#contributors)**
71
71
  - **[License](#license)**
72
72
 
73
- ## **Current version: 7.0.0**
73
+ ## **Current version: 7.1.0**
74
74
 
75
75
  (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
76
76
 
@@ -132,6 +132,7 @@ The following is the documentation for node-addon-api.
132
132
  - [Error](doc/error.md)
133
133
  - [TypeError](doc/type_error.md)
134
134
  - [RangeError](doc/range_error.md)
135
+ - [SyntaxError](doc/syntax_error.md)
135
136
  - [Object Lifetime Management](doc/object_lifetime_management.md)
136
137
  - [HandleScope](doc/handle_scope.md)
137
138
  - [EscapableHandleScope](doc/escapable_handle_scope.md)
@@ -152,14 +153,14 @@ The following is the documentation for node-addon-api.
152
153
 
153
154
  Are you new to **node-addon-api**? Take a look at our **[examples](https://github.com/nodejs/node-addon-examples)**
154
155
 
155
- - **[Hello World](https://github.com/nodejs/node-addon-examples/tree/HEAD/1_hello_world/node-addon-api)**
156
- - **[Pass arguments to a function](https://github.com/nodejs/node-addon-examples/tree/HEAD/2_function_arguments/node-addon-api)**
157
- - **[Callbacks](https://github.com/nodejs/node-addon-examples/tree/HEAD/3_callbacks/node-addon-api)**
158
- - **[Object factory](https://github.com/nodejs/node-addon-examples/tree/HEAD/4_object_factory/node-addon-api)**
159
- - **[Function factory](https://github.com/nodejs/node-addon-examples/tree/HEAD/5_function_factory/node-addon-api)**
160
- - **[Wrapping C++ Object](https://github.com/nodejs/node-addon-examples/tree/HEAD/6_object_wrap/node-addon-api)**
161
- - **[Factory of wrapped object](https://github.com/nodejs/node-addon-examples/tree/HEAD/7_factory_wrap/node-addon-api)**
162
- - **[Passing wrapped object around](https://github.com/nodejs/node-addon-examples/tree/HEAD/8_passing_wrapped/node-addon-api)**
156
+ - **[Hello World](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/1_hello_world)**
157
+ - **[Pass arguments to a function](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/2_function_arguments/node-addon-api)**
158
+ - **[Callbacks](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/3_callbacks/node-addon-api)**
159
+ - **[Object factory](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/4_object_factory/node-addon-api)**
160
+ - **[Function factory](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/5_function_factory/node-addon-api)**
161
+ - **[Wrapping C++ Object](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/6_object_wrap/node-addon-api)**
162
+ - **[Factory of wrapped object](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/7_factory_wrap/node-addon-api)**
163
+ - **[Passing wrapped object around](https://github.com/nodejs/node-addon-examples/tree/main/src/2-js-to-native-conversion/8_passing_wrapped/node-addon-api)**
163
164
 
164
165
  <a name="tests"></a>
165
166
 
@@ -4,22 +4,22 @@
4
4
  {
5
5
  'target_name': 'function_args',
6
6
  'sources': [ 'function_args.cc' ],
7
- 'includes': [ '../except.gypi' ],
7
+ 'dependencies': ['../node_addon_api.gyp:node_addon_api_except'],
8
8
  },
9
9
  {
10
10
  'target_name': 'function_args_noexcept',
11
11
  'sources': [ 'function_args.cc' ],
12
- 'includes': [ '../noexcept.gypi' ],
12
+ 'dependencies': ['../node_addon_api.gyp:node_addon_api'],
13
13
  },
14
14
  {
15
15
  'target_name': 'property_descriptor',
16
16
  'sources': [ 'property_descriptor.cc' ],
17
- 'includes': [ '../except.gypi' ],
17
+ 'dependencies': ['../node_addon_api.gyp:node_addon_api_except'],
18
18
  },
19
19
  {
20
20
  'target_name': 'property_descriptor_noexcept',
21
21
  'sources': [ 'property_descriptor.cc' ],
22
- 'includes': [ '../noexcept.gypi' ],
22
+ 'dependencies': ['../node_addon_api.gyp:node_addon_api'],
23
23
  },
24
24
  ]
25
25
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  'variables': {
3
- 'NAPI_VERSION%': "<!(node -p \"process.versions.napi\")",
3
+ 'NAPI_VERSION%': "<!(node -p \"process.env.NAPI_VERSION || process.versions.napi\")",
4
4
  'disable_deprecated': "<!(node -p \"process.env['npm_config_disable_deprecated']\")"
5
5
  },
6
6
  'conditions': [
@@ -15,7 +15,6 @@
15
15
  }
16
16
  }]
17
17
  ],
18
- 'include_dirs': ["<!(node -p \"require('../').include_dir\")"],
19
18
  'cflags': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ],
20
19
  'cflags_cc': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ]
21
20
  }
@@ -9,7 +9,7 @@ around `napi_value` representing a JavaScript Array.
9
9
  types such as [`Napi::Int32Array`][] and [`Napi::ArrayBuffer`][], respectively,
10
10
  that can be used for transferring large amounts of data from JavaScript to the
11
11
  native side. An example illustrating the use of a JavaScript-provided
12
- `ArrayBuffer` in native code is available [here](https://github.com/nodejs/node-addon-examples/tree/HEAD/array_buffer_to_native/node-addon-api).
12
+ `ArrayBuffer` in native code is available [here](https://github.com/nodejs/node-addon-examples/tree/main/src/2-js-to-native-conversion/array_buffer_to_native/node-addon-api).
13
13
 
14
14
  ## Constructor
15
15
  ```cpp
@@ -52,9 +52,9 @@ virtual void Napi::AsyncProgressWorker::OnOK();
52
52
  ### OnProgress
53
53
 
54
54
  This method is invoked when the computation in the
55
- `Napi::AsyncProgressWorker::ExecutionProcess::Send` method was called during
55
+ `Napi::AsyncProgressWorker::ExecutionProgress::Send` method was called during
56
56
  worker thread execution. This method can also be triggered via a call to
57
- `Napi::AsyncProgress[Queue]Worker::ExecutionProcess::Signal`, in which case the
57
+ `Napi::AsyncProgress[Queue]Worker::ExecutionProgress::Signal`, in which case the
58
58
  `data` parameter will be `nullptr`.
59
59
 
60
60
  ```cpp
@@ -227,7 +227,7 @@ unexpected upcoming thread safe calls.
227
227
  virtual Napi::AsyncProgressWorker::~AsyncProgressWorker();
228
228
  ```
229
229
 
230
- # AsyncProgressWorker::ExecutionProcess
230
+ # AsyncProgressWorker::ExecutionProgress
231
231
 
232
232
  A bridge class created before the worker thread execution of `Napi::AsyncProgressWorker::Execute`.
233
233
 
@@ -235,15 +235,15 @@ A bridge class created before the worker thread execution of `Napi::AsyncProgres
235
235
 
236
236
  ### Send
237
237
 
238
- `Napi::AsyncProgressWorker::ExecutionProcess::Send` takes two arguments, a pointer
238
+ `Napi::AsyncProgressWorker::ExecutionProgress::Send` takes two arguments, a pointer
239
239
  to a generic type of data, and a `size_t` to indicate how many items the pointer is
240
240
  pointing to.
241
241
 
242
242
  The data pointed to will be copied to internal slots of `Napi::AsyncProgressWorker` so
243
- after the call to `Napi::AsyncProgressWorker::ExecutionProcess::Send` the data can
243
+ after the call to `Napi::AsyncProgressWorker::ExecutionProgress::Send` the data can
244
244
  be safely released.
245
245
 
246
- Note that `Napi::AsyncProgressWorker::ExecutionProcess::Send` merely guarantees
246
+ Note that `Napi::AsyncProgressWorker::ExecutionProgress::Send` merely guarantees
247
247
  **eventual** invocation of `Napi::AsyncProgressWorker::OnProgress`, which means
248
248
  multiple send might be coalesced into single invocation of `Napi::AsyncProgressWorker::OnProgress`
249
249
  with latest data. If you would like to guarantee that there is one invocation of
@@ -251,16 +251,16 @@ with latest data. If you would like to guarantee that there is one invocation of
251
251
  class instead which is documented further down this page.
252
252
 
253
253
  ```cpp
254
- void Napi::AsyncProgressWorker::ExecutionProcess::Send(const T* data, size_t count) const;
254
+ void Napi::AsyncProgressWorker::ExecutionProgress::Send(const T* data, size_t count) const;
255
255
  ```
256
256
 
257
257
  ### Signal
258
258
 
259
- `Napi::AsyncProgressWorker::ExecutionProcess::Signal` triggers an invocation of
259
+ `Napi::AsyncProgressWorker::ExecutionProgress::Signal` triggers an invocation of
260
260
  `Napi::AsyncProgressWorker::OnProgress` with `nullptr` as the `data` parameter.
261
261
 
262
262
  ```cpp
263
- void Napi::AsyncProgressWorker::ExecutionProcess::Signal();
263
+ void Napi::AsyncProgressWorker::ExecutionProgress::Signal();
264
264
  ```
265
265
 
266
266
  ## Example
@@ -402,7 +402,7 @@ thread in the order it was committed.
402
402
  For the most basic use, only the `Napi::AsyncProgressQueueWorker::Execute` and
403
403
  `Napi::AsyncProgressQueueWorker::OnProgress` method must be implemented in a subclass.
404
404
 
405
- # AsyncProgressQueueWorker::ExecutionProcess
405
+ # AsyncProgressQueueWorker::ExecutionProgress
406
406
 
407
407
  A bridge class created before the worker thread execution of `Napi::AsyncProgressQueueWorker::Execute`.
408
408
 
@@ -410,30 +410,30 @@ A bridge class created before the worker thread execution of `Napi::AsyncProgres
410
410
 
411
411
  ### Send
412
412
 
413
- `Napi::AsyncProgressQueueWorker::ExecutionProcess::Send` takes two arguments, a pointer
413
+ `Napi::AsyncProgressQueueWorker::ExecutionProgress::Send` takes two arguments, a pointer
414
414
  to a generic type of data, and a `size_t` to indicate how many items the pointer is
415
415
  pointing to.
416
416
 
417
417
  The data pointed to will be copied to internal slots of `Napi::AsyncProgressQueueWorker` so
418
- after the call to `Napi::AsyncProgressQueueWorker::ExecutionProcess::Send` the data can
418
+ after the call to `Napi::AsyncProgressQueueWorker::ExecutionProgress::Send` the data can
419
419
  be safely released.
420
420
 
421
- `Napi::AsyncProgressQueueWorker::ExecutionProcess::Send` guarantees invocation
421
+ `Napi::AsyncProgressQueueWorker::ExecutionProgress::Send` guarantees invocation
422
422
  of `Napi::AsyncProgressQueueWorker::OnProgress`, which means multiple `Send`
423
423
  call will result in the in-order invocation of `Napi::AsyncProgressQueueWorker::OnProgress`
424
424
  with each data item.
425
425
 
426
426
  ```cpp
427
- void Napi::AsyncProgressQueueWorker::ExecutionProcess::Send(const T* data, size_t count) const;
427
+ void Napi::AsyncProgressQueueWorker::ExecutionProgress::Send(const T* data, size_t count) const;
428
428
  ```
429
429
 
430
430
  ### Signal
431
431
 
432
- `Napi::AsyncProgressQueueWorker::ExecutionProcess::Signal` triggers an invocation of
432
+ `Napi::AsyncProgressQueueWorker::ExecutionProgress::Signal` triggers an invocation of
433
433
  `Napi::AsyncProgressQueueWorker::OnProgress` with `nullptr` as the `data` parameter.
434
434
 
435
435
  ```cpp
436
- void Napi::AsyncProgressQueueWorker::ExecutionProcess::Signal() const;
436
+ void Napi::AsyncProgressQueueWorker::ExecutionProgress::Signal() const;
437
437
  ```
438
438
 
439
439
  ## Example
@@ -51,7 +51,7 @@ If your Node-API native add-on uses the optional [**node-addon-api**](https://gi
51
51
 
52
52
  ## Example
53
53
 
54
- A working example of an Node-API native addon built using CMake.js can be found on the [node-addon-examples repository](https://github.com/nodejs/node-addon-examples/tree/HEAD/build_with_cmake#building-n-api-addons-using-cmakejs).
54
+ A working example of an Node-API native addon built using CMake.js can be found on the [node-addon-examples repository](https://github.com/nodejs/node-addon-examples/tree/main/src/8-tooling/build_with_cmake#building-node-api-addons-using-cmakejs).
55
55
 
56
56
  ## **CMake** Reference
57
57
 
@@ -131,6 +131,17 @@ addon. The item will be passed to the function `fini` which gets called when an
131
131
  instance of the addon is unloaded. This overload accepts an additional hint to
132
132
  be passed to `fini`.
133
133
 
134
+ ### GetModuleFileName
135
+
136
+ ```cpp
137
+ const char* Napi::Env::GetModuleFileName() const;
138
+ ```
139
+
140
+ Returns a A URL containing the absolute path of the location from which the
141
+ add-on was loaded. For a file on the local file system it will start with
142
+ `file://`. The string is null-terminated and owned by env and must thus not be
143
+ modified or freed. It is only valid while the add-on is loaded.
144
+
134
145
  ### AddCleanupHook
135
146
 
136
147
  ```cpp
@@ -37,6 +37,7 @@
37
37
  | [`Napi::Reference`] | |
38
38
  | [`Napi::String`][] | [`Napi::Name`][] |
39
39
  | [`Napi::Symbol`][] | [`Napi::Name`][] |
40
+ | [`Napi::SyntaxError`][] | [`Napi::Error`][] |
40
41
  | [`Napi::ThreadSafeFunction`][] | |
41
42
  | [`Napi::TypeTaggable`][] | [`Napi::Value][] |
42
43
  | [`Napi::TypeError`][] | [`Napi::Error`][] |
@@ -82,6 +83,7 @@
82
83
  [`Napi::Reference<Napi::Object>`]: ./reference.md
83
84
  [`Napi::String`]: ./string.md
84
85
  [`Napi::Symbol`]: ./symbol.md
86
+ [`Napi::SyntaxError`]: ./syntax_error.md
85
87
  [`Napi::ThreadSafeFunction`]: ./threadsafe_function.md
86
88
  [`Napi::TypeError`]: ./type_error.md
87
89
  [`Napi::TypeTaggable`]: ./type_taggable.md
@@ -17,84 +17,66 @@ To use **Node-API** in a native module:
17
17
 
18
18
  1. Add a dependency on this package to `package.json`:
19
19
 
20
- ```json
21
- "dependencies": {
22
- "node-addon-api": "*",
23
- }
24
- ```
25
-
26
- 2. Reference this package's include directory and gyp file in `binding.gyp`:
27
-
28
- ```gyp
29
- 'include_dirs': ["<!(node -p \"require('node-addon-api').include_dir\")"],
30
- ```
31
-
32
- 3. Decide whether the package will enable C++ exceptions in the Node-API wrapper.
20
+ ```json
21
+ "dependencies": {
22
+ "node-addon-api": "*",
23
+ }
24
+ ```
25
+
26
+ 2. Decide whether the package will enable C++ exceptions in the Node-API
27
+ wrapper, and reference this package as a dependency in `binding.gyp`.
33
28
  The base ABI-stable C APIs do not throw or handle C++ exceptions, but the
34
29
  Node-API C++ wrapper classes may _optionally_
35
30
  [integrate C++ and JavaScript exception-handling
36
31
  ](https://github.com/nodejs/node-addon-api/blob/HEAD/doc/error_handling.md).
37
- To enable that capability, C++ exceptions must be enabled in `binding.gyp`:
38
-
39
- ```gyp
40
- 'cflags!': [ '-fno-exceptions' ],
41
- 'cflags_cc!': [ '-fno-exceptions' ],
42
- 'conditions': [
43
- ["OS=='win'", {
44
- "defines": [
45
- "_HAS_EXCEPTIONS=1"
46
- ],
47
- "msvs_settings": {
48
- "VCCLCompilerTool": {
49
- "ExceptionHandling": 1
50
- },
51
- },
52
- }],
53
- ["OS=='mac'", {
54
- 'xcode_settings': {
55
- 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
56
- 'CLANG_CXX_LIBRARY': 'libc++',
57
- 'MACOSX_DEPLOYMENT_TARGET': '10.7',
58
- },
59
- }],
60
- ],
61
- ```
62
-
63
- Alternatively, disable use of C++ exceptions in Node-API:
64
-
65
- ```gyp
66
- 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
67
- ```
68
-
69
- If you decide to use node-addon-api without C++ exceptions enabled, please
70
- consider enabling node-addon-api safe API type guards to ensure the proper
71
- exception handling pattern:
72
-
73
- ```gyp
74
- 'defines': [ 'NODE_ADDON_API_ENABLE_MAYBE' ],
75
- ```
76
-
77
- 4. If you would like your native addon to support OSX, please also add the
78
- following settings in the `binding.gyp` file:
79
-
80
- ```gyp
81
- 'conditions': [
82
- ['OS=="mac"', {
83
- 'cflags+': ['-fvisibility=hidden'],
84
- 'xcode_settings': {
85
- 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
86
- }
87
- }]
88
- ]
89
- ```
90
-
91
- 5. Include `napi.h` in the native module code.
32
+
33
+ To use without C++ exceptions, add the following to `binding.gyp`:
34
+
35
+ ```gyp
36
+ 'dependencies': [
37
+ "<!(node -p \"require('node-addon-api').targets\"):node_addon_api",
38
+ ],
39
+ ```
40
+
41
+ To enable that capability, add an alternative dependency in `binding.gyp`:
42
+
43
+ ```gyp
44
+ 'dependencies': [
45
+ "<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
46
+ ],
47
+ ```
48
+
49
+ If you decide to use node-addon-api without C++ exceptions enabled, please
50
+ consider enabling node-addon-api safe API type guards to ensure the proper
51
+ exception handling pattern:
52
+
53
+ ```gyp
54
+ 'dependencies': [
55
+ "<!(node -p \"require('node-addon-api').targets\"):node_addon_api_maybe",
56
+ ],
57
+ ```
58
+
59
+ 3. If you would like your native addon to support OSX, please also add the
60
+ following settings in the `binding.gyp` file:
61
+
62
+ ```gyp
63
+ 'conditions': [
64
+ ['OS=="mac"', {
65
+ 'cflags+': ['-fvisibility=hidden'],
66
+ 'xcode_settings': {
67
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
68
+ }
69
+ }]
70
+ ]
71
+ ```
72
+
73
+ 4. Include `napi.h` in the native module code.
92
74
  To ensure only ABI-stable APIs are used, DO NOT include
93
75
  `node.h`, `nan.h`, or `v8.h`.
94
76
 
95
- ```C++
96
- #include "napi.h"
97
- ```
77
+ ```C++
78
+ #include "napi.h"
79
+ ```
98
80
 
99
81
  At build time, the Node-API back-compat library code will be used only when the
100
82
  targeted node version *does not* have Node-API built-in.
@@ -0,0 +1,66 @@
1
+ # SyntaxError
2
+
3
+ The `Napi::SyntaxError` class is a representation of the JavaScript
4
+ `SyntaxError` that is thrown when the engine encounters tokens or token order
5
+ that does not conform to the syntax of the language when parsing code.
6
+
7
+ The `Napi::SyntaxError` class inherits its behaviors from the `Napi::Error`
8
+ class (for more info see: [`Napi::Error`](error.md)).
9
+
10
+ For more details about error handling refer to the section titled [Error
11
+ handling](error_handling.md).
12
+
13
+ ## Methods
14
+
15
+ ### New
16
+
17
+ Creates a new instance of a `Napi::SyntaxError` object.
18
+
19
+ ```cpp
20
+ Napi::SyntaxError::New(Napi::Env env, const char* message);
21
+ ```
22
+
23
+ - `[in] Env`: The environment in which to construct the `Napi::SyntaxError`
24
+ object.
25
+ - `[in] message`: Null-terminated string to be used as the message for the
26
+ `Napi::SyntaxError`.
27
+
28
+ Returns an instance of a `Napi::SyntaxError` object.
29
+
30
+ ### New
31
+
32
+ Creates a new instance of a `Napi::SyntaxError` object.
33
+
34
+ ```cpp
35
+ Napi::SyntaxError::New(Napi::Env env, const std::string& message);
36
+ ```
37
+
38
+ - `[in] Env`: The environment in which to construct the `Napi::SyntaxError`
39
+ object.
40
+ - `[in] message`: Reference string to be used as the message for the
41
+ `Napi::SyntaxError`.
42
+
43
+ Returns an instance of a `Napi::SyntaxError` object.
44
+
45
+ ### Constructor
46
+
47
+ Creates a new empty instance of a `Napi::SyntaxError`.
48
+
49
+ ```cpp
50
+ Napi::SyntaxError::SyntaxError();
51
+ ```
52
+
53
+ ### Constructor
54
+
55
+ Initializes a `Napi::SyntaxError` instance from an existing Javascript error
56
+ object.
57
+
58
+ ```cpp
59
+ Napi::SyntaxError::SyntaxError(napi_env env, napi_value value);
60
+ ```
61
+
62
+ - `[in] Env`: The environment in which to construct the `Napi::SyntaxError`
63
+ object.
64
+ - `[in] value`: The `Napi::Error` reference to wrap.
65
+
66
+ Returns an instance of a `Napi::SyntaxError` object.
@@ -141,6 +141,8 @@ bool Napi::Value::IsArrayBuffer() const;
141
141
  Returns `true` if the underlying value is a JavaScript `Napi::ArrayBuffer` or
142
142
  `false` otherwise.
143
143
 
144
+ ### IsBigInt
145
+
144
146
  ```cpp
145
147
  bool Napi::Value::IsBigInt() const;
146
148
  ```
@@ -5,7 +5,8 @@ const includeDir = path.relative('.', __dirname);
5
5
  module.exports = {
6
6
  include: `"${__dirname}"`, // deprecated, can be removed as part of 4.0.0
7
7
  include_dir: includeDir,
8
- gyp: path.join(includeDir, 'node_api.gyp:nothing'),
8
+ gyp: path.join(includeDir, 'node_api.gyp:nothing'), // deprecated.
9
+ targets: path.join(includeDir, 'node_addon_api.gyp'),
9
10
  isNodeApiBuiltin: true,
10
11
  needsFlag: false
11
12
  };