@scriptc/cli-darwin-arm64 0.2.0 → 0.2.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/dist/THIRD_PARTY_NOTICES +1 -1
- package/dist/bin/scriptc +0 -0
- package/dist/bin/scriptc.json +1 -1
- package/dist/lib/declarations/scriptc-node-fallback.d.ts +84 -19
- package/dist/lib/llvm/bin/scriptc-llvm-codegen +0 -0
- package/dist/lib/llvm/package.json +1 -1
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_web.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/licenses/v8-number-radix.txt +61 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_web.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-arm64/package.json +1 -1
- package/dist/lib/runtime-darwin-arm64/runtime-pack.json +549 -545
- package/dist/lib/runtime-sources/package.json +1 -1
- package/dist/lib/runtime-sources/src/scr_abort.c +5 -0
- package/dist/lib/runtime-sources/src/scr_array.c +16 -0
- package/dist/lib/runtime-sources/src/scr_assert.c +1 -0
- package/dist/lib/runtime-sources/src/scr_async.c +38 -5
- package/dist/lib/runtime-sources/src/scr_async_dyn.c +208 -40
- package/dist/lib/runtime-sources/src/scr_bigint.c +8 -0
- package/dist/lib/runtime-sources/src/scr_bytes.c +431 -41
- package/dist/lib/runtime-sources/src/scr_bytes_io.c +628 -12
- package/dist/lib/runtime-sources/src/scr_child.c +544 -17
- package/dist/lib/runtime-sources/src/scr_console.c +1 -1
- package/dist/lib/runtime-sources/src/scr_crypto_async.c +22 -2
- package/dist/lib/runtime-sources/src/scr_dyn_invoke.c +344 -73
- package/dist/lib/runtime-sources/src/scr_error.c +52 -5
- package/dist/lib/runtime-sources/src/scr_exception.c +21 -5
- package/dist/lib/runtime-sources/src/scr_fetch.c +311 -3
- package/dist/lib/runtime-sources/src/scr_file_handle.c +31 -0
- package/dist/lib/runtime-sources/src/scr_http.c +3 -0
- package/dist/lib/runtime-sources/src/scr_island.c +1226 -405
- package/dist/lib/runtime-sources/src/scr_island_manifest.h +11 -9
- package/dist/lib/runtime-sources/src/scr_json.c +1594 -139
- package/dist/lib/runtime-sources/src/scr_json.test.ts +1 -0
- package/dist/lib/runtime-sources/src/scr_lib.c +816 -34
- package/dist/lib/runtime-sources/src/scr_map.c +47 -0
- package/dist/lib/runtime-sources/src/scr_node_builtin.c +10 -0
- package/dist/lib/runtime-sources/src/scr_object.c +11 -0
- package/dist/lib/runtime-sources/src/scr_qs.c +10 -0
- package/dist/lib/runtime-sources/src/scr_regex.c +148 -72
- package/dist/lib/runtime-sources/src/scr_runtime.h +257 -41
- package/dist/lib/runtime-sources/src/scr_stream.c +197 -0
- package/dist/lib/runtime-sources/src/scr_string.c +16 -1
- package/dist/lib/runtime-sources/src/scr_symbol.c +5 -0
- package/dist/lib/runtime-sources/src/scr_text_decoder_labels.h +225 -0
- package/dist/lib/runtime-sources/src/scr_url.c +206 -10
- package/dist/lib/runtime-sources/src/scr_web.c +129 -26
- package/dist/lib/runtime-sources/vendor/v8-number-radix/LICENSE +61 -0
- package/package.json +1 -1
|
@@ -420,6 +420,7 @@ ScrArr *scr_arr_new(ScrElemKind elem, size_t initial_cap) {
|
|
|
420
420
|
a->props = NULL;
|
|
421
421
|
a->prop_len = 0;
|
|
422
422
|
a->prop_cap = 0;
|
|
423
|
+
a->metadata = NULL;
|
|
423
424
|
if (initial_cap > 0) scr_arr_grow_dense(a, initial_cap);
|
|
424
425
|
#ifdef SCR_RC_AUDIT
|
|
425
426
|
scr_live_arrays++;
|
|
@@ -433,6 +434,7 @@ ScrArr *scr_arr_new(ScrElemKind elem, size_t initial_cap) {
|
|
|
433
434
|
* below releases none — the complement contract in scr_runtime.h. */
|
|
434
435
|
void scr_arr_trace_v(void *a0, ScrTraceVisit visit, void *ctx) {
|
|
435
436
|
ScrArr *a = (ScrArr *)a0;
|
|
437
|
+
visit(a->metadata, ctx);
|
|
436
438
|
for (size_t i = 0; i < a->cap; i++) {
|
|
437
439
|
if (a->present[i] == SCR_ARR_VALUE) visit(scr_slot_to_ptr(a->data[i]), ctx);
|
|
438
440
|
}
|
|
@@ -486,6 +488,7 @@ ScrArr *scr_arr_new_ref(void *(*elem_retain)(void *),
|
|
|
486
488
|
a->props = NULL;
|
|
487
489
|
a->prop_len = 0;
|
|
488
490
|
a->prop_cap = 0;
|
|
491
|
+
a->metadata = NULL;
|
|
489
492
|
if (initial_cap > 0) scr_arr_grow_dense(a, initial_cap);
|
|
490
493
|
#ifdef SCR_RC_AUDIT
|
|
491
494
|
scr_live_arrays++;
|
|
@@ -497,6 +500,8 @@ void scr_arr_release(ScrArr *a) {
|
|
|
497
500
|
if (!a || a->rc == SIZE_MAX) return; /* NULL: an uninitialized `let` local */
|
|
498
501
|
if (--a->rc == 0) {
|
|
499
502
|
if (a->elem_trace) scr_cyc_on_dead(a);
|
|
503
|
+
scr_dyn_release(a->metadata);
|
|
504
|
+
a->metadata = NULL;
|
|
500
505
|
if (scr_elem_is_ref(a->elem)) {
|
|
501
506
|
for (size_t i = 0; i < a->cap; i++) {
|
|
502
507
|
if (a->present[i] != SCR_ARR_HOLE) {
|
|
@@ -534,6 +539,7 @@ void scr_arr_release(ScrArr *a) {
|
|
|
534
539
|
#ifdef SCR_RC_AUDIT
|
|
535
540
|
scr_live_arrays--;
|
|
536
541
|
#endif
|
|
542
|
+
scr_weak_dispose(a);
|
|
537
543
|
free(a);
|
|
538
544
|
}
|
|
539
545
|
} else if (a->elem_trace) {
|
|
@@ -1442,3 +1448,13 @@ ScrStr *scr_str_raw(ScrArr *raw, ScrArr *subs) {
|
|
|
1442
1448
|
free(buf);
|
|
1443
1449
|
return out;
|
|
1444
1450
|
}
|
|
1451
|
+
|
|
1452
|
+
void scr_arr_copy_metadata(ScrArr *a, ScrDyn *target) {
|
|
1453
|
+
if (!a->metadata) return;
|
|
1454
|
+
for (size_t i = 0; i < a->metadata->v.obj.len; i++) {
|
|
1455
|
+
ScrDynEntry *entry = &a->metadata->v.obj.entries[i];
|
|
1456
|
+
ScrStr *key = scr_str_new(entry->key, entry->key_len);
|
|
1457
|
+
scr_dyn_key_set(target, key, entry->value);
|
|
1458
|
+
scr_str_release(key);
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
@@ -134,6 +134,7 @@ void scr_assert_fail_msg(ScrStr *message) {
|
|
|
134
134
|
scr_str_release(message); /* scr_error_new retained its copy */
|
|
135
135
|
scr_str_release(e->name);
|
|
136
136
|
e->name = scr_str_new("AssertionError", 14);
|
|
137
|
+
e->name_present = true;
|
|
137
138
|
scr_error_set_code(e, "ERR_ASSERTION");
|
|
138
139
|
scr_throw_obj(e, &scr_error_retain_v, &scr_error_release_v, scr_error_trace_arg());
|
|
139
140
|
}
|
|
@@ -153,8 +153,11 @@ enum { SCR_PROM_PENDING = 0, SCR_PROM_FULFILLED = 1, SCR_PROM_REJECTED = 2 };
|
|
|
153
153
|
|
|
154
154
|
typedef struct ScrFiber ScrFiber;
|
|
155
155
|
|
|
156
|
+
typedef struct { size_t rc; } ScrPromiseIdentity;
|
|
157
|
+
|
|
156
158
|
struct ScrPromise {
|
|
157
|
-
size_t rc;
|
|
159
|
+
size_t rc; /* The cycle collector reads the reference count at offset zero. */
|
|
160
|
+
ScrPromiseIdentity *identity;
|
|
158
161
|
int state;
|
|
159
162
|
bool top_level_handled; /* uncaughtException handled entry evaluation */
|
|
160
163
|
/* Payload (fulfillment value or rejection reason), ScrExcCell-style.
|
|
@@ -257,6 +260,7 @@ static void scr_promise_gcfree(void *o) {
|
|
|
257
260
|
for (size_t i = 0; i < p->ncbs; i++) {
|
|
258
261
|
if (p->cbs[i].all) scr_promise_all_state_release(p->cbs[i].all);
|
|
259
262
|
}
|
|
263
|
+
if (--p->identity->rc == 0) free(p->identity);
|
|
260
264
|
free(p->waiters);
|
|
261
265
|
free(p->cbs);
|
|
262
266
|
#ifdef SCR_RC_AUDIT
|
|
@@ -268,12 +272,26 @@ static void scr_promise_gcfree(void *o) {
|
|
|
268
272
|
ScrPromise *scr_promise_new(void) {
|
|
269
273
|
ScrPromise *p = scr_cyc_alloc(sizeof *p, &scr_promise_trace, &scr_promise_gcfree);
|
|
270
274
|
p->rc = 1;
|
|
275
|
+
p->identity = malloc(sizeof *p->identity);
|
|
276
|
+
if (!p->identity) scr_oom();
|
|
277
|
+
p->identity->rc = 1;
|
|
271
278
|
#ifdef SCR_RC_AUDIT
|
|
272
279
|
scr_live_promises++;
|
|
273
280
|
#endif
|
|
274
281
|
return p;
|
|
275
282
|
}
|
|
276
283
|
|
|
284
|
+
void scr_promise_share_identity(ScrPromise *dst, ScrPromise *src) {
|
|
285
|
+
if (dst->identity == src->identity) return;
|
|
286
|
+
if (--dst->identity->rc == 0) free(dst->identity);
|
|
287
|
+
dst->identity = src->identity;
|
|
288
|
+
dst->identity->rc++;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
bool scr_promise_identity_equal(ScrPromise *a, ScrPromise *b) {
|
|
292
|
+
return a->identity == b->identity;
|
|
293
|
+
}
|
|
294
|
+
|
|
277
295
|
/* The 'rejectionHandled' hook (scr_async_dyn.c installs it at listener
|
|
278
296
|
* registration — the scr_urj_deliver_fn pattern, so listener-free
|
|
279
297
|
* binaries keep their size class): called when a promise the checkpoint
|
|
@@ -328,6 +346,7 @@ void scr_promise_release(ScrPromise *p) {
|
|
|
328
346
|
if (--p->rc == 0) {
|
|
329
347
|
scr_cyc_on_dead(p);
|
|
330
348
|
scr_promise_release_payload(p);
|
|
349
|
+
if (--p->identity->rc == 0) free(p->identity);
|
|
331
350
|
free(p->waiters);
|
|
332
351
|
for (size_t i = 0; i < p->ncbs; i++) {
|
|
333
352
|
scr_promise_release(p->cbs[i].dst);
|
|
@@ -1240,8 +1259,10 @@ static void scr_fiber_finish(ScrFiber *self) {
|
|
|
1240
1259
|
* (moved from the fiber's cell into the promise). */
|
|
1241
1260
|
scr_promise_reject_from_cell(p, &self->exc);
|
|
1242
1261
|
}
|
|
1243
|
-
/*
|
|
1244
|
-
|
|
1262
|
+
/* A returned checked promise may still be resolving after its function
|
|
1263
|
+
* body finishes. Its resolver owns settlement and must not wake awaiters
|
|
1264
|
+
* until adoption completes (WASI continuations cannot park a C stack). */
|
|
1265
|
+
if (p->state != SCR_PROM_PENDING) scr_promise_settle_wake(p);
|
|
1245
1266
|
self->done = true;
|
|
1246
1267
|
}
|
|
1247
1268
|
|
|
@@ -2127,6 +2148,7 @@ void scr_fs_rename_thunk0(ScrClosure *cb, ScrError *err) {
|
|
|
2127
2148
|
* the emitted callback adapter. */
|
|
2128
2149
|
typedef struct ScrCryptoBytesOp {
|
|
2129
2150
|
ScrBytes *value;
|
|
2151
|
+
ScrError *error;
|
|
2130
2152
|
ScrClosure *cb;
|
|
2131
2153
|
ScrCryptoBytesFn fn;
|
|
2132
2154
|
struct ScrCryptoBytesOp *next;
|
|
@@ -2142,6 +2164,7 @@ static void scr_crypto_bytes_shutdown(void) {
|
|
|
2142
2164
|
ScrCryptoBytesOp *op = scr_crypto_bytes_head;
|
|
2143
2165
|
scr_crypto_bytes_head = op->next;
|
|
2144
2166
|
scr_bytes_release(op->value);
|
|
2167
|
+
scr_error_release(op->error);
|
|
2145
2168
|
scr_closure_release(op->cb);
|
|
2146
2169
|
free(op);
|
|
2147
2170
|
}
|
|
@@ -2159,16 +2182,18 @@ static bool scr_crypto_bytes_dispatch(void) {
|
|
|
2159
2182
|
scr_crypto_bytes_head = op->next;
|
|
2160
2183
|
if (scr_crypto_bytes_head == NULL) scr_crypto_bytes_tail = &scr_crypto_bytes_head;
|
|
2161
2184
|
scr_crypto_bytes_pending_count--;
|
|
2162
|
-
op->fn(op->cb, op->value); /* adapter consumes value */
|
|
2185
|
+
op->fn(op->cb, op->error, op->value); /* adapter consumes value */
|
|
2186
|
+
scr_error_release(op->error);
|
|
2163
2187
|
scr_closure_release(op->cb);
|
|
2164
2188
|
free(op);
|
|
2165
2189
|
return true;
|
|
2166
2190
|
}
|
|
2167
2191
|
|
|
2168
|
-
void scr_crypto_defer_bytes(ScrBytes *value, ScrClosure *cb, ScrCryptoBytesFn fn) {
|
|
2192
|
+
void scr_crypto_defer_bytes(ScrBytes *value, ScrError *error, ScrClosure *cb, ScrCryptoBytesFn fn) {
|
|
2169
2193
|
if (!scr_crypto_bytes_cleanup_registered) {
|
|
2170
2194
|
if (atexit(scr_crypto_bytes_shutdown) != 0) {
|
|
2171
2195
|
scr_bytes_release(value);
|
|
2196
|
+
scr_error_release(error);
|
|
2172
2197
|
scr_closure_release(cb);
|
|
2173
2198
|
scr_trap("scriptc: could not register crypto callback cleanup\n");
|
|
2174
2199
|
}
|
|
@@ -2177,10 +2202,12 @@ void scr_crypto_defer_bytes(ScrBytes *value, ScrClosure *cb, ScrCryptoBytesFn fn
|
|
|
2177
2202
|
ScrCryptoBytesOp *op = malloc(sizeof *op);
|
|
2178
2203
|
if (!op) {
|
|
2179
2204
|
scr_bytes_release(value);
|
|
2205
|
+
scr_error_release(error);
|
|
2180
2206
|
scr_closure_release(cb);
|
|
2181
2207
|
scr_trap("scriptc: out of memory\n");
|
|
2182
2208
|
}
|
|
2183
2209
|
op->value = value;
|
|
2210
|
+
op->error = error;
|
|
2184
2211
|
op->cb = cb;
|
|
2185
2212
|
op->fn = fn;
|
|
2186
2213
|
op->next = NULL;
|
|
@@ -3298,6 +3325,7 @@ static void scr_gen_exc_move(ScrExcCell *dst, ScrExcCell *src) {
|
|
|
3298
3325
|
|
|
3299
3326
|
struct ScrGen {
|
|
3300
3327
|
size_t rc;
|
|
3328
|
+
ScrDyn *receiver;
|
|
3301
3329
|
ScrFiber *fiber; /* NULL once torn down (done, or unstarted release) */
|
|
3302
3330
|
int state;
|
|
3303
3331
|
ScrGenSlot out; /* yielded value / completion value */
|
|
@@ -3322,6 +3350,7 @@ static ScrGen *scr_gen_new_common(void (*entry)(ScrFiber *, void *), void *argpa
|
|
|
3322
3350
|
ScrGen *g = calloc(1, sizeof *g);
|
|
3323
3351
|
if (!g) scr_oom();
|
|
3324
3352
|
g->rc = 1;
|
|
3353
|
+
g->receiver = scr_dyn_this_get();
|
|
3325
3354
|
g->state = SCR_GEN_UNSTARTED;
|
|
3326
3355
|
g->drop_args = drop_args;
|
|
3327
3356
|
g->is_async = settle_async != NULL;
|
|
@@ -3368,6 +3397,7 @@ ScrGen *scr_gen_retain(ScrGen *g) {
|
|
|
3368
3397
|
|
|
3369
3398
|
void scr_gen_release(ScrGen *g) {
|
|
3370
3399
|
if (!g || --g->rc != 0) return;
|
|
3400
|
+
scr_dyn_release(g->receiver);
|
|
3371
3401
|
scr_gen_slot_reset(&g->out);
|
|
3372
3402
|
scr_gen_slot_reset(&g->in);
|
|
3373
3403
|
scr_gen_slot_reset(&g->ret);
|
|
@@ -3399,6 +3429,9 @@ void scr_gen_release_v(void *g) { scr_gen_release((ScrGen *)g); }
|
|
|
3399
3429
|
|
|
3400
3430
|
bool scr_gen_done(ScrGen *g) { return g->state == SCR_GEN_DONE; }
|
|
3401
3431
|
ScrGen *scr_gen_of_fiber(ScrFiber *f) { return f->gen; }
|
|
3432
|
+
ScrDyn *scr_gen_receiver(void) {
|
|
3433
|
+
return scr_dyn_retain(scr_current && scr_current->gen ? scr_current->gen->receiver : scr_dyn_undefined());
|
|
3434
|
+
}
|
|
3402
3435
|
|
|
3403
3436
|
/* Slot setters (release the previous occupant; payloads MOVE in). */
|
|
3404
3437
|
static void scr_gen_slot_f64(ScrGenSlot *s, double v) {
|
|
@@ -421,6 +421,24 @@ typedef struct {
|
|
|
421
421
|
ScrDyn *onf, *onr, *onfin; /* owned or NULL */
|
|
422
422
|
} ScrDynThenPack;
|
|
423
423
|
|
|
424
|
+
typedef struct {
|
|
425
|
+
ScrPromise *src, *dst;
|
|
426
|
+
ScrDyn *result;
|
|
427
|
+
} ScrDynFinallyPack;
|
|
428
|
+
|
|
429
|
+
static void scr_dyn_finally_entry(ScrFiber *self, void *opaque) {
|
|
430
|
+
(void)self;
|
|
431
|
+
ScrDynFinallyPack *pack = opaque;
|
|
432
|
+
ScrDyn *result = scr_await_dyn(pack->result->v.promise);
|
|
433
|
+
if (scr_exc_pending()) scr_promise_reject_pending(pack->dst);
|
|
434
|
+
else scr_promise_adapt_copy(pack->dst, pack->src);
|
|
435
|
+
scr_dyn_release(result);
|
|
436
|
+
scr_dyn_release(pack->result);
|
|
437
|
+
scr_promise_release(pack->src);
|
|
438
|
+
scr_promise_release(pack->dst);
|
|
439
|
+
free(pack);
|
|
440
|
+
}
|
|
441
|
+
|
|
424
442
|
static void scr_dyn_then_entry(ScrFiber *self, void *ap) {
|
|
425
443
|
(void)self;
|
|
426
444
|
ScrDynThenPack *a = (ScrDynThenPack *)ap;
|
|
@@ -428,7 +446,7 @@ static void scr_dyn_then_entry(ScrFiber *self, void *ap) {
|
|
|
428
446
|
bool rejected = scr_exc_pending();
|
|
429
447
|
ScrCaught *c = rejected ? scr_exc_take() : NULL;
|
|
430
448
|
ScrDyn *handler = a->onfin ? a->onfin : (rejected ? a->onr : a->onf);
|
|
431
|
-
if (handler != NULL && handler
|
|
449
|
+
if (handler != NULL && scr_dyn_is_callable(handler)) {
|
|
432
450
|
ScrDyn *arg = NULL;
|
|
433
451
|
if (a->onfin == NULL) arg = rejected ? scr_caught_to_dyn(c) : scr_dyn_retain(v);
|
|
434
452
|
ScrDyn *r = scr_dyn_call(handler, arg ? &arg : NULL, arg ? 1 : 0, "handler");
|
|
@@ -437,30 +455,27 @@ static void scr_dyn_then_entry(ScrFiber *self, void *ap) {
|
|
|
437
455
|
/* The handler threw: dst rejects with that. */
|
|
438
456
|
scr_promise_reject_pending(a->dst);
|
|
439
457
|
} else if (a->onfin != NULL) {
|
|
440
|
-
/* finally
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
scr_promise_fulfill_ref(a->dst, scr_dyn_retain(v), scr_dyn_retain_v, scr_dyn_release_v, NULL);
|
|
458
|
+
/* finally returns PromiseResolve(result).then(valueThunk), which
|
|
459
|
+
* the outer reaction adopts. Even an undefined result takes those
|
|
460
|
+
* jobs before propagating the original fulfillment or rejection. */
|
|
461
|
+
if (r->kind != SCR_DYN_PROMISE) {
|
|
462
|
+
ScrPromise *result = scr_promise_new();
|
|
463
|
+
scr_promise_fulfill_ref(result, r, scr_dyn_retain_v, scr_dyn_release_v, scr_dyn_trace_v);
|
|
464
|
+
r = scr_dyn_new_promise(result);
|
|
465
|
+
scr_promise_release(result);
|
|
449
466
|
}
|
|
467
|
+
ScrPromise *passthrough = scr_promise_new();
|
|
468
|
+
ScrDynFinallyPack *pack = malloc(sizeof *pack);
|
|
469
|
+
if (!pack) scr_ad_oom();
|
|
470
|
+
pack->src = scr_promise_retain(a->src);
|
|
471
|
+
pack->dst = scr_promise_retain(passthrough);
|
|
472
|
+
pack->result = r;
|
|
473
|
+
ScrPromise *waiter = scr_async_spawn_after(r->v.promise, scr_dyn_finally_entry, pack);
|
|
474
|
+
scr_promise_release(waiter);
|
|
475
|
+
scr_promise_resolve_dyn(a->dst, scr_dyn_new_promise(passthrough));
|
|
476
|
+
scr_promise_release(passthrough);
|
|
450
477
|
} else {
|
|
451
|
-
|
|
452
|
-
while (r != NULL && r->kind == SCR_DYN_PROMISE) {
|
|
453
|
-
ScrDyn *inner = scr_await_dyn(r->v.promise);
|
|
454
|
-
scr_dyn_release(r);
|
|
455
|
-
r = inner;
|
|
456
|
-
if (scr_exc_pending()) {
|
|
457
|
-
scr_promise_reject_pending(a->dst);
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
if (r != NULL) {
|
|
462
|
-
scr_promise_fulfill_ref(a->dst, r, scr_dyn_retain_v, scr_dyn_release_v, NULL);
|
|
463
|
-
}
|
|
478
|
+
scr_promise_resolve_dyn(a->dst, r);
|
|
464
479
|
}
|
|
465
480
|
} else if (rejected) {
|
|
466
481
|
scr_rethrow(c);
|
|
@@ -492,10 +507,75 @@ ScrDyn *scr_dyn_promise_then(ScrPromise *src, ScrDyn *onf, ScrDyn *onr, ScrDyn *
|
|
|
492
507
|
a->onr = onr ? scr_dyn_retain(onr) : NULL;
|
|
493
508
|
a->onfin = onfin ? scr_dyn_retain(onfin) : NULL;
|
|
494
509
|
ScrDyn *boxed = scr_dyn_new_promise(a->dst);
|
|
495
|
-
ScrPromise *waiter =
|
|
510
|
+
ScrPromise *waiter = scr_async_spawn_after(src, scr_dyn_then_entry, a);
|
|
496
511
|
scr_promise_release(waiter); /* the entry never rejects; nobody awaits it */
|
|
497
512
|
return boxed;
|
|
498
513
|
}
|
|
514
|
+
typedef struct {
|
|
515
|
+
ScrPromise *destination;
|
|
516
|
+
ScrDyn *value;
|
|
517
|
+
} ScrDynResolvePack;
|
|
518
|
+
|
|
519
|
+
static void scr_dyn_resolve_entry(ScrFiber *self, void *opaque) {
|
|
520
|
+
(void)self;
|
|
521
|
+
ScrDynResolvePack *pack = opaque;
|
|
522
|
+
#ifndef __wasi__
|
|
523
|
+
/* Promise resolution schedules a job before attaching its reaction. */
|
|
524
|
+
scr_await_hop();
|
|
525
|
+
#endif
|
|
526
|
+
ScrDyn *value = scr_await_dyn(pack->value->v.promise);
|
|
527
|
+
if (scr_exc_pending()) scr_promise_reject_pending(pack->destination);
|
|
528
|
+
else scr_promise_resolve_dyn(pack->destination, value);
|
|
529
|
+
scr_dyn_release(pack->value);
|
|
530
|
+
scr_promise_release(pack->destination);
|
|
531
|
+
free(pack);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
#ifdef __wasi__
|
|
535
|
+
static void scr_dyn_resolve_job(ScrClosure *closure) {
|
|
536
|
+
ScrPromise *destination = scr_box_get_ref(closure->caps[0]);
|
|
537
|
+
ScrDyn *value = scr_box_get_ref(closure->caps[1]);
|
|
538
|
+
ScrDynResolvePack *pack = malloc(sizeof *pack);
|
|
539
|
+
if (!pack) scr_ad_oom();
|
|
540
|
+
pack->destination = destination;
|
|
541
|
+
pack->value = value;
|
|
542
|
+
ScrPromise *waiter = scr_async_spawn_after(value->v.promise, scr_dyn_resolve_entry, pack);
|
|
543
|
+
scr_promise_release(waiter);
|
|
544
|
+
}
|
|
545
|
+
#endif
|
|
546
|
+
|
|
547
|
+
/* The destination is borrowed; value moves in. An async function may
|
|
548
|
+
* return a native promise hidden behind any/unknown without an explicit
|
|
549
|
+
* await, so its completion must use resolution rather than fulfillment. */
|
|
550
|
+
void scr_promise_resolve_dyn(ScrPromise *destination, ScrDyn *value) {
|
|
551
|
+
if (value->kind != SCR_DYN_PROMISE) {
|
|
552
|
+
scr_promise_fulfill_ref(destination, value, scr_dyn_retain_v, scr_dyn_release_v, scr_dyn_trace_v);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (value->v.promise == destination) {
|
|
556
|
+
static const char message[] = "Chaining cycle detected for promise #<Promise>";
|
|
557
|
+
scr_throw_error_msg(SCR_ERR_TYPE, message, sizeof message - 1);
|
|
558
|
+
scr_promise_reject_pending(destination);
|
|
559
|
+
scr_dyn_release(value);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
#ifdef __wasi__
|
|
563
|
+
ScrClosure *job = scr_closure_new((void *)scr_dyn_resolve_job, 2);
|
|
564
|
+
job->caps[0] = scr_box_new_obj(scr_promise_retain_v, scr_promise_release_v, scr_promise_trace_v);
|
|
565
|
+
scr_box_set_ref(job->caps[0], scr_promise_retain(destination));
|
|
566
|
+
job->caps[1] = scr_box_new_obj(scr_dyn_retain_v, scr_dyn_release_v, scr_dyn_trace_v);
|
|
567
|
+
scr_box_set_ref(job->caps[1], value);
|
|
568
|
+
scr_queue_microtask(job);
|
|
569
|
+
#else
|
|
570
|
+
ScrDynResolvePack *pack = malloc(sizeof *pack);
|
|
571
|
+
if (!pack) scr_ad_oom();
|
|
572
|
+
pack->destination = scr_promise_retain(destination);
|
|
573
|
+
pack->value = value;
|
|
574
|
+
ScrPromise *waiter = scr_async_spawn(scr_dyn_resolve_entry, pack);
|
|
575
|
+
scr_promise_release(waiter);
|
|
576
|
+
#endif
|
|
577
|
+
}
|
|
578
|
+
|
|
499
579
|
/* `await v` where v is a CHECKED-DYNAMIC value: a dyn promise adopts
|
|
500
580
|
* (the boxed promise awaits — rejections re-throw); every other kind is
|
|
501
581
|
* JS's await-of-a-non-thenable — one microtask hop, the value itself
|
|
@@ -507,6 +587,13 @@ ScrDyn *scr_await_dyn_value(ScrDyn *v) {
|
|
|
507
587
|
return scr_dyn_retain(v);
|
|
508
588
|
}
|
|
509
589
|
|
|
590
|
+
/* The WASI emitter has already suspended on the value's actual promise,
|
|
591
|
+
* or taken the non-promise microtask hop. Extraction must never suspend a
|
|
592
|
+
* runtime-authored C frame. */
|
|
593
|
+
ScrDyn *scr_await_dyn_value_settled(ScrDyn *value) {
|
|
594
|
+
return value->kind == SCR_DYN_PROMISE ? scr_await_dyn(value->v.promise) : scr_dyn_retain(value);
|
|
595
|
+
}
|
|
596
|
+
|
|
510
597
|
/* ── process warnings (emitWarning + the 'warning' event) ─────────────
|
|
511
598
|
* Gated with the rest of this TU (a deprecation-emitting unit's gate
|
|
512
599
|
* must imply the dynAsync link). Listeners are dyn functions; emission
|
|
@@ -597,6 +684,7 @@ void scr_emit_warning(const char *name, const char *code, ScrStr *message) {
|
|
|
597
684
|
ScrError *e = scr_error_new(SCR_ERR_ERROR, message);
|
|
598
685
|
scr_str_release(e->name);
|
|
599
686
|
e->name = scr_str_new(name ? name : "Warning", strlen(name ? name : "Warning"));
|
|
687
|
+
e->name_present = true;
|
|
600
688
|
if (code) e->code = scr_str_new(code, strlen(code));
|
|
601
689
|
ScrDyn *w = scr_dyn_from_error(e);
|
|
602
690
|
scr_error_release(e);
|
|
@@ -670,6 +758,7 @@ void scr_process_emit_warning(ScrDyn *args) {
|
|
|
670
758
|
ScrError *e = scr_error_new(SCR_ERR_ERROR, (ScrStr *)warning->v.str);
|
|
671
759
|
scr_str_release(e->name);
|
|
672
760
|
e->name = type ? scr_str_retain((ScrStr *)type) : scr_str_new("Warning", 7);
|
|
761
|
+
e->name_present = true;
|
|
673
762
|
if (code) e->code = scr_str_retain((ScrStr *)code);
|
|
674
763
|
ScrDyn *w = scr_dyn_from_error(e);
|
|
675
764
|
scr_error_release(e);
|
|
@@ -689,22 +778,6 @@ void scr_process_emit_warning(ScrDyn *args) {
|
|
|
689
778
|
* (SEMANTICS.md 67). Shared by the dc trace choreography, the checked-dynamic tree
|
|
690
779
|
* promise reactions, and the unhandled-rejection dispatch. Borrows the
|
|
691
780
|
* box; result +1. */
|
|
692
|
-
ScrDyn *scr_caught_to_dyn(const ScrCaught *c) {
|
|
693
|
-
switch (c->kind) {
|
|
694
|
-
case SCR_EXC_F64: return scr_dyn_new_num(c->f64);
|
|
695
|
-
case SCR_EXC_BOOL: return scr_dyn_new_bool(c->b);
|
|
696
|
-
case SCR_EXC_STR: return scr_dyn_new_str((ScrStr *)c->payload);
|
|
697
|
-
case SCR_EXC_REF:
|
|
698
|
-
case SCR_EXC_PRIMITIVE_REF:
|
|
699
|
-
if (c->retain_fn == scr_dyn_retain_v) return scr_dyn_retain((ScrDyn *)c->payload);
|
|
700
|
-
return scr_dyn_new_obj();
|
|
701
|
-
case SCR_EXC_OBJ:
|
|
702
|
-
if (scr_error_is(c->payload)) return scr_dyn_from_error((const ScrError *)c->payload);
|
|
703
|
-
return scr_dyn_new_obj();
|
|
704
|
-
default:
|
|
705
|
-
return scr_dyn_new_obj();
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
781
|
|
|
709
782
|
/* Await a dyn-CROSSING promise (SCR_DYN_PROMISE's boundary contract —
|
|
710
783
|
* dyn or void fulfillment): the payload as a dyn value (+1; a void
|
|
@@ -777,7 +850,10 @@ ScrDyn *scr_promise_reason_dyn(const ScrPromise *p) {
|
|
|
777
850
|
* promise<dyn> directly and every other inner type through the adapting
|
|
778
851
|
* constructor below. */
|
|
779
852
|
|
|
853
|
+
extern bool (*scr_dyn_promise_identity_fn)(ScrPromise *, ScrPromise *);
|
|
854
|
+
|
|
780
855
|
ScrDyn *scr_dyn_new_promise(ScrPromise *p) {
|
|
856
|
+
scr_dyn_promise_identity_fn = scr_promise_identity_equal;
|
|
781
857
|
ScrDyn *d = scr_dyn_alloc_promise(scr_promise_release);
|
|
782
858
|
d->v.promise = scr_promise_retain(p);
|
|
783
859
|
return d;
|
|
@@ -792,6 +868,8 @@ ScrDyn *scr_dyn_new_promise(ScrPromise *p) {
|
|
|
792
868
|
ScrDyn *scr_dyn_new_promise_adapting(ScrPromise *src,
|
|
793
869
|
void (*adapt)(ScrPromise *dst, ScrPromise *src)) {
|
|
794
870
|
ScrPromise *dst = scr_promise_new();
|
|
871
|
+
scr_promise_share_identity(dst, src);
|
|
872
|
+
scr_dyn_promise_identity_fn = scr_promise_identity_equal;
|
|
795
873
|
scr_promise_race_add(dst, src, adapt);
|
|
796
874
|
ScrDyn *d = scr_dyn_alloc_promise(scr_promise_release);
|
|
797
875
|
d->v.promise = dst; /* the constructor's +1 moves in */
|
|
@@ -801,3 +879,93 @@ ScrDyn *scr_dyn_new_promise_adapting(ScrPromise *src,
|
|
|
801
879
|
ScrPromise *scr_dyn_promise_of(const ScrDyn *d) {
|
|
802
880
|
return d->kind == SCR_DYN_PROMISE ? d->v.promise : NULL;
|
|
803
881
|
}
|
|
882
|
+
|
|
883
|
+
static void scr_dyn_all_result(ScrPromise *destination, ScrPromise *source) {
|
|
884
|
+
ScrArr *values = scr_promise_payload_ref(source);
|
|
885
|
+
ScrDyn *result = scr_dyn_new_arr();
|
|
886
|
+
for (size_t i = 0; i < values->len; i++) scr_dyn_arr_push(result, scr_arr_get_ref(values, (double)i));
|
|
887
|
+
scr_arr_release(values);
|
|
888
|
+
scr_promise_fulfill_ref(destination, result, scr_dyn_retain_v, scr_dyn_release_v, scr_dyn_trace_v);
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
ScrPromise *scr_dyn_promise_all(const ScrDyn *entries) {
|
|
892
|
+
ScrArr *promises = scr_arr_new_ref(scr_promise_retain_v, scr_promise_release_v, scr_promise_trace_v, entries->v.arr.len);
|
|
893
|
+
ScrArr *values = scr_arr_new_ref(scr_dyn_retain_v, scr_dyn_release_v, scr_dyn_trace_v, entries->v.arr.len);
|
|
894
|
+
for (size_t i = 0; i < entries->v.arr.len; i++) {
|
|
895
|
+
ScrDyn *value = entries->v.arr.items[i];
|
|
896
|
+
ScrPromise *source;
|
|
897
|
+
if (value->kind == SCR_DYN_PROMISE) source = scr_promise_retain(value->v.promise);
|
|
898
|
+
else {
|
|
899
|
+
source = scr_promise_new();
|
|
900
|
+
if (value->kind == SCR_DYN_OBJ || value->kind == SCR_DYN_FUNC || value->kind == SCR_DYN_PROXY) {
|
|
901
|
+
ScrStr *key = scr_str_new("then", 4);
|
|
902
|
+
ScrDyn *then = value->kind == SCR_DYN_PROXY ? scr_dyn_proxy_get(value, key)
|
|
903
|
+
: value->kind == SCR_DYN_FUNC ? scr_dyn_fn_get(value, "then", 4) : scr_dyn_obj_read(value, "then", 4);
|
|
904
|
+
scr_str_release(key);
|
|
905
|
+
if (then && then->kind == SCR_DYN_FUNC) {
|
|
906
|
+
static const char message[] = "Promise.all over custom thenables is not supported yet";
|
|
907
|
+
scr_throw_error_msg_code(SCR_ERR_ERROR, message, sizeof message - 1, "SC2020");
|
|
908
|
+
}
|
|
909
|
+
scr_dyn_release(then);
|
|
910
|
+
}
|
|
911
|
+
if (scr_exc_pending()) scr_promise_reject_pending(source);
|
|
912
|
+
else scr_promise_fulfill_ref(source, scr_dyn_retain(value), scr_dyn_retain_v, scr_dyn_release_v, scr_dyn_trace_v);
|
|
913
|
+
}
|
|
914
|
+
/* Each element contributes a reaction job, even an already fulfilled
|
|
915
|
+
* plain value. The aggregate preserves input order and Node's hops. */
|
|
916
|
+
scr_promise_mark_handled(source);
|
|
917
|
+
ScrDyn *reaction = scr_dyn_promise_then(source, NULL, NULL, NULL);
|
|
918
|
+
scr_arr_push_ref(promises, scr_promise_retain(reaction->v.promise));
|
|
919
|
+
scr_dyn_release(reaction);
|
|
920
|
+
scr_promise_release(source);
|
|
921
|
+
}
|
|
922
|
+
ScrPromise *all = scr_promise_all(promises, values, scr_promise_all_store_ref);
|
|
923
|
+
ScrPromise *result = scr_promise_new();
|
|
924
|
+
scr_promise_race_add(result, all, scr_dyn_all_result);
|
|
925
|
+
scr_promise_release(all);
|
|
926
|
+
scr_arr_release(values);
|
|
927
|
+
scr_arr_release(promises);
|
|
928
|
+
return result;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/* The checked native WebCrypto digest entry keeps promise and ArrayBuffer results native. */
|
|
932
|
+
static ScrDyn *scr_crypto_digest_call(ScrClosure *closure, ScrDyn *const *args, size_t argc) {
|
|
933
|
+
(void)closure;
|
|
934
|
+
ScrPromise *promise = scr_promise_new();
|
|
935
|
+
ScrDyn *algorithm = argc ? args[0] : scr_dyn_undefined();
|
|
936
|
+
ScrDyn *name = algorithm->kind == SCR_DYN_OBJ ? scr_dyn_obj_read(algorithm, "name", 4) : scr_dyn_retain(algorithm);
|
|
937
|
+
ScrStr *text = name ? scr_dyn_string_coerce_js(name) : NULL;
|
|
938
|
+
scr_dyn_release(name);
|
|
939
|
+
ScrBytes *bytes = argc > 1 && args[1]->kind == SCR_DYN_BYTES ? scr_dyn_bytes_unbox(args[1]) : NULL;
|
|
940
|
+
if (!bytes && argc > 1 && scr_array_buffer_is(args[1])) bytes = scr_array_buffer_view(SCR_BYTES_U8, args[1], scr_dyn_undefined(), scr_dyn_undefined());
|
|
941
|
+
const char *native = NULL;
|
|
942
|
+
if (text) {
|
|
943
|
+
if (text->len == 7 && strncasecmp(text->data, "SHA-256", 7) == 0) native = "sha256";
|
|
944
|
+
else if (text->len == 5 && strncasecmp(text->data, "SHA-1", 5) == 0) native = "sha1";
|
|
945
|
+
}
|
|
946
|
+
if (!text || !bytes || !native) {
|
|
947
|
+
static const char message[] = "Unsupported WebCrypto digest algorithm or BufferSource";
|
|
948
|
+
if (!scr_exc_pending()) scr_throw_error_msg_code(SCR_ERR_TYPE, message, sizeof message - 1, "SC2020");
|
|
949
|
+
scr_promise_reject_pending(promise);
|
|
950
|
+
} else {
|
|
951
|
+
ScrStr *alg = scr_str_new(native, strlen(native));
|
|
952
|
+
ScrCryptoHash *hash = scr_crypto_hash_new(alg);
|
|
953
|
+
scr_str_release(alg);
|
|
954
|
+
if (hash) {
|
|
955
|
+
scr_crypto_hash_update_bytes(hash, bytes);
|
|
956
|
+
ScrBytes *digest = scr_exc_pending() ? NULL : scr_crypto_hash_digest_buffer(hash);
|
|
957
|
+
scr_crypto_hash_release(hash);
|
|
958
|
+
if (digest) {
|
|
959
|
+
ScrDyn *buffer = scr_array_buffer_from_bytes(digest); scr_bytes_release(digest);
|
|
960
|
+
scr_promise_resolve_dyn(promise, buffer);
|
|
961
|
+
} else scr_promise_reject_pending(promise);
|
|
962
|
+
} else scr_promise_reject_pending(promise);
|
|
963
|
+
}
|
|
964
|
+
scr_str_release(text); scr_bytes_release(bytes);
|
|
965
|
+
ScrDyn *result = scr_dyn_new_promise(promise); scr_promise_release(promise); return result;
|
|
966
|
+
}
|
|
967
|
+
ScrDyn *scr_crypto_native(void) {
|
|
968
|
+
ScrDyn *subtle = scr_dyn_new_obj();
|
|
969
|
+
scr_dyn_obj_set(subtle, "digest", 6, scr_dyn_new_func(scr_closure_new(NULL, 0), scr_crypto_digest_call, 2, "crypto.subtle.digest", "digest"));
|
|
970
|
+
ScrDyn *result = scr_dyn_new_obj(); scr_dyn_obj_set(result, "subtle", 6, subtle); return result;
|
|
971
|
+
}
|
|
@@ -597,6 +597,14 @@ static ScrBigInt *bi_parse_string(ScrStr *s, bool report_error) {
|
|
|
597
597
|
|
|
598
598
|
ScrBigInt *scr_bigint_parse(ScrStr *s) { return bi_parse_string(s, true); }
|
|
599
599
|
|
|
600
|
+
double scr_bigint_cmp_string(ScrBigInt *a, ScrStr *b) {
|
|
601
|
+
ScrBigInt *parsed = bi_parse_string(b, false);
|
|
602
|
+
if (!parsed) return 2;
|
|
603
|
+
double result = scr_bigint_cmp_f64(a, parsed);
|
|
604
|
+
scr_bigint_release(parsed);
|
|
605
|
+
return result;
|
|
606
|
+
}
|
|
607
|
+
|
|
600
608
|
/* Abstract Equality's String/BigInt arm uses StringToBigInt without
|
|
601
609
|
* surfacing its parse failure: an invalid string compares false instead
|
|
602
610
|
* of throwing. BigInt(string) keeps the public throwing parser above. */
|