koffi 2.12.1 → 2.12.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.
Files changed (188) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE.txt +2 -2
  3. package/README.md +8 -8
  4. package/build/koffi/darwin_arm64/koffi.node +0 -0
  5. package/build/koffi/darwin_x64/koffi.node +0 -0
  6. package/build/koffi/freebsd_arm64/koffi.node +0 -0
  7. package/build/koffi/freebsd_ia32/koffi.node +0 -0
  8. package/build/koffi/freebsd_x64/koffi.node +0 -0
  9. package/build/koffi/linux_arm64/koffi.node +0 -0
  10. package/build/koffi/linux_armhf/koffi.node +0 -0
  11. package/build/koffi/linux_ia32/koffi.node +0 -0
  12. package/build/koffi/linux_loong64/koffi.node +0 -0
  13. package/build/koffi/linux_riscv64d/koffi.node +0 -0
  14. package/build/koffi/linux_x64/koffi.node +0 -0
  15. package/build/koffi/musl_arm64/koffi.node +0 -0
  16. package/build/koffi/musl_x64/koffi.node +0 -0
  17. package/build/koffi/openbsd_ia32/koffi.node +0 -0
  18. package/build/koffi/openbsd_x64/koffi.node +0 -0
  19. package/build/koffi/win32_arm64/koffi.exp +0 -0
  20. package/build/koffi/win32_arm64/koffi.node +0 -0
  21. package/build/koffi/win32_ia32/koffi.exp +0 -0
  22. package/build/koffi/win32_ia32/koffi.node +0 -0
  23. package/build/koffi/win32_x64/koffi.exp +0 -0
  24. package/build/koffi/win32_x64/koffi.node +0 -0
  25. package/doc/assets.ini +3 -3
  26. package/doc/develop.sh +4 -3
  27. package/doc/pages/platforms.md +1 -1
  28. package/doc/static/highlight.js +1 -1
  29. package/doc/static/koffi.css +3 -2
  30. package/doc/static/print.css +1 -1
  31. package/doc/templates/code.html +5 -5
  32. package/doc/templates/page.html +4 -4
  33. package/index.d.ts +2 -2
  34. package/index.js +32 -32
  35. package/indirect.js +32 -12
  36. package/package.json +2 -2
  37. package/src/cnoke/LICENSE.txt +2 -2
  38. package/src/cnoke/README.md +2 -0
  39. package/src/cnoke/assets/FindCNoke.cmake +12 -2
  40. package/src/cnoke/assets/win_delay_hook.c +4 -4
  41. package/src/cnoke/cnoke.js +4 -2
  42. package/src/cnoke/package.json +1 -1
  43. package/src/cnoke/src/builder.js +11 -14
  44. package/src/cnoke/src/index.js +2 -2
  45. package/src/cnoke/src/tools.js +34 -2
  46. package/src/core/{libcc/libcc.cc → base/base.cc} +3092 -1674
  47. package/src/core/{libcc/libcc.hh → base/base.hh} +3059 -2432
  48. package/src/core/{libcc → base}/mimetypes.inc +42 -4
  49. package/src/core/{libcc → base}/mimetypes_gen.py +3 -3
  50. package/src/core/unicode/generate.py +124 -0
  51. package/src/core/unicode/xid.cc +52 -0
  52. package/src/core/unicode/xid.hh +29 -0
  53. package/src/core/unicode/xid.inc +465 -0
  54. package/src/koffi/CMakeLists.txt +8 -5
  55. package/src/koffi/cmake/raylib.cmake +6 -2
  56. package/src/koffi/cmake/{sqlite.cmake → sqlite3.cmake} +3 -3
  57. package/src/koffi/examples/electron-forge/forge.config.js +23 -3
  58. package/src/koffi/examples/electron-forge/package.json +18 -16
  59. package/src/koffi/src/abi_arm32.cc +7 -7
  60. package/src/koffi/src/abi_arm32_asm.S +2 -2
  61. package/src/koffi/src/abi_arm64.cc +45 -45
  62. package/src/koffi/src/abi_arm64_asm.S +4 -4
  63. package/src/koffi/src/abi_arm64_asm.asm +2 -2
  64. package/src/koffi/src/abi_loong64_asm.S +2 -2
  65. package/src/koffi/src/abi_riscv64.cc +5 -5
  66. package/src/koffi/src/abi_riscv64_asm.S +2 -2
  67. package/src/koffi/src/abi_x64_sysv.cc +3 -3
  68. package/src/koffi/src/abi_x64_sysv_asm.S +5 -5
  69. package/src/koffi/src/abi_x64_win.cc +3 -3
  70. package/src/koffi/src/abi_x64_win_asm.asm +2 -2
  71. package/src/koffi/src/abi_x86.cc +8 -8
  72. package/src/koffi/src/abi_x86_asm.S +2 -2
  73. package/src/koffi/src/abi_x86_asm.asm +2 -2
  74. package/src/koffi/src/call.cc +12 -12
  75. package/src/koffi/src/call.hh +8 -8
  76. package/src/koffi/src/errno.inc +152 -152
  77. package/src/koffi/src/ffi.cc +45 -39
  78. package/src/koffi/src/ffi.hh +6 -6
  79. package/src/koffi/src/init.js +1 -1
  80. package/src/koffi/src/parser.cc +6 -5
  81. package/src/koffi/src/parser.hh +3 -3
  82. package/src/koffi/src/trampolines/armasm.inc +2 -2
  83. package/src/koffi/src/trampolines/gnu.inc +2 -2
  84. package/src/koffi/src/trampolines/masm32.inc +2 -2
  85. package/src/koffi/src/trampolines/masm64.inc +2 -2
  86. package/src/koffi/src/trampolines/prototypes.inc +2 -2
  87. package/src/koffi/src/util.cc +9 -9
  88. package/src/koffi/src/util.hh +3 -3
  89. package/src/koffi/src/win32.cc +5 -5
  90. package/src/koffi/src/win32.hh +9 -9
  91. package/vendor/node-addon-api/CHANGELOG.md +97 -2
  92. package/vendor/node-addon-api/CONTRIBUTING.md +117 -7
  93. package/vendor/node-addon-api/README.md +25 -249
  94. package/vendor/node-addon-api/common.gypi +1 -0
  95. package/vendor/node-addon-api/doc/README.md +145 -0
  96. package/vendor/node-addon-api/doc/array_buffer.md +15 -15
  97. package/vendor/node-addon-api/doc/basic_env.md +200 -0
  98. package/vendor/node-addon-api/doc/buffer.md +24 -26
  99. package/vendor/node-addon-api/doc/cmake-js.md +19 -0
  100. package/vendor/node-addon-api/doc/{creating_a_release.md → contributing/creating_a_release.md} +16 -4
  101. package/vendor/node-addon-api/doc/env.md +11 -131
  102. package/vendor/node-addon-api/doc/error_handling.md +12 -0
  103. package/vendor/node-addon-api/doc/external.md +13 -4
  104. package/vendor/node-addon-api/doc/finalization.md +153 -0
  105. package/vendor/node-addon-api/doc/memory_management.md +1 -1
  106. package/vendor/node-addon-api/doc/object_wrap.md +19 -3
  107. package/vendor/node-addon-api/doc/promises.md +51 -0
  108. package/vendor/node-addon-api/doc/setup.md +29 -6
  109. package/vendor/node-addon-api/doc/value.md +13 -0
  110. package/vendor/node-addon-api/doc/version_management.md +2 -2
  111. package/vendor/node-addon-api/eslint.config.js +5 -0
  112. package/vendor/node-addon-api/index.js +2 -0
  113. package/vendor/node-addon-api/napi-inl.h +592 -166
  114. package/vendor/node-addon-api/napi.h +167 -59
  115. package/vendor/node-addon-api/node_addon_api.gyp +10 -0
  116. package/vendor/node-addon-api/noexcept.gypi +1 -1
  117. package/vendor/node-addon-api/package.json +10 -13
  118. package/vendor/node-addon-api/release-please-config.json +15 -0
  119. package/vendor/node-addon-api/test/addon_build/tpl/binding.gyp +2 -1
  120. package/vendor/node-addon-api/test/array_buffer.js +1 -1
  121. package/vendor/node-addon-api/test/async_context.js +2 -2
  122. package/vendor/node-addon-api/test/async_progress_queue_worker.js +3 -3
  123. package/vendor/node-addon-api/test/async_progress_worker.js +3 -3
  124. package/vendor/node-addon-api/test/async_worker.cc +15 -13
  125. package/vendor/node-addon-api/test/async_worker.js +5 -5
  126. package/vendor/node-addon-api/test/basic_types/value.cc +6 -0
  127. package/vendor/node-addon-api/test/basic_types/value.js +17 -0
  128. package/vendor/node-addon-api/test/binding.cc +8 -0
  129. package/vendor/node-addon-api/test/binding.gyp +23 -1
  130. package/vendor/node-addon-api/test/buffer.js +1 -2
  131. package/vendor/node-addon-api/test/common/index.js +1 -1
  132. package/vendor/node-addon-api/test/except_all.cc +22 -0
  133. package/vendor/node-addon-api/test/except_all.js +14 -0
  134. package/vendor/node-addon-api/test/exports.js +19 -0
  135. package/vendor/node-addon-api/test/finalizer_order.cc +152 -0
  136. package/vendor/node-addon-api/test/finalizer_order.js +98 -0
  137. package/vendor/node-addon-api/test/function.js +2 -2
  138. package/vendor/node-addon-api/test/function_reference.js +2 -2
  139. package/vendor/node-addon-api/test/globalObject/global_object_delete_property.cc +4 -4
  140. package/vendor/node-addon-api/test/globalObject/global_object_get_property.cc +4 -4
  141. package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.cc +3 -3
  142. package/vendor/node-addon-api/test/globalObject/global_object_set_property.cc +5 -5
  143. package/vendor/node-addon-api/test/name.cc +10 -8
  144. package/vendor/node-addon-api/test/object/delete_property.cc +5 -5
  145. package/vendor/node-addon-api/test/object/get_property.cc +5 -5
  146. package/vendor/node-addon-api/test/object/has_own_property.cc +4 -4
  147. package/vendor/node-addon-api/test/object/has_property.cc +5 -5
  148. package/vendor/node-addon-api/test/object/object.cc +1 -1
  149. package/vendor/node-addon-api/test/object/set_property.cc +5 -5
  150. package/vendor/node-addon-api/test/object/subscript_operator.cc +3 -3
  151. package/vendor/node-addon-api/test/object_reference.cc +18 -18
  152. package/vendor/node-addon-api/test/promise.cc +75 -0
  153. package/vendor/node-addon-api/test/promise.js +23 -0
  154. package/vendor/node-addon-api/test/require_basic_finalizers/index.js +38 -0
  155. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/addon.cc +12 -0
  156. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/binding.gyp +48 -0
  157. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/index.js +3 -0
  158. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/package.json +11 -0
  159. package/vendor/node-addon-api/test/run_script.cc +1 -1
  160. package/vendor/node-addon-api/test/type_taggable.cc +1 -1
  161. package/vendor/node-addon-api/test/type_taggable.js +3 -4
  162. package/vendor/node-addon-api/test/typedarray.cc +28 -24
  163. package/vendor/node-addon-api/tools/conversion.js +1 -1
  164. package/vendor/node-api-headers/CHANGELOG.md +29 -0
  165. package/vendor/node-api-headers/CREATING_A_RELEASE.md +12 -2
  166. package/vendor/node-api-headers/def/js_native_api.def +6 -1
  167. package/vendor/node-api-headers/def/node_api.def +7 -1
  168. package/vendor/node-api-headers/include/js_native_api.h +56 -24
  169. package/vendor/node-api-headers/include/js_native_api_types.h +27 -0
  170. package/vendor/node-api-headers/include/node_api.h +38 -29
  171. package/vendor/node-api-headers/lib/parse-utils.js +92 -0
  172. package/vendor/node-api-headers/package.json +7 -7
  173. package/vendor/node-api-headers/release-please-config.json +12 -0
  174. package/vendor/node-api-headers/scripts/update-headers.js +63 -12
  175. package/vendor/node-api-headers/scripts/write-symbols.js +1 -1
  176. package/vendor/node-api-headers/symbols.js +17 -1
  177. package/vendor/node-api-headers/test/parse-utils.js +21 -0
  178. package/doc/flat/flat.css +0 -27
  179. package/doc/flat/normal.css +0 -429
  180. package/doc/flat/print.css +0 -29
  181. package/doc/flat/reset.css +0 -41
  182. package/doc/flat/small.css +0 -104
  183. package/doc/flat/static.js +0 -161
  184. package/src/core/libcc/brotli.cc +0 -186
  185. package/src/core/libcc/lz4.cc +0 -197
  186. package/src/core/libcc/miniz.cc +0 -353
  187. package/vendor/node-addon-api/tools/eslint-format.js +0 -79
  188. /package/vendor/node-api-headers/{scripts → lib}/clang-utils.js +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@
