1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

refactor(ext/node): reorganize ops (#18799)

Move all op related code of "ext/node" to "ext/node/ops" module.

These files were unnecessarily scattered around the extension.
This commit is contained in:
Bartek Iwańczuk 2023-04-24 12:22:21 +02:00 committed by GitHub
parent 28e2c7204f
commit 1f0360c073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 106 additions and 104 deletions

View file

@ -21,18 +21,13 @@ use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
pub mod analyze; pub mod analyze;
mod crypto;
pub mod errors; pub mod errors;
mod idna;
mod ops; mod ops;
mod package_json; mod package_json;
mod path; mod path;
mod polyfill; mod polyfill;
mod resolution; mod resolution;
mod resolver; mod resolver;
mod v8;
mod winerror;
mod zlib;
pub use package_json::PackageJson; pub use package_json::PackageJson;
pub use path::PathClean; pub use path::PathClean;
@ -266,100 +261,100 @@ deno_core::extension!(deno_node,
deps = [ deno_io, deno_fs ], deps = [ deno_io, deno_fs ],
parameters = [Env: NodeEnv], parameters = [Env: NodeEnv],
ops = [ ops = [
crypto::op_node_create_decipheriv, ops::crypto::op_node_create_decipheriv,
crypto::op_node_cipheriv_encrypt, ops::crypto::op_node_cipheriv_encrypt,
crypto::op_node_cipheriv_final, ops::crypto::op_node_cipheriv_final,
crypto::op_node_create_cipheriv, ops::crypto::op_node_create_cipheriv,
crypto::op_node_create_hash, ops::crypto::op_node_create_hash,
crypto::op_node_decipheriv_decrypt, ops::crypto::op_node_decipheriv_decrypt,
crypto::op_node_decipheriv_final, ops::crypto::op_node_decipheriv_final,
crypto::op_node_hash_update, ops::crypto::op_node_hash_update,
crypto::op_node_hash_update_str, ops::crypto::op_node_hash_update_str,
crypto::op_node_hash_digest, ops::crypto::op_node_hash_digest,
crypto::op_node_hash_digest_hex, ops::crypto::op_node_hash_digest_hex,
crypto::op_node_hash_clone, ops::crypto::op_node_hash_clone,
crypto::op_node_private_encrypt, ops::crypto::op_node_private_encrypt,
crypto::op_node_private_decrypt, ops::crypto::op_node_private_decrypt,
crypto::op_node_public_encrypt, ops::crypto::op_node_public_encrypt,
crypto::op_node_check_prime, ops::crypto::op_node_check_prime,
crypto::op_node_check_prime_async, ops::crypto::op_node_check_prime_async,
crypto::op_node_check_prime_bytes, ops::crypto::op_node_check_prime_bytes,
crypto::op_node_check_prime_bytes_async, ops::crypto::op_node_check_prime_bytes_async,
crypto::op_node_pbkdf2, ops::crypto::op_node_pbkdf2,
crypto::op_node_pbkdf2_async, ops::crypto::op_node_pbkdf2_async,
crypto::op_node_hkdf, ops::crypto::op_node_hkdf,
crypto::op_node_hkdf_async, ops::crypto::op_node_hkdf_async,
crypto::op_node_generate_secret, ops::crypto::op_node_generate_secret,
crypto::op_node_generate_secret_async, ops::crypto::op_node_generate_secret_async,
crypto::op_node_sign, ops::crypto::op_node_sign,
crypto::op_node_generate_rsa, ops::crypto::op_node_generate_rsa,
crypto::op_node_generate_rsa_async, ops::crypto::op_node_generate_rsa_async,
crypto::op_node_dsa_generate, ops::crypto::op_node_dsa_generate,
crypto::op_node_dsa_generate_async, ops::crypto::op_node_dsa_generate_async,
crypto::op_node_ec_generate, ops::crypto::op_node_ec_generate,
crypto::op_node_ec_generate_async, ops::crypto::op_node_ec_generate_async,
crypto::op_node_ed25519_generate, ops::crypto::op_node_ed25519_generate,
crypto::op_node_ed25519_generate_async, ops::crypto::op_node_ed25519_generate_async,
crypto::op_node_x25519_generate, ops::crypto::op_node_x25519_generate,
crypto::op_node_x25519_generate_async, ops::crypto::op_node_x25519_generate_async,
crypto::op_node_dh_generate_group, ops::crypto::op_node_dh_generate_group,
crypto::op_node_dh_generate_group_async, ops::crypto::op_node_dh_generate_group_async,
crypto::op_node_dh_generate, ops::crypto::op_node_dh_generate,
crypto::op_node_dh_generate_async, ops::crypto::op_node_dh_generate_async,
crypto::op_node_verify, ops::crypto::op_node_verify,
crypto::op_node_random_int, ops::crypto::op_node_random_int,
crypto::op_node_scrypt_sync, ops::crypto::op_node_scrypt_sync,
crypto::op_node_scrypt_async, ops::crypto::op_node_scrypt_async,
crypto::x509::op_node_x509_parse, ops::crypto::x509::op_node_x509_parse,
crypto::x509::op_node_x509_ca, ops::crypto::x509::op_node_x509_ca,
crypto::x509::op_node_x509_check_email, ops::crypto::x509::op_node_x509_check_email,
crypto::x509::op_node_x509_fingerprint, ops::crypto::x509::op_node_x509_fingerprint,
crypto::x509::op_node_x509_fingerprint256, ops::crypto::x509::op_node_x509_fingerprint256,
crypto::x509::op_node_x509_fingerprint512, ops::crypto::x509::op_node_x509_fingerprint512,
crypto::x509::op_node_x509_get_issuer, ops::crypto::x509::op_node_x509_get_issuer,
crypto::x509::op_node_x509_get_subject, ops::crypto::x509::op_node_x509_get_subject,
crypto::x509::op_node_x509_get_valid_from, ops::crypto::x509::op_node_x509_get_valid_from,
crypto::x509::op_node_x509_get_valid_to, ops::crypto::x509::op_node_x509_get_valid_to,
crypto::x509::op_node_x509_get_serial_number, ops::crypto::x509::op_node_x509_get_serial_number,
crypto::x509::op_node_x509_key_usage, ops::crypto::x509::op_node_x509_key_usage,
winerror::op_node_sys_to_uv_error, ops::winerror::op_node_sys_to_uv_error,
v8::op_v8_cached_data_version_tag, ops::v8::op_v8_cached_data_version_tag,
v8::op_v8_get_heap_statistics, ops::v8::op_v8_get_heap_statistics,
idna::op_node_idna_domain_to_ascii, ops::idna::op_node_idna_domain_to_ascii,
idna::op_node_idna_domain_to_unicode, ops::idna::op_node_idna_domain_to_unicode,
idna::op_node_idna_punycode_decode, ops::idna::op_node_idna_punycode_decode,
idna::op_node_idna_punycode_encode, ops::idna::op_node_idna_punycode_encode,
zlib::op_zlib_new, ops::zlib::op_zlib_new,
zlib::op_zlib_close, ops::zlib::op_zlib_close,
zlib::op_zlib_close_if_pending, ops::zlib::op_zlib_close_if_pending,
zlib::op_zlib_write, ops::zlib::op_zlib_write,
zlib::op_zlib_write_async, ops::zlib::op_zlib_write_async,
zlib::op_zlib_init, ops::zlib::op_zlib_init,
zlib::op_zlib_reset, ops::zlib::op_zlib_reset,
op_node_build_os, op_node_build_os,
ops::op_require_init_paths, ops::require::op_require_init_paths,
ops::op_require_node_module_paths<Env>, ops::require::op_require_node_module_paths<Env>,
ops::op_require_proxy_path, ops::require::op_require_proxy_path,
ops::op_require_is_deno_dir_package, ops::require::op_require_is_deno_dir_package,
ops::op_require_resolve_deno_dir, ops::require::op_require_resolve_deno_dir,
ops::op_require_is_request_relative, ops::require::op_require_is_request_relative,
ops::op_require_resolve_lookup_paths, ops::require::op_require_resolve_lookup_paths,
ops::op_require_try_self_parent_path<Env>, ops::require::op_require_try_self_parent_path<Env>,
ops::op_require_try_self<Env>, ops::require::op_require_try_self<Env>,
ops::op_require_real_path<Env>, ops::require::op_require_real_path<Env>,
ops::op_require_path_is_absolute, ops::require::op_require_path_is_absolute,
ops::op_require_path_dirname, ops::require::op_require_path_dirname,
ops::op_require_stat<Env>, ops::require::op_require_stat<Env>,
ops::op_require_path_resolve, ops::require::op_require_path_resolve,
ops::op_require_path_basename, ops::require::op_require_path_basename,
ops::op_require_read_file<Env>, ops::require::op_require_read_file<Env>,
ops::op_require_as_file_path, ops::require::op_require_as_file_path,
ops::op_require_resolve_exports<Env>, ops::require::op_require_resolve_exports<Env>,
ops::op_require_read_closest_package_json<Env>, ops::require::op_require_read_closest_package_json<Env>,
ops::op_require_read_package_scope<Env>, ops::require::op_require_read_package_scope<Env>,
ops::op_require_package_imports_resolve<Env>, ops::require::op_require_package_imports_resolve<Env>,
ops::op_require_break_on_next_statement, ops::require::op_require_break_on_next_statement,
], ],
esm_entry_point = "ext:deno_node/02_init.js", esm_entry_point = "ext:deno_node/02_init.js",
esm = [ esm = [

8
ext/node/ops/mod.rs Normal file
View file

@ -0,0 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
pub mod crypto;
pub mod idna;
pub mod require;
pub mod v8;
pub mod winerror;
pub mod zlib;

View file

@ -14,15 +14,14 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::rc::Rc; use std::rc::Rc;
use crate::resolution;
use crate::NodeEnv; use crate::NodeEnv;
use crate::NodeFs; use crate::NodeFs;
use crate::NodeModuleKind;
use super::resolution; use crate::NodePermissions;
use super::NodeModuleKind; use crate::NodeResolutionMode;
use super::NodePermissions; use crate::NpmResolver;
use super::NodeResolutionMode; use crate::PackageJson;
use super::NpmResolver;
use super::PackageJson;
fn ensure_read_permission<P>( fn ensure_read_permission<P>(
state: &mut OpState, state: &mut OpState,