refactor: don't expose ops to user code (#22273)

Brings the number of ops exposed to user code down to 58.
This commit is contained in:
Bartek Iwańczuk 2024-02-06 00:26:36 +01:00 committed by GitHub
parent 2c621f5894
commit b94dabdb81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 150 deletions

View file

@ -538,34 +538,12 @@ function exposeUnstableFeaturesForWindowOrWorkerGlobalScope(options) {
// NOTE(bartlomieju): remove all the ops that have already been imported using
// "virtual op module" (`ext:core/ops`).
const NOT_IMPORTED_OPS = [
"op_abort_wasm_streaming",
"op_add_async",
"op_add",
"op_apply_source_map_filename",
"op_apply_source_map",
"op_bench_now",
"op_bootstrap_args",
"op_bootstrap_is_tty",
"op_bootstrap_no_color",
"op_bootstrap_pid",
"op_broadcast_unsubscribe",
"op_can_write_vectored",
"op_close",
"op_cpus",
"op_create_brotli_compress",
"op_create_brotli_decompress",
"op_current_user_call_site",
"op_decode",
"op_deserialize",
"op_destructure_error",
"op_dispatch_bench_event",
"op_dispatch_exception",
"op_encode_binary_string",
"op_encode",
"op_error_async_deferred",
"op_error_async",
"op_eval_context",
"op_event_loop_has_more_work",
"op_ffi_buf_copy_into",
"op_ffi_call_nonblocking",
"op_ffi_call_ptr_nonblocking",
@ -595,86 +573,18 @@ const NOT_IMPORTED_OPS = [
"op_ffi_unsafe_callback_close",
"op_ffi_unsafe_callback_create",
"op_ffi_unsafe_callback_ref",
"op_format_file_name",
"op_get_promise_details",
"op_get_proxy_details",
"op_has_tick_scheduled",
"op_http_get_request_header",
"op_http2_accept",
"op_http2_client_end_stream",
"op_http2_client_get_response_body_chunk",
"op_http2_client_get_response_trailers",
"op_http2_client_get_response",
"op_http2_client_request",
"op_http2_client_reset_stream",
"op_http2_client_send_data",
"op_http2_client_send_trailers",
"op_http2_connect",
"op_http2_listen",
"op_http2_poll_client_connection",
"op_http2_send_response",
"op_image_decode_png",
"op_image_process",
"op_is_any_array_buffer",
"op_is_arguments_object",
"op_is_array_buffer_view",
"op_is_array_buffer",
"op_is_async_function",
"op_is_big_int_object",
"op_is_boolean_object",
"op_is_boxed_primitive",
"op_is_data_view",
"op_is_date",
"op_is_generator_function",
"op_is_generator_object",
"op_is_map_iterator",
"op_is_map",
"op_is_module_namespace_object",
"op_is_native_error",
"op_is_number_object",
"op_is_promise",
"op_is_proxy",
"op_is_reg_exp",
"op_is_set_iterator",
"op_is_set",
"op_is_shared_array_buffer",
"op_is_string_object",
"op_is_symbol_object",
"op_is_typed_array",
"op_is_weak_map",
"op_is_weak_set",
"op_main_module",
"op_memory_usage",
"op_napi_open",
"op_npm_process_state",
"op_op_names",
"op_panic",
"op_pledge_test_permissions",
"op_ppid",
"op_print",
"op_queue_microtask",
"op_raw_write_vectored",
"op_read_all",
"op_read_sync",
"op_read",
"op_ref_op",
"op_register_bench",
"op_register_test_step",
"op_register_test",
"op_resources",
"op_restore_test_permissions",
"op_run_microtasks",
"op_serialize",
"op_set_exit_code",
"op_set_format_exception_callback",
"op_set_handled_promise_rejection_handler",
"op_set_has_tick_scheduled",
"op_set_promise_hooks",
"op_set_wasm_streaming_callback",
"op_shutdown",
"op_snapshot_options",
"op_spawn_child",
"op_str_byte_length",
"op_test_event_step_result_failed",
"op_test_event_step_result_ignored",
"op_test_event_step_result_ok",
@ -683,15 +593,6 @@ const NOT_IMPORTED_OPS = [
"op_test_op_sanitizer_finish",
"op_test_op_sanitizer_get_async_message",
"op_test_op_sanitizer_report",
"op_timer_cancel",
"op_timer_queue",
"op_timer_ref",
"op_timer_unref",
"op_try_close",
"op_unref_op",
"op_v8_cached_data_version_tag",
"op_v8_get_heap_statistics",
"op_vm_run_in_new_context",
"op_void_async",
"op_void_sync",
"op_worker_close",
@ -699,12 +600,11 @@ const NOT_IMPORTED_OPS = [
"op_worker_post_message",
"op_worker_recv_message",
"op_worker_sync_fetch",
"op_write_all",
"op_write_sync",
"op_write_type_error",
"op_write",
"op_ws_send_pong",
"op_jupyter_broadcast",
"op_format_file_name",
"op_apply_source_map",
"op_apply_source_map_filename",
];
function removeImportedOps() {