@blazetrails/ruby-compat 0.0.0-stage → 0.1.0-alpha0.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 (625) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +6 -0
  3. package/README.md +440 -2
  4. package/dist/argument-error.d.ts +15 -0
  5. package/dist/argument-error.js +15 -0
  6. package/dist/argument-error.js.map +1 -0
  7. package/dist/array.d.ts +415 -0
  8. package/dist/array.js +1330 -0
  9. package/dist/array.js.map +1 -0
  10. package/dist/async-context-adapter.d.ts +19 -0
  11. package/dist/async-context-adapter.js +139 -0
  12. package/dist/async-context-adapter.js.map +1 -0
  13. package/dist/backtrace-location.d.ts +78 -0
  14. package/dist/backtrace-location.js +158 -0
  15. package/dist/backtrace-location.js.map +1 -0
  16. package/dist/base64.d.ts +73 -0
  17. package/dist/base64.js +164 -0
  18. package/dist/base64.js.map +1 -0
  19. package/dist/benchmark.d.ts +19 -0
  20. package/dist/benchmark.js +16 -0
  21. package/dist/benchmark.js.map +1 -0
  22. package/dist/big-decimal.d.ts +111 -0
  23. package/dist/big-decimal.js +584 -0
  24. package/dist/big-decimal.js.map +1 -0
  25. package/dist/bundler.d.ts +44 -0
  26. package/dist/bundler.js +97 -0
  27. package/dist/bundler.js.map +1 -0
  28. package/dist/cgi.d.ts +89 -0
  29. package/dist/cgi.js +168 -0
  30. package/dist/cgi.js.map +1 -0
  31. package/dist/child-process-adapter.d.ts +110 -0
  32. package/dist/child-process-adapter.js +272 -0
  33. package/dist/child-process-adapter.js.map +1 -0
  34. package/dist/class-module.d.ts +10 -0
  35. package/dist/class-module.js +10 -0
  36. package/dist/class-module.js.map +1 -0
  37. package/dist/classpath.d.ts +93 -0
  38. package/dist/classpath.js +210 -0
  39. package/dist/classpath.js.map +1 -0
  40. package/dist/closed-queue-error.d.ts +10 -0
  41. package/dist/closed-queue-error.js +10 -0
  42. package/dist/closed-queue-error.js.map +1 -0
  43. package/dist/comparable.d.ts +127 -0
  44. package/dist/comparable.js +376 -0
  45. package/dist/comparable.js.map +1 -0
  46. package/dist/complex.d.ts +49 -0
  47. package/dist/complex.js +164 -0
  48. package/dist/complex.js.map +1 -0
  49. package/dist/concurrent/atomic-boolean.d.ts +24 -0
  50. package/dist/concurrent/atomic-boolean.js +43 -0
  51. package/dist/concurrent/atomic-boolean.js.map +1 -0
  52. package/dist/concurrent/atomic-fixnum.d.ts +21 -0
  53. package/dist/concurrent/atomic-fixnum.js +35 -0
  54. package/dist/concurrent/atomic-fixnum.js.map +1 -0
  55. package/dist/concurrent/count-down-latch.d.ts +20 -0
  56. package/dist/concurrent/count-down-latch.js +50 -0
  57. package/dist/concurrent/count-down-latch.js.map +1 -0
  58. package/dist/concurrent/cyclic-barrier.d.ts +18 -0
  59. package/dist/concurrent/cyclic-barrier.js +50 -0
  60. package/dist/concurrent/cyclic-barrier.js.map +1 -0
  61. package/dist/concurrent/event.d.ts +19 -0
  62. package/dist/concurrent/event.js +31 -0
  63. package/dist/concurrent/event.js.map +1 -0
  64. package/dist/concurrent/map.d.ts +149 -0
  65. package/dist/concurrent/map.js +202 -0
  66. package/dist/concurrent/map.js.map +1 -0
  67. package/dist/concurrent/read-write-lock.d.ts +25 -0
  68. package/dist/concurrent/read-write-lock.js +70 -0
  69. package/dist/concurrent/read-write-lock.js.map +1 -0
  70. package/dist/concurrent/semaphore.d.ts +24 -0
  71. package/dist/concurrent/semaphore.js +74 -0
  72. package/dist/concurrent/semaphore.js.map +1 -0
  73. package/dist/concurrent/timer-task.d.ts +52 -0
  74. package/dist/concurrent/timer-task.js +112 -0
  75. package/dist/concurrent/timer-task.js.map +1 -0
  76. package/dist/constants.generated.d.ts +2 -0
  77. package/dist/constants.generated.js +64 -0
  78. package/dist/constants.generated.js.map +1 -0
  79. package/dist/converter-not-found-error.d.ts +14 -0
  80. package/dist/converter-not-found-error.js +14 -0
  81. package/dist/converter-not-found-error.js.map +1 -0
  82. package/dist/crypto-adapter.d.ts +64 -0
  83. package/dist/crypto-adapter.js +365 -0
  84. package/dist/crypto-adapter.js.map +1 -0
  85. package/dist/delegate.d.ts +156 -0
  86. package/dist/delegate.js +306 -0
  87. package/dist/delegate.js.map +1 -0
  88. package/dist/digest.d.ts +99 -0
  89. package/dist/digest.js +131 -0
  90. package/dist/digest.js.map +1 -0
  91. package/dist/dir.d.ts +225 -0
  92. package/dist/dir.js +608 -0
  93. package/dist/dir.js.map +1 -0
  94. package/dist/encoding-error.d.ts +14 -0
  95. package/dist/encoding-error.js +17 -0
  96. package/dist/encoding-error.js.map +1 -0
  97. package/dist/encoding.d.ts +121 -0
  98. package/dist/encoding.js +306 -0
  99. package/dist/encoding.js.map +1 -0
  100. package/dist/ensure.d.ts +15 -0
  101. package/dist/ensure.js +35 -0
  102. package/dist/ensure.js.map +1 -0
  103. package/dist/enumerable.d.ts +375 -0
  104. package/dist/enumerable.js +1102 -0
  105. package/dist/enumerable.js.map +1 -0
  106. package/dist/enumerator.d.ts +324 -0
  107. package/dist/enumerator.js +625 -0
  108. package/dist/enumerator.js.map +1 -0
  109. package/dist/eof-error.d.ts +14 -0
  110. package/dist/eof-error.js +14 -0
  111. package/dist/eof-error.js.map +1 -0
  112. package/dist/errno.d.ts +447 -0
  113. package/dist/errno.js +616 -0
  114. package/dist/errno.js.map +1 -0
  115. package/dist/exc-detailed-message.d.ts +15 -0
  116. package/dist/exc-detailed-message.js +106 -0
  117. package/dist/exc-detailed-message.js.map +1 -0
  118. package/dist/exc-to-s.d.ts +10 -0
  119. package/dist/exc-to-s.js +21 -0
  120. package/dist/exc-to-s.js.map +1 -0
  121. package/dist/exception.d.ts +44 -0
  122. package/dist/exception.js +115 -0
  123. package/dist/exception.js.map +1 -0
  124. package/dist/fiber-error.d.ts +12 -0
  125. package/dist/fiber-error.js +12 -0
  126. package/dist/fiber-error.js.map +1 -0
  127. package/dist/fiber.d.ts +51 -0
  128. package/dist/fiber.js +178 -0
  129. package/dist/fiber.js.map +1 -0
  130. package/dist/file-utils.d.ts +480 -0
  131. package/dist/file-utils.js +1824 -0
  132. package/dist/file-utils.js.map +1 -0
  133. package/dist/file.d.ts +643 -0
  134. package/dist/file.js +1334 -0
  135. package/dist/file.js.map +1 -0
  136. package/dist/float-domain-error.d.ts +17 -0
  137. package/dist/float-domain-error.js +17 -0
  138. package/dist/float-domain-error.js.map +1 -0
  139. package/dist/fork-children.d.ts +23 -0
  140. package/dist/fork-children.js +32 -0
  141. package/dist/fork-children.js.map +1 -0
  142. package/dist/frozen-error.d.ts +33 -0
  143. package/dist/frozen-error.js +41 -0
  144. package/dist/frozen-error.js.map +1 -0
  145. package/dist/fs-adapter.d.ts +158 -0
  146. package/dist/fs-adapter.js +253 -0
  147. package/dist/fs-adapter.js.map +1 -0
  148. package/dist/gem/deprecate.d.ts +10 -0
  149. package/dist/gem/deprecate.js +8 -0
  150. package/dist/gem/deprecate.js.map +1 -0
  151. package/dist/gem/requirement.d.ts +55 -0
  152. package/dist/gem/requirement.js +91 -0
  153. package/dist/gem/requirement.js.map +1 -0
  154. package/dist/gem/version.d.ts +50 -0
  155. package/dist/gem/version.js +148 -0
  156. package/dist/gem/version.js.map +1 -0
  157. package/dist/gem.d.ts +59 -0
  158. package/dist/gem.js +82 -0
  159. package/dist/gem.js.map +1 -0
  160. package/dist/hash.d.ts +967 -0
  161. package/dist/hash.js +1572 -0
  162. package/dist/hash.js.map +1 -0
  163. package/dist/http-adapter.d.ts +124 -0
  164. package/dist/http-adapter.js +220 -0
  165. package/dist/http-adapter.js.map +1 -0
  166. package/dist/immediate-executor.d.ts +20 -0
  167. package/dist/immediate-executor.js +39 -0
  168. package/dist/immediate-executor.js.map +1 -0
  169. package/dist/include.d.ts +778 -0
  170. package/dist/include.js +2208 -0
  171. package/dist/include.js.map +1 -0
  172. package/dist/index-error.d.ts +13 -0
  173. package/dist/index-error.js +13 -0
  174. package/dist/index-error.js.map +1 -0
  175. package/dist/index.d.ts +174 -0
  176. package/dist/index.js +166 -0
  177. package/dist/index.js.map +1 -0
  178. package/dist/invalid-byte-sequence-error.d.ts +62 -0
  179. package/dist/invalid-byte-sequence-error.js +75 -0
  180. package/dist/invalid-byte-sequence-error.js.map +1 -0
  181. package/dist/io-error.d.ts +14 -0
  182. package/dist/io-error.js +17 -0
  183. package/dist/io-error.js.map +1 -0
  184. package/dist/io.d.ts +867 -0
  185. package/dist/io.js +1960 -0
  186. package/dist/io.js.map +1 -0
  187. package/dist/ipaddr.d.ts +79 -0
  188. package/dist/ipaddr.js +405 -0
  189. package/dist/ipaddr.js.map +1 -0
  190. package/dist/json.d.ts +70 -0
  191. package/dist/json.js +181 -0
  192. package/dist/json.js.map +1 -0
  193. package/dist/kernel-catch.d.ts +59 -0
  194. package/dist/kernel-catch.js +184 -0
  195. package/dist/kernel-catch.js.map +1 -0
  196. package/dist/kernel-float.d.ts +19 -0
  197. package/dist/kernel-float.js +54 -0
  198. package/dist/kernel-float.js.map +1 -0
  199. package/dist/kernel-fork.d.ts +30 -0
  200. package/dist/kernel-fork.js +72 -0
  201. package/dist/kernel-fork.js.map +1 -0
  202. package/dist/kernel-format.d.ts +27 -0
  203. package/dist/kernel-format.js +901 -0
  204. package/dist/kernel-format.js.map +1 -0
  205. package/dist/kernel-hash.d.ts +7 -0
  206. package/dist/kernel-hash.js +33 -0
  207. package/dist/kernel-hash.js.map +1 -0
  208. package/dist/kernel-integer.d.ts +49 -0
  209. package/dist/kernel-integer.js +170 -0
  210. package/dist/kernel-integer.js.map +1 -0
  211. package/dist/kernel-rand.d.ts +16 -0
  212. package/dist/kernel-rand.js +237 -0
  213. package/dist/kernel-rand.js.map +1 -0
  214. package/dist/kernel-system.d.ts +39 -0
  215. package/dist/kernel-system.js +103 -0
  216. package/dist/kernel-system.js.map +1 -0
  217. package/dist/kernel-warn.d.ts +35 -0
  218. package/dist/kernel-warn.js +73 -0
  219. package/dist/kernel-warn.js.map +1 -0
  220. package/dist/key-error.d.ts +44 -0
  221. package/dist/key-error.js +59 -0
  222. package/dist/key-error.js.map +1 -0
  223. package/dist/keyword-splat.d.ts +41 -0
  224. package/dist/keyword-splat.js +65 -0
  225. package/dist/keyword-splat.js.map +1 -0
  226. package/dist/load-error.d.ts +19 -0
  227. package/dist/load-error.js +19 -0
  228. package/dist/load-error.js.map +1 -0
  229. package/dist/load.d.ts +128 -0
  230. package/dist/load.js +278 -0
  231. package/dist/load.js.map +1 -0
  232. package/dist/loaded-features.d.ts +13 -0
  233. package/dist/loaded-features.js +15 -0
  234. package/dist/loaded-features.js.map +1 -0
  235. package/dist/local-jump-error.d.ts +12 -0
  236. package/dist/local-jump-error.js +12 -0
  237. package/dist/local-jump-error.js.map +1 -0
  238. package/dist/logger/formatter.d.ts +21 -0
  239. package/dist/logger/formatter.js +43 -0
  240. package/dist/logger/formatter.js.map +1 -0
  241. package/dist/logger/log-device.d.ts +52 -0
  242. package/dist/logger/log-device.js +104 -0
  243. package/dist/logger/log-device.js.map +1 -0
  244. package/dist/logger/severity.d.ts +23 -0
  245. package/dist/logger/severity.js +42 -0
  246. package/dist/logger/severity.js.map +1 -0
  247. package/dist/logger.d.ts +127 -0
  248. package/dist/logger.js +218 -0
  249. package/dist/logger.js.map +1 -0
  250. package/dist/marshal.d.ts +83 -0
  251. package/dist/marshal.js +1487 -0
  252. package/dist/marshal.js.map +1 -0
  253. package/dist/match-data.d.ts +161 -0
  254. package/dist/match-data.js +284 -0
  255. package/dist/match-data.js.map +1 -0
  256. package/dist/method-cache.d.ts +81 -0
  257. package/dist/method-cache.js +109 -0
  258. package/dist/method-cache.js.map +1 -0
  259. package/dist/method-missing-proxy.d.ts +53 -0
  260. package/dist/method-missing-proxy.js +154 -0
  261. package/dist/method-missing-proxy.js.map +1 -0
  262. package/dist/method.d.ts +132 -0
  263. package/dist/method.js +320 -0
  264. package/dist/method.js.map +1 -0
  265. package/dist/monitor.d.ts +114 -0
  266. package/dist/monitor.js +270 -0
  267. package/dist/monitor.js.map +1 -0
  268. package/dist/mutex.d.ts +51 -0
  269. package/dist/mutex.js +150 -0
  270. package/dist/mutex.js.map +1 -0
  271. package/dist/name-error.d.ts +45 -0
  272. package/dist/name-error.js +54 -0
  273. package/dist/name-error.js.map +1 -0
  274. package/dist/net/http/exceptions.d.ts +31 -0
  275. package/dist/net/http/exceptions.js +46 -0
  276. package/dist/net/http/exceptions.js.map +1 -0
  277. package/dist/net/http/request.d.ts +137 -0
  278. package/dist/net/http/request.js +559 -0
  279. package/dist/net/http/request.js.map +1 -0
  280. package/dist/net/http/requests.d.ts +197 -0
  281. package/dist/net/http/requests.js +197 -0
  282. package/dist/net/http/requests.js.map +1 -0
  283. package/dist/net/http/response.d.ts +141 -0
  284. package/dist/net/http/response.js +416 -0
  285. package/dist/net/http/response.js.map +1 -0
  286. package/dist/net/http/responses.d.ts +345 -0
  287. package/dist/net/http/responses.js +486 -0
  288. package/dist/net/http/responses.js.map +1 -0
  289. package/dist/net/http.d.ts +278 -0
  290. package/dist/net/http.js +760 -0
  291. package/dist/net/http.js.map +1 -0
  292. package/dist/net/protocol.d.ts +227 -0
  293. package/dist/net/protocol.js +392 -0
  294. package/dist/net/protocol.js.map +1 -0
  295. package/dist/nil-class.d.ts +10 -0
  296. package/dist/nil-class.js +27 -0
  297. package/dist/nil-class.js.map +1 -0
  298. package/dist/no-method-error.d.ts +38 -0
  299. package/dist/no-method-error.js +45 -0
  300. package/dist/no-method-error.js.map +1 -0
  301. package/dist/not-implemented-error.d.ts +13 -0
  302. package/dist/not-implemented-error.js +13 -0
  303. package/dist/not-implemented-error.js.map +1 -0
  304. package/dist/numeric-class.d.ts +29 -0
  305. package/dist/numeric-class.js +41 -0
  306. package/dist/numeric-class.js.map +1 -0
  307. package/dist/numeric.d.ts +226 -0
  308. package/dist/numeric.js +848 -0
  309. package/dist/numeric.js.map +1 -0
  310. package/dist/object-space.d.ts +34 -0
  311. package/dist/object-space.js +152 -0
  312. package/dist/object-space.js.map +1 -0
  313. package/dist/object.d.ts +833 -0
  314. package/dist/object.js +2131 -0
  315. package/dist/object.js.map +1 -0
  316. package/dist/open-uri.d.ts +180 -0
  317. package/dist/open-uri.js +402 -0
  318. package/dist/open-uri.js.map +1 -0
  319. package/dist/open3.d.ts +69 -0
  320. package/dist/open3.js +134 -0
  321. package/dist/open3.js.map +1 -0
  322. package/dist/openssl.d.ts +479 -0
  323. package/dist/openssl.js +1052 -0
  324. package/dist/openssl.js.map +1 -0
  325. package/dist/optparse.d.ts +130 -0
  326. package/dist/optparse.js +457 -0
  327. package/dist/optparse.js.map +1 -0
  328. package/dist/os-adapter.d.ts +20 -0
  329. package/dist/os-adapter.js +95 -0
  330. package/dist/os-adapter.js.map +1 -0
  331. package/dist/pathname.d.ts +73 -0
  332. package/dist/pathname.js +412 -0
  333. package/dist/pathname.js.map +1 -0
  334. package/dist/pp.d.ts +60 -0
  335. package/dist/pp.js +195 -0
  336. package/dist/pp.js.map +1 -0
  337. package/dist/pretty-print.d.ts +89 -0
  338. package/dist/pretty-print.js +232 -0
  339. package/dist/pretty-print.js.map +1 -0
  340. package/dist/process-adapter.d.ts +229 -0
  341. package/dist/process-adapter.js +889 -0
  342. package/dist/process-adapter.js.map +1 -0
  343. package/dist/process.d.ts +202 -0
  344. package/dist/process.js +433 -0
  345. package/dist/process.js.map +1 -0
  346. package/dist/psych/class-loader.d.ts +92 -0
  347. package/dist/psych/class-loader.js +139 -0
  348. package/dist/psych/class-loader.js.map +1 -0
  349. package/dist/psych/coder.d.ts +144 -0
  350. package/dist/psych/coder.js +176 -0
  351. package/dist/psych/coder.js.map +1 -0
  352. package/dist/psych/core-ext.d.ts +8 -0
  353. package/dist/psych/core-ext.js +10 -0
  354. package/dist/psych/core-ext.js.map +1 -0
  355. package/dist/psych/emitter.d.ts +116 -0
  356. package/dist/psych/emitter.js +1130 -0
  357. package/dist/psych/emitter.js.map +1 -0
  358. package/dist/psych/exception.d.ts +43 -0
  359. package/dist/psych/exception.js +54 -0
  360. package/dist/psych/exception.js.map +1 -0
  361. package/dist/psych/handler.d.ts +59 -0
  362. package/dist/psych/handler.js +95 -0
  363. package/dist/psych/handler.js.map +1 -0
  364. package/dist/psych/handlers/document-stream.d.ts +17 -0
  365. package/dist/psych/handlers/document-stream.js +26 -0
  366. package/dist/psych/handlers/document-stream.js.map +1 -0
  367. package/dist/psych/nodes/alias.d.ts +15 -0
  368. package/dist/psych/nodes/alias.js +22 -0
  369. package/dist/psych/nodes/alias.js.map +1 -0
  370. package/dist/psych/nodes/document.d.ts +23 -0
  371. package/dist/psych/nodes/document.js +35 -0
  372. package/dist/psych/nodes/document.js.map +1 -0
  373. package/dist/psych/nodes/mapping.d.ts +25 -0
  374. package/dist/psych/nodes/mapping.js +35 -0
  375. package/dist/psych/nodes/mapping.js.map +1 -0
  376. package/dist/psych/nodes/node.d.ts +59 -0
  377. package/dist/psych/nodes/node.js +79 -0
  378. package/dist/psych/nodes/node.js.map +1 -0
  379. package/dist/psych/nodes/scalar.d.ts +35 -0
  380. package/dist/psych/nodes/scalar.js +47 -0
  381. package/dist/psych/nodes/scalar.js.map +1 -0
  382. package/dist/psych/nodes/sequence.d.ts +25 -0
  383. package/dist/psych/nodes/sequence.js +35 -0
  384. package/dist/psych/nodes/sequence.js.map +1 -0
  385. package/dist/psych/nodes/stream.d.ts +23 -0
  386. package/dist/psych/nodes/stream.js +31 -0
  387. package/dist/psych/nodes/stream.js.map +1 -0
  388. package/dist/psych/omap.d.ts +9 -0
  389. package/dist/psych/omap.js +9 -0
  390. package/dist/psych/omap.js.map +1 -0
  391. package/dist/psych/parser.d.ts +41 -0
  392. package/dist/psych/parser.js +139 -0
  393. package/dist/psych/parser.js.map +1 -0
  394. package/dist/psych/scalar-scanner.d.ts +31 -0
  395. package/dist/psych/scalar-scanner.js +169 -0
  396. package/dist/psych/scalar-scanner.js.map +1 -0
  397. package/dist/psych/syntax-error.d.ts +23 -0
  398. package/dist/psych/syntax-error.js +35 -0
  399. package/dist/psych/syntax-error.js.map +1 -0
  400. package/dist/psych/tree-builder.d.ts +51 -0
  401. package/dist/psych/tree-builder.js +118 -0
  402. package/dist/psych/tree-builder.js.map +1 -0
  403. package/dist/psych/visitors/depth-first.d.ts +27 -0
  404. package/dist/psych/visitors/depth-first.js +37 -0
  405. package/dist/psych/visitors/depth-first.js.map +1 -0
  406. package/dist/psych/visitors/emitter.d.ts +32 -0
  407. package/dist/psych/visitors/emitter.js +63 -0
  408. package/dist/psych/visitors/emitter.js.map +1 -0
  409. package/dist/psych/visitors/to-ruby.d.ts +110 -0
  410. package/dist/psych/visitors/to-ruby.js +396 -0
  411. package/dist/psych/visitors/to-ruby.js.map +1 -0
  412. package/dist/psych/visitors/visitor.d.ts +11 -0
  413. package/dist/psych/visitors/visitor.js +17 -0
  414. package/dist/psych/visitors/visitor.js.map +1 -0
  415. package/dist/psych/visitors/yaml-tree.d.ts +182 -0
  416. package/dist/psych/visitors/yaml-tree.js +593 -0
  417. package/dist/psych/visitors/yaml-tree.js.map +1 -0
  418. package/dist/psych-adapter.d.ts +65 -0
  419. package/dist/psych-adapter.js +121 -0
  420. package/dist/psych-adapter.js.map +1 -0
  421. package/dist/psych-yaml.d.ts +2 -0
  422. package/dist/psych-yaml.js +5 -0
  423. package/dist/psych-yaml.js.map +1 -0
  424. package/dist/psych.d.ts +257 -0
  425. package/dist/psych.js +332 -0
  426. package/dist/psych.js.map +1 -0
  427. package/dist/queue.d.ts +137 -0
  428. package/dist/queue.js +236 -0
  429. package/dist/queue.js.map +1 -0
  430. package/dist/racc/parser.d.ts +70 -0
  431. package/dist/racc/parser.js +206 -0
  432. package/dist/racc/parser.js.map +1 -0
  433. package/dist/range-error.d.ts +15 -0
  434. package/dist/range-error.js +15 -0
  435. package/dist/range-error.js.map +1 -0
  436. package/dist/range.d.ts +166 -0
  437. package/dist/range.js +421 -0
  438. package/dist/range.js.map +1 -0
  439. package/dist/rational.d.ts +168 -0
  440. package/dist/rational.js +587 -0
  441. package/dist/rational.js.map +1 -0
  442. package/dist/rb-config.d.ts +33 -0
  443. package/dist/rb-config.js +53 -0
  444. package/dist/rb-config.js.map +1 -0
  445. package/dist/rb-equal.d.ts +66 -0
  446. package/dist/rb-equal.js +262 -0
  447. package/dist/rb-equal.js.map +1 -0
  448. package/dist/rb-hash.d.ts +26 -0
  449. package/dist/rb-hash.js +108 -0
  450. package/dist/rb-hash.js.map +1 -0
  451. package/dist/regexp.d.ts +82 -0
  452. package/dist/regexp.js +191 -0
  453. package/dist/regexp.js.map +1 -0
  454. package/dist/repl-adapter.d.ts +270 -0
  455. package/dist/repl-adapter.js +562 -0
  456. package/dist/repl-adapter.js.map +1 -0
  457. package/dist/resolv.d.ts +30 -0
  458. package/dist/resolv.js +48 -0
  459. package/dist/resolv.js.map +1 -0
  460. package/dist/ruby-empty.d.ts +28 -0
  461. package/dist/ruby-empty.js +40 -0
  462. package/dist/ruby-empty.js.map +1 -0
  463. package/dist/ruby-platform.d.ts +39 -0
  464. package/dist/ruby-platform.js +49 -0
  465. package/dist/ruby-platform.js.map +1 -0
  466. package/dist/runtime-error.d.ts +15 -0
  467. package/dist/runtime-error.js +15 -0
  468. package/dist/runtime-error.js.map +1 -0
  469. package/dist/scheduled-task.d.ts +73 -0
  470. package/dist/scheduled-task.js +150 -0
  471. package/dist/scheduled-task.js.map +1 -0
  472. package/dist/secure-random.d.ts +50 -0
  473. package/dist/secure-random.js +141 -0
  474. package/dist/secure-random.js.map +1 -0
  475. package/dist/set.d.ts +158 -0
  476. package/dist/set.js +352 -0
  477. package/dist/set.js.map +1 -0
  478. package/dist/shellwords.d.ts +27 -0
  479. package/dist/shellwords.js +53 -0
  480. package/dist/shellwords.js.map +1 -0
  481. package/dist/signal-exception.d.ts +43 -0
  482. package/dist/signal-exception.js +88 -0
  483. package/dist/signal-exception.js.map +1 -0
  484. package/dist/socket.d.ts +230 -0
  485. package/dist/socket.js +484 -0
  486. package/dist/socket.js.map +1 -0
  487. package/dist/standard-error.d.ts +27 -0
  488. package/dist/standard-error.js +49 -0
  489. package/dist/standard-error.js.map +1 -0
  490. package/dist/stop-iteration.d.ts +10 -0
  491. package/dist/stop-iteration.js +10 -0
  492. package/dist/stop-iteration.js.map +1 -0
  493. package/dist/string/b.d.ts +19 -0
  494. package/dist/string/b.js +28 -0
  495. package/dist/string/b.js.map +1 -0
  496. package/dist/string/byte-methods.d.ts +57 -0
  497. package/dist/string/byte-methods.js +266 -0
  498. package/dist/string/byte-methods.js.map +1 -0
  499. package/dist/string/bytes.d.ts +35 -0
  500. package/dist/string/bytes.js +123 -0
  501. package/dist/string/bytes.js.map +1 -0
  502. package/dist/string/case-mapping.d.ts +57 -0
  503. package/dist/string/case-mapping.js +192 -0
  504. package/dist/string/case-mapping.js.map +1 -0
  505. package/dist/string/chomp.d.ts +15 -0
  506. package/dist/string/chomp.js +32 -0
  507. package/dist/string/chomp.js.map +1 -0
  508. package/dist/string/convert.d.ts +55 -0
  509. package/dist/string/convert.js +316 -0
  510. package/dist/string/convert.js.map +1 -0
  511. package/dist/string/delete.d.ts +14 -0
  512. package/dist/string/delete.js +17 -0
  513. package/dist/string/delete.js.map +1 -0
  514. package/dist/string/each.d.ts +108 -0
  515. package/dist/string/each.js +305 -0
  516. package/dist/string/each.js.map +1 -0
  517. package/dist/string/encode.d.ts +37 -0
  518. package/dist/string/encode.js +268 -0
  519. package/dist/string/encode.js.map +1 -0
  520. package/dist/string/force-encoding.d.ts +72 -0
  521. package/dist/string/force-encoding.js +147 -0
  522. package/dist/string/force-encoding.js.map +1 -0
  523. package/dist/string/inspect.d.ts +17 -0
  524. package/dist/string/inspect.js +81 -0
  525. package/dist/string/inspect.js.map +1 -0
  526. package/dist/string/method-table.d.ts +174 -0
  527. package/dist/string/method-table.js +805 -0
  528. package/dist/string/method-table.js.map +1 -0
  529. package/dist/string/scrub.d.ts +12 -0
  530. package/dist/string/scrub.js +33 -0
  531. package/dist/string/scrub.js.map +1 -0
  532. package/dist/string/slice.d.ts +26 -0
  533. package/dist/string/slice.js +73 -0
  534. package/dist/string/slice.js.map +1 -0
  535. package/dist/string/split.d.ts +11 -0
  536. package/dist/string/split.js +44 -0
  537. package/dist/string/split.js.map +1 -0
  538. package/dist/string/sub.d.ts +114 -0
  539. package/dist/string/sub.js +371 -0
  540. package/dist/string/sub.js.map +1 -0
  541. package/dist/string/succ.d.ts +14 -0
  542. package/dist/string/succ.js +118 -0
  543. package/dist/string/succ.js.map +1 -0
  544. package/dist/string/support.d.ts +142 -0
  545. package/dist/string/support.js +296 -0
  546. package/dist/string/support.js.map +1 -0
  547. package/dist/string/tr.d.ts +46 -0
  548. package/dist/string/tr.js +156 -0
  549. package/dist/string/tr.js.map +1 -0
  550. package/dist/string-io.d.ts +166 -0
  551. package/dist/string-io.js +248 -0
  552. package/dist/string-io.js.map +1 -0
  553. package/dist/string-scanner.d.ts +133 -0
  554. package/dist/string-scanner.js +248 -0
  555. package/dist/string-scanner.js.map +1 -0
  556. package/dist/struct.d.ts +54 -0
  557. package/dist/struct.js +222 -0
  558. package/dist/struct.js.map +1 -0
  559. package/dist/symbol.d.ts +48 -0
  560. package/dist/symbol.js +107 -0
  561. package/dist/symbol.js.map +1 -0
  562. package/dist/tempfile.d.ts +173 -0
  563. package/dist/tempfile.js +295 -0
  564. package/dist/tempfile.js.map +1 -0
  565. package/dist/temporal-tag.d.ts +23 -0
  566. package/dist/temporal-tag.js +29 -0
  567. package/dist/temporal-tag.js.map +1 -0
  568. package/dist/thread-error.d.ts +13 -0
  569. package/dist/thread-error.js +13 -0
  570. package/dist/thread-error.js.map +1 -0
  571. package/dist/thread-pool-executor.d.ts +121 -0
  572. package/dist/thread-pool-executor.js +254 -0
  573. package/dist/thread-pool-executor.js.map +1 -0
  574. package/dist/thread.d.ts +211 -0
  575. package/dist/thread.js +495 -0
  576. package/dist/thread.js.map +1 -0
  577. package/dist/timeout.d.ts +29 -0
  578. package/dist/timeout.js +41 -0
  579. package/dist/timeout.js.map +1 -0
  580. package/dist/tse.d.ts +40 -0
  581. package/dist/tse.js +66 -0
  582. package/dist/tse.js.map +1 -0
  583. package/dist/type-error.d.ts +14 -0
  584. package/dist/type-error.js +14 -0
  585. package/dist/type-error.js.map +1 -0
  586. package/dist/undefined-conversion-error.d.ts +10 -0
  587. package/dist/undefined-conversion-error.js +10 -0
  588. package/dist/undefined-conversion-error.js.map +1 -0
  589. package/dist/uri/common.d.ts +209 -0
  590. package/dist/uri/common.js +369 -0
  591. package/dist/uri/common.js.map +1 -0
  592. package/dist/uri/generic.d.ts +280 -0
  593. package/dist/uri/generic.js +806 -0
  594. package/dist/uri/generic.js.map +1 -0
  595. package/dist/uri/http.d.ts +23 -0
  596. package/dist/uri/http.js +30 -0
  597. package/dist/uri/http.js.map +1 -0
  598. package/dist/uri/https.d.ts +13 -0
  599. package/dist/uri/https.js +15 -0
  600. package/dist/uri/https.js.map +1 -0
  601. package/dist/uri/rfc2396-parser.d.ts +70 -0
  602. package/dist/uri/rfc2396-parser.js +264 -0
  603. package/dist/uri/rfc2396-parser.js.map +1 -0
  604. package/dist/uri/rfc3986-parser.d.ts +46 -0
  605. package/dist/uri/rfc3986-parser.js +171 -0
  606. package/dist/uri/rfc3986-parser.js.map +1 -0
  607. package/dist/uri.d.ts +13 -0
  608. package/dist/uri.js +13 -0
  609. package/dist/uri.js.map +1 -0
  610. package/dist/variable.d.ts +183 -0
  611. package/dist/variable.js +463 -0
  612. package/dist/variable.js.map +1 -0
  613. package/dist/verbose.d.ts +39 -0
  614. package/dist/verbose.js +49 -0
  615. package/dist/verbose.js.map +1 -0
  616. package/dist/yaml.d.ts +9 -0
  617. package/dist/yaml.js +9 -0
  618. package/dist/yaml.js.map +1 -0
  619. package/dist/zlib-adapter.d.ts +119 -0
  620. package/dist/zlib-adapter.js +230 -0
  621. package/dist/zlib-adapter.js.map +1 -0
  622. package/dist/zlib.d.ts +299 -0
  623. package/dist/zlib.js +679 -0
  624. package/dist/zlib.js.map +1 -0
  625. package/package.json +172 -3