7
7
 
8
8
  ### Koffi 2.12
9
9
 
10
+ #### Koffi 2.12.2
11
+
12
+ *Released on 2025-07-16*
13
+
14
+ - Validate identifiers against Unicode XID table
15
+ - Skip struct and union members with placeholder name '\_'
16
+ - Add Koffi prebuild for Linux (musl) ARM64
17
+
18
+ > [!NOTE]
19
+ > The Koffi 3 codebase has been put aside, and some of it will be progressively integrated into Koffi 2 over the following months.
20
+
10
21
  #### Koffi 2.12.1
11
22
 
12
23
  *Released on 2025-07-05*
package/LICENSE.txt CHANGED
@@ -1,9 +1,9 @@
1
1
  MIT License
2
2
 
3
- Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
3
+ Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
6
+ this software and associated documentation files (the “Software”), to deal in
7
7
  the Software without restriction, including without limitation the rights to use,
8
8
  copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
9
  Software, and to permit persons to whom the Software is furnished to do so,
package/README.md CHANGED
@@ -9,14 +9,14 @@ Koffi is a fast and easy-to-use C FFI module for Node.js, featuring:
9
9
 
10
10
  The following combinations of OS and architectures __are officially supported and tested__ at the moment:
11
11
 
12
- ISA / OS | Windows | Linux | macOS | FreeBSD | OpenBSD
13
- ------------------ | ----------- | -------- | ----------- | ----------- | --------
14
- x86 (IA32) [^1] | ✅ Yes | ✅ Yes | ⬜️ *N/A* | ✅ Yes | ✅ Yes
15
- x86_64 (AMD64) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes
16
- ARM32 LE [^2] | ⬜️ *N/A* | ✅ Yes | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
17
- ARM64 (AArch64) LE | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | 🟨 Probably
18
- RISC-V 64 [^3] | ⬜️ *N/A* | ✅ Yes | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
19
- LoongArch64 | ⬜️ *N/A* | ✅ Yes | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
12
+ ISA / OS | Windows | Linux (glibc) | Linux (musl) | macOS | FreeBSD | OpenBSD
13
+ ------------------ | ----------- | ------------- | ------------ | ----------- | ----------- | --------
14
+ x86 (IA32) [^1] | ✅ Yes | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | ✅ Yes | ✅ Yes
15
+ x86_64 (AMD64) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes
16
+ ARM32 LE [^2] | ⬜️ *N/A* | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
17
+ ARM64 (AArch64) LE | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | 🟨 Probably
18
+ RISC-V 64 [^3] | ⬜️ *N/A* | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
19
+ LoongArch64 | ⬜️ *N/A* | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
20
20
 
