mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
refactor: use futures and serde_json from deno_core (#7614)
This commit is contained in:
parent
9d738fc197
commit
92edc36442
52 changed files with 156 additions and 97 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -96,7 +96,7 @@ pub fn metrics_op(op_fn: Box<OpFn>) -> Box<OpFn> {
|
|||
let mut s = op_state.borrow_mut();
|
||||
let metrics = s.borrow_mut::<Metrics>();
|
||||
|
||||
use futures::future::FutureExt;
|
||||
use deno_core::futures::future::FutureExt;
|
||||
|
||||
match op {
|
||||
Op::Sync(buf) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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::<UnixListenerResource>(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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<String>
|
||||
macro_rules! svec {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<tokio::net::TcpStream>,
|
||||
) -> 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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue