visaljs 0.0.0-stage → 0.0.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 (520) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/cli.js +8084 -0
  4. package/node/include/js_node.h +46 -0
  5. package/node/prelude/async_hooks.js +88 -0
  6. package/node/prelude/buffer.js +31 -0
  7. package/node/prelude/crypto.js +114 -0
  8. package/node/prelude/events.js +227 -0
  9. package/node/prelude/fs.js +79 -0
  10. package/node/prelude/http.js +536 -0
  11. package/node/prelude/http2.js +30 -0
  12. package/node/prelude/internal/crypto/asym.js +333 -0
  13. package/node/prelude/internal/crypto/cipher.js +205 -0
  14. package/node/prelude/internal/crypto/hash.js +137 -0
  15. package/node/prelude/internal/crypto/kdf.js +182 -0
  16. package/node/prelude/internal/crypto/keys.js +603 -0
  17. package/node/prelude/internal/crypto/random.js +118 -0
  18. package/node/prelude/internal/crypto/util.js +76 -0
  19. package/node/prelude/internal/errors.js +88 -0
  20. package/node/prelude/internal/querystring.js +105 -0
  21. package/node/prelude/module.js +53 -0
  22. package/node/prelude/net.js +51 -0
  23. package/node/prelude/os.js +129 -0
  24. package/node/prelude/path.js +257 -0
  25. package/node/prelude/process.js +21 -0
  26. package/node/prelude/querystring.js +469 -0
  27. package/node/prelude/stream.js +1327 -0
  28. package/node/prelude/stream_promises.js +7 -0
  29. package/node/prelude/stream_web.js +6 -0
  30. package/node/prelude/string_decoder.js +236 -0
  31. package/node/prelude/tty.js +18 -0
  32. package/node/prelude/url.js +1156 -0
  33. package/node/prelude/util.js +64 -0
  34. package/node/prelude/zlib.js +81 -0
  35. package/node/src/host_fs.c +126 -0
  36. package/node/src/host_http.c +486 -0
  37. package/node/src/host_os.c +505 -0
  38. package/node/src/host_sys.c +78 -0
  39. package/node/third_party/libuv/LICENSE +19 -0
  40. package/node/third_party/libuv/include/uv/aix.h +32 -0
  41. package/node/third_party/libuv/include/uv/bsd.h +34 -0
  42. package/node/third_party/libuv/include/uv/darwin.h +61 -0
  43. package/node/third_party/libuv/include/uv/errno.h +483 -0
  44. package/node/third_party/libuv/include/uv/linux.h +34 -0
  45. package/node/third_party/libuv/include/uv/os390.h +33 -0
  46. package/node/third_party/libuv/include/uv/posix.h +31 -0
  47. package/node/third_party/libuv/include/uv/sunos.h +44 -0
  48. package/node/third_party/libuv/include/uv/threadpool.h +37 -0
  49. package/node/third_party/libuv/include/uv/tree.h +521 -0
  50. package/node/third_party/libuv/include/uv/unix.h +512 -0
  51. package/node/third_party/libuv/include/uv/version.h +43 -0
  52. package/node/third_party/libuv/include/uv/win.h +698 -0
  53. package/node/third_party/libuv/include/uv.h +1990 -0
  54. package/node/third_party/libuv/src/fs-poll.c +290 -0
  55. package/node/third_party/libuv/src/heap-inl.h +245 -0
  56. package/node/third_party/libuv/src/idna.c +560 -0
  57. package/node/third_party/libuv/src/idna.h +31 -0
  58. package/node/third_party/libuv/src/inet.c +298 -0
  59. package/node/third_party/libuv/src/queue.h +90 -0
  60. package/node/third_party/libuv/src/random.c +123 -0
  61. package/node/third_party/libuv/src/strscpy.c +38 -0
  62. package/node/third_party/libuv/src/strscpy.h +39 -0
  63. package/node/third_party/libuv/src/strtok.c +52 -0
  64. package/node/third_party/libuv/src/strtok.h +27 -0
  65. package/node/third_party/libuv/src/thread-common.c +175 -0
  66. package/node/third_party/libuv/src/threadpool.c +419 -0
  67. package/node/third_party/libuv/src/timer.c +200 -0
  68. package/node/third_party/libuv/src/unix/async.c +418 -0
  69. package/node/third_party/libuv/src/unix/bsd-ifaddrs.c +164 -0
  70. package/node/third_party/libuv/src/unix/core.c +2104 -0
  71. package/node/third_party/libuv/src/unix/darwin-proctitle.c +176 -0
  72. package/node/third_party/libuv/src/unix/darwin-stub.h +97 -0
  73. package/node/third_party/libuv/src/unix/darwin-syscalls.h +17 -0
  74. package/node/third_party/libuv/src/unix/darwin.c +237 -0
  75. package/node/third_party/libuv/src/unix/dl.c +80 -0
  76. package/node/third_party/libuv/src/unix/fs.c +2303 -0
  77. package/node/third_party/libuv/src/unix/fsevents.c +906 -0
  78. package/node/third_party/libuv/src/unix/getaddrinfo.c +252 -0
  79. package/node/third_party/libuv/src/unix/getnameinfo.c +121 -0
  80. package/node/third_party/libuv/src/unix/internal.h +530 -0
  81. package/node/third_party/libuv/src/unix/kqueue.c +667 -0
  82. package/node/third_party/libuv/src/unix/linux.c +2761 -0
  83. package/node/third_party/libuv/src/unix/loop-watcher.c +68 -0
  84. package/node/third_party/libuv/src/unix/loop.c +240 -0
  85. package/node/third_party/libuv/src/unix/pipe.c +555 -0
  86. package/node/third_party/libuv/src/unix/poll.c +159 -0
  87. package/node/third_party/libuv/src/unix/process.c +1123 -0
  88. package/node/third_party/libuv/src/unix/procfs-exepath.c +45 -0
  89. package/node/third_party/libuv/src/unix/proctitle.c +157 -0
  90. package/node/third_party/libuv/src/unix/random-devurandom.c +93 -0
  91. package/node/third_party/libuv/src/unix/random-getentropy.c +57 -0
  92. package/node/third_party/libuv/src/unix/random-getrandom.c +86 -0
  93. package/node/third_party/libuv/src/unix/random-sysctl-linux.c +99 -0
  94. package/node/third_party/libuv/src/unix/signal.c +581 -0
  95. package/node/third_party/libuv/src/unix/stream.c +1567 -0
  96. package/node/third_party/libuv/src/unix/tcp.c +673 -0
  97. package/node/third_party/libuv/src/unix/thread.c +975 -0
  98. package/node/third_party/libuv/src/unix/tty.c +510 -0
  99. package/node/third_party/libuv/src/unix/udp.c +1434 -0
  100. package/node/third_party/libuv/src/uv-common.c +1051 -0
  101. package/node/third_party/libuv/src/uv-common.h +474 -0
  102. package/node/third_party/libuv/src/uv-data-getter-setters.c +119 -0
  103. package/node/third_party/libuv/src/version.c +45 -0
  104. package/node/third_party/llhttp/LICENSE +22 -0
  105. package/node/third_party/llhttp/api.c +509 -0
  106. package/node/third_party/llhttp/http.c +170 -0
  107. package/node/third_party/llhttp/llhttp.c +10099 -0
  108. package/node/third_party/llhttp/llhttp.h +907 -0
  109. package/package.json +25 -4
  110. package/runtime/include/js_atoms.gen.h +68 -0
  111. package/runtime/include/js_atoms.h +54 -0
  112. package/runtime/include/js_bigint.h +93 -0
  113. package/runtime/include/js_buffer.h +79 -0
  114. package/runtime/include/js_builtins.h +168 -0
  115. package/runtime/include/js_console.h +58 -0
  116. package/runtime/include/js_convert.h +22 -0
  117. package/runtime/include/js_core.def +188 -0
  118. package/runtime/include/js_crypto.h +58 -0
  119. package/runtime/include/js_error.h +37 -0
  120. package/runtime/include/js_exception.h +65 -0
  121. package/runtime/include/js_function.h +167 -0
  122. package/runtime/include/js_gc.h +195 -0
  123. package/runtime/include/js_generator.h +96 -0
  124. package/runtime/include/js_host.h +19 -0
  125. package/runtime/include/js_jobs.h +84 -0
  126. package/runtime/include/js_module.h +16 -0
  127. package/runtime/include/js_object.h +384 -0
  128. package/runtime/include/js_ops.h +111 -0
  129. package/runtime/include/js_promise.h +45 -0
  130. package/runtime/include/js_regexp.h +25 -0
  131. package/runtime/include/js_runtime.h +30 -0
  132. package/runtime/include/js_symbol.h +62 -0
  133. package/runtime/include/js_web.h +110 -0
  134. package/runtime/include/jscell.h +48 -0
  135. package/runtime/include/jscontext.h +240 -0
  136. package/runtime/include/jsnum.h +42 -0
  137. package/runtime/include/jsstring.h +161 -0
  138. package/runtime/include/jsvalue.h +142 -0
  139. package/runtime/src/arguments.c +115 -0
  140. package/runtime/src/array.c +1145 -0
  141. package/runtime/src/arraybuffer.c +608 -0
  142. package/runtime/src/async_iter.c +479 -0
  143. package/runtime/src/atoms.c +157 -0
  144. package/runtime/src/base64.c +107 -0
  145. package/runtime/src/bigint.c +1189 -0
  146. package/runtime/src/blob.c +371 -0
  147. package/runtime/src/buffer.c +1357 -0
  148. package/runtime/src/builtin_table.c +100 -0
  149. package/runtime/src/builtins.c +987 -0
  150. package/runtime/src/builtins_util.h +53 -0
  151. package/runtime/src/collections.c +912 -0
  152. package/runtime/src/components.c +28 -0
  153. package/runtime/src/console.c +637 -0
  154. package/runtime/src/convert.c +82 -0
  155. package/runtime/src/core_all.c +21 -0
  156. package/runtime/src/crypto.c +116 -0
  157. package/runtime/src/crypto_asym.c +644 -0
  158. package/runtime/src/crypto_cipher.c +671 -0
  159. package/runtime/src/crypto_hash.c +260 -0
  160. package/runtime/src/crypto_host.c +414 -0
  161. package/runtime/src/crypto_internal.h +304 -0
  162. package/runtime/src/crypto_kdf.c +143 -0
  163. package/runtime/src/crypto_key.c +171 -0
  164. package/runtime/src/crypto_pkey.c +794 -0
  165. package/runtime/src/crypto_subtle.c +1675 -0
  166. package/runtime/src/date.c +940 -0
  167. package/runtime/src/domexception.c +169 -0
  168. package/runtime/src/elements.c +312 -0
  169. package/runtime/src/elements.h +45 -0
  170. package/runtime/src/encoding.c +485 -0
  171. package/runtime/src/error.c +297 -0
  172. package/runtime/src/events.c +793 -0
  173. package/runtime/src/exception.c +56 -0
  174. package/runtime/src/fetch.c +772 -0
  175. package/runtime/src/function.c +530 -0
  176. package/runtime/src/gc.c +803 -0
  177. package/runtime/src/generator.c +218 -0
  178. package/runtime/src/global.c +119 -0
  179. package/runtime/src/headers.c +557 -0
  180. package/runtime/src/inspect.c +1792 -0
  181. package/runtime/src/internal.h +80 -0
  182. package/runtime/src/iterate.c +94 -0
  183. package/runtime/src/iterator.c +409 -0
  184. package/runtime/src/jobs.c +337 -0
  185. package/runtime/src/jsnum.c +353 -0
  186. package/runtime/src/json.c +1028 -0
  187. package/runtime/src/math.c +243 -0
  188. package/runtime/src/module.c +336 -0
  189. package/runtime/src/number.c +176 -0
  190. package/runtime/src/object.c +1265 -0
  191. package/runtime/src/ops.c +322 -0
  192. package/runtime/src/os.c +196 -0
  193. package/runtime/src/os.h +29 -0
  194. package/runtime/src/process.c +432 -0
  195. package/runtime/src/promise.c +721 -0
  196. package/runtime/src/proxy.c +570 -0
  197. package/runtime/src/reflect.c +194 -0
  198. package/runtime/src/regexp.c +1141 -0
  199. package/runtime/src/regexp_anchor.h +34 -0
  200. package/runtime/src/regexp_message.h +32 -0
  201. package/runtime/src/shape.c +294 -0
  202. package/runtime/src/shape.h +46 -0
  203. package/runtime/src/streams.c +1046 -0
  204. package/runtime/src/streams.h +47 -0
  205. package/runtime/src/string.c +364 -0
  206. package/runtime/src/string_builtins.c +837 -0
  207. package/runtime/src/symbol.c +143 -0
  208. package/runtime/src/test_host.c +59 -0
  209. package/runtime/src/typedarray.c +1330 -0
  210. package/runtime/src/tznames.gen.h +712 -0
  211. package/runtime/src/uri.c +169 -0
  212. package/runtime/src/url.c +2116 -0
  213. package/runtime/src/weak.c +486 -0
  214. package/runtime/src/web.c +214 -0
  215. package/runtime/src/wrapper.c +59 -0
  216. package/runtime/src/writable.c +1486 -0
  217. package/runtime/third_party/ada-idna/LICENSE-MIT +18 -0
  218. package/runtime/third_party/ada-idna/README.md +27 -0
  219. package/runtime/third_party/ada-idna/convert.mjs +83 -0
  220. package/runtime/third_party/ada-idna/idna.c +416 -0
  221. package/runtime/third_party/ada-idna/idna.h +15 -0
  222. package/runtime/third_party/ada-idna/idna_tables.h +2657 -0
  223. package/runtime/third_party/bearssl/LICENSE.txt +21 -0
  224. package/runtime/third_party/bearssl/README.txt +136 -0
  225. package/runtime/third_party/bearssl/VERSION +1 -0
  226. package/runtime/third_party/bearssl/inc/bearssl.h +183 -0
  227. package/runtime/third_party/bearssl/inc/bearssl_aead.h +1059 -0
  228. package/runtime/third_party/bearssl/inc/bearssl_block.h +2618 -0
  229. package/runtime/third_party/bearssl/inc/bearssl_ec.h +967 -0
  230. package/runtime/third_party/bearssl/inc/bearssl_hash.h +1346 -0
  231. package/runtime/third_party/bearssl/inc/bearssl_hmac.h +241 -0
  232. package/runtime/third_party/bearssl/inc/bearssl_kdf.h +284 -0
  233. package/runtime/third_party/bearssl/inc/bearssl_pem.h +294 -0
  234. package/runtime/third_party/bearssl/inc/bearssl_prf.h +150 -0
  235. package/runtime/third_party/bearssl/inc/bearssl_rand.h +397 -0
  236. package/runtime/third_party/bearssl/inc/bearssl_rsa.h +1655 -0
  237. package/runtime/third_party/bearssl/inc/bearssl_ssl.h +4296 -0
  238. package/runtime/third_party/bearssl/inc/bearssl_x509.h +1474 -0
  239. package/runtime/third_party/bearssl/src/aead/ccm.c +346 -0
  240. package/runtime/third_party/bearssl/src/aead/eax.c +525 -0
  241. package/runtime/third_party/bearssl/src/aead/gcm.c +318 -0
  242. package/runtime/third_party/bearssl/src/codec/ccopy.c +44 -0
  243. package/runtime/third_party/bearssl/src/codec/dec16be.c +38 -0
  244. package/runtime/third_party/bearssl/src/codec/dec16le.c +38 -0
  245. package/runtime/third_party/bearssl/src/codec/dec32be.c +38 -0
  246. package/runtime/third_party/bearssl/src/codec/dec32le.c +38 -0
  247. package/runtime/third_party/bearssl/src/codec/dec64be.c +38 -0
  248. package/runtime/third_party/bearssl/src/codec/dec64le.c +38 -0
  249. package/runtime/third_party/bearssl/src/codec/enc16be.c +38 -0
  250. package/runtime/third_party/bearssl/src/codec/enc16le.c +38 -0
  251. package/runtime/third_party/bearssl/src/codec/enc32be.c +38 -0
  252. package/runtime/third_party/bearssl/src/codec/enc32le.c +38 -0
  253. package/runtime/third_party/bearssl/src/codec/enc64be.c +38 -0
  254. package/runtime/third_party/bearssl/src/codec/enc64le.c +38 -0
  255. package/runtime/third_party/bearssl/src/codec/pemdec.c +526 -0
  256. package/runtime/third_party/bearssl/src/codec/pemdec.t0 +314 -0
  257. package/runtime/third_party/bearssl/src/codec/pemenc.c +173 -0
  258. package/runtime/third_party/bearssl/src/config.h +247 -0
  259. package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +121 -0
  260. package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +171 -0
  261. package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +398 -0
  262. package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +390 -0
  263. package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +1478 -0
  264. package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +800 -0
  265. package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +605 -0
  266. package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +831 -0
  267. package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +46 -0
  268. package/runtime/third_party/bearssl/src/ec/ec_default.c +36 -0
  269. package/runtime/third_party/bearssl/src/ec/ec_keygen.c +86 -0
  270. package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +2124 -0
  271. package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +1469 -0
  272. package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +1765 -0
  273. package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +1781 -0
  274. package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +824 -0
  275. package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +826 -0
  276. package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +85 -0
  277. package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +51 -0
  278. package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +57 -0
  279. package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +64 -0
  280. package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +134 -0
  281. package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +36 -0
  282. package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +36 -0
  283. package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +36 -0
  284. package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +36 -0
  285. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +47 -0
  286. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +45 -0
  287. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +174 -0
  288. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +48 -0
  289. package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +166 -0
  290. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +47 -0
  291. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +45 -0
  292. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +173 -0
  293. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +48 -0
  294. package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +165 -0
  295. package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +121 -0
  296. package/runtime/third_party/bearssl/src/hash/dig_oid.c +84 -0
  297. package/runtime/third_party/bearssl/src/hash/dig_size.c +50 -0
  298. package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +345 -0
  299. package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +251 -0
  300. package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +154 -0
  301. package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +389 -0
  302. package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +411 -0
  303. package/runtime/third_party/bearssl/src/hash/md5.c +208 -0
  304. package/runtime/third_party/bearssl/src/hash/md5sha1.c +141 -0
  305. package/runtime/third_party/bearssl/src/hash/mgf1.c +56 -0
  306. package/runtime/third_party/bearssl/src/hash/multihash.c +166 -0
  307. package/runtime/third_party/bearssl/src/hash/sha1.c +191 -0
  308. package/runtime/third_party/bearssl/src/hash/sha2big.c +285 -0
  309. package/runtime/third_party/bearssl/src/hash/sha2small.c +341 -0
  310. package/runtime/third_party/bearssl/src/inner.h +2577 -0
  311. package/runtime/third_party/bearssl/src/int/i15_add.c +46 -0
  312. package/runtime/third_party/bearssl/src/int/i15_bitlen.c +44 -0
  313. package/runtime/third_party/bearssl/src/int/i15_decmod.c +124 -0
  314. package/runtime/third_party/bearssl/src/int/i15_decode.c +56 -0
  315. package/runtime/third_party/bearssl/src/int/i15_decred.c +100 -0
  316. package/runtime/third_party/bearssl/src/int/i15_encode.c +56 -0
  317. package/runtime/third_party/bearssl/src/int/i15_fmont.c +59 -0
  318. package/runtime/third_party/bearssl/src/int/i15_iszero.c +39 -0
  319. package/runtime/third_party/bearssl/src/int/i15_moddiv.c +465 -0
  320. package/runtime/third_party/bearssl/src/int/i15_modpow.c +50 -0
  321. package/runtime/third_party/bearssl/src/int/i15_modpow2.c +160 -0
  322. package/runtime/third_party/bearssl/src/int/i15_montmul.c +184 -0
  323. package/runtime/third_party/bearssl/src/int/i15_mulacc.c +61 -0
  324. package/runtime/third_party/bearssl/src/int/i15_muladd.c +173 -0
  325. package/runtime/third_party/bearssl/src/int/i15_ninv15.c +38 -0
  326. package/runtime/third_party/bearssl/src/int/i15_reduce.c +66 -0
  327. package/runtime/third_party/bearssl/src/int/i15_rshift.c +47 -0
  328. package/runtime/third_party/bearssl/src/int/i15_sub.c +46 -0
  329. package/runtime/third_party/bearssl/src/int/i15_tmont.c +36 -0
  330. package/runtime/third_party/bearssl/src/int/i31_add.c +46 -0
  331. package/runtime/third_party/bearssl/src/int/i31_bitlen.c +44 -0
  332. package/runtime/third_party/bearssl/src/int/i31_decmod.c +124 -0
  333. package/runtime/third_party/bearssl/src/int/i31_decode.c +57 -0
  334. package/runtime/third_party/bearssl/src/int/i31_decred.c +103 -0
  335. package/runtime/third_party/bearssl/src/int/i31_encode.c +79 -0
  336. package/runtime/third_party/bearssl/src/int/i31_fmont.c +60 -0
  337. package/runtime/third_party/bearssl/src/int/i31_iszero.c +39 -0
  338. package/runtime/third_party/bearssl/src/int/i31_moddiv.c +488 -0
  339. package/runtime/third_party/bearssl/src/int/i31_modpow.c +65 -0
  340. package/runtime/third_party/bearssl/src/int/i31_modpow2.c +160 -0
  341. package/runtime/third_party/bearssl/src/int/i31_montmul.c +127 -0
  342. package/runtime/third_party/bearssl/src/int/i31_mulacc.c +74 -0
  343. package/runtime/third_party/bearssl/src/int/i31_muladd.c +157 -0
  344. package/runtime/third_party/bearssl/src/int/i31_ninv31.c +39 -0
  345. package/runtime/third_party/bearssl/src/int/i31_reduce.c +66 -0
  346. package/runtime/third_party/bearssl/src/int/i31_rshift.c +47 -0
  347. package/runtime/third_party/bearssl/src/int/i31_sub.c +46 -0
  348. package/runtime/third_party/bearssl/src/int/i31_tmont.c +36 -0
  349. package/runtime/third_party/bearssl/src/int/i32_add.c +51 -0
  350. package/runtime/third_party/bearssl/src/int/i32_bitlen.c +44 -0
  351. package/runtime/third_party/bearssl/src/int/i32_decmod.c +77 -0
  352. package/runtime/third_party/bearssl/src/int/i32_decode.c +63 -0
  353. package/runtime/third_party/bearssl/src/int/i32_decred.c +107 -0
  354. package/runtime/third_party/bearssl/src/int/i32_div32.c +56 -0
  355. package/runtime/third_party/bearssl/src/int/i32_encode.c +72 -0
  356. package/runtime/third_party/bearssl/src/int/i32_fmont.c +60 -0
  357. package/runtime/third_party/bearssl/src/int/i32_iszero.c +39 -0
  358. package/runtime/third_party/bearssl/src/int/i32_modpow.c +65 -0
  359. package/runtime/third_party/bearssl/src/int/i32_montmul.c +69 -0
  360. package/runtime/third_party/bearssl/src/int/i32_mulacc.c +56 -0
  361. package/runtime/third_party/bearssl/src/int/i32_muladd.c +138 -0
  362. package/runtime/third_party/bearssl/src/int/i32_ninv32.c +39 -0
  363. package/runtime/third_party/bearssl/src/int/i32_reduce.c +66 -0
  364. package/runtime/third_party/bearssl/src/int/i32_sub.c +51 -0
  365. package/runtime/third_party/bearssl/src/int/i32_tmont.c +36 -0
  366. package/runtime/third_party/bearssl/src/int/i62_modpow2.c +493 -0
  367. package/runtime/third_party/bearssl/src/kdf/hkdf.c +107 -0
  368. package/runtime/third_party/bearssl/src/kdf/shake.c +590 -0
  369. package/runtime/third_party/bearssl/src/mac/hmac.c +122 -0
  370. package/runtime/third_party/bearssl/src/mac/hmac_ct.c +193 -0
  371. package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +206 -0
  372. package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +157 -0
  373. package/runtime/third_party/bearssl/src/rand/sysrng.c +252 -0
  374. package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +38 -0
  375. package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +36 -0
  376. package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +38 -0
  377. package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +38 -0
  378. package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +38 -0
  379. package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +38 -0
  380. package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +38 -0
  381. package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +36 -0
  382. package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +38 -0
  383. package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +38 -0
  384. package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +38 -0
  385. package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +36 -0
  386. package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +583 -0
  387. package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +99 -0
  388. package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +41 -0
  389. package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +44 -0
  390. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +37 -0
  391. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +43 -0
  392. package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +209 -0
  393. package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +320 -0
  394. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +40 -0
  395. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +44 -0
  396. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +113 -0
  397. package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +152 -0
  398. package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +37 -0
  399. package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +608 -0
  400. package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +99 -0
  401. package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +41 -0
  402. package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +44 -0
  403. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +37 -0
  404. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +43 -0
  405. package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +203 -0
  406. package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +318 -0
  407. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +40 -0
  408. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +44 -0
  409. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +106 -0
  410. package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +152 -0
  411. package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +41 -0
  412. package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +44 -0
  413. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +37 -0
  414. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +43 -0
  415. package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +160 -0
  416. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +40 -0
  417. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +44 -0
  418. package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +77 -0
  419. package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +57 -0
  420. package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +61 -0
  421. package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +64 -0
  422. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +57 -0
  423. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +63 -0
  424. package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +223 -0
  425. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +60 -0
  426. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +64 -0
  427. package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +125 -0
  428. package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +112 -0
  429. package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +145 -0
  430. package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +100 -0
  431. package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +121 -0
  432. package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +106 -0
  433. package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +121 -0
  434. package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +52 -0
  435. package/runtime/third_party/bearssl/src/settings.c +306 -0
  436. package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +69 -0
  437. package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +67 -0
  438. package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +84 -0
  439. package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +142 -0
  440. package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +254 -0
  441. package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +157 -0
  442. package/runtime/third_party/bearssl/src/symcipher/aes_common.c +112 -0
  443. package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +328 -0
  444. package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +398 -0
  445. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +104 -0
  446. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +81 -0
  447. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +114 -0
  448. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +433 -0
  449. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +159 -0
  450. package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +115 -0
  451. package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +111 -0
  452. package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +91 -0
  453. package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +116 -0
  454. package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +422 -0
  455. package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +170 -0
  456. package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +112 -0
  457. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +445 -0
  458. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +670 -0
  459. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +417 -0
  460. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +717 -0
  461. package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +946 -0
  462. package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +69 -0
  463. package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +67 -0
  464. package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +84 -0
  465. package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +142 -0
  466. package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +176 -0
  467. package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +129 -0
  468. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +240 -0
  469. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +223 -0
  470. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +122 -0
  471. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +211 -0
  472. package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +596 -0
  473. package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +106 -0
  474. package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +237 -0
  475. package/runtime/third_party/bearssl/src/symcipher/des_ct.c +411 -0
  476. package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +87 -0
  477. package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +69 -0
  478. package/runtime/third_party/bearssl/src/symcipher/des_support.c +166 -0
  479. package/runtime/third_party/bearssl/src/symcipher/des_tab.c +310 -0
  480. package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +85 -0
  481. package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +67 -0
  482. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +260 -0
  483. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +297 -0
  484. package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +475 -0
  485. package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +221 -0
  486. package/runtime/third_party/bearssl/src/x509/asn1.t0 +757 -0
  487. package/runtime/third_party/bearssl/src/x509/asn1enc.c +93 -0
  488. package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +110 -0
  489. package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +161 -0
  490. package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +97 -0
  491. package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +96 -0
  492. package/runtime/third_party/bearssl/src/x509/skey_decoder.c +653 -0
  493. package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +376 -0
  494. package/runtime/third_party/bearssl/src/x509/x509_decoder.c +776 -0
  495. package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +324 -0
  496. package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +105 -0
  497. package/runtime/third_party/bearssl/src/x509/x509_minimal.c +1722 -0
  498. package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +1526 -0
  499. package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +59 -0
  500. package/runtime/third_party/quickjs-dtoa/LICENSE +22 -0
  501. package/runtime/third_party/quickjs-dtoa/README.md +23 -0
  502. package/runtime/third_party/quickjs-dtoa/dtoa.c +1640 -0
  503. package/runtime/third_party/quickjs-dtoa/dtoa.h +83 -0
  504. package/runtime/third_party/quickjs-dtoa/dtoa_compat.h +89 -0
  505. package/runtime/third_party/quickjs-regexp/LICENSE +22 -0
  506. package/runtime/third_party/quickjs-regexp/README.md +22 -0
  507. package/runtime/third_party/quickjs-regexp/cutils.c +641 -0
  508. package/runtime/third_party/quickjs-regexp/cutils.h +457 -0
  509. package/runtime/third_party/quickjs-regexp/libregexp-opcode.h +73 -0
  510. package/runtime/third_party/quickjs-regexp/libregexp.c +3448 -0
  511. package/runtime/third_party/quickjs-regexp/libregexp.h +65 -0
  512. package/runtime/third_party/quickjs-regexp/libunicode-table.h +5206 -0
  513. package/runtime/third_party/quickjs-regexp/libunicode.c +2124 -0
  514. package/runtime/third_party/quickjs-regexp/libunicode.h +196 -0
  515. package/runtime/third_party/v8-ieee754/LICENSE +61 -0
  516. package/runtime/third_party/v8-ieee754/README.md +22 -0
  517. package/runtime/third_party/v8-ieee754/convert.py +84 -0
  518. package/runtime/third_party/v8-ieee754/ieee754.c +3030 -0
  519. package/runtime/third_party/v8-ieee754/ieee754.h +27 -0
  520. package/runtime/tools/regexp_compile.c +90 -0
