@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.
- package/LICENSE +21 -0
- package/NOTICE +6 -0
- package/README.md +440 -2
- package/dist/argument-error.d.ts +15 -0
- package/dist/argument-error.js +15 -0
- package/dist/argument-error.js.map +1 -0
- package/dist/array.d.ts +415 -0
- package/dist/array.js +1330 -0
- package/dist/array.js.map +1 -0
- package/dist/async-context-adapter.d.ts +19 -0
- package/dist/async-context-adapter.js +139 -0
- package/dist/async-context-adapter.js.map +1 -0
- package/dist/backtrace-location.d.ts +78 -0
- package/dist/backtrace-location.js +158 -0
- package/dist/backtrace-location.js.map +1 -0
- package/dist/base64.d.ts +73 -0
- package/dist/base64.js +164 -0
- package/dist/base64.js.map +1 -0
- package/dist/benchmark.d.ts +19 -0
- package/dist/benchmark.js +16 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/big-decimal.d.ts +111 -0
- package/dist/big-decimal.js +584 -0
- package/dist/big-decimal.js.map +1 -0
- package/dist/bundler.d.ts +44 -0
- package/dist/bundler.js +97 -0
- package/dist/bundler.js.map +1 -0
- package/dist/cgi.d.ts +89 -0
- package/dist/cgi.js +168 -0
- package/dist/cgi.js.map +1 -0
- package/dist/child-process-adapter.d.ts +110 -0
- package/dist/child-process-adapter.js +272 -0
- package/dist/child-process-adapter.js.map +1 -0
- package/dist/class-module.d.ts +10 -0
- package/dist/class-module.js +10 -0
- package/dist/class-module.js.map +1 -0
- package/dist/classpath.d.ts +93 -0
- package/dist/classpath.js +210 -0
- package/dist/classpath.js.map +1 -0
- package/dist/closed-queue-error.d.ts +10 -0
- package/dist/closed-queue-error.js +10 -0
- package/dist/closed-queue-error.js.map +1 -0
- package/dist/comparable.d.ts +127 -0
- package/dist/comparable.js +376 -0
- package/dist/comparable.js.map +1 -0
- package/dist/complex.d.ts +49 -0
- package/dist/complex.js +164 -0
- package/dist/complex.js.map +1 -0
- package/dist/concurrent/atomic-boolean.d.ts +24 -0
- package/dist/concurrent/atomic-boolean.js +43 -0
- package/dist/concurrent/atomic-boolean.js.map +1 -0
- package/dist/concurrent/atomic-fixnum.d.ts +21 -0
- package/dist/concurrent/atomic-fixnum.js +35 -0
- package/dist/concurrent/atomic-fixnum.js.map +1 -0
- package/dist/concurrent/count-down-latch.d.ts +20 -0
- package/dist/concurrent/count-down-latch.js +50 -0
- package/dist/concurrent/count-down-latch.js.map +1 -0
- package/dist/concurrent/cyclic-barrier.d.ts +18 -0
- package/dist/concurrent/cyclic-barrier.js +50 -0
- package/dist/concurrent/cyclic-barrier.js.map +1 -0
- package/dist/concurrent/event.d.ts +19 -0
- package/dist/concurrent/event.js +31 -0
- package/dist/concurrent/event.js.map +1 -0
- package/dist/concurrent/map.d.ts +149 -0
- package/dist/concurrent/map.js +202 -0
- package/dist/concurrent/map.js.map +1 -0
- package/dist/concurrent/read-write-lock.d.ts +25 -0
- package/dist/concurrent/read-write-lock.js +70 -0
- package/dist/concurrent/read-write-lock.js.map +1 -0
- package/dist/concurrent/semaphore.d.ts +24 -0
- package/dist/concurrent/semaphore.js +74 -0
- package/dist/concurrent/semaphore.js.map +1 -0
- package/dist/concurrent/timer-task.d.ts +52 -0
- package/dist/concurrent/timer-task.js +112 -0
- package/dist/concurrent/timer-task.js.map +1 -0
- package/dist/constants.generated.d.ts +2 -0
- package/dist/constants.generated.js +64 -0
- package/dist/constants.generated.js.map +1 -0
- package/dist/converter-not-found-error.d.ts +14 -0
- package/dist/converter-not-found-error.js +14 -0
- package/dist/converter-not-found-error.js.map +1 -0
- package/dist/crypto-adapter.d.ts +64 -0
- package/dist/crypto-adapter.js +365 -0
- package/dist/crypto-adapter.js.map +1 -0
- package/dist/delegate.d.ts +156 -0
- package/dist/delegate.js +306 -0
- package/dist/delegate.js.map +1 -0
- package/dist/digest.d.ts +99 -0
- package/dist/digest.js +131 -0
- package/dist/digest.js.map +1 -0
- package/dist/dir.d.ts +225 -0
- package/dist/dir.js +608 -0
- package/dist/dir.js.map +1 -0
- package/dist/encoding-error.d.ts +14 -0
- package/dist/encoding-error.js +17 -0
- package/dist/encoding-error.js.map +1 -0
- package/dist/encoding.d.ts +121 -0
- package/dist/encoding.js +306 -0
- package/dist/encoding.js.map +1 -0
- package/dist/ensure.d.ts +15 -0
- package/dist/ensure.js +35 -0
- package/dist/ensure.js.map +1 -0
- package/dist/enumerable.d.ts +375 -0
- package/dist/enumerable.js +1102 -0
- package/dist/enumerable.js.map +1 -0
- package/dist/enumerator.d.ts +324 -0
- package/dist/enumerator.js +625 -0
- package/dist/enumerator.js.map +1 -0
- package/dist/eof-error.d.ts +14 -0
- package/dist/eof-error.js +14 -0
- package/dist/eof-error.js.map +1 -0
- package/dist/errno.d.ts +447 -0
- package/dist/errno.js +616 -0
- package/dist/errno.js.map +1 -0
- package/dist/exc-detailed-message.d.ts +15 -0
- package/dist/exc-detailed-message.js +106 -0
- package/dist/exc-detailed-message.js.map +1 -0
- package/dist/exc-to-s.d.ts +10 -0
- package/dist/exc-to-s.js +21 -0
- package/dist/exc-to-s.js.map +1 -0
- package/dist/exception.d.ts +44 -0
- package/dist/exception.js +115 -0
- package/dist/exception.js.map +1 -0
- package/dist/fiber-error.d.ts +12 -0
- package/dist/fiber-error.js +12 -0
- package/dist/fiber-error.js.map +1 -0
- package/dist/fiber.d.ts +51 -0
- package/dist/fiber.js +178 -0
- package/dist/fiber.js.map +1 -0
- package/dist/file-utils.d.ts +480 -0
- package/dist/file-utils.js +1824 -0
- package/dist/file-utils.js.map +1 -0
- package/dist/file.d.ts +643 -0
- package/dist/file.js +1334 -0
- package/dist/file.js.map +1 -0
- package/dist/float-domain-error.d.ts +17 -0
- package/dist/float-domain-error.js +17 -0
- package/dist/float-domain-error.js.map +1 -0
- package/dist/fork-children.d.ts +23 -0
- package/dist/fork-children.js +32 -0
- package/dist/fork-children.js.map +1 -0
- package/dist/frozen-error.d.ts +33 -0
- package/dist/frozen-error.js +41 -0
- package/dist/frozen-error.js.map +1 -0
- package/dist/fs-adapter.d.ts +158 -0
- package/dist/fs-adapter.js +253 -0
- package/dist/fs-adapter.js.map +1 -0
- package/dist/gem/deprecate.d.ts +10 -0
- package/dist/gem/deprecate.js +8 -0
- package/dist/gem/deprecate.js.map +1 -0
- package/dist/gem/requirement.d.ts +55 -0
- package/dist/gem/requirement.js +91 -0
- package/dist/gem/requirement.js.map +1 -0
- package/dist/gem/version.d.ts +50 -0
- package/dist/gem/version.js +148 -0
- package/dist/gem/version.js.map +1 -0
- package/dist/gem.d.ts +59 -0
- package/dist/gem.js +82 -0
- package/dist/gem.js.map +1 -0
- package/dist/hash.d.ts +967 -0
- package/dist/hash.js +1572 -0
- package/dist/hash.js.map +1 -0
- package/dist/http-adapter.d.ts +124 -0
- package/dist/http-adapter.js +220 -0
- package/dist/http-adapter.js.map +1 -0
- package/dist/immediate-executor.d.ts +20 -0
- package/dist/immediate-executor.js +39 -0
- package/dist/immediate-executor.js.map +1 -0
- package/dist/include.d.ts +778 -0
- package/dist/include.js +2208 -0
- package/dist/include.js.map +1 -0
- package/dist/index-error.d.ts +13 -0
- package/dist/index-error.js +13 -0
- package/dist/index-error.js.map +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/invalid-byte-sequence-error.d.ts +62 -0
- package/dist/invalid-byte-sequence-error.js +75 -0
- package/dist/invalid-byte-sequence-error.js.map +1 -0
- package/dist/io-error.d.ts +14 -0
- package/dist/io-error.js +17 -0
- package/dist/io-error.js.map +1 -0
- package/dist/io.d.ts +867 -0
- package/dist/io.js +1960 -0
- package/dist/io.js.map +1 -0
- package/dist/ipaddr.d.ts +79 -0
- package/dist/ipaddr.js +405 -0
- package/dist/ipaddr.js.map +1 -0
- package/dist/json.d.ts +70 -0
- package/dist/json.js +181 -0
- package/dist/json.js.map +1 -0
- package/dist/kernel-catch.d.ts +59 -0
- package/dist/kernel-catch.js +184 -0
- package/dist/kernel-catch.js.map +1 -0
- package/dist/kernel-float.d.ts +19 -0
- package/dist/kernel-float.js +54 -0
- package/dist/kernel-float.js.map +1 -0
- package/dist/kernel-fork.d.ts +30 -0
- package/dist/kernel-fork.js +72 -0
- package/dist/kernel-fork.js.map +1 -0
- package/dist/kernel-format.d.ts +27 -0
- package/dist/kernel-format.js +901 -0
- package/dist/kernel-format.js.map +1 -0
- package/dist/kernel-hash.d.ts +7 -0
- package/dist/kernel-hash.js +33 -0
- package/dist/kernel-hash.js.map +1 -0
- package/dist/kernel-integer.d.ts +49 -0
- package/dist/kernel-integer.js +170 -0
- package/dist/kernel-integer.js.map +1 -0
- package/dist/kernel-rand.d.ts +16 -0
- package/dist/kernel-rand.js +237 -0
- package/dist/kernel-rand.js.map +1 -0
- package/dist/kernel-system.d.ts +39 -0
- package/dist/kernel-system.js +103 -0
- package/dist/kernel-system.js.map +1 -0
- package/dist/kernel-warn.d.ts +35 -0
- package/dist/kernel-warn.js +73 -0
- package/dist/kernel-warn.js.map +1 -0
- package/dist/key-error.d.ts +44 -0
- package/dist/key-error.js +59 -0
- package/dist/key-error.js.map +1 -0
- package/dist/keyword-splat.d.ts +41 -0
- package/dist/keyword-splat.js +65 -0
- package/dist/keyword-splat.js.map +1 -0
- package/dist/load-error.d.ts +19 -0
- package/dist/load-error.js +19 -0
- package/dist/load-error.js.map +1 -0
- package/dist/load.d.ts +128 -0
- package/dist/load.js +278 -0
- package/dist/load.js.map +1 -0
- package/dist/loaded-features.d.ts +13 -0
- package/dist/loaded-features.js +15 -0
- package/dist/loaded-features.js.map +1 -0
- package/dist/local-jump-error.d.ts +12 -0
- package/dist/local-jump-error.js +12 -0
- package/dist/local-jump-error.js.map +1 -0
- package/dist/logger/formatter.d.ts +21 -0
- package/dist/logger/formatter.js +43 -0
- package/dist/logger/formatter.js.map +1 -0
- package/dist/logger/log-device.d.ts +52 -0
- package/dist/logger/log-device.js +104 -0
- package/dist/logger/log-device.js.map +1 -0
- package/dist/logger/severity.d.ts +23 -0
- package/dist/logger/severity.js +42 -0
- package/dist/logger/severity.js.map +1 -0
- package/dist/logger.d.ts +127 -0
- package/dist/logger.js +218 -0
- package/dist/logger.js.map +1 -0
- package/dist/marshal.d.ts +83 -0
- package/dist/marshal.js +1487 -0
- package/dist/marshal.js.map +1 -0
- package/dist/match-data.d.ts +161 -0
- package/dist/match-data.js +284 -0
- package/dist/match-data.js.map +1 -0
- package/dist/method-cache.d.ts +81 -0
- package/dist/method-cache.js +109 -0
- package/dist/method-cache.js.map +1 -0
- package/dist/method-missing-proxy.d.ts +53 -0
- package/dist/method-missing-proxy.js +154 -0
- package/dist/method-missing-proxy.js.map +1 -0
- package/dist/method.d.ts +132 -0
- package/dist/method.js +320 -0
- package/dist/method.js.map +1 -0
- package/dist/monitor.d.ts +114 -0
- package/dist/monitor.js +270 -0
- package/dist/monitor.js.map +1 -0
- package/dist/mutex.d.ts +51 -0
- package/dist/mutex.js +150 -0
- package/dist/mutex.js.map +1 -0
- package/dist/name-error.d.ts +45 -0
- package/dist/name-error.js +54 -0
- package/dist/name-error.js.map +1 -0
- package/dist/net/http/exceptions.d.ts +31 -0
- package/dist/net/http/exceptions.js +46 -0
- package/dist/net/http/exceptions.js.map +1 -0
- package/dist/net/http/request.d.ts +137 -0
- package/dist/net/http/request.js +559 -0
- package/dist/net/http/request.js.map +1 -0
- package/dist/net/http/requests.d.ts +197 -0
- package/dist/net/http/requests.js +197 -0
- package/dist/net/http/requests.js.map +1 -0
- package/dist/net/http/response.d.ts +141 -0
- package/dist/net/http/response.js +416 -0
- package/dist/net/http/response.js.map +1 -0
- package/dist/net/http/responses.d.ts +345 -0
- package/dist/net/http/responses.js +486 -0
- package/dist/net/http/responses.js.map +1 -0
- package/dist/net/http.d.ts +278 -0
- package/dist/net/http.js +760 -0
- package/dist/net/http.js.map +1 -0
- package/dist/net/protocol.d.ts +227 -0
- package/dist/net/protocol.js +392 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/nil-class.d.ts +10 -0
- package/dist/nil-class.js +27 -0
- package/dist/nil-class.js.map +1 -0
- package/dist/no-method-error.d.ts +38 -0
- package/dist/no-method-error.js +45 -0
- package/dist/no-method-error.js.map +1 -0
- package/dist/not-implemented-error.d.ts +13 -0
- package/dist/not-implemented-error.js +13 -0
- package/dist/not-implemented-error.js.map +1 -0
- package/dist/numeric-class.d.ts +29 -0
- package/dist/numeric-class.js +41 -0
- package/dist/numeric-class.js.map +1 -0
- package/dist/numeric.d.ts +226 -0
- package/dist/numeric.js +848 -0
- package/dist/numeric.js.map +1 -0
- package/dist/object-space.d.ts +34 -0
- package/dist/object-space.js +152 -0
- package/dist/object-space.js.map +1 -0
- package/dist/object.d.ts +833 -0
- package/dist/object.js +2131 -0
- package/dist/object.js.map +1 -0
- package/dist/open-uri.d.ts +180 -0
- package/dist/open-uri.js +402 -0
- package/dist/open-uri.js.map +1 -0
- package/dist/open3.d.ts +69 -0
- package/dist/open3.js +134 -0
- package/dist/open3.js.map +1 -0
- package/dist/openssl.d.ts +479 -0
- package/dist/openssl.js +1052 -0
- package/dist/openssl.js.map +1 -0
- package/dist/optparse.d.ts +130 -0
- package/dist/optparse.js +457 -0
- package/dist/optparse.js.map +1 -0
- package/dist/os-adapter.d.ts +20 -0
- package/dist/os-adapter.js +95 -0
- package/dist/os-adapter.js.map +1 -0
- package/dist/pathname.d.ts +73 -0
- package/dist/pathname.js +412 -0
- package/dist/pathname.js.map +1 -0
- package/dist/pp.d.ts +60 -0
- package/dist/pp.js +195 -0
- package/dist/pp.js.map +1 -0
- package/dist/pretty-print.d.ts +89 -0
- package/dist/pretty-print.js +232 -0
- package/dist/pretty-print.js.map +1 -0
- package/dist/process-adapter.d.ts +229 -0
- package/dist/process-adapter.js +889 -0
- package/dist/process-adapter.js.map +1 -0
- package/dist/process.d.ts +202 -0
- package/dist/process.js +433 -0
- package/dist/process.js.map +1 -0
- package/dist/psych/class-loader.d.ts +92 -0
- package/dist/psych/class-loader.js +139 -0
- package/dist/psych/class-loader.js.map +1 -0
- package/dist/psych/coder.d.ts +144 -0
- package/dist/psych/coder.js +176 -0
- package/dist/psych/coder.js.map +1 -0
- package/dist/psych/core-ext.d.ts +8 -0
- package/dist/psych/core-ext.js +10 -0
- package/dist/psych/core-ext.js.map +1 -0
- package/dist/psych/emitter.d.ts +116 -0
- package/dist/psych/emitter.js +1130 -0
- package/dist/psych/emitter.js.map +1 -0
- package/dist/psych/exception.d.ts +43 -0
- package/dist/psych/exception.js +54 -0
- package/dist/psych/exception.js.map +1 -0
- package/dist/psych/handler.d.ts +59 -0
- package/dist/psych/handler.js +95 -0
- package/dist/psych/handler.js.map +1 -0
- package/dist/psych/handlers/document-stream.d.ts +17 -0
- package/dist/psych/handlers/document-stream.js +26 -0
- package/dist/psych/handlers/document-stream.js.map +1 -0
- package/dist/psych/nodes/alias.d.ts +15 -0
- package/dist/psych/nodes/alias.js +22 -0
- package/dist/psych/nodes/alias.js.map +1 -0
- package/dist/psych/nodes/document.d.ts +23 -0
- package/dist/psych/nodes/document.js +35 -0
- package/dist/psych/nodes/document.js.map +1 -0
- package/dist/psych/nodes/mapping.d.ts +25 -0
- package/dist/psych/nodes/mapping.js +35 -0
- package/dist/psych/nodes/mapping.js.map +1 -0
- package/dist/psych/nodes/node.d.ts +59 -0
- package/dist/psych/nodes/node.js +79 -0
- package/dist/psych/nodes/node.js.map +1 -0
- package/dist/psych/nodes/scalar.d.ts +35 -0
- package/dist/psych/nodes/scalar.js +47 -0
- package/dist/psych/nodes/scalar.js.map +1 -0
- package/dist/psych/nodes/sequence.d.ts +25 -0
- package/dist/psych/nodes/sequence.js +35 -0
- package/dist/psych/nodes/sequence.js.map +1 -0
- package/dist/psych/nodes/stream.d.ts +23 -0
- package/dist/psych/nodes/stream.js +31 -0
- package/dist/psych/nodes/stream.js.map +1 -0
- package/dist/psych/omap.d.ts +9 -0
- package/dist/psych/omap.js +9 -0
- package/dist/psych/omap.js.map +1 -0
- package/dist/psych/parser.d.ts +41 -0
- package/dist/psych/parser.js +139 -0
- package/dist/psych/parser.js.map +1 -0
- package/dist/psych/scalar-scanner.d.ts +31 -0
- package/dist/psych/scalar-scanner.js +169 -0
- package/dist/psych/scalar-scanner.js.map +1 -0
- package/dist/psych/syntax-error.d.ts +23 -0
- package/dist/psych/syntax-error.js +35 -0
- package/dist/psych/syntax-error.js.map +1 -0
- package/dist/psych/tree-builder.d.ts +51 -0
- package/dist/psych/tree-builder.js +118 -0
- package/dist/psych/tree-builder.js.map +1 -0
- package/dist/psych/visitors/depth-first.d.ts +27 -0
- package/dist/psych/visitors/depth-first.js +37 -0
- package/dist/psych/visitors/depth-first.js.map +1 -0
- package/dist/psych/visitors/emitter.d.ts +32 -0
- package/dist/psych/visitors/emitter.js +63 -0
- package/dist/psych/visitors/emitter.js.map +1 -0
- package/dist/psych/visitors/to-ruby.d.ts +110 -0
- package/dist/psych/visitors/to-ruby.js +396 -0
- package/dist/psych/visitors/to-ruby.js.map +1 -0
- package/dist/psych/visitors/visitor.d.ts +11 -0
- package/dist/psych/visitors/visitor.js +17 -0
- package/dist/psych/visitors/visitor.js.map +1 -0
- package/dist/psych/visitors/yaml-tree.d.ts +182 -0
- package/dist/psych/visitors/yaml-tree.js +593 -0
- package/dist/psych/visitors/yaml-tree.js.map +1 -0
- package/dist/psych-adapter.d.ts +65 -0
- package/dist/psych-adapter.js +121 -0
- package/dist/psych-adapter.js.map +1 -0
- package/dist/psych-yaml.d.ts +2 -0
- package/dist/psych-yaml.js +5 -0
- package/dist/psych-yaml.js.map +1 -0
- package/dist/psych.d.ts +257 -0
- package/dist/psych.js +332 -0
- package/dist/psych.js.map +1 -0
- package/dist/queue.d.ts +137 -0
- package/dist/queue.js +236 -0
- package/dist/queue.js.map +1 -0
- package/dist/racc/parser.d.ts +70 -0
- package/dist/racc/parser.js +206 -0
- package/dist/racc/parser.js.map +1 -0
- package/dist/range-error.d.ts +15 -0
- package/dist/range-error.js +15 -0
- package/dist/range-error.js.map +1 -0
- package/dist/range.d.ts +166 -0
- package/dist/range.js +421 -0
- package/dist/range.js.map +1 -0
- package/dist/rational.d.ts +168 -0
- package/dist/rational.js +587 -0
- package/dist/rational.js.map +1 -0
- package/dist/rb-config.d.ts +33 -0
- package/dist/rb-config.js +53 -0
- package/dist/rb-config.js.map +1 -0
- package/dist/rb-equal.d.ts +66 -0
- package/dist/rb-equal.js +262 -0
- package/dist/rb-equal.js.map +1 -0
- package/dist/rb-hash.d.ts +26 -0
- package/dist/rb-hash.js +108 -0
- package/dist/rb-hash.js.map +1 -0
- package/dist/regexp.d.ts +82 -0
- package/dist/regexp.js +191 -0
- package/dist/regexp.js.map +1 -0
- package/dist/repl-adapter.d.ts +270 -0
- package/dist/repl-adapter.js +562 -0
- package/dist/repl-adapter.js.map +1 -0
- package/dist/resolv.d.ts +30 -0
- package/dist/resolv.js +48 -0
- package/dist/resolv.js.map +1 -0
- package/dist/ruby-empty.d.ts +28 -0
- package/dist/ruby-empty.js +40 -0
- package/dist/ruby-empty.js.map +1 -0
- package/dist/ruby-platform.d.ts +39 -0
- package/dist/ruby-platform.js +49 -0
- package/dist/ruby-platform.js.map +1 -0
- package/dist/runtime-error.d.ts +15 -0
- package/dist/runtime-error.js +15 -0
- package/dist/runtime-error.js.map +1 -0
- package/dist/scheduled-task.d.ts +73 -0
- package/dist/scheduled-task.js +150 -0
- package/dist/scheduled-task.js.map +1 -0
- package/dist/secure-random.d.ts +50 -0
- package/dist/secure-random.js +141 -0
- package/dist/secure-random.js.map +1 -0
- package/dist/set.d.ts +158 -0
- package/dist/set.js +352 -0
- package/dist/set.js.map +1 -0
- package/dist/shellwords.d.ts +27 -0
- package/dist/shellwords.js +53 -0
- package/dist/shellwords.js.map +1 -0
- package/dist/signal-exception.d.ts +43 -0
- package/dist/signal-exception.js +88 -0
- package/dist/signal-exception.js.map +1 -0
- package/dist/socket.d.ts +230 -0
- package/dist/socket.js +484 -0
- package/dist/socket.js.map +1 -0
- package/dist/standard-error.d.ts +27 -0
- package/dist/standard-error.js +49 -0
- package/dist/standard-error.js.map +1 -0
- package/dist/stop-iteration.d.ts +10 -0
- package/dist/stop-iteration.js +10 -0
- package/dist/stop-iteration.js.map +1 -0
- package/dist/string/b.d.ts +19 -0
- package/dist/string/b.js +28 -0
- package/dist/string/b.js.map +1 -0
- package/dist/string/byte-methods.d.ts +57 -0
- package/dist/string/byte-methods.js +266 -0
- package/dist/string/byte-methods.js.map +1 -0
- package/dist/string/bytes.d.ts +35 -0
- package/dist/string/bytes.js +123 -0
- package/dist/string/bytes.js.map +1 -0
- package/dist/string/case-mapping.d.ts +57 -0
- package/dist/string/case-mapping.js +192 -0
- package/dist/string/case-mapping.js.map +1 -0
- package/dist/string/chomp.d.ts +15 -0
- package/dist/string/chomp.js +32 -0
- package/dist/string/chomp.js.map +1 -0
- package/dist/string/convert.d.ts +55 -0
- package/dist/string/convert.js +316 -0
- package/dist/string/convert.js.map +1 -0
- package/dist/string/delete.d.ts +14 -0
- package/dist/string/delete.js +17 -0
- package/dist/string/delete.js.map +1 -0
- package/dist/string/each.d.ts +108 -0
- package/dist/string/each.js +305 -0
- package/dist/string/each.js.map +1 -0
- package/dist/string/encode.d.ts +37 -0
- package/dist/string/encode.js +268 -0
- package/dist/string/encode.js.map +1 -0
- package/dist/string/force-encoding.d.ts +72 -0
- package/dist/string/force-encoding.js +147 -0
- package/dist/string/force-encoding.js.map +1 -0
- package/dist/string/inspect.d.ts +17 -0
- package/dist/string/inspect.js +81 -0
- package/dist/string/inspect.js.map +1 -0
- package/dist/string/method-table.d.ts +174 -0
- package/dist/string/method-table.js +805 -0
- package/dist/string/method-table.js.map +1 -0
- package/dist/string/scrub.d.ts +12 -0
- package/dist/string/scrub.js +33 -0
- package/dist/string/scrub.js.map +1 -0
- package/dist/string/slice.d.ts +26 -0
- package/dist/string/slice.js +73 -0
- package/dist/string/slice.js.map +1 -0
- package/dist/string/split.d.ts +11 -0
- package/dist/string/split.js +44 -0
- package/dist/string/split.js.map +1 -0
- package/dist/string/sub.d.ts +114 -0
- package/dist/string/sub.js +371 -0
- package/dist/string/sub.js.map +1 -0
- package/dist/string/succ.d.ts +14 -0
- package/dist/string/succ.js +118 -0
- package/dist/string/succ.js.map +1 -0
- package/dist/string/support.d.ts +142 -0
- package/dist/string/support.js +296 -0
- package/dist/string/support.js.map +1 -0
- package/dist/string/tr.d.ts +46 -0
- package/dist/string/tr.js +156 -0
- package/dist/string/tr.js.map +1 -0
- package/dist/string-io.d.ts +166 -0
- package/dist/string-io.js +248 -0
- package/dist/string-io.js.map +1 -0
- package/dist/string-scanner.d.ts +133 -0
- package/dist/string-scanner.js +248 -0
- package/dist/string-scanner.js.map +1 -0
- package/dist/struct.d.ts +54 -0
- package/dist/struct.js +222 -0
- package/dist/struct.js.map +1 -0
- package/dist/symbol.d.ts +48 -0
- package/dist/symbol.js +107 -0
- package/dist/symbol.js.map +1 -0
- package/dist/tempfile.d.ts +173 -0
- package/dist/tempfile.js +295 -0
- package/dist/tempfile.js.map +1 -0
- package/dist/temporal-tag.d.ts +23 -0
- package/dist/temporal-tag.js +29 -0
- package/dist/temporal-tag.js.map +1 -0
- package/dist/thread-error.d.ts +13 -0
- package/dist/thread-error.js +13 -0
- package/dist/thread-error.js.map +1 -0
- package/dist/thread-pool-executor.d.ts +121 -0
- package/dist/thread-pool-executor.js +254 -0
- package/dist/thread-pool-executor.js.map +1 -0
- package/dist/thread.d.ts +211 -0
- package/dist/thread.js +495 -0
- package/dist/thread.js.map +1 -0
- package/dist/timeout.d.ts +29 -0
- package/dist/timeout.js +41 -0
- package/dist/timeout.js.map +1 -0
- package/dist/tse.d.ts +40 -0
- package/dist/tse.js +66 -0
- package/dist/tse.js.map +1 -0
- package/dist/type-error.d.ts +14 -0
- package/dist/type-error.js +14 -0
- package/dist/type-error.js.map +1 -0
- package/dist/undefined-conversion-error.d.ts +10 -0
- package/dist/undefined-conversion-error.js +10 -0
- package/dist/undefined-conversion-error.js.map +1 -0
- package/dist/uri/common.d.ts +209 -0
- package/dist/uri/common.js +369 -0
- package/dist/uri/common.js.map +1 -0
- package/dist/uri/generic.d.ts +280 -0
- package/dist/uri/generic.js +806 -0
- package/dist/uri/generic.js.map +1 -0
- package/dist/uri/http.d.ts +23 -0
- package/dist/uri/http.js +30 -0
- package/dist/uri/http.js.map +1 -0
- package/dist/uri/https.d.ts +13 -0
- package/dist/uri/https.js +15 -0
- package/dist/uri/https.js.map +1 -0
- package/dist/uri/rfc2396-parser.d.ts +70 -0
- package/dist/uri/rfc2396-parser.js +264 -0
- package/dist/uri/rfc2396-parser.js.map +1 -0
- package/dist/uri/rfc3986-parser.d.ts +46 -0
- package/dist/uri/rfc3986-parser.js +171 -0
- package/dist/uri/rfc3986-parser.js.map +1 -0
- package/dist/uri.d.ts +13 -0
- package/dist/uri.js +13 -0
- package/dist/uri.js.map +1 -0
- package/dist/variable.d.ts +183 -0
- package/dist/variable.js +463 -0
- package/dist/variable.js.map +1 -0
- package/dist/verbose.d.ts +39 -0
- package/dist/verbose.js +49 -0
- package/dist/verbose.js.map +1 -0
- package/dist/yaml.d.ts +9 -0
- package/dist/yaml.js +9 -0
- package/dist/yaml.js.map +1 -0
- package/dist/zlib-adapter.d.ts +119 -0
- package/dist/zlib-adapter.js +230 -0
- package/dist/zlib-adapter.js.map +1 -0
- package/dist/zlib.d.ts +299 -0
- package/dist/zlib.js +679 -0
- package/dist/zlib.js.map +1 -0
- 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
|
package/dist/json.js.map
ADDED
|
@@ -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,OA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AAE,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IATe,KAAA,IAAI,OASnB,CAAA;AACH,CAAC,EA/JgB,IAAI,KAAJ,IAAI,QA+JpB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ArgumentError } from "./argument-error.js";
|
|
2
|
+
/**
|
|
3
|
+
* Ruby's core `UncaughtThrowError < ArgumentError`
|
|
4
|
+
* (`vendor/ruby/v3.3.11/vm_eval.c:2588-2591`): `initialize(tag, value, *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;QAC5B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,aAAa,CAAC,oCAAoC,IAAI,CAAC,MAAM,gBAAgB,CAAC,CAAC;QAC3F,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,aAAa,CAAC,oCAAoC,IAAI,CAAC,MA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G,EAAE;oBACZ,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;gBACnB,CAAC,CAAC;qBACD,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAC7B,CAAC;YACD,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;YACjB,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,QAAQ,GAAG,KAAK,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAI,GAAY,EAAE,KAA0B;IACzE,MAAM,KAAK,GAAG,QAAQ,CAAC;IACvB,MAAM,EAAE,GAAY,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAChG,QAAQ,GAAG,EAAE,CAAC;IACd,IAAI,CAAC;QACH,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QACjB,IAAI,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG;YAAE,OAAO,EAAE,CAAC,MAAM,CAAC;QAC5E,MAAM,OAAO,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;QACjB,QAAQ,GAAG,KAAK,CAAC;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-float.js","sourceRoot":"","sources":["../lib/kernel-float.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,aAAa,GACjB,iFAAiF,CAAC;AAEpF,MAAM,iBAAiB,GACrB,oGAAoG,CAAC;AAEvG,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,IAAI,GAAG,YAAY,MAAM;QAAE,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;IAChD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC;QACnF,MAAM,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,IAAI,aAAa,CAAC,8BAA8B,IAAI,CAAC,SAAS,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+
* 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
|