21
21
  [^1]: The following call conventions are supported: cdecl, stdcall, MS fastcall, thiscall.
22
22
  [^2]: The prebuilt binary uses the hard float ABI and expects a VFP coprocessor. Build from source to use Koffi with a different ABI (softfp, soft).
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/doc/assets.ini CHANGED
@@ -1,4 +1,4 @@
1
- EsbuildPath = ../../vendor/esbuild/bin
1
+ EsbuildPath = ../../vendor/esbuild/native/node_modules/@esbuild
2
2
 
3
3
  [favicon.png]
4
4
  Type = Copy
@@ -11,7 +11,7 @@ Ignore = favicon.png *.js *.css
11
11
 
12
12
  [static/site.min.js]
13
13
  Type = Bundle
14
- Source = flat/static.js
14
+ Source = ../../src/web/flat/static.js
15
15
 
16
16
  [static/highlight.min.js]
17
17
  Type = Bundle
@@ -20,4 +20,4 @@ Source = static/highlight.js
20
20
  [static/site.min.css]
21
21
  Type = Bundle
22
22
  Source = static/koffi.css
23
- Options = --loader:.woff=file --loader:.woff2=file --loader:.png=file --loader:.webp=file
23
+ Options = --loader:.woff2=file --loader:.png=file --loader:.webp=file
package/doc/develop.sh CHANGED
@@ -3,12 +3,13 @@
3
3
  cd "$(dirname $0)"
