@btc-vision/bitcoin 6.4.9 → 6.4.11

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 (230) hide show
  1. package/.babelrc +4 -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/index.d.ts +1 -1
  9. package/browser/index.js +1 -1
  10. package/browser/{ops.d.ts → opcodes.d.ts} +2 -3
  11. package/browser/script.d.ts +2 -2
  12. package/build/address.js +2 -1
  13. package/build/index.d.ts +1 -1
  14. package/build/index.js +1 -1
  15. package/build/{ops.d.ts → opcodes.d.ts} +2 -3
  16. package/build/{ops.js → opcodes.js} +4 -5
  17. package/build/payments/embed.js +1 -1
  18. package/build/payments/p2ms.js +1 -1
  19. package/build/payments/p2op.js +1 -1
  20. package/build/payments/p2pk.js +1 -1
  21. package/build/payments/p2pkh.js +1 -1
  22. package/build/payments/p2sh.js +3 -3
  23. package/build/payments/p2tr.js +1 -1
  24. package/build/payments/p2wpkh.js +2 -2
  25. package/build/payments/p2wsh.js +2 -2
  26. package/build/push_data.js +9 -9
  27. package/build/script.d.ts +2 -2
  28. package/build/script.js +12 -12
  29. package/build/transaction.js +1 -1
  30. package/cjs/package.json +3 -3
  31. package/gulpfile.js +42 -42
  32. package/package.json +150 -150
  33. package/src/address.ts +304 -303
  34. package/src/bip66.ts +107 -107
  35. package/src/block.ts +233 -233
  36. package/src/bufferutils.ts +188 -188
  37. package/src/crypto.ts +108 -108
  38. package/src/ecc_lib.ts +94 -94
  39. package/src/hooks/AdvancedSignatureManager.ts +104 -104
  40. package/src/hooks/SignatureManager.ts +84 -84
  41. package/src/index.ts +105 -105
  42. package/src/merkle.ts +31 -31
  43. package/src/{ops.ts → opcodes.ts} +280 -282
  44. package/src/payments/bip341.ts +140 -140
  45. package/src/payments/embed.ts +61 -61
  46. package/src/payments/index.ts +172 -172
  47. package/src/payments/lazy.ts +28 -28
  48. package/src/payments/p2ms.ts +156 -156
  49. package/src/payments/p2op.ts +195 -195
  50. package/src/payments/p2pk.ts +93 -93
  51. package/src/payments/p2pkh.ts +214 -214
  52. package/src/payments/p2sh.ts +210 -210
  53. package/src/payments/p2tr.ts +309 -309
  54. package/src/payments/p2wpkh.ts +144 -144
  55. package/src/payments/p2wsh.ts +217 -217
  56. package/src/psbt/bip371.ts +441 -441
  57. package/src/push_data.ts +97 -97
  58. package/src/script.ts +247 -247
  59. package/src/script_number.ts +72 -72
  60. package/src/script_signature.ts +91 -91
  61. package/src/transaction.ts +656 -656
  62. package/test/address.spec.ts +155 -155
  63. package/test/bitcoin.core.spec.ts +212 -212
  64. package/test/block.spec.ts +171 -171
  65. package/test/bufferutils.spec.ts +450 -450
  66. package/test/crypto.spec.ts +49 -49
  67. package/test/fixtures/address.json +329 -329
  68. package/test/fixtures/block.json +148 -148
  69. package/test/fixtures/bufferutils.json +102 -102
  70. package/test/fixtures/core/README.md +26 -26
  71. package/test/fixtures/core/base58_encode_decode.json +50 -50
  72. package/test/fixtures/core/base58_keys_invalid.json +152 -152
  73. package/test/fixtures/core/base58_keys_valid.json +452 -452
  74. package/test/fixtures/core/blocks.json +27 -27
  75. package/test/fixtures/core/sig_canonical.json +7 -7
  76. package/test/fixtures/core/sig_noncanonical.json +33 -33
  77. package/test/fixtures/core/sighash.json +3505 -3505
  78. package/test/fixtures/core/tx_valid.json +2023 -2023
  79. package/test/fixtures/crypto.json +43 -43
  80. package/test/fixtures/ecdsa.json +217 -217
  81. package/test/fixtures/ecpair.json +141 -141
  82. package/test/fixtures/embed.json +108 -108
  83. package/test/fixtures/p2ms.json +434 -434
  84. package/test/fixtures/p2pk.json +179 -179
  85. package/test/fixtures/p2pkh.json +276 -276
  86. package/test/fixtures/p2sh.json +508 -508
  87. package/test/fixtures/p2tr.json +1198 -1198
  88. package/test/fixtures/p2wpkh.json +290 -290
  89. package/test/fixtures/p2wsh.json +489 -489
  90. package/test/fixtures/psbt.json +924 -924
  91. package/test/fixtures/script.json +465 -465
  92. package/test/fixtures/script_number.json +225 -225
  93. package/test/fixtures/signature.json +140 -140
  94. package/test/fixtures/transaction.json +916 -916
  95. package/test/integration/_regtest.ts +6 -6
  96. package/test/integration/addresses.spec.ts +142 -142
  97. package/test/integration/bip32.spec.ts +130 -130
  98. package/test/integration/blocks.spec.ts +28 -28
  99. package/test/integration/cltv.spec.ts +241 -241
  100. package/test/integration/csv.spec.ts +452 -452
  101. package/test/integration/payments.spec.ts +110 -110
  102. package/test/integration/taproot.spec.ts +663 -663
  103. package/test/integration/transactions.spec.ts +668 -668
  104. package/test/payments.spec.ts +114 -114
  105. package/test/payments.utils.ts +165 -165
  106. package/test/psbt.spec.ts +1285 -1285
  107. package/test/script.spec.ts +186 -186
  108. package/test/script_number.spec.ts +26 -26
  109. package/test/script_signature.spec.ts +66 -66
  110. package/test/transaction.spec.ts +337 -337
  111. package/test/ts-node-register.js +7 -7
  112. package/test/tsconfig.json +48 -48
  113. package/test/types.spec.ts +53 -53
  114. package/tsconfig.base.json +27 -27
  115. package/tsconfig.json +19 -19
  116. package/tsconfig.webpack.json +18 -18
  117. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
  118. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
  119. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
  120. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
  121. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
  122. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
  123. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
  124. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
  125. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
  126. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
  127. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
  128. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
  129. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
  130. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
  131. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
  132. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
  133. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
  134. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
  135. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
  136. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
  137. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
  138. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
  139. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  140. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
  141. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  142. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
  143. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  144. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  145. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  146. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  147. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  148. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
  149. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
  150. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
  151. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
  152. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
  153. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  154. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  155. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
  156. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  157. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
  158. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
  159. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  160. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
  161. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  162. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
  163. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
  164. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
  165. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  166. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
  167. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
  168. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
  169. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  170. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
  171. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  172. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  173. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
  174. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  175. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  176. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
  177. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
  178. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
  179. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  180. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
  181. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  182. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
  183. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
  184. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
  185. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
  186. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
  187. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
  188. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
  189. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
  190. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
  191. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
  192. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
  193. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
  194. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  195. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
  196. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
  197. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
  198. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
  199. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
  200. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
  201. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
  202. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  203. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
  204. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
  205. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
  206. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
  207. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
  208. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
  209. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
  210. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
  211. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
  212. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
  213. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
  214. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
  215. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
  216. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
  217. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
  218. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
  219. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
  220. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
  221. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
  222. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
  223. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
  224. package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
  225. package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
  226. package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
  227. package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
  228. package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
  229. package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
  230. package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
