mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699 Closes https://github.com/denoland/deno/issues/2347 Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not need to switch the cargo toolchain to nightly. Do we care about formatting stability of our codebase across Rust versions? (I don't)
This commit is contained in:
parent
efcbfd5206
commit
d5634164cb
65 changed files with 301 additions and 126 deletions
|
@ -11,7 +11,7 @@
|
||||||
},
|
},
|
||||||
"exec": {
|
"exec": {
|
||||||
"associations": "**/*.rs",
|
"associations": "**/*.rs",
|
||||||
"rustfmt": "rustfmt"
|
"rustfmt": "rustfmt --config imports_granularity=item"
|
||||||
},
|
},
|
||||||
"includes": [
|
"includes": [
|
||||||
"**/*.{ts,tsx,js,jsx,json,md,toml,rs}"
|
"**/*.{ts,tsx,js,jsx,json,md,toml,rs}"
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
use deno_bench_util::bench_js_async;
|
||||||
|
use deno_bench_util::bench_js_sync;
|
||||||
use deno_bench_util::bench_or_profile;
|
use deno_bench_util::bench_or_profile;
|
||||||
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
use deno_bench_util::bencher::benchmark_group;
|
||||||
use deno_bench_util::{bench_js_async, bench_js_sync};
|
use deno_bench_util::bencher::Bencher;
|
||||||
|
|
||||||
use deno_core::op;
|
use deno_core::op;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use bencher::{DynBenchFn, StaticBenchFn, TestDescAndFn, TestOpts};
|
use bencher::DynBenchFn;
|
||||||
|
use bencher::StaticBenchFn;
|
||||||
|
use bencher::TestDescAndFn;
|
||||||
|
use bencher::TestOpts;
|
||||||
|
|
||||||
pub fn is_profiling() -> bool {
|
pub fn is_profiling() -> bool {
|
||||||
std::env::var("PROFILING").is_ok()
|
std::env::var("PROFILING").is_ok()
|
||||||
|
|
|
@ -2401,7 +2401,10 @@ fn completions_parse(
|
||||||
mut app: clap::Command,
|
mut app: clap::Command,
|
||||||
) {
|
) {
|
||||||
use clap_complete::generate;
|
use clap_complete::generate;
|
||||||
use clap_complete::shells::{Bash, Fish, PowerShell, Zsh};
|
use clap_complete::shells::Bash;
|
||||||
|
use clap_complete::shells::Fish;
|
||||||
|
use clap_complete::shells::PowerShell;
|
||||||
|
use clap_complete::shells::Zsh;
|
||||||
use clap_complete_fig::Fig;
|
use clap_complete_fig::Fig;
|
||||||
|
|
||||||
let mut buf: Vec<u8> = vec![];
|
let mut buf: Vec<u8> = vec![];
|
||||||
|
|
|
@ -64,7 +64,8 @@ pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod bare_port_tests {
|
mod bare_port_tests {
|
||||||
use super::{BarePort, ParsePortError};
|
use super::BarePort;
|
||||||
|
use super::ParsePortError;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bare_port_parsed() {
|
fn bare_port_parsed() {
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use std::sync::atomic::{AtomicU16, Ordering};
|
use std::collections::HashMap;
|
||||||
use std::{collections::HashMap, path::Path, process::Command, time::Duration};
|
use std::path::Path;
|
||||||
|
use std::process::Command;
|
||||||
|
use std::sync::atomic::AtomicU16;
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use super::Result;
|
use super::Result;
|
||||||
|
|
||||||
pub use test_util::{parse_wrk_output, WrkOutput as HttpBenchmarkResult};
|
pub use test_util::parse_wrk_output;
|
||||||
|
pub use test_util::WrkOutput as HttpBenchmarkResult;
|
||||||
// Some of the benchmarks in this file have been renamed. In case the history
|
// Some of the benchmarks in this file have been renamed. In case the history
|
||||||
// somehow gets messed up:
|
// somehow gets messed up:
|
||||||
// "node_http" was once called "node"
|
// "node_http" was once called "node"
|
||||||
|
|
7
cli/cache/deno_dir.rs
vendored
7
cli/cache/deno_dir.rs
vendored
|
@ -184,7 +184,12 @@ mod dirs {
|
||||||
use std::os::windows::ffi::OsStringExt;
|
use std::os::windows::ffi::OsStringExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use winapi::shared::winerror;
|
use winapi::shared::winerror;
|
||||||
use winapi::um::{combaseapi, knownfolders, shlobj, shtypes, winbase, winnt};
|
use winapi::um::combaseapi;
|
||||||
|
use winapi::um::knownfolders;
|
||||||
|
use winapi::um::shlobj;
|
||||||
|
use winapi::um::shtypes;
|
||||||
|
use winapi::um::winbase;
|
||||||
|
use winapi::um::winnt;
|
||||||
|
|
||||||
fn known_folder(folder_id: shtypes::REFKNOWNFOLDERID) -> Option<PathBuf> {
|
fn known_folder(folder_id: shtypes::REFKNOWNFOLDERID) -> Option<PathBuf> {
|
||||||
// SAFETY: winapi calls
|
// SAFETY: winapi calls
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
// and https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostTypes.ts
|
// and https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostTypes.ts
|
||||||
// for the SemanticTokensBuilder implementation.
|
// for the SemanticTokensBuilder implementation.
|
||||||
|
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::Index;
|
||||||
|
use std::ops::IndexMut;
|
||||||
use tower_lsp::lsp_types::SemanticToken;
|
use tower_lsp::lsp_types::SemanticToken;
|
||||||
use tower_lsp::lsp_types::SemanticTokenModifier;
|
use tower_lsp::lsp_types::SemanticTokenModifier;
|
||||||
use tower_lsp::lsp_types::SemanticTokenType;
|
use tower_lsp::lsp_types::SemanticTokenType;
|
||||||
|
|
|
@ -8,7 +8,10 @@ A proc_macro for Deno's Node-API implementation. It does the following things:
|
||||||
- Maps `deno_napi::Result` to raw `napi_result`.
|
- Maps `deno_napi::Result` to raw `napi_result`.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use deno_napi::{napi_value, Env, Error, Result};
|
use deno_napi::napi_value;
|
||||||
|
use deno_napi::Env;
|
||||||
|
use deno_napi::Error;
|
||||||
|
use deno_napi::Result;
|
||||||
|
|
||||||
#[napi_sym::napi_sym]
|
#[napi_sym::napi_sym]
|
||||||
fn napi_get_boolean(
|
fn napi_get_boolean(
|
||||||
|
|
|
@ -126,7 +126,8 @@ fn fmt_ignore_unexplicit_files() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fmt_auto_ignore_git_and_node_modules() {
|
fn fmt_auto_ignore_git_and_node_modules() {
|
||||||
use std::fs::{create_dir_all, File};
|
use std::fs::create_dir_all;
|
||||||
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
fn create_bad_json(t: PathBuf) {
|
fn create_bad_json(t: PathBuf) {
|
||||||
|
|
|
@ -211,7 +211,8 @@ fn assert_stderr(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inspect_flag_with_unique_port(flag_prefix: &str) -> String {
|
fn inspect_flag_with_unique_port(flag_prefix: &str) -> String {
|
||||||
use std::sync::atomic::{AtomicU16, Ordering};
|
use std::sync::atomic::AtomicU16;
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
static PORT: AtomicU16 = AtomicU16::new(9229);
|
static PORT: AtomicU16 = AtomicU16::new(9229);
|
||||||
let port = PORT.fetch_add(1, Ordering::Relaxed);
|
let port = PORT.fetch_add(1, Ordering::Relaxed);
|
||||||
format!("{}=127.0.0.1:{}", flag_prefix, port)
|
format!("{}=127.0.0.1:{}", flag_prefix, port)
|
||||||
|
|
|
@ -602,7 +602,8 @@ fn lexical_scoped_variable() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn missing_deno_dir() {
|
fn missing_deno_dir() {
|
||||||
use std::fs::{read_dir, remove_dir_all};
|
use std::fs::read_dir;
|
||||||
|
use std::fs::remove_dir_all;
|
||||||
const DENO_DIR: &str = "nonexistent";
|
const DENO_DIR: &str = "nonexistent";
|
||||||
let test_deno_dir = test_util::testdata_path().join(DENO_DIR);
|
let test_deno_dir = test_util::testdata_path().join(DENO_DIR);
|
||||||
let (out, err) = util::run_and_collect_output(
|
let (out, err) = util::run_and_collect_output(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use std::process::{Command, Stdio};
|
use std::process::Command;
|
||||||
|
use std::process::Stdio;
|
||||||
use test_util as util;
|
use test_util as util;
|
||||||
use test_util::TempDir;
|
use test_util::TempDir;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,9 @@ use regex::Regex;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::BufWriter;
|
use std::io::BufWriter;
|
||||||
use std::io::{self, Error, Write};
|
use std::io::Error;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::io::{self};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use text_lines::TextLines;
|
use text_lines::TextLines;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
|
@ -18,15 +18,19 @@ use rustyline::validate::ValidationResult;
|
||||||
use rustyline::validate::Validator;
|
use rustyline::validate::Validator;
|
||||||
use rustyline::Cmd;
|
use rustyline::Cmd;
|
||||||
use rustyline::CompletionType;
|
use rustyline::CompletionType;
|
||||||
|
use rustyline::ConditionalEventHandler;
|
||||||
use rustyline::Config;
|
use rustyline::Config;
|
||||||
use rustyline::Context;
|
use rustyline::Context;
|
||||||
use rustyline::Editor;
|
use rustyline::Editor;
|
||||||
|
use rustyline::Event;
|
||||||
|
use rustyline::EventContext;
|
||||||
use rustyline::EventHandler;
|
use rustyline::EventHandler;
|
||||||
use rustyline::KeyCode;
|
use rustyline::KeyCode;
|
||||||
use rustyline::KeyEvent;
|
use rustyline::KeyEvent;
|
||||||
use rustyline::Modifiers;
|
use rustyline::Modifiers;
|
||||||
use rustyline::{ConditionalEventHandler, Event, EventContext, RepeatCount};
|
use rustyline::RepeatCount;
|
||||||
use rustyline_derive::{Helper, Hinter};
|
use rustyline_derive::Helper;
|
||||||
|
use rustyline_derive::Hinter;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use crate::colors;
|
use crate::colors;
|
||||||
use dissimilar::{diff as difference, Chunk};
|
use dissimilar::diff as difference;
|
||||||
|
use dissimilar::Chunk;
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
|
|
||||||
/// Print diff of the same file_path, before and after formatting.
|
/// Print diff of the same file_path, before and after formatting.
|
||||||
|
|
|
@ -729,7 +729,8 @@ fn create_web_worker_callback(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use deno_core::{resolve_url_or_path, FsModuleLoader};
|
use deno_core::resolve_url_or_path;
|
||||||
|
use deno_core::FsModuleLoader;
|
||||||
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
|
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
|
||||||
use deno_runtime::deno_web::BlobStore;
|
use deno_runtime::deno_web::BlobStore;
|
||||||
use deno_runtime::permissions::Permissions;
|
use deno_runtime::permissions::Permissions;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use crate::OpState;
|
use crate::OpState;
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use std::{cell::RefCell, rc::Rc, task::Context};
|
use std::cell::RefCell;
|
||||||
|
use std::rc::Rc;
|
||||||
|
use std::task::Context;
|
||||||
use v8::fast_api::FastFunction;
|
use v8::fast_api::FastFunction;
|
||||||
|
|
||||||
pub type SourcePair = (&'static str, &'static str);
|
pub type SourcePair = (&'static str, &'static str);
|
||||||
|
|
|
@ -1190,7 +1190,8 @@ mod tests {
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::AtomicUsize;
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
// deno_ops macros generate code assuming deno_core in scope.
|
// deno_ops macros generate code assuming deno_core in scope.
|
||||||
mod deno_core {
|
mod deno_core {
|
||||||
|
|
|
@ -13,7 +13,9 @@ use crate::ZeroCopyBuf;
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use deno_ops::op;
|
use deno_ops::op;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::io::{stderr, stdout, Write};
|
use std::io::stderr;
|
||||||
|
use std::io::stdout;
|
||||||
|
use std::io::Write;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub(crate) fn init_builtins() -> Extension {
|
pub(crate) fn init_builtins() -> Extension {
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use crate::serde::Serialize;
|
use crate::serde::Serialize;
|
||||||
use crate::OpId;
|
use crate::OpId;
|
||||||
use std::cell::{RefCell, RefMut};
|
use std::cell::RefCell;
|
||||||
|
use std::cell::RefMut;
|
||||||
|
|
||||||
// TODO(@AaronO): split into AggregateMetrics & PerOpMetrics
|
// TODO(@AaronO): split into AggregateMetrics & PerOpMetrics
|
||||||
#[derive(Clone, Default, Debug, Serialize)]
|
#[derive(Clone, Default, Debug, Serialize)]
|
||||||
|
|
|
@ -2593,7 +2593,8 @@ pub mod tests {
|
||||||
use std::ops::FnOnce;
|
use std::ops::FnOnce;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::AtomicUsize;
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
// deno_ops macros generate code assuming deno_core in scope.
|
// deno_ops macros generate code assuming deno_core in scope.
|
||||||
mod deno_core {
|
mod deno_core {
|
||||||
|
|
|
@ -31,7 +31,8 @@ use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use deno_tls::rustls::RootCertStore;
|
use deno_tls::rustls::RootCertStore;
|
||||||
use deno_tls::Proxy;
|
use deno_tls::Proxy;
|
||||||
use http::{header::CONTENT_LENGTH, Uri};
|
use http::header::CONTENT_LENGTH;
|
||||||
|
use http::Uri;
|
||||||
use reqwest::header::HeaderMap;
|
use reqwest::header::HeaderMap;
|
||||||
use reqwest::header::HeaderName;
|
use reqwest::header::HeaderName;
|
||||||
use reqwest::header::HeaderValue;
|
use reqwest::header::HeaderValue;
|
||||||
|
|
|
@ -1917,7 +1917,8 @@ mod tests {
|
||||||
mod x64_windows {
|
mod x64_windows {
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use dynasmrt::{dynasm, DynasmApi};
|
use dynasmrt::dynasm;
|
||||||
|
use dynasmrt::DynasmApi;
|
||||||
|
|
||||||
use super::super::Win64;
|
use super::super::Win64;
|
||||||
use super::symbol;
|
use super::symbol;
|
||||||
|
|
|
@ -5,7 +5,8 @@ use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::os::unix::io::RawFd;
|
use std::os::unix::io::RawFd;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{self, Poll};
|
use std::task::Poll;
|
||||||
|
use std::task::{self};
|
||||||
|
|
||||||
pub struct SendFile {
|
pub struct SendFile {
|
||||||
pub io: (RawFd, RawFd),
|
pub io: (RawFd, RawFd),
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
use std::cell::UnsafeCell;
|
use std::cell::UnsafeCell;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io::{Read, Write};
|
use std::io::Read;
|
||||||
|
use std::io::Write;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::Arc;
|
||||||
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use mio::net::TcpStream;
|
use mio::net::TcpStream;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use bencher::{benchmark_group, benchmark_main, Bencher};
|
use bencher::benchmark_group;
|
||||||
|
use bencher::benchmark_main;
|
||||||
|
use bencher::Bencher;
|
||||||
use deno_http::compressible::is_content_compressible;
|
use deno_http::compressible::is_content_compressible;
|
||||||
|
|
||||||
fn compressible_simple_hit(b: &mut Bencher) {
|
fn compressible_simple_hit(b: &mut Bencher) {
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use deno_bench_util::bench_js_sync;
|
use deno_bench_util::bench_js_sync;
|
||||||
use deno_bench_util::bench_or_profile;
|
use deno_bench_util::bench_or_profile;
|
||||||
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
use deno_bench_util::bencher::benchmark_group;
|
||||||
|
use deno_bench_util::bencher::Bencher;
|
||||||
|
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use deno_bench_util::bench_js_sync;
|
use deno_bench_util::bench_js_sync;
|
||||||
use deno_bench_util::bench_or_profile;
|
use deno_bench_util::bench_or_profile;
|
||||||
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
use deno_bench_util::bencher::benchmark_group;
|
||||||
|
use deno_bench_util::bencher::Bencher;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_web::BlobStore;
|
use deno_web::BlobStore;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use deno_bench_util::bench_js_async;
|
use deno_bench_util::bench_js_async;
|
||||||
use deno_bench_util::bench_or_profile;
|
use deno_bench_util::bench_or_profile;
|
||||||
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
use deno_bench_util::bencher::benchmark_group;
|
||||||
|
use deno_bench_util::bencher::Bencher;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_web::BlobStore;
|
use deno_web::BlobStore;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ use deno_core::op;
|
||||||
use deno_core::parking_lot::Mutex;
|
use deno_core::parking_lot::Mutex;
|
||||||
use deno_core::url::Url;
|
use deno_core::url::Url;
|
||||||
use deno_core::ZeroCopyBuf;
|
use deno_core::ZeroCopyBuf;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::Location;
|
use crate::Location;
|
||||||
|
|
|
@ -8,10 +8,13 @@ use deno_core::error::type_error;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::op;
|
use deno_core::op;
|
||||||
|
|
||||||
|
use deno_core::CancelFuture;
|
||||||
|
use deno_core::CancelHandle;
|
||||||
use deno_core::DetachedBuffer;
|
use deno_core::DetachedBuffer;
|
||||||
use deno_core::{CancelFuture, Resource};
|
use deno_core::OpState;
|
||||||
use deno_core::{CancelHandle, OpState};
|
use deno_core::RcRef;
|
||||||
use deno_core::{RcRef, ResourceId};
|
use deno_core::Resource;
|
||||||
|
use deno_core::ResourceId;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tokio::sync::mpsc::unbounded_channel;
|
use tokio::sync::mpsc::unbounded_channel;
|
||||||
|
|
12
ops/attrs.rs
12
ops/attrs.rs
|
@ -1,9 +1,11 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use syn::{
|
use syn::parse::Parse;
|
||||||
parse::{Parse, ParseStream},
|
use syn::parse::ParseStream;
|
||||||
punctuated::Punctuated,
|
use syn::punctuated::Punctuated;
|
||||||
Error, Ident, Result, Token,
|
use syn::Error;
|
||||||
};
|
use syn::Ident;
|
||||||
|
use syn::Result;
|
||||||
|
use syn::Token;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Default)]
|
#[derive(Copy, Clone, Debug, Default)]
|
||||||
pub struct Attributes {
|
pub struct Attributes {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
#![cfg(not(test))]
|
#![cfg(not(test))]
|
||||||
|
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::Span;
|
||||||
use proc_macro_crate::{crate_name, FoundCrate};
|
use proc_macro2::TokenStream;
|
||||||
|
use proc_macro_crate::crate_name;
|
||||||
|
use proc_macro_crate::FoundCrate;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::Ident;
|
use syn::Ident;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,25 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
//! Code generation for V8 fast calls.
|
//! Code generation for V8 fast calls.
|
||||||
|
|
||||||
use pmutil::{q, Quote, ToTokensExt};
|
use pmutil::q;
|
||||||
use proc_macro2::{Span, TokenStream};
|
use pmutil::Quote;
|
||||||
|
use pmutil::ToTokensExt;
|
||||||
|
use proc_macro2::Span;
|
||||||
|
use proc_macro2::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::{
|
use syn::parse_quote;
|
||||||
parse_quote, punctuated::Punctuated, token::Comma, GenericParam, Generics,
|
use syn::punctuated::Punctuated;
|
||||||
Ident, ItemFn, ItemImpl, Path, PathArguments, PathSegment, Type, TypePath,
|
use syn::token::Comma;
|
||||||
};
|
use syn::GenericParam;
|
||||||
|
use syn::Generics;
|
||||||
|
use syn::Ident;
|
||||||
|
use syn::ItemFn;
|
||||||
|
use syn::ItemImpl;
|
||||||
|
use syn::Path;
|
||||||
|
use syn::PathArguments;
|
||||||
|
use syn::PathSegment;
|
||||||
|
use syn::Type;
|
||||||
|
use syn::TypePath;
|
||||||
|
|
||||||
use crate::optimizer::FastValue;
|
use crate::optimizer::FastValue;
|
||||||
use crate::optimizer::Optimizer;
|
use crate::optimizer::Optimizer;
|
||||||
|
|
26
ops/lib.rs
26
ops/lib.rs
|
@ -2,15 +2,24 @@
|
||||||
|
|
||||||
use attrs::Attributes;
|
use attrs::Attributes;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use optimizer::{BailoutReason, Optimizer};
|
use optimizer::BailoutReason;
|
||||||
|
use optimizer::Optimizer;
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use proc_macro2::{Span, TokenStream as TokenStream2};
|
use proc_macro2::Span;
|
||||||
use quote::{quote, ToTokens};
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
|
use quote::quote;
|
||||||
|
use quote::ToTokens;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use syn::{
|
use syn::parse;
|
||||||
parse, parse_macro_input, punctuated::Punctuated, token::Comma, FnArg,
|
use syn::parse_macro_input;
|
||||||
GenericParam, Ident, ItemFn, Lifetime, LifetimeDef,
|
use syn::punctuated::Punctuated;
|
||||||
};
|
use syn::token::Comma;
|
||||||
|
use syn::FnArg;
|
||||||
|
use syn::GenericParam;
|
||||||
|
use syn::Ident;
|
||||||
|
use syn::ItemFn;
|
||||||
|
use syn::Lifetime;
|
||||||
|
use syn::LifetimeDef;
|
||||||
|
|
||||||
mod attrs;
|
mod attrs;
|
||||||
mod deno;
|
mod deno;
|
||||||
|
@ -747,7 +756,8 @@ fn exclude_lifetime_params(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{Attributes, Op};
|
use crate::Attributes;
|
||||||
|
use crate::Op;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[testing_macros::fixture("optimizer_tests/**/*.rs")]
|
#[testing_macros::fixture("optimizer_tests/**/*.rs")]
|
||||||
|
|
|
@ -5,15 +5,28 @@ use std::collections::BTreeMap;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::fmt::Formatter;
|
use std::fmt::Formatter;
|
||||||
|
|
||||||
use pmutil::{q, Quote};
|
use pmutil::q;
|
||||||
|
use pmutil::Quote;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
|
||||||
use syn::{
|
use syn::parse_quote;
|
||||||
parse_quote, punctuated::Punctuated, token::Colon2,
|
use syn::punctuated::Punctuated;
|
||||||
AngleBracketedGenericArguments, FnArg, GenericArgument, PatType, Path,
|
use syn::token::Colon2;
|
||||||
PathArguments, PathSegment, ReturnType, Signature, Type, TypePath, TypePtr,
|
use syn::AngleBracketedGenericArguments;
|
||||||
TypeReference, TypeSlice, TypeTuple,
|
use syn::FnArg;
|
||||||
};
|
use syn::GenericArgument;
|
||||||
|
use syn::PatType;
|
||||||
|
use syn::Path;
|
||||||
|
use syn::PathArguments;
|
||||||
|
use syn::PathSegment;
|
||||||
|
use syn::ReturnType;
|
||||||
|
use syn::Signature;
|
||||||
|
use syn::Type;
|
||||||
|
use syn::TypePath;
|
||||||
|
use syn::TypePtr;
|
||||||
|
use syn::TypeReference;
|
||||||
|
use syn::TypeSlice;
|
||||||
|
use syn::TypeTuple;
|
||||||
|
|
||||||
use crate::Op;
|
use crate::Op;
|
||||||
|
|
||||||
|
@ -678,7 +691,8 @@ fn double_segment(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{Attributes, Op};
|
use crate::Attributes;
|
||||||
|
use crate::Op;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use syn::parse_quote;
|
use syn::parse_quote;
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,22 @@ use atty;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
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::Ansi;
|
||||||
use termcolor::{Ansi, ColorSpec, WriteColor};
|
use termcolor::Color::Ansi256;
|
||||||
|
use termcolor::Color::Black;
|
||||||
|
use termcolor::Color::Blue;
|
||||||
|
use termcolor::Color::Cyan;
|
||||||
|
use termcolor::Color::Green;
|
||||||
|
use termcolor::Color::Red;
|
||||||
|
use termcolor::Color::White;
|
||||||
|
use termcolor::Color::Yellow;
|
||||||
|
use termcolor::ColorSpec;
|
||||||
|
use termcolor::WriteColor;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use termcolor::{BufferWriter, ColorChoice};
|
use termcolor::BufferWriter;
|
||||||
|
#[cfg(windows)]
|
||||||
|
use termcolor::ColorChoice;
|
||||||
|
|
||||||
static NO_COLOR: Lazy<bool> =
|
static NO_COLOR: Lazy<bool> =
|
||||||
Lazy::new(|| std::env::var_os("NO_COLOR").is_some());
|
Lazy::new(|| std::env::var_os("NO_COLOR").is_some());
|
||||||
|
|
|
@ -5,7 +5,8 @@ use deno_core::error::AnyError;
|
||||||
pub use deno_core::normalize_path;
|
pub use deno_core::normalize_path;
|
||||||
use std::env::current_dir;
|
use std::env::current_dir;
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
/// Similar to `std::fs::canonicalize()` but strips UNC prefixes on Windows.
|
/// Similar to `std::fs::canonicalize()` but strips UNC prefixes on Windows.
|
||||||
pub fn canonicalize_path(path: &Path) -> Result<PathBuf, Error> {
|
pub fn canonicalize_path(path: &Path) -> Result<PathBuf, Error> {
|
||||||
|
|
|
@ -679,7 +679,9 @@ fn op_chown_sync(
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
use crate::errors::get_nix_error_class;
|
use crate::errors::get_nix_error_class;
|
||||||
use nix::unistd::{chown, Gid, Uid};
|
use nix::unistd::chown;
|
||||||
|
use nix::unistd::Gid;
|
||||||
|
use nix::unistd::Uid;
|
||||||
let nix_uid = uid.map(Uid::from_raw);
|
let nix_uid = uid.map(Uid::from_raw);
|
||||||
let nix_gid = gid.map(Gid::from_raw);
|
let nix_gid = gid.map(Gid::from_raw);
|
||||||
chown(&path, nix_uid, nix_gid).map_err(|err| {
|
chown(&path, nix_uid, nix_gid).map_err(|err| {
|
||||||
|
@ -717,7 +719,9 @@ async fn op_chown_async(
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
use crate::errors::get_nix_error_class;
|
use crate::errors::get_nix_error_class;
|
||||||
use nix::unistd::{chown, Gid, Uid};
|
use nix::unistd::chown;
|
||||||
|
use nix::unistd::Gid;
|
||||||
|
use nix::unistd::Uid;
|
||||||
let nix_uid = uid.map(Uid::from_raw);
|
let nix_uid = uid.map(Uid::from_raw);
|
||||||
let nix_gid = gid.map(Gid::from_raw);
|
let nix_gid = gid.map(Gid::from_raw);
|
||||||
chown(&path, nix_uid, nix_gid).map_err(|err| {
|
chown(&path, nix_uid, nix_gid).map_err(|err| {
|
||||||
|
@ -1488,7 +1492,8 @@ fn op_symlink_sync(
|
||||||
}
|
}
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
{
|
{
|
||||||
use std::os::windows::fs::{symlink_dir, symlink_file};
|
use std::os::windows::fs::symlink_dir;
|
||||||
|
use std::os::windows::fs::symlink_file;
|
||||||
|
|
||||||
match _type {
|
match _type {
|
||||||
Some(ty) => match ty.as_ref() {
|
Some(ty) => match ty.as_ref() {
|
||||||
|
|
|
@ -35,10 +35,11 @@ use tokio::process;
|
||||||
use std::os::unix::io::FromRawFd;
|
use std::os::unix::io::FromRawFd;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use {
|
use std::os::windows::io::FromRawHandle;
|
||||||
std::os::windows::io::FromRawHandle,
|
#[cfg(windows)]
|
||||||
winapi::um::{processenv::GetStdHandle, winbase},
|
use winapi::um::processenv::GetStdHandle;
|
||||||
};
|
#[cfg(windows)]
|
||||||
|
use winapi::um::winbase;
|
||||||
|
|
||||||
// Store the stdio fd/handles in global statics in order to keep them
|
// Store the stdio fd/handles in global statics in order to keep them
|
||||||
// alive for the duration of the application since the last handle/fd
|
// alive for the duration of the application since the last handle/fd
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
use super::utils::into_string;
|
use super::utils::into_string;
|
||||||
use crate::permissions::PermissionsContainer;
|
use crate::permissions::PermissionsContainer;
|
||||||
use crate::worker::ExitCode;
|
use crate::worker::ExitCode;
|
||||||
use deno_core::error::{type_error, AnyError};
|
use deno_core::error::type_error;
|
||||||
|
use deno_core::error::AnyError;
|
||||||
use deno_core::op;
|
use deno_core::op;
|
||||||
use deno_core::url::Url;
|
use deno_core::url::Url;
|
||||||
use deno_core::v8;
|
use deno_core::v8;
|
||||||
|
|
|
@ -294,7 +294,8 @@ async fn op_run_status(
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub fn kill(pid: i32, signal: &str) -> Result<(), AnyError> {
|
pub fn kill(pid: i32, signal: &str) -> Result<(), AnyError> {
|
||||||
let signo = super::signal::signal_str_to_int(signal)?;
|
let signo = super::signal::signal_str_to_int(signal)?;
|
||||||
use nix::sys::signal::{kill as unix_kill, Signal};
|
use nix::sys::signal::kill as unix_kill;
|
||||||
|
use nix::sys::signal::Signal;
|
||||||
use nix::unistd::Pid;
|
use nix::unistd::Pid;
|
||||||
let sig = Signal::try_from(signo)?;
|
let sig = Signal::try_from(signo)?;
|
||||||
unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(AnyError::from)
|
unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(AnyError::from)
|
||||||
|
|
|
@ -44,12 +44,14 @@ pub fn ppid() -> i64 {
|
||||||
// - MIT license
|
// - MIT license
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use winapi::shared::minwindef::DWORD;
|
use winapi::shared::minwindef::DWORD;
|
||||||
use winapi::um::handleapi::{CloseHandle, INVALID_HANDLE_VALUE};
|
use winapi::um::handleapi::CloseHandle;
|
||||||
|
use winapi::um::handleapi::INVALID_HANDLE_VALUE;
|
||||||
use winapi::um::processthreadsapi::GetCurrentProcessId;
|
use winapi::um::processthreadsapi::GetCurrentProcessId;
|
||||||
use winapi::um::tlhelp32::{
|
use winapi::um::tlhelp32::CreateToolhelp32Snapshot;
|
||||||
CreateToolhelp32Snapshot, Process32First, Process32Next, PROCESSENTRY32,
|
use winapi::um::tlhelp32::Process32First;
|
||||||
TH32CS_SNAPPROCESS,
|
use winapi::um::tlhelp32::Process32Next;
|
||||||
};
|
use winapi::um::tlhelp32::PROCESSENTRY32;
|
||||||
|
use winapi::um::tlhelp32::TH32CS_SNAPPROCESS;
|
||||||
// SAFETY: winapi calls
|
// SAFETY: winapi calls
|
||||||
unsafe {
|
unsafe {
|
||||||
// Take a snapshot of system processes, one of which is ours
|
// Take a snapshot of system processes, one of which is ours
|
||||||
|
|
|
@ -16,9 +16,19 @@ use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use tokio::signal::unix::{signal, Signal, SignalKind};
|
use tokio::signal::unix::signal;
|
||||||
|
#[cfg(unix)]
|
||||||
|
use tokio::signal::unix::Signal;
|
||||||
|
#[cfg(unix)]
|
||||||
|
use tokio::signal::unix::SignalKind;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use tokio::signal::windows::{ctrl_break, ctrl_c, CtrlBreak, CtrlC};
|
use tokio::signal::windows::ctrl_break;
|
||||||
|
#[cfg(windows)]
|
||||||
|
use tokio::signal::windows::ctrl_c;
|
||||||
|
#[cfg(windows)]
|
||||||
|
use tokio::signal::windows::CtrlBreak;
|
||||||
|
#[cfg(windows)]
|
||||||
|
use tokio::signal::windows::CtrlC;
|
||||||
|
|
||||||
pub fn init() -> Extension {
|
pub fn init() -> Extension {
|
||||||
Extension::builder("deno_signal")
|
Extension::builder("deno_signal")
|
||||||
|
|
|
@ -60,7 +60,8 @@ fn op_stdin_set_raw(
|
||||||
{
|
{
|
||||||
use std::os::windows::io::AsRawHandle;
|
use std::os::windows::io::AsRawHandle;
|
||||||
use winapi::shared::minwindef::FALSE;
|
use winapi::shared::minwindef::FALSE;
|
||||||
use winapi::um::{consoleapi, handleapi};
|
use winapi::um::consoleapi;
|
||||||
|
use winapi::um::handleapi;
|
||||||
|
|
||||||
if cbreak {
|
if cbreak {
|
||||||
return Err(deno_core::error::not_supported());
|
return Err(deno_core::error::not_supported());
|
||||||
|
|
|
@ -12,7 +12,8 @@ use deno_fetch::reqwest;
|
||||||
use deno_web::BlobStore;
|
use deno_web::BlobStore;
|
||||||
use deno_websocket::DomExceptionNetworkError;
|
use deno_websocket::DomExceptionNetworkError;
|
||||||
use hyper::body::Bytes;
|
use hyper::body::Bytes;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
// TODO(andreubotella) Properly parse the MIME type
|
// TODO(andreubotella) Properly parse the MIME type
|
||||||
|
|
|
@ -20,7 +20,8 @@ use once_cell::sync::Lazy;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
|
@ -243,7 +243,8 @@ impl WebWorkerHandle {
|
||||||
/// This function will set the termination signal, close the message channel,
|
/// This function will set the termination signal, close the message channel,
|
||||||
/// and schedule to terminate the isolate after two seconds.
|
/// and schedule to terminate the isolate after two seconds.
|
||||||
pub fn terminate(self) {
|
pub fn terminate(self) {
|
||||||
use std::thread::{sleep, spawn};
|
use std::thread::sleep;
|
||||||
|
use std::thread::spawn;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
let schedule_termination =
|
let schedule_termination =
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use bencher::{benchmark_group, benchmark_main, Bencher};
|
use bencher::benchmark_group;
|
||||||
|
use bencher::benchmark_main;
|
||||||
|
use bencher::Bencher;
|
||||||
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use serde_v8::utils::{js_exec, v8_do};
|
use serde_v8::utils::js_exec;
|
||||||
|
use serde_v8::utils::v8_do;
|
||||||
use serde_v8::ByteString;
|
use serde_v8::ByteString;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq)]
|
#[derive(Debug, Deserialize, PartialEq)]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use bencher::{benchmark_group, benchmark_main, Bencher};
|
use bencher::benchmark_group;
|
||||||
|
use bencher::benchmark_main;
|
||||||
|
use bencher::Bencher;
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use serde::de::{self, SeqAccess as _, Visitor};
|
use serde::de::SeqAccess as _;
|
||||||
|
use serde::de::Visitor;
|
||||||
|
use serde::de::{self};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::error::{Error, Result};
|
use crate::error::Error;
|
||||||
use crate::keys::{v8_struct_key, KeyCache};
|
use crate::error::Result;
|
||||||
|
use crate::keys::v8_struct_key;
|
||||||
|
use crate::keys::KeyCache;
|
||||||
|
use crate::magic;
|
||||||
|
use crate::magic::transl8::visit_magic;
|
||||||
use crate::magic::transl8::FromV8;
|
use crate::magic::transl8::FromV8;
|
||||||
use crate::magic::transl8::{visit_magic, MagicType};
|
use crate::magic::transl8::MagicType;
|
||||||
use crate::payload::ValueType;
|
use crate::payload::ValueType;
|
||||||
use crate::{
|
use crate::ByteString;
|
||||||
magic, ByteString, DetachedBuffer, StringOrBuffer, U16String, ZeroCopyBuf,
|
use crate::DetachedBuffer;
|
||||||
};
|
use crate::StringOrBuffer;
|
||||||
|
use crate::U16String;
|
||||||
|
use crate::ZeroCopyBuf;
|
||||||
|
|
||||||
pub struct Deserializer<'a, 'b, 's> {
|
pub struct Deserializer<'a, 'b, 's> {
|
||||||
input: v8::Local<'a, v8::Value>,
|
input: v8::Local<'a, v8::Value>,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use std::fmt::{self, Display};
|
use std::fmt::Display;
|
||||||
|
use std::fmt::{self};
|
||||||
|
|
||||||
use serde::{de, ser};
|
use serde::de;
|
||||||
|
use serde::ser;
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,12 @@ mod ser;
|
||||||
mod serializable;
|
mod serializable;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
pub use de::{from_v8, from_v8_cached, to_utf8, Deserializer};
|
pub use de::from_v8;
|
||||||
pub use error::{Error, Result};
|
pub use de::from_v8_cached;
|
||||||
|
pub use de::to_utf8;
|
||||||
|
pub use de::Deserializer;
|
||||||
|
pub use error::Error;
|
||||||
|
pub use error::Result;
|
||||||
pub use keys::KeyCache;
|
pub use keys::KeyCache;
|
||||||
pub use magic::buffer::ZeroCopyBuf;
|
pub use magic::buffer::ZeroCopyBuf;
|
||||||
pub use magic::bytestring::ByteString;
|
pub use magic::bytestring::ByteString;
|
||||||
|
@ -18,5 +22,7 @@ pub use magic::string_or_buffer::StringOrBuffer;
|
||||||
pub use magic::u16string::U16String;
|
pub use magic::u16string::U16String;
|
||||||
pub use magic::Global;
|
pub use magic::Global;
|
||||||
pub use magic::Value;
|
pub use magic::Value;
|
||||||
pub use ser::{to_v8, Serializer};
|
pub use ser::to_v8;
|
||||||
pub use serializable::{Serializable, SerializablePkg};
|
pub use ser::Serializer;
|
||||||
|
pub use serializable::Serializable;
|
||||||
|
pub use serializable::SerializablePkg;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use super::transl8::{FromV8, ToV8};
|
use super::transl8::FromV8;
|
||||||
|
use super::transl8::ToV8;
|
||||||
use crate::magic::transl8::impl_magic;
|
use crate::magic::transl8::impl_magic;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use super::buffer::ZeroCopyBuf;
|
use super::buffer::ZeroCopyBuf;
|
||||||
use super::transl8::{FromV8, ToV8};
|
use super::transl8::FromV8;
|
||||||
|
use super::transl8::ToV8;
|
||||||
use crate::magic::transl8::impl_magic;
|
use crate::magic::transl8::impl_magic;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
use super::transl8::{impl_magic, impl_wrapper, FromV8, ToV8};
|
use super::transl8::impl_magic;
|
||||||
|
use super::transl8::impl_wrapper;
|
||||||
|
use super::transl8::FromV8;
|
||||||
|
use super::transl8::ToV8;
|
||||||
|
|
||||||
impl_wrapper!(
|
impl_wrapper!(
|
||||||
pub struct U16String(Vec<u16>);
|
pub struct U16String(Vec<u16>);
|
||||||
|
|
|
@ -5,13 +5,20 @@ use serde::ser::Serialize;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
use crate::error::{Error, Result};
|
use crate::error::Error;
|
||||||
|
use crate::error::Result;
|
||||||
use crate::keys::v8_struct_key;
|
use crate::keys::v8_struct_key;
|
||||||
|
use crate::magic;
|
||||||
|
use crate::magic::transl8::opaque_deref_mut;
|
||||||
|
use crate::magic::transl8::opaque_recv;
|
||||||
|
use crate::magic::transl8::MagicType;
|
||||||
|
use crate::magic::transl8::ToV8;
|
||||||
use crate::magic::transl8::MAGIC_FIELD;
|
use crate::magic::transl8::MAGIC_FIELD;
|
||||||
use crate::magic::transl8::{opaque_deref_mut, opaque_recv, MagicType, ToV8};
|
use crate::ByteString;
|
||||||
use crate::{
|
use crate::DetachedBuffer;
|
||||||
magic, ByteString, DetachedBuffer, StringOrBuffer, U16String, ZeroCopyBuf,
|
use crate::StringOrBuffer;
|
||||||
};
|
use crate::U16String;
|
||||||
|
use crate::ZeroCopyBuf;
|
||||||
|
|
||||||
type JsValue<'s> = v8::Local<'s, v8::Value>;
|
type JsValue<'s> = v8::Local<'s, v8::Value>;
|
||||||
type JsResult<'s> = Result<JsValue<'s>>;
|
type JsResult<'s> = Result<JsValue<'s>>;
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::Deserialize;
|
||||||
|
use serde::Deserializer;
|
||||||
|
|
||||||
use serde_v8::utils::{js_exec, v8_do};
|
use serde_v8::utils::js_exec;
|
||||||
|
use serde_v8::utils::v8_do;
|
||||||
use serde_v8::ByteString;
|
use serde_v8::ByteString;
|
||||||
use serde_v8::Error;
|
use serde_v8::Error;
|
||||||
use serde_v8::{U16String, ZeroCopyBuf};
|
use serde_v8::U16String;
|
||||||
|
use serde_v8::ZeroCopyBuf;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq)]
|
#[derive(Debug, Deserialize, PartialEq)]
|
||||||
struct MathOp {
|
struct MathOp {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
use serde_v8::utils::{js_exec, v8_do};
|
use serde_v8::utils::js_exec;
|
||||||
|
use serde_v8::utils::v8_do;
|
||||||
use serde_v8::Result;
|
use serde_v8::Result;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use serde_v8::utils::{js_exec, v8_do};
|
use serde_v8::utils::js_exec;
|
||||||
|
use serde_v8::utils::v8_do;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq)]
|
||||||
struct MathOp {
|
struct MathOp {
|
||||||
|
|
|
@ -6,7 +6,8 @@ use crate::napi_new_property;
|
||||||
use napi_sys::Status::napi_ok;
|
use napi_sys::Status::napi_ok;
|
||||||
use napi_sys::ValueType::napi_function;
|
use napi_sys::ValueType::napi_function;
|
||||||
use napi_sys::*;
|
use napi_sys::*;
|
||||||
use std::os::raw::{c_char, c_void};
|
use std::os::raw::c_char;
|
||||||
|
use std::os::raw::c_void;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
pub struct Baton {
|
pub struct Baton {
|
||||||
|
|
|
@ -5,7 +5,8 @@ use crate::napi_get_callback_info;
|
||||||
use crate::napi_new_property;
|
use crate::napi_new_property;
|
||||||
use napi_sys::ValueType::napi_number;
|
use napi_sys::ValueType::napi_number;
|
||||||
use napi_sys::*;
|
use napi_sys::*;
|
||||||
use std::os::raw::{c_char, c_void};
|
use std::os::raw::c_char;
|
||||||
|
use std::os::raw::c_void;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
pub struct NapiObject {
|
pub struct NapiObject {
|
||||||
|
|
|
@ -1610,7 +1610,8 @@ impl HttpServerCount {
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("failed to execute test_server");
|
.expect("failed to execute test_server");
|
||||||
let stdout = test_server.stdout.as_mut().unwrap();
|
let stdout = test_server.stdout.as_mut().unwrap();
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::BufRead;
|
||||||
|
use std::io::BufReader;
|
||||||
let lines = BufReader::new(stdout).lines();
|
let lines = BufReader::new(stdout).lines();
|
||||||
|
|
||||||
// Wait for all the servers to report being ready.
|
// Wait for all the servers to report being ready.
|
||||||
|
|
|
@ -14,8 +14,9 @@ use regex::Regex;
|
||||||
use serde::de;
|
use serde::de;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
use serde_json::json;
|
||||||
|
use serde_json::to_value;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use serde_json::{json, to_value};
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
Loading…
Reference in a new issue