@psnext/slingcli 2.4.20260525-4 → 2.4.20260527-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 (243) hide show
  1. package/bin/sling.js +4 -1
  2. package/node_modules/@aws-sdk/core/package.json +2 -2
  3. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  4. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +12 -6
  5. package/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js +12 -6
  6. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -2
  7. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  8. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  9. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  10. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
  12. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  13. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  14. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  15. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  16. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  17. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  20. package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
  21. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -2
  22. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  23. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +18 -24
  24. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  25. package/node_modules/@earendil-works/pi-ai/dist/cli.js +14 -0
  26. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +78 -63
  27. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +2 -1
  28. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +8 -22
  29. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -1
  30. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +1 -1
  31. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +60 -40
  32. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +1 -1
  33. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -1
  34. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +55 -0
  35. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +45 -69
  36. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +1 -0
  37. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
  38. package/node_modules/@earendil-works/pi-ai/package.json +4 -3
  39. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +2 -3
  40. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +18 -12
  41. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +2 -1
  42. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +3 -2
  43. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +8 -2
  44. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +2 -1
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +18 -24
  46. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js +8 -6
  47. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +6 -3
  48. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +12 -29
  49. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +5 -1
  50. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js +52 -22
  51. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +63 -36
  52. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -20
  53. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +38 -31
  54. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +9 -4
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +32 -24
  56. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +6 -13
  57. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +8 -22
  58. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +54 -53
  59. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +8 -1
  60. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +44 -81
  61. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js +27 -12
  62. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +2 -3
  63. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +3 -3
  64. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -5
  65. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +9 -3
  66. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +39 -21
  67. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +9 -8
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +12 -2
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +20 -35
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +5 -6
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +1 -1
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +14 -5
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +29 -4
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -4
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +37 -28
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +64 -7
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +15 -3
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js +14 -8
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +124 -0
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +31 -0
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +75 -115
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +33 -7
  84. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +13 -26
  85. package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
  86. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +40 -55
  87. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
  88. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +12 -2
  89. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +53 -0
  90. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
  91. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -16
  92. package/node_modules/@earendil-works/pi-tui/dist/utils.js +19 -12
  93. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  94. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  95. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  96. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  97. package/node_modules/@earendil-works/pi-tui/package.json +3 -5
  98. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  99. package/node_modules/undici/lib/api/api-request.js +1 -1
  100. package/node_modules/undici/lib/cache/sqlite-cache-store.js +3 -3
  101. package/node_modules/undici/lib/core/connect.js +16 -0
  102. package/node_modules/undici/lib/core/request.js +17 -2
  103. package/node_modules/undici/lib/core/socks5-client.js +10 -5
  104. package/node_modules/undici/lib/core/socks5-utils.js +17 -22
  105. package/node_modules/undici/lib/dispatcher/client-h1.js +64 -20
  106. package/node_modules/undici/lib/dispatcher/client.js +6 -2
  107. package/node_modules/undici/lib/dispatcher/h2c-client.js +1 -1
  108. package/node_modules/undici/lib/mock/mock-call-history.js +15 -15
  109. package/node_modules/undici/lib/util/cache.js +8 -7
  110. package/node_modules/undici/lib/web/fetch/formdata-parser.js +17 -6
  111. package/node_modules/undici/lib/web/fetch/index.js +5 -2
  112. package/node_modules/undici/lib/web/webidl/index.js +5 -5
  113. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +1 -7
  114. package/node_modules/undici/package.json +1 -1
  115. package/package.json +6 -6
  116. package/slingshot/index.js +269 -266
  117. package/node_modules/koffi/CHANGELOG.md +0 -1093
  118. package/node_modules/koffi/LICENSE.txt +0 -22
  119. package/node_modules/koffi/README.md +0 -43
  120. package/node_modules/koffi/build/koffi/darwin_arm64/koffi.node +0 -0
  121. package/node_modules/koffi/build/koffi/darwin_x64/koffi.node +0 -0
  122. package/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node +0 -0
  123. package/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node +0 -0
  124. package/node_modules/koffi/build/koffi/freebsd_x64/koffi.node +0 -0
  125. package/node_modules/koffi/build/koffi/linux_arm64/koffi.node +0 -0
  126. package/node_modules/koffi/build/koffi/linux_armhf/koffi.node +0 -0
  127. package/node_modules/koffi/build/koffi/linux_ia32/koffi.node +0 -0
  128. package/node_modules/koffi/build/koffi/linux_loong64/koffi.node +0 -0
  129. package/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
  130. package/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
  131. package/node_modules/koffi/build/koffi/musl_arm64/koffi.node +0 -0
  132. package/node_modules/koffi/build/koffi/musl_x64/koffi.node +0 -0
  133. package/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node +0 -0
  134. package/node_modules/koffi/build/koffi/openbsd_x64/koffi.node +0 -0
  135. package/node_modules/koffi/build/koffi/win32_arm64/koffi.exp +0 -0
  136. package/node_modules/koffi/build/koffi/win32_arm64/koffi.lib +0 -0
  137. package/node_modules/koffi/build/koffi/win32_arm64/koffi.node +0 -0
  138. package/node_modules/koffi/build/koffi/win32_ia32/koffi.exp +0 -0
  139. package/node_modules/koffi/build/koffi/win32_ia32/koffi.lib +0 -0
  140. package/node_modules/koffi/build/koffi/win32_ia32/koffi.node +0 -0
  141. package/node_modules/koffi/build/koffi/win32_x64/koffi.exp +0 -0
  142. package/node_modules/koffi/build/koffi/win32_x64/koffi.lib +0 -0
  143. package/node_modules/koffi/build/koffi/win32_x64/koffi.node +0 -0
  144. package/node_modules/koffi/doc/benchmarks.md +0 -126
  145. package/node_modules/koffi/doc/callbacks.md +0 -210
  146. package/node_modules/koffi/doc/contribute.md +0 -148
  147. package/node_modules/koffi/doc/functions.md +0 -250
  148. package/node_modules/koffi/doc/index.md +0 -61
  149. package/node_modules/koffi/doc/input.md +0 -471
  150. package/node_modules/koffi/doc/migration.md +0 -159
  151. package/node_modules/koffi/doc/misc.md +0 -180
  152. package/node_modules/koffi/doc/output.md +0 -305
  153. package/node_modules/koffi/doc/packaging.md +0 -88
  154. package/node_modules/koffi/doc/platforms.md +0 -36
  155. package/node_modules/koffi/doc/pointers.md +0 -328
  156. package/node_modules/koffi/doc/start.md +0 -118
  157. package/node_modules/koffi/doc/unions.md +0 -186
  158. package/node_modules/koffi/doc/variables.md +0 -102
  159. package/node_modules/koffi/index.d.ts +0 -288
  160. package/node_modules/koffi/index.js +0 -634
  161. package/node_modules/koffi/indirect.js +0 -533
  162. package/node_modules/koffi/lib/native/base/base.cc +0 -11015
  163. package/node_modules/koffi/lib/native/base/base.hh +0 -6003
  164. package/node_modules/koffi/lib/native/base/crc.inc +0 -2214
  165. package/node_modules/koffi/lib/native/base/crc_gen.py +0 -72
  166. package/node_modules/koffi/lib/native/base/mimetypes.inc +0 -1248
  167. package/node_modules/koffi/lib/native/base/mimetypes_gen.py +0 -58
  168. package/node_modules/koffi/lib/native/base/tower.cc +0 -821
  169. package/node_modules/koffi/lib/native/base/tower.hh +0 -81
  170. package/node_modules/koffi/lib/native/base/unicode.inc +0 -408
  171. package/node_modules/koffi/lib/native/base/unicode_gen.py +0 -152
  172. package/node_modules/koffi/package.json +0 -38
  173. package/node_modules/koffi/src/cnoke/LICENSE.txt +0 -22
  174. package/node_modules/koffi/src/cnoke/README.md +0 -99
  175. package/node_modules/koffi/src/cnoke/assets/FindCNoke.cmake +0 -127
  176. package/node_modules/koffi/src/cnoke/assets/toolchains.json +0 -126
  177. package/node_modules/koffi/src/cnoke/assets/win_delay_hook.c +0 -36
  178. package/node_modules/koffi/src/cnoke/cnoke.js +0 -170
  179. package/node_modules/koffi/src/cnoke/package.json +0 -24
  180. package/node_modules/koffi/src/cnoke/src/builder.js +0 -511
  181. package/node_modules/koffi/src/cnoke/src/index.js +0 -10
  182. package/node_modules/koffi/src/cnoke/src/tools.js +0 -407
  183. package/node_modules/koffi/src/koffi/CMakeLists.txt +0 -182
  184. package/node_modules/koffi/src/koffi/src/abi_arm32.cc +0 -1018
  185. package/node_modules/koffi/src/koffi/src/abi_arm32_asm.S +0 -169
  186. package/node_modules/koffi/src/koffi/src/abi_arm64.cc +0 -1295
  187. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.S +0 -195
  188. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.asm +0 -174
  189. package/node_modules/koffi/src/koffi/src/abi_loong64.cc +0 -5
  190. package/node_modules/koffi/src/koffi/src/abi_loong64_asm.S +0 -204
  191. package/node_modules/koffi/src/koffi/src/abi_riscv64.cc +0 -915
  192. package/node_modules/koffi/src/koffi/src/abi_riscv64_asm.S +0 -203
  193. package/node_modules/koffi/src/koffi/src/abi_x64_sysv.cc +0 -939
  194. package/node_modules/koffi/src/koffi/src/abi_x64_sysv_asm.S +0 -231
  195. package/node_modules/koffi/src/koffi/src/abi_x64_win.cc +0 -715
  196. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.S +0 -166
  197. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.asm +0 -192
  198. package/node_modules/koffi/src/koffi/src/abi_x86.cc +0 -860
  199. package/node_modules/koffi/src/koffi/src/abi_x86_asm.S +0 -193
  200. package/node_modules/koffi/src/koffi/src/abi_x86_asm.asm +0 -177
  201. package/node_modules/koffi/src/koffi/src/call.cc +0 -1326
  202. package/node_modules/koffi/src/koffi/src/call.hh +0 -179
  203. package/node_modules/koffi/src/koffi/src/errno.inc +0 -462
  204. package/node_modules/koffi/src/koffi/src/ffi.cc +0 -2702
  205. package/node_modules/koffi/src/koffi/src/ffi.hh +0 -354
  206. package/node_modules/koffi/src/koffi/src/init.js +0 -105
  207. package/node_modules/koffi/src/koffi/src/parser.cc +0 -220
  208. package/node_modules/koffi/src/koffi/src/parser.hh +0 -54
  209. package/node_modules/koffi/src/koffi/src/util.cc +0 -1807
  210. package/node_modules/koffi/src/koffi/src/util.hh +0 -221
  211. package/node_modules/koffi/src/koffi/src/uv.cc +0 -193
  212. package/node_modules/koffi/src/koffi/src/uv.def +0 -10
  213. package/node_modules/koffi/src/koffi/src/uv.hh +0 -40
  214. package/node_modules/koffi/src/koffi/src/win32.cc +0 -198
  215. package/node_modules/koffi/src/koffi/src/win32.hh +0 -119
  216. package/node_modules/koffi/src/koffi/tools/write_trampolines.js +0 -77
  217. package/node_modules/koffi/vendor/node-addon-api/LICENSE.md +0 -9
  218. package/node_modules/koffi/vendor/node-addon-api/README.md +0 -95
  219. package/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +0 -186
  220. package/node_modules/koffi/vendor/node-addon-api/napi-inl.h +0 -7033
  221. package/node_modules/koffi/vendor/node-addon-api/napi.h +0 -3309
  222. package/node_modules/koffi/vendor/node-api-headers/LICENSE +0 -21
  223. package/node_modules/koffi/vendor/node-api-headers/README.md +0 -95
  224. package/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +0 -125
  225. package/node_modules/koffi/vendor/node-api-headers/def/node_api.def +0 -157
  226. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +0 -591
  227. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +0 -210
  228. package/node_modules/koffi/vendor/node-api-headers/include/node_api.h +0 -265
  229. package/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +0 -58
  230. package/node_modules/koffi/vendor/node-api-headers/include/uv/aix.h +0 -32
  231. package/node_modules/koffi/vendor/node-api-headers/include/uv/bsd.h +0 -34
  232. package/node_modules/koffi/vendor/node-api-headers/include/uv/darwin.h +0 -61
  233. package/node_modules/koffi/vendor/node-api-headers/include/uv/errno.h +0 -483
  234. package/node_modules/koffi/vendor/node-api-headers/include/uv/linux.h +0 -34
  235. package/node_modules/koffi/vendor/node-api-headers/include/uv/os390.h +0 -33
  236. package/node_modules/koffi/vendor/node-api-headers/include/uv/posix.h +0 -31
  237. package/node_modules/koffi/vendor/node-api-headers/include/uv/sunos.h +0 -44
  238. package/node_modules/koffi/vendor/node-api-headers/include/uv/threadpool.h +0 -37
  239. package/node_modules/koffi/vendor/node-api-headers/include/uv/tree.h +0 -521
  240. package/node_modules/koffi/vendor/node-api-headers/include/uv/unix.h +0 -512
  241. package/node_modules/koffi/vendor/node-api-headers/include/uv/version.h +0 -43
  242. package/node_modules/koffi/vendor/node-api-headers/include/uv/win.h +0 -698
  243. package/node_modules/koffi/vendor/node-api-headers/include/uv.h +0 -1990
