1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00

remove macro_use (#9884)

This commit is contained in:
Ryan Dahl 2021-03-26 12:34:25 -04:00 committed by GitHub
parent 6c6f3e87c1
commit f46e39c5c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 101 additions and 107 deletions

View file

@ -1,6 +1,8 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use log::debug;
use log::error;
use std::fmt; use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]

View file

@ -4,7 +4,6 @@
#![allow(dead_code)] #![allow(dead_code)]
use regex::Regex; use regex::Regex;
use std::env;
use std::fmt; use std::fmt;
use std::io::Write; use std::io::Write;
use termcolor::Color::{Ansi256, Black, Blue, Cyan, Green, Red, White, Yellow}; use termcolor::Color::{Ansi256, Black, Blue, Cyan, Green, Red, White, Yellow};
@ -13,14 +12,14 @@ use termcolor::{Ansi, ColorSpec, WriteColor};
#[cfg(windows)] #[cfg(windows)]
use termcolor::{BufferWriter, ColorChoice}; use termcolor::{BufferWriter, ColorChoice};
lazy_static! { lazy_static::lazy_static! {
// STRIP_ANSI_RE and strip_ansi_codes are lifted from the "console" crate. // STRIP_ANSI_RE and strip_ansi_codes are lifted from the "console" crate.
// Copyright 2017 Armin Ronacher <armin.ronacher@active-4.com>. MIT License. // Copyright 2017 Armin Ronacher <armin.ronacher@active-4.com>. MIT License.
static ref STRIP_ANSI_RE: Regex = Regex::new( static ref STRIP_ANSI_RE: Regex = Regex::new(
r"[\x1b\x9b][\[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]" r"[\x1b\x9b][\[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]"
).unwrap(); ).unwrap();
static ref NO_COLOR: bool = { static ref NO_COLOR: bool = {
env::var_os("NO_COLOR").is_some() std::env::var_os("NO_COLOR").is_some()
}; };
} }

View file