4
4
 
5
5
  ../../bootstrap.sh
6
- ../../felix -pFast serf hodler
6
+ ../../felix -pFast nestor hodler
7
7
 
8
8
  trap 'kill $(jobs -p) 2>/dev/null' EXIT
9
9
  trap 'kill $(jobs -p) 2>/dev/null' SIGINT
10
10
 
11
- ../../bin/Fast/serf dist/ &
12
- ../../bin/Fast/hodler . -O dist --loop &
11
+ mkdir -p dist
12
+ ../../bin/Fast/nestor dist/ &
13
+ ../../bin/Fast/hodler . -O dist --loop --sourcemap &
13
14
 
14
15
  wait $(jobs -p)
@@ -19,7 +19,7 @@ ISA / OS | Windows | Linux (glibc) | Linux (musl)
19
19
  x86 (IA32) [^1] | ✅ | ✅ | 🟨
20
20
  x86_64 (AMD64) | ✅ | ✅ | ✅
21
21
  ARM32 LE [^2] | ⬜️ | ✅ | 🟨
22
- ARM64 (AArch64) LE | ✅ | ✅ | 🟨
22
+ ARM64 (AArch64) LE | ✅ | ✅ |
23
23
  RISC-V 64 [^3] | ⬜️ | ✅ | 🟨
