From 6055629ee7f48a4e887392ccac13788aa4008249 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 23 Jul 2024 17:34:46 -0400 Subject: [PATCH] refactor: update to use deno_package_json (#24688) This is in preparation for extracting out node resolution code from ext/node (which is something I'm going to do gradually over time). Uses https://github.com/denoland/deno_package_json --- Cargo.lock | 23 +++++++++++--- Cargo.toml | 2 +- cli/Cargo.toml | 3 +- cli/args/deno_json.rs | 56 ++++++++++++++++++++++++++++++++++ cli/args/mod.rs | 5 +--- cli/args/package_json.rs | 2 +- cli/factory.rs | 2 +- cli/lsp/config.rs | 10 +++---- cli/lsp/language_server.rs | 3 +- cli/npm/byonm.rs | 2 +- cli/resolver.rs | 2 +- cli/standalone/mod.rs | 4 +-- cli/tools/registry/unfurl.rs | 2 +- ext/fs/Cargo.toml | 3 +- ext/fs/interface.rs | 58 ------------------------------------ ext/fs/lib.rs | 1 - ext/node/Cargo.toml | 5 +++- ext/node/errors.rs | 2 +- ext/node/lib.rs | 2 +- ext/node/package_json.rs | 33 +++++++++++++------- ext/node/resolution.rs | 4 +-- 21 files changed, 123 insertions(+), 101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b38172a069..b75a8ffc34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1131,6 +1131,7 @@ dependencies = [ "deno_lint", "deno_lockfile", "deno_npm", + "deno_package_json", "deno_runtime", "deno_semver", "deno_task_shell", @@ -1312,11 +1313,12 @@ dependencies = [ [[package]] name = "deno_config" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e7a65603a3aa52216021a0abd401770ac6ed284e5b885dadf40ce35b2a0d9e" +checksum = "8188c39699541affc0c0f89bbba07d31212385fa0c4e1a5a9e530b0f3cbc776f" dependencies = [ "anyhow", + "deno_package_json", "deno_semver", "glob", "ignore", @@ -1513,7 +1515,6 @@ version = "0.72.0" dependencies = [ "async-trait", "base32", - "deno_config", "deno_core", "deno_io", "deno_permissions", @@ -1733,13 +1734,13 @@ dependencies = [ "cbc", "const-oid", "data-encoding", - "deno_config", "deno_core", "deno_fetch", "deno_fs", "deno_io", "deno_media_type", "deno_net", + "deno_package_json", "deno_permissions", "deno_whoami", "digest", @@ -1831,6 +1832,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "deno_package_json" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38cf6ea5cc98ea7ad58b0e84593773bea03fc0431071a296017bed4151e3dc1d" +dependencies = [ + "deno_semver", + "indexmap", + "serde", + "serde_json", + "thiserror", + "url", +] + [[package]] name = "deno_permissions" version = "0.22.0" diff --git a/Cargo.toml b/Cargo.toml index fd243fff53..17f12050eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ console_static_text = "=0.8.1" data-encoding = "2.3.3" data-url = "=0.3.0" deno_cache_dir = "=0.10.2" -deno_config = { version = "=0.25.0", default-features = false } +deno_package_json = { version = "=0.1.1", default-features = false } dlopen2 = "0.6.1" ecb = "=0.1.2" elliptic-curve = { version = "0.13.4", features = ["alloc", "arithmetic", "ecdh", "std", "pem"] } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 6c185560de..3fa5b54ed9 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -65,7 +65,7 @@ winres.workspace = true [dependencies] deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] } deno_cache_dir = { workspace = true } -deno_config = { workspace = true, features = ["workspace"] } +deno_config = { version = "=0.26.1", features = ["workspace", "sync"] } deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_doc = { version = "=0.142.0", features = ["html", "syntect"] } deno_emit = "=0.43.1" @@ -73,6 +73,7 @@ deno_graph = { version = "=0.80.1", features = ["tokio_executor"] } deno_lint = { version = "=0.60.1", features = ["docs"] } deno_lockfile.workspace = true deno_npm = "=0.21.4" +deno_package_json.workspace = true deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_semver = "=0.5.7" deno_task_shell = "=0.17.0" diff --git a/cli/args/deno_json.rs b/cli/args/deno_json.rs index 2b3261a0b9..cbc33aa0b2 100644 --- a/cli/args/deno_json.rs +++ b/cli/args/deno_json.rs @@ -7,6 +7,62 @@ use deno_semver::jsr::JsrDepPackageReq; use deno_semver::jsr::JsrPackageReqReference; use deno_semver::npm::NpmPackageReqReference; +#[cfg(test)] // happens to only be used by the tests at the moment +pub struct DenoConfigFsAdapter<'a>( + pub &'a dyn deno_runtime::deno_fs::FileSystem, +); + +#[cfg(test)] +impl<'a> deno_config::fs::DenoConfigFs for DenoConfigFsAdapter<'a> { + fn read_to_string_lossy( + &self, + path: &std::path::Path, + ) -> Result { + self + .0 + .read_text_file_lossy_sync(path, None) + .map_err(|err| err.into_io_error()) + } + + fn stat_sync( + &self, + path: &std::path::Path, + ) -> Result { + self + .0 + .stat_sync(path) + .map(|stat| deno_config::fs::FsMetadata { + is_file: stat.is_file, + is_directory: stat.is_directory, + is_symlink: stat.is_symlink, + }) + .map_err(|err| err.into_io_error()) + } + + fn read_dir( + &self, + path: &std::path::Path, + ) -> Result, std::io::Error> { + self + .0 + .read_dir_sync(path) + .map_err(|err| err.into_io_error()) + .map(|entries| { + entries + .into_iter() + .map(|e| deno_config::fs::FsDirEntry { + path: path.join(e.name), + metadata: deno_config::fs::FsMetadata { + is_file: e.is_file, + is_directory: e.is_directory, + is_symlink: e.is_symlink, + }, + }) + .collect() + }) + } +} + pub fn deno_json_deps( config: &deno_config::deno_json::ConfigFile, ) -> HashSet { diff --git a/cli/args/mod.rs b/cli/args/mod.rs index c2ea3be4df..ba2e06e067 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -25,8 +25,6 @@ use deno_npm::npm_rc::NpmRc; use deno_npm::npm_rc::ResolvedNpmRc; use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot; use deno_npm::NpmSystemInfo; -use deno_runtime::deno_fs::DenoConfigFsAdapter; -use deno_runtime::deno_fs::RealFs; use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::deno_tls::RootCertStoreProvider; use deno_semver::npm::NpmPackageReqReference; @@ -835,7 +833,6 @@ impl CliOptions { pub fn from_flags(flags: Flags) -> Result { let initial_cwd = std::env::current_dir().with_context(|| "Failed getting cwd.")?; - let config_fs_adapter = DenoConfigFsAdapter::new(&RealFs); let maybe_vendor_override = flags.vendor.map(|v| match v { true => VendorEnablement::Enable { cwd: &initial_cwd }, false => VendorEnablement::Disable, @@ -860,7 +857,7 @@ impl CliOptions { log::debug!("package.json auto-discovery is disabled"); } WorkspaceDiscoverOptions { - fs: &config_fs_adapter, + fs: Default::default(), // use real fs deno_json_cache: None, pkg_json_cache: Some( &deno_runtime::deno_node::PackageJsonThreadLocalCache, diff --git a/cli/args/package_json.rs b/cli/args/package_json.rs index 170f8b6770..eedd0a1941 100644 --- a/cli/args/package_json.rs +++ b/cli/args/package_json.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; use std::sync::Arc; -use deno_config::package_json::PackageJsonDepValue; use deno_config::workspace::Workspace; +use deno_package_json::PackageJsonDepValue; use deno_semver::package::PackageReq; #[derive(Debug)] diff --git a/cli/factory.rs b/cli/factory.rs index 15c36cfd29..18757cda64 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -55,12 +55,12 @@ use std::collections::BTreeSet; use std::path::PathBuf; use deno_config::deno_json::ConfigFile; -use deno_config::package_json::PackageJsonDepValue; use deno_config::workspace::PackageJsonDepResolution; use deno_config::workspace::WorkspaceResolver; use deno_core::error::AnyError; use deno_core::futures::FutureExt; use deno_core::FeatureChecker; +use deno_package_json::PackageJsonDepValue; use deno_lockfile::WorkspaceMemberConfig; use deno_runtime::deno_fs; diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index 2757500d1a..ec5430e8af 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -11,7 +11,6 @@ use deno_config::fs::DenoConfigFs; use deno_config::fs::RealDenoConfigFs; use deno_config::glob::FilePatterns; use deno_config::glob::PathOrPatternSet; -use deno_config::package_json::PackageJsonCache; use deno_config::workspace::CreateResolverOptions; use deno_config::workspace::PackageJsonDepResolution; use deno_config::workspace::SpecifiedImportMap; @@ -34,6 +33,7 @@ use deno_core::serde_json::Value; use deno_core::ModuleSpecifier; use deno_lint::linter::LintConfig as DenoLintConfig; use deno_npm::npm_rc::ResolvedNpmRc; +use deno_package_json::PackageJsonCache; use deno_runtime::deno_node::PackageJson; use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::fs_util::specifier_to_file_path; @@ -1560,9 +1560,7 @@ impl ConfigData { self.member_dir.maybe_deno_json() } - pub fn maybe_pkg_json( - &self, - ) -> Option<&Arc> { + pub fn maybe_pkg_json(&self) -> Option<&Arc> { self.member_dir.maybe_pkg_json() } } @@ -1793,7 +1791,7 @@ impl ConfigTree { &config_path, ), &deno_config::workspace::WorkspaceDiscoverOptions { - fs: &deno_runtime::deno_fs::DenoConfigFsAdapter::new(&test_fs), + fs: &crate::args::deno_json::DenoConfigFsAdapter(&test_fs), ..Default::default() }, ) @@ -1888,7 +1886,7 @@ impl deno_config::deno_json::DenoJsonCache for DenoJsonMemCache { #[derive(Default)] struct PackageJsonMemCache(Mutex>>); -impl deno_config::package_json::PackageJsonCache for PackageJsonMemCache { +impl deno_package_json::PackageJsonCache for PackageJsonMemCache { fn get(&self, path: &Path) -> Option> { self.0.lock().get(path).cloned() } diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 9680c63f9d..0e65d8b255 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -15,7 +15,6 @@ use deno_core::url; use deno_core::ModuleSpecifier; use deno_graph::GraphKind; use deno_graph::Resolution; -use deno_runtime::deno_fs::DenoConfigFsAdapter; use deno_runtime::deno_tls::rustls::RootCertStore; use deno_runtime::deno_tls::RootCertStoreProvider; use deno_semver::jsr::JsrPackageReqReference; @@ -3539,7 +3538,7 @@ impl Inner { initial_cwd.clone() ]), &WorkspaceDiscoverOptions { - fs: &DenoConfigFsAdapter::new(&deno_runtime::deno_fs::RealFs), + fs: Default::default(), // use real fs, deno_json_cache: None, pkg_json_cache: None, workspace_cache: None, diff --git a/cli/npm/byonm.rs b/cli/npm/byonm.rs index 6f45648a88..f776b79c19 100644 --- a/cli/npm/byonm.rs +++ b/cli/npm/byonm.rs @@ -6,10 +6,10 @@ use std::path::PathBuf; use std::sync::Arc; use deno_ast::ModuleSpecifier; -use deno_config::package_json::PackageJsonDepValue; use deno_core::anyhow::bail; use deno_core::error::AnyError; use deno_core::serde_json; +use deno_package_json::PackageJsonDepValue; use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_node::errors::PackageFolderResolveError; use deno_runtime::deno_node::errors::PackageFolderResolveErrorKind; diff --git a/cli/resolver.rs b/cli/resolver.rs index 7c47795c45..c332878a23 100644 --- a/cli/resolver.rs +++ b/cli/resolver.rs @@ -4,7 +4,6 @@ use async_trait::async_trait; use dashmap::DashMap; use dashmap::DashSet; use deno_ast::MediaType; -use deno_config::package_json::PackageJsonDepValue; use deno_config::workspace::MappedResolution; use deno_config::workspace::MappedResolutionError; use deno_config::workspace::WorkspaceResolver; @@ -21,6 +20,7 @@ use deno_graph::source::DEFAULT_JSX_IMPORT_SOURCE_MODULE; use deno_graph::NpmLoadError; use deno_graph::NpmResolvePkgReqsResult; use deno_npm::resolution::NpmResolutionError; +use deno_package_json::PackageJsonDepValue; use deno_runtime::deno_fs; use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_node::errors::ClosestPkgJsonError; diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs index e0c8e66ff0..14a8572144 100644 --- a/cli/standalone/mod.rs +++ b/cli/standalone/mod.rs @@ -34,7 +34,6 @@ use crate::worker::CliMainWorkerOptions; use crate::worker::ModuleLoaderAndSourceMapGetter; use crate::worker::ModuleLoaderFactory; use deno_ast::MediaType; -use deno_config::package_json::PackageJsonDepValue; use deno_config::workspace::MappedResolution; use deno_config::workspace::MappedResolutionError; use deno_config::workspace::WorkspaceResolver; @@ -52,6 +51,7 @@ use deno_core::ModuleType; use deno_core::RequestedModuleType; use deno_core::ResolutionKind; use deno_npm::npm_rc::ResolvedNpmRc; +use deno_package_json::PackageJsonDepValue; use deno_runtime::deno_fs; use deno_runtime::deno_node::analyze::NodeCodeTranslator; use deno_runtime::deno_node::NodeResolutionMode; @@ -591,7 +591,7 @@ pub async fn run( .to_file_path() .unwrap(); let pkg_json = - deno_config::package_json::PackageJson::load_from_value(path, json); + deno_package_json::PackageJson::load_from_value(path, json); Arc::new(pkg_json) }) .collect(); diff --git a/cli/tools/registry/unfurl.rs b/cli/tools/registry/unfurl.rs index 63c773f018..f7c1049ca1 100644 --- a/cli/tools/registry/unfurl.rs +++ b/cli/tools/registry/unfurl.rs @@ -3,7 +3,6 @@ use deno_ast::ParsedSource; use deno_ast::SourceRange; use deno_ast::SourceTextInfo; -use deno_config::package_json::PackageJsonDepValue; use deno_config::workspace::MappedResolution; use deno_config::workspace::PackageJsonDepResolution; use deno_config::workspace::WorkspaceResolver; @@ -12,6 +11,7 @@ use deno_graph::DependencyDescriptor; use deno_graph::DynamicTemplatePart; use deno_graph::ParserModuleAnalyzer; use deno_graph::TypeScriptReference; +use deno_package_json::PackageJsonDepValue; use deno_runtime::deno_node::is_builtin_node_module; use crate::resolver::SloppyImportsResolver; diff --git a/ext/fs/Cargo.toml b/ext/fs/Cargo.toml index b5634a3a3e..ad8d9683df 100644 --- a/ext/fs/Cargo.toml +++ b/ext/fs/Cargo.toml @@ -14,12 +14,11 @@ description = "Ops for interacting with the file system" path = "lib.rs" [features] -sync_fs = ["deno_config/sync"] +sync_fs = [] [dependencies] async-trait.workspace = true base32.workspace = true -deno_config = { workspace = true, default-features = false } deno_core.workspace = true deno_io.workspace = true deno_permissions.workspace = true diff --git a/ext/fs/interface.rs b/ext/fs/interface.rs index 09e16aff10..af4beb248b 100644 --- a/ext/fs/interface.rs +++ b/ext/fs/interface.rs @@ -337,64 +337,6 @@ pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync { } } -pub struct DenoConfigFsAdapter<'a>(&'a dyn FileSystem); - -impl<'a> DenoConfigFsAdapter<'a> { - pub fn new(fs: &'a dyn FileSystem) -> Self { - Self(fs) - } -} - -impl<'a> deno_config::fs::DenoConfigFs for DenoConfigFsAdapter<'a> { - fn read_to_string_lossy( - &self, - path: &Path, - ) -> Result { - self - .0 - .read_text_file_lossy_sync(path, None) - .map_err(|err| err.into_io_error()) - } - - fn stat_sync( - &self, - path: &Path, - ) -> Result { - self - .0 - .stat_sync(path) - .map(|stat| deno_config::fs::FsMetadata { - is_file: stat.is_file, - is_directory: stat.is_directory, - is_symlink: stat.is_symlink, - }) - .map_err(|err| err.into_io_error()) - } - - fn read_dir( - &self, - path: &Path, - ) -> Result, std::io::Error> { - self - .0 - .read_dir_sync(path) - .map_err(|err| err.into_io_error()) - .map(|entries| { - entries - .into_iter() - .map(|e| deno_config::fs::FsDirEntry { - path: path.join(e.name), - metadata: deno_config::fs::FsMetadata { - is_file: e.is_file, - is_directory: e.is_directory, - is_symlink: e.is_symlink, - }, - }) - .collect() - }) - } -} - // Like String::from_utf8_lossy but operates on owned values #[inline(always)] fn string_from_utf8_lossy(buf: Vec) -> String { diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index a60408f9bd..2dce04b325 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -9,7 +9,6 @@ pub mod sync; pub use crate::in_memory_fs::InMemoryFs; pub use crate::interface::AccessCheckCb; pub use crate::interface::AccessCheckFn; -pub use crate::interface::DenoConfigFsAdapter; pub use crate::interface::FileSystem; pub use crate::interface::FileSystemRc; pub use crate::interface::FsDirEntry; diff --git a/ext/node/Cargo.toml b/ext/node/Cargo.toml index dafb3a0c80..ed168eace3 100644 --- a/ext/node/Cargo.toml +++ b/ext/node/Cargo.toml @@ -13,6 +13,9 @@ description = "Node compatibility for Deno" [lib] path = "lib.rs" +[features] +sync_fs = ["deno_package_json/sync"] + [dependencies] aead-gcm-stream = "0.1" aes.workspace = true @@ -23,13 +26,13 @@ bytes.workspace = true cbc.workspace = true const-oid = "0.9.5" data-encoding.workspace = true -deno_config = { workspace = true, default-features = false, features = ["package_json"] } deno_core.workspace = true deno_fetch.workspace = true deno_fs.workspace = true deno_io.workspace = true deno_media_type.workspace = true deno_net.workspace = true +deno_package_json.workspace = true deno_permissions.workspace = true deno_whoami = "0.1.0" digest = { version = "0.10.5", features = ["core-api", "std"] } diff --git a/ext/node/errors.rs b/ext/node/errors.rs index 98b207e86a..11bb011f81 100644 --- a/ext/node/errors.rs +++ b/ext/node/errors.rs @@ -315,7 +315,7 @@ impl NodeJsErrorCoded for PathToDeclarationUrlError { pub struct PackageJsonLoadError( #[source] #[from] - pub deno_config::package_json::PackageJsonLoadError, + pub deno_package_json::PackageJsonLoadError, ); impl NodeJsErrorCoded for PackageJsonLoadError { diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 5be0fffa11..6f71851488 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -32,7 +32,7 @@ mod path; mod polyfill; mod resolution; -pub use deno_config::package_json::PackageJson; +pub use deno_package_json::PackageJson; pub use ops::ipc::ChildPipeFd; pub use ops::ipc::IpcJsonStreamResource; use ops::vm; diff --git a/ext/node/package_json.rs b/ext/node/package_json.rs index b28207db8b..877acfc7a7 100644 --- a/ext/node/package_json.rs +++ b/ext/node/package_json.rs @@ -1,8 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use deno_config::package_json::PackageJson; -use deno_config::package_json::PackageJsonRc; -use deno_fs::DenoConfigFsAdapter; +use deno_package_json::PackageJson; +use deno_package_json::PackageJsonRc; use std::cell::RefCell; use std::collections::HashMap; use std::io::ErrorKind; @@ -24,9 +23,7 @@ impl PackageJsonThreadLocalCache { } } -impl deno_config::package_json::PackageJsonCache - for PackageJsonThreadLocalCache -{ +impl deno_package_json::PackageJsonCache for PackageJsonThreadLocalCache { fn get(&self, path: &Path) -> Option { CACHE.with(|cache| cache.borrow().get(path).cloned()) } @@ -36,6 +33,20 @@ impl deno_config::package_json::PackageJsonCache } } +pub struct DenoPkgJsonFsAdapter<'a>(pub &'a dyn deno_fs::FileSystem); + +impl<'a> deno_package_json::fs::DenoPkgJsonFs for DenoPkgJsonFsAdapter<'a> { + fn read_to_string_lossy( + &self, + path: &Path, + ) -> Result { + self + .0 + .read_text_file_lossy_sync(path, None) + .map_err(|err| err.into_io_error()) + } +} + /// Helper to load a package.json file using the thread local cache /// in deno_node. pub fn load_pkg_json( @@ -44,14 +55,16 @@ pub fn load_pkg_json( ) -> Result, PackageJsonLoadError> { let result = PackageJson::load_from_path( path, - &DenoConfigFsAdapter::new(fs), + &DenoPkgJsonFsAdapter(fs), Some(&PackageJsonThreadLocalCache), ); match result { Ok(pkg_json) => Ok(Some(pkg_json)), - Err(deno_config::package_json::PackageJsonLoadError::Io { - source, .. - }) if source.kind() == ErrorKind::NotFound => Ok(None), + Err(deno_package_json::PackageJsonLoadError::Io { source, .. }) + if source.kind() == ErrorKind::NotFound => + { + Ok(None) + } Err(err) => Err(PackageJsonLoadError(err)), } } diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs index cf30305a9f..476b4f59c4 100644 --- a/ext/node/resolution.rs +++ b/ext/node/resolution.rs @@ -5,7 +5,6 @@ use std::collections::HashMap; use std::path::Path; use std::path::PathBuf; -use deno_config::package_json::PackageJsonRc; use deno_core::anyhow::bail; use deno_core::error::AnyError; use deno_core::serde_json::Map; @@ -14,6 +13,7 @@ use deno_core::url::Url; use deno_core::ModuleSpecifier; use deno_fs::FileSystemRc; use deno_media_type::MediaType; +use deno_package_json::PackageJsonRc; use crate::errors; use crate::errors::CanonicalizingPkgJsonDirError; @@ -56,7 +56,7 @@ use crate::PathClean; pub static DEFAULT_CONDITIONS: &[&str] = &["deno", "node", "import"]; pub static REQUIRE_CONDITIONS: &[&str] = &["require", "node"]; -pub type NodeModuleKind = deno_config::package_json::NodeModuleKind; +pub type NodeModuleKind = deno_package_json::NodeModuleKind; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum NodeResolutionMode {