@btc-vision/bitcoin 6.4.10 → 6.5.1

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 (220) hide show
  1. package/.babelrc +13 -4
  2. package/.mocharc.json +13 -13
  3. package/.prettierrc.json +12 -12
  4. package/CHANGELOG.md +403 -403
  5. package/CONTRIBUTING.md +83 -83
  6. package/LICENSE +21 -21
  7. package/README.md +201 -201
  8. package/browser/chunks/crypto-C6FlKKmp.js +2006 -0
  9. package/browser/chunks/payments-BE4vwHhV.js +1045 -0
  10. package/browser/chunks/psbt-Dlosf9CT.js +3853 -0
  11. package/browser/chunks/script-COWGdiOo.js +318 -0
  12. package/browser/chunks/transaction-BiXwH2v4.js +421 -0
  13. package/browser/chunks/utils-BKmkTzNZ.js +759 -0
  14. package/browser/crypto/crypto.d.ts +1 -1
  15. package/browser/index.d.ts +7 -27
  16. package/browser/index.js +92 -2
  17. package/build/index.d.ts +7 -27
  18. package/build/index.js +2 -2
  19. package/cjs/package.json +3 -3
  20. package/gulpfile.js +42 -42
  21. package/package.json +153 -150
  22. package/src/bip66.ts +107 -107
  23. package/src/block.ts +233 -233
  24. package/src/bufferutils.ts +188 -188
  25. package/src/crypto.ts +108 -108
  26. package/src/ecc_lib.ts +94 -94
  27. package/src/hooks/AdvancedSignatureManager.ts +104 -104
  28. package/src/hooks/SignatureManager.ts +84 -84
  29. package/src/index.ts +83 -105
  30. package/src/merkle.ts +31 -31
  31. package/src/opcodes.ts +280 -280
  32. package/src/payments/bip341.ts +140 -140
  33. package/src/payments/embed.ts +61 -61
  34. package/src/payments/index.ts +172 -172
  35. package/src/payments/lazy.ts +28 -28
  36. package/src/payments/p2ms.ts +156 -156
  37. package/src/payments/p2op.ts +195 -195
  38. package/src/payments/p2pk.ts +93 -93
  39. package/src/payments/p2pkh.ts +214 -214
  40. package/src/payments/p2tr.ts +309 -309
  41. package/src/psbt/bip371.ts +441 -441
  42. package/src/push_data.ts +97 -97
  43. package/src/script.ts +247 -247
  44. package/src/script_number.ts +72 -72
  45. package/src/script_signature.ts +91 -91
  46. package/src/transaction.ts +656 -656
  47. package/test/address.spec.ts +155 -155
  48. package/test/bitcoin.core.spec.ts +212 -212
  49. package/test/block.spec.ts +171 -171
  50. package/test/bufferutils.spec.ts +450 -450
  51. package/test/crypto.spec.ts +49 -49
  52. package/test/fixtures/address.json +329 -329
  53. package/test/fixtures/block.json +148 -148
  54. package/test/fixtures/bufferutils.json +102 -102
  55. package/test/fixtures/core/README.md +26 -26
  56. package/test/fixtures/core/base58_encode_decode.json +50 -50
  57. package/test/fixtures/core/base58_keys_invalid.json +152 -152
  58. package/test/fixtures/core/base58_keys_valid.json +452 -452
  59. package/test/fixtures/core/blocks.json +27 -27
  60. package/test/fixtures/core/sig_canonical.json +7 -7
  61. package/test/fixtures/core/sig_noncanonical.json +33 -33
  62. package/test/fixtures/core/sighash.json +3505 -3505
  63. package/test/fixtures/core/tx_valid.json +2023 -2023
  64. package/test/fixtures/crypto.json +43 -43
  65. package/test/fixtures/ecdsa.json +217 -217
  66. package/test/fixtures/ecpair.json +141 -141
  67. package/test/fixtures/embed.json +108 -108
  68. package/test/fixtures/p2ms.json +434 -434
  69. package/test/fixtures/p2pk.json +179 -179
  70. package/test/fixtures/p2pkh.json +276 -276
  71. package/test/fixtures/p2sh.json +508 -508
  72. package/test/fixtures/p2tr.json +1198 -1198
  73. package/test/fixtures/p2wpkh.json +290 -290
  74. package/test/fixtures/p2wsh.json +489 -489
  75. package/test/fixtures/psbt.json +924 -924
  76. package/test/fixtures/script.json +465 -465
  77. package/test/fixtures/script_number.json +225 -225
  78. package/test/fixtures/signature.json +140 -140
  79. package/test/fixtures/transaction.json +916 -916
  80. package/test/integration/_regtest.ts +6 -6
  81. package/test/integration/addresses.spec.ts +142 -142
  82. package/test/integration/bip32.spec.ts +130 -130
  83. package/test/integration/blocks.spec.ts +28 -28
  84. package/test/integration/cltv.spec.ts +241 -241
  85. package/test/integration/csv.spec.ts +452 -452
  86. package/test/integration/payments.spec.ts +110 -110
  87. package/test/integration/taproot.spec.ts +663 -663
  88. package/test/integration/transactions.spec.ts +668 -668
  89. package/test/payments.spec.ts +114 -114
  90. package/test/payments.utils.ts +165 -165
  91. package/test/psbt.spec.ts +1285 -1285
  92. package/test/script.spec.ts +186 -186
  93. package/test/script_number.spec.ts +26 -26
  94. package/test/script_signature.spec.ts +66 -66
  95. package/test/transaction.spec.ts +337 -337
  96. package/test/ts-node-register.js +7 -7
  97. package/test/tsconfig.json +48 -48
  98. package/test/types.spec.ts +53 -53
  99. package/tsconfig.base.json +27 -27
  100. package/tsconfig.json +19 -19
  101. package/tsconfig.webpack.json +18 -18
  102. package/vite.config.browser.ts +93 -0
  103. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
  104. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
  105. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
  106. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
  107. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
  108. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
  109. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
  110. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
  111. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
  112. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
  113. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
  114. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
  115. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
  116. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
  117. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
  118. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
  119. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
  120. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
  121. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
  122. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
  123. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
  124. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
  125. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  126. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
  127. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  128. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
  129. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  130. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  131. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  132. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  133. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  134. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
  135. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
  136. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
  137. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
  138. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
  139. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  140. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  141. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
  142. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  143. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
  144. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
  145. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  146. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
  147. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  148. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
  149. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
  150. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
  151. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  152. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
  153. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
  154. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
  155. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  156. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
  157. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  158. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  159. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
  160. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  161. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  162. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
  163. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
  164. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
  165. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  166. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
  167. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  168. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
  169. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
  170. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
  171. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
  172. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
  173. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
  174. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
  175. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
  176. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
  177. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
  178. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
  179. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
  180. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  181. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
  182. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
  183. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
  184. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
  185. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
  186. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
  187. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
  188. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  189. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
  190. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
  191. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
  192. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
  193. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
  194. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
  195. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
  196. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
  197. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
  198. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
  199. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
  200. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
  201. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
  202. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
  203. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
  204. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
  205. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
  206. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
  207. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
  208. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
  209. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
  210. package/browser/index.js.LICENSE.txt +0 -14
  211. package/browser/ops.d.ts +0 -126
  212. package/build/ops.d.ts +0 -126
  213. package/build/ops.js +0 -127
  214. package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
  215. package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
  216. package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
  217. package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
  218. package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
  219. package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
  220. package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