@ -63,7 +63,7 @@ const UNSTABLE_DENO_PROPS: &[&str] = &[
"utimeSync", "utimeSync",
]; ];
lazy_static! { lazy_static::lazy_static! {
static ref MSG_MISSING_PROPERTY_DENO: Regex = static ref MSG_MISSING_PROPERTY_DENO: Regex =
Regex::new(r#"Property '([^']+)' does not exist on type 'typeof Deno'"#) Regex::new(r#"Property '([^']+)' does not exist on type 'typeof Deno'"#)
.unwrap(); .unwrap();

View file

@ -10,8 +10,6 @@ use crate::http_util::FetchOnceResult;
use crate::media_type::MediaType; use crate::media_type::MediaType;
use crate::text_encoding; use crate::text_encoding;
use crate::version::get_user_agent; use crate::version::get_user_agent;
use deno_runtime::permissions::Permissions;
use deno_core::error::custom_error; use deno_core::error::custom_error;
use deno_core::error::generic_error; use deno_core::error::generic_error;
use deno_core::error::uri_error; use deno_core::error::uri_error;
@ -20,6 +18,9 @@ use deno_core::futures;
use deno_core::futures::future::FutureExt; use deno_core::futures::future::FutureExt;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use deno_runtime::deno_fetch::reqwest; use deno_runtime::deno_fetch::reqwest;
use deno_runtime::permissions::Permissions;
use log::debug;
use log::info;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::fs; use std::fs;

View file

@ -5,6 +5,7 @@ use deno_core::error::AnyError;
use deno_core::futures::ready; use deno_core::futures::ready;
use deno_core::futures::stream::{Stream, StreamExt}; use deno_core::futures::stream::{Stream, StreamExt};
use deno_core::futures::Future; use deno_core::futures::Future;
use log::info;
use notify::event::Event as NotifyEvent; use notify::event::Event as NotifyEvent;
use notify::event::EventKind; use notify::event::EventKind;
use notify::Config; use notify::Config;

View file

@ -10,11 +10,27 @@ use deno_core::serde::Deserialize;
use deno_core::serde::Serialize; use deno_core::serde::Serialize;
use deno_core::url::Url; use deno_core::url::Url;
use deno_runtime::permissions::PermissionsOptions; use deno_runtime::permissions::PermissionsOptions;
use log::debug;
use log::Level; use log::Level;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
lazy_static::lazy_static! {
static ref LONG_VERSION: String = format!(
"{} ({}, {})\nv8 {}\ntypescript {}",
crate::version::deno(),
if crate::version::is_canary() {
"canary"
} else {
env!("PROFILE")
},
env!("TARGET"),
deno_core::v8_version(),
crate::version::TYPESCRIPT
);
}
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum DenoSubcommand { pub enum DenoSubcommand {
Bundle { Bundle {
@ -259,21 +275,6 @@ To evaluate code in the shell:
deno eval \"console.log(30933 + 404)\" deno eval \"console.log(30933 + 404)\"
"; ";
lazy_static! {
static ref LONG_VERSION: String = format!(
"{} ({}, {})\nv8 {}\ntypescript {}",
crate::version::deno(),
if crate::version::is_canary() {
"canary"
} else {
env!("PROFILE")
},
env!("TARGET"),
deno_core::v8_version(),
crate::version::TYPESCRIPT
);
}
/// Main entry point for parsing deno's command line flags. /// Main entry point for parsing deno's command line flags.
pub fn flags_from_vec(args: Vec<String>) -> clap::Result<Flags> { pub fn flags_from_vec(args: Vec<String>) -> clap::Result<Flags> {
let version = crate::version::deno(); let version = crate::version::deno();

View file

@ -1,9 +1,8 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
//! This module is meant to eventually implement HTTP cache
/// This module is meant to eventually implement HTTP cache //! as defined in RFC 7234 (https://tools.ietf.org/html/rfc7234).
/// as defined in RFC 7234 (https://tools.ietf.org/html/rfc7234). //! Currently it's a very simplified version to fulfill Deno needs
/// Currently it's a very simplified version to fulfill Deno needs //! at hand.
/// at hand.
use crate::fs_util; use crate::fs_util;
use crate::http_util::HeadersMap; use crate::http_util::HeadersMap;
use deno_core::error::generic_error; use deno_core::error::generic_error;
@ -12,6 +11,7 @@ use deno_core::serde::Deserialize;
use deno_core::serde::Serialize; use deno_core::serde::Serialize;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::url::Url; use deno_core::url::Url;
use log::error;
use std::fs; use std::fs;
use std::fs::File; use std::fs::File;
use std::io; use std::io;

View file

@ -15,6 +15,7 @@ use deno_runtime::deno_fetch::reqwest::header::USER_AGENT;
use deno_runtime::deno_fetch::reqwest::redirect::Policy; use deno_runtime::deno_fetch::reqwest::redirect::Policy;
use deno_runtime::deno_fetch::reqwest::Client; use deno_runtime::deno_fetch::reqwest::Client;
use deno_runtime::deno_fetch::reqwest::StatusCode; use deno_runtime::deno_fetch::reqwest::StatusCode;
use log::debug;
use std::collections::HashMap; use std::collections::HashMap;
/// Create new instance of async reqwest::Client. This client supports /// Create new instance of async reqwest::Client. This client supports

View file

@ -6,6 +6,8 @@ use deno_core::serde_json::Map;
use deno_core::serde_json::Value; use deno_core::serde_json::Value;
use deno_core::url::Url; use deno_core::url::Url;
use indexmap::IndexMap; use indexmap::IndexMap;
use log::debug;
use log::info;
use std::cmp::Ordering; use std::cmp::Ordering;
use std::collections::HashSet; use std::collections::HashSet;
use std::error::Error; use std::error::Error;

View file

@ -2,6 +2,7 @@
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::serde_json::json; use deno_core::serde_json::json;
use log::debug;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::io::Result; use std::io::Result;
use std::path::PathBuf; use std::path::PathBuf;

View file

@ -28,7 +28,7 @@ use std::collections::HashMap;
use std::fmt; use std::fmt;
use std::rc::Rc; use std::rc::Rc;
lazy_static! { lazy_static::lazy_static! {
/// Diagnostic error codes which actually are the same, and so when grouping /// Diagnostic error codes which actually are the same, and so when grouping
/// fixes we treat them the same. /// fixes we treat them the same.
static ref FIX_ALL_ERROR_CODES: HashMap<&'static str, &'static str> = static ref FIX_ALL_ERROR_CODES: HashMap<&'static str, &'static str> =

View file

@ -15,6 +15,7 @@ use deno_core::error::AnyError;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::serde_json::json; use deno_core::serde_json::json;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use log::error;
use lspower::lsp; use lspower::lsp;
use lspower::Client; use lspower::Client;
use std::collections::HashMap; use std::collections::HashMap;

View file

@ -10,6 +10,9 @@ use deno_core::serde_json::json;
use deno_core::serde_json::Value; use deno_core::serde_json::Value;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use dprint_plugin_typescript as dprint; use dprint_plugin_typescript as dprint;
use log::error;
use log::info;
use log::warn;
use lspower::jsonrpc::Error as LspError; use lspower::jsonrpc::Error as LspError;
use lspower::jsonrpc::Result as LspResult; use lspower::jsonrpc::Result as LspResult;
use lspower::lsp::request::*; use lspower::lsp::request::*;
@ -55,7 +58,7 @@ use super::tsc::Assets;
use super::tsc::TsServer; use super::tsc::TsServer;
use super::urls; use super::urls;
lazy_static! { lazy_static::lazy_static! {
static ref ABSTRACT_MODIFIER: Regex = Regex::new(r"\babstract\b").unwrap(); static ref ABSTRACT_MODIFIER: Regex = Regex::new(r"\babstract\b").unwrap();
static ref EXPORT_MODIFIER: Regex = Regex::new(r"\bexport\b").unwrap(); static ref EXPORT_MODIFIER: Regex = Regex::new(r"\bexport\b").unwrap();
} }

View file

@ -31,6 +31,7 @@ use deno_core::JsRuntime;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use deno_core::OpFn; use deno_core::OpFn;
use deno_core::RuntimeOptions; use deno_core::RuntimeOptions;
use log::warn;
use lspower::lsp; use lspower::lsp;
use regex::Captures; use regex::Captures;
use regex::Regex; use regex::Regex;

View file

@ -2,11 +2,6 @@
#![deny(warnings)] #![deny(warnings)]
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
mod ast; mod ast;
mod auth_tokens; mod auth_tokens;
mod checksum; mod checksum;
@ -70,6 +65,8 @@ use deno_runtime::web_worker::WebWorker;
use deno_runtime::web_worker::WebWorkerOptions; use deno_runtime::web_worker::WebWorkerOptions;
use deno_runtime::worker::MainWorker; use deno_runtime::worker::MainWorker;
use deno_runtime::worker::WorkerOptions; use deno_runtime::worker::WorkerOptions;
use log::debug;
use log::info;
use log::Level; use log::Level;
use log::LevelFilter; use log::LevelFilter;
use std::env; use std::env;

View file

@ -2,9 +2,6 @@
#![deny(warnings)] #![deny(warnings)]
#[macro_use]
extern crate lazy_static;
mod colors; mod colors;
mod standalone; mod standalone;
mod tokio_util; mod tokio_util;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::ast; use crate::ast;
use crate::ast::parse; use crate::ast::parse;
use crate::ast::transpile_module; use crate::ast::transpile_module;
@ -23,11 +22,10 @@ use crate::tsc;
use crate::tsc_config::IgnoredCompilerOptions; use crate::tsc_config::IgnoredCompilerOptions;
use crate::tsc_config::TsConfig; use crate::tsc_config::TsConfig;
use crate::version; use crate::version;
use deno_core::error::AnyError;
use deno_core::error::anyhow; use deno_core::error::anyhow;
use deno_core::error::custom_error; use deno_core::error::custom_error;
use deno_core::error::get_custom_error_class; use deno_core::error::get_custom_error_class;
use deno_core::error::AnyError;
use deno_core::error::Context; use deno_core::error::Context;
use deno_core::futures::stream::FuturesUnordered; use deno_core::futures::stream::FuturesUnordered;
use deno_core::futures::stream::StreamExt; use deno_core::futures::stream::StreamExt;
@ -41,6 +39,7 @@ use deno_core::serde_json::Value;
use deno_core::ModuleResolutionError; use deno_core::ModuleResolutionError;
use deno_core::ModuleSource; use deno_core::ModuleSource;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use log::debug;
use regex::Regex; use regex::Regex;
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::HashSet; use std::collections::HashSet;
@ -53,7 +52,7 @@ use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Instant; use std::time::Instant;
lazy_static! { lazy_static::lazy_static! {
/// Matched the `@deno-types` pragma. /// Matched the `@deno-types` pragma.
static ref DENO_TYPES_RE: Regex = static ref DENO_TYPES_RE: Regex =
Regex::new(r#"(?i)^\s*@deno-types\s*=\s*(?:["']([^"']+)["']|(\S+))"#) Regex::new(r#"(?i)^\s*@deno-types\s*=\s*(?:["']([^"']+)["']|(\S+))"#)
@ -846,7 +845,7 @@ impl Graph {
// moved it out of here, we wouldn't know until after the check has already // moved it out of here, we wouldn't know until after the check has already
// happened, which isn't informative to the users. // happened, which isn't informative to the users.
for specifier in &self.roots { for specifier in &self.roots {
info!("{} {}", colors::green("Check"), specifier); log::info!("{} {}", colors::green("Check"), specifier);
} }
let root_names = self.get_root_names(!config.get_check_js())?; let root_names = self.get_root_names(!config.get_check_js())?;

View file

@ -25,6 +25,8 @@ use deno_core::resolve_url;
use deno_core::url::Url; use deno_core::url::Url;
use deno_core::ModuleSource; use deno_core::ModuleSource;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use log::debug;
use log::warn;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::fs::read; use std::fs::read;

View file

@ -17,6 +17,7 @@ use deno_core::serde::Deserialize;
use deno_core::serde::Serialize; use deno_core::serde::Serialize;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use log::debug;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::fmt; use std::fmt;

View file

@ -16,6 +16,8 @@ use deno_core::error::generic_error;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::futures; use deno_core::futures;
use deno_core::futures::FutureExt; use deno_core::futures::FutureExt;
use log::debug;
use log::info;
use std::fs; use std::fs;
use std::io::stdin; use std::io::stdin;
use std::io::stdout; use std::io::stdout;

View file

@ -1,23 +1,24 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::flags::Flags; use crate::flags::Flags;
use crate::fs_util::canonicalize_path; use crate::fs_util::canonicalize_path;
use deno_core::error::generic_error; use deno_core::error::generic_error;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::url::Url; use deno_core::url::Url;
use log::Level; use log::Level;
use regex::{Regex, RegexBuilder}; use regex::Regex;
use regex::RegexBuilder;
use std::env; use std::env;
use std::fs; use std::fs;
use std::fs::File; use std::fs::File;
use std::io; use std::io;
use std::io::Write; use std::io::Write;
#[cfg(not(windows))]
use std::os::unix::fs::PermissionsExt;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
lazy_static! { #[cfg(not(windows))]
use std::os::unix::fs::PermissionsExt;
lazy_static::lazy_static! {
static ref EXEC_NAME_RE: Regex = RegexBuilder::new( static ref EXEC_NAME_RE: Regex = RegexBuilder::new(
r"^[a-z][\w-]*$" r"^[a-z][\w-]*$"
).case_insensitive(true).build().unwrap(); ).case_insensitive(true).build().unwrap();
@ -337,7 +338,7 @@ mod tests {
use std::sync::Mutex; use std::sync::Mutex;
use tempfile::TempDir; use tempfile::TempDir;
lazy_static! { lazy_static::lazy_static! {
pub static ref ENV_LOCK: Mutex<()> = Mutex::new(()); pub static ref ENV_LOCK: Mutex<()> = Mutex::new(());
} }

View file

@ -19,6 +19,8 @@ use deno_lint::linter::Linter;
use deno_lint::linter::LinterBuilder; use deno_lint::linter::LinterBuilder;
use deno_lint::rules; use deno_lint::rules;
use deno_lint::rules::LintRule; use deno_lint::rules::LintRule;
use log::debug;
use log::info;
use serde::Serialize; use serde::Serialize;
use std::fs; use std::fs;
use std::io::{stdin, Read}; use std::io::{stdin, Read};

View file

@ -12,7 +12,7 @@ use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use tempfile::TempDir; use tempfile::TempDir;
lazy_static! { lazy_static::lazy_static! {
static ref ARCHIVE_NAME: String = format!("deno-{}.zip", env!("TARGET")); static ref ARCHIVE_NAME: String = format!("deno-{}.zip", env!("TARGET"));
} }

View file

@ -55,7 +55,7 @@ macro_rules! inc {
}; };
} }
lazy_static! { lazy_static::lazy_static! {
/// Contains static assets that are not preloaded in the compiler snapshot. /// Contains static assets that are not preloaded in the compiler snapshot.
pub(crate) static ref STATIC_ASSETS: HashMap<&'static str, &'static str> = (&[ pub(crate) static ref STATIC_ASSETS: HashMap<&'static str, &'static str> = (&[
("lib.dom.asynciterable.d.ts", inc!("lib.dom.asynciterable.d.ts")), ("lib.dom.asynciterable.d.ts", inc!("lib.dom.asynciterable.d.ts")),

View file

@ -9,6 +9,8 @@ use crate::OpTable;
use crate::ZeroCopyBuf; use crate::ZeroCopyBuf;
use futures::future::FutureExt; use futures::future::FutureExt;
use rusty_v8 as v8; use rusty_v8 as v8;
use serde::Serialize;
use serde_v8::to_v8;
use std::cell::Cell; use std::cell::Cell;
use std::convert::TryFrom; use std::convert::TryFrom;
use std::convert::TryInto; use std::convert::TryInto;
@ -17,10 +19,7 @@ use std::option::Option;
use url::Url; use url::Url;
use v8::MapFnTo; use v8::MapFnTo;
use serde::Serialize; lazy_static::lazy_static! {
use serde_v8::to_v8;
lazy_static! {
pub static ref EXTERNAL_REFERENCES: v8::ExternalReferences = pub static ref EXTERNAL_REFERENCES: v8::ExternalReferences =
v8::ExternalReferences::new(&[ v8::ExternalReferences::new(&[
v8::ExternalReference { v8::ExternalReference {

View file

@ -1,8 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
#[macro_use]
extern crate log;
use deno_core::error::bad_resource_id; use deno_core::error::bad_resource_id;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::AsyncRefCell; use deno_core::AsyncRefCell;
@ -128,7 +124,7 @@ fn op_listen(
_rid: ResourceId, _rid: ResourceId,
_bufs: &mut [ZeroCopyBuf], _bufs: &mut [ZeroCopyBuf],
) -> Result<u32, AnyError> { ) -> Result<u32, AnyError> {
debug!("listen"); log::debug!("listen");
let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap(); let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap();
let std_listener = std::net::TcpListener::bind(&addr)?; let std_listener = std::net::TcpListener::bind(&addr)?;
std_listener.set_nonblocking(true)?; std_listener.set_nonblocking(true)?;
@ -142,7 +138,7 @@ fn op_close(
rid: ResourceId, rid: ResourceId,
_bufs: &mut [ZeroCopyBuf], _bufs: &mut [ZeroCopyBuf],
) -> Result<u32, AnyError> { ) -> Result<u32, AnyError> {
debug!("close rid={}", rid); log::debug!("close rid={}", rid);
state state
.resource_table .resource_table
.close(rid) .close(rid)
@ -155,7 +151,7 @@ async fn op_accept(
rid: ResourceId, rid: ResourceId,
_bufs: BufVec, _bufs: BufVec,
) -> Result<u32, AnyError> { ) -> Result<u32, AnyError> {
debug!("accept rid={}", rid); log::debug!("accept rid={}", rid);
let listener = state let listener = state
.borrow() .borrow()
@ -173,7 +169,7 @@ async fn op_read(
mut bufs: BufVec, mut bufs: BufVec,
) -> Result<u32, AnyError> { ) -> Result<u32, AnyError> {
assert_eq!(bufs.len(), 1, "Invalid number of arguments"); assert_eq!(bufs.len(), 1, "Invalid number of arguments");
debug!("read rid={}", rid); log::debug!("read rid={}", rid);
let stream = state let stream = state
.borrow() .borrow()
@ -190,7 +186,7 @@ async fn op_write(
bufs: BufVec, bufs: BufVec,
) -> Result<u32, AnyError> { ) -> Result<u32, AnyError> {
assert_eq!(bufs.len(), 1, "Invalid number of arguments"); assert_eq!(bufs.len(), 1, "Invalid number of arguments");
debug!("write rid={}", rid); log::debug!("write rid={}", rid);
let stream = state let stream = state
.borrow() .borrow()

View file

@ -1,8 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
#[macro_use]
extern crate log;
use deno_core::error::bad_resource_id; use deno_core::error::bad_resource_id;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::AsyncRefCell; use deno_core::AsyncRefCell;
@ -135,7 +131,7 @@ fn op_listen(
_args: (), _args: (),
_bufs: &mut [ZeroCopyBuf], _bufs: &mut [ZeroCopyBuf],
) -> Result<ResourceId, AnyError> { ) -> Result<ResourceId, AnyError> {
debug!("listen"); log::debug!("listen");
let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap(); let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap();
let std_listener = std::net::TcpListener::bind(&addr)?; let std_listener = std::net::TcpListener::bind(&addr)?;
std_listener.set_nonblocking(true)?; std_listener.set_nonblocking(true)?;
@ -149,7 +145,7 @@ fn op_close(
args: ResourceId, args: ResourceId,
_buf: &mut [ZeroCopyBuf], _buf: &mut [ZeroCopyBuf],
) -> Result<(), AnyError> { ) -> Result<(), AnyError> {
debug!("close rid={}", args.rid); log::debug!("close rid={}", args.rid);
state state
.resource_table .resource_table
.close(args.rid) .close(args.rid)
@ -162,7 +158,7 @@ async fn op_accept(
args: ResourceId, args: ResourceId,
_bufs: BufVec, _bufs: BufVec,
) -> Result<ResourceId, AnyError> { ) -> Result<ResourceId, AnyError> {
debug!("accept rid={}", args.rid); log::debug!("accept rid={}", args.rid);
let listener = state let listener = state
.borrow() .borrow()
@ -180,7 +176,7 @@ async fn op_read(
mut bufs: BufVec, mut bufs: BufVec,
) -> Result<Value, AnyError> { ) -> Result<Value, AnyError> {
assert_eq!(bufs.len(), 1, "Invalid number of arguments"); assert_eq!(bufs.len(), 1, "Invalid number of arguments");
debug!("read rid={}", args.rid); log::debug!("read rid={}", args.rid);
let stream = state let stream = state
.borrow() .borrow()
@ -197,7 +193,7 @@ async fn op_write(
bufs: BufVec, bufs: BufVec,
) -> Result<Value, AnyError> { ) -> Result<Value, AnyError> {
assert_eq!(bufs.len(), 1, "Invalid number of arguments"); assert_eq!(bufs.len(), 1, "Invalid number of arguments");
debug!("write rid={}", args.rid); log::debug!("write rid={}", args.rid);
let stream = state let stream = state
.borrow() .borrow()

View file

@ -3,6 +3,7 @@
// https://github.com/gotham-rs/gotham/blob/bcbbf8923789e341b7a0e62c59909428ca4e22e2/gotham/src/state/mod.rs // https://github.com/gotham-rs/gotham/blob/bcbbf8923789e341b7a0e62c59909428ca4e22e2/gotham/src/state/mod.rs
// Copyright 2017 Gotham Project Developers. MIT license. // Copyright 2017 Gotham Project Developers. MIT license.
use log::trace;
use std::any::Any; use std::any::Any;
use std::any::TypeId; use std::any::TypeId;
use std::collections::HashMap; use std::collections::HashMap;

View file

@ -1,10 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
mod async_cancel; mod async_cancel;
mod async_cell; mod async_cell;
mod bindings; mod bindings;

View file

@ -21,7 +21,7 @@ use std::sync::atomic::Ordering;
use std::task::Context; use std::task::Context;
use std::task::Poll; use std::task::Poll;
lazy_static! { lazy_static::lazy_static! {
pub static ref NEXT_LOAD_ID: AtomicI32 = AtomicI32::new(0); pub static ref NEXT_LOAD_ID: AtomicI32 = AtomicI32::new(0);
} }

View file

@ -31,6 +31,7 @@ use futures::stream::StreamExt;
use futures::stream::StreamFuture; use futures::stream::StreamFuture;
use futures::task::AtomicWaker; use futures::task::AtomicWaker;
use futures::Future; use futures::Future;
use log::debug;
use std::any::Any; use std::any::Any;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;

View file

@ -18,6 +18,7 @@ SharedQueue Binary Layout
use crate::bindings; use crate::bindings;
use crate::ops::OpId; use crate::ops::OpId;
use log::debug;
use rusty_v8 as v8; use rusty_v8 as v8;
use std::convert::TryInto; use std::convert::TryInto;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use regex::Regex; use regex::Regex;
use std::env; use std::env;
use std::fmt; use std::fmt;
@ -10,15 +9,13 @@ use termcolor::{Ansi, ColorSpec, WriteColor};
#[cfg(windows)] #[cfg(windows)]
use termcolor::{BufferWriter, ColorChoice}; use termcolor::{BufferWriter, ColorChoice};
lazy_static! { lazy_static::lazy_static! {
// STRIP_ANSI_RE and strip_ansi_codes are lifted from the "console" crate. // STRIP_ANSI_RE and strip_ansi_codes are lifted from the "console" crate.
// Copyright 2017 Armin Ronacher <armin.ronacher@active-4.com>. MIT License. // Copyright 2017 Armin Ronacher <armin.ronacher@active-4.com>. MIT License.
static ref STRIP_ANSI_RE: Regex = Regex::new( static ref STRIP_ANSI_RE: Regex = Regex::new(
r"[\x1b\x9b][\[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]" r"[\x1b\x9b][\[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]"
).unwrap(); ).unwrap();
static ref NO_COLOR: bool = { static ref NO_COLOR: bool = env::var_os("NO_COLOR").is_some();
env::var_os("NO_COLOR").is_some()
};
} }
/// Helper function to strip ansi codes. /// Helper function to strip ansi codes.

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::Snapshot; use deno_core::Snapshot;
use log::debug;
pub static CLI_SNAPSHOT: &[u8] = pub static CLI_SNAPSHOT: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.bin")); include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.bin"));

View file

@ -2,11 +2,6 @@
#![deny(warnings)] #![deny(warnings)]
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
pub use deno_console; pub use deno_console;
pub use deno_crypto; pub use deno_crypto;
pub use deno_fetch; pub use deno_fetch;

View file

@ -17,6 +17,7 @@ use deno_core::ResourceId;
use deno_core::ZeroCopyBuf; use deno_core::ZeroCopyBuf;
use deno_crypto::rand::thread_rng; use deno_crypto::rand::thread_rng;
use deno_crypto::rand::Rng; use deno_crypto::rand::Rng;
use log::debug;
use serde::Deserialize; use serde::Deserialize;
use std::cell::RefCell; use std::cell::RefCell;
use std::convert::From; use std::convert::From;

View file

@ -42,7 +42,7 @@ use tokio::net::unix;
#[cfg(windows)] #[cfg(windows)]
use std::os::windows::io::FromRawHandle; use std::os::windows::io::FromRawHandle;
lazy_static! { lazy_static::lazy_static! {
/// Due to portability issues on Windows handle to stdout is created from raw /// Due to portability issues on Windows handle to stdout is created from raw
/// file descriptor. The caveat of that approach is fact that when this /// file descriptor. The caveat of that approach is fact that when this
/// handle is dropped underlying file descriptor is closed - that is highly /// handle is dropped underlying file descriptor is closed - that is highly

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::ops::io::TcpStreamResource; use crate::ops::io::TcpStreamResource;
use crate::permissions::Permissions; use crate::permissions::Permissions;
use crate::resolve_addr::resolve_addr; use crate::resolve_addr::resolve_addr;
@ -21,6 +20,7 @@ use deno_core::RcRef;
use deno_core::Resource; use deno_core::Resource;
use deno_core::ResourceId; use deno_core::ResourceId;
use deno_core::ZeroCopyBuf; use deno_core::ZeroCopyBuf;
use log::debug;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use std::borrow::Cow; use std::borrow::Cow;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::metrics::metrics_op; use crate::metrics::metrics_op;
use crate::permissions::Permissions; use crate::permissions::Permissions;
use deno_core::error::AnyError; use deno_core::error::AnyError;
@ -16,6 +15,7 @@ use deno_core::OpState;
use deno_core::Resource; use deno_core::Resource;
use deno_core::ZeroCopyBuf; use deno_core::ZeroCopyBuf;
use dlopen::symbor::Library; use dlopen::symbor::Library;
use log::debug;
use serde::Deserialize; use serde::Deserialize;
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::RefCell; use std::cell::RefCell;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::permissions::resolve_read_allowlist; use crate::permissions::resolve_read_allowlist;
use crate::permissions::resolve_write_allowlist; use crate::permissions::resolve_write_allowlist;
use crate::permissions::NetDescriptor; use crate::permissions::NetDescriptor;
@ -28,6 +27,7 @@ use deno_core::BufVec;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use deno_core::OpState; use deno_core::OpState;
use deno_core::ZeroCopyBuf; use deno_core::ZeroCopyBuf;
use log::debug;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::HashSet; use std::collections::HashSet;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::colors; use crate::colors;
use crate::fs_util::resolve_from_cwd; use crate::fs_util::resolve_from_cwd;
use deno_core::error::custom_error; use deno_core::error::custom_error;
@ -9,6 +8,7 @@ use deno_core::serde::Deserialize;
use deno_core::serde::Serialize; use deno_core::serde::Serialize;
use deno_core::url; use deno_core::url;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use log::debug;
use std::collections::HashSet; use std::collections::HashSet;
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
@ -717,7 +717,7 @@ fn permission_prompt(_message: &str) -> bool {
} }
#[cfg(test)] #[cfg(test)]
lazy_static! { lazy_static::lazy_static! {
/// Lock this when you use `set_prompt_result` in a test case. /// Lock this when you use `set_prompt_result` in a test case.
static ref PERMISSION_PROMPT_GUARD: Mutex<()> = Mutex::new(()); static ref PERMISSION_PROMPT_GUARD: Mutex<()> = Mutex::new(());
} }

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::colors; use crate::colors;
use crate::inspector::DenoInspector; use crate::inspector::DenoInspector;
use crate::inspector::InspectorServer; use crate::inspector::InspectorServer;
@ -24,6 +23,7 @@ use deno_core::JsRuntime;
use deno_core::ModuleLoader; use deno_core::ModuleLoader;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use deno_core::RuntimeOptions; use deno_core::RuntimeOptions;
use log::debug;
use std::env; use std::env;
use std::rc::Rc; use std::rc::Rc;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;

View file

@ -21,6 +21,7 @@ use deno_core::ModuleId;
use deno_core::ModuleLoader; use deno_core::ModuleLoader;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use deno_core::RuntimeOptions; use deno_core::RuntimeOptions;
use log::debug;
use std::env; use std::env;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;

View file

@ -1,10 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// Usage: provide a port as argument to run hyper_hello benchmark server // Usage: provide a port as argument to run hyper_hello benchmark server
// otherwise this starts multiple servers on many ports for test endpoints. // otherwise this starts multiple servers on many ports for test endpoints.
#[macro_use]
extern crate lazy_static;
use futures::FutureExt; use futures::FutureExt;
use futures::Stream; use futures::Stream;
use futures::StreamExt; use futures::StreamExt;
@ -16,9 +12,8 @@ use hyper::Body;
use hyper::Request; use hyper::Request;
use hyper::Response; use hyper::Response;
use hyper::StatusCode; use hyper::StatusCode;
use lazy_static::lazy_static;
use os_pipe::pipe; use os_pipe::pipe;
#[cfg(unix)]
pub use pty;
use regex::Regex; use regex::Regex;
use serde::Serialize; use serde::Serialize;
use std::collections::HashMap; use std::collections::HashMap;
@ -48,6 +43,9 @@ use tokio_rustls::rustls;
use tokio_rustls::TlsAcceptor; use tokio_rustls::TlsAcceptor;
use tokio_tungstenite::accept_async; use tokio_tungstenite::accept_async;
#[cfg(unix)]
pub use pty;
const PORT: u16 = 4545; const PORT: u16 = 4545;
const TEST_AUTH_TOKEN: &str = "abcdef123456789"; const TEST_AUTH_TOKEN: &str = "abcdef123456789";
const REDIRECT_PORT: u16 = 4546; const REDIRECT_PORT: u16 = 4546;