@scriptc/cli-darwin-x64 0.2.0 → 0.2.1
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 +25 -15
- package/dist/lib/llvm/bin/scriptc-llvm-codegen +0 -0
- package/dist/lib/llvm/package.json +1 -1
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/licenses/v8-number-radix.txt +61 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/package.json +1 -1
- package/dist/lib/runtime-darwin-x64/runtime-pack.json +529 -525
- package/dist/lib/runtime-sources/package.json +1 -1
- 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 +26 -1
- package/dist/lib/runtime-sources/src/scr_async_dyn.c +90 -16
- package/dist/lib/runtime-sources/src/scr_bigint.c +8 -0
- package/dist/lib/runtime-sources/src/scr_bytes.c +205 -41
- package/dist/lib/runtime-sources/src/scr_bytes_io.c +581 -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_dyn_invoke.c +164 -31
- 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 +266 -2
- package/dist/lib/runtime-sources/src/scr_http.c +3 -0
- package/dist/lib/runtime-sources/src/scr_island.c +38 -13
- package/dist/lib/runtime-sources/src/scr_json.c +1149 -91
- 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_regex.c +108 -69
- package/dist/lib/runtime-sources/src/scr_runtime.h +190 -33
- 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 +172 -3
- package/dist/lib/runtime-sources/vendor/v8-number-radix/LICENSE +61 -0
- package/package.json +1 -1
|
@@ -3176,6 +3176,7 @@ static SfResponse *sf_response_retain(SfResponse *r) {
|
|
|
3176
3176
|
|
|
3177
3177
|
static void sf_response_release(SfResponse *r) {
|
|
3178
3178
|
if (!r || --r->rc > 0) return;
|
|
3179
|
+
scr_weak_dispose(r);
|
|
3179
3180
|
sf_stream_release(r->body);
|
|
3180
3181
|
sf_headers_release(r->headers);
|
|
3181
3182
|
scr_str_release(r->url);
|
|
@@ -4057,11 +4058,17 @@ static ScrArr *sf_headers_convert_init(const ScrDyn *headers) {
|
|
|
4057
4058
|
if (headers->kind == SCR_DYN_ARR) {
|
|
4058
4059
|
for (size_t i = 0; i < headers->v.arr.len; i++) {
|
|
4059
4060
|
ScrDyn *pair = scr_dyn_retain(headers->v.arr.items[i]);
|
|
4061
|
+
if (pair->kind == SCR_DYN_TYPED_REF) {
|
|
4062
|
+
ScrDyn *materialized = scr_dyn_typed_ref_materialize(pair);
|
|
4063
|
+
scr_dyn_release(pair);
|
|
4064
|
+
pair = materialized;
|
|
4065
|
+
}
|
|
4060
4066
|
if (pair->kind != SCR_DYN_ARR || pair->v.arr.len != 2) {
|
|
4067
|
+
bool sequence = pair->kind == SCR_DYN_ARR;
|
|
4061
4068
|
size_t pair_len = pair->kind == SCR_DYN_ARR ? pair->v.arr.len : 0;
|
|
4062
4069
|
scr_dyn_release(pair);
|
|
4063
4070
|
if (!scr_exc_pending()) {
|
|
4064
|
-
if (
|
|
4071
|
+
if (sequence) {
|
|
4065
4072
|
sf_headers_pair_length_error(pair_len);
|
|
4066
4073
|
} else {
|
|
4067
4074
|
sf_headers_constructor_type_error();
|
|
@@ -5169,7 +5176,250 @@ fail:
|
|
|
5169
5176
|
return NULL;
|
|
5170
5177
|
}
|
|
5171
5178
|
|
|
5179
|
+
/* Request uses the same body stream and Headers ownership as Response. */
|
|
5180
|
+
typedef struct SfRequest {
|
|
5181
|
+
size_t rc;
|
|
5182
|
+
SfResponse *payload;
|
|
5183
|
+
ScrStr *url;
|
|
5184
|
+
ScrStr *method;
|
|
5185
|
+
ScrStr *redirect;
|
|
5186
|
+
SfSignal *signal;
|
|
5187
|
+
} SfRequest;
|
|
5188
|
+
|
|
5189
|
+
static void *sf_request_retain_v(void *ptr) {
|
|
5190
|
+
SfRequest *r = ptr; r->rc++; return r;
|
|
5191
|
+
}
|
|
5192
|
+
static void sf_request_release_v(void *ptr) {
|
|
5193
|
+
SfRequest *r = ptr;
|
|
5194
|
+
if (--r->rc) return;
|
|
5195
|
+
scr_weak_dispose(r);
|
|
5196
|
+
sf_response_release(r->payload);
|
|
5197
|
+
scr_str_release(r->url); scr_str_release(r->method); scr_str_release(r->redirect);
|
|
5198
|
+
sf_signal_release(r->signal); free(r);
|
|
5199
|
+
}
|
|
5200
|
+
static ScrDyn *sf_request_get(void *ptr, const char *key, size_t len) {
|
|
5201
|
+
SfRequest *r = ptr;
|
|
5202
|
+
if (sf_name(key, len, "url")) return scr_dyn_new_str(r->url);
|
|
5203
|
+
if (sf_name(key, len, "method")) return scr_dyn_new_str(r->method);
|
|
5204
|
+
if (sf_name(key, len, "redirect")) return scr_dyn_new_str(r->redirect);
|
|
5205
|
+
if (sf_name(key, len, "signal")) return scr_dyn_new_handle(r->signal, SCR_DYNH_ABORT_SIGNAL);
|
|
5206
|
+
if (sf_name(key, len, "duplex")) { ScrStr *s = scr_str_new("half", 4); ScrDyn *v = scr_dyn_new_str(s); scr_str_release(s); return v; }
|
|
5207
|
+
const char *default_value = NULL;
|
|
5208
|
+
if (sf_name(key, len, "destination") || sf_name(key, len, "integrity") || sf_name(key, len, "referrerPolicy")) default_value = "";
|
|
5209
|
+
if (sf_name(key, len, "mode")) default_value = "cors";
|
|
5210
|
+
if (sf_name(key, len, "credentials")) default_value = "same-origin";
|
|
5211
|
+
if (sf_name(key, len, "cache")) default_value = "default";
|
|
5212
|
+
if (sf_name(key, len, "referrer")) default_value = "about:client";
|
|
5213
|
+
if (default_value) { ScrStr *s = scr_str_new(default_value, strlen(default_value)); ScrDyn *v = scr_dyn_new_str(s); scr_str_release(s); return v; }
|
|
5214
|
+
if (sf_name(key, len, "keepalive") || sf_name(key, len, "isReloadNavigation") || sf_name(key, len, "isHistoryNavigation")) return scr_dyn_new_bool(false);
|
|
5215
|
+
if (sf_name(key, len, "body") || sf_name(key, len, "bodyUsed") || sf_name(key, len, "headers")) return sf_response_get(r->payload, key, len);
|
|
5216
|
+
return scr_dyn_undefined();
|
|
5217
|
+
}
|
|
5218
|
+
static ScrDyn *sf_request_invoke(void *ptr, ScrDyn *self, const char *method, ScrDyn *const *args, size_t argc, const char *what) {
|
|
5219
|
+
SfRequest *r = ptr;
|
|
5220
|
+
return sf_response_invoke(r->payload, self, method, args, argc, what);
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5223
|
+
ScrDyn *scr_fetch_headers_new(ScrDyn *init) {
|
|
5224
|
+
ScrArr *converted = sf_headers_convert_init(init);
|
|
5225
|
+
if (!converted) return NULL;
|
|
5226
|
+
ScrArr *pairs = scr_arr_new(SCR_ELEM_STR, 8);
|
|
5227
|
+
bool ok = sf_add_converted_headers(pairs, converted, false);
|
|
5228
|
+
scr_arr_release(converted);
|
|
5229
|
+
if (!ok) { scr_arr_release(pairs); return NULL; }
|
|
5230
|
+
SfHeaders *headers = sf_headers_new(pairs, false);
|
|
5231
|
+
ScrDyn *result = scr_dyn_new_handle(headers, SCR_DYNH_FETCH_HEADERS);
|
|
5232
|
+
sf_headers_release(headers);
|
|
5233
|
+
return result;
|
|
5234
|
+
}
|
|
5235
|
+
|
|
5236
|
+
ScrDyn *scr_fetch_request_new(ScrDyn *input, ScrDyn *init) {
|
|
5237
|
+
SfRequest *source = input && input->kind == SCR_DYN_HANDLE && input->v.handle.tag == SCR_DYNH_FETCH_REQUEST ? input->v.handle.ptr : NULL;
|
|
5238
|
+
if (init && init->kind != SCR_DYN_UNDEF && init->kind != SCR_DYN_NULL && !sf_response_init_object_like(init)) {
|
|
5239
|
+
sf_type_error("Request constructor init must be an object"); return NULL;
|
|
5240
|
+
}
|
|
5241
|
+
ScrStr *url_text = source ? scr_str_retain(source->url) : scr_dyn_string_coerce_js(input);
|
|
5242
|
+
if (!url_text) return NULL;
|
|
5243
|
+
ScrUrl *url = scr_url_new(url_text);
|
|
5244
|
+
scr_str_release(url_text);
|
|
5245
|
+
if (!url) return NULL;
|
|
5246
|
+
if (url->userinfo->len) { scr_url_release(url); sf_type_error("Request cannot be constructed from a URL that includes credentials"); return NULL; }
|
|
5247
|
+
ScrDyn *dictionary = scr_dyn_new_obj();
|
|
5248
|
+
ScrDyn *method = sf_response_init_get(init, "method", 6);
|
|
5249
|
+
if ((!method || method->kind == SCR_DYN_UNDEF) && source) { scr_dyn_release(method); method = scr_dyn_new_str(source->method); }
|
|
5250
|
+
if (method) scr_dyn_obj_set(dictionary, "method", 6, method);
|
|
5251
|
+
ScrStr *method_text = sf_method_value(dictionary);
|
|
5252
|
+
scr_dyn_release(dictionary);
|
|
5253
|
+
if (!method_text || !sf_method_validate(&method_text)) { scr_str_release(method_text); scr_url_release(url); return NULL; }
|
|
5254
|
+
ScrDyn *body = sf_response_init_get(init, "body", 4);
|
|
5255
|
+
bool supplied = body && body->kind != SCR_DYN_UNDEF && body->kind != SCR_DYN_NULL;
|
|
5256
|
+
if (!supplied && source && !source->payload->null_body) {
|
|
5257
|
+
if (source->payload->body->disturbed || source->payload->body->reader || source->payload->body->internal_lock) {
|
|
5258
|
+
scr_dyn_release(body); scr_str_release(method_text); scr_url_release(url);
|
|
5259
|
+
sf_type_error("Cannot construct a Request with a Request object that has already been used."); return NULL;
|
|
5260
|
+
}
|
|
5261
|
+
scr_dyn_release(body); body = scr_dyn_new_handle(source->payload->body, SCR_DYNH_WEB_STREAM);
|
|
5262
|
+
}
|
|
5263
|
+
bool has_body = body && body->kind != SCR_DYN_UNDEF && body->kind != SCR_DYN_NULL;
|
|
5264
|
+
if (has_body && (sf_name(method_text->data, method_text->len, "GET") || sf_name(method_text->data, method_text->len, "HEAD"))) {
|
|
5265
|
+
scr_dyn_release(body); scr_str_release(method_text); scr_url_release(url); sf_type_error("Request with GET/HEAD method cannot have body."); return NULL;
|
|
5266
|
+
}
|
|
5267
|
+
if (supplied && body->kind == SCR_DYN_HANDLE && body->v.handle.tag == SCR_DYNH_WEB_STREAM) {
|
|
5268
|
+
ScrDyn *duplex = sf_response_init_get(init, "duplex", 6);
|
|
5269
|
+
ScrStr *text = duplex && duplex->kind != SCR_DYN_UNDEF ? scr_dyn_string_coerce_js(duplex) : NULL;
|
|
5270
|
+
scr_dyn_release(duplex);
|
|
5271
|
+
bool half = text && sf_name(text->data, text->len, "half"); scr_str_release(text);
|
|
5272
|
+
if (!half) { scr_dyn_release(body); scr_str_release(method_text); scr_url_release(url); sf_type_error("RequestInit: duplex option is required when sending a body."); return NULL; }
|
|
5273
|
+
}
|
|
5274
|
+
ScrDyn *headers = sf_response_init_get(init, "headers", 7);
|
|
5275
|
+
if ((!headers || headers->kind == SCR_DYN_UNDEF) && source) { scr_dyn_release(headers); headers = scr_dyn_new_handle(source->payload->headers, SCR_DYNH_FETCH_HEADERS); }
|
|
5276
|
+
ScrDyn *payload_init = scr_dyn_new_obj();
|
|
5277
|
+
if (headers) scr_dyn_obj_set(payload_init, "headers", 7, headers);
|
|
5278
|
+
ScrDyn *payload = scr_fetch_response_new(body, payload_init);
|
|
5279
|
+
scr_dyn_release(payload_init); scr_dyn_release(body);
|
|
5280
|
+
if (!payload) { scr_str_release(method_text); scr_url_release(url); return NULL; }
|
|
5281
|
+
ScrDyn *signal = sf_response_init_get(init, "signal", 6);
|
|
5282
|
+
if ((!signal || signal->kind == SCR_DYN_UNDEF) && source) { scr_dyn_release(signal); signal = scr_dyn_new_handle(source->signal, SCR_DYNH_ABORT_SIGNAL); }
|
|
5283
|
+
SfSignal *following = NULL;
|
|
5284
|
+
if (signal && signal->kind != SCR_DYN_UNDEF && signal->kind != SCR_DYN_NULL) {
|
|
5285
|
+
ScrDyn *signals = scr_dyn_new_arr(); scr_dyn_arr_push(signals, scr_dyn_retain(signal));
|
|
5286
|
+
ScrDyn *dependent = scr_fetch_abort_any(signals); scr_dyn_release(signals);
|
|
5287
|
+
if (dependent) { following = sf_signal_retain(dependent->v.handle.ptr); scr_dyn_release(dependent); }
|
|
5288
|
+
} else following = sf_signal_new();
|
|
5289
|
+
scr_dyn_release(signal);
|
|
5290
|
+
if (!following) { scr_dyn_release(payload); scr_str_release(method_text); scr_url_release(url); return NULL; }
|
|
5291
|
+
ScrDyn *redirect = sf_response_init_get(init, "redirect", 8);
|
|
5292
|
+
ScrStr *redirect_text = redirect && redirect->kind != SCR_DYN_UNDEF ? scr_dyn_string_coerce_js(redirect) : source ? scr_str_retain(source->redirect) : scr_str_new("follow", 6);
|
|
5293
|
+
scr_dyn_release(redirect);
|
|
5294
|
+
if (!redirect_text || !(sf_name(redirect_text->data, redirect_text->len, "follow") || sf_name(redirect_text->data, redirect_text->len, "manual") || sf_name(redirect_text->data, redirect_text->len, "error"))) {
|
|
5295
|
+
scr_str_release(redirect_text); sf_signal_release(following); scr_dyn_release(payload); scr_str_release(method_text); scr_url_release(url); sf_type_error("Invalid Request redirect value"); return NULL;
|
|
5296
|
+
}
|
|
5297
|
+
SfRequest *r = calloc(1, sizeof *r); if (!r) sf_oom();
|
|
5298
|
+
r->rc = 1; r->payload = sf_response_retain(payload->v.handle.ptr); scr_dyn_release(payload);
|
|
5299
|
+
r->url = scr_url_href(url); scr_url_release(url); r->method = method_text; r->redirect = redirect_text; r->signal = following;
|
|
5300
|
+
ScrDyn *result = scr_dyn_new_handle(r, SCR_DYNH_FETCH_REQUEST); sf_request_release_v(r); return result;
|
|
5301
|
+
}
|
|
5302
|
+
|
|
5303
|
+
ScrPromise *scr_fetch_input(ScrDyn *input, ScrDyn *init) {
|
|
5304
|
+
if (init && init->kind == SCR_DYN_TYPED_REF) {
|
|
5305
|
+
ScrDyn *view = scr_dyn_typed_ref_materialize(init);
|
|
5306
|
+
if (scr_exc_pending()) { scr_dyn_release(view); ScrPromise *p = scr_promise_new(); scr_promise_reject_pending(p); return p; }
|
|
5307
|
+
ScrPromise *result = scr_fetch_input(input, view);
|
|
5308
|
+
scr_dyn_release(view);
|
|
5309
|
+
return result;
|
|
5310
|
+
}
|
|
5311
|
+
if (input && input->kind == SCR_DYN_HANDLE && input->v.handle.tag == SCR_DYNH_FETCH_REQUEST) {
|
|
5312
|
+
ScrDyn *converted = scr_fetch_request_new(input, init);
|
|
5313
|
+
if (!converted) { ScrPromise *p = scr_promise_new(); scr_promise_reject_pending(p); return p; }
|
|
5314
|
+
SfRequest *r = converted->v.handle.ptr;
|
|
5315
|
+
ScrDyn *dictionary = scr_dyn_new_obj();
|
|
5316
|
+
scr_dyn_obj_set(dictionary, "method", 6, scr_dyn_new_str(r->method));
|
|
5317
|
+
scr_dyn_obj_set(dictionary, "headers", 7, scr_dyn_new_handle(r->payload->headers, SCR_DYNH_FETCH_HEADERS));
|
|
5318
|
+
scr_dyn_obj_set(dictionary, "signal", 6, scr_dyn_new_handle(r->signal, SCR_DYNH_ABORT_SIGNAL));
|
|
5319
|
+
scr_dyn_obj_set(dictionary, "redirect", 8, scr_dyn_new_str(r->redirect));
|
|
5320
|
+
if (!r->payload->null_body) {
|
|
5321
|
+
scr_dyn_obj_set(dictionary, "body", 4, scr_dyn_new_handle(r->payload->body, SCR_DYNH_WEB_STREAM));
|
|
5322
|
+
ScrStr *half = scr_str_new("half", 4); scr_dyn_obj_set(dictionary, "duplex", 6, scr_dyn_new_str(half)); scr_str_release(half);
|
|
5323
|
+
}
|
|
5324
|
+
ScrPromise *result = scr_fetch_static(r->url, dictionary);
|
|
5325
|
+
scr_dyn_release(dictionary); scr_dyn_release(converted); return result;
|
|
5326
|
+
}
|
|
5327
|
+
ScrStr *url = scr_dyn_string_coerce_js(input);
|
|
5328
|
+
if (!url) { ScrPromise *p = scr_promise_new(); scr_promise_reject_pending(p); return p; }
|
|
5329
|
+
ScrPromise *result = scr_fetch_static(url, init); scr_str_release(url); return result;
|
|
5330
|
+
}
|
|
5331
|
+
|
|
5332
|
+
static ScrDyn *sf_fetch_function_call(ScrClosure *closure, ScrDyn *const *args, size_t argc) {
|
|
5333
|
+
(void)closure;
|
|
5334
|
+
ScrPromise *p = scr_fetch_input(argc ? args[0] : scr_dyn_undefined(), argc > 1 ? args[1] : scr_dyn_undefined());
|
|
5335
|
+
ScrDyn *result = scr_dyn_new_promise(p); scr_promise_release(p); return result;
|
|
5336
|
+
}
|
|
5337
|
+
static ScrDyn *sf_fetch_function_value;
|
|
5338
|
+
static void sf_fetch_function_cleanup(void) {
|
|
5339
|
+
ScrDyn *value = sf_fetch_function_value;
|
|
5340
|
+
sf_fetch_function_value = NULL;
|
|
5341
|
+
scr_dyn_release(value);
|
|
5342
|
+
}
|
|
5343
|
+
bool scr_fetch_web_is(const ScrDyn *value, const ScrStr *name) {
|
|
5344
|
+
if (value->kind != SCR_DYN_HANDLE) return false;
|
|
5345
|
+
if (sf_name(name->data, name->len, "Response")) return value->v.handle.tag == SCR_DYNH_FETCH_RESPONSE;
|
|
5346
|
+
if (sf_name(name->data, name->len, "Request")) return value->v.handle.tag == SCR_DYNH_FETCH_REQUEST;
|
|
5347
|
+
return sf_name(name->data, name->len, "Headers") && value->v.handle.tag == SCR_DYNH_FETCH_HEADERS;
|
|
5348
|
+
}
|
|
5349
|
+
|
|
5350
|
+
bool scr_fetch_stream_is(const ScrDyn *value) {
|
|
5351
|
+
return value && value->kind == SCR_DYN_HANDLE && value->v.handle.tag == SCR_DYNH_WEB_STREAM;
|
|
5352
|
+
}
|
|
5353
|
+
ScrDyn *scr_fetch_function(void) {
|
|
5354
|
+
if (!sf_fetch_function_value) {
|
|
5355
|
+
sf_fetch_function_value = scr_dyn_new_func(scr_closure_new(NULL, 0), sf_fetch_function_call, 1, "fetch", "fetch");
|
|
5356
|
+
scr_atexit(sf_fetch_function_cleanup);
|
|
5357
|
+
}
|
|
5358
|
+
return scr_dyn_retain(sf_fetch_function_value);
|
|
5359
|
+
}
|
|
5360
|
+
|
|
5361
|
+
static int sf_data_hex(unsigned char ch) {
|
|
5362
|
+
if (ch >= '0' && ch <= '9') return ch - '0';
|
|
5363
|
+
if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
|
|
5364
|
+
if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
|
|
5365
|
+
return -1;
|
|
5366
|
+
}
|
|
5367
|
+
|
|
5368
|
+
static ScrDyn *sf_data_response(ScrStr *url) {
|
|
5369
|
+
size_t end = url->len;
|
|
5370
|
+
for (size_t i = 5; i < end; i++) if (url->data[i] == '#') { end = i; break; }
|
|
5371
|
+
size_t comma = 5;
|
|
5372
|
+
while (comma < end && url->data[comma] != ',') comma++;
|
|
5373
|
+
if (comma == end) { sf_type_error("fetch failed"); return NULL; }
|
|
5374
|
+
size_t meta_end = comma;
|
|
5375
|
+
bool base64 = meta_end >= 12 && strncasecmp(url->data + meta_end - 7, ";base64", 7) == 0;
|
|
5376
|
+
if (base64) meta_end -= 7;
|
|
5377
|
+
ScrBytes *bytes = scr_bytes_new(SCR_BYTES_U8, (double)(end - comma - 1));
|
|
5378
|
+
size_t n = 0;
|
|
5379
|
+
for (size_t i = comma + 1; i < end; i++) {
|
|
5380
|
+
int a, b;
|
|
5381
|
+
if (url->data[i] == '%' && i + 2 < end && (a = sf_data_hex(url->data[i + 1])) >= 0 && (b = sf_data_hex(url->data[i + 2])) >= 0) {
|
|
5382
|
+
bytes->data[n++] = (unsigned char)((a << 4) | b); i += 2;
|
|
5383
|
+
} else bytes->data[n++] = (unsigned char)url->data[i];
|
|
5384
|
+
}
|
|
5385
|
+
bytes->len = n;
|
|
5386
|
+
if (base64) {
|
|
5387
|
+
ScrStr *encoded = scr_str_new((const char *)bytes->data, bytes->len);
|
|
5388
|
+
ScrStr *encoding = scr_str_new("base64", 6);
|
|
5389
|
+
ScrBytes *decoded = scr_bytes_from_str(encoded, encoding);
|
|
5390
|
+
scr_str_release(encoded); scr_str_release(encoding); scr_bytes_release(bytes); bytes = decoded;
|
|
5391
|
+
}
|
|
5392
|
+
ScrDyn *body = scr_dyn_new_bytes(bytes); scr_bytes_release(bytes);
|
|
5393
|
+
ScrStr *mime = meta_end == 5 ? scr_str_new("text/plain;charset=US-ASCII", 26) : scr_str_new(url->data + 5, meta_end - 5);
|
|
5394
|
+
if (mime->len && mime->data[0] == ';') {
|
|
5395
|
+
ScrJsonBuf b; scr_jb_init(&b); scr_jb_puts(&b, "text/plain"); for (size_t i = 0; i < mime->len; i++) scr_jb_putc(&b, mime->data[i]);
|
|
5396
|
+
scr_str_release(mime); mime = scr_jb_finish(&b);
|
|
5397
|
+
}
|
|
5398
|
+
ScrDyn *headers = scr_dyn_new_obj(); scr_dyn_obj_set(headers, "content-type", 12, scr_dyn_new_str(mime)); scr_str_release(mime);
|
|
5399
|
+
ScrDyn *init = scr_dyn_new_obj(); scr_dyn_obj_set(init, "headers", 7, headers);
|
|
5400
|
+
ScrStr *ok = scr_str_new("OK", 2); scr_dyn_obj_set(init, "statusText", 10, scr_dyn_new_str(ok)); scr_str_release(ok);
|
|
5401
|
+
ScrDyn *result = scr_fetch_response_new(body, init); scr_dyn_release(body); scr_dyn_release(init);
|
|
5402
|
+
if (result) {
|
|
5403
|
+
SfResponse *response = result->v.handle.ptr;
|
|
5404
|
+
scr_str_release(response->url); response->url = scr_str_new(url->data, end);
|
|
5405
|
+
response->headers->immutable = true;
|
|
5406
|
+
}
|
|
5407
|
+
return result;
|
|
5408
|
+
}
|
|
5409
|
+
|
|
5172
5410
|
ScrPromise *scr_fetch_static(ScrStr *url, ScrDyn *init) {
|
|
5411
|
+
if (init && init->kind == SCR_DYN_TYPED_REF) {
|
|
5412
|
+
ScrDyn *view = scr_dyn_typed_ref_materialize(init);
|
|
5413
|
+
if (scr_exc_pending()) {
|
|
5414
|
+
scr_dyn_release(view);
|
|
5415
|
+
ScrPromise *promise = scr_promise_new();
|
|
5416
|
+
scr_promise_reject_pending(promise);
|
|
5417
|
+
return promise;
|
|
5418
|
+
}
|
|
5419
|
+
ScrPromise *result = scr_fetch_static(url, view);
|
|
5420
|
+
scr_dyn_release(view);
|
|
5421
|
+
return result;
|
|
5422
|
+
}
|
|
5173
5423
|
ScrPromise *promise = scr_promise_new();
|
|
5174
5424
|
if (init && init->kind != SCR_DYN_OBJ &&
|
|
5175
5425
|
init->kind != SCR_DYN_UNDEF && init->kind != SCR_DYN_NULL) {
|
|
@@ -5324,7 +5574,8 @@ ScrPromise *scr_fetch_static(ScrStr *url, ScrDyn *init) {
|
|
|
5324
5574
|
return sf_reject_now(promise, "fetch failed");
|
|
5325
5575
|
}
|
|
5326
5576
|
bool https = sf_eq_ci(u->scheme, "https");
|
|
5327
|
-
|
|
5577
|
+
bool data_url = sf_eq_ci(u->scheme, "data");
|
|
5578
|
+
if (!https && !sf_eq_ci(u->scheme, "http") && !data_url) {
|
|
5328
5579
|
scr_dyn_release(coerced_body);
|
|
5329
5580
|
scr_arr_release(headers);
|
|
5330
5581
|
scr_str_release(method);
|
|
@@ -5406,6 +5657,14 @@ ScrPromise *scr_fetch_static(ScrStr *url, ScrDyn *init) {
|
|
|
5406
5657
|
return promise;
|
|
5407
5658
|
}
|
|
5408
5659
|
|
|
5660
|
+
if (data_url) {
|
|
5661
|
+
ScrDyn *response = sf_data_response(url);
|
|
5662
|
+
scr_dyn_release(coerced_body); scr_arr_release(headers); scr_str_release(method); scr_url_release(u);
|
|
5663
|
+
if (response) { scr_promise_resolve_dyn(promise, response); }
|
|
5664
|
+
else scr_promise_reject_pending(promise);
|
|
5665
|
+
return promise;
|
|
5666
|
+
}
|
|
5667
|
+
|
|
5409
5668
|
SfTransfer *t = calloc(1, sizeof *t);
|
|
5410
5669
|
if (!t) sf_oom();
|
|
5411
5670
|
t->rc = 1; /* registry */
|
|
@@ -5457,6 +5716,9 @@ static const ScrDynHandleOps sf_controller_ops = {
|
|
|
5457
5716
|
"ReadableStreamDefaultController", &sf_stream_retain_v,
|
|
5458
5717
|
&sf_stream_release_v, &sf_controller_invoke, &sf_controller_get,
|
|
5459
5718
|
&sf_no_set, NULL};
|
|
5719
|
+
static const ScrDynHandleOps sf_request_ops = {
|
|
5720
|
+
"Request", &sf_request_retain_v, &sf_request_release_v,
|
|
5721
|
+
&sf_request_invoke, &sf_request_get, &sf_no_set, NULL};
|
|
5460
5722
|
static const ScrDynHandleOps sf_response_ops = {
|
|
5461
5723
|
"Response", &sf_response_retain_v, &sf_response_release_v,
|
|
5462
5724
|
&sf_response_invoke, &sf_response_get, &sf_no_set, NULL};
|
|
@@ -5497,6 +5759,7 @@ void scr_fetch_install(void) {
|
|
|
5497
5759
|
if (installed) return;
|
|
5498
5760
|
installed = true;
|
|
5499
5761
|
scr_tls_ca_install();
|
|
5762
|
+
scr_global_fetch_install(scr_fetch_function);
|
|
5500
5763
|
sf_proxy_snapshot();
|
|
5501
5764
|
scr_net_install();
|
|
5502
5765
|
scr_dyn_handle_install(SCR_DYNH_ABORT_SIGNAL, &sf_signal_ops);
|
|
@@ -5505,6 +5768,7 @@ void scr_fetch_install(void) {
|
|
|
5505
5768
|
scr_dyn_handle_install(SCR_DYNH_WEB_STREAM, &sf_stream_ops);
|
|
5506
5769
|
scr_dyn_handle_install(SCR_DYNH_WEB_READER, &sf_reader_ops);
|
|
5507
5770
|
scr_dyn_handle_install(SCR_DYNH_WEB_CONTROLLER, &sf_controller_ops);
|
|
5771
|
+
scr_dyn_handle_install(SCR_DYNH_FETCH_REQUEST, &sf_request_ops);
|
|
5508
5772
|
scr_dyn_handle_install(SCR_DYNH_FETCH_RESPONSE, &sf_response_ops);
|
|
5509
5773
|
scr_dyn_handle_install(SCR_DYNH_FETCH_HEADERS, &sf_headers_ops);
|
|
5510
5774
|
scr_dyn_handle_install(SCR_DYNH_EVENT, &sf_event_ops);
|
|
@@ -5567,6 +5567,8 @@ static ScrDyn *scr_http_dynh_agent_invoke(void *h, ScrDyn *self, const char *met
|
|
|
5567
5567
|
}
|
|
5568
5568
|
if (strcmp(method, "getName") == 0) {
|
|
5569
5569
|
const ScrDyn *opts = argc > 0 ? args[0] : scr_dyn_undefined();
|
|
5570
|
+
ScrDyn *view = opts->kind == SCR_DYN_TYPED_REF ? scr_dyn_typed_ref_materialize(opts) : NULL;
|
|
5571
|
+
if (view != NULL) opts = view;
|
|
5570
5572
|
ScrStr *host = scr_http_dynh_opt_str(opts, "host");
|
|
5571
5573
|
ScrStr *port = scr_http_dynh_opt_str(opts, "port");
|
|
5572
5574
|
ScrStr *laddr = scr_http_dynh_opt_str(opts, "localAddress");
|
|
@@ -5587,6 +5589,7 @@ static ScrDyn *scr_http_dynh_agent_invoke(void *h, ScrDyn *self, const char *met
|
|
|
5587
5589
|
scr_str_release(port);
|
|
5588
5590
|
scr_str_release(laddr);
|
|
5589
5591
|
scr_str_release(spath);
|
|
5592
|
+
scr_dyn_release(view);
|
|
5590
5593
|
ScrDyn *d = scr_dyn_new_str(name);
|
|
5591
5594
|
scr_str_release(name);
|
|
5592
5595
|
return d;
|
|
@@ -1002,6 +1002,12 @@ static const char *isl_dyn_unmarshalable(const ScrDyn *d) {
|
|
|
1002
1002
|
return "a promise";
|
|
1003
1003
|
case SCR_DYN_PROXY:
|
|
1004
1004
|
return "a native Proxy";
|
|
1005
|
+
case SCR_DYN_TYPED_REF: {
|
|
1006
|
+
ScrDyn *view = scr_dyn_typed_ref_materialize(d);
|
|
1007
|
+
const char *result = isl_dyn_unmarshalable(view);
|
|
1008
|
+
scr_dyn_release(view);
|
|
1009
|
+
return result;
|
|
1010
|
+
}
|
|
1005
1011
|
case SCR_DYN_ARR:
|
|
1006
1012
|
for (size_t i = 0; i < d->v.arr.len; i++) {
|
|
1007
1013
|
const char *r = isl_dyn_unmarshalable(d->v.arr.items[i]);
|
|
@@ -1040,6 +1046,12 @@ static JSValue isl_from_bytes(const ScrBytes *b) {
|
|
|
1040
1046
|
|
|
1041
1047
|
static JSValue isl_from_dyn(const ScrDyn *d) {
|
|
1042
1048
|
switch (d->kind) {
|
|
1049
|
+
case SCR_DYN_TYPED_REF: {
|
|
1050
|
+
ScrDyn *view = scr_dyn_typed_ref_materialize(d);
|
|
1051
|
+
JSValue result = isl_from_dyn(view);
|
|
1052
|
+
scr_dyn_release(view);
|
|
1053
|
+
return result;
|
|
1054
|
+
}
|
|
1043
1055
|
case SCR_DYN_FUNC:
|
|
1044
1056
|
/* A boxed dyn function enters as ONE generic host-function shim over
|
|
1045
1057
|
* its uniform call thunk (ScrDynThunk): engine args wrap as dyn
|
|
@@ -1356,19 +1368,7 @@ static bool isl_dynjs_assign(ScrJsval *cell, const ScrDyn *src) {
|
|
|
1356
1368
|
|
|
1357
1369
|
static ScrStr *isl_dynjs_to_json(ScrJsval *cell) { return scr_jsval_to_json(cell); }
|
|
1358
1370
|
|
|
1359
|
-
static ScrDyn *
|
|
1360
|
-
isl_entry();
|
|
1361
|
-
JSValue m = JS_NewInt32(isl_ctx, spread ? 1 : 0);
|
|
1362
|
-
JSValue s = spell && spell->len > 0
|
|
1363
|
-
? JS_NewStringLen(isl_ctx, spell->data, spell->len)
|
|
1364
|
-
: JS_UNDEFINED;
|
|
1365
|
-
JSValue argv[3] = {cell->v, m, s};
|
|
1366
|
-
JSValue r = JS_Call(isl_ctx, isl_helpers[ISL_H_ITERDRAIN], JS_UNDEFINED, 3, argv);
|
|
1367
|
-
JS_FreeValue(isl_ctx, s);
|
|
1368
|
-
if (JS_IsException(r)) {
|
|
1369
|
-
isl_bridge_exception();
|
|
1370
|
-
return NULL;
|
|
1371
|
-
}
|
|
1371
|
+
static ScrDyn *isl_dynjs_unpack_array(JSValue r) {
|
|
1372
1372
|
/* The drained engine array unpacks into a fresh dyn array — elements
|
|
1373
1373
|
* wrap back scalar-normalized (composites stay engine values by
|
|
1374
1374
|
* reference), exactly the obj_walk unpack. */
|
|
@@ -1386,6 +1386,22 @@ static ScrDyn *isl_dynjs_iter_drain(ScrJsval *cell, bool spread, const ScrStr *s
|
|
|
1386
1386
|
return out;
|
|
1387
1387
|
}
|
|
1388
1388
|
|
|
1389
|
+
static ScrDyn *isl_dynjs_iter_drain(ScrJsval *cell, bool spread, const ScrStr *spell) {
|
|
1390
|
+
isl_entry();
|
|
1391
|
+
JSValue m = JS_NewInt32(isl_ctx, spread ? 1 : 0);
|
|
1392
|
+
JSValue s = spell && spell->len > 0
|
|
1393
|
+
? JS_NewStringLen(isl_ctx, spell->data, spell->len)
|
|
1394
|
+
: JS_UNDEFINED;
|
|
1395
|
+
JSValue argv[3] = {cell->v, m, s};
|
|
1396
|
+
JSValue r = JS_Call(isl_ctx, isl_helpers[ISL_H_ITERDRAIN], JS_UNDEFINED, 3, argv);
|
|
1397
|
+
JS_FreeValue(isl_ctx, s);
|
|
1398
|
+
if (JS_IsException(r)) {
|
|
1399
|
+
isl_bridge_exception();
|
|
1400
|
+
return NULL;
|
|
1401
|
+
}
|
|
1402
|
+
return isl_dynjs_unpack_array(r);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1389
1405
|
static ScrDyn *isl_dynjs_iterator(ScrJsval *cell, const ScrStr *spell, bool array_from) {
|
|
1390
1406
|
isl_entry();
|
|
1391
1407
|
JSValue s = spell && spell->len ? JS_NewStringLen(isl_ctx, spell->data, spell->len) : JS_UNDEFINED;
|
|
@@ -1398,6 +1414,14 @@ static ScrDyn *isl_dynjs_iterator(ScrJsval *cell, const ScrStr *spell, bool arra
|
|
|
1398
1414
|
return out;
|
|
1399
1415
|
}
|
|
1400
1416
|
|
|
1417
|
+
static ScrDyn *isl_dynjs_iter_n(ScrJsval *cell, double count) {
|
|
1418
|
+
ScrJsval *prefix = scr_jsval_iter_n(cell, count);
|
|
1419
|
+
if (!prefix) return NULL;
|
|
1420
|
+
ScrDyn *out = isl_dynjs_unpack_array(JS_DupValue(isl_ctx, prefix->v));
|
|
1421
|
+
scr_jsval_release(prefix);
|
|
1422
|
+
return out;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1401
1425
|
static const ScrDynJsvalOps isl_dynjs_ops = {
|
|
1402
1426
|
isl_dynjs_release,
|
|
1403
1427
|
isl_dynjs_typeof,
|
|
@@ -1417,6 +1441,7 @@ static const ScrDynJsvalOps isl_dynjs_ops = {
|
|
|
1417
1441
|
isl_dynjs_to_json,
|
|
1418
1442
|
isl_dynjs_iter_drain,
|
|
1419
1443
|
isl_dynjs_iterator,
|
|
1444
|
+
isl_dynjs_iter_n,
|
|
1420
1445
|
};
|
|
1421
1446
|
|
|
1422
1447
|
ScrDyn *scr_dyn_from_jsval(ScrJsval *cell) {
|