@@ -1,34 +0,0 @@
1
- # Contributing to node-gyp
2
-
3
- ## Code of Conduct
4
-
5
- Please read the
6
- [Code of Conduct](https://github.com/nodejs/admin/blob/main/CODE_OF_CONDUCT.md)
7
- which explains the minimum behavior expectations for node-gyp contributors.
8
-
9
- <a id="developers-certificate-of-origin"></a>
10
- ## Developer's Certificate of Origin 1.1
11
-
12
- By making a contribution to this project, I certify that:
13
-
14
- * (a) The contribution was created in whole or in part by me and I
15
- have the right to submit it under the open source license
16
- indicated in the file; or
17
-
18
- * (b) The contribution is based upon previous work that, to the best
19
- of my knowledge, is covered under an appropriate open source
20
- license and I have the right under that license to submit that
21
- work with modifications, whether created in whole or in part
22
- by me, under the same open source license (unless I am
23
- permitted to submit under a different license), as indicated
24
- in the file; or
25
-
26
- * (c) The contribution was provided directly to me by some other
27
- person who certified (a), (b) or (c) and I have not modified
28
- it.
29
-
30
- * (d) I understand and agree that this project and the contribution
31
- are public and that a record of the contribution (including all
32
- personal information I submit with it, including my sign-off) is
33
- maintained indefinitely and may be redistributed consistent with
34
- this project or the open source license(s) involved.
@@ -1,24 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
4
-
5
- Permission is hereby granted, free of charge, to any person
6
- obtaining a copy of this software and associated documentation
7
- files (the "Software"), to deal in the Software without
8
- restriction, including without limitation the rights to use,
9
- copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the
11
- Software is furnished to do so, subject to the following
12
- conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,273 +0,0 @@
1
- # `node-gyp` - Node.js native addon build tool
2
-
3
- [![Build Status](https://github.com/nodejs/node-gyp/workflows/Tests/badge.svg?branch=main)](https://github.com/nodejs/node-gyp/actions?query=workflow%3ATests+branch%3Amain)
4
- ![npm](https://img.shields.io/npm/dm/node-gyp)
5
-
6
- `node-gyp` is a cross-platform command-line tool written in Node.js for
7
- compiling native addon modules for Node.js. It contains a vendored copy of the
8
- [gyp-next](https://github.com/nodejs/gyp-next) project that was previously used
9
- by the Chromium team and extended to support the development of Node.js native
10
- addons.
11
-
12
- Note that `node-gyp` is _not_ used to build Node.js itself.
13
-
14
- All current and LTS target versions of Node.js are supported. Depending on what version of Node.js is actually installed on your system
15
- `node-gyp` downloads the necessary development files or headers for the target version. List of stable Node.js versions can be found on [Node.js website](https://nodejs.org/en/about/previous-releases).
16
-
17
- ## Features
18
-
19
- * The same build commands work on any of the supported platforms
20
- * Supports the targeting of different versions of Node.js
21
-
22
- ## Installation
23
-
24
- > [!Important]
25
- > Python >= v3.12 requires `node-gyp` >= v10
26
-
27
- You can install `node-gyp` using `npm`:
28
-
29
- ``` bash
30
- npm install -g node-gyp
31
- ```
32
-
33
- Depending on your operating system, you will need to install:
34
-
35
- ### On Unix
36
-
37
- * [A supported version of Python](https://devguide.python.org/versions/)
38
- * `make`
39
- * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
40
-
41
- ### On macOS
42
-
43
- * [A supported version of Python](https://devguide.python.org/versions/)
44
- * `Xcode Command Line Tools` which will install `clang`, `clang++`, and `make`.
45
- * Install the `Xcode Command Line Tools` standalone by running `xcode-select --install`. -- OR --
46
- * Alternatively, if you already have the [full Xcode installed](https://developer.apple.com/xcode/download/), you can install the Command Line Tools under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`.
47
-
48
-
49
- ### On Windows
50
-
51
- Install tools with [Chocolatey](https://chocolatey.org):
52
- ``` bash
53
- choco install python visualstudio2022-workload-vctools -y
54
- ```
55
-
56
- Or install and configure Python and Visual Studio tools manually:
57
-
58
- * Install the current [version of Python](https://devguide.python.org/versions/) from the
59
- [Microsoft Store](https://apps.microsoft.com/store/search?publisher=Python+Software+Foundation).
60
-
61
- * Install Visual C++ Build Environment: For Visual Studio 2019 or later, use the `Desktop development with C++` workload from [Visual Studio Community](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community). For a version older than Visual Studio 2019, install [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) with the `Visual C++ build tools` option.
62
-
63
- If the above steps didn't work for you, please visit [Microsoft's Node.js Guidelines for Windows](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules) for additional tips.
64
-
65
- To target native ARM64 Node.js on Windows on ARM, add the components "Visual C++ compilers and libraries for ARM64" and "Visual C++ ATL for ARM64".
66
-
67
- To use the native ARM64 C++ compiler on Windows on ARM, ensure that you have Visual Studio 2022 [17.4 or later](https://devblogs.microsoft.com/visualstudio/arm64-visual-studio-is-officially-here/) installed.
68
-
69
- It's advised to install following Powershell module: [VSSetup](https://github.com/microsoft/vssetup.powershell) using `Install-Module VSSetup -Scope CurrentUser`.
70
- This will make Visual Studio detection logic to use more flexible and accessible method, avoiding Powershell's `ConstrainedLanguage` mode.
71
-
72
- ### Configuring Python Dependency
73
-
74
- `node-gyp` requires that you have installed a [supported version of Python](https://devguide.python.org/versions/).
75
- If you have multiple versions of Python installed, you can identify which version
76
- `node-gyp` should use in one of the following ways:
77
-
78
- 1. by setting the `--python` command-line option, e.g.:
79
-
80
- ``` bash
81
- node-gyp <command> --python /path/to/executable/python
82
- ```
83
-
84
- 2. If `node-gyp` is called by way of `npm`, *and* you have multiple versions of
85
- Python installed, then you can set the `npm_config_python` environment variable
86
- to the appropriate path:
87
- ``` bash
88
- export npm_config_python=/path/to/executable/python
89
- ```
90
- &nbsp;&nbsp;&nbsp;&nbsp;Or on Windows:
91
- ```console
92
- py --list-paths # To see the installed Python versions
93
- set npm_config_python=C:\path\to\python.exe # CMD
94
- $Env:npm_config_python="C:\path\to\python.exe" # PowerShell
95
- ```
96
-
97
- 3. If the `PYTHON` environment variable is set to the path of a Python executable,
98
- then that version will be used if it is a supported version.
99
-
100
- 4. If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a
101
- Python executable, it will be used instead of any of the other configured or
102
- built-in Python search paths. If it's not a compatible version, no further
103
- searching will be done.
104
-
105
- ### Build for Third Party Node.js Runtimes
106
-
107
- When building modules for third-party Node.js runtimes like Electron, which have
108
- different build configurations from the official Node.js distribution, you
109
- should use `--dist-url` or `--nodedir` flags to specify the headers of the
110
- runtime to build for.
111
-
112
- Also when `--dist-url` or `--nodedir` flags are passed, node-gyp will use the
113
- `config.gypi` shipped in the headers distribution to generate build
114
- configurations, which is different from the default mode that would use the
115
- `process.config` object of the running Node.js instance.
116
-
117
- Some old versions of Electron shipped malformed `config.gypi` in their headers
118
- distributions, and you might need to pass `--force-process-config` to node-gyp
119
- to work around configuration errors.
120
-
121
- ## How to Use
122
-
123
- To compile your native addon first go to its root directory:
124
-
125
- ``` bash
126
- cd my_node_addon
127
- ```
128
-
129
- The next step is to generate the appropriate project build files for the current
130
- platform. Use `configure` for that:
131
-
132
- ``` bash
133
- node-gyp configure
134
- ```
135
-
136
- Auto-detection fails for Visual C++ Build Tools 2015, so `--msvs_version=2015`
137
- needs to be added (not needed when run by npm as configured above):
138
- ``` bash
139
- node-gyp configure --msvs_version=2015
140
- ```
141
-
142
- __Note__: The `configure` step looks for a `binding.gyp` file in the current
143
- directory to process. See below for instructions on creating a `binding.gyp` file.
144
-
145
- Now you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file
146
- (on Windows) in the `build/` directory. Next, invoke the `build` command:
147
-
148
- ``` bash
149
- node-gyp build
150
- ```
151
-
152
- Now you have your compiled `.node` bindings file! The compiled bindings end up
153
- in `build/Debug/` or `build/Release/`, depending on the build mode. At this point,
154
- you can require the `.node` file with Node.js and run your tests!
155
-
156
- __Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or
157
- `-d`) switch when running either the `configure`, `build` or `rebuild` commands.
158
-
159
- ## The `binding.gyp` file
160
-
161
- A `binding.gyp` file describes the configuration to build your module, in a
162
- JSON-like format. This file gets placed in the root of your package, alongside
163
- `package.json`.
164
-
165
- A barebones `gyp` file appropriate for building a Node.js addon could look like:
166
-
167
- ```python
168
- {
169
- "targets": [
170
- {
171
- "target_name": "binding",
172
- "sources": [ "src/binding.cc" ]
173
- }
174
- ]
175
- }
176
- ```
177
-
178
- ## Further reading
179
-
180
- The **[docs](./docs/)** directory contains additional documentation on specific node-gyp topics that may be useful if you are experiencing problems installing or building addons using node-gyp.
181
-
182
- Some additional resources for Node.js native addons and writing `gyp` configuration files:
183
-
184
- * ["Going Native" a nodeschool.io tutorial](http://nodeschool.io/#goingnative)
185
- * ["Hello World" node addon example](https://github.com/nodejs/node/tree/main/test/addons/hello-world)
186
- * [gyp user documentation](https://gyp.gsrc.io/docs/UserDocumentation.md)
187
- * [gyp input format reference](https://gyp.gsrc.io/docs/InputFormatReference.md)
188
- * [*"binding.gyp" files out in the wild* wiki page](./docs/binding.gyp-files-in-the-wild.md)
189
-
190
- ## Commands
191
-
192
- `node-gyp` responds to the following commands:
193
-
194
- | **Command** | **Description**
195
- |:--------------|:---------------------------------------------------------------
196
- | `help` | Shows the help dialog
197
- | `build` | Invokes `make`/`msbuild.exe` and builds the native addon
198
- | `clean` | Removes the `build` directory if it exists
199
- | `configure` | Generates project build files for the current platform
200
- | `rebuild` | Runs `clean`, `configure` and `build` all in a row
201
- | `install` | Installs Node.js header files for the given version
202
- | `list` | Lists the currently installed Node.js header versions
203
- | `remove` | Removes the Node.js header files for the given version
204
-
205
-
206
- ## Command Options
207
-
208
- `node-gyp` accepts the following command options:
209
-
210
- | **Command** | **Description**
211
- |:----------------------------------|:------------------------------------------
212
- | `-j n`, `--jobs n` | Run `make` in parallel. The value `max` will use all available CPU cores
213
- | `--target=v6.2.1` | Node.js version to build for (default is `process.version`)
214
- | `--silly`, `--loglevel=silly` | Log all progress to console
215
- | `--verbose`, `--loglevel=verbose` | Log most progress to console
216
- | `--silent`, `--loglevel=silent` | Don't log anything to console
217
- | `debug`, `--debug` | Make Debug build (default is `Release`)
218
- | `--release`, `--no-debug` | Make Release build
219
- | `-C $dir`, `--directory=$dir` | Run command in different directory
220
- | `--make=$make` | Override `make` command (e.g. `gmake`)
221
- | `--thin=yes` | Enable thin static libraries
222
- | `--arch=$arch` | Set target architecture (e.g. ia32)
223
- | `--tarball=$path` | Get headers from a local tarball
224
- | `--devdir=$path` | SDK download directory (default is OS cache directory)
225
- | `--ensure` | Don't reinstall headers if already present
226
- | `--dist-url=$url` | Download header tarball from custom URL
227
- | `--proxy=$url` | Set HTTP(S) proxy for downloading header tarball
228
- | `--noproxy=$urls` | Set urls to ignore proxies when downloading header tarball
229
- | `--cafile=$cafile` | Override default CA chain (to download tarball)
230
- | `--nodedir=$path` | Set the path to the node source code
231
- | `--python=$path` | Set path to the Python binary
232
- | `--msvs_version=$version` | Set Visual Studio version (Windows only)
233
- | `--solution=$solution` | Set Visual Studio Solution version (Windows only)
234
- | `--force-process-config` | Force using runtime's `process.config` object to generate `config.gypi` file
235
-
236
- ## Configuration
237
-
238
- ### Environment variables
239
-
240
- Use the form `npm_config_OPTION_NAME` for any of the command options listed
241
- above (dashes in option names should be replaced by underscores).
242
-
243
- For example, to set `devdir` equal to `/tmp/.gyp`, you would:
244
-
245
- Run this on Unix:
246
-
247
- ```bash
248
- export npm_config_devdir=/tmp/.gyp
249
- ```
250
-
251
- Or this on Windows:
252
-
253
- ```console
254
- set npm_config_devdir=c:\temp\.gyp
255
- ```
256
-
257
- ### `npm` configuration for npm versions before v9
258
-
259
- Use the form `OPTION_NAME` for any of the command options listed above.
260
-
261
- For example, to set `devdir` equal to `/tmp/.gyp`, you would run:
262
-
263
- ```bash
264
- npm config set [--global] devdir /tmp/.gyp
265
- ```
266
-
267
- **Note:** Configuration set via `npm` will only be used when `node-gyp`
268
- is run via `npm`, not when `node-gyp` is run directly.
269
-
270
- ## License
271
-
272
- `node-gyp` is available under the MIT license. See the [LICENSE
273
- file](LICENSE) for details.
@@ -1,2 +0,0 @@
1
- If you believe you have found a security issue in the software in this
2
- repository, please consult https://github.com/nodejs/node/blob/HEAD/SECURITY.md.
@@ -1,204 +0,0 @@
1
- {
2
- 'variables' : {
3
- 'node_engine_include_dir%': 'deps/v8/include',
4
- 'node_host_binary%': 'node',
5
- 'node_with_ltcg%': 'true',
6
- },
7
- 'target_defaults': {
8
- 'type': 'loadable_module',
9
- 'win_delay_load_hook': 'true',
10
- 'product_prefix': '',
11
-
12
- 'conditions': [
13
- [ 'node_engine=="chakracore"', {
14
- 'variables': {
15
- 'node_engine_include_dir%': 'deps/chakrashim/include'
16
- },
17
- }]
18
- ],
19
-
20
- 'include_dirs': [
21
- '<(node_root_dir)/include/node',
22
- '<(node_root_dir)/src',
23
- '<(node_root_dir)/deps/openssl/config',
24
- '<(node_root_dir)/deps/openssl/openssl/include',
25
- '<(node_root_dir)/deps/uv/include',
26
- '<(node_root_dir)/deps/zlib',
27
- '<(node_root_dir)/<(node_engine_include_dir)'
28
- ],
29
- 'defines!': [
30
- 'BUILDING_UV_SHARED=1', # Inherited from common.gypi.
31
- 'BUILDING_V8_SHARED=1', # Inherited from common.gypi.
32
- ],
33
- 'defines': [
34
- 'NODE_GYP_MODULE_NAME=>(_target_name)',
35
- 'USING_UV_SHARED=1',
36
- 'USING_V8_SHARED=1',
37
- # Warn when using deprecated V8 APIs.
38
- 'V8_DEPRECATION_WARNINGS=1'
39
- ],
40
-
41
- 'target_conditions': [
42
- ['_type=="loadable_module"', {
43
- 'product_extension': 'node',
44
- 'defines': [
45
- 'BUILDING_NODE_EXTENSION'
46
- ],
47
- 'xcode_settings': {
48
- 'OTHER_LDFLAGS': [
49
- '-undefined dynamic_lookup'
50
- ],
51
- },
52
- }],
53
-
54
- ['_type=="static_library"', {
55
- # set to `1` to *disable* the -T thin archive 'ld' flag.
56
- # older linkers don't support this flag.
57
- 'standalone_static_library': '<(standalone_static_library)'
58
- }],
59
-
60
- ['_type!="executable"', {
61
- 'conditions': [
62
- [ 'OS=="android"', {
63
- 'cflags!': [ '-fPIE' ],
64
- }]
65
- ]
66
- }],
67
-
68
- ['_win_delay_load_hook=="true"', {
69
- # If the addon specifies `'win_delay_load_hook': 'true'` in its
70
- # binding.gyp, link a delay-load hook into the DLL. This hook ensures
71
- # that the addon will work regardless of whether the node/iojs binary
72
- # is named node.exe, iojs.exe, or something else.
73
- 'conditions': [
74
- [ 'OS=="win"', {
75
- 'defines': [ 'HOST_BINARY=\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\"', ],
76
- 'sources': [
77
- '<(node_gyp_dir)/src/win_delay_load_hook.cc',
78
- ],
79
- 'msvs_settings': {
80
- 'VCLinkerTool': {
81
- 'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ],
82
- # Don't print a linker warning when no imports from either .exe
83
- # are used.
84
- 'AdditionalOptions': [ '/ignore:4199' ],
85
- },
86
- },
87
- }],
88
- ],
89
- }],
90
- ],
91
-
92
- 'conditions': [
93
- [ 'OS=="mac"', {
94
- 'defines': [
95
- '_DARWIN_USE_64_BIT_INODE=1'
96
- ],
97
- 'xcode_settings': {
98
- 'DYLIB_INSTALL_NAME_BASE': '@rpath'
99
- },
100
- }],
101
- [ 'OS=="aix"', {
102
- 'ldflags': [
103
- '-Wl,-bimport:<(node_exp_file)'
104
- ],
105
- }],
106
- [ 'OS=="os400"', {
107
- 'ldflags': [
108
- '-Wl,-bimport:<(node_exp_file)'
109
- ],
110
- }],
111
- [ 'OS=="zos"', {
112
- 'conditions': [
113
- [ '"<!(echo $CC)" != "clang" and \
114
- "<!(echo $CC)" != "ibm-clang64" and \
115
- "<!(echo $CC)" != "ibm-clang"', {
116
- 'cflags': [
117
- '-q64',
118
- '-Wc,DLL',
119
- '-qlonglong',
120
- '-qenum=int',
121
- '-qxclang=-fexec-charset=ISO8859-1'
122
- ],
123
- 'ldflags': [
124
- '-q64',
125
- '<(node_exp_file)',
126
- ],
127
- }, {
128
- 'cflags': [
129
- '-m64',
130
- ],
131
- 'ldflags': [
132
- '-m64',
133
- '<(node_exp_file)',
134
- ],
135
- }],
136
- ],
137
- 'defines': [
138
- '_ALL_SOURCE',
139
- 'MAP_FAILED=-1',
140
- '_UNIX03_SOURCE',
141
- ],
142
- }],
143
- [ 'OS=="win"', {
144
- 'conditions': [
145
- ['node_engine=="chakracore"', {
146
- 'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
147
- 'libraries': [ '<@(node_engine_libs)' ],
148
- }],
149
- ['node_with_ltcg=="true"', {
150
- 'msvs_settings': {
151
- 'VCCLCompilerTool': {
152
- 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
153
- },
154
- 'VCLibrarianTool': {
155
- 'AdditionalOptions': [
156
- '/LTCG:INCREMENTAL', # incremental link-time code generation
157
- ]
158
- },
159
- 'VCLinkerTool': {
160
- 'OptimizeReferences': 2, # /OPT:REF
161
- 'EnableCOMDATFolding': 2, # /OPT:ICF
162
- 'LinkIncremental': 1, # disable incremental linking
163
- 'AdditionalOptions': [
164
- '/LTCG:INCREMENTAL', # incremental link-time code generation
165
- ]
166
- }
167
- }
168
- }]
169
- ],
170
- 'libraries': [
171
- '-lkernel32.lib',
172
- '-luser32.lib',
173
- '-lgdi32.lib',
174
- '-lwinspool.lib',
175
- '-lcomdlg32.lib',
176
- '-ladvapi32.lib',
177
- '-lshell32.lib',
178
- '-lole32.lib',
179
- '-loleaut32.lib',
180
- '-luuid.lib',
181
- '-lodbc32.lib',
182
- '-lDelayImp.lib',
183
- '-l"<(node_lib_file)"'
184
- ],
185
- 'msvs_disabled_warnings': [
186
- # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
187
- # needs to have dll-interface to be used by
188
- # clients of class 'node::ObjectWrap'
189
- 4251
190
- ],
191
- }, {
192
- # OS!="win"
193
- 'defines': [
194
- '_LARGEFILE_SOURCE',
195
- '_FILE_OFFSET_BITS=64'
196
- ],
197
- }],
198
- [ 'OS in "freebsd openbsd netbsd solaris android" or \
199
- (OS=="linux" and target_arch!="ia32")', {
200
- 'cflags': [ '-fPIC' ],
201
- }],
202
- ]
203
- }
204
- }
@@ -1,138 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- 'use strict'
4
-
5
- process.title = 'node-gyp'
6
-
7
- const envPaths = require('env-paths')
8
- const gyp = require('../')
9
- const log = require('../lib/log')
10
- const os = require('os')
11
-
12
- /**
13
- * Process and execute the selected commands.
14
- */
15
-
16
- const prog = gyp()
17
- let completed = false
18
- prog.parseArgv(process.argv)
19
- prog.devDir = prog.opts.devdir
20
-
21
- const homeDir = os.homedir()
22
- if (prog.devDir) {
23
- prog.devDir = prog.devDir.replace(/^~/, homeDir)
24
- } else if (homeDir) {
25
- prog.devDir = envPaths('node-gyp', { suffix: '' }).cache
26
- } else {
27
- throw new Error(
28
- "node-gyp requires that the user's home directory is specified " +
29
- 'in either of the environmental variables HOME or USERPROFILE. ' +
30
- 'Overide with: --devdir /path/to/.node-gyp')
31
- }
32
-
33
- if (prog.todo.length === 0) {
34
- if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
35
- log.stdout('v%s', prog.version)
36
- } else {
37
- log.stdout('%s', prog.usage())
38
- }
39
- process.exit(0)
40
- }
41
-
42
- log.info('it worked if it ends with', 'ok')
43
- log.verbose('cli', process.argv)
44
- log.info('using', 'node-gyp@%s', prog.version)
45
- log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch)
46
-
47
- /**
48
- * Change dir if -C/--directory was passed.
49
- */
50
-
51
- const dir = prog.opts.directory
52
- if (dir) {
53
- const fs = require('fs')
54
- try {
55
- const stat = fs.statSync(dir)
56
- if (stat.isDirectory()) {
57
- log.info('chdir', dir)
58
- process.chdir(dir)
59
- } else {
60
- log.warn('chdir', dir + ' is not a directory')
61
- }
62
- } catch (e) {
63
- if (e.code === 'ENOENT') {
64
- log.warn('chdir', dir + ' is not a directory')
65
- } else {
66
- log.warn('chdir', 'error during chdir() "%s"', e.message)
67
- }
68
- }
69
- }
70
-
71
- async function run () {
72
- const command = prog.todo.shift()
73
- if (!command) {
74
- // done!
75
- completed = true
76
- log.info('ok')
77
- return
78
- }
79
-
80
- try {
81
- const args = await prog.commands[command.name](command.args) ?? []
82
-
83
- if (command.name === 'list') {
84
- if (args.length) {
85
- args.forEach((version) => log.stdout(version))
86
- } else {
87
- log.stdout('No node development files installed. Use `node-gyp install` to install a version.')
88
- }
89
- } else if (args.length >= 1) {
90
- log.stdout(...args.slice(1))
91
- }
92
-
93
- // now run the next command in the queue
94
- return run()
95
- } catch (err) {
96
- log.error(command.name + ' error')
97
- log.error('stack', err.stack)
98
- errorMessage()
99
- log.error('not ok')
100
- return process.exit(1)
101
- }
102
- }
103
-
104
- process.on('exit', function (code) {
105
- if (!completed && !code) {
106
- log.error('Completion callback never invoked!')
107
- issueMessage()
108
- process.exit(6)
109
- }
110
- })
111
-
112
- process.on('uncaughtException', function (err) {
113
- log.error('UNCAUGHT EXCEPTION')
114
- log.error('stack', err.stack)
115
- issueMessage()
116
- process.exit(7)
117
- })
118
-
119
- function errorMessage () {
120
- // copied from npm's lib/utils/error-handler.js
121
- const os = require('os')
122
- log.error('System', os.type() + ' ' + os.release())
123
- log.error('command', process.argv
124
- .map(JSON.stringify).join(' '))
125
- log.error('cwd', process.cwd())
126
- log.error('node -v', process.version)
127
- log.error('node-gyp -v', 'v' + prog.package.version)
128
- }
129
-
130
- function issueMessage () {
131
- errorMessage()
132
- log.error('', ['Node-gyp failed to build your package.',
133
- 'Try to update npm and/or node-gyp and if it does not help file an issue with the package author.'
134
- ].join('\n'))
135
- }
136
-
137
- // start running the given commands!
138
- run()