24
24
  LoongArch64 | ⬜️ | ✅ | 🟨
25
25
 
@@ -1,4 +1,4 @@
1
- // Copyright (C) 2024 Niels Martignène <niels.martignene@protonmail.com>
1
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  //
3
3
  // This program is free software: you can redistribute it and/or modify
4
4
  // it under the terms of the GNU General Public License as published by
@@ -1,4 +1,4 @@
1
- /* Copyright (C) 2024 Niels Martignène <niels.martignene@protonmail.com>
1
+ /* Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
 
3
3
  This program is free software: you can redistribute it and/or modify
4
4
  it under the terms of the GNU General Public License as published by
@@ -13,10 +13,11 @@
13
13
  You should have received a copy of the GNU General Public License
14
14
  along with this program. If not, see <https://www.gnu.org/licenses/>. */
15
15
 
16
- @import url('../flat/flat.css');
16
+ @import url('../../../src/web/flat/flat.css');
17
17
  @import url('../../../vendor/highlight.js/styles/base16/tomorrow.css');
18
18
 
19
19
  html {
20
20
  --top_color: #ec7400;
21
+ --button_color: #ec7400;
21
22
  --anchor_color: #ec7400;
22
23
  }
@@ -1,4 +1,4 @@
1
- /* Copyright (C) 2024 Niels Martignène <niels.martignene@protonmail.com>
1
+ /* Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
 
3
3
  This program is free software: you can redistribute it and/or modify
4
4
  it under the terms of the GNU General Public License as published by
@@ -12,8 +12,8 @@
12
12
  <meta name="theme-color" content="#6aa051">
13
13
  <link rel="stylesheet" href="{{ ASSET static/site.min.css }}">
14
14
 
15
- <script type="text/javascript" src="{{ ASSET static/site.min.js }}" async></script>
16
- <script type="text/javascript" src="{{ ASSET static/highlight.min.js }}" async></script>
15
+ <script type="text/javascript" src="{{ ASSET static/site.min.js }}"></script>
16
+ <script type="text/javascript" src="{{ ASSET static/highlight.min.js }}"></script>
17
17
  </head>
18
18
 
19
19
  <body>
@@ -21,7 +21,7 @@
21
21
 
22
22
  <nav id="top">
23
23
  <menu>
24
- <a id="logo" href="/"><img src="{{ ASSET static/logo.webp }}" alt="Logo Koffi" /></a>
24
+ <a id="logo" href="/"><img src="{{ ASSET static/logo.webp }}" width="370" height="198" alt="" /></a>
25
25
 
26
26
  {{ LINKS }}
27
27
 
@@ -39,9 +39,9 @@
39
39
  </main>
40
40
 
41
41
  <footer>
42
- <div>Koffi © 2024</div>
42
+ <div>Koffi © 2025</div>
43
43
  <div style="font-size: 0.8em;">
44
- Niels Martignène (<a href="https://github.com/Koromix/" target="_blank">Koromix</a>)<br>
44
+ Niels Martignène (<a href="https://koromix.dev/" target="_blank">Koromix</a>)<br>
45
45
  <a href="mailto:niels.martignene@protonmail.com" style="font-weight: bold; color: inherit;">niels.martignene@protonmail.com</a>
46
46
  </div>
47
47
  </footer>
@@ -12,7 +12,7 @@
12
12
  <meta name="theme-color" content="#6aa051">
13
13
  <link rel="stylesheet" href="{{ ASSET static/site.min.css }}">
14
14
 
15
- <script type="text/javascript" src="{{ ASSET static/site.min.js }}" async></script>
15
+ <script type="text/javascript" src="{{ ASSET static/site.min.js }}"></script>
16
16
  </head>
17
17
 
18
18
  <body>
@@ -20,7 +20,7 @@
20
20
 
21
21
  <nav id="top">
22
22
  <menu>
23
- <a id="logo" href="/"><img src="{{ ASSET static/logo.webp }}" alt="Logo Koffi" /></a>
23
+ <a id="logo" href="/"><img src="{{ ASSET static/logo.webp }}" width="370" height="198" alt="" /></a>
24
24
 
25
25
  {{ LINKS }}
26
26
 
@@ -38,9 +38,9 @@
38
38
  </main>
39
39
 
40
40
  <footer>
41
- <div>Koffi © 2024</div>
41
+ <div>Koffi © 2025</div>
42
42
  <div style="font-size: 0.8em;">
43
- Niels Martignène (<a href="https://github.com/Koromix/" target="_blank">Koromix</a>)<br>
43
+ Niels Martignène (<a href="https://koromix.dev/" target="_blank">Koromix</a>)<br>
44
44
  <a href="mailto:niels.martignene@protonmail.com" style="font-weight: bold; color: inherit;">niels.martignene@protonmail.com</a>
45
45
  </div>
46
46
  </footer>
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  //
3
3
  // Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- // this software and associated documentation files (the “Software”), to deal in
4
+ // this software and associated documentation files (the “Software”), to deal in
5
5
  // the Software without restriction, including without limitation the rights to use,
6
6
  // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  // Software, and to permit persons to whom the Software is furnished to do so,
package/index.js CHANGED
@@ -4,9 +4,9 @@ var __commonJS = (cb, mod3) => function __require() {
4
4
  return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
5
5
  };
6
6
 
7
- // ../../bin/Koffi/package/src/cnoke/src/tools.js
7
+ // package/src/cnoke/src/tools.js
8
8
  var require_tools = __commonJS({
9
- "../../bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
9
+ "package/src/cnoke/src/tools.js"(exports2, module2) {
10
10
  "use strict";
11
11
  var crypto = require("crypto");
12
12
  var fs2 = require("fs");
@@ -178,6 +178,28 @@ var require_tools = __commonJS({
178
178
  return true;
179
179
  return false;
180
180
  }
181
+ function sync_files(src_dir, dest_dir) {
182
+ let keep = /* @__PURE__ */ new Set();
183
+ {
184
+ let entries = fs2.readdirSync(src_dir, { withFileTypes: true });
185
+ for (let entry of entries) {
186
+ if (!entry.isFile())
187
+ continue;
188
+ keep.add(entry.name);
189
+ fs2.copyFileSync(src_dir + `/${entry.name}`, dest_dir + `/${entry.name}`);
190
+ }
191
+ }
192
+ {
193
+ let entries = fs2.readdirSync(dest_dir, { withFileTypes: true });
194
+ for (let entry of entries) {
195
+ if (!entry.isFile())
196
+ continue;
197
+ if (keep.has(entry.name))
198
+ continue;
199
+ fs2.unlinkSync(dest_dir + `/${entry.name}`);
200
+ }
201
+ }
202
+ }
181
203
  function determine_arch2() {
182
204
  let arch = process.arch;
183
205
  if (arch == "riscv32" || arch == "riscv64") {
@@ -366,6 +388,7 @@ var require_tools = __commonJS({
366
388
  extract_targz,
367
389
  path_is_absolute,
368
390
  path_has_dotdot,
391
+ sync_files,
369
392
  determine_arch: determine_arch2,
370
393
  unlink_recursive,
371
394
  get_napi_version: get_napi_version2,
@@ -374,13 +397,13 @@ var require_tools = __commonJS({
374
397
  }
375
398
  });
376
399
 
377
- // ../../bin/Koffi/package/src/koffi/package.json
400
+ // package/src/koffi/package.json
378
401
  var require_package = __commonJS({
379
- "../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
402
+ "package/src/koffi/package.json"(exports2, module2) {
380
403
  module2.exports = {
381
404
  name: "koffi",
382
- version: "2.12.1",
383
- stable: "2.12.1",
405
+ version: "2.12.2",
406
+ stable: "2.12.2",
384
407
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
385
408
  keywords: [
386
409
  "foreign",
@@ -410,9 +433,6 @@ var require_package = __commonJS({
410
433
  package: "node tools/koffi.js build"
411
434
  },
412
435
  license: "MIT",
413
- devDependencies: {
414
- esbuild: "^0.19.2"
415
- },
416
436
  cnoke: {
417
437
  api: "../../vendor/node-api-headers",
418
438
  output: "../../bin/Koffi/{{ platform }}_{{ arch }}",
@@ -424,9 +444,9 @@ var require_package = __commonJS({
424
444
  }
425
445
  });
426
446
 
427
- // ../../bin/Koffi/package/src/koffi/src/init.js
447
+ // package/src/koffi/src/init.js
428
448
  var require_init = __commonJS({
429
- "../../bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
449
+ "package/src/koffi/src/init.js"(exports, module) {
430
450
  var fs = require("fs");
431
451
  var path = require("path");
432
452
  var util = require("util");
@@ -509,7 +529,7 @@ var require_init = __commonJS({
509
529
  }
510
530
  });
511
531
 
512
- // ../../bin/Koffi/package/src/koffi/index.js
532
+ // package/src/koffi/index.js
513
533
  var { detect: detect2, init: init2 } = require_init();
514
534
  var triplet2 = detect2();
515
535
  var native2 = null;
@@ -599,31 +619,11 @@ try {
599
619
  } catch {
600
620
  try {
601
621
  switch (triplet2) {
602
- case "linux_armhf":
603
- {
604
- native2 = require("./build/koffi/musl_armhf/koffi.node");
605
- }
606
- break;
607
622
  case "linux_arm64":
608
623
  {
609
624
  native2 = require("./build/koffi/musl_arm64/koffi.node");
610
625
  }
611
626
  break;
612
- case "linux_ia32":
613
- {
614
- native2 = require("./build/koffi/musl_ia32/koffi.node");
615
- }
616
- break;
617
- case "linux_loong64":
618
- {
619
- native2 = require("./build/koffi/musl_loong64/koffi.node");
620
- }
621
- break;
622
- case "linux_riscv64d":
623
- {
624
- native2 = require("./build/koffi/musl_riscv64d/koffi.node");
625
- }
626
- break;
627
627
  case "linux_x64":
628
628
  {
629
629
  native2 = require("./build/koffi/musl_x64/koffi.node");
package/indirect.js CHANGED
@@ -4,9 +4,9 @@ var __commonJS = (cb, mod3) => function __require() {
4
4
  return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
5
5
  };
6
6
 
7
- // ../../bin/Koffi/package/src/cnoke/src/tools.js
7
+ // package/src/cnoke/src/tools.js
8
8
  var require_tools = __commonJS({
9
- "../../bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
9
+ "package/src/cnoke/src/tools.js"(exports2, module2) {
10
10
  "use strict";
11
11
  var crypto = require("crypto");
12
12
  var fs2 = require("fs");
@@ -178,6 +178,28 @@ var require_tools = __commonJS({
178
178
  return true;
179
179
  return false;
180
180
  }
181
+ function sync_files(src_dir, dest_dir) {
182
+ let keep = /* @__PURE__ */ new Set();
183
+ {
184
+ let entries = fs2.readdirSync(src_dir, { withFileTypes: true });
185
+ for (let entry of entries) {
186
+ if (!entry.isFile())
187
+ continue;
188
+ keep.add(entry.name);
189
+ fs2.copyFileSync(src_dir + `/${entry.name}`, dest_dir + `/${entry.name}`);
190
+ }
191
+ }
192
+ {
193
+ let entries = fs2.readdirSync(dest_dir, { withFileTypes: true });
194
+ for (let entry of entries) {
195
+ if (!entry.isFile())
196
+ continue;
197
+ if (keep.has(entry.name))
198
+ continue;
199
+ fs2.unlinkSync(dest_dir + `/${entry.name}`);
200
+ }
201
+ }
202
+ }
181
203
  function determine_arch2() {
182
204
  let arch = process.arch;
183
205
  if (arch == "riscv32" || arch == "riscv64") {
@@ -366,6 +388,7 @@ var require_tools = __commonJS({
366
388
  extract_targz,
367
389
  path_is_absolute,
368
390
  path_has_dotdot,
391
+ sync_files,
369
392
  determine_arch: determine_arch2,
370
393
  unlink_recursive,
371
394
  get_napi_version: get_napi_version2,
@@ -374,13 +397,13 @@ var require_tools = __commonJS({
374
397
  }
375
398
  });
376
399
 
377
- // ../../bin/Koffi/package/src/koffi/package.json
400
+ // package/src/koffi/package.json
378
401
  var require_package = __commonJS({
379
- "../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
402
+ "package/src/koffi/package.json"(exports2, module2) {
380
403
  module2.exports = {
381
404
  name: "koffi",
382
- version: "2.12.1",
383
- stable: "2.12.1",
405
+ version: "2.12.2",
406
+ stable: "2.12.2",
384
407
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
385
408
  keywords: [
386
409
  "foreign",
@@ -410,9 +433,6 @@ var require_package = __commonJS({
410
433
  package: "node tools/koffi.js build"
411
434
  },
412
435
  license: "MIT",
413
- devDependencies: {
414
- esbuild: "^0.19.2"
415
- },
416
436
  cnoke: {
417
437
  api: "../../vendor/node-api-headers",
418
438
  output: "../../bin/Koffi/{{ platform }}_{{ arch }}",
@@ -424,9 +444,9 @@ var require_package = __commonJS({
424
444
  }
425
445
  });
426
446
 
427
- // ../../bin/Koffi/package/src/koffi/src/init.js
447
+ // package/src/koffi/src/init.js
428
448
  var require_init = __commonJS({
429
- "../../bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
449
+ "package/src/koffi/src/init.js"(exports, module) {
430
450
  var fs = require("fs");
431
451
  var path = require("path");
432
452
  var util = require("util");
@@ -509,7 +529,7 @@ var require_init = __commonJS({
509
529
  }
510
530
  });
511
531
 
512
- // ../../bin/Koffi/package/src/koffi/indirect.js
532
+ // package/src/koffi/indirect.js
513
533
  var { detect: detect2, init: init2 } = require_init();
514
534
  var triplet2 = detect2();
515
535
  var mod2 = init2(triplet2, null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.12.1",
4
- "stable": "2.12.1",
3
+ "version": "2.12.2",
4
+ "stable": "2.12.2",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -1,9 +1,9 @@
1
1
  MIT License
2
2
 
3
- Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
3
+ Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
6
+ this software and associated documentation files (the “Software”), to deal in
7
7
  the Software without restriction, including without limitation the rights to use,
8
8
  copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
9
  Software, and to permit persons to whom the Software is furnished to do so,
@@ -65,11 +65,13 @@ You can find the same help text by running `cnoke --help`:
65
65
  Usage: cnoke [command] [options...] [targets...]
66
66
 
67
67
  Commands:
68
+
68
69
  configure Configure CMake build
69
70
  build Build project (configure if needed)
70
71
  clean Clean build files
71
72
 
72
73
  Options:
74
+
73
75
  -d, --directory <DIR> Change project directory
74
76
  (default: current working directory)
75
77
 
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,
@@ -110,3 +110,13 @@ else()
110
110
  function(enable_unity_build TARGET)
111
111
  endfunction()
112
112
  endif()
113
+
114
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
115
+ message(STATUS ${CMAKE_SYSTEM_PROCESSOR})
116
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64|x86_64)")
117
+ foreach(lang C CXX)
118
+ set(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} -mpopcnt -msse4.1 -msse4.2 -mssse3 -mcx16")
119
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO "${CMAKE_${lang}_FLAGS_RELWITHDEBINFO} -mpopcnt -msse4.1 -msse4.2 -mssse3 -mcx16")
120
+ endforeach()
121
+ endif()
122
+ endif()
@@ -1,7 +1,7 @@
1
- // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  //
3
3
  // Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- // this software and associated documentation files (the “Software”), to deal in
4
+ // this software and associated documentation files (the “Software”), to deal in
5
5
  // the Software without restriction, including without limitation the rights to use,
6
6
  // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  // Software, and to permit persons to whom the Software is furnished to do so,
@@ -20,10 +20,10 @@
20
20
  // OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  #include <stdlib.h>
23
- #ifndef NOMINMAX
23
+ #if !defined(NOMINMAX)
24
24
  #define NOMINMAX
25
25
  #endif
26
- #ifndef WIN32_LEAN_AND_MEAN
26
+ #if !defined(WIN32_LEAN_AND_MEAN)
27
27
  #define WIN32_LEAN_AND_MEAN
28
28
  #endif
29
29
  #include <windows.h>
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
3
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
4
4
  //
5
5
  // Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- // this software and associated documentation files (the “Software”), to deal in
6
+ // this software and associated documentation files (the “Software”), to deal in
7
7
  // the Software without restriction, including without limitation the rights to use,
8
8
  // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
9
  // Software, and to permit persons to whom the Software is furnished to do so,
@@ -153,11 +153,13 @@ function print_usage() {
153
153
  let help = `Usage: cnoke [command] [options...]
154
154
 
155
155
  Commands:
156
+
156
157
  configure Configure CMake build
157
158
  build Build project (configure if needed)
158
159
  clean Clean build files
159
160
 
160
161
  Options:
162
+
161
163
  -d, --directory <DIR> Change source directory
162
164
  (default: current working directory)
163
165
  -p, --package <DIR> Change package directory
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/Koromix/rygel.git"
14
+ "url": "https://codeberg.org/Koromix/rygel.git"
15
15
  },
16
16
  "author": {
17
17
  "name": "Niels Martignène",