@@ -1,38 +0,0 @@
1
- {
2
- "name": "koffi",
3
- "version": "2.16.2",
4
- "description": "Fast and simple C FFI (foreign function interface) for Node.js",
5
- "keywords": [
6
- "foreign",
7
- "function",
8
- "interface",
9
- "ffi",
10
- "binding",
11
- "c",
12
- "napi"
13
- ],
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/Koromix/koffi"
17
- },
18
- "homepage": "https://koffi.dev/",
19
- "author": {
20
- "name": "Niels Martignène",
21
- "email": "niels.martignene@protonmail.com",
22
- "url": "https://koromix.dev/"
23
- },
24
- "main": "./index.js",
25
- "types": "./index.d.ts",
26
- "scripts": {
27
- "install": "node src/cnoke/cnoke.js -P . -D src/koffi --prebuild"
28
- },
29
- "license": "MIT",
30
- "cnoke": {
31
- "api": "../../vendor/node-api-headers",
32
- "output": "build/koffi/{{ toolchain }}",
33
- "node": 16,
34
- "napi": 8,
35
- "require": "./index.js"
36
- },
37
- "funding": "https://liberapay.com/Koromix"
38
- }
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
4
-
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
7
- the Software without restriction, including without limitation the rights to use,
8
- copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
- Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,99 +0,0 @@
1
- # Table of contents
2
-
3
- - [Introduction](#introduction)
4
- - [Get started](#get-started)
5
- - [Command usage](#command-usage)
6
-
7
- # Introduction
8
-
9
- CNoke is a simpler alternative to CMake.js, without any dependency, designed to build
10
- native Node addons based on CMake.
11
-
12
- Install it like this:
13
-
14
- ```sh
15
- npm install cnoke
16
- ```
17
-
18
- It obviously requires [CMake](http://www.cmake.org/download/) and a proper C/C++ toolchain:
19
-
20
- * Windows: Visual C++ Build Tools or a recent version of Visual C++ will do (the free Community version works well)
21
- * POSIX (Linux, macOS, etc.): Clang or GCC, and Make (Ninja is preferred if available)
22
-
23
- # Get started
24
-
25
- In order to build a native Node.js addon with CNoke, you can use the following CMakeLists.txt
26
- template to get started:
27
-
28
- ```cmake
29
- cmake_minimum_required(VERSION 3.11)
30
- project(hello C CXX)
31
-
32
- find_package(CNoke)
33
-
34
- add_node_addon(NAME hello SOURCES hello.cc)
35
- ```
36
-
37
- You can also do it manually (without the module) if you prefer:
38
-
39
- ```cmake
40
- cmake_minimum_required(VERSION 3.11)
41
- project(hello C CXX)
42
-
43
- add_library(hello SHARED hello.cc ${NODE_JS_SOURCES})
44
- set_target_properties(hello PROPERTIES PREFIX "" SUFFIX ".node")
45
- target_include_directories(hello PRIVATE ${NODE_JS_INCLUDE_DIRS})
46
- target_link_libraries(hello PRIVATE ${NODE_JS_LIBRARIES})
47
- target_compile_options(hello PRIVATE ${NODE_JS_COMPILE_FLAGS})
48
- target_link_options(hello PRIVATE ${NODE_JS_LINK_FLAGS})
49
- ```
50
-
51
- In order for this to run when `npm install` runs (directly or when someone else installs
52
- your dependency), add the following script to package.json:
53
-
54
- ```json
55
- "scripts": {
56
- "install": "cnoke"
57
- }
58
- ```
59
-
60
- # Command usage
61
-
62
- You can find the same help text by running `cnoke --help`:
63
-
64
- ```
65
- Usage: cnoke [command] [options...] [targets...]
66
-
67
- Commands:
68
-
69
- configure Configure CMake build
70
- build Build project (configure if needed)
71
- clean Clean build files
72
-
73
- Options:
74
-
75
- -d, --directory <DIR> Change project directory
76
- (default: current working directory)
77
-
78
- -B, --config <CONFIG> Change build type: RelWithDebInfo, Debug, Release
79
- (default: RelWithDebInfo)
80
- -D, --debug Shortcut for --config Debug
81
-
82
- --prebuild <URL> Set URL template to download prebuilt binaries
83
- --require <PATH> Require specified module, drop prebuild if it fails
84
-
85
- -a, --arch <ARCH> Change architecture and ABI
86
- (default: x64)
87
- -v, --runtime-version <VERSION> Change node version
88
- (default: v16.14.0)
89
- -t, --toolset <TOOLSET> Change default CMake toolset
90
- -C, --prefer-clang Use Clang instead of default CMake compiler
91
-
92
- --verbose Show build commands while building
93
- ```
94
-
95
- The ARCH value is similar to process.arch, with the following differences:
96
-
97
- - arm is changed to arm32hf or arm32sf depending on the floating-point ABI used (hard-float, soft-float)
98
- - riscv32 is changed to riscv32sf, riscv32hf32, riscv32hf64 or riscv32hf128 depending on the floating-point ABI
99
- - riscv64 is changed to riscv64sf, riscv64hf32, riscv64hf64 or riscv64hf128 depending on the floating-point ABI
@@ -1,127 +0,0 @@
1
- # SPDX-License-Identifier: MIT
2
- # SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
3
-
4
- if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR
5
- CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
6
- set(USE_UNITY_BUILDS ON CACHE BOOL "Use single-TU builds (aka. Unity builds)")
7
- else()
8
- set(USE_UNITY_BUILDS OFF CACHE BOOL "Use single-TU builds (aka. Unity builds)")
9
- endif()
10
-
11
- function(add_node_addon)
12
- cmake_parse_arguments(ARG "" "NAME" "SOURCES" ${ARGN})
13
- add_library(${ARG_NAME} SHARED ${ARG_SOURCES} ${NODE_JS_SOURCES})
14
- target_link_node(${ARG_NAME})
15
- set_target_properties(${ARG_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
16
- endfunction()
17
-
18
- function(target_link_node TARGET)
19
- target_include_directories(${TARGET} PRIVATE ${NODE_JS_INCLUDE_DIRS})
20
- if(NODE_JS_LINK_DEF)
21
- target_sources(${TARGET} PRIVATE node.lib)
22
- endif()
23
- if(NODE_JS_LINK_LIB)
24
- target_link_libraries(${TARGET} PRIVATE ${NODE_JS_LINK_LIB})
25
- endif()
26
- target_compile_options(${TARGET} PRIVATE ${NODE_JS_COMPILE_FLAGS})
27
- if(NODE_JS_LINK_FLAGS)
28
- target_link_options(${TARGET} PRIVATE ${NODE_JS_LINK_FLAGS})
29
- endif()
30
- endfunction()
31
-
32
- if(WIN32)
33
- function(create_import_lib OUTPUT SRC)
34
- if (MSVC)
35
- add_custom_command(OUTPUT ${OUTPUT}
36
- COMMAND ${CMAKE_AR} ${CMAKE_STATIC_LINKER_FLAGS}
37
- /def:${SRC} /out:"${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}"
38
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
39
- MAIN_DEPENDENCY ${SRC})
40
- elseif(DEFINED NODE_JS_DLLTOOL_MACHINE)
41
- add_custom_command(OUTPUT ${OUTPUT}
42
- COMMAND ${CMAKE_DLLTOOL} -d ${SRC} -l "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}" -m ${NODE_JS_DLLTOOL_MACHINE}
43
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
44
- MAIN_DEPENDENCY ${SRC})
45
- else()
46
- add_custom_command(OUTPUT ${OUTPUT}
47
- COMMAND ${CMAKE_DLLTOOL} -d ${SRC} -l "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}"
48
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
49
- MAIN_DEPENDENCY ${SRC})
50
- endif()
51
- endfunction()
52
- endif()
53
-
54
- if(NODE_JS_LINK_DEF)
55
- create_import_lib(node.lib ${NODE_JS_LINK_DEF})
56
- set(NODE_JS_LINK_LIB "${CMAKE_CURRENT_BINARY_DIR}/node.lib")
57
- endif()
58
-
59
- if(USE_UNITY_BUILDS)
60
- function(enable_unity_build TARGET)
61
- cmake_parse_arguments(ARG "" "" "EXCLUDE" ${ARGN})
62
-
63
- get_target_property(sources ${TARGET} SOURCES)
64
- string(GENEX_STRIP "${sources}" sources)
65
-
66
- set(unity_file_c "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_unity.c")
67
- set(unity_file_cpp "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_unity.cpp")
68
- file(REMOVE ${unity_file_c} ${unity_file_cpp})
69
-
70
- set(c_definitions "")
71
- set(cpp_definitions "")
72
-
73
- foreach(src ${sources})
74
- if (src IN_LIST ARG_EXCLUDE)
75
- continue()
76
- endif()
77
-
78
- get_source_file_property(language ${src} LANGUAGE)
79
- get_property(definitions SOURCE ${src} PROPERTY COMPILE_DEFINITIONS)
80
- if(IS_ABSOLUTE ${src})
81
- set(src_full ${src})
82
- else()
83
- set(src_full "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
84
- endif()
85
- if(language STREQUAL "C")
86
- set_source_files_properties(${src} PROPERTIES HEADER_FILE_ONLY 1)
87
- file(APPEND ${unity_file_c} "#include \"${src_full}\"\n")
88
- if (definitions)
89
- set(c_definitions "${c_definitions} ${definitions}")
90
- endif()
91
- elseif(language STREQUAL "CXX")
92
- set_source_files_properties(${src} PROPERTIES HEADER_FILE_ONLY 1)
93
- file(APPEND ${unity_file_cpp} "#include \"${src_full}\"\n")
94
- if (definitions)
95
- set(cpp_definitions "${cpp_definitions} ${definitions}")
96
- endif()
97
- endif()
98
- endforeach()
99
-
100
- if(EXISTS ${unity_file_c})
101
- target_sources(${TARGET} PRIVATE ${unity_file_c})
102
- if(c_definitions)
103
- set_source_files_properties(${unity_file_c} PROPERTIES COMPILE_DEFINITIONS ${c_definitions})
104
- endif()
105
- endif()
106
- if(EXISTS ${unity_file_cpp})
107
- target_sources(${TARGET} PRIVATE ${unity_file_cpp})
108
- if(cpp_definitions)
109
- set_source_files_properties(${unity_file_cpp} PROPERTIES COMPILE_DEFINITIONS ${cpp_definitions})
110
- endif()
111
- endif()
112
-
113
- target_compile_definitions(${TARGET} PRIVATE -DUNITY_BUILD=1)
114
- endfunction()
115
- else()
116
- function(enable_unity_build TARGET)
117
- endfunction()
118
- endif()
119
-
120
- if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
121
- if(CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64|x86_64)")
122
- foreach(lang C CXX)
123
- set(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} -mpopcnt -msse4.1 -msse4.2 -mssse3 -mcx16")
124
- set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO "${CMAKE_${lang}_FLAGS_RELWITHDEBINFO} -mpopcnt -msse4.1 -msse4.2 -mssse3 -mcx16")
125
- endforeach()
126
- endif()
127
- endif()
@@ -1,126 +0,0 @@
1
- {
2
- "linux_ia32": {
3
- "system": "Linux",
4
- "processor": "i386",
5
- "triplet": "i686-linux-gnu",
6
- "sysroot": "../../tools/cross/sysroots/debian_i386"
7
- },
8
- "linux_x64": {
9
- "system": "Linux",
10
- "processor": "x86_64",
11
- "triplet": "x86_64-linux-gnu",
12
- "sysroot": "../../tools/cross/sysroots/debian_x64"
13
- },
14
- "linux_armhf": {
15
- "system": "Linux",
16
- "processor": "arm",
17
- "triplet": "arm-linux-gnueabihf",
18
- "sysroot": "../../tools/cross/sysroots/debian_arm32"
19
- },
20
- "linux_arm64": {
21
- "system": "Linux",
22
- "processor": "aarch64",
23
- "triplet": "aarch64-linux-gnu",
24
- "sysroot": "../../tools/cross/sysroots/debian_arm64"
25
- },
26
- "linux_riscv64d": {
27
- "system": "Linux",
28
- "processor": "riscv64",
29
- "triplet": "riscv64-linux-gnu",
30
- "sysroot": "../../tools/cross/sysroots/debian_riscv64"
31
- },
32
- "linux_loong64": {
33
- "system": "Linux",
34
- "processor": "loongarch64",
35
- "triplet": "loongarch64-linux-gnu",
36
- "sysroot": "../../tools/cross/sysroots/debian_loong64"
37
- },
38
-
39
- "win32_ia32": {
40
- "system": "Windows",
41
- "processor": "X86",
42
- "lib": "win-x86",
43
- "flags": ["-DNODE_JS_LINK_FLAGS=/DELAYLOAD:node.exe;/SAFESEH:NO", "-A", "Win32"],
44
-
45
- "triplet": "i386-pc-windows-msvc",
46
- "linux": {
47
- "sysroot": "../../tools/cross/sysroots/windows_i386",
48
- "flags": ["-DNODE_JS_LINK_FLAGS=-Wl,/DELAYLOAD:node.exe,/SAFESEH:NO", "-DNODE_JS_DLLTOOL_MACHINE=i386"],
49
- "variables": {
50
- "CMAKE_DLLTOOL": "llvm-dlltool",
51
- "CMAKE_RC_COMPILER": "llvm-rc",
52
- "CMAKE_C_FLAGS": "-Xmicrosoft-windows-sys-root {{ sysroot }}",
53
- "CMAKE_CXX_FLAGS": "-Xmicrosoft-windows-sys-root {{ sysroot }}",
54
- "CMAKE_EXE_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/x86_64 -ldelayimp",
55
- "CMAKE_STATIC_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/x86_64 -ldelayimp",
56
- "CMAKE_SHARED_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/x86_64 -ldelayimp"
57
- }
58
- }
59
- },
60
- "win32_x64": {
61
- "system": "Windows",
62
- "processor": "AMD64",
63
- "lib": "win-x64",
64
- "flags": ["-DNODE_JS_LINK_FLAGS=/DELAYLOAD:node.exe"],
65
-
66
- "triplet": "x86_64-pc-windows-msvc",
67
- "linux": {
68
- "sysroot": "../../tools/cross/sysroots/windows_x64",
69
- "flags": ["-DNODE_JS_LINK_FLAGS=-Wl,/DELAYLOAD:node.exe", "-DNODE_JS_DLLTOOL_MACHINE=i386:x86-64"],
70
- "variables": {
71
- "CMAKE_DLLTOOL": "llvm-dlltool",
72
- "CMAKE_RC_COMPILER": "llvm-rc",
73
- "CMAKE_C_FLAGS": "-Xmicrosoft-windows-sys-root {{ sysroot }}",
74
- "CMAKE_CXX_FLAGS": "-Xmicrosoft-windows-sys-root {{ sysroot }}",
75
- "CMAKE_EXE_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/x86_64 -ldelayimp",
76
- "CMAKE_STATIC_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/x86_64 -ldelayimp",
77
- "CMAKE_SHARED_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/x86_64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/x86_64 -ldelayimp"
78
- }
79
- }
80
- },
81
- "win32_arm64": {
82
- "system": "Windows",
83
- "processor": "ARM64",
84
- "lib": "win-arm64",
85
- "flags": ["-DNODE_JS_LINK_FLAGS=/DELAYLOAD:node.exe;/SAFESEH:NO", "-A", "ARM64"],
86
-
87
- "triplet": "aarch64-pc-windows-msvc",
88
- "linux": {
89
- "sysroot": "../../tools/cross/sysroots/windows_arm64",
90
- "flags": ["-DNODE_JS_LINK_FLAGS=-Wl,/DELAYLOAD:node.exe,/SAFESEH:NO", "-DNODE_JS_DLLTOOL_MACHINE=arm64"],
91
- "variables": {
92
- "CMAKE_DLLTOOL": "llvm-dlltool",
93
- "CMAKE_RC_COMPILER": "llvm-rc",
94
- "CMAKE_C_FLAGS": "-Xmicrosoft-windows-sys-root {{ sysroot }}",
95
- "CMAKE_CXX_FLAGS": "-Xmicrosoft-windows-sys-root {{ sysroot }}",
96
- "CMAKE_EXE_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/aarch64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/aarch64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/aarch64 -ldelayimp",
97
- "CMAKE_STATIC_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/aarch64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/aarch64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/aarch64 -ldelayimp",
98
- "CMAKE_SHARED_LINKER_FLAGS": "-Wl,-libpath:{{ sysroot }}/VC/Tools/MSVC/Current/lib/aarch64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/ucrt/aarch64,-libpath:{{ sysroot }}/Kits/10/Lib/Current/um/aarch64 -ldelayimp"
99
- }
100
- }
101
- },
102
-
103
- "darwin_x64": {
104
- "system": "Darwin",
105
- "processor": "x86_64",
106
- "flags": ["-DNODE_JS_LINK_FLAGS=-undefined;dynamic_lookup", "-DCMAKE_OSX_ARCHITECTURES=x86_64"]
107
- },
108
- "darwin_arm64": {
109
- "system": "Darwin",
110
- "processor": "arm64",
111
- "flags": ["-DNODE_JS_LINK_FLAGS=-undefined;dynamic_lookup", "-DCMAKE_OSX_ARCHITECTURES=arm64"]
112
- },
113
-
114
- "freebsd_x64": {
115
- "system": "FreeBSD",
116
- "processor": "amd64",
117
- "triplet": "x86_64-unknown-freebsd",
118
- "sysroot": "../../tools/cross/sysroots/freebsd_x64"
119
- },
120
- "freebsd_arm64": {
121
- "system": "FreeBSD",
122
- "processor": "arm64",
123
- "triplet": "aarch64-unknown-freebsd",
124
- "sysroot": "../../tools/cross/sysroots/freebsd_arm64"
125
- }
126
- }
@@ -1,36 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
3
-
4
- #include <stdlib.h>
5
- #if !defined(NOMINMAX)
6
- #define NOMINMAX
7
- #endif
8
- #if !defined(WIN32_LEAN_AND_MEAN)
9
- #define WIN32_LEAN_AND_MEAN
10
- #endif
11
- #include <windows.h>
12
- #include <delayimp.h>
13
-
14
- static HMODULE node_dll;
15
-
16
- static FARPROC WINAPI self_exe_hook(unsigned int event, DelayLoadInfo *info)
17
- {
18
- if (event == dliStartProcessing) {
19
- node_dll = GetModuleHandleA("node.dll");
20
- if (!node_dll) {
21
- node_dll = GetModuleHandle(NULL);
22
- }
23
- return NULL;
24
- }
25
-
26
- if (event == dliNotePreLoadLibrary && !stricmp(info->szDll, "node.exe"))
27
- return (FARPROC)node_dll;
28
-
29
- return NULL;
30
- }
31
-
32
- #if defined(__MINGW32__)
33
- PfnDliHook __pfnDliNotifyHook2 = self_exe_hook;
34
- #else
35
- const PfnDliHook __pfnDliNotifyHook2 = self_exe_hook;
36
- #endif
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env node
2
- // SPDX-License-Identifier: MIT
3
- // SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
4
-
5
- 'use strict';
6
-
7
- const fs = require('fs');
8
- const cnoke = require('./src/index.js');
9
-
10
- const VALID_COMMANDS = ['build', 'configure', 'clean'];
11
-
12
- main();
13
-
14
- async function main() {
15
- let config = {};
16
- let command = 'build';
17
-
18
- // Parse options
19
- {
20
- let i = 2;
21
-
22
- if (process.argv.length >= 3 && process.argv[2][0] != '-') {
23
- let cmd = process.argv[2];
24
-
25
- if (VALID_COMMANDS.includes(cmd)) {
26
- command = cmd;
27
- i++;
28
- }
29
- }
30
-
31
- for (; i < process.argv.length; i++) {
32
- let arg = process.argv[i];
33
- let value = null;
34
-
35
- if (arg[0] == '-') {
36
- if (arg.length > 2 && arg[1] != '-') {
37
- value = arg.substr(2);
38
- arg = arg.substr(0, 2);
39
- } else if (arg[1] == '-') {
40
- let offset = arg.indexOf('=');
41
-
42
- if (offset > 2 && arg.length > offset + 1) {
43
- value = arg.substr(offset + 1);
44
- arg = arg.substr(0, offset);
45
- }
46
- }
47
- if (value == null && process.argv[i + 1] != null && process.argv[i + 1][0] != '-') {
48
- value = process.argv[i + 1];
49
- i++; // Skip this value next iteration
50
- }
51
- }
52
-
53
- if (arg == '--help') {
54
- print_usage();
55
- return;
56
- } else if (arg == '-D' || arg == '--directory') {
57
- if (value == null)
58
- throw new Error(`Missing value for ${arg}`);
59
-
60
- config.project_dir = fs.realpathSync(value);
61
- } else if (arg == '-P' || arg == '--package') {
62
- if (value == null)
63
- throw new Error(`Missing value for ${arg}`);
64
-
65
- config.package_dir = fs.realpathSync(value);
66
- } else if (arg == '-O' || arg == '--output') {
67
- if (value == null)
68
- throw new Error(`Missing value for ${arg}`);
69
-
70
- config.output_directory = value;
71
- } else if ((command == 'build' || command == 'configure') && arg == '--runtime') {
72
- if (value == null)
73
- throw new Error(`Missing value for ${arg}`);
74
- if (!value.match(/^[0-9]+\.[0-9]+\.[0-9]+$/))
75
- throw new Error(`Malformed runtime version '${value}'`);
76
-
77
- config.runtime_version = value;
78
- } else if ((command == 'build' || command == 'configure') && arg == '--clang') {
79
- config.prefer_clang = true;
80
- } else if ((command == 'build' || command == 'configure') && (arg == '-t' || arg == '--toolchain')) {
81
- if (value == null)
82
- throw new Error(`Missing value for ${arg}`);
83
-
84
- config.toolchain = value;
85
- } else if ((command == 'build' || command == 'configure') && (arg == '-c' || arg == '--config')) {
86
- if (value == null)
87
- throw new Error(`Missing value for ${arg}`);
88
-
89
- switch (value.toLowerCase()) {
90
- case 'relwithdebinfo': { config.mode = 'RelWithDebInfo'; } break;
91
- case 'debug': { config.mode = 'Debug'; } break;
92
- case 'release': { config.mode = 'Release'; } break;
93
-
94
- default: {
95
- throw new Error(`Unknown value '${value}' for ${arg}`);
96
- } break;
97
- }
98
- } else if ((command == 'build' || command == 'configure') && arg == '--debug') {
99
- config.mode = 'Debug';
100
- } else if ((command == 'build' || command == 'configure') && arg == '--release') {
101
- config.mode = 'Release';
102
- } else if (command == 'build' && arg == '--prebuild') {
103
- config.prebuild = true;
104
- } else if (command == 'build' && arg == '--target') {
105
- if (value == null)
106
- throw new Error(`Missing value for ${arg}`);
107
-
108
- config.targets = [value];
109
- } else if (command == 'build' && (arg == '-v' || arg == '--verbose')) {
110
- config.verbose = true;
111
- } else {
112
- if (arg[0] == '-') {
113
- throw new Error(`Unexpected argument '${arg}'`);
114
- } else {
115
- throw new Error(`Unexpected value '${arg}'`);
116
- }
117
- }
118
- }
119
- }
120
-
121
- try {
122
- let builder = new cnoke.Builder(config);
123
- await builder[command]();
124
- } catch (err) {
125
- console.error(err);
126
- process.exit(1);
127
- }
128
- }
129
-
130
- function print_usage() {
131
- let help = `Usage: cnoke [command] [options...]
132
-
133
- Commands:
134
-
135
- configure Configure CMake build
136
- build Build project (configure if needed)
137
- clean Clean build files
138
-
139
- Options:
140
-
141
- -D, --directory <DIR> Change source directory
142
- (default: current working directory)
143
- -P, --package <DIR> Change package directory
144
- (default: current working directory)
145
- -O, --output <DIR> Set explicit output directory
146
- (default: ./build)
147
-
148
- -c, --config <CONFIG> Change build type: RelWithDebInfo, Debug, Release
149
- (default: ${cnoke.DefaultOptions.mode})
150
- --debug Shortcut for --config Debug
151
- --release Shortcut for --config Release
152
-
153
- -t, --toolchain <TOOLCHAIN> Cross-compile for specific platform
154
- --runtime <VERSION> Change node version
155
- (default: ${process.version})
156
- --clang Use Clang instead of default CMake compiler
157
-
158
- --prebuild Use prebuilt binary if available
159
- --target <TARGET> Only build the specified target
160
-
161
- -v, --verbose Show build commands while building
162
-
163
- The ARCH value is similar to process.arch, with the following differences:
164
-
165
- - arm is changed to arm32hf or arm32sf depending on the floating-point ABI used (hard-float, soft-float)
166
- - riscv32 is changed to riscv32sf, riscv32hf32, riscv32hf64 or riscv32hf128 depending on the floating-point ABI
167
- - riscv64 is changed to riscv64sf, riscv64hf32, riscv64hf64 or riscv64hf128 depending on the floating-point ABI`;
168
-
169
- console.log(help);
170
- }
@@ -1,24 +0,0 @@
1
- {
2
- "name": "cnoke",
3
- "version": "4.0.3",
4
- "description": "Build native Node addons based on CMake, without extra dependency",
5
- "keywords": [
6
- "native",
7
- "addon",
8
- "cmake",
9
- "c",
10
- "c++"
11
- ],
12
- "repository": {
13
- "type": "git",
14
- "url": "https://codeberg.org/Koromix/rygel.git"
15
- },
16
- "author": {
17
- "name": "Niels Martignène",
18
- "email": "niels.martignene@protonmail.com",
19
- "url": "https://koromix.dev/"
20
- },
21
- "index": "src/index.js",
22
- "bin": "cnoke.js",
23
- "license": "MIT"
24
- }