@@ -1,563 +0,0 @@
1
- # This file is dual licensed under the terms of the Apache License, Version
2
- # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
- # for complete details.
4
- """
5
- .. testsetup::
6
-
7
- from packaging.version import parse, Version
8
- """
9
-
10
- import itertools
11
- import re
12
- from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union
13
-
14
- from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType
15
-
16
- __all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"]
17
-
18
- LocalType = Tuple[Union[int, str], ...]
19
-
20
- CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]]
21
- CmpLocalType = Union[
22
- NegativeInfinityType,
23
- Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...],
24
- ]
25
- CmpKey = Tuple[
26
- int,
27
- Tuple[int, ...],
28
- CmpPrePostDevType,
29
- CmpPrePostDevType,
30
- CmpPrePostDevType,
31
- CmpLocalType,
32
- ]
33
- VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool]
34
-
35
-
36
- class _Version(NamedTuple):
37
- epoch: int
38
- release: Tuple[int, ...]
39
- dev: Optional[Tuple[str, int]]
40
- pre: Optional[Tuple[str, int]]
41
- post: Optional[Tuple[str, int]]
42
- local: Optional[LocalType]
43
-
44
-
45
- def parse(version: str) -> "Version":
46
- """Parse the given version string.
47
-
48
- >>> parse('1.0.dev1')
49
- <Version('1.0.dev1')>
50
-
51
- :param version: The version string to parse.
52
- :raises InvalidVersion: When the version string is not a valid version.
53
- """
54
- return Version(version)
55
-
56
-
57
- class InvalidVersion(ValueError):
58
- """Raised when a version string is not a valid version.
59
-
60
- >>> Version("invalid")
61
- Traceback (most recent call last):
62
- ...
63
- packaging.version.InvalidVersion: Invalid version: 'invalid'
64
- """
65
-
66
-
67
- class _BaseVersion:
68
- _key: Tuple[Any, ...]
69
-
70
- def __hash__(self) -> int:
71
- return hash(self._key)
72
-
73
- # Please keep the duplicated `isinstance` check
74
- # in the six comparisons hereunder
75
- # unless you find a way to avoid adding overhead function calls.
76
- def __lt__(self, other: "_BaseVersion") -> bool:
77
- if not isinstance(other, _BaseVersion):
78
- return NotImplemented
79
-
80
- return self._key < other._key
81
-
82
- def __le__(self, other: "_BaseVersion") -> bool:
83
- if not isinstance(other, _BaseVersion):
84
- return NotImplemented
85
-
86
- return self._key <= other._key
87
-
88
- def __eq__(self, other: object) -> bool:
89
- if not isinstance(other, _BaseVersion):
90
- return NotImplemented
91
-
92
- return self._key == other._key
93
-
94
- def __ge__(self, other: "_BaseVersion") -> bool:
95
- if not isinstance(other, _BaseVersion):
96
- return NotImplemented
97
-
98
- return self._key >= other._key
99
-
100
- def __gt__(self, other: "_BaseVersion") -> bool:
101
- if not isinstance(other, _BaseVersion):
102
- return NotImplemented
103
-
104
- return self._key > other._key
105
-
106
- def __ne__(self, other: object) -> bool:
107
- if not isinstance(other, _BaseVersion):
108
- return NotImplemented
109
-
110
- return self._key != other._key
111
-
112
-
113
- # Deliberately not anchored to the start and end of the string, to make it
114
- # easier for 3rd party code to reuse
115
- _VERSION_PATTERN = r"""
116
- v?
117
- (?:
118
- (?:(?P<epoch>[0-9]+)!)? # epoch
119
- (?P<release>[0-9]+(?:\.[0-9]+)*) # release segment
120
- (?P<pre> # pre-release
121
- [-_\.]?
122
- (?P<pre_l>alpha|a|beta|b|preview|pre|c|rc)
123
- [-_\.]?
124
- (?P<pre_n>[0-9]+)?
125
- )?
126
- (?P<post> # post release
127
- (?:-(?P<post_n1>[0-9]+))
128
- |
129
- (?:
130
- [-_\.]?
131
- (?P<post_l>post|rev|r)
132
- [-_\.]?
133
- (?P<post_n2>[0-9]+)?
134
- )
135
- )?
136
- (?P<dev> # dev release
137
- [-_\.]?
138
- (?P<dev_l>dev)
139
- [-_\.]?
140
- (?P<dev_n>[0-9]+)?
141
- )?
142
- )
143
- (?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
144
- """
145
-
146
- VERSION_PATTERN = _VERSION_PATTERN
147
- """
148
- A string containing the regular expression used to match a valid version.
149
-
150
- The pattern is not anchored at either end, and is intended for embedding in larger
151
- expressions (for example, matching a version number as part of a file name). The
152
- regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
153
- flags set.
154
-
155
- :meta hide-value:
156
- """
157
-
158
-
159
- class Version(_BaseVersion):
160
- """This class abstracts handling of a project's versions.
161
-
162
- A :class:`Version` instance is comparison aware and can be compared and
163
- sorted using the standard Python interfaces.
164
-
165
- >>> v1 = Version("1.0a5")
166
- >>> v2 = Version("1.0")
167
- >>> v1
168
- <Version('1.0a5')>
169
- >>> v2
170
- <Version('1.0')>
171
- >>> v1 < v2
172
- True
173
- >>> v1 == v2
174
- False
175
- >>> v1 > v2
176
- False
177
- >>> v1 >= v2
178
- False
179
- >>> v1 <= v2
180
- True
181
- """
182
-
183
- _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
184
- _key: CmpKey
185
-
186
- def __init__(self, version: str) -> None:
187
- """Initialize a Version object.
188
-
189
- :param version:
190
- The string representation of a version which will be parsed and normalized
191
- before use.
192
- :raises InvalidVersion:
193
- If the ``version`` does not conform to PEP 440 in any way then this
194
- exception will be raised.
195
- """
196
-
197
- # Validate the version and parse it into pieces
198
- match = self._regex.search(version)
199
- if not match:
200
- raise InvalidVersion(f"Invalid version: '{version}'")
201
-
202
- # Store the parsed out pieces of the version
203
- self._version = _Version(
204
- epoch=int(match.group("epoch")) if match.group("epoch") else 0,
205
- release=tuple(int(i) for i in match.group("release").split(".")),
206
- pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
207
- post=_parse_letter_version(
208
- match.group("post_l"), match.group("post_n1") or match.group("post_n2")
209
- ),
210
- dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
211
- local=_parse_local_version(match.group("local")),
212
- )
213
-
214
- # Generate a key which will be used for sorting
215
- self._key = _cmpkey(
216
- self._version.epoch,
217
- self._version.release,
218
- self._version.pre,
219
- self._version.post,
220
- self._version.dev,
221
- self._version.local,
222
- )
223
-
224
- def __repr__(self) -> str:
225
- """A representation of the Version that shows all internal state.
226
-
227
- >>> Version('1.0.0')
228
- <Version('1.0.0')>
229
- """
230
- return f"<Version('{self}')>"
231
-
232
- def __str__(self) -> str:
233
- """A string representation of the version that can be rounded-tripped.
234
-
235
- >>> str(Version("1.0a5"))
236
- '1.0a5'
237
- """
238
- parts = []
239
-
240
- # Epoch
241
- if self.epoch != 0:
242
- parts.append(f"{self.epoch}!")
243
-
244
- # Release segment
245
- parts.append(".".join(str(x) for x in self.release))
246
-
247
- # Pre-release
248
- if self.pre is not None:
249
- parts.append("".join(str(x) for x in self.pre))
250
-
251
- # Post-release
252
- if self.post is not None:
253
- parts.append(f".post{self.post}")
254
-
255
- # Development release
256
- if self.dev is not None:
257
- parts.append(f".dev{self.dev}")
258
-
259
- # Local version segment
260
- if self.local is not None:
261
- parts.append(f"+{self.local}")
262
-
263
- return "".join(parts)
264
-
265
- @property
266
- def epoch(self) -> int:
267
- """The epoch of the version.
268
-
269
- >>> Version("2.0.0").epoch
270
- 0
271
- >>> Version("1!2.0.0").epoch
272
- 1
273
- """
274
- return self._version.epoch
275
-
276
- @property
277
- def release(self) -> Tuple[int, ...]:
278
- """The components of the "release" segment of the version.
279
-
280
- >>> Version("1.2.3").release
281
- (1, 2, 3)
282
- >>> Version("2.0.0").release
283
- (2, 0, 0)
284
- >>> Version("1!2.0.0.post0").release
285
- (2, 0, 0)
286
-
287
- Includes trailing zeroes but not the epoch or any pre-release / development /
288
- post-release suffixes.
289
- """
290
- return self._version.release
291
-
292
- @property
293
- def pre(self) -> Optional[Tuple[str, int]]:
294
- """The pre-release segment of the version.
295
-
296
- >>> print(Version("1.2.3").pre)
297
- None
298
- >>> Version("1.2.3a1").pre
299
- ('a', 1)
300
- >>> Version("1.2.3b1").pre
301
- ('b', 1)
302
- >>> Version("1.2.3rc1").pre
303
- ('rc', 1)
304
- """
305
- return self._version.pre
306
-
307
- @property
308
- def post(self) -> Optional[int]:
309
- """The post-release number of the version.
310
-
311
- >>> print(Version("1.2.3").post)
312
- None
313
- >>> Version("1.2.3.post1").post
314
- 1
315
- """
316
- return self._version.post[1] if self._version.post else None
317
-
318
- @property
319
- def dev(self) -> Optional[int]:
320
- """The development number of the version.
321
-
322
- >>> print(Version("1.2.3").dev)
323
- None
324
- >>> Version("1.2.3.dev1").dev
325
- 1
326
- """
327
- return self._version.dev[1] if self._version.dev else None
328
-
329
- @property
330
- def local(self) -> Optional[str]:
331
- """The local version segment of the version.
332
-
333
- >>> print(Version("1.2.3").local)
334
- None
335
- >>> Version("1.2.3+abc").local
336
- 'abc'
337
- """
338
- if self._version.local:
339
- return ".".join(str(x) for x in self._version.local)
340
- else:
341
- return None
342
-
343
- @property
344
- def public(self) -> str:
345
- """The public portion of the version.
346
-
347
- >>> Version("1.2.3").public
348
- '1.2.3'
349
- >>> Version("1.2.3+abc").public
350
- '1.2.3'
351
- >>> Version("1.2.3+abc.dev1").public
352
- '1.2.3'
353
- """
354
- return str(self).split("+", 1)[0]
355
-
356
- @property
357
- def base_version(self) -> str:
358
- """The "base version" of the version.
359
-
360
- >>> Version("1.2.3").base_version
361
- '1.2.3'
362
- >>> Version("1.2.3+abc").base_version
363
- '1.2.3'
364
- >>> Version("1!1.2.3+abc.dev1").base_version
365
- '1!1.2.3'
366
-
367
- The "base version" is the public version of the project without any pre or post
368
- release markers.
369
- """
370
- parts = []
371
-
372
- # Epoch
373
- if self.epoch != 0:
374
- parts.append(f"{self.epoch}!")
375
-
376
- # Release segment
377
- parts.append(".".join(str(x) for x in self.release))
378
-
379
- return "".join(parts)
380
-
381
- @property
382
- def is_prerelease(self) -> bool:
383
- """Whether this version is a pre-release.
384
-
385
- >>> Version("1.2.3").is_prerelease
386
- False
387
- >>> Version("1.2.3a1").is_prerelease
388
- True
389
- >>> Version("1.2.3b1").is_prerelease
390
- True
391
- >>> Version("1.2.3rc1").is_prerelease
392
- True
393
- >>> Version("1.2.3dev1").is_prerelease
394
- True
395
- """
396
- return self.dev is not None or self.pre is not None
397
-
398
- @property
399
- def is_postrelease(self) -> bool:
400
- """Whether this version is a post-release.
401
-
402
- >>> Version("1.2.3").is_postrelease
403
- False
404
- >>> Version("1.2.3.post1").is_postrelease
405
- True
406
- """
407
- return self.post is not None
408
-
409
- @property
410
- def is_devrelease(self) -> bool:
411
- """Whether this version is a development release.
412
-
413
- >>> Version("1.2.3").is_devrelease
414
- False
415
- >>> Version("1.2.3.dev1").is_devrelease
416
- True
417
- """
418
- return self.dev is not None
419
-
420
- @property
421
- def major(self) -> int:
422
- """The first item of :attr:`release` or ``0`` if unavailable.
423
-
424
- >>> Version("1.2.3").major
425
- 1
426
- """
427
- return self.release[0] if len(self.release) >= 1 else 0
428
-
429
- @property
430
- def minor(self) -> int:
431
- """The second item of :attr:`release` or ``0`` if unavailable.
432
-
433
- >>> Version("1.2.3").minor
434
- 2
435
- >>> Version("1").minor
436
- 0
437
- """
438
- return self.release[1] if len(self.release) >= 2 else 0
439
-
440
- @property
441
- def micro(self) -> int:
442
- """The third item of :attr:`release` or ``0`` if unavailable.
443
-
444
- >>> Version("1.2.3").micro
445
- 3
446
- >>> Version("1").micro
447
- 0
448
- """
449
- return self.release[2] if len(self.release) >= 3 else 0
450
-
451
-
452
- def _parse_letter_version(
453
- letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
454
- ) -> Optional[Tuple[str, int]]:
455
-
456
- if letter:
457
- # We consider there to be an implicit 0 in a pre-release if there is
458
- # not a numeral associated with it.
459
- if number is None:
460
- number = 0
461
-
462
- # We normalize any letters to their lower case form
463
- letter = letter.lower()
464
-
465
- # We consider some words to be alternate spellings of other words and
466
- # in those cases we want to normalize the spellings to our preferred
467
- # spelling.
468
- if letter == "alpha":
469
- letter = "a"
470
- elif letter == "beta":
471
- letter = "b"
472
- elif letter in ["c", "pre", "preview"]:
473
- letter = "rc"
474
- elif letter in ["rev", "r"]:
475
- letter = "post"
476
-
477
- return letter, int(number)
478
- if not letter and number:
479
- # We assume if we are given a number, but we are not given a letter
480
- # then this is using the implicit post release syntax (e.g. 1.0-1)
481
- letter = "post"
482
-
483
- return letter, int(number)
484
-
485
- return None
486
-
487
-
488
- _local_version_separators = re.compile(r"[\._-]")
489
-
490
-
491
- def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
492
- """
493
- Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
494
- """
495
- if local is not None:
496
- return tuple(
497
- part.lower() if not part.isdigit() else int(part)
498
- for part in _local_version_separators.split(local)
499
- )
500
- return None
501
-
502
-
503
- def _cmpkey(
504
- epoch: int,
505
- release: Tuple[int, ...],
506
- pre: Optional[Tuple[str, int]],
507
- post: Optional[Tuple[str, int]],
508
- dev: Optional[Tuple[str, int]],
509
- local: Optional[LocalType],
510
- ) -> CmpKey:
511
-
512
- # When we compare a release version, we want to compare it with all of the
513
- # trailing zeros removed. So we'll use a reverse the list, drop all the now
514
- # leading zeros until we come to something non zero, then take the rest
515
- # re-reverse it back into the correct order and make it a tuple and use
516
- # that for our sorting key.
517
- _release = tuple(
518
- reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
519
- )
520
-
521
- # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
522
- # We'll do this by abusing the pre segment, but we _only_ want to do this
523
- # if there is not a pre or a post segment. If we have one of those then
524
- # the normal sorting rules will handle this case correctly.
525
- if pre is None and post is None and dev is not None:
526
- _pre: CmpPrePostDevType = NegativeInfinity
527
- # Versions without a pre-release (except as noted above) should sort after
528
- # those with one.
529
- elif pre is None:
530
- _pre = Infinity
531
- else:
532
- _pre = pre
533
-
534
- # Versions without a post segment should sort before those with one.
535
- if post is None:
536
- _post: CmpPrePostDevType = NegativeInfinity
537
-
538
- else:
539
- _post = post
540
-
541
- # Versions without a development segment should sort after those with one.
542
- if dev is None:
543
- _dev: CmpPrePostDevType = Infinity
544
-
545
- else:
546
- _dev = dev
547
-
548
- if local is None:
549
- # Versions without a local segment should sort before those with one.
550
- _local: CmpLocalType = NegativeInfinity
551
- else:
552
- # Versions with a local segment need that segment parsed to implement
553
- # the sorting rules in PEP440.
554
- # - Alpha numeric segments sort before numeric segments
555
- # - Alpha numeric segments sort lexicographically
556
- # - Numeric segments sort numerically
557
- # - Shorter versions sort before longer versions when the prefixes
558
- # match exactly
559
- _local = tuple(
560
- (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
561
- )
562
-
563
- return epoch, _release, _pre, _post, _dev, _local
@@ -1,120 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=61.0"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "gyp-next"
7
- version = "0.18.1"
8
- authors = [
9
- { name="Node.js contributors", email="ryzokuken@disroot.org" },
10
- ]
11
- description = "A fork of the GYP build system for use in the Node.js projects"
12
- readme = "README.md"
13
- license = { file="LICENSE" }
14
- requires-python = ">=3.8"
15
- dependencies = ["packaging>=24.0", "setuptools>=69.5.1"]
16
- classifiers = [
17
- "Development Status :: 3 - Alpha",
18
- "Environment :: Console",
19
- "Intended Audience :: Developers",
20
- "License :: OSI Approved :: BSD License",
21
- "Natural Language :: English",
22
- "Programming Language :: Python",
23
- "Programming Language :: Python :: 3",
24
- "Programming Language :: Python :: 3.8",
25
- "Programming Language :: Python :: 3.9",
26
- "Programming Language :: Python :: 3.10",
27
- "Programming Language :: Python :: 3.11",
28
- ]
29
-
30
- [project.optional-dependencies]
31
- dev = ["pytest", "ruff"]
32
-
33
- [project.scripts]
34
- gyp = "gyp:script_main"
35
-
36
- [project.urls]
37
- "Homepage" = "https://github.com/nodejs/gyp-next"
38
-
39
- [tool.ruff]
40
- extend-exclude = ["pylib/packaging"]
41
- line-length = 88
42
- target-version = "py37"
43
-
44
- [tool.ruff.lint]
45
- select = [
46
- "C4", # flake8-comprehensions
47
- "C90", # McCabe cyclomatic complexity
48
- "DTZ", # flake8-datetimez
49
- "E", # pycodestyle
50
- "F", # Pyflakes
51
- "G", # flake8-logging-format
52
- "ICN", # flake8-import-conventions
53
- "INT", # flake8-gettext
54
- "PL", # Pylint
55
- "PYI", # flake8-pyi
56
- "RSE", # flake8-raise
57
- "RUF", # Ruff-specific rules
58
- "T10", # flake8-debugger
59
- "TCH", # flake8-type-checking
60
- "TID", # flake8-tidy-imports
61
- "UP", # pyupgrade
62
- "W", # pycodestyle
63
- "YTT", # flake8-2020
64
- # "A", # flake8-builtins
65
- # "ANN", # flake8-annotations
66
- # "ARG", # flake8-unused-arguments
67
- # "B", # flake8-bugbear
68
- # "BLE", # flake8-blind-except
69
- # "COM", # flake8-commas
70
- # "D", # pydocstyle
71
- # "DJ", # flake8-django
72
- # "EM", # flake8-errmsg
73
- # "ERA", # eradicate
74
- # "EXE", # flake8-executable
75
- # "FBT", # flake8-boolean-trap
76
- # "I", # isort
77
- # "INP", # flake8-no-pep420
78
- # "ISC", # flake8-implicit-str-concat
79
- # "N", # pep8-naming
80
- # "NPY", # NumPy-specific rules
81
- # "PD", # pandas-vet
82
- # "PGH", # pygrep-hooks
83
- # "PIE", # flake8-pie
84
- # "PT", # flake8-pytest-style
85
- # "PTH", # flake8-use-pathlib
86
- # "Q", # flake8-quotes
87
- # "RET", # flake8-return
88
- # "S", # flake8-bandit
89
- # "SIM", # flake8-simplify
90
- # "SLF", # flake8-self
91
- # "T20", # flake8-print
92
- # "TRY", # tryceratops
93
- ]
94
- ignore = [
95
- "E721",
96
- "PLC1901",
97
- "PLR0402",
98
- "PLR1714",
99
- "PLR2004",
100
- "PLR5501",
101
- "PLW0603",
102
- "PLW2901",
103
- "PYI024",
104
- "RUF005",
105
- "RUF012",
106
- "UP031",
107
- ]
108
-
109
- [tool.ruff.lint.mccabe]
110
- max-complexity = 101
111
-
112
- [tool.ruff.lint.pylint]
113
- max-args = 11
114
- max-branches = 108
115
- max-returns = 10
116
- max-statements = 286
117
-
118
- [tool.setuptools]
119
- package-dir = {"" = "pylib"}
120
- packages = ["gyp", "gyp.generator"]
@@ -1,11 +0,0 @@
1
- {
2
- "last-release-sha": "78756421b0d7bb335992a9c7d26ba3cc8b619708",
3
- "packages": {
4
- ".": {
5
- "release-type": "python",
6
- "package-name": "gyp-next",
7
- "bump-minor-pre-major": true,
8
- "include-component-in-tag": false
9
- }
10
- }
11
- }