diff --git a/Cargo.lock b/Cargo.lock index 9bd3daf048..bc83710b5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,7 +412,6 @@ dependencies = [ "encoding_rs", "env_logger", "filetime", - "futures", "fwdansi", "http", "indexmap", @@ -429,7 +428,6 @@ dependencies = [ "rustyline", "semver-parser 0.9.0", "serde", - "serde_json", "sourcemap", "swc_common", "swc_ecmascript", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a1b5b3f6ba..1307b445fc 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -44,7 +44,6 @@ dissimilar = "1.0.2" dlopen = "0.1.8" encoding_rs = "0.8.24" dprint-plugin-typescript = "0.31.3" -futures = "0.3.5" # TODO(ry) Remove and use deno_core::futures filetime = "0.2.12" http = "0.2.1" indexmap = "1.6.0" @@ -59,7 +58,6 @@ regex = "1.3.9" ring = "0.16.15" rustyline = { version = "6.3.0", default-features = false } serde = { version = "1.0.116", features = ["derive"] } -serde_json = { version = "1.0.57", features = [ "preserve_order" ] } # TODO(ry) Remove and use deno_core::serde_json sys-info = "0.7.0" sourcemap = "6.0.1" swc_common = { version = "=0.10.2", features = ["sourcemap"] } diff --git a/cli/bench/main.rs b/cli/bench/main.rs index bb735f7171..cf640d1f72 100644 --- a/cli/bench/main.rs +++ b/cli/bench/main.rs @@ -1,6 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -use serde_json::{self, map::Map, Number, Value}; +use deno_core::serde_json::{self, map::Map, Number, Value}; use std::{ convert::From, env, fs, diff --git a/cli/bench/throughput.rs b/cli/bench/throughput.rs index 74844fbed6..611ccbcc30 100644 --- a/cli/bench/throughput.rs +++ b/cli/bench/throughput.rs @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use super::Result; -use serde_json::{Number, Value}; +use deno_core::serde_json::{Number, Value}; use std::{ path::PathBuf, process::Command, diff --git a/cli/coverage.rs b/cli/coverage.rs index 4633575dfb..15a3b5aa14 100644 --- a/cli/coverage.rs +++ b/cli/coverage.rs @@ -7,10 +7,12 @@ use crate::inspector::DenoInspector; use crate::permissions::Permissions; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::futures::channel::oneshot; +use deno_core::serde_json; +use deno_core::serde_json::json; use deno_core::url::Url; use deno_core::v8; use deno_core::ModuleSpecifier; -use futures::channel::oneshot; use serde::Deserialize; use std::collections::HashMap; use std::mem::MaybeUninit; diff --git a/cli/diagnostics.rs b/cli/diagnostics.rs index 06fc585bbd..b3b5a73c3c 100644 --- a/cli/diagnostics.rs +++ b/cli/diagnostics.rs @@ -384,7 +384,8 @@ impl Error for Diagnostics {} mod tests { use super::*; use colors::strip_ansi_codes; - use serde_json::json; + use deno_core::serde_json; + use deno_core::serde_json::json; #[test] fn test_de_diagnostics() { diff --git a/cli/errors.rs b/cli/errors.rs index 7e9eb5b36f..869cdee2c7 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -12,6 +12,7 @@ use crate::ast::DiagnosticBuffer; use crate::import_map::ImportMapError; use deno_core::error::AnyError; +use deno_core::serde_json; use deno_core::url; use deno_core::ModuleResolutionError; use deno_fetch::reqwest; @@ -132,7 +133,7 @@ fn get_request_error_class(error: &reqwest::Error) -> &'static str { fn get_serde_json_error_class( error: &serde_json::error::Error, ) -> &'static str { - use serde_json::error::*; + use deno_core::serde_json::error::*; match error.classify() { Category::Io => error .source() diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs index c4a4d8ea31..af4aef07aa 100644 --- a/cli/file_fetcher.rs +++ b/cli/file_fetcher.rs @@ -12,11 +12,12 @@ use deno_core::error::custom_error; use deno_core::error::generic_error; use deno_core::error::uri_error; use deno_core::error::AnyError; +use deno_core::futures; +use deno_core::futures::future::FutureExt; use deno_core::url; use deno_core::url::Url; use deno_core::ModuleSpecifier; use deno_fetch::reqwest; -use futures::future::FutureExt; use log::info; use std::borrow::Cow; use std::collections::HashMap; diff --git a/cli/file_watcher.rs b/cli/file_watcher.rs index dfcf05e27a..1f0107f49f 100644 --- a/cli/file_watcher.rs +++ b/cli/file_watcher.rs @@ -2,8 +2,8 @@ use crate::colors; use deno_core::error::AnyError; -use futures::stream::StreamExt; -use futures::Future; +use deno_core::futures::stream::StreamExt; +use deno_core::futures::Future; use notify::event::Event as NotifyEvent; use notify::event::EventKind; use notify::Config; diff --git a/cli/fmt.rs b/cli/fmt.rs index d989ac1ada..452ae20b5a 100644 --- a/cli/fmt.rs +++ b/cli/fmt.rs @@ -13,6 +13,7 @@ use crate::fs::files_in_subtree; use crate::text_encoding; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::futures; use dprint_plugin_typescript as dprint; use std::fs; use std::io::stdin; diff --git a/cli/http_cache.rs b/cli/http_cache.rs index 94be58c3bd..995532e609 100644 --- a/cli/http_cache.rs +++ b/cli/http_cache.rs @@ -7,6 +7,7 @@ use crate::fs as deno_fs; use crate::http_util::HeadersMap; use deno_core::error::AnyError; +use deno_core::serde_json; use deno_core::url::Url; use serde::Deserialize; use serde::Serialize; diff --git a/cli/http_util.rs b/cli/http_util.rs index 0defed2a1a..f54684f157 100644 --- a/cli/http_util.rs +++ b/cli/http_util.rs @@ -4,6 +4,7 @@ use crate::version; use bytes::Bytes; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::futures; use deno_core::url::Url; use deno_fetch::reqwest; use deno_fetch::reqwest::header::HeaderMap; diff --git a/cli/import_map.rs b/cli/import_map.rs index 7fb769955c..d58eb5ca0a 100644 --- a/cli/import_map.rs +++ b/cli/import_map.rs @@ -1,11 +1,12 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::Map; +use deno_core::serde_json::Value; use deno_core::url::Url; use deno_core::ModuleSpecifier; use indexmap::IndexMap; -use serde_json::Map; -use serde_json::Value; use std::cmp::Ordering; use std::error::Error; use std::fmt; @@ -473,6 +474,7 @@ impl ImportMap { #[cfg(test)] mod tests { use super::*; + use deno_core::serde_json::json; #[test] fn load_nonexistent() { diff --git a/cli/inspector.rs b/cli/inspector.rs index 691c147fe5..b94da69a33 100644 --- a/cli/inspector.rs +++ b/cli/inspector.rs @@ -5,19 +5,20 @@ //! https://hyperandroid.com/2020/02/12/v8-inspector-from-an-embedder-standpoint/ use core::convert::Infallible as Never; // Alias for the future `!` type. +use deno_core::futures::channel::mpsc; +use deno_core::futures::channel::mpsc::UnboundedReceiver; +use deno_core::futures::channel::mpsc::UnboundedSender; +use deno_core::futures::channel::oneshot; +use deno_core::futures::future::Future; +use deno_core::futures::prelude::*; +use deno_core::futures::select; +use deno_core::futures::stream::FuturesUnordered; +use deno_core::futures::task; +use deno_core::futures::task::Context; +use deno_core::futures::task::Poll; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::v8; -use futures::channel::mpsc; -use futures::channel::mpsc::UnboundedReceiver; -use futures::channel::mpsc::UnboundedSender; -use futures::channel::oneshot; -use futures::future::Future; -use futures::prelude::*; -use futures::select; -use futures::stream::FuturesUnordered; -use futures::task; -use futures::task::Context; -use futures::task::Poll; -use serde_json::Value; use std::cell::BorrowMutError; use std::cell::RefCell; use std::collections::HashMap; diff --git a/cli/lint.rs b/cli/lint.rs index 7190192dca..3b337fe7f4 100644 --- a/cli/lint.rs +++ b/cli/lint.rs @@ -14,6 +14,7 @@ use crate::fmt_errors; use crate::media_type::MediaType; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::serde_json; use deno_lint::diagnostic::LintDiagnostic; use deno_lint::linter::Linter; use deno_lint::linter::LinterBuilder; diff --git a/cli/lockfile.rs b/cli/lockfile.rs index fcc15892b7..266975ba7f 100644 --- a/cli/lockfile.rs +++ b/cli/lockfile.rs @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -use serde_json::json; +use deno_core::serde_json; +use deno_core::serde_json::json; use std::collections::BTreeMap; use std::io::Result; diff --git a/cli/main.rs b/cli/main.rs index fb02e57181..902ccc21df 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -6,8 +6,6 @@ extern crate lazy_static; #[macro_use] extern crate log; -#[macro_use] -extern crate serde_json; mod ast; mod checksum; @@ -68,7 +66,10 @@ use crate::media_type::MediaType; use crate::permissions::Permissions; use crate::worker::MainWorker; use deno_core::error::AnyError; -use deno_core::futures; +use deno_core::futures::future::FutureExt; +use deno_core::futures::Future; +use deno_core::serde_json; +use deno_core::serde_json::json; use deno_core::url::Url; use deno_core::v8_set_flags; use deno_core::ModuleSpecifier; @@ -76,8 +77,6 @@ use deno_doc as doc; use deno_doc::parser::DocFileLoader; use flags::DenoSubcommand; use flags::Flags; -use futures::future::FutureExt; -use futures::Future; use global_state::exit_unstable; use log::Level; use log::LevelFilter; diff --git a/cli/metrics.rs b/cli/metrics.rs index 5efce29db1..c70e0dab9e 100644 --- a/cli/metrics.rs +++ b/cli/metrics.rs @@ -96,7 +96,7 @@ pub fn metrics_op(op_fn: Box) -> Box { let mut s = op_state.borrow_mut(); let metrics = s.borrow_mut::(); - use futures::future::FutureExt; + use deno_core::futures::future::FutureExt; match op { Op::Sync(buf) => { diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 41863762a6..e626dfb079 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -16,11 +16,11 @@ use crate::version; use deno_core::error::custom_error; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::futures::stream::FuturesUnordered; +use deno_core::futures::stream::StreamExt; +use deno_core::futures::Future; +use deno_core::futures::FutureExt; use deno_core::ModuleSpecifier; -use futures::stream::FuturesUnordered; -use futures::stream::StreamExt; -use futures::Future; -use futures::FutureExt; use serde::Serialize; use serde::Serializer; use std::collections::HashMap; @@ -595,6 +595,8 @@ impl ModuleGraphLoader { mod tests { use super::*; use crate::global_state::GlobalState; + use deno_core::serde_json; + use deno_core::serde_json::json; async fn build_graph( module_specifier: &ModuleSpecifier, diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index 618851daa8..faf5fff327 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -1,5 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +use deno_core::serde_json::json; use std::sync::Arc; use std::sync::Mutex; diff --git a/cli/ops/dispatch_minimal.rs b/cli/ops/dispatch_minimal.rs index a21e68faae..ae8fa819d8 100644 --- a/cli/ops/dispatch_minimal.rs +++ b/cli/ops/dispatch_minimal.rs @@ -1,11 +1,11 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; +use deno_core::futures::future::FutureExt; use deno_core::BufVec; use deno_core::Op; use deno_core::OpFn; use deno_core::OpState; -use futures::future::FutureExt; use std::cell::RefCell; use std::future::Future; use std::iter::repeat; diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index 6bf0983e2b..40ea013706 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -4,10 +4,12 @@ use crate::diagnostics::Diagnostics; use crate::source_maps::get_orig_position; use crate::source_maps::CachedMaps; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::OpState; use deno_core::ZeroCopyBuf; use serde::Deserialize; -use serde_json::Value; use std::collections::HashMap; pub fn init(rt: &mut deno_core::JsRuntime) { diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs index ad5cc8add6..7610231c74 100644 --- a/cli/ops/fs.rs +++ b/cli/ops/fs.rs @@ -6,13 +6,15 @@ use crate::permissions::Permissions; use deno_core::error::custom_error; use deno_core::error::type_error; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; use rand::thread_rng; use rand::Rng; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::convert::From; use std::env::{current_dir, set_current_dir, temp_dir}; diff --git a/cli/ops/fs_events.rs b/cli/ops/fs_events.rs index a79784c5ad..4832c915ca 100644 --- a/cli/ops/fs_events.rs +++ b/cli/ops/fs_events.rs @@ -3,10 +3,13 @@ use crate::permissions::Permissions; use deno_core::error::bad_resource_id; use deno_core::error::AnyError; +use deno_core::futures::future::poll_fn; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use futures::future::poll_fn; use notify::event::Event as NotifyEvent; use notify::Error as NotifyError; use notify::EventKind; @@ -15,7 +18,6 @@ use notify::RecursiveMode; use notify::Watcher; use serde::Deserialize; use serde::Serialize; -use serde_json::Value; use std::cell::RefCell; use std::convert::From; use std::path::PathBuf; diff --git a/cli/ops/io.rs b/cli/ops/io.rs index d481e8211d..80ae6bc9eb 100644 --- a/cli/ops/io.rs +++ b/cli/ops/io.rs @@ -8,12 +8,13 @@ use deno_core::error::bad_resource_id; use deno_core::error::resource_unavailable; use deno_core::error::type_error; use deno_core::error::AnyError; +use deno_core::futures; +use deno_core::futures::future::poll_fn; +use deno_core::futures::future::FutureExt; +use deno_core::futures::ready; use deno_core::BufVec; use deno_core::JsRuntime; use deno_core::OpState; -use futures::future::poll_fn; -use futures::future::FutureExt; -use futures::ready; use std::cell::RefCell; use std::collections::HashMap; use std::pin::Pin; diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index 3149f147db..ddc648be6f 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -33,11 +33,11 @@ use crate::metrics::metrics_op; use deno_core::error::AnyError; use deno_core::json_op_async; use deno_core::json_op_sync; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::JsRuntime; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use serde_json::Value; use std::cell::RefCell; use std::future::Future; use std::rc::Rc; diff --git a/cli/ops/net.rs b/cli/ops/net.rs index 4e35f22471..c0cb84a9b6 100644 --- a/cli/ops/net.rs +++ b/cli/ops/net.rs @@ -10,12 +10,15 @@ use deno_core::error::custom_error; use deno_core::error::generic_error; use deno_core::error::type_error; use deno_core::error::AnyError; +use deno_core::futures; +use deno_core::futures::future::poll_fn; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use futures::future::poll_fn; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::net::Shutdown; use std::net::SocketAddr; diff --git a/cli/ops/net_unix.rs b/cli/ops/net_unix.rs index a54c536309..4c416a5a4e 100644 --- a/cli/ops/net_unix.rs +++ b/cli/ops/net_unix.rs @@ -6,11 +6,12 @@ use crate::ops::net::AcceptArgs; use crate::ops::net::ReceiveArgs; use deno_core::error::bad_resource; use deno_core::error::AnyError; +use deno_core::futures::future::poll_fn; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; -use futures::future::poll_fn; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::fs::remove_file; use std::os::unix; @@ -49,7 +50,7 @@ pub(crate) async fn accept_unix( .get_mut::(rid) .ok_or_else(|| bad_resource("Listener has been closed"))?; let listener = &mut listener_resource.listener; - use futures::StreamExt; + use deno_core::futures::StreamExt; match listener.poll_next_unpin(cx) { Poll::Ready(Some(stream)) => { //listener_resource.untrack_task(); diff --git a/cli/ops/os.rs b/cli/ops/os.rs index 42d09da865..4b28f898e7 100644 --- a/cli/ops/os.rs +++ b/cli/ops/os.rs @@ -2,11 +2,13 @@ use crate::permissions::Permissions; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::url::Url; use deno_core::OpState; use deno_core::ZeroCopyBuf; use serde::Deserialize; -use serde_json::Value; use std::collections::HashMap; use std::env; diff --git a/cli/ops/permissions.rs b/cli/ops/permissions.rs index 54dda78bcc..7474c0e376 100644 --- a/cli/ops/permissions.rs +++ b/cli/ops/permissions.rs @@ -3,10 +3,12 @@ use crate::permissions::Permissions; use deno_core::error::custom_error; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::OpState; use deno_core::ZeroCopyBuf; use serde::Deserialize; -use serde_json::Value; use std::path::Path; pub fn init(rt: &mut deno_core::JsRuntime) { diff --git a/cli/ops/plugin.rs b/cli/ops/plugin.rs index c862fb6742..f929a89d3d 100644 --- a/cli/ops/plugin.rs +++ b/cli/ops/plugin.rs @@ -3,7 +3,11 @@ use crate::metrics::metrics_op; use crate::permissions::Permissions; use deno_core::error::AnyError; +use deno_core::futures::prelude::*; use deno_core::plugin_api; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::JsRuntime; use deno_core::Op; @@ -12,9 +16,7 @@ use deno_core::OpId; use deno_core::OpState; use deno_core::ZeroCopyBuf; use dlopen::symbor::Library; -use futures::prelude::*; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::path::PathBuf; use std::pin::Pin; diff --git a/cli/ops/process.rs b/cli/ops/process.rs index 5099889cd8..48b945f07c 100644 --- a/cli/ops/process.rs +++ b/cli/ops/process.rs @@ -6,13 +6,15 @@ use crate::signal::kill; use deno_core::error::bad_resource_id; use deno_core::error::type_error; use deno_core::error::AnyError; +use deno_core::futures::future::poll_fn; +use deno_core::futures::future::FutureExt; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use futures::future::poll_fn; -use futures::future::FutureExt; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::rc::Rc; use tokio::process::Command; diff --git a/cli/ops/random.rs b/cli/ops/random.rs index 84e38d105c..53aedb73fc 100644 --- a/cli/ops/random.rs +++ b/cli/ops/random.rs @@ -1,12 +1,13 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::OpState; use deno_core::ZeroCopyBuf; use rand::rngs::StdRng; use rand::thread_rng; use rand::Rng; -use serde_json::Value; pub fn init(rt: &mut deno_core::JsRuntime) { super::reg_json_sync(rt, "op_get_random_values", op_get_random_values); diff --git a/cli/ops/repl.rs b/cli/ops/repl.rs index c87f7dc5c5..a2c26b2aba 100644 --- a/cli/ops/repl.rs +++ b/cli/ops/repl.rs @@ -4,11 +4,13 @@ use crate::repl; use crate::repl::Repl; use deno_core::error::bad_resource_id; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; diff --git a/cli/ops/runtime.rs b/cli/ops/runtime.rs index 27f2dc8c56..d059301f16 100644 --- a/cli/ops/runtime.rs +++ b/cli/ops/runtime.rs @@ -6,10 +6,12 @@ use crate::permissions::Permissions; use crate::version; use crate::DenoSubcommand; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::ModuleSpecifier; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use serde_json::Value; use std::env; pub fn init(rt: &mut deno_core::JsRuntime) { diff --git a/cli/ops/runtime_compiler.rs b/cli/ops/runtime_compiler.rs index f2839585c0..b51cda95b6 100644 --- a/cli/ops/runtime_compiler.rs +++ b/cli/ops/runtime_compiler.rs @@ -5,11 +5,12 @@ use crate::tsc::runtime_bundle; use crate::tsc::runtime_compile; use crate::tsc::runtime_transpile; use deno_core::error::AnyError; +use deno_core::futures::FutureExt; +use deno_core::serde_json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; -use futures::FutureExt; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; diff --git a/cli/ops/signal.rs b/cli/ops/signal.rs index 3f4c5c8eeb..4159de84a0 100644 --- a/cli/ops/signal.rs +++ b/cli/ops/signal.rs @@ -1,17 +1,21 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use serde_json::Value; use std::cell::RefCell; use std::rc::Rc; #[cfg(unix)] use deno_core::error::bad_resource_id; #[cfg(unix)] -use futures::future::poll_fn; +use deno_core::futures::future::poll_fn; +#[cfg(unix)] +use deno_core::serde_json; +#[cfg(unix)] +use deno_core::serde_json::json; #[cfg(unix)] use serde::Deserialize; #[cfg(unix)] diff --git a/cli/ops/timers.rs b/cli/ops/timers.rs index a3aef3fef0..b7ea625397 100644 --- a/cli/ops/timers.rs +++ b/cli/ops/timers.rs @@ -10,14 +10,17 @@ use crate::permissions::Permissions; use deno_core::error::AnyError; +use deno_core::futures; +use deno_core::futures::channel::oneshot; +use deno_core::futures::FutureExt; +use deno_core::futures::TryFutureExt; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use futures::channel::oneshot; -use futures::FutureExt; -use futures::TryFutureExt; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::future::Future; use std::rc::Rc; diff --git a/cli/ops/tls.rs b/cli/ops/tls.rs index 448e33a9d6..1b812c33f9 100644 --- a/cli/ops/tls.rs +++ b/cli/ops/tls.rs @@ -7,12 +7,15 @@ use deno_core::error::bad_resource; use deno_core::error::bad_resource_id; use deno_core::error::custom_error; use deno_core::error::AnyError; +use deno_core::futures; +use deno_core::futures::future::poll_fn; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use futures::future::poll_fn; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::convert::From; use std::fs::File; diff --git a/cli/ops/tty.rs b/cli/ops/tty.rs index 410256163f..7673090540 100644 --- a/cli/ops/tty.rs +++ b/cli/ops/tty.rs @@ -7,11 +7,13 @@ use deno_core::error::bad_resource_id; use deno_core::error::last_os_error; use deno_core::error::resource_unavailable; use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::OpState; use deno_core::ZeroCopyBuf; use serde::Deserialize; use serde::Serialize; -use serde_json::Value; #[cfg(unix)] use deno_core::error::not_supported; diff --git a/cli/ops/web_worker.rs b/cli/ops/web_worker.rs index fad0b9df7a..e57edaf6c2 100644 --- a/cli/ops/web_worker.rs +++ b/cli/ops/web_worker.rs @@ -2,7 +2,8 @@ use crate::web_worker::WebWorkerHandle; use crate::worker::WorkerEvent; -use futures::channel::mpsc; +use deno_core::futures::channel::mpsc; +use deno_core::serde_json::json; pub fn init( rt: &mut deno_core::JsRuntime, diff --git a/cli/ops/websocket.rs b/cli/ops/websocket.rs index e16ce258cf..6c4d079b6b 100644 --- a/cli/ops/websocket.rs +++ b/cli/ops/websocket.rs @@ -5,15 +5,17 @@ use core::task::Poll; use deno_core::error::bad_resource_id; use deno_core::error::type_error; use deno_core::error::AnyError; +use deno_core::futures::future::poll_fn; +use deno_core::futures::StreamExt; +use deno_core::futures::{ready, SinkExt}; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::url; use deno_core::BufVec; use deno_core::OpState; -use futures::future::poll_fn; -use futures::StreamExt; -use futures::{ready, SinkExt}; use http::{Method, Request, Uri}; use serde::Deserialize; -use serde_json::Value; use std::borrow::Cow; use std::cell::RefCell; use std::fs::File; diff --git a/cli/ops/worker_host.rs b/cli/ops/worker_host.rs index f7b981c149..058ffaa315 100644 --- a/cli/ops/worker_host.rs +++ b/cli/ops/worker_host.rs @@ -9,13 +9,15 @@ use crate::web_worker::WebWorker; use crate::web_worker::WebWorkerHandle; use crate::worker::WorkerEvent; use deno_core::error::AnyError; +use deno_core::futures::future::FutureExt; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::BufVec; use deno_core::ModuleSpecifier; use deno_core::OpState; use deno_core::ZeroCopyBuf; -use futures::future::FutureExt; use serde::Deserialize; -use serde_json::Value; use std::cell::RefCell; use std::collections::HashMap; use std::convert::From; diff --git a/cli/permissions.rs b/cli/permissions.rs index 06a33096f2..d2f58de0a9 100644 --- a/cli/permissions.rs +++ b/cli/permissions.rs @@ -733,6 +733,7 @@ fn permission_escalation_error() -> AnyError { #[cfg(test)] mod tests { use super::*; + use deno_core::serde_json; // Creates vector of strings, Vec macro_rules! svec { diff --git a/cli/state.rs b/cli/state.rs index dcf540d095..7a3541af77 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -5,12 +5,12 @@ use crate::import_map::ImportMap; use crate::permissions::Permissions; use crate::tsc::TargetLib; use deno_core::error::AnyError; +use deno_core::futures::future::FutureExt; +use deno_core::futures::Future; use deno_core::ModuleLoadId; use deno_core::ModuleLoader; use deno_core::ModuleSpecifier; use deno_core::OpState; -use futures::future::FutureExt; -use futures::Future; use std::cell::RefCell; use std::pin::Pin; use std::rc::Rc; diff --git a/cli/test_runner.rs b/cli/test_runner.rs index 7b5366852b..1e91d1c309 100644 --- a/cli/test_runner.rs +++ b/cli/test_runner.rs @@ -3,6 +3,7 @@ use crate::fs as deno_fs; use crate::installer::is_remote_url; use deno_core::error::AnyError; +use deno_core::serde_json::json; use deno_core::url::Url; use std::path::Path; use std::path::PathBuf; diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index a03dc7dc47..cb633bdd28 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +use deno_core::futures; +use deno_core::futures::prelude::*; use deno_core::url; -use futures::prelude::*; use std::io::{BufRead, Write}; use std::process::Command; use tempfile::TempDir; @@ -3088,7 +3089,7 @@ async fn inspector_pause() { async fn ws_read_msg( socket: &mut tokio_tungstenite::WebSocketStream, ) -> String { - use futures::stream::StreamExt; + use deno_core::futures::stream::StreamExt; while let Some(msg) = socket.next().await { let msg = msg.unwrap().to_string(); // FIXME(bartlomieju): fails because there's a file loaded diff --git a/cli/tsc.rs b/cli/tsc.rs index c4102cc422..4665a268ff 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -25,10 +25,13 @@ use crate::worker::Worker; use core::task::Context; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::futures::future::Future; +use deno_core::futures::future::FutureExt; +use deno_core::serde_json; +use deno_core::serde_json::json; +use deno_core::serde_json::Value; use deno_core::url::Url; use deno_core::ModuleSpecifier; -use futures::future::Future; -use futures::future::FutureExt; use log::debug; use log::info; use log::Level; @@ -36,8 +39,6 @@ use regex::Regex; use serde::Deserialize; use serde::Serialize; use serde::Serializer; -use serde_json::json; -use serde_json::Value; use sourcemap::SourceMap; use std::collections::HashMap; use std::collections::HashSet; diff --git a/cli/tsc_config.rs b/cli/tsc_config.rs index a86b549bc2..63538d49f3 100644 --- a/cli/tsc_config.rs +++ b/cli/tsc_config.rs @@ -1,9 +1,10 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; +use deno_core::serde_json; +use deno_core::serde_json::Value; use jsonc_parser::JsonValue; use serde::Deserialize; -use serde_json::Value; use std::collections::HashMap; use std::fmt; use std::str::FromStr; @@ -178,7 +179,7 @@ pub fn parse_config( #[cfg(test)] mod tests { use super::*; - use serde_json::json; + use deno_core::serde_json::json; #[test] fn test_json_merge() { diff --git a/cli/upgrade.rs b/cli/upgrade.rs index 544f2b3291..37c7a88ed3 100644 --- a/cli/upgrade.rs +++ b/cli/upgrade.rs @@ -10,11 +10,11 @@ use crate::http_util::fetch_once; use crate::http_util::FetchOnceResult; use crate::AnyError; use deno_core::error::custom_error; +use deno_core::futures::FutureExt; use deno_core::url::Url; use deno_fetch::reqwest; use deno_fetch::reqwest::redirect::Policy; use deno_fetch::reqwest::Client; -use futures::FutureExt; use regex::Regex; use semver_parser::version::parse as semver_parse; use semver_parser::version::Version; diff --git a/cli/web_worker.rs b/cli/web_worker.rs index ab021a93d2..587bc055d7 100644 --- a/cli/web_worker.rs +++ b/cli/web_worker.rs @@ -9,11 +9,11 @@ use crate::worker::Worker; use crate::worker::WorkerEvent; use crate::worker::WorkerHandle; use deno_core::error::AnyError; +use deno_core::futures::channel::mpsc; +use deno_core::futures::future::FutureExt; +use deno_core::futures::stream::StreamExt; use deno_core::v8; use deno_core::ModuleSpecifier; -use futures::channel::mpsc; -use futures::future::FutureExt; -use futures::stream::StreamExt; use std::future::Future; use std::ops::Deref; use std::ops::DerefMut; @@ -268,6 +268,7 @@ mod tests { use super::*; use crate::tokio_util; use crate::worker::WorkerEvent; + use deno_core::serde_json::json; fn create_test_worker() -> WebWorker { let main_module = diff --git a/cli/worker.rs b/cli/worker.rs index f87cd5cf18..98418d4faa 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -13,16 +13,16 @@ use crate::ops::worker_host::WorkersTable; use crate::permissions::Permissions; use crate::state::CliModuleLoader; use deno_core::error::AnyError; +use deno_core::futures::channel::mpsc; +use deno_core::futures::future::FutureExt; +use deno_core::futures::stream::StreamExt; +use deno_core::futures::task::AtomicWaker; use deno_core::url::Url; use deno_core::JsRuntime; use deno_core::ModuleId; use deno_core::ModuleSpecifier; use deno_core::RuntimeOptions; use deno_core::Snapshot; -use futures::channel::mpsc; -use futures::future::FutureExt; -use futures::stream::StreamExt; -use futures::task::AtomicWaker; use rand::rngs::StdRng; use rand::SeedableRng; use std::env;