@@ -0,0 +1,505 @@
1
+ /* Host primitives for node:os (ADR 0012): the system's facts through libuv, as Node's os module
2
+ * gets them, and the constants (signals and errno numbers) of the platform the program was built
3
+ * for. Failures return -errno, which the prelude turns into Node's SystemError. */
4
+ #define _GNU_SOURCE /* libuv's headers, and every signal and errno name the platform has */
5
+ #include "js_node.h"
6
+
7
+ #include <errno.h>
8
+ #include <signal.h>
9
+ #include <stdlib.h>
10
+ #include <string.h>
11
+
12
+ #include "js_exception.h"
13
+ #include "jsstring.h"
14
+ #include "uv.h"
15
+
16
+ #define PRIMITIVE(fn) \
17
+ JSValue fn(JSContext *ctx, JSValue callee, JSValue this_val, uint32_t argc, const JSValue *argv, JSValue new_target)
18
+ #define UNUSED_PRIMITIVE_ARGS (void)callee, (void)this_val, (void)argc, (void)argv, (void)new_target
19
+
20
+ static JSValue array_of(JSContext *ctx, const JSValue *items, uint32_t n) {
21
+ JSValue a = js_new_array(ctx, n);
22
+ for (uint32_t i = 0; i < n; i++)
23
+ if (js_array_append(ctx, a, items[i]) < 0) return JS_EXCEPTION;
24
+ return a;
25
+ }
26
+
27
+ /* osUname(): [sysname, release, version, machine], or -errno. */
28
+ PRIMITIVE(js_host_os_uname) {
29
+ UNUSED_PRIMITIVE_ARGS;
30
+ uv_utsname_t u;
31
+ int e = uv_os_uname(&u);
32
+ if (e) return js_int32(e);
33
+ JSValue items[4] = { js_new_string_cstr(ctx, u.sysname), js_new_string_cstr(ctx, u.release), js_new_string_cstr(ctx, u.version),
34
+ js_new_string_cstr(ctx, u.machine) };
35
+ return array_of(ctx, items, 4);
36
+ }
37
+
38
+ typedef int (*PathFn)(char *buffer, size_t *size);
39
+
40
+ static JSValue path_result(JSContext *ctx, PathFn fn) {
41
+ char buf[4096];
42
+ size_t n = sizeof buf;
43
+ int e = fn(buf, &n);
44
+ return e ? js_int32(e) : js_new_string_utf8(ctx, buf, n);
45
+ }
46
+
47
+ /* osHostname(), osHomedir(), osTmpdir(): a string, or -errno. */
48
+ PRIMITIVE(js_host_os_hostname) {
49
+ UNUSED_PRIMITIVE_ARGS;
50
+ return path_result(ctx, uv_os_gethostname);
51
+ }
52
+
53
+ PRIMITIVE(js_host_os_homedir) {
54
+ UNUSED_PRIMITIVE_ARGS;
55
+ return path_result(ctx, uv_os_homedir);
56
+ }
57
+
58
+ PRIMITIVE(js_host_os_tmpdir) {
59
+ UNUSED_PRIMITIVE_ARGS;
60
+ return path_result(ctx, uv_os_tmpdir);
61
+ }
62
+
63
+ /* osMemory(): [total, free] in bytes. */
64
+ PRIMITIVE(js_host_os_memory) {
65
+ UNUSED_PRIMITIVE_ARGS;
66
+ JSValue items[2] = { js_number((double)uv_get_total_memory()), js_number((double)uv_get_free_memory()) };
67
+ return array_of(ctx, items, 2);
68
+ }
69
+
70
+ /* osUptime(): seconds, or -errno. */
71
+ PRIMITIVE(js_host_os_uptime) {
72
+ UNUSED_PRIMITIVE_ARGS;
73
+ double up;
74
+ int e = uv_uptime(&up);
75
+ return e ? js_int32(e) : js_number(up);
76
+ }
77
+
78
+ /* osLoadavg(): [1, 5, 15 minutes]. */
79
+ PRIMITIVE(js_host_os_loadavg) {
80
+ UNUSED_PRIMITIVE_ARGS;
81
+ double avg[3];
82
+ uv_loadavg(avg);
83
+ JSValue items[3] = { js_number(avg[0]), js_number(avg[1]), js_number(avg[2]) };
84
+ return array_of(ctx, items, 3);
85
+ }
86
+
87
+ /* osParallelism(): os.availableParallelism(). */
88
+ PRIMITIVE(js_host_os_parallelism) {
89
+ UNUSED_PRIMITIVE_ARGS;
90
+ (void)ctx;
91
+ return js_number((double)uv_available_parallelism());
92
+ }
93
+
94
+ /* osCpus(): [model, speed, user, nice, sys, idle, irq] for each CPU (times in ms), or -errno. */
95
+ PRIMITIVE(js_host_os_cpus) {
96
+ UNUSED_PRIMITIVE_ARGS;
97
+ uv_cpu_info_t *cpus;
98
+ int count;
99
+ int e = uv_cpu_info(&cpus, &count);
100
+ if (e) return js_int32(e);
101
+ JSValue out = js_new_array(ctx, (uint32_t)count);
102
+ for (int i = 0; i < count; i++) {
103
+ uv_cpu_info_t *c = &cpus[i];
104
+ JSValue items[7] = { js_new_string_cstr(ctx, c->model), js_number(c->speed), js_number((double)c->cpu_times.user),
105
+ js_number((double)c->cpu_times.nice), js_number((double)c->cpu_times.sys),
106
+ js_number((double)c->cpu_times.idle), js_number((double)c->cpu_times.irq) };
107
+ JSValue cpu = array_of(ctx, items, 7);
108
+ if (js_is_exception(cpu) || js_array_append(ctx, out, cpu) < 0) {
109
+ uv_free_cpu_info(cpus, count);
110
+ return JS_EXCEPTION;
111
+ }
112
+ }
113
+ uv_free_cpu_info(cpus, count);
114
+ return out;
115
+ }
116
+
117
+ /* osUserInfo(): [uid, gid, username, homedir, shell] (shell null when there is none), or -errno. */
118
+ PRIMITIVE(js_host_os_user_info) {
119
+ UNUSED_PRIMITIVE_ARGS;
120
+ uv_passwd_t pw;
121
+ int e = uv_os_get_passwd(&pw);
122
+ if (e) return js_int32(e);
123
+ JSValue items[5] = { js_number((double)pw.uid), js_number((double)pw.gid), js_new_string_cstr(ctx, pw.username),
124
+ js_new_string_cstr(ctx, pw.homedir), pw.shell ? js_new_string_cstr(ctx, pw.shell) : JS_NULL };
125
+ uv_os_free_passwd(&pw);
126
+ return array_of(ctx, items, 5);
127
+ }
128
+
129
+ /* The platform's numbers, as Node's node_constants.cc lists them */
130
+ static const struct { const char *name; int value; } SIGNALS[] = {
131
+ #ifdef SIGHUP
132
+ { "SIGHUP", SIGHUP },
133
+ #endif
134
+ #ifdef SIGINT
135
+ { "SIGINT", SIGINT },
136
+ #endif
137
+ #ifdef SIGQUIT
138
+ { "SIGQUIT", SIGQUIT },
139
+ #endif
140
+ #ifdef SIGILL
141
+ { "SIGILL", SIGILL },
142
+ #endif
143
+ #ifdef SIGTRAP
144
+ { "SIGTRAP", SIGTRAP },
145
+ #endif
146
+ #ifdef SIGABRT
147
+ { "SIGABRT", SIGABRT },
148
+ #endif
149
+ #ifdef SIGIOT
150
+ { "SIGIOT", SIGIOT },
151
+ #endif
152
+ #ifdef SIGBUS
153
+ { "SIGBUS", SIGBUS },
154
+ #endif
155
+ #ifdef SIGFPE
156
+ { "SIGFPE", SIGFPE },
157
+ #endif
158
+ #ifdef SIGKILL
159
+ { "SIGKILL", SIGKILL },
160
+ #endif
161
+ #ifdef SIGUSR1
162
+ { "SIGUSR1", SIGUSR1 },
163
+ #endif
164
+ #ifdef SIGSEGV
165
+ { "SIGSEGV", SIGSEGV },
166
+ #endif
167
+ #ifdef SIGUSR2
168
+ { "SIGUSR2", SIGUSR2 },
169
+ #endif
170
+ #ifdef SIGPIPE
171
+ { "SIGPIPE", SIGPIPE },
172
+ #endif
173
+ #ifdef SIGALRM
174
+ { "SIGALRM", SIGALRM },
175
+ #endif
176
+ #ifdef SIGTERM
177
+ { "SIGTERM", SIGTERM },
178
+ #endif
179
+ #ifdef SIGCHLD
180
+ { "SIGCHLD", SIGCHLD },
181
+ #endif
182
+ #ifdef SIGSTKFLT
183
+ { "SIGSTKFLT", SIGSTKFLT },
184
+ #endif
185
+ #ifdef SIGCONT
186
+ { "SIGCONT", SIGCONT },
187
+ #endif
188
+ #ifdef SIGSTOP
189
+ { "SIGSTOP", SIGSTOP },
190
+ #endif
191
+ #ifdef SIGTSTP
192
+ { "SIGTSTP", SIGTSTP },
193
+ #endif
194
+ #ifdef SIGBREAK
195
+ { "SIGBREAK", SIGBREAK },
196
+ #endif
197
+ #ifdef SIGTTIN
198
+ { "SIGTTIN", SIGTTIN },
199
+ #endif
200
+ #ifdef SIGTTOU
201
+ { "SIGTTOU", SIGTTOU },
202
+ #endif
203
+ #ifdef SIGURG
204
+ { "SIGURG", SIGURG },
205
+ #endif
206
+ #ifdef SIGXCPU
207
+ { "SIGXCPU", SIGXCPU },
208
+ #endif
209
+ #ifdef SIGXFSZ
210
+ { "SIGXFSZ", SIGXFSZ },
211
+ #endif
212
+ #ifdef SIGVTALRM
213
+ { "SIGVTALRM", SIGVTALRM },
214
+ #endif
215
+ #ifdef SIGPROF
216
+ { "SIGPROF", SIGPROF },
217
+ #endif
218
+ #ifdef SIGWINCH
219
+ { "SIGWINCH", SIGWINCH },
220
+ #endif
221
+ #ifdef SIGIO
222
+ { "SIGIO", SIGIO },
223
+ #endif
224
+ #ifdef SIGPOLL
225
+ { "SIGPOLL", SIGPOLL },
226
+ #endif
227
+ #ifdef SIGLOST
228
+ { "SIGLOST", SIGLOST },
229
+ #endif
230
+ #ifdef SIGPWR
231
+ { "SIGPWR", SIGPWR },
232
+ #endif
233
+ #ifdef SIGINFO
234
+ { "SIGINFO", SIGINFO },
235
+ #endif
236
+ #ifdef SIGSYS
237
+ { "SIGSYS", SIGSYS },
238
+ #endif
239
+ #ifdef SIGUNUSED
240
+ { "SIGUNUSED", SIGUNUSED },
241
+ #endif
242
+ };
243
+
244
+ static const struct { const char *name; int value; } ERRNOS[] = {
245
+ #ifdef E2BIG
246
+ { "E2BIG", E2BIG },
247
+ #endif
248
+ #ifdef EACCES
249
+ { "EACCES", EACCES },
250
+ #endif
251
+ #ifdef EADDRINUSE
252
+ { "EADDRINUSE", EADDRINUSE },
253
+ #endif
254
+ #ifdef EADDRNOTAVAIL
255
+ { "EADDRNOTAVAIL", EADDRNOTAVAIL },
256
+ #endif
257
+ #ifdef EAFNOSUPPORT
258
+ { "EAFNOSUPPORT", EAFNOSUPPORT },
259
+ #endif
260
+ #ifdef EAGAIN
261
+ { "EAGAIN", EAGAIN },
262
+ #endif
263
+ #ifdef EALREADY
264
+ { "EALREADY", EALREADY },
265
+ #endif
266
+ #ifdef EBADF
267
+ { "EBADF", EBADF },
268
+ #endif
269
+ #ifdef EBADMSG
270
+ { "EBADMSG", EBADMSG },
271
+ #endif
272
+ #ifdef EBUSY
273
+ { "EBUSY", EBUSY },
274
+ #endif
275
+ #ifdef ECANCELED
276
+ { "ECANCELED", ECANCELED },
277
+ #endif
278
+ #ifdef ECHILD
279
+ { "ECHILD", ECHILD },
280
+ #endif
281
+ #ifdef ECONNABORTED
282
+ { "ECONNABORTED", ECONNABORTED },
283
+ #endif
284
+ #ifdef ECONNREFUSED
285
+ { "ECONNREFUSED", ECONNREFUSED },
286
+ #endif
287
+ #ifdef ECONNRESET
288
+ { "ECONNRESET", ECONNRESET },
289
+ #endif
290
+ #ifdef EDEADLK
291
+ { "EDEADLK", EDEADLK },
292
+ #endif
293
+ #ifdef EDESTADDRREQ
294
+ { "EDESTADDRREQ", EDESTADDRREQ },
295
+ #endif
296
+ #ifdef EDOM
297
+ { "EDOM", EDOM },
298
+ #endif
299
+ #ifdef EDQUOT
300
+ { "EDQUOT", EDQUOT },
301
+ #endif
302
+ #ifdef EEXIST
303
+ { "EEXIST", EEXIST },
304
+ #endif
305
+ #ifdef EFAULT
306
+ { "EFAULT", EFAULT },
307
+ #endif
308
+ #ifdef EFBIG
309
+ { "EFBIG", EFBIG },
310
+ #endif
311
+ #ifdef EHOSTUNREACH
312
+ { "EHOSTUNREACH", EHOSTUNREACH },
313
+ #endif
314
+ #ifdef EIDRM
315
+ { "EIDRM", EIDRM },
316
+ #endif
317
+ #ifdef EILSEQ
318
+ { "EILSEQ", EILSEQ },
319
+ #endif
320
+ #ifdef EINPROGRESS
321
+ { "EINPROGRESS", EINPROGRESS },
322
+ #endif
323
+ #ifdef EINTR
324
+ { "EINTR", EINTR },
325
+ #endif
326
+ #ifdef EINVAL
327
+ { "EINVAL", EINVAL },
328
+ #endif
329
+ #ifdef EIO
330
+ { "EIO", EIO },
331
+ #endif
332
+ #ifdef EISCONN
333
+ { "EISCONN", EISCONN },
334
+ #endif
335
+ #ifdef EISDIR
336
+ { "EISDIR", EISDIR },
337
+ #endif
338
+ #ifdef ELOOP
339
+ { "ELOOP", ELOOP },
340
+ #endif
341
+ #ifdef EMFILE
342
+ { "EMFILE", EMFILE },
343
+ #endif
344
+ #ifdef EMLINK
345
+ { "EMLINK", EMLINK },
346
+ #endif
347
+ #ifdef EMSGSIZE
348
+ { "EMSGSIZE", EMSGSIZE },
349
+ #endif
350
+ #ifdef EMULTIHOP
351
+ { "EMULTIHOP", EMULTIHOP },
352
+ #endif
353
+ #ifdef ENAMETOOLONG
354
+ { "ENAMETOOLONG", ENAMETOOLONG },
355
+ #endif
356
+ #ifdef ENETDOWN
357
+ { "ENETDOWN", ENETDOWN },
358
+ #endif
359
+ #ifdef ENETRESET
360
+ { "ENETRESET", ENETRESET },
361
+ #endif
362
+ #ifdef ENETUNREACH
363
+ { "ENETUNREACH", ENETUNREACH },
364
+ #endif
365
+ #ifdef ENFILE
366
+ { "ENFILE", ENFILE },
367
+ #endif
368
+ #ifdef ENOBUFS
369
+ { "ENOBUFS", ENOBUFS },
370
+ #endif
371
+ #ifdef ENODATA
372
+ { "ENODATA", ENODATA },
373
+ #endif
374
+ #ifdef ENODEV
375
+ { "ENODEV", ENODEV },
376
+ #endif
377
+ #ifdef ENOENT
378
+ { "ENOENT", ENOENT },
379
+ #endif
380
+ #ifdef ENOEXEC
381
+ { "ENOEXEC", ENOEXEC },
382
+ #endif
383
+ #ifdef ENOLCK
384
+ { "ENOLCK", ENOLCK },
385
+ #endif
386
+ #ifdef ENOLINK
387
+ { "ENOLINK", ENOLINK },
388
+ #endif
389
+ #ifdef ENOMEM
390
+ { "ENOMEM", ENOMEM },
391
+ #endif
392
+ #ifdef ENOMSG
393
+ { "ENOMSG", ENOMSG },
394
+ #endif
395
+ #ifdef ENOPROTOOPT
396
+ { "ENOPROTOOPT", ENOPROTOOPT },
397
+ #endif
398
+ #ifdef ENOSPC
399
+ { "ENOSPC", ENOSPC },
400
+ #endif
401
+ #ifdef ENOSR
402
+ { "ENOSR", ENOSR },
403
+ #endif
404
+ #ifdef ENOSTR
405
+ { "ENOSTR", ENOSTR },
406
+ #endif
407
+ #ifdef ENOSYS
408
+ { "ENOSYS", ENOSYS },
409
+ #endif
410
+ #ifdef ENOTCONN
411
+ { "ENOTCONN", ENOTCONN },
412
+ #endif
413
+ #ifdef ENOTDIR
414
+ { "ENOTDIR", ENOTDIR },
415
+ #endif
416
+ #ifdef ENOTEMPTY
417
+ { "ENOTEMPTY", ENOTEMPTY },
418
+ #endif
419
+ #ifdef ENOTSOCK
420
+ { "ENOTSOCK", ENOTSOCK },
421
+ #endif
422
+ #ifdef ENOTSUP
423
+ { "ENOTSUP", ENOTSUP },
424
+ #endif
425
+ #ifdef ENOTTY
426
+ { "ENOTTY", ENOTTY },
427
+ #endif
428
+ #ifdef ENXIO
429
+ { "ENXIO", ENXIO },
430
+ #endif
431
+ #ifdef EOPNOTSUPP
432
+ { "EOPNOTSUPP", EOPNOTSUPP },
433
+ #endif
434
+ #ifdef EOVERFLOW
435
+ { "EOVERFLOW", EOVERFLOW },
436
+ #endif
437
+ #ifdef EPERM
438
+ { "EPERM", EPERM },
439
+ #endif
440
+ #ifdef EPIPE
441
+ { "EPIPE", EPIPE },
442
+ #endif
443
+ #ifdef EPROTO
444
+ { "EPROTO", EPROTO },
445
+ #endif
446
+ #ifdef EPROTONOSUPPORT
447
+ { "EPROTONOSUPPORT", EPROTONOSUPPORT },
448
+ #endif
449
+ #ifdef EPROTOTYPE
450
+ { "EPROTOTYPE", EPROTOTYPE },
451
+ #endif
452
+ #ifdef ERANGE
453
+ { "ERANGE", ERANGE },
454
+ #endif
455
+ #ifdef EROFS
456
+ { "EROFS", EROFS },
457
+ #endif
458
+ #ifdef ESPIPE
459
+ { "ESPIPE", ESPIPE },
460
+ #endif
461
+ #ifdef ESRCH
462
+ { "ESRCH", ESRCH },
463
+ #endif
464
+ #ifdef ESTALE
465
+ { "ESTALE", ESTALE },
466
+ #endif
467
+ #ifdef ETIME
468
+ { "ETIME", ETIME },
469
+ #endif
470
+ #ifdef ETIMEDOUT
471
+ { "ETIMEDOUT", ETIMEDOUT },
472
+ #endif
473
+ #ifdef ETXTBSY
474
+ { "ETXTBSY", ETXTBSY },
475
+ #endif
476
+ #ifdef EWOULDBLOCK
477
+ { "EWOULDBLOCK", EWOULDBLOCK },
478
+ #endif
479
+ #ifdef EXDEV
480
+ { "EXDEV", EXDEV },
481
+ #endif
482
+ };
483
+
484
+ static JSValue table(JSContext *ctx, const char *const *names, const int *values, size_t n) {
485
+ (void)names, (void)values;
486
+ JSValue a = js_new_array(ctx, (uint32_t)(2 * n));
487
+ for (size_t i = 0; i < n; i++)
488
+ if (js_array_append(ctx, a, js_new_string_cstr(ctx, names[i])) < 0 || js_array_append(ctx, a, js_int32(values[i])) < 0)
489
+ return JS_EXCEPTION;
490
+ return a;
491
+ }
492
+
493
+ /* osConstants(): [signals, errno], each a flat [name, number, name, number, …]. */
494
+ PRIMITIVE(js_host_os_constants) {
495
+ UNUSED_PRIMITIVE_ARGS;
496
+ const size_t ns = sizeof SIGNALS / sizeof SIGNALS[0], ne = sizeof ERRNOS / sizeof ERRNOS[0];
497
+ const char *names[128];
498
+ int values[128];
499
+ for (size_t i = 0; i < ns; i++) names[i] = SIGNALS[i].name, values[i] = SIGNALS[i].value;
500
+ JSValue s = table(ctx, names, values, ns);
501
+ for (size_t i = 0; i < ne; i++) names[i] = ERRNOS[i].name, values[i] = ERRNOS[i].value;
502
+ JSValue e = table(ctx, names, values, ne);
503
+ JSValue items[2] = { s, e };
504
+ return array_of(ctx, items, 2);
505
+ }
@@ -0,0 +1,78 @@
1
+ /* Host primitives shared by the prelude modules (ADR 0012): error names and messages for
2
+ * -errno results, as libuv words them (Node's err.code and message). The working directory
3
+ * (cwd) is the runtime's, for process.cwd(). */
4
+ #include "js_node.h"
5
+
6
+ #include <errno.h>
7
+ #include <stdlib.h>
8
+ #include <string.h>
9
+ #ifdef _WIN32
10
+ #include <io.h>
11
+ #else
12
+ #include <unistd.h>
13
+ #endif
14
+
15
+ #include "js_exception.h"
16
+ #include "jsstring.h"
17
+
18
+ static const struct { int code; const char *name, *message; } ERRORS[] = {
19
+ { EPERM, "EPERM", "operation not permitted" },
20
+ { ENOENT, "ENOENT", "no such file or directory" },
21
+ { EIO, "EIO", "i/o error" },
22
+ { EBADF, "EBADF", "bad file descriptor" },
23
+ { EACCES, "EACCES", "permission denied" },
24
+ { EBUSY, "EBUSY", "resource busy or locked" },
25
+ { EEXIST, "EEXIST", "file already exists" },
26
+ { ENOTDIR, "ENOTDIR", "not a directory" },
27
+ { EISDIR, "EISDIR", "illegal operation on a directory" },
28
+ { EINVAL, "EINVAL", "invalid argument" },
29
+ { EMFILE, "EMFILE", "too many open files" },
30
+ { EFBIG, "EFBIG", "file too large" },
31
+ { ENOSPC, "ENOSPC", "no space left on device" },
32
+ { EROFS, "EROFS", "read-only file system" },
33
+ { ENAMETOOLONG, "ENAMETOOLONG", "name too long" },
34
+ { ENOTEMPTY, "ENOTEMPTY", "directory not empty" },
35
+ { ELOOP, "ELOOP", "too many symbolic links encountered" },
36
+ { EADDRINUSE, "EADDRINUSE", "address already in use" },
37
+ { EADDRNOTAVAIL, "EADDRNOTAVAIL", "address not available" },
38
+ { ECONNRESET, "ECONNRESET", "connection reset by peer" },
39
+ { ECONNREFUSED, "ECONNREFUSED", "connection refused" },
40
+ { EPIPE, "EPIPE", "broken pipe" },
41
+ { EAFNOSUPPORT, "EAFNOSUPPORT", "address family not supported" },
42
+ };
43
+
44
+ static int errno_arg(uint32_t argc, const JSValue *argv) {
45
+ return argc > 0 && js_is_int32(argv[0]) ? -js_as_int32(argv[0]) : 0;
46
+ }
47
+
48
+ /* errnoName(-errno): "ENOENT", or "UNKNOWN". */
49
+ JSValue js_host_errno_name(JSContext *ctx, JSValue callee, JSValue this_val, uint32_t argc,
50
+ const JSValue *argv, JSValue new_target) {
51
+ (void)callee, (void)this_val, (void)new_target;
52
+ int e = errno_arg(argc, argv);
53
+ for (size_t i = 0; i < sizeof ERRORS / sizeof ERRORS[0]; i++)
54
+ if (ERRORS[i].code == e) return js_new_string_cstr(ctx, ERRORS[i].name);
55
+ return js_new_string_cstr(ctx, "UNKNOWN");
56
+ }
57
+
58
+ /* errnoMessage(-errno): "no such file or directory", or "unknown error". */
59
+ JSValue js_host_errno_message(JSContext *ctx, JSValue callee, JSValue this_val, uint32_t argc,
60
+ const JSValue *argv, JSValue new_target) {
61
+ (void)callee, (void)this_val, (void)new_target;
62
+ int e = errno_arg(argc, argv);
63
+ for (size_t i = 0; i < sizeof ERRORS / sizeof ERRORS[0]; i++)
64
+ if (ERRORS[i].code == e) return js_new_string_cstr(ctx, ERRORS[i].message);
65
+ return js_new_string_cstr(ctx, "unknown error");
66
+ }
67
+
68
+ /* ttyIsatty(fd): whether the descriptor is a terminal (node:tty's isatty). */
69
+ JSValue js_host_tty_isatty(JSContext *ctx, JSValue callee, JSValue this_val, uint32_t argc, const JSValue *argv,
70
+ JSValue new_target) {
71
+ (void)ctx, (void)callee, (void)this_val, (void)new_target;
72
+ if (argc < 1 || !js_is_int32(argv[0])) return JS_FALSE;
73
+ #ifdef _WIN32
74
+ return js_bool(_isatty(js_as_int32(argv[0])) != 0);
75
+ #else
76
+ return js_bool(isatty(js_as_int32(argv[0])) == 1);
77
+ #endif
78
+ }
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2015-present libuv project contributors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
@@ -0,0 +1,32 @@
1
+ /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to
5
+ * deal in the Software without restriction, including without limitation the
6
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ * sell copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ * IN THE SOFTWARE.
20
+ */
21
+
22
+ #ifndef UV_AIX_H
23
+ #define UV_AIX_H
24
+
25
+ #define UV_PLATFORM_LOOP_FIELDS \
26
+ int fs_fd; \
27
+
28
+ #define UV_PLATFORM_FS_EVENT_FIELDS \
29
+ uv__io_t event_watcher; \
30
+ char *dir_filename; \
31
+
32
+ #endif /* UV_AIX_H */
@@ -0,0 +1,34 @@
1
+ /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to
5
+ * deal in the Software without restriction, including without limitation the
6
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ * sell copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ * IN THE SOFTWARE.
20
+ */
21
+
22
+ #ifndef UV_BSD_H
23
+ #define UV_BSD_H
24
+
25
+ #define UV_PLATFORM_FS_EVENT_FIELDS \
26
+ uv__io_t event_watcher; \
27
+
28
+ #define UV_IO_PRIVATE_PLATFORM_FIELDS \
29
+ int rcount; \
30
+ int wcount; \
31
+
32
+ #define UV_HAVE_KQUEUE 1
33
+
34
+ #endif /* UV_BSD_H */