package/dist/json.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ import { Hash } from "./hash.js";
2
+ /**
3
+ * Ruby's stdlib `JSON` module, the two entry points Rails hands to a
4
+ * `serializer:` kwarg — `ActiveRecord::SignedId#signed_id_verifier` passes the
5
+ * constant bare (`signed_id.rb:79`), and the module has to be nameable as
6
+ * `JSON` at that call site for the port to read like the Ruby.
7
+ *
8
+ * This is stdlib, not Rails — `ActiveSupport::JSON` (`json.ts` in
9
+ * `@blazetrails/activesupport`) is a different module with `encode`/`decode`,
10
+ * and its `dump` carries ActiveSupport's HTML-escaping encoder rather than the
11
+ * json gem's plain `generate`.
12
+ *
13
+ * `dump` falls back to the `nil` dump because `globalThis.JSON.stringify`
14
+ * returns `undefined` for the values Ruby has no counterpart for (`undefined`
15
+ * itself, functions, symbols) where MRI writes `"null"`.
16
+ *
17
+ * @noRailsEquivalent PERMANENT — Ruby stdlib, not Rails: `JSON.dump`
18
+ * (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:541`) and `JSON.load` (`:615`) ship
19
+ * with the interpreter, so no Rails file defines them.
20
+ */
21
+ export declare namespace JSON {
22
+ /** @noRailsEquivalent PERMANENT */
23
+ function deepConstGet(path: string): unknown;
24
+ /**
25
+ * `JSON.parse` (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:219`). The parser
26
+ * takes the source through `StringValue` and `convert_encoding`
27
+ * (`vendor/ruby/v3.3.11/ext/json/parser/parser.rl:673-687,805`), which reads an
28
+ * `ASCII-8BIT` source as UTF-8, so a source held as its bytes is decoded here.
29
+ * A malformed source raises `SyntaxError`, JS's `JSON::ParserError`. With an
30
+ * options hash an object is parsed into a `Hash`, its names Symbols under
31
+ * `symbolizeNames` and every value frozen under `freeze` (`parser.rl:742-752`),
32
+ * or into a new `objectClass` instance filled through its `[]=`
33
+ * (`parser.rl:139-143,179`). Between tokens the source is read through the
34
+ * grammar's `ignore = ws | comment` (`parser.rl:100-108`): a block comment,
35
+ * and a `//` comment running to and including its newline, each read as
36
+ * whitespace; a comment left open raises `SyntaxError`.
37
+ *
38
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `JSON.parse`
39
+ * (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:219`).
40
+ */
41
+ function parse(source: string | Uint8Array, opts?: {
42
+ symbolizeNames?: boolean;
43
+ freeze?: boolean;
44
+ objectClass?: new () => Hash<string, unknown>;
45
+ quirksMode?: boolean;
46
+ }): unknown;
47
+ /**
48
+ * `JSON.pretty_generate` (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:374`) over
49
+ * `generate_json_object` / `generate_json_array` and `json_object_i`
50
+ * (`vendor/ruby/v3.3.11/ext/json/generator/generator.c:837-950`), with the pretty
51
+ * state's defaults (`common.rb:352-355`).
52
+ *
53
+ * @noRailsEquivalent PERMANENT
54
+ */
55
+ function prettyGenerate(obj: unknown, { indent, space, objectNl, arrayNl, }?: {
56
+ indent?: string;
57
+ space?: string;
58
+ objectNl?: string;
59
+ arrayNl?: string;
60
+ }): string;
61
+ /**
62
+ * `JSON.generate` (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:300-307`).
63
+ *
64
+ * @noRailsEquivalent PERMANENT
65
+ */
66
+ function generate(obj: unknown): string;
67
+ function dump(value: unknown): string;
68
+ function load(dumped: string | Uint8Array): unknown;
69
+ }
70
+ //# sourceMappingURL=json.d.ts.map
package/dist/json.js ADDED
@@ -0,0 +1,181 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace -- Ruby's `JSON` module is a
2
+ namespace of module functions; ESM syntax cannot spell `JSON.dump`. */
3
+ import { ArgumentError } from "./argument-error.js";
4
+ import { Hash } from "./hash.js";
5
+ import { rbObjClassname } from "./object.js";
6
+ const globalJSON = globalThis.JSON;
7
+ /**
8
+ * Ruby's stdlib `JSON` module, the two entry points Rails hands to a
9
+ * `serializer:` kwarg — `ActiveRecord::SignedId#signed_id_verifier` passes the
10
+ * constant bare (`signed_id.rb:79`), and the module has to be nameable as
11
+ * `JSON` at that call site for the port to read like the Ruby.
12
+ *
13
+ * This is stdlib, not Rails — `ActiveSupport::JSON` (`json.ts` in
14
+ * `@blazetrails/activesupport`) is a different module with `encode`/`decode`,
15
+ * and its `dump` carries ActiveSupport's HTML-escaping encoder rather than the
16
+ * json gem's plain `generate`.
17
+ *
18
+ * `dump` falls back to the `nil` dump because `globalThis.JSON.stringify`
19
+ * returns `undefined` for the values Ruby has no counterpart for (`undefined`
20
+ * itself, functions, symbols) where MRI writes `"null"`.
21
+ *
22
+ * @noRailsEquivalent PERMANENT — Ruby stdlib, not Rails: `JSON.dump`
23
+ * (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:541`) and `JSON.load` (`:615`) ship
24
+ * with the interpreter, so no Rails file defines them.
25
+ */
26
+ export var JSON;
27
+ (function (JSON) {
28
+ /** @noRailsEquivalent PERMANENT */
29
+ function deepConstGet(path) {
30
+ let constant = globalThis;
31
+ for (const name of path.split("::").filter((segment, i) => i > 0 || segment !== "")) {
32
+ if (constant === null ||
33
+ (typeof constant !== "object" && typeof constant !== "function") ||
34
+ !(name in constant)) {
35
+ throw new ArgumentError(`can't get const ${path}: uninitialized constant ${name}`);
36
+ }
37
+ constant = constant[name];
38
+ }
39
+ return constant;
40
+ }
41
+ JSON.deepConstGet = deepConstGet;
42
+ /**
43
+ * `JSON.parse` (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:219`). The parser
44
+ * takes the source through `StringValue` and `convert_encoding`
45
+ * (`vendor/ruby/v3.3.11/ext/json/parser/parser.rl:673-687,805`), which reads an
46
+ * `ASCII-8BIT` source as UTF-8, so a source held as its bytes is decoded here.
47
+ * A malformed source raises `SyntaxError`, JS's `JSON::ParserError`. With an
48
+ * options hash an object is parsed into a `Hash`, its names Symbols under
49
+ * `symbolizeNames` and every value frozen under `freeze` (`parser.rl:742-752`),
50
+ * or into a new `objectClass` instance filled through its `[]=`
51
+ * (`parser.rl:139-143,179`). Between tokens the source is read through the
52
+ * grammar's `ignore = ws | comment` (`parser.rl:100-108`): a block comment,
53
+ * and a `//` comment running to and including its newline, each read as
54
+ * whitespace; a comment left open raises `SyntaxError`.
55
+ *
56
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `JSON.parse`
57
+ * (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:219`).
58
+ */
59
+ function parse(source, opts) {
60
+ if (source instanceof Uint8Array) {
61
+ try {
62
+ source = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(source);
63
+ }
64
+ catch {
65
+ throw new SyntaxError("source sequence is illegal/malformed utf-8");
66
+ }
67
+ }
68
+ if (typeof source !== "string") {
69
+ throw new TypeError(`no implicit conversion of ${rbObjClassname(source)} into String`);
70
+ }
71
+ const reviver = opts?.symbolizeNames == null && opts?.freeze == null && opts?.objectClass == null
72
+ ? undefined
73
+ : (_key, value) => {
74
+ if (Array.isArray(value))
75
+ return opts.freeze ? Object.freeze(value) : value;
76
+ if (typeof value !== "object" || value === null)
77
+ return value;
78
+ const hash = opts.objectClass ? new opts.objectClass() : new Hash();
79
+ for (const [name, v] of Object.entries(value)) {
80
+ hash.set(opts.symbolizeNames ? `:${name}` : name, v);
81
+ }
82
+ return opts.freeze ? hash.freeze() : hash;
83
+ };
84
+ let out = "";
85
+ let start = 0;
86
+ let index = 0;
87
+ while (index < source.length) {
88
+ const char = source[index];
89
+ if (char === '"') {
90
+ index++;
91
+ while (index < source.length && source[index] !== '"') {
92
+ index += source[index] === "\\" ? 2 : 1;
93
+ }
94
+ index++;
95
+ }
96
+ else if (char === "/" && source[index + 1] === "*") {
97
+ const end = source.indexOf("*/", index + 2);
98
+ if (end === -1)
99
+ throw new SyntaxError(`unexpected token at '${source.slice(index)}'`);
100
+ out += source.slice(start, index) + " ";
101
+ index = start = end + 2;
102
+ }
103
+ else if (char === "/" && source[index + 1] === "/") {
104
+ const end = source.indexOf("\n", index + 2);
105
+ if (end === -1)
106
+ throw new SyntaxError(`unexpected token at '${source.slice(index)}'`);
107
+ out += source.slice(start, index) + " ";
108
+ index = start = end + 1;
109
+ }
110
+ else {
111
+ index++;
112
+ }
113
+ }
114
+ return globalJSON.parse(start === 0 ? source : out + source.slice(start), reviver);
115
+ }
116
+ JSON.parse = parse;
117
+ /**
118
+ * `JSON.pretty_generate` (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:374`) over
119
+ * `generate_json_object` / `generate_json_array` and `json_object_i`
120
+ * (`vendor/ruby/v3.3.11/ext/json/generator/generator.c:837-950`), with the pretty
121
+ * state's defaults (`common.rb:352-355`).
122
+ *
123
+ * @noRailsEquivalent PERMANENT
124
+ */
125
+ function prettyGenerate(obj, { indent = " ", space = " ", objectNl = "\n", arrayNl = "\n", } = {}) {
126
+ const generate = (value, depth) => {
127
+ if (Array.isArray(value)) {
128
+ depth += 1;
129
+ let buffer = "[" + arrayNl;
130
+ value.forEach((element, i) => {
131
+ if (i > 0)
132
+ buffer += "," + arrayNl;
133
+ buffer += indent.repeat(depth) + generate(element, depth);
134
+ });
135
+ return buffer + arrayNl + indent.repeat(depth - 1) + "]";
136
+ }
137
+ if (value instanceof Hash)
138
+ value = value.toJSON();
139
+ if (value !== null && typeof value === "object") {
140
+ depth += 1;
141
+ let buffer = "{";
142
+ Object.entries(value).forEach(([key, val], i) => {
143
+ if (i > 0)
144
+ buffer += ",";
145
+ buffer += objectNl + indent.repeat(depth);
146
+ buffer += globalJSON.stringify(key) + ":" + space + generate(val, depth);
147
+ });
148
+ return buffer + objectNl + indent.repeat(depth - 1) + "}";
149
+ }
150
+ return globalJSON.stringify(value) ?? "null";
151
+ };
152
+ return generate(obj, 0);
153
+ }
154
+ JSON.prettyGenerate = prettyGenerate;
155
+ /**
156
+ * `JSON.generate` (`vendor/ruby/v3.3.11/ext/json/lib/json/common.rb:300-307`).
157
+ *
158
+ * @noRailsEquivalent PERMANENT
159
+ */
160
+ function generate(obj) {
161
+ return globalJSON.stringify(obj) ?? "null";
162
+ }
163
+ JSON.generate = generate;
164
+ function dump(value) {
165
+ return globalJSON.stringify(value) ?? "null";
166
+ }
167
+ JSON.dump = dump;
168
+ function load(dumped) {
169
+ const source = typeof dumped === "string" ? dumped : new TextDecoder().decode(dumped);
170
+ return globalJSON.parse(source, (_key, value) => {
171
+ if (value !== null && typeof value === "object" && typeof value.json_class === "string") {
172
+ const klass = deepConstGet(value.json_class);
173
+ if (typeof klass?.jsonCreate === "function")
174
+ return klass.jsonCreate(value);
175
+ }
176
+ return value;
177
+ });
178
+ }
179
+ JSON.load = load;
180
+ })(JSON || (JSON = {}));
181
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../lib/json.ts"],"names":[],"mappings":"AAAA;yEACyE;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC;AAEnC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,KAAW,IAAI,CA+JpB;AA/JD,WAAiB,IAAI;IACnB,mCAAmC;IACnC,SAAgB,YAAY,CAAC,IAAY;QACvC,IAAI,QAAQ,GAAY,UAAU,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,EAAE,CAAC,EAAE,CAAC;YACpF,IACE,QAAQ,KAAK,IAAI;gBACjB,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,CAAC;gBAChE,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC,EACnB,CAAC;gBACD,MAAM,IAAI,aAAa,CAAC,mBAAmB,IAAI,4BAA4B,IAAI,EAAE,CAAC,CAAC;YACrF,CAAC;YACD,QAAQ,GAAI,QAAoC,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;QACD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args)` stores
5
+ * the tag and value and hands the rest to `super`
6
+ * (`uncaught_throw_init`, `vm_eval.c:2180-2188`); `to_s` formats the message
7
+ * with the tag (`uncaught_throw_to_s`, `vm_eval.c:2222-2228`). JS has no
8
+ * `to_s` hook on an `Error`, so the constructor installs `message` as a getter
9
+ * that runs that format on read, raising `TypeError` for a nil or non-String
10
+ * message just as `rb_str_format` does.
11
+ *
12
+ * @noRailsEquivalent PERMANENT — Ruby core `UncaughtThrowError`, which Rails
13
+ * inherits rather than defines.
14
+ */
15
+ export declare class UncaughtThrowError extends ArgumentError {
16
+ constructor(...argv: unknown[]);
17
+ }
18
+ /** @noRailsEquivalent PERMANENT */
19
+ export interface UncaughtThrowError {
20
+ readonly tag: unknown;
21
+ readonly value: unknown;
22
+ }
23
+ /**
24
+ * `THROW_DATA_P` (`vendor/ruby/v3.3.11/internal/imemo.h:118`): a `throw` in
25
+ * flight is not an exception, so no `rescue` clause sees it. A JS `catch`
26
+ * does, and asks this before treating what it caught as one.
27
+ *
28
+ * @noRailsEquivalent PERMANENT
29
+ */
30
+ export declare function throwDataP(err: unknown): boolean;
31
+ /**
32
+ * `Kernel#throw` (`vendor/ruby/v3.3.11/vm_eval.c:2244-2251` `rb_f_throw`):
33
+ * `rb_scan_args(argc, argv, "11", &tag, &value)`, then `rb_throw_obj`.
34
+ *
35
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#throw`, which Rails calls
36
+ * without defining.
37
+ */
38
+ export declare function kernelThrow(tag: unknown, value?: unknown): never;
39
+ /**
40
+ * `Kernel#catch` (`vendor/ruby/v3.3.11/vm_eval.c:2342` `rb_f_catch`).
41
+ *
42
+ * @noRailsEquivalent PERMANENT
43
+ */
44
+ export declare function kernelCatch<T>(block: (tag: object) => T): T | unknown;
45
+ /** @noRailsEquivalent PERMANENT */
46
+ export declare function kernelCatch<T>(tag: unknown, block: (tag: unknown) => T): T | unknown;
47
+ /**
48
+ * `Kernel#catch` (`vendor/ruby/v3.3.11/vm_eval.c:2342` `rb_f_catch`) for a
49
+ * block its caller knows is synchronous: the tag is
50
+ * pushed on a stack popped when the block returns, with no async-context
51
+ * frame, which only a block that can `await` needs. The block must not
52
+ * return a thenable: its tag is popped when it returns, so a `throw` after
53
+ * an `await` inside it finds no tag and raises `UncaughtThrowError`.
54
+ *
55
+ * @noRailsEquivalent PERMANENT
56
+ * @perf 4.6% — PERMANENT
57
+ */
58
+ export declare function kernelCatchSync<T>(tag: unknown, block: (tag: unknown) => T): T | unknown;
59
+ //# sourceMappingURL=kernel-catch.d.ts.map
@@ -0,0 +1,184 @@
1
+ import { ArgumentError } from "./argument-error.js";
2
+ import { getAsyncContext, } from "./async-context-adapter.js";
3
+ import { format } from "./kernel-format.js";
4
+ import { LocalJumpError } from "./local-jump-error.js";
5
+ import { rbBuiltinClassName } from "./object.js";
6
+ import { TypeError as RbTypeError } from "./type-error.js";
7
+ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging -- the extra-surface gate scores a class field as extra surface and excludes an interface member, so the tag/value readers are declared by merging */
8
+ /**
9
+ * Ruby's core `UncaughtThrowError < ArgumentError`
10
+ * (`vendor/ruby/v3.3.11/vm_eval.c:2588-2591`): `initialize(tag, value, *args)` stores
11
+ * the tag and value and hands the rest to `super`
12
+ * (`uncaught_throw_init`, `vm_eval.c:2180-2188`); `to_s` formats the message
13
+ * with the tag (`uncaught_throw_to_s`, `vm_eval.c:2222-2228`). JS has no
14
+ * `to_s` hook on an `Error`, so the constructor installs `message` as a getter
15
+ * that runs that format on read, raising `TypeError` for a nil or non-String
16
+ * message just as `rb_str_format` does.
17
+ *
18
+ * @noRailsEquivalent PERMANENT — Ruby core `UncaughtThrowError`, which Rails
19
+ * inherits rather than defines.
20
+ */
21
+ export class UncaughtThrowError extends ArgumentError {
22
+ constructor(...argv) {
23
+ if (argv.length < 2) {
24
+ throw new ArgumentError(`wrong number of arguments (given ${argv.length}, expected 2+)`);
25
+ }
26
+ const args = argv.slice(2);
27
+ if (args.length > 1) {
28
+ throw new ArgumentError(`wrong number of arguments (given ${args.length}, expected 0..1)`);
29
+ }
30
+ super();
31
+ const mesg = args.length === 0 ? null : args[0];
32
+ Object.assign(this, { tag: argv[0], value: argv[1] });
33
+ Object.defineProperty(this, "message", {
34
+ get: () => {
35
+ if (typeof mesg !== "string") {
36
+ throw new RbTypeError(`no implicit conversion of ${rbBuiltinClassName(mesg)} into String`);
37
+ }
38
+ return format(mesg, argv[0]);
39
+ },
40
+ });
41
+ }
42
+ }
43
+ class VmThrowData {
44
+ tag;
45
+ constructor(tag) {
46
+ this.tag = tag;
47
+ }
48
+ }
49
+ /**
50
+ * `THROW_DATA_P` (`vendor/ruby/v3.3.11/internal/imemo.h:118`): a `throw` in
51
+ * flight is not an exception, so no `rescue` clause sees it. A JS `catch`
52
+ * does, and asks this before treating what it caught as one.
53
+ *
54
+ * @noRailsEquivalent PERMANENT
55
+ */
56
+ export function throwDataP(err) {
57
+ return err instanceof VmThrowData;
58
+ }
59
+ let _ecTag = null;
60
+ let _adapter = null;
61
+ function ecTagSlot() {
62
+ const adapter = getAsyncContext();
63
+ if (!_ecTag || _adapter !== adapter) {
64
+ _adapter = adapter;
65
+ _ecTag = adapter.create();
66
+ }
67
+ return _ecTag;
68
+ }
69
+ let _syncTag;
70
+ /**
71
+ * `Kernel#throw` (`vendor/ruby/v3.3.11/vm_eval.c:2244-2251` `rb_f_throw`):
72
+ * `rb_scan_args(argc, argv, "11", &tag, &value)`, then `rb_throw_obj`.
73
+ *
74
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#throw`, which Rails calls
75
+ * without defining.
76
+ */
77
+ export function kernelThrow(tag, value = null) {
78
+ if (arguments.length < 1 || arguments.length > 2) {
79
+ throw new ArgumentError(`wrong number of arguments (given ${arguments.length}, expected 1..2)`);
80
+ }
81
+ return rbThrowObj(tag, value);
82
+ }
83
+ function rbThrowObj(tag, value) {
84
+ let tt = _syncTag ?? ecTagSlot().getStore();
85
+ while (tt) {
86
+ if (!tt.popped && tt.tag === tag) {
87
+ tt.retval = value;
88
+ break;
89
+ }
90
+ tt = tt.prev;
91
+ }
92
+ if (!tt) {
93
+ throw new UncaughtThrowError(tag, value, "uncaught throw %p");
94
+ }
95
+ throw new VmThrowData(tag);
96
+ }
97
+ /**
98
+ * `Kernel#catch` (`vendor/ruby/v3.3.11/vm_eval.c:2342` `rb_f_catch`): the tag
99
+ * defaults to a fresh `Object.new`, and a missing block raises
100
+ * `LocalJumpError` at `catch_i`'s `rb_yield_0`.
101
+ *
102
+ * A block returning a thenable keeps its tag pushed until it settles, and a
103
+ * rejection carrying a matching throw resolves to the thrown value — the
104
+ * `EC_POP_TAG` Ruby runs after the block returns, moved to where an async
105
+ * block actually returns. A sync block stays sync.
106
+ *
107
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#catch`, which Rails calls
108
+ * without defining.
109
+ */
110
+ export function kernelCatch(...argv) {
111
+ if (argv.length > 2) {
112
+ throw new ArgumentError(`wrong number of arguments (given ${argv.length}, expected 0..1)`);
113
+ }
114
+ const block = argv.length === 2 ? argv[1] : argv[0];
115
+ if (typeof block !== "function") {
116
+ throw new LocalJumpError("no block given (yield)");
117
+ }
118
+ const tag = argv.length === 2 ? argv[0] : {};
119
+ return rbCatchObj(tag, block);
120
+ }
121
+ function rbCatchObj(tag, func) {
122
+ const context = ecTagSlot();
123
+ const outer = _syncTag;
124
+ const tt = { tag, retval: null, prev: outer ?? context.getStore(), popped: false };
125
+ const rescue = (errinfo) => {
126
+ if (errinfo instanceof VmThrowData && errinfo.tag === tag)
127
+ return tt.retval;
128
+ throw errinfo;
129
+ };
130
+ _syncTag = undefined;
131
+ try {
132
+ return context.run(tt, () => {
133
+ let val;
134
+ try {
135
+ val = func(tag);
136
+ }
137
+ catch (errinfo) {
138
+ tt.popped = true;
139
+ return rescue(errinfo);
140
+ }
141
+ if (val !== null && typeof val?.then === "function") {
142
+ return Promise.resolve(val)
143
+ .finally(() => {
144
+ tt.popped = true;
145
+ })
146
+ .then(undefined, rescue);
147
+ }
148
+ tt.popped = true;
149
+ return val;
150
+ });
151
+ }
152
+ finally {
153
+ _syncTag = outer;
154
+ }
155
+ }
156
+ /**
157
+ * `Kernel#catch` (`vendor/ruby/v3.3.11/vm_eval.c:2342` `rb_f_catch`) for a
158
+ * block its caller knows is synchronous: the tag is
159
+ * pushed on a stack popped when the block returns, with no async-context
160
+ * frame, which only a block that can `await` needs. The block must not
161
+ * return a thenable: its tag is popped when it returns, so a `throw` after
162
+ * an `await` inside it finds no tag and raises `UncaughtThrowError`.
163
+ *
164
+ * @noRailsEquivalent PERMANENT
165
+ * @perf 4.6% — PERMANENT
166
+ */
167
+ export function kernelCatchSync(tag, block) {
168
+ const outer = _syncTag;
169
+ const tt = { tag, retval: null, prev: outer ?? ecTagSlot().getStore(), popped: false };
170
+ _syncTag = tt;
171
+ try {
172
+ return block(tag);
173
+ }
174
+ catch (errinfo) {
175
+ if (errinfo instanceof VmThrowData && errinfo.tag === tag)
176
+ return tt.retval;
177
+ throw errinfo;
178
+ }
179
+ finally {
180
+ tt.popped = true;
181
+ _syncTag = outer;
182
+ }
183
+ }
184
+ //# sourceMappingURL=kernel-catch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel-catch.js","sourceRoot":"","sources":["../lib/kernel-catch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,eAAe,GAGhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,wNAAwN;AACxN;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACnD,YAAY,GAAG,IAAe;Q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;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `vendor/ruby/v3.3.11/object.c:3605` `rb_convert_to_float` with `raise_exception`
3
+ * true — the arm every Rails call site reaches. A Numeric answers itself, a
4
+ * String is parsed by `rb_str_to_dbl` and raises `ArgumentError` when it does
5
+ * not parse, and anything else is converted through `to_f`, raising
6
+ * `TypeError` when the value does not define one.
7
+ *
8
+ * `rb_cstr_to_dbl` strips surrounding whitespace and then requires the WHOLE
9
+ * remainder to match Ruby's float grammar, so the parse is validated against
10
+ * that grammar rather than delegated to `Number()`, which reads `0b…`, `0o…`,
11
+ * `"Infinity"`, `"NaN"`, `"5."` and `"1e"` that Ruby rejects and rejects the
12
+ * `1_000` separators and `0x1p3` hex floats Ruby reads.
13
+ *
14
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#Float`
15
+ * (`vendor/ruby/v3.3.11/object.c:3648`), which Rails calls without defining, so there
16
+ * is no Ruby file in any gem for the port to mirror.
17
+ */
18
+ export declare function kernelFloat(val: unknown): number;
19
+ //# sourceMappingURL=kernel-float.d.ts.map
@@ -0,0 +1,54 @@
1
+ import { ArgumentError } from "./argument-error.js";
2
+ import { rbBuiltinClassName } from "./object.js";
3
+ const DECIMAL_REGEX = /^[+-]?(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?$/;
4
+ const HEXADECIMAL_REGEX = /^([+-]?)0[xX]([\da-fA-F](?:_?[\da-fA-F])*)(?:\.([\da-fA-F](?:_?[\da-fA-F])*))?(?:[pP]([+-]?\d+))?$/;
5
+ const DIGIT_SEPARATOR_REGEX = /_/g;
6
+ /**
7
+ * `vendor/ruby/v3.3.11/object.c:3605` `rb_convert_to_float` with `raise_exception`
8
+ * true — the arm every Rails call site reaches. A Numeric answers itself, a
9
+ * String is parsed by `rb_str_to_dbl` and raises `ArgumentError` when it does
10
+ * not parse, and anything else is converted through `to_f`, raising
11
+ * `TypeError` when the value does not define one.
12
+ *
13
+ * `rb_cstr_to_dbl` strips surrounding whitespace and then requires the WHOLE
14
+ * remainder to match Ruby's float grammar, so the parse is validated against
15
+ * that grammar rather than delegated to `Number()`, which reads `0b…`, `0o…`,
16
+ * `"Infinity"`, `"NaN"`, `"5."` and `"1e"` that Ruby rejects and rejects the
17
+ * `1_000` separators and `0x1p3` hex floats Ruby reads.
18
+ *
19
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#Float`
20
+ * (`vendor/ruby/v3.3.11/object.c:3648`), which Rails calls without defining, so there
21
+ * is no Ruby file in any gem for the port to mirror.
22
+ */
23
+ export function kernelFloat(val) {
24
+ if (typeof val === "number")
25
+ return val;
26
+ if (val instanceof Number)
27
+ return val.valueOf();
28
+ if (typeof val === "bigint")
29
+ return Number(val);
30
+ if (typeof val === "string") {
31
+ const str = val.trim();
32
+ if (DECIMAL_REGEX.test(str))
33
+ return Number(str.replace(DIGIT_SEPARATOR_REGEX, ""));
34
+ const hex = HEXADECIMAL_REGEX.exec(str);
35
+ if (hex !== null)
36
+ return hexFloat(hex);
37
+ throw new ArgumentError(`invalid value for Float(): ${JSON.stringify(val)}`);
38
+ }
39
+ if (val !== null && val !== undefined && typeof val === "object") {
40
+ const toF = val.toF;
41
+ if (typeof toF === "function")
42
+ return toF.call(val);
43
+ }
44
+ throw new TypeError(`can't convert ${rbBuiltinClassName(val)} into Float`);
45
+ }
46
+ function hexFloat(hex) {
47
+ const [, sign, intDigits, fracDigits, exponent] = hex;
48
+ const digits = intDigits.replace(DIGIT_SEPARATOR_REGEX, "");
49
+ const frac = (fracDigits ?? "").replace(DIGIT_SEPARATOR_REGEX, "");
50
+ const mantissa = Number.parseInt(digits + frac, 16) / 16 ** frac.length;
51
+ const scaled = mantissa * 2 ** Number(exponent ?? "0");
52
+ return sign === "-" ? -scaled : scaled;
53
+ }
54
+ //# sourceMappingURL=kernel-float.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel-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AQ,GAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,IAAI,SAAS,CAAC,iBAAiB,kBAAkB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,QAAQ,CAAC,GAAoB;IACpC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,GAAG,GAAG,CAAC;IACtD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;IACxE,MAAM,MAAM,GAAG,QAAQ,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;IACvD,OAAO,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;AACzC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type PipeIO } from "./io.js";
2
+ /**
3
+ * `Kernel#fork` (`rb_f_fork`, `vendor/ruby/v3.3.11/process.c:4375`) over
4
+ * `child_process.fork`. A Node child starts on a fresh heap rather than a copy
5
+ * of the parent's, so it cannot run the parent's block: it runs `entry`, which
6
+ * reads `payload` back with {@link rbForkPayload}. Each of `pipes` is a writer
7
+ * the child holds a copy of, reached there as {@link rbForkedPipe}. Answers
8
+ * the child's pid, which {@link rbWaitpidNohang} reports once it exits.
9
+ *
10
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#fork`.
11
+ */
12
+ export declare function rbFFork(entry: string, payload: unknown, pipes?: PipeIO[]): number;
13
+ /**
14
+ * What {@link rbFFork} handed this process, or `null` outside a forked child:
15
+ * the part of the heap `rb_fork_ruby` (`vendor/ruby/v3.3.11/process.c:4249`)
16
+ * would have copied that the child needs.
17
+ *
18
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#fork`.
19
+ */
20
+ export declare function rbForkPayload(): unknown;
21
+ /**
22
+ * The child's copy of the `index`th pipe {@link rbFFork} was handed: a reader
23
+ * of its own, closed apart from the parent's, and a writer whose bytes reach
24
+ * the parent's reader, as `rb_fork_ruby` (`vendor/ruby/v3.3.11/process.c:4249`)
25
+ * leaves the child both descriptors of every pipe.
26
+ *
27
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#fork`.
28
+ */
29
+ export declare function rbForkedPipe(index: number): [PipeIO, PipeIO];
30
+ //# sourceMappingURL=kernel-fork.d.ts.map