diff options
31 files changed, 52 insertions, 111 deletions
diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index 364468fb3..9d0258e0b 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -3,7 +3,7 @@ // deno-lint-ignore-file import { core, internals, primordials } from "ext:core/mod.js"; -const { +import { op_require_as_file_path, op_require_break_on_next_statement, op_require_init_paths, @@ -25,7 +25,7 @@ const { op_require_stat, op_require_try_self, op_require_try_self_parent_path, -} = core.ensureFastOps(); +} from "ext:core/ops"; const { op_napi_open, op_require_read_closest_package_json, diff --git a/ext/node/polyfills/_brotli.js b/ext/node/polyfills/_brotli.js index 26628dde9..c815add22 100644 --- a/ext/node/polyfills/_brotli.js +++ b/ext/node/polyfills/_brotli.js @@ -4,7 +4,7 @@ // deno-lint-ignore-file prefer-primordials import { core } from "ext:core/mod.js"; -const { +import { op_brotli_compress, op_brotli_compress_async, op_brotli_compress_stream, @@ -14,7 +14,7 @@ const { op_brotli_decompress_stream, op_create_brotli_compress, op_create_brotli_decompress, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { zlib as constants } from "ext:deno_node/internal_binding/constants.ts"; import { TextEncoder } from "ext:deno_web/08_text_encoding.js"; diff --git a/ext/node/polyfills/_fs/_fs_cp.js b/ext/node/polyfills/_fs/_fs_cp.js index 283b4f542..0d8c4d644 100644 --- a/ext/node/polyfills/_fs/_fs_cp.js +++ b/ext/node/polyfills/_fs/_fs_cp.js @@ -2,11 +2,7 @@ // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_cp, - op_node_cp_sync, -} = core.ensureFastOps(); +import { op_node_cp, op_node_cp_sync } from "ext:core/ops"; import { getValidatedPath, diff --git a/ext/node/polyfills/_fs/_fs_exists.ts b/ext/node/polyfills/_fs/_fs_exists.ts index 3c22fc5b8..57df1f07c 100644 --- a/ext/node/polyfills/_fs/_fs_exists.ts +++ b/ext/node/polyfills/_fs/_fs_exists.ts @@ -3,10 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_fs_exists_sync, -} = core.ensureFastOps(); +import { op_node_fs_exists_sync } from "ext:core/ops"; import { pathFromURL } from "ext:deno_web/00_infra.js"; diff --git a/ext/node/polyfills/_zlib_binding.mjs b/ext/node/polyfills/_zlib_binding.mjs index f5e7a1218..729af9b35 100644 --- a/ext/node/polyfills/_zlib_binding.mjs +++ b/ext/node/polyfills/_zlib_binding.mjs @@ -43,8 +43,7 @@ export const DEFLATERAW = 5; export const INFLATERAW = 6; export const UNZIP = 7; -import { core } from "ext:core/mod.js"; -const { +import { op_zlib_close, op_zlib_close_if_pending, op_zlib_init, @@ -52,7 +51,7 @@ const { op_zlib_reset, op_zlib_write, op_zlib_write_async, -} = core.ensureFastOps(); +} from "ext:core/ops"; const writeResult = new Uint32Array(2); diff --git a/ext/node/polyfills/async_hooks.ts b/ext/node/polyfills/async_hooks.ts index f2733e92d..e69bc88aa 100644 --- a/ext/node/polyfills/async_hooks.ts +++ b/ext/node/polyfills/async_hooks.ts @@ -8,9 +8,7 @@ // deno-lint-ignore-file prefer-primordials import { core } from "ext:core/mod.js"; -const { - op_node_is_promise_rejected, -} = core.ensureFastOps(); +import { op_node_is_promise_rejected } from "ext:core/ops"; import { validateFunction } from "ext:deno_node/internal/validators.mjs"; function assert(cond: boolean) { diff --git a/ext/node/polyfills/child_process.ts b/ext/node/polyfills/child_process.ts index c88266cbe..1d070d1ef 100644 --- a/ext/node/polyfills/child_process.ts +++ b/ext/node/polyfills/child_process.ts @@ -7,10 +7,10 @@ // deno-lint-ignore-file prefer-primordials import { core, internals } from "ext:core/mod.js"; -const { - op_node_child_ipc_pipe, +import { op_bootstrap_unstable_args, -} = core.ensureFastOps(); + op_node_child_ipc_pipe, +} from "ext:core/ops"; const { op_npm_process_state, } = core.ensureFastOps(true); diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 92368b74f..d3d51a324 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -4,10 +4,7 @@ // deno-lint-ignore-file prefer-primordials import { core } from "ext:core/mod.js"; -const { - op_fetch_response_upgrade, - op_node_http_request, -} = core.ensureFastOps(); +import { op_fetch_response_upgrade, op_node_http_request } from "ext:core/ops"; // TODO(bartlomieju): this ops is also used in `ext/fetch/26_fetch.js`. const { op_fetch_send, diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts index 357697731..a13953e76 100644 --- a/ext/node/polyfills/http2.ts +++ b/ext/node/polyfills/http2.ts @@ -5,8 +5,7 @@ // deno-lint-ignore-file prefer-primordials import { core } from "ext:core/mod.js"; -const { - op_http2_connect, +import { op_http2_client_get_response, op_http2_client_get_response_body_chunk, op_http2_client_get_response_trailers, @@ -14,8 +13,9 @@ const { op_http2_client_reset_stream, op_http2_client_send_data, op_http2_client_send_trailers, + op_http2_connect, op_http2_poll_client_connection, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts"; import { EventEmitter } from "node:events"; diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index cf935cfd4..584f6af11 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -7,10 +7,7 @@ // deno-lint-ignore-file prefer-primordials import { core, internals } from "ext:core/mod.js"; -const { - op_node_ipc_read, - op_node_ipc_write, -} = core.ensureFastOps(); +import { op_node_ipc_read, op_node_ipc_write } from "ext:core/ops"; import { ArrayIsArray, ArrayPrototypeFilter, diff --git a/ext/node/polyfills/internal/crypto/_randomInt.ts b/ext/node/polyfills/internal/crypto/_randomInt.ts index 072d74c11..7f4d703ad 100644 --- a/ext/node/polyfills/internal/crypto/_randomInt.ts +++ b/ext/node/polyfills/internal/crypto/_randomInt.ts @@ -3,10 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_random_int, -} = core.ensureFastOps(); +import { op_node_random_int } from "ext:core/ops"; export default function randomInt(max: number): number; export default function randomInt(min: number, max: number): number; diff --git a/ext/node/polyfills/internal/crypto/cipher.ts b/ext/node/polyfills/internal/crypto/cipher.ts index fdbdb6fd4..20971a8c7 100644 --- a/ext/node/polyfills/internal/crypto/cipher.ts +++ b/ext/node/polyfills/internal/crypto/cipher.ts @@ -8,7 +8,7 @@ import { core } from "ext:core/mod.js"; const { encode, } = core; -const { +import { op_node_cipheriv_encrypt, op_node_cipheriv_final, op_node_cipheriv_set_aad, @@ -20,7 +20,7 @@ const { op_node_private_decrypt, op_node_private_encrypt, op_node_public_encrypt, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; import { diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts index fbcdab185..bba01e2c4 100644 --- a/ext/node/polyfills/internal/crypto/diffiehellman.ts +++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts @@ -5,13 +5,13 @@ // deno-lint-ignore-file prefer-primordials import { core } from "ext:core/mod.js"; -const { +import { op_node_dh_compute_secret, op_node_dh_generate2, + op_node_ecdh_compute_public_key, op_node_ecdh_compute_secret, op_node_ecdh_generate_keys, - op_node_ecdh_compute_public_key, -} = core.ensureFastOps(); +} from "ext:core/ops"; const { op_node_gen_prime, } = core.ensureFastOps(true); diff --git a/ext/node/polyfills/internal/crypto/hash.ts b/ext/node/polyfills/internal/crypto/hash.ts index 8d56f601e..a1d61f953 100644 --- a/ext/node/polyfills/internal/crypto/hash.ts +++ b/ext/node/polyfills/internal/crypto/hash.ts @@ -4,16 +4,15 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { +import { op_node_create_hash, op_node_get_hashes, op_node_hash_clone, - op_node_hash_digest_hex, op_node_hash_digest, - op_node_hash_update_str, + op_node_hash_digest_hex, op_node_hash_update, -} = core.ensureFastOps(); + op_node_hash_update_str, +} from "ext:core/ops"; import { TextEncoder } from "ext:deno_web/08_text_encoding.js"; import { Buffer } from "node:buffer"; diff --git a/ext/node/polyfills/internal/crypto/hkdf.ts b/ext/node/polyfills/internal/crypto/hkdf.ts index 8e09f6388..0a8dcbb2e 100644 --- a/ext/node/polyfills/internal/crypto/hkdf.ts +++ b/ext/node/polyfills/internal/crypto/hkdf.ts @@ -4,11 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_hkdf, - op_node_hkdf_async, -} = core.ensureFastOps(); +import { op_node_hkdf, op_node_hkdf_async } from "ext:core/ops"; import { validateFunction, diff --git a/ext/node/polyfills/internal/crypto/keygen.ts b/ext/node/polyfills/internal/crypto/keygen.ts index 7b6c58d59..cdb94d222 100644 --- a/ext/node/polyfills/internal/crypto/keygen.ts +++ b/ext/node/polyfills/internal/crypto/keygen.ts @@ -30,7 +30,7 @@ import { Buffer } from "node:buffer"; import { KeyFormat, KeyType } from "ext:deno_node/internal/crypto/types.ts"; import { core } from "ext:core/mod.js"; -const { +import { op_node_dh_generate, op_node_dh_generate_async, op_node_dh_generate_group, @@ -45,7 +45,7 @@ const { op_node_generate_rsa_async, op_node_x25519_generate, op_node_x25519_generate_async, -} = core.ensureFastOps(); +} from "ext:core/ops"; const { op_node_generate_secret, op_node_generate_secret_async, diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts index f1da42daf..ab753582f 100644 --- a/ext/node/polyfills/internal/crypto/keys.ts +++ b/ext/node/polyfills/internal/crypto/keys.ts @@ -4,10 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_create_private_key, -} = core.ensureFastOps(); +import { op_node_create_private_key } from "ext:core/ops"; import { kHandle, diff --git a/ext/node/polyfills/internal/crypto/pbkdf2.ts b/ext/node/polyfills/internal/crypto/pbkdf2.ts index 47c66043c..5cf102fa9 100644 --- a/ext/node/polyfills/internal/crypto/pbkdf2.ts +++ b/ext/node/polyfills/internal/crypto/pbkdf2.ts @@ -3,11 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_pbkdf2, - op_node_pbkdf2_async, -} = core.ensureFastOps(); +import { op_node_pbkdf2, op_node_pbkdf2_async } from "ext:core/ops"; import { Buffer } from "node:buffer"; import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts"; diff --git a/ext/node/polyfills/internal/crypto/random.ts b/ext/node/polyfills/internal/crypto/random.ts index 52f6db272..0c8273bdf 100644 --- a/ext/node/polyfills/internal/crypto/random.ts +++ b/ext/node/polyfills/internal/crypto/random.ts @@ -5,13 +5,13 @@ // deno-lint-ignore-file prefer-primordials import { core, primordials } from "ext:core/mod.js"; -const { +import { op_node_check_prime, op_node_check_prime_async, op_node_check_prime_bytes, op_node_check_prime_bytes_async, op_node_gen_prime_async, -} = core.ensureFastOps(); +} from "ext:core/ops"; const { op_node_gen_prime, } = core.ensureFastOps(true); diff --git a/ext/node/polyfills/internal/crypto/scrypt.ts b/ext/node/polyfills/internal/crypto/scrypt.ts index 7de5a3ab8..ce8649bbe 100644 --- a/ext/node/polyfills/internal/crypto/scrypt.ts +++ b/ext/node/polyfills/internal/crypto/scrypt.ts @@ -28,12 +28,7 @@ SOFTWARE. import { Buffer } from "node:buffer"; import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts"; - -import { core } from "ext:core/mod.js"; -const { - op_node_scrypt_sync, - op_node_scrypt_async, -} = core.ensureFastOps(); +import { op_node_scrypt_async, op_node_scrypt_sync } from "ext:core/ops"; type Opts = Partial<{ N: number; diff --git a/ext/node/polyfills/internal/crypto/sig.ts b/ext/node/polyfills/internal/crypto/sig.ts index fb303e4e2..5a9611780 100644 --- a/ext/node/polyfills/internal/crypto/sig.ts +++ b/ext/node/polyfills/internal/crypto/sig.ts @@ -4,11 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_sign, - op_node_verify, -} = core.ensureFastOps(); +import { op_node_sign, op_node_verify } from "ext:core/ops"; import { notImplemented } from "ext:deno_node/_utils.ts"; import { diff --git a/ext/node/polyfills/internal/crypto/x509.ts b/ext/node/polyfills/internal/crypto/x509.ts index 380deefc3..50a7ab48d 100644 --- a/ext/node/polyfills/internal/crypto/x509.ts +++ b/ext/node/polyfills/internal/crypto/x509.ts @@ -4,8 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { +import { op_node_x509_ca, op_node_x509_check_email, op_node_x509_fingerprint, @@ -18,7 +17,7 @@ const { op_node_x509_get_valid_to, op_node_x509_key_usage, op_node_x509_parse, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { KeyObject } from "ext:deno_node/internal/crypto/keys.ts"; import { Buffer } from "node:buffer"; diff --git a/ext/node/polyfills/internal_binding/_libuv_winerror.ts b/ext/node/polyfills/internal_binding/_libuv_winerror.ts index 105adfb55..3ba7d9cda 100644 --- a/ext/node/polyfills/internal_binding/_libuv_winerror.ts +++ b/ext/node/polyfills/internal_binding/_libuv_winerror.ts @@ -1,9 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core } from "ext:core/mod.js"; -const { - op_node_sys_to_uv_error, -} = core.ensureFastOps(); +import { op_node_sys_to_uv_error } from "ext:core/ops"; export function uvTranslateSysError(sysErrno: number): string { return op_node_sys_to_uv_error(sysErrno); diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts index d568803bf..4915a38ca 100644 --- a/ext/node/polyfills/internal_binding/stream_wrap.ts +++ b/ext/node/polyfills/internal_binding/stream_wrap.ts @@ -32,10 +32,7 @@ import { core } from "ext:core/mod.js"; const { internalRidSymbol } = core; -const { - op_can_write_vectored, - op_raw_write_vectored, -} = core.ensureFastOps(); +import { op_can_write_vectored, op_raw_write_vectored } from "ext:core/ops"; import { TextEncoder } from "ext:deno_web/08_text_encoding.js"; import { Buffer } from "node:buffer"; diff --git a/ext/node/polyfills/internal_binding/udp_wrap.ts b/ext/node/polyfills/internal_binding/udp_wrap.ts index b78f2a077..7cbd6cabe 100644 --- a/ext/node/polyfills/internal_binding/udp_wrap.ts +++ b/ext/node/polyfills/internal_binding/udp_wrap.ts @@ -23,11 +23,10 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { +import { op_node_unstable_net_listen_udp, op_node_unstable_net_listen_unixpacket, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { AsyncWrap, diff --git a/ext/node/polyfills/internal_binding/util.ts b/ext/node/polyfills/internal_binding/util.ts index b4bcdaef4..c8fb32d8c 100644 --- a/ext/node/polyfills/internal_binding/util.ts +++ b/ext/node/polyfills/internal_binding/util.ts @@ -28,10 +28,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { - op_node_guess_handle_type, -} = core.ensureFastOps(); +import { op_node_guess_handle_type } from "ext:core/ops"; const handleTypes = ["TCP", "TTY", "UDP", "FILE", "PIPE", "UNKNOWN"]; export function guessHandleType(fd: number): string { diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts index f95ea1cc8..bc88b0601 100644 --- a/ext/node/polyfills/os.ts +++ b/ext/node/polyfills/os.ts @@ -23,13 +23,12 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { +import { op_cpus, op_node_os_get_priority, op_node_os_set_priority, op_node_os_username, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { validateIntegerRange } from "ext:deno_node/_utils.ts"; import process from "node:process"; diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 1edcccc00..40433a91f 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -5,10 +5,7 @@ // deno-lint-ignore-file prefer-primordials import { core, internals } from "ext:core/mod.js"; -const { - op_process_abort, - op_geteuid, -} = core.ensureFastOps(); +import { op_geteuid, op_process_abort } from "ext:core/ops"; const { op_set_exit_code, } = core.ensureFastOps(true); diff --git a/ext/node/polyfills/punycode.ts b/ext/node/polyfills/punycode.ts index 53bec2e5e..6f137d31f 100644 --- a/ext/node/polyfills/punycode.ts +++ b/ext/node/polyfills/punycode.ts @@ -1,12 +1,11 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core } from "ext:core/mod.js"; -const { +import { + op_node_idna_domain_to_ascii, op_node_idna_domain_to_unicode, op_node_idna_punycode_decode, op_node_idna_punycode_encode, - op_node_idna_domain_to_ascii, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { ucs2 } from "ext:deno_node/internal/idna.ts"; diff --git a/ext/node/polyfills/v8.ts b/ext/node/polyfills/v8.ts index 4c01bc9ad..a1ea16430 100644 --- a/ext/node/polyfills/v8.ts +++ b/ext/node/polyfills/v8.ts @@ -4,11 +4,10 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { +import { op_v8_cached_data_version_tag, op_v8_get_heap_statistics, -} = core.ensureFastOps(); +} from "ext:core/ops"; import { notImplemented } from "ext:deno_node/_utils.ts"; diff --git a/ext/node/polyfills/vm.ts b/ext/node/polyfills/vm.ts index ef817456a..10000b08c 100644 --- a/ext/node/polyfills/vm.ts +++ b/ext/node/polyfills/vm.ts @@ -5,9 +5,7 @@ import { core } from "ext:core/mod.js"; import { notImplemented } from "ext:deno_node/_utils.ts"; -const { - op_vm_run_in_new_context, -} = core.ensureFastOps(); +import { op_vm_run_in_new_context } from "ext:core/ops"; export class Script { code: string; |