Skip to content

match [email protected] dependencies #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
945 changes: 491 additions & 454 deletions Cargo.lock

Large diffs are not rendered by default.

79 changes: 40 additions & 39 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ worker = []

[dependencies]
maybe_path = "0.1.3"
thiserror = "^2.0.3"
thiserror = "^2.0.12"
serde = "^1.0.149"

# Used for NodeJS compatibility and other features
Expand All @@ -164,12 +164,13 @@ async-trait = "^0.1.73"
paste = "1.0.15"

# The deno runtime itself, and the webidl extension for the web APIs
deno_core = "^0.340.0"
deno_error = "=0.5.5"
deno_core = "^0.347.0"
deno_error = "=0.5.6"
deno_features = "0.2.0"

# For transpiling typescript
deno_ast = { version = "=0.46.0", features = ["transpiling", "cjs"] }
deno_media_type = "=0.2.6"
deno_ast = { version = "=0.47.0", features = ["transpiling", "cjs"] }
deno_media_type = "=0.2.8"

# Runtime for async tasks
tokio = "^1.36.0"
Expand All @@ -182,37 +183,37 @@ hyper-util = {version = "^0.1.10", optional = true}
# Pinned for now due to upstream issues
reqwest = { version = "=0.12.8", optional = true, default-features = false, features = ["blocking", "rustls-tls"] }
http = { version = "^1.0", optional = true }
deno_permissions = { version = "^0.53.0", optional = true }
deno_permissions = { version = "^0.64.0", optional = true }


#
# Dependencies for the various extension features
#

deno_broadcast_channel = { version = "^0.188.0", optional = true }

deno_cache = { version = "^0.126.0", optional = true }
deno_console = { version = "^0.194.0", optional = true }
deno_cron = { version = "^0.74.0", optional = true }
deno_crypto = { version = "^0.208.0", optional = true }
deno_fetch = { version = "^0.218.0", optional = true }
deno_ffi = { version = "^0.181.0", optional = true }
deno_fs = { version = "^0.104.0", optional = true, features = ["sync_fs"] }
deno_http = { version = "^0.192.0", optional = true }
deno_kv = { version = "^0.102.0", optional = true }
deno_net = { version = "^0.186.0", optional = true }
deno_node = { version = "^0.132.0", optional = true }
deno_tls = { version = "^0.181.0", optional = true }
deno_url = { version = "^0.194.0", optional = true }

deno_web = { version = "^0.225.0", optional = true }
deno_webidl = { version = "^0.194.0", optional = true }
deno_webstorage = { version = "^0.189.0", optional = true }
deno_websocket = { version = "^0.199.0", optional = true }
deno_webgpu = { version = "^0.161.0", optional = true }

deno_io = { version = "^0.104.0", optional = true }
deno_telemetry = { version = "^0.16.0", optional = true }
deno_broadcast_channel = { version = "^0.199.0", optional = true }

deno_cache = { version = "^0.137.0", optional = true }
deno_console = { version = "^0.205.0", optional = true }
deno_cron = { version = "^0.85.0", optional = true }
deno_crypto = { version = "^0.219.0", optional = true }
deno_fetch = { version = "^0.229.0", optional = true }
deno_ffi = { version = "^0.192.0", optional = true }
deno_fs = { version = "^0.115.0", optional = true, features = ["sync_fs"] }
deno_http = { version = "^0.203.0", optional = true }
deno_kv = { version = "^0.113.0", optional = true }
deno_net = { version = "^0.197.0", optional = true }
deno_node = { version = "^0.143.0", optional = true }
deno_tls = { version = "^0.192.0", optional = true }
deno_url = { version = "^0.205.0", optional = true }

deno_web = { version = "^0.236.0", optional = true }
deno_webidl = { version = "^0.205.0", optional = true }
deno_webstorage = { version = "^0.200.0", optional = true }
deno_websocket = { version = "^0.210.0", optional = true }
deno_webgpu = { version = "^0.172.0", optional = true }

deno_io = { version = "^0.115.0", optional = true }
deno_telemetry = { version = "^0.27.0", optional = true }

# Dependencies for the IO feature
rustyline = {version = "=13.0.0", optional = true}
Expand All @@ -229,17 +230,17 @@ once_cell = {version = "^1.17.1", optional = true}
base64-simd = {version = "0.8.0", optional = true}

# Dependencies for the node feature
deno_resolver = { version = "^0.25.0", optional = true }
node_resolver = { version = "^0.32.0", optional = true, features = ["sync"] }
deno_runtime = { version = "^0.202.0", optional = true, features = ["exclude_runtime_main_js"] }
deno_terminal = { version = "^0.2.0", optional = true }
deno_resolver = { version = "^0.36.0", optional = true }
node_resolver = { version = "^0.43.0", optional = true, features = ["sync"] }
deno_runtime = { version = "^0.213.0", optional = true, features = ["exclude_runtime_main_js"] }
deno_terminal = { version = "=0.2.2", optional = true }
deno_semver = { version = "=0.7.1", optional = true }
deno_napi = { version = "^0.125.0", optional = true }
deno_npm = { version = "=0.27.2", optional = true }
deno_process = { version = "^0.9.0", optional = true }
deno_package_json = { version = "=0.5.0", optional = true }
deno_napi = { version = "^0.136.0", optional = true }
deno_npm = { version = "=0.33.3", optional = true }
deno_process = { version = "^0.20.0", optional = true }
deno_package_json = { version = "=0.6.0", optional = true }
checksum = { version = "0.2.1", optional = true }
sys_traits = { version = "=0.1.8", optional = true }
sys_traits = { version = "=0.1.9", optional = true }

[dev-dependencies]
version-sync = "0.9.5"
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_runtimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl MyRuntime {
/// Create a new instance of the runtime
pub fn new() -> Result<Self, Error> {
let mut runtime = Self(Runtime::new(RuntimeOptions {
extensions: vec![example_extension::example_extension::init_ops_and_esm()],
extensions: vec![example_extension::example_extension::init()],
timeout: Duration::from_millis(500),
..Default::default()
})?);
Expand Down
2 changes: 1 addition & 1 deletion examples/runtime_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() -> Result<(), Error> {
// allow clone or copy from extensions
let mut runtime = Runtime::new(RuntimeOptions {
schema_whlist,
extensions: vec![example_extension::example_extension::init_ops_and_esm()],
extensions: vec![example_extension::example_extension::init()],
..Default::default()
})?;
let module_handle = runtime.load_module(&module)?;
Expand Down
4 changes: 2 additions & 2 deletions src/ext/broadcast_channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ extension!(
);
impl ExtensionTrait<()> for init_broadcast_channel {
fn init((): ()) -> Extension {
init_broadcast_channel::init_ops_and_esm()
init_broadcast_channel::init()
}
}
impl ExtensionTrait<InMemoryBroadcastChannel> for deno_broadcast_channel::deno_broadcast_channel {
fn init(channel: InMemoryBroadcastChannel) -> Extension {
deno_broadcast_channel::deno_broadcast_channel::init_ops_and_esm(channel)
deno_broadcast_channel::deno_broadcast_channel::init(channel)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ext/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ extension!(
);
impl ExtensionTrait<()> for init_cache {
fn init((): ()) -> Extension {
init_cache::init_ops_and_esm()
init_cache::init()
}
}
impl ExtensionTrait<Option<deno_cache::CreateCache>> for deno_cache::deno_cache {
fn init(options: Option<deno_cache::CreateCache>) -> Extension {
deno_cache::deno_cache::init_ops_and_esm(options)
deno_cache::deno_cache::init(options)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ext/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ extension!(
impl ExtensionTrait<()> for init_console {
fn init((): ()) -> Extension {
deno_terminal::colors::set_use_color(true);
init_console::init_ops_and_esm()
init_console::init()
}
}
impl ExtensionTrait<()> for deno_console::deno_console {
fn init((): ()) -> Extension {
deno_console::deno_console::init_ops_and_esm()
deno_console::deno_console::init()
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ext/cron/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ extension!(
);
impl ExtensionTrait<()> for init_cron {
fn init((): ()) -> Extension {
init_cron::init_ops_and_esm()
init_cron::init()
}
}
impl ExtensionTrait<()> for deno_cron::deno_cron {
fn init((): ()) -> Extension {
deno_cron::deno_cron::init_ops_and_esm(LocalCronHandler::new())
deno_cron::deno_cron::init(LocalCronHandler::new())
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ext/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ extension!(
);
impl ExtensionTrait<()> for init_crypto {
fn init((): ()) -> Extension {
init_crypto::init_ops_and_esm()
init_crypto::init()
}
}
impl ExtensionTrait<Option<u64>> for deno_crypto::deno_crypto {
fn init(seed: Option<u64>) -> Extension {
deno_crypto::deno_crypto::init_ops_and_esm(seed)
deno_crypto::deno_crypto::init(seed)
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/ext/ffi/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::borrow::Cow;

use super::{web::PermissionsContainer, ExtensionTrait};
use deno_core::{extension, Extension};

Expand All @@ -9,12 +11,12 @@ extension!(
);
impl ExtensionTrait<()> for init_ffi {
fn init((): ()) -> Extension {
init_ffi::init_ops_and_esm()
init_ffi::init()
}
}
impl ExtensionTrait<()> for deno_ffi::deno_ffi {
fn init((): ()) -> Extension {
deno_ffi::deno_ffi::init_ops_and_esm::<PermissionsContainer>()
deno_ffi::deno_ffi::init::<PermissionsContainer>(None)
}
}

Expand All @@ -36,7 +38,9 @@ impl deno_ffi::FfiPermissions for PermissionsContainer {
path: &str,
) -> Result<std::path::PathBuf, deno_permissions::PermissionCheckError> {
self.check_partial_no_path()?;
let p = self.0.check_read(std::path::Path::new(path), None)?;
let p = self
.0
.check_read(Cow::Borrowed(std::path::Path::new(path)), None)?;
Ok(p.to_path_buf())
}
}
48 changes: 35 additions & 13 deletions src/ext/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::Path;
use std::{borrow::Cow, path::Path};

use super::{web::PermissionsContainer, ExtensionTrait};
use deno_core::{extension, Extension};
Expand All @@ -14,12 +14,12 @@ extension!(
);
impl ExtensionTrait<()> for init_fs {
fn init((): ()) -> Extension {
init_fs::init_ops_and_esm()
init_fs::init()
}
}
impl ExtensionTrait<FileSystemRc> for deno_fs::deno_fs {
fn init(fs: FileSystemRc) -> Extension {
deno_fs::deno_fs::init_ops_and_esm::<PermissionsContainer>(fs)
deno_fs::deno_fs::init::<PermissionsContainer>(fs)
}
}

Expand All @@ -33,15 +33,37 @@ pub fn extensions(fs: FileSystemRc, is_snapshot: bool) -> Vec<Extension> {
impl deno_fs::FsPermissions for PermissionsContainer {
fn check_open<'a>(
&mut self,
resolved: bool,
read: bool,
write: bool,
path: &'a std::path::Path,
path: std::borrow::Cow<'a, Path>,
api_name: &str,
) -> Result<std::borrow::Cow<'a, std::path::Path>, FsError> {
self.0
.check_open(resolved, read, write, path, api_name)
.ok_or(FsError::NotCapable("Access Denied"))
get_path: &'a dyn deno_fs::GetPath,
) -> Result<deno_fs::CheckedPath<'a>, FsError> {
let (needs_canonicalize, normalized_path_cow) = get_path.normalized(path)?;

if needs_canonicalize {
let resolved_path_buf = get_path.resolved(&normalized_path_cow)?;

let p = self
.0
.check_open(
true,
read,
write,
Cow::Borrowed(&resolved_path_buf),
api_name,
)
.ok_or(FsError::NotCapable("Access Denied"))?;

Ok(deno_fs::CheckedPath::Resolved(Cow::Owned(p.into_owned())))
} else {
let p = self
.0
.check_open(false, read, write, normalized_path_cow, api_name)
.ok_or(FsError::NotCapable("Access Denied"))?;

Ok(deno_fs::CheckedPath::Unresolved(p))
}
}

fn check_read(
Expand All @@ -52,14 +74,14 @@ impl deno_fs::FsPermissions for PermissionsContainer {
self.0.check_read_all(Some(api_name))?;
let p = self
.0
.check_read(Path::new(path), Some(api_name))
.check_read(Cow::Borrowed(Path::new(path)), Some(api_name))
.map(std::borrow::Cow::into_owned)?;
Ok(p)
}

fn check_read_path<'a>(
&mut self,
path: &'a std::path::Path,
path: Cow<'a, std::path::Path>,
api_name: &str,
) -> Result<std::borrow::Cow<'a, std::path::Path>, PermissionCheckError> {
self.0.check_read_all(Some(api_name))?;
Expand Down Expand Up @@ -91,14 +113,14 @@ impl deno_fs::FsPermissions for PermissionsContainer {
self.0.check_write_all(api_name)?;
let p = self
.0
.check_write(Path::new(path), Some(api_name))
.check_write(Cow::Borrowed(Path::new(path)), Some(api_name))
.map(std::borrow::Cow::into_owned)?;
Ok(p)
}

fn check_write_path<'a>(
&mut self,
path: &'a std::path::Path,
path: Cow<'a, std::path::Path>,
api_name: &str,
) -> Result<std::borrow::Cow<'a, std::path::Path>, PermissionCheckError> {
self.0.check_write_all(api_name)?;
Expand Down
7 changes: 4 additions & 3 deletions src/ext/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod http_runtime;
use http_runtime::deno_http_runtime;
impl ExtensionTrait<()> for deno_http_runtime {
fn init((): ()) -> Extension {
deno_http_runtime::init_ops_and_esm()
deno_http_runtime::init()
}
}

Expand All @@ -17,14 +17,15 @@ extension!(
);
impl ExtensionTrait<()> for init_http {
fn init((): ()) -> Extension {
init_http::init_ops_and_esm()
init_http::init()
}
}
impl ExtensionTrait<()> for deno_http::deno_http {
fn init((): ()) -> Extension {
deno_http::deno_http::init_ops_and_esm(deno_http::Options {
deno_http::deno_http::init(deno_http::Options {
http2_builder_hook: None,
http1_builder_hook: None,
no_legacy_abort: false,
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/ext/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ extension!(
);
impl ExtensionTrait<()> for init_io {
fn init((): ()) -> Extension {
init_io::init_ops_and_esm()
init_io::init()
}
}
impl ExtensionTrait<Option<deno_io::Stdio>> for deno_io::deno_io {
fn init(pipes: Option<deno_io::Stdio>) -> Extension {
deno_io::deno_io::init_ops_and_esm(pipes)
deno_io::deno_io::init(pipes)
}
}
impl ExtensionTrait<()> for tty::deno_tty {
fn init((): ()) -> Extension {
tty::deno_tty::init_ops_and_esm()
tty::deno_tty::init()
}
}

Expand Down
Loading