1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-20 20:42:19 -05:00

chore: cargo fmt - turn on group_imports=StdExternalCrate (#26646)

This commit is contained in:
David Sherret 2024-12-31 12:13:39 -05:00 committed by GitHub
parent 88bd5f09f7
commit ac7b33a340
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
298 changed files with 2160 additions and 1951 deletions

View file

@ -13,7 +13,7 @@
}, },
"exec": { "exec": {
"commands": [{ "commands": [{
"command": "rustfmt --config imports_granularity=item", "command": "rustfmt --config imports_granularity=item --config group_imports=StdExternalCrate",
"exts": ["rs"] "exts": ["rs"]
}] }]
}, },

View file

@ -7,7 +7,6 @@ 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; use deno_bench_util::bencher::benchmark_group;
use deno_bench_util::bencher::Bencher; use deno_bench_util::bencher::Bencher;
use deno_core::Extension; use deno_core::Extension;
#[op2] #[op2]

View file

@ -43,11 +43,10 @@ use log::Level;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use crate::args::resolve_no_prompt;
use crate::util::fs::canonicalize_path;
use super::flags_net; use super::flags_net;
use super::jsr_url; use super::jsr_url;
use crate::args::resolve_no_prompt;
use crate::util::fs::canonicalize_path;
#[derive(Clone, Debug, Default, Eq, PartialEq)] #[derive(Clone, Debug, Default, Eq, PartialEq)]
pub enum ConfigFlag { pub enum ConfigFlag {
@ -6059,9 +6058,10 @@ pub fn resolve_urls(urls: Vec<String>) -> Vec<String> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use super::*;
/// Creates vector of strings, Vec<String> /// Creates vector of strings, Vec<String>
macro_rules! svec { macro_rules! svec {
($($x:expr),* $(,)?) => (vec![$($x.to_string().into()),*]); ($($x:expr),* $(,)?) => (vec![$($x.to_string().into()),*]);

View file

@ -1,9 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::net::IpAddr;
use std::str::FromStr;
use deno_core::url::Url; use deno_core::url::Url;
use deno_runtime::deno_permissions::NetDescriptor; use deno_runtime::deno_permissions::NetDescriptor;
use std::net::IpAddr;
use std::str::FromStr;
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct ParsePortError(String); pub struct ParsePortError(String);

View file

@ -10,6 +10,7 @@ use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex; use deno_core::parking_lot::Mutex;
use deno_core::parking_lot::MutexGuard; use deno_core::parking_lot::MutexGuard;
use deno_core::serde_json; use deno_core::serde_json;
use deno_lockfile::Lockfile;
use deno_lockfile::WorkspaceMemberConfig; use deno_lockfile::WorkspaceMemberConfig;
use deno_package_json::PackageJsonDepValue; use deno_package_json::PackageJsonDepValue;
use deno_path_util::fs::atomic_write_file_with_retries; use deno_path_util::fs::atomic_write_file_with_retries;
@ -17,15 +18,12 @@ use deno_runtime::deno_node::PackageJson;
use deno_semver::jsr::JsrDepPackageReq; use deno_semver::jsr::JsrDepPackageReq;
use crate::args::deno_json::import_map_deps; use crate::args::deno_json::import_map_deps;
use crate::args::DenoSubcommand;
use crate::args::InstallFlags;
use crate::cache; use crate::cache;
use crate::sys::CliSys; use crate::sys::CliSys;
use crate::Flags; use crate::Flags;
use crate::args::DenoSubcommand;
use crate::args::InstallFlags;
use deno_lockfile::Lockfile;
#[derive(Debug)] #[derive(Debug)]
pub struct CliLockfileReadFromPathOptions { pub struct CliLockfileReadFromPathOptions {
pub file_path: PathBuf, pub file_path: PathBuf,

View file

@ -7,70 +7,6 @@ mod import_map;
mod lockfile; mod lockfile;
mod package_json; mod package_json;
use deno_ast::MediaType;
use deno_ast::SourceMapOption;
use deno_cache_dir::file_fetcher::CacheSetting;
use deno_config::deno_json::NodeModulesDirMode;
use deno_config::workspace::CreateResolverOptions;
use deno_config::workspace::FolderConfigs;
use deno_config::workspace::PackageJsonDepResolution;
use deno_config::workspace::VendorEnablement;
use deno_config::workspace::Workspace;
use deno_config::workspace::WorkspaceDirectory;
use deno_config::workspace::WorkspaceDirectoryEmptyOptions;
use deno_config::workspace::WorkspaceDiscoverOptions;
use deno_config::workspace::WorkspaceDiscoverStart;
use deno_config::workspace::WorkspaceLintConfig;
use deno_config::workspace::WorkspaceResolver;
use deno_core::resolve_url_or_path;
use deno_graph::GraphKind;
use deno_lint::linter::LintConfig as DenoLintConfig;
use deno_npm::npm_rc::NpmRc;
use deno_npm::npm_rc::ResolvedNpmRc;
use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
use deno_npm::NpmSystemInfo;
use deno_path_util::normalize_path;
use deno_semver::npm::NpmPackageReqReference;
use deno_semver::StackString;
use deno_telemetry::OtelConfig;
use deno_telemetry::OtelRuntimeConfig;
use import_map::resolve_import_map_value_from_specifier;
pub use deno_config::deno_json::BenchConfig;
pub use deno_config::deno_json::ConfigFile;
pub use deno_config::deno_json::FmtOptionsConfig;
pub use deno_config::deno_json::LintRulesConfig;
pub use deno_config::deno_json::ProseWrap;
pub use deno_config::deno_json::TsConfig;
pub use deno_config::deno_json::TsConfigForEmit;
pub use deno_config::deno_json::TsConfigType;
pub use deno_config::deno_json::TsTypeLib;
pub use deno_config::glob::FilePatterns;
pub use deno_json::check_warn_tsconfig;
pub use flags::*;
pub use lockfile::CliLockfile;
pub use lockfile::CliLockfileReadFromPathOptions;
pub use package_json::NpmInstallDepsProvider;
pub use package_json::PackageJsonDepValueParseWithLocationError;
use deno_ast::ModuleSpecifier;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::url::Url;
use deno_runtime::deno_permissions::PermissionsOptions;
use deno_runtime::deno_tls::deno_native_certs::load_native_certs;
use deno_runtime::deno_tls::rustls;
use deno_runtime::deno_tls::rustls::RootCertStore;
use deno_runtime::deno_tls::rustls_pemfile;
use deno_runtime::deno_tls::webpki_roots;
use deno_runtime::inspector_server::InspectorServer;
use deno_terminal::colors;
use dotenvy::from_filename;
use once_cell::sync::Lazy;
use serde::Deserialize;
use serde::Serialize;
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
@ -83,6 +19,72 @@ use std::num::NonZeroUsize;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use deno_ast::MediaType;
use deno_ast::ModuleSpecifier;
use deno_ast::SourceMapOption;
use deno_cache_dir::file_fetcher::CacheSetting;
pub use deno_config::deno_json::BenchConfig;
pub use deno_config::deno_json::ConfigFile;
use deno_config::deno_json::FmtConfig;
pub use deno_config::deno_json::FmtOptionsConfig;
use deno_config::deno_json::LintConfig;
pub use deno_config::deno_json::LintRulesConfig;
use deno_config::deno_json::NodeModulesDirMode;
pub use deno_config::deno_json::ProseWrap;
use deno_config::deno_json::TestConfig;
pub use deno_config::deno_json::TsConfig;
pub use deno_config::deno_json::TsConfigForEmit;
pub use deno_config::deno_json::TsConfigType;
pub use deno_config::deno_json::TsTypeLib;
pub use deno_config::glob::FilePatterns;
use deno_config::workspace::CreateResolverOptions;
use deno_config::workspace::FolderConfigs;
use deno_config::workspace::PackageJsonDepResolution;
use deno_config::workspace::VendorEnablement;
use deno_config::workspace::Workspace;
use deno_config::workspace::WorkspaceDirectory;
use deno_config::workspace::WorkspaceDirectoryEmptyOptions;
use deno_config::workspace::WorkspaceDiscoverOptions;
use deno_config::workspace::WorkspaceDiscoverStart;
use deno_config::workspace::WorkspaceLintConfig;
use deno_config::workspace::WorkspaceResolver;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::resolve_url_or_path;
use deno_core::serde_json;
use deno_core::url::Url;
use deno_graph::GraphKind;
pub use deno_json::check_warn_tsconfig;
use deno_lint::linter::LintConfig as DenoLintConfig;
use deno_npm::npm_rc::NpmRc;
use deno_npm::npm_rc::ResolvedNpmRc;
use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
use deno_npm::NpmSystemInfo;
use deno_path_util::normalize_path;
use deno_runtime::deno_permissions::PermissionsOptions;
use deno_runtime::deno_tls::deno_native_certs::load_native_certs;
use deno_runtime::deno_tls::rustls;
use deno_runtime::deno_tls::rustls::RootCertStore;
use deno_runtime::deno_tls::rustls_pemfile;
use deno_runtime::deno_tls::webpki_roots;
use deno_runtime::inspector_server::InspectorServer;
use deno_semver::npm::NpmPackageReqReference;
use deno_semver::StackString;
use deno_telemetry::OtelConfig;
use deno_telemetry::OtelRuntimeConfig;
use deno_terminal::colors;
use dotenvy::from_filename;
pub use flags::*;
use import_map::resolve_import_map_value_from_specifier;
pub use lockfile::CliLockfile;
pub use lockfile::CliLockfileReadFromPathOptions;
use once_cell::sync::Lazy;
pub use package_json::NpmInstallDepsProvider;
pub use package_json::PackageJsonDepValueParseWithLocationError;
use serde::Deserialize;
use serde::Serialize;
use sys_traits::EnvHomeDir; use sys_traits::EnvHomeDir;
use thiserror::Error; use thiserror::Error;
@ -92,10 +94,6 @@ use crate::sys::CliSys;
use crate::util::fs::canonicalize_path_maybe_not_exists; use crate::util::fs::canonicalize_path_maybe_not_exists;
use crate::version; use crate::version;
use deno_config::deno_json::FmtConfig;
use deno_config::deno_json::LintConfig;
use deno_config::deno_json::TestConfig;
pub fn npm_registry_url() -> &'static Url { pub fn npm_registry_url() -> &'static Url {
static NPM_REGISTRY_DEFAULT_URL: Lazy<Url> = Lazy::new(|| { static NPM_REGISTRY_DEFAULT_URL: Lazy<Url> = Lazy::new(|| {
let env_var_name = "NPM_CONFIG_REGISTRY"; let env_var_name = "NPM_CONFIG_REGISTRY";

View file

@ -1,14 +1,15 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::HashMap;
use std::path::Path;
use std::str::FromStr;
use std::time::Duration;
use deno_core::serde::Deserialize; use deno_core::serde::Deserialize;
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::serde_json::Value; use deno_core::serde_json::Value;
use lsp_types::Uri; use lsp_types::Uri;
use std::collections::HashMap;
use std::path::Path;
use std::str::FromStr;
use std::time::Duration;
use test_util::lsp::LspClientBuilder; use test_util::lsp::LspClientBuilder;
use test_util::PathRef; use test_util::PathRef;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;

View file

@ -3,9 +3,6 @@
#![allow(clippy::print_stdout)] #![allow(clippy::print_stdout)]
#![allow(clippy::print_stderr)] #![allow(clippy::print_stderr)]
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::Value;
use std::collections::HashMap; use std::collections::HashMap;
use std::convert::From; use std::convert::From;
use std::env; use std::env;
@ -15,6 +12,10 @@ use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use std::process::Stdio; use std::process::Stdio;
use std::time::SystemTime; use std::time::SystemTime;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::Value;
use test_util::PathRef; use test_util::PathRef;
mod lsp; mod lsp;

View file

@ -8,16 +8,18 @@ use deno_runtime::*;
mod shared; mod shared;
mod ts { mod ts {
use super::*; use std::collections::HashMap;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use deno_core::error::custom_error; use deno_core::error::custom_error;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::op2; use deno_core::op2;
use deno_core::OpState; use deno_core::OpState;
use serde::Serialize; use serde::Serialize;
use std::collections::HashMap;
use std::io::Write; use super::*;
use std::path::Path;
use std::path::PathBuf;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]

View file

@ -1,5 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::io::IsTerminal;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex; use deno_core::parking_lot::Mutex;
use deno_core::parking_lot::MutexGuard; use deno_core::parking_lot::MutexGuard;
@ -9,10 +14,6 @@ use deno_runtime::deno_webstorage::rusqlite::Connection;
use deno_runtime::deno_webstorage::rusqlite::OptionalExtension; use deno_runtime::deno_webstorage::rusqlite::OptionalExtension;
use deno_runtime::deno_webstorage::rusqlite::Params; use deno_runtime::deno_webstorage::rusqlite::Params;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use std::io::IsTerminal;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use super::FastInsecureHasher; use super::FastInsecureHasher;

7
cli/cache/check.rs vendored
View file

@ -1,12 +1,13 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_runtime::deno_webstorage::rusqlite::params;
use super::cache_db::CacheDB; use super::cache_db::CacheDB;
use super::cache_db::CacheDBConfiguration; use super::cache_db::CacheDBConfiguration;
use super::cache_db::CacheDBHash; use super::cache_db::CacheDBHash;
use super::cache_db::CacheFailure; use super::cache_db::CacheFailure;
use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_runtime::deno_webstorage::rusqlite::params;
pub static TYPE_CHECK_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration { pub static TYPE_CHECK_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
table_initializer: concat!( table_initializer: concat!(

View file

@ -7,12 +7,11 @@ use deno_core::error::AnyError;
use deno_runtime::code_cache; use deno_runtime::code_cache;
use deno_runtime::deno_webstorage::rusqlite::params; use deno_runtime::deno_webstorage::rusqlite::params;
use crate::worker::CliCodeCache;
use super::cache_db::CacheDB; use super::cache_db::CacheDB;
use super::cache_db::CacheDBConfiguration; use super::cache_db::CacheDBConfiguration;
use super::cache_db::CacheDBHash; use super::cache_db::CacheDBHash;
use super::cache_db::CacheFailure; use super::cache_db::CacheFailure;
use crate::worker::CliCodeCache;
pub static CODE_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration { pub static CODE_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
table_initializer: concat!( table_initializer: concat!(

View file

@ -1,14 +1,13 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::env;
use std::path::PathBuf;
use deno_cache_dir::DenoDirResolutionError; use deno_cache_dir::DenoDirResolutionError;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use crate::sys::CliSys;
use super::DiskCache; use super::DiskCache;
use crate::sys::CliSys;
use std::env;
use std::path::PathBuf;
/// Lazily creates the deno dir which might be useful in scenarios /// Lazily creates the deno dir which might be useful in scenarios
/// where functionality wants to continue if the DENO_DIR can't be created. /// where functionality wants to continue if the DENO_DIR can't be created.

View file

@ -1,13 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::sys::CliSys;
use super::CACHE_PERM;
use deno_cache_dir::url_to_filename;
use deno_core::url::Host;
use deno_core::url::Url;
use deno_path_util::fs::atomic_write_file_with_retries;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fs; use std::fs;
use std::path::Component; use std::path::Component;
@ -16,6 +8,14 @@ use std::path::PathBuf;
use std::path::Prefix; use std::path::Prefix;
use std::str; use std::str;
use deno_cache_dir::url_to_filename;
use deno_core::url::Host;
use deno_core::url::Url;
use deno_path_util::fs::atomic_write_file_with_retries;
use super::CACHE_PERM;
use crate::sys::CliSys;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct DiskCache { pub struct DiskCache {
sys: CliSys, sys: CliSys,
@ -130,9 +130,10 @@ impl DiskCache {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use test_util::TempDir; use test_util::TempDir;
use super::*;
#[test] #[test]
fn test_set_get_cache_file() { fn test_set_get_cache_file() {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();

3
cli/cache/emit.rs vendored
View file

@ -159,9 +159,8 @@ impl EmitFileSerializer {
mod test { mod test {
use test_util::TempDir; use test_util::TempDir;
use crate::sys::CliSys;
use super::*; use super::*;
use crate::sys::CliSys;
#[test] #[test]
pub fn emit_cache_general_use() { pub fn emit_cache_general_use() {

24
cli/cache/mod.rs vendored
View file

@ -1,11 +1,8 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::jsr_url; use std::collections::HashMap;
use crate::file_fetcher::CliFetchNoFollowErrorKind; use std::path::PathBuf;
use crate::file_fetcher::CliFileFetcher; use std::sync::Arc;
use crate::file_fetcher::FetchNoFollowOptions;
use crate::file_fetcher::FetchPermissionsOptionRef;
use crate::sys::CliSys;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_cache_dir::file_fetcher::CacheSetting; use deno_cache_dir::file_fetcher::CacheSetting;
@ -21,9 +18,13 @@ use deno_graph::source::LoadResponse;
use deno_graph::source::Loader; use deno_graph::source::Loader;
use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::deno_permissions::PermissionsContainer;
use node_resolver::InNpmPackageChecker; use node_resolver::InNpmPackageChecker;
use std::collections::HashMap;
use std::path::PathBuf; use crate::args::jsr_url;
use std::sync::Arc; use crate::file_fetcher::CliFetchNoFollowErrorKind;
use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::FetchNoFollowOptions;
use crate::file_fetcher::FetchPermissionsOptionRef;
use crate::sys::CliSys;
mod cache_db; mod cache_db;
mod caches; mod caches;
@ -44,6 +45,8 @@ pub use caches::Caches;
pub use check::TypeCheckCache; pub use check::TypeCheckCache;
pub use code_cache::CodeCache; pub use code_cache::CodeCache;
pub use common::FastInsecureHasher; pub use common::FastInsecureHasher;
/// Permissions used to save a file in the disk caches.
pub use deno_cache_dir::CACHE_PERM;
pub use deno_dir::DenoDir; pub use deno_dir::DenoDir;
pub use deno_dir::DenoDirProvider; pub use deno_dir::DenoDirProvider;
pub use disk_cache::DiskCache; pub use disk_cache::DiskCache;
@ -55,9 +58,6 @@ pub use node::NodeAnalysisCache;
pub use parsed_source::LazyGraphSourceParser; pub use parsed_source::LazyGraphSourceParser;
pub use parsed_source::ParsedSourceCache; pub use parsed_source::ParsedSourceCache;
/// Permissions used to save a file in the disk caches.
pub use deno_cache_dir::CACHE_PERM;
pub type GlobalHttpCache = deno_cache_dir::GlobalHttpCache<CliSys>; pub type GlobalHttpCache = deno_cache_dir::GlobalHttpCache<CliSys>;
pub type LocalHttpCache = deno_cache_dir::LocalHttpCache<CliSys>; pub type LocalHttpCache = deno_cache_dir::LocalHttpCache<CliSys>;
pub type LocalLspHttpCache = deno_cache_dir::LocalLspHttpCache<CliSys>; pub type LocalLspHttpCache = deno_cache_dir::LocalLspHttpCache<CliSys>;

3
cli/cache/node.rs vendored
View file

@ -4,12 +4,11 @@ use deno_core::error::AnyError;
use deno_core::serde_json; use deno_core::serde_json;
use deno_runtime::deno_webstorage::rusqlite::params; use deno_runtime::deno_webstorage::rusqlite::params;
use crate::node::CliCjsAnalysis;
use super::cache_db::CacheDB; use super::cache_db::CacheDB;
use super::cache_db::CacheDBConfiguration; use super::cache_db::CacheDBConfiguration;
use super::cache_db::CacheFailure; use super::cache_db::CacheFailure;
use super::CacheDBHash; use super::CacheDBHash;
use crate::node::CliCjsAnalysis;
pub static NODE_ANALYSIS_CACHE_DB: CacheDBConfiguration = pub static NODE_ANALYSIS_CACHE_DB: CacheDBConfiguration =
CacheDBConfiguration { CacheDBConfiguration {

View file

@ -1,9 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::cache::EmitCache; use std::sync::Arc;
use crate::cache::FastInsecureHasher;
use crate::cache::ParsedSourceCache;
use crate::resolver::CjsTracker;
use deno_ast::EmittedSourceText; use deno_ast::EmittedSourceText;
use deno_ast::ModuleKind; use deno_ast::ModuleKind;
@ -21,7 +18,11 @@ use deno_core::ModuleSpecifier;
use deno_graph::MediaType; use deno_graph::MediaType;
use deno_graph::Module; use deno_graph::Module;
use deno_graph::ModuleGraph; use deno_graph::ModuleGraph;
use std::sync::Arc;
use crate::cache::EmitCache;
use crate::cache::FastInsecureHasher;
use crate::cache::ParsedSourceCache;
use crate::resolver::CjsTracker;
#[derive(Debug)] #[derive(Debug)]
pub struct Emitter { pub struct Emitter {

View file

@ -1,5 +1,34 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::future::Future;
use std::path::PathBuf;
use std::sync::Arc;
use deno_cache_dir::npm::NpmCacheDir;
use deno_config::workspace::PackageJsonDepResolution;
use deno_config::workspace::WorkspaceResolver;
use deno_core::error::AnyError;
use deno_core::futures::FutureExt;
use deno_core::FeatureChecker;
use deno_resolver::cjs::IsCjsResolutionMode;
use deno_resolver::npm::NpmReqResolverOptions;
use deno_resolver::DenoResolverOptions;
use deno_resolver::NodeAndNpmReqResolver;
use deno_runtime::deno_fs;
use deno_runtime::deno_fs::RealFs;
use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker;
use deno_runtime::deno_permissions::Permissions;
use deno_runtime::deno_permissions::PermissionsContainer;
use deno_runtime::deno_tls::rustls::RootCertStore;
use deno_runtime::deno_tls::RootCertStoreProvider;
use deno_runtime::deno_web::BlobStore;
use deno_runtime::inspector_server::InspectorServer;
use deno_runtime::permissions::RuntimePermissionDescriptorParser;
use log::warn;
use node_resolver::analyze::NodeCodeTranslator;
use node_resolver::InNpmPackageChecker;
use once_cell::sync::OnceCell;
use crate::args::check_warn_tsconfig; use crate::args::check_warn_tsconfig;
use crate::args::get_root_cert_store; use crate::args::get_root_cert_store;
use crate::args::CaData; use crate::args::CaData;
@ -63,35 +92,6 @@ use crate::util::progress_bar::ProgressBar;
use crate::util::progress_bar::ProgressBarStyle; use crate::util::progress_bar::ProgressBarStyle;
use crate::worker::CliMainWorkerFactory; use crate::worker::CliMainWorkerFactory;
use crate::worker::CliMainWorkerOptions; use crate::worker::CliMainWorkerOptions;
use std::path::PathBuf;
use deno_cache_dir::npm::NpmCacheDir;
use deno_config::workspace::PackageJsonDepResolution;
use deno_config::workspace::WorkspaceResolver;
use deno_core::error::AnyError;
use deno_core::futures::FutureExt;
use deno_core::FeatureChecker;
use deno_resolver::cjs::IsCjsResolutionMode;
use deno_resolver::npm::NpmReqResolverOptions;
use deno_resolver::DenoResolverOptions;
use deno_resolver::NodeAndNpmReqResolver;
use deno_runtime::deno_fs;
use deno_runtime::deno_fs::RealFs;
use deno_runtime::deno_node::RealIsBuiltInNodeModuleChecker;
use deno_runtime::deno_permissions::Permissions;
use deno_runtime::deno_permissions::PermissionsContainer;
use deno_runtime::deno_tls::rustls::RootCertStore;
use deno_runtime::deno_tls::RootCertStoreProvider;
use deno_runtime::deno_web::BlobStore;
use deno_runtime::inspector_server::InspectorServer;
use deno_runtime::permissions::RuntimePermissionDescriptorParser;
use log::warn;
use node_resolver::analyze::NodeCodeTranslator;
use node_resolver::InNpmPackageChecker;
use once_cell::sync::OnceCell;
use std::future::Future;
use std::sync::Arc;
struct CliRootCertStoreProvider { struct CliRootCertStoreProvider {
cell: OnceCell<RootCertStore>, cell: OnceCell<RootCertStore>,

View file

@ -498,10 +498,6 @@ fn validate_scheme(specifier: &Url) -> Result<(), UnsupportedSchemeError> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::cache::GlobalHttpCache;
use crate::http_util::HttpClientProvider;
use super::*;
use deno_cache_dir::file_fetcher::FetchNoFollowErrorKind; use deno_cache_dir::file_fetcher::FetchNoFollowErrorKind;
use deno_cache_dir::file_fetcher::HttpClient; use deno_cache_dir::file_fetcher::HttpClient;
use deno_core::resolve_url; use deno_core::resolve_url;
@ -509,6 +505,10 @@ mod tests {
use deno_runtime::deno_web::InMemoryBlobPart; use deno_runtime::deno_web::InMemoryBlobPart;
use test_util::TempDir; use test_util::TempDir;
use super::*;
use crate::cache::GlobalHttpCache;
use crate::http_util::HttpClientProvider;
fn setup( fn setup(
cache_setting: CacheSetting, cache_setting: CacheSetting,
maybe_temp_dir: Option<TempDir>, maybe_temp_dir: Option<TempDir>,

View file

@ -1,7 +1,8 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::util::progress_bar::UpdateGuard; use std::collections::HashMap;
use crate::version; use std::sync::Arc;
use std::thread::ThreadId;
use boxed_error::Boxed; use boxed_error::Boxed;
use deno_cache_dir::file_fetcher::RedirectHeaderParseError; use deno_cache_dir::file_fetcher::RedirectHeaderParseError;
@ -23,12 +24,11 @@ use http::header::CONTENT_LENGTH;
use http::HeaderMap; use http::HeaderMap;
use http::StatusCode; use http::StatusCode;
use http_body_util::BodyExt; use http_body_util::BodyExt;
use std::collections::HashMap;
use std::sync::Arc;
use std::thread::ThreadId;
use thiserror::Error; use thiserror::Error;
use crate::util::progress_bar::UpdateGuard;
use crate::version;
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum SendError { pub enum SendError {
#[error(transparent)] #[error(transparent)]

View file

@ -1,14 +1,16 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::jsr_url; use std::sync::Arc;
use crate::file_fetcher::CliFileFetcher;
use dashmap::DashMap; use dashmap::DashMap;
use deno_core::serde_json; use deno_core::serde_json;
use deno_graph::packages::JsrPackageInfo; use deno_graph::packages::JsrPackageInfo;
use deno_graph::packages::JsrPackageVersionInfo; use deno_graph::packages::JsrPackageVersionInfo;
use deno_semver::package::PackageNv; use deno_semver::package::PackageNv;
use deno_semver::package::PackageReq; use deno_semver::package::PackageReq;
use std::sync::Arc;
use crate::args::jsr_url;
use crate::file_fetcher::CliFileFetcher;
/// This is similar to a subset of `JsrCacheResolver` which fetches rather than /// This is similar to a subset of `JsrCacheResolver` which fetches rather than
/// just reads the cache. Keep in sync! /// just reads the cache. Keep in sync!

View file

@ -1,25 +1,15 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::diagnostics::DenoDiagnostic; use std::borrow::Cow;
use super::diagnostics::DiagnosticSource; use std::cmp::Ordering;
use super::documents::Document; use std::collections::HashMap;
use super::documents::Documents; use std::collections::HashSet;
use super::language_server; use std::path::Path;
use super::resolver::LspResolver;
use super::tsc;
use super::urls::url_to_uri;
use crate::args::jsr_url;
use crate::lsp::logging::lsp_warn;
use crate::lsp::search::PackageSearchApi;
use crate::tools::lint::CliLinter;
use crate::util::path::relative_specifier;
use deno_config::workspace::MappedResolution;
use deno_lint::diagnostic::LintDiagnosticRange;
use deno_ast::SourceRange; use deno_ast::SourceRange;
use deno_ast::SourceRangedForSpanned; use deno_ast::SourceRangedForSpanned;
use deno_ast::SourceTextInfo; use deno_ast::SourceTextInfo;
use deno_config::workspace::MappedResolution;
use deno_core::error::custom_error; use deno_core::error::custom_error;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::serde::Deserialize; use deno_core::serde::Deserialize;
@ -27,6 +17,7 @@ use deno_core::serde::Serialize;
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 deno_lint::diagnostic::LintDiagnosticRange;
use deno_path_util::url_to_file_path; use deno_path_util::url_to_file_path;
use deno_runtime::deno_node::PathClean; use deno_runtime::deno_node::PathClean;
use deno_semver::jsr::JsrPackageNvReference; use deno_semver::jsr::JsrPackageNvReference;
@ -44,16 +35,25 @@ use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode; use node_resolver::ResolutionMode;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use std::borrow::Cow;
use std::cmp::Ordering;
use std::collections::HashMap;
use std::collections::HashSet;
use std::path::Path;
use text_lines::LineAndColumnIndex; use text_lines::LineAndColumnIndex;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use tower_lsp::lsp_types::Position; use tower_lsp::lsp_types::Position;
use tower_lsp::lsp_types::Range; use tower_lsp::lsp_types::Range;
use super::diagnostics::DenoDiagnostic;
use super::diagnostics::DiagnosticSource;
use super::documents::Document;
use super::documents::Documents;
use super::language_server;
use super::resolver::LspResolver;
use super::tsc;
use super::urls::url_to_uri;
use crate::args::jsr_url;
use crate::lsp::logging::lsp_warn;
use crate::lsp::search::PackageSearchApi;
use crate::tools::lint::CliLinter;
use crate::util::path::relative_specifier;
/// 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 FIX_ALL_ERROR_CODES: Lazy<HashMap<&'static str, &'static str>> = static FIX_ALL_ERROR_CODES: Lazy<HashMap<&'static str, &'static str>> =

View file

@ -1,5 +1,15 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::BTreeMap;
use std::fs;
use std::path::Path;
use std::sync::Arc;
use std::time::SystemTime;
use deno_core::url::Url;
use deno_core::ModuleSpecifier;
use deno_path_util::url_to_file_path;
use crate::cache::DenoDir; use crate::cache::DenoDir;
use crate::cache::GlobalHttpCache; use crate::cache::GlobalHttpCache;
use crate::cache::HttpCache; use crate::cache::HttpCache;
@ -9,15 +19,6 @@ use crate::lsp::logging::lsp_log;
use crate::lsp::logging::lsp_warn; use crate::lsp::logging::lsp_warn;
use crate::sys::CliSys; use crate::sys::CliSys;
use deno_core::url::Url;
use deno_core::ModuleSpecifier;
use deno_path_util::url_to_file_path;
use std::collections::BTreeMap;
use std::fs;
use std::path::Path;
use std::sync::Arc;
use std::time::SystemTime;
pub fn calculate_fs_version( pub fn calculate_fs_version(
cache: &LspCache, cache: &LspCache,
specifier: &ModuleSpecifier, specifier: &ModuleSpecifier,

View file

@ -12,12 +12,11 @@ use lsp_types::Uri;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use tower_lsp::lsp_types::ConfigurationItem; use tower_lsp::lsp_types::ConfigurationItem;
use crate::lsp::repl::get_repl_workspace_settings;
use super::config::WorkspaceSettings; use super::config::WorkspaceSettings;
use super::config::SETTINGS_SECTION; use super::config::SETTINGS_SECTION;
use super::lsp_custom; use super::lsp_custom;
use super::testing::lsp_custom as testing_lsp_custom; use super::testing::lsp_custom as testing_lsp_custom;
use crate::lsp::repl::get_repl_workspace_settings;
#[derive(Debug)] #[derive(Debug)]
pub enum TestingNotification { pub enum TestingNotification {

View file

@ -1,13 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::lsp::logging::lsp_warn; use std::cell::RefCell;
use std::collections::HashSet;
use super::analysis::source_range_to_lsp_range; use std::rc::Rc;
use super::config::CodeLensSettings; use std::sync::Arc;
use super::language_server;
use super::text::LineIndex;
use super::tsc;
use super::tsc::NavigationTree;
use deno_ast::swc::ast; use deno_ast::swc::ast;
use deno_ast::swc::visit::Visit; use deno_ast::swc::visit::Visit;
@ -25,13 +21,17 @@ use deno_core::ModuleSpecifier;
use lazy_regex::lazy_regex; use lazy_regex::lazy_regex;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use std::cell::RefCell;
use std::collections::HashSet;
use std::rc::Rc;
use std::sync::Arc;
use tower_lsp::jsonrpc::Error as LspError; use tower_lsp::jsonrpc::Error as LspError;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::analysis::source_range_to_lsp_range;
use super::config::CodeLensSettings;
use super::language_server;
use super::text::LineIndex;
use super::tsc;
use super::tsc::NavigationTree;
use crate::lsp::logging::lsp_warn;
static ABSTRACT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\babstract\b"); static ABSTRACT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\babstract\b");
static EXPORT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\bexport\b"); static EXPORT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\bexport\b");

View file

@ -1,5 +1,27 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use deno_ast::LineAndColumnIndex;
use deno_ast::SourceTextInfo;
use deno_core::resolve_path;
use deno_core::resolve_url;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json::json;
use deno_core::url::Position;
use deno_core::ModuleSpecifier;
use deno_path_util::url_to_file_path;
use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES;
use deno_semver::jsr::JsrPackageReqReference;
use deno_semver::package::PackageNv;
use import_map::ImportMap;
use indexmap::IndexSet;
use lsp_types::CompletionList;
use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode;
use once_cell::sync::Lazy;
use regex::Regex;
use tower_lsp::lsp_types as lsp;
use super::client::Client; use super::client::Client;
use super::config::Config; use super::config::Config;
use super::config::WorkspaceSettings; use super::config::WorkspaceSettings;
@ -12,33 +34,10 @@ use super::registries::ModuleRegistry;
use super::resolver::LspResolver; use super::resolver::LspResolver;
use super::search::PackageSearchApi; use super::search::PackageSearchApi;
use super::tsc; use super::tsc;
use crate::graph_util::to_node_resolution_mode; use crate::graph_util::to_node_resolution_mode;
use crate::jsr::JsrFetchResolver; use crate::jsr::JsrFetchResolver;
use crate::util::path::is_importable_ext; use crate::util::path::is_importable_ext;
use crate::util::path::relative_specifier; use crate::util::path::relative_specifier;
use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES;
use deno_ast::LineAndColumnIndex;
use deno_ast::SourceTextInfo;
use deno_core::resolve_path;
use deno_core::resolve_url;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json::json;
use deno_core::url::Position;
use deno_core::ModuleSpecifier;
use deno_path_util::url_to_file_path;
use deno_semver::jsr::JsrPackageReqReference;
use deno_semver::package::PackageNv;
use import_map::ImportMap;
use indexmap::IndexSet;
use lsp_types::CompletionList;
use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode;
use once_cell::sync::Lazy;
use regex::Regex;
use tower_lsp::lsp_types as lsp;
static FILE_PROTO_RE: Lazy<Regex> = static FILE_PROTO_RE: Lazy<Regex> =
lazy_regex::lazy_regex!(r#"^file:/{2}(?:/[A-Za-z]:)?"#); lazy_regex::lazy_regex!(r#"^file:/{2}(?:/[A-Za-z]:)?"#);
@ -822,16 +821,18 @@ fn get_workspace_completions(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::collections::HashMap;
use deno_core::resolve_url;
use pretty_assertions::assert_eq;
use test_util::TempDir;
use super::*; use super::*;
use crate::cache::HttpCache; use crate::cache::HttpCache;
use crate::lsp::cache::LspCache; use crate::lsp::cache::LspCache;
use crate::lsp::documents::Documents; use crate::lsp::documents::Documents;
use crate::lsp::documents::LanguageId; use crate::lsp::documents::LanguageId;
use crate::lsp::search::tests::TestPackageSearchApi; use crate::lsp::search::tests::TestPackageSearchApi;
use deno_core::resolve_url;
use pretty_assertions::assert_eq;
use std::collections::HashMap;
use test_util::TempDir;
fn setup( fn setup(
open_sources: &[(&str, &str, i32, LanguageId)], open_sources: &[(&str, &str, i32, LanguageId)],

View file

@ -1,5 +1,14 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::ops::Deref;
use std::ops::DerefMut;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_config::deno_json::DenoJsonCache; use deno_config::deno_json::DenoJsonCache;
use deno_config::deno_json::FmtConfig; use deno_config::deno_json::FmtConfig;
@ -39,14 +48,6 @@ use deno_path_util::url_to_file_path;
use deno_runtime::deno_node::PackageJson; use deno_runtime::deno_node::PackageJson;
use indexmap::IndexSet; use indexmap::IndexSet;
use lsp_types::ClientCapabilities; use lsp_types::ClientCapabilities;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::ops::Deref;
use std::ops::DerefMut;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::logging::lsp_log; use super::logging::lsp_log;

View file

@ -1,32 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::analysis; use std::collections::HashMap;
use super::client::Client; use std::collections::HashSet;
use super::config::Config; use std::path::PathBuf;
use super::documents; use std::sync::atomic::AtomicUsize;
use super::documents::Document; use std::sync::Arc;
use super::documents::Documents; use std::thread;
use super::documents::DocumentsFilter;
use super::language_server;
use super::language_server::StateSnapshot;
use super::performance::Performance;
use super::tsc;
use super::tsc::TsServer;
use super::urls::uri_parse_unencoded;
use super::urls::url_to_uri;
use super::urls::LspUrlMap;
use crate::graph_util;
use crate::graph_util::enhanced_resolution_error_message;
use crate::lsp::lsp_custom::DiagnosticBatchNotificationParams;
use crate::resolver::CliSloppyImportsResolver;
use crate::resolver::SloppyImportsCachedFs;
use crate::sys::CliSys;
use crate::tools::lint::CliLinter;
use crate::tools::lint::CliLinterOptions;
use crate::tools::lint::LintRuleProvider;
use crate::tsc::DiagnosticCategory;
use crate::util::path::to_percent_decoded_str;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_config::deno_json::LintConfig; use deno_config::deno_json::LintConfig;
@ -57,18 +36,39 @@ use deno_semver::package::PackageReq;
use import_map::ImportMap; use import_map::ImportMap;
use import_map::ImportMapError; use import_map::ImportMapError;
use log::error; use log::error;
use std::collections::HashMap;
use std::collections::HashSet;
use std::path::PathBuf;
use std::sync::atomic::AtomicUsize;
use std::sync::Arc;
use std::thread;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use tokio::time::Duration; use tokio::time::Duration;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::analysis;
use super::client::Client;
use super::config::Config;
use super::documents;
use super::documents::Document;
use super::documents::Documents;
use super::documents::DocumentsFilter;
use super::language_server;
use super::language_server::StateSnapshot;
use super::performance::Performance;
use super::tsc;
use super::tsc::TsServer;
use super::urls::uri_parse_unencoded;
use super::urls::url_to_uri;
use super::urls::LspUrlMap;
use crate::graph_util;
use crate::graph_util::enhanced_resolution_error_message;
use crate::lsp::lsp_custom::DiagnosticBatchNotificationParams;
use crate::resolver::CliSloppyImportsResolver;
use crate::resolver::SloppyImportsCachedFs;
use crate::sys::CliSys;
use crate::tools::lint::CliLinter;
use crate::tools::lint::CliLinterOptions;
use crate::tools::lint::LintRuleProvider;
use crate::tsc::DiagnosticCategory;
use crate::util::path::to_percent_decoded_str;
#[derive(Debug)] #[derive(Debug)]
pub struct DiagnosticServerUpdateMessage { pub struct DiagnosticServerUpdateMessage {
pub snapshot: Arc<StateSnapshot>, pub snapshot: Arc<StateSnapshot>,
@ -1646,6 +1646,12 @@ fn generate_deno_diagnostics(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::sync::Arc;
use deno_config::deno_json::ConfigFile;
use pretty_assertions::assert_eq;
use test_util::TempDir;
use super::*; use super::*;
use crate::lsp::cache::LspCache; use crate::lsp::cache::LspCache;
use crate::lsp::config::Config; use crate::lsp::config::Config;
@ -1656,11 +1662,6 @@ mod tests {
use crate::lsp::language_server::StateSnapshot; use crate::lsp::language_server::StateSnapshot;
use crate::lsp::resolver::LspResolver; use crate::lsp::resolver::LspResolver;
use deno_config::deno_json::ConfigFile;
use pretty_assertions::assert_eq;
use std::sync::Arc;
use test_util::TempDir;
fn mock_config() -> Config { fn mock_config() -> Config {
let root_url = resolve_url("file:///").unwrap(); let root_url = resolve_url("file:///").unwrap();
let root_uri = url_to_uri(&root_url).unwrap(); let root_uri = url_to_uri(&root_url).unwrap();

View file

@ -1,18 +1,17 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::cache::calculate_fs_version; use std::borrow::Cow;
use super::cache::LspCache; use std::collections::BTreeMap;
use super::config::Config; use std::collections::HashMap;
use super::resolver::LspResolver; use std::collections::HashSet;
use super::resolver::ScopeDepInfo; use std::fs;
use super::resolver::SingleReferrerGraphResolver; use std::future::Future;
use super::testing::TestCollector; use std::ops::Range;
use super::testing::TestModule; use std::pin::Pin;
use super::text::LineIndex; use std::str::FromStr;
use super::tsc; use std::sync::atomic::AtomicBool;
use super::tsc::AssetDocument; use std::sync::atomic::Ordering;
use std::sync::Arc;
use crate::graph_util::CliJsrUrlProvider;
use dashmap::DashMap; use dashmap::DashMap;
use deno_ast::swc::visit::VisitWith; use deno_ast::swc::visit::VisitWith;
@ -36,20 +35,21 @@ use indexmap::IndexMap;
use indexmap::IndexSet; use indexmap::IndexSet;
use node_resolver::NodeResolutionKind; use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode; use node_resolver::ResolutionMode;
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs;
use std::future::Future;
use std::ops::Range;
use std::pin::Pin;
use std::str::FromStr;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::cache::calculate_fs_version;
use super::cache::LspCache;
use super::config::Config;
use super::resolver::LspResolver;
use super::resolver::ScopeDepInfo;
use super::resolver::SingleReferrerGraphResolver;
use super::testing::TestCollector;
use super::testing::TestModule;
use super::text::LineIndex;
use super::tsc;
use super::tsc::AssetDocument;
use crate::graph_util::CliJsrUrlProvider;
pub const DOCUMENT_SCHEMES: [&str; 5] = pub const DOCUMENT_SCHEMES: [&str; 5] =
["data", "blob", "file", "http", "https"]; ["data", "blob", "file", "http", "https"];
@ -1754,9 +1754,6 @@ fn bytes_to_content(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use crate::lsp::cache::LspCache;
use deno_config::deno_json::ConfigFile; use deno_config::deno_json::ConfigFile;
use deno_config::deno_json::ConfigParseOptions; use deno_config::deno_json::ConfigParseOptions;
use deno_core::serde_json; use deno_core::serde_json;
@ -1764,6 +1761,9 @@ mod tests {
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use test_util::TempDir; use test_util::TempDir;
use super::*;
use crate::lsp::cache::LspCache;
async fn setup() -> (Documents, LspCache, TempDir) { async fn setup() -> (Documents, LspCache, TempDir) {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();
temp_dir.create_dir_all(".deno_dir"); temp_dir.create_dir_all(".deno_dir");

View file

@ -1,11 +1,8 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::jsr_api_url; use std::collections::HashMap;
use crate::args::jsr_url; use std::sync::Arc;
use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::TextDecodedFile;
use crate::jsr::partial_jsr_package_version_info_from_slice;
use crate::jsr::JsrFetchResolver;
use dashmap::DashMap; use dashmap::DashMap;
use deno_cache_dir::HttpCache; use deno_cache_dir::HttpCache;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
@ -21,11 +18,15 @@ use deno_semver::package::PackageReq;
use deno_semver::StackString; use deno_semver::StackString;
use deno_semver::Version; use deno_semver::Version;
use serde::Deserialize; use serde::Deserialize;
use std::collections::HashMap;
use std::sync::Arc;
use super::config::ConfigData; use super::config::ConfigData;
use super::search::PackageSearchApi; use super::search::PackageSearchApi;
use crate::args::jsr_api_url;
use crate::args::jsr_url;
use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::TextDecodedFile;
use crate::jsr::partial_jsr_package_version_info_from_slice;
use crate::jsr::JsrFetchResolver;
/// Keep in sync with `JsrFetchResolver`! /// Keep in sync with `JsrFetchResolver`!
#[derive(Debug)] #[derive(Debug)]

View file

@ -1,5 +1,16 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::env;
use std::fmt::Write as _;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_cache_dir::file_fetcher::CacheSetting; use deno_cache_dir::file_fetcher::CacheSetting;
use deno_config::workspace::WorkspaceDirectory; use deno_config::workspace::WorkspaceDirectory;
@ -27,16 +38,6 @@ use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode; use node_resolver::ResolutionMode;
use serde::Deserialize; use serde::Deserialize;
use serde_json::from_value; use serde_json::from_value;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::env;
use std::fmt::Write as _;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::unbounded_channel;
use tokio::sync::mpsc::UnboundedReceiver; use tokio::sync::mpsc::UnboundedReceiver;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
@ -3963,10 +3964,11 @@ impl Inner {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use test_util::TempDir; use test_util::TempDir;
use super::*;
#[test] #[test]
fn test_walk_workspace() { fn test_walk_workspace() {
let temp_dir = TempDir::new(); let temp_dir = TempDir::new();

View file

@ -1,8 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use chrono::DateTime;
use chrono::Utc;
use deno_core::parking_lot::Mutex;
use std::fs; use std::fs;
use std::io::prelude::*; use std::io::prelude::*;
use std::path::Path; use std::path::Path;
@ -12,6 +9,10 @@ use std::sync::atomic::Ordering;
use std::thread; use std::thread;
use std::time::SystemTime; use std::time::SystemTime;
use chrono::DateTime;
use chrono::Utc;
use deno_core::parking_lot::Mutex;
static LSP_DEBUG_FLAG: AtomicBool = AtomicBool::new(false); static LSP_DEBUG_FLAG: AtomicBool = AtomicBool::new(false);
static LSP_LOG_LEVEL: AtomicUsize = AtomicUsize::new(log::Level::Info as usize); static LSP_LOG_LEVEL: AtomicUsize = AtomicUsize::new(log::Level::Info as usize);
static LSP_WARN_LEVEL: AtomicUsize = static LSP_WARN_LEVEL: AtomicUsize =

View file

@ -2,15 +2,14 @@
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::unsync::spawn; use deno_core::unsync::spawn;
pub use repl::ReplCompletionItem;
pub use repl::ReplLanguageServer;
use tower_lsp::LspService; use tower_lsp::LspService;
use tower_lsp::Server; use tower_lsp::Server;
use self::diagnostics::should_send_diagnostic_batch_index_notifications;
use crate::lsp::language_server::LanguageServer; use crate::lsp::language_server::LanguageServer;
use crate::util::sync::AsyncFlag; use crate::util::sync::AsyncFlag;
pub use repl::ReplCompletionItem;
pub use repl::ReplLanguageServer;
use self::diagnostics::should_send_diagnostic_batch_index_notifications;
mod analysis; mod analysis;
mod cache; mod cache;

View file

@ -1,5 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::sync::Arc;
use dashmap::DashMap; use dashmap::DashMap;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
use deno_core::error::AnyError; use deno_core::error::AnyError;
@ -8,15 +10,13 @@ use deno_npm::npm_rc::NpmRc;
use deno_semver::package::PackageNv; use deno_semver::package::PackageNv;
use deno_semver::Version; use deno_semver::Version;
use serde::Deserialize; use serde::Deserialize;
use std::sync::Arc;
use super::search::PackageSearchApi;
use crate::args::npm_registry_url; use crate::args::npm_registry_url;
use crate::file_fetcher::CliFileFetcher; use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::TextDecodedFile; use crate::file_fetcher::TextDecodedFile;
use crate::npm::NpmFetchResolver; use crate::npm::NpmFetchResolver;
use super::search::PackageSearchApi;
#[derive(Debug)] #[derive(Debug)]
pub struct CliNpmSearchApi { pub struct CliNpmSearchApi {
file_fetcher: Arc<CliFileFetcher>, file_fetcher: Arc<CliFileFetcher>,

View file

@ -52,10 +52,12 @@ fn is_process_active(process_id: u32) -> bool {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::is_process_active;
use std::process::Command; use std::process::Command;
use test_util::deno_exe_path; use test_util::deno_exe_path;
use super::is_process_active;
#[test] #[test]
fn process_active() { fn process_active() {
// launch a long running process // launch a long running process

View file

@ -26,15 +26,16 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
use std::collections::HashMap;
use std::fmt;
use std::fmt::Write as _;
use std::iter::Peekable;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use fancy_regex::Regex as FancyRegex; use fancy_regex::Regex as FancyRegex;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use std::collections::HashMap;
use std::fmt;
use std::fmt::Write as _;
use std::iter::Peekable;
static ESCAPE_STRING_RE: Lazy<Regex> = static ESCAPE_STRING_RE: Lazy<Regex> =
lazy_regex::lazy_regex!(r"([.+*?=^!:${}()\[\]|/\\])"); lazy_regex::lazy_regex!(r"([.+*?=^!:${}()\[\]|/\\])");

View file

@ -1,9 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use deno_core::parking_lot::Mutex;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json::json;
use std::cmp; use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::VecDeque; use std::collections::VecDeque;
@ -12,6 +8,11 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
use deno_core::parking_lot::Mutex;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json::json;
use super::logging::lsp_debug; use super::logging::lsp_debug;
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)] #[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]

View file

@ -1,25 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::completions::IMPORT_COMMIT_CHARS; use std::borrow::Cow;
use super::logging::lsp_log; use std::collections::HashMap;
use super::path_to_regex::parse; use std::path::PathBuf;
use super::path_to_regex::string_to_regex; use std::sync::Arc;
use super::path_to_regex::Compiler;
use super::path_to_regex::Key;
use super::path_to_regex::MatchResult;
use super::path_to_regex::Matcher;
use super::path_to_regex::StringOrNumber;
use super::path_to_regex::StringOrVec;
use super::path_to_regex::Token;
use crate::cache::GlobalHttpCache;
use crate::cache::HttpCache;
use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::FetchOptions;
use crate::file_fetcher::FetchPermissionsOptionRef;
use crate::file_fetcher::TextDecodedFile;
use crate::http_util::HttpClientProvider;
use crate::sys::CliSys;
use deno_cache_dir::file_fetcher::CacheSetting; use deno_cache_dir::file_fetcher::CacheSetting;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
@ -35,12 +19,28 @@ use deno_core::ModuleSpecifier;
use deno_graph::Dependency; use deno_graph::Dependency;
use log::error; use log::error;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::borrow::Cow;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::completions::IMPORT_COMMIT_CHARS;
use super::logging::lsp_log;
use super::path_to_regex::parse;
use super::path_to_regex::string_to_regex;
use super::path_to_regex::Compiler;
use super::path_to_regex::Key;
use super::path_to_regex::MatchResult;
use super::path_to_regex::Matcher;
use super::path_to_regex::StringOrNumber;
use super::path_to_regex::StringOrVec;
use super::path_to_regex::Token;
use crate::cache::GlobalHttpCache;
use crate::cache::HttpCache;
use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::FetchOptions;
use crate::file_fetcher::FetchPermissionsOptionRef;
use crate::file_fetcher::TextDecodedFile;
use crate::http_util::HttpClientProvider;
use crate::sys::CliSys;
const CONFIG_PATH: &str = "/.well-known/deno-import-intellisense.json"; const CONFIG_PATH: &str = "/.well-known/deno-import-intellisense.json";
const COMPONENT: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS const COMPONENT: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
.add(b' ') .add(b' ')
@ -1128,9 +1128,10 @@ FetchPermissionsOptionRef::AllowAll,
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use test_util::TempDir; use test_util::TempDir;
use super::*;
#[test] #[test]
fn test_validate_registry_configuration() { fn test_validate_registry_configuration() {
assert!(validate_config(&RegistryConfigurationJson { assert!(validate_config(&RegistryConfigurationJson {

View file

@ -1,5 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
use dashmap::DashMap; use dashmap::DashMap;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_cache_dir::file_fetcher::CacheSetting; use deno_cache_dir::file_fetcher::CacheSetting;
@ -28,12 +35,6 @@ use indexmap::IndexMap;
use node_resolver::InNpmPackageChecker; use node_resolver::InNpmPackageChecker;
use node_resolver::NodeResolutionKind; use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode; use node_resolver::ResolutionMode;
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
use super::cache::LspCache; use super::cache::LspCache;
use super::jsr::JsrCacheResolver; use super::jsr::JsrCacheResolver;

View file

@ -1,9 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::sync::Arc;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_semver::package::PackageNv; use deno_semver::package::PackageNv;
use deno_semver::Version; use deno_semver::Version;
use std::sync::Arc;
#[async_trait::async_trait] #[async_trait::async_trait]
pub trait PackageSearchApi { pub trait PackageSearchApi {
@ -15,10 +16,12 @@ pub trait PackageSearchApi {
#[cfg(test)] #[cfg(test)]
pub mod tests { pub mod tests {
use super::*;
use deno_core::anyhow::anyhow;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use deno_core::anyhow::anyhow;
use super::*;
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct TestPackageSearchApi { pub struct TestPackageSearchApi {
/// [(name -> [(version -> [export])])] /// [(name -> [(version -> [export])])]

View file

@ -7,6 +7,7 @@
use std::ops::Index; use std::ops::Index;
use std::ops::IndexMut; use std::ops::IndexMut;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use tower_lsp::lsp_types::SemanticToken; use tower_lsp::lsp_types::SemanticToken;
use tower_lsp::lsp_types::SemanticTokenModifier; use tower_lsp::lsp_types::SemanticTokenModifier;

View file

@ -1,8 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::lsp::analysis::source_range_to_lsp_range; use std::collections::HashMap;
use std::collections::HashSet;
use super::definitions::TestModule;
use deno_ast::swc::ast; use deno_ast::swc::ast;
use deno_ast::swc::visit::Visit; use deno_ast::swc::visit::Visit;
@ -11,10 +10,11 @@ use deno_ast::SourceRangedForSpanned;
use deno_ast::SourceTextInfo; use deno_ast::SourceTextInfo;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use lsp::Range; use lsp::Range;
use std::collections::HashMap;
use std::collections::HashSet;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::definitions::TestModule;
use crate::lsp::analysis::source_range_to_lsp_range;
/// Parse an arrow expression for any test steps and return them. /// Parse an arrow expression for any test steps and return them.
fn visit_arrow( fn visit_arrow(
arrow_expr: &ast::ArrowExpr, arrow_expr: &ast::ArrowExpr,
@ -626,12 +626,12 @@ impl Visit for TestCollector {
#[cfg(test)] #[cfg(test)]
pub mod tests { pub mod tests {
use crate::lsp::testing::definitions::TestDefinition;
use super::*;
use deno_core::resolve_url; use deno_core::resolve_url;
use lsp::Position; use lsp::Position;
use super::*;
use crate::lsp::testing::definitions::TestDefinition;
pub fn new_range(l1: u32, c1: u32, l2: u32, c2: u32) -> Range { pub fn new_range(l1: u32, c1: u32, l2: u32, c2: u32) -> Range {
Range::new(Position::new(l1, c1), Position::new(l2, c2)) Range::new(Position::new(l1, c1), Position::new(l2, c2))
} }

View file

@ -1,8 +1,15 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::HashMap;
use std::collections::HashSet;
use deno_core::error::AnyError;
use deno_core::ModuleSpecifier;
use lsp::Range;
use tower_lsp::lsp_types as lsp;
use super::lsp_custom; use super::lsp_custom;
use super::lsp_custom::TestData; use super::lsp_custom::TestData;
use crate::lsp::client::TestingNotification; use crate::lsp::client::TestingNotification;
use crate::lsp::logging::lsp_warn; use crate::lsp::logging::lsp_warn;
use crate::lsp::urls::url_to_uri; use crate::lsp::urls::url_to_uri;
@ -10,13 +17,6 @@ use crate::tools::test::TestDescription;
use crate::tools::test::TestStepDescription; use crate::tools::test::TestStepDescription;
use crate::util::checksum; use crate::util::checksum;
use deno_core::error::AnyError;
use deno_core::ModuleSpecifier;
use lsp::Range;
use std::collections::HashMap;
use std::collections::HashSet;
use tower_lsp::lsp_types as lsp;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TestDefinition { pub struct TestDefinition {
pub id: String, pub id: String,

View file

@ -1,24 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::definitions::TestDefinition; use std::borrow::Cow;
use super::definitions::TestModule; use std::collections::HashMap;
use super::lsp_custom; use std::collections::HashSet;
use super::server::TestServerTests; use std::num::NonZeroUsize;
use std::sync::Arc;
use crate::args::flags_from_vec; use std::time::Duration;
use crate::args::DenoSubcommand; use std::time::Instant;
use crate::factory::CliFactory;
use crate::lsp::client::Client;
use crate::lsp::client::TestingNotification;
use crate::lsp::config;
use crate::lsp::logging::lsp_log;
use crate::lsp::urls::uri_parse_unencoded;
use crate::lsp::urls::uri_to_url;
use crate::lsp::urls::url_to_uri;
use crate::tools::test;
use crate::tools::test::create_test_event_channel;
use crate::tools::test::FailFastTracker;
use crate::tools::test::TestFailureFormatOptions;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
use deno_core::error::AnyError; use deno_core::error::AnyError;
@ -34,16 +22,28 @@ use deno_runtime::deno_permissions::Permissions;
use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::deno_permissions::PermissionsContainer;
use deno_runtime::tokio_util::create_and_run_current_thread; use deno_runtime::tokio_util::create_and_run_current_thread;
use indexmap::IndexMap; use indexmap::IndexMap;
use std::borrow::Cow;
use std::collections::HashMap;
use std::collections::HashSet;
use std::num::NonZeroUsize;
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::definitions::TestDefinition;
use super::definitions::TestModule;
use super::lsp_custom;
use super::server::TestServerTests;
use crate::args::flags_from_vec;
use crate::args::DenoSubcommand;
use crate::factory::CliFactory;
use crate::lsp::client::Client;
use crate::lsp::client::TestingNotification;
use crate::lsp::config;
use crate::lsp::logging::lsp_log;
use crate::lsp::urls::uri_parse_unencoded;
use crate::lsp::urls::uri_to_url;
use crate::lsp::urls::url_to_uri;
use crate::tools::test;
use crate::tools::test::create_test_event_channel;
use crate::tools::test::FailFastTracker;
use crate::tools::test::TestFailureFormatOptions;
/// Logic to convert a test request into a set of test modules to be tested and /// Logic to convert a test request into a set of test modules to be tested and
/// any filters to be applied to those tests /// any filters to be applied to those tests
fn as_queue_and_filters( fn as_queue_and_filters(
@ -794,9 +794,10 @@ impl LspTestReporter {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use deno_core::serde_json::json;
use super::*; use super::*;
use crate::lsp::testing::collectors::tests::new_range; use crate::lsp::testing::collectors::tests::new_range;
use deno_core::serde_json::json;
#[test] #[test]
fn test_as_queue_and_filters() { fn test_as_queue_and_filters() {

View file

@ -1,16 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::definitions::TestModule; use std::collections::HashMap;
use super::execution::TestRun; use std::collections::HashSet;
use super::lsp_custom; use std::sync::Arc;
use std::thread;
use crate::lsp::client::Client;
use crate::lsp::client::TestingNotification;
use crate::lsp::config;
use crate::lsp::documents::DocumentsFilter;
use crate::lsp::language_server::StateSnapshot;
use crate::lsp::performance::Performance;
use crate::lsp::urls::url_to_uri;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex; use deno_core::parking_lot::Mutex;
@ -18,15 +11,22 @@ 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 deno_runtime::tokio_util::create_basic_runtime; use deno_runtime::tokio_util::create_basic_runtime;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
use std::thread;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tower_lsp::jsonrpc::Error as LspError; use tower_lsp::jsonrpc::Error as LspError;
use tower_lsp::jsonrpc::Result as LspResult; use tower_lsp::jsonrpc::Result as LspResult;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::definitions::TestModule;
use super::execution::TestRun;
use super::lsp_custom;
use crate::lsp::client::Client;
use crate::lsp::client::TestingNotification;
use crate::lsp::config;
use crate::lsp::documents::DocumentsFilter;
use crate::lsp::language_server::StateSnapshot;
use crate::lsp::performance::Performance;
use crate::lsp::urls::url_to_uri;
fn as_delete_notification( fn as_delete_notification(
url: &ModuleSpecifier, url: &ModuleSpecifier,
) -> Result<TestingNotification, AnyError> { ) -> Result<TestingNotification, AnyError> {

View file

@ -1,10 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::HashMap;
use deno_core::error::custom_error; use deno_core::error::custom_error;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use dissimilar::diff; use dissimilar::diff;
use dissimilar::Chunk; use dissimilar::Chunk;
use std::collections::HashMap;
use text_size::TextRange; use text_size::TextRange;
use text_size::TextSize; use text_size::TextSize;
use tower_lsp::jsonrpc; use tower_lsp::jsonrpc;

View file

@ -1,52 +1,29 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::analysis::CodeActionData; use std::cell::RefCell;
use super::code_lens; use std::cmp;
use super::config; use std::collections::BTreeMap;
use super::config::LspTsConfig; use std::collections::HashMap;
use super::documents::AssetOrDocument; use std::collections::HashSet;
use super::documents::Document; use std::convert::Infallible;
use super::documents::DocumentsFilter; use std::net::SocketAddr;
use super::language_server; use std::ops::Range;
use super::language_server::StateSnapshot; use std::path::Path;
use super::performance::Performance; use std::rc::Rc;
use super::performance::PerformanceMark; use std::sync::Arc;
use super::refactor::RefactorCodeActionData; use std::thread;
use super::refactor::ALL_KNOWN_REFACTOR_ACTION_KINDS;
use super::refactor::EXTRACT_CONSTANT;
use super::refactor::EXTRACT_INTERFACE;
use super::refactor::EXTRACT_TYPE;
use super::semantic_tokens;
use super::semantic_tokens::SemanticTokensBuilder;
use super::text::LineIndex;
use super::urls::uri_to_url;
use super::urls::url_to_uri;
use super::urls::INVALID_SPECIFIER;
use super::urls::INVALID_URI;
use crate::args::jsr_url;
use crate::args::FmtOptionsConfig;
use crate::lsp::logging::lsp_warn;
use crate::tsc;
use crate::tsc::ResolveArgs;
use crate::tsc::MISSING_DEPENDENCY_SPECIFIER;
use crate::util::path::relative_specifier;
use crate::util::path::to_percent_decoded_str;
use crate::util::result::InfallibleResultExt;
use crate::util::v8::convert;
use crate::worker::create_isolate_create_params;
use deno_core::convert::Smi;
use deno_core::convert::ToV8;
use deno_core::error::StdAnyError;
use deno_core::futures::stream::FuturesOrdered;
use deno_core::futures::StreamExt;
use dashmap::DashMap; use dashmap::DashMap;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
use deno_core::anyhow::Context as _; use deno_core::anyhow::Context as _;
use deno_core::convert::Smi;
use deno_core::convert::ToV8;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::error::StdAnyError;
use deno_core::futures::stream::FuturesOrdered;
use deno_core::futures::FutureExt; use deno_core::futures::FutureExt;
use deno_core::futures::StreamExt;
use deno_core::op2; use deno_core::op2;
use deno_core::parking_lot::Mutex; use deno_core::parking_lot::Mutex;
use deno_core::resolve_url; use deno_core::resolve_url;
@ -77,18 +54,6 @@ use regex::Captures;
use regex::Regex; use regex::Regex;
use serde_repr::Deserialize_repr; use serde_repr::Deserialize_repr;
use serde_repr::Serialize_repr; use serde_repr::Serialize_repr;
use std::cell::RefCell;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::convert::Infallible;
use std::net::SocketAddr;
use std::ops::Range;
use std::path::Path;
use std::rc::Rc;
use std::sync::Arc;
use std::thread;
use text_size::TextRange; use text_size::TextRange;
use text_size::TextSize; use text_size::TextSize;
use tokio::sync::mpsc; use tokio::sync::mpsc;
@ -99,6 +64,41 @@ use tower_lsp::jsonrpc::Error as LspError;
use tower_lsp::jsonrpc::Result as LspResult; use tower_lsp::jsonrpc::Result as LspResult;
use tower_lsp::lsp_types as lsp; use tower_lsp::lsp_types as lsp;
use super::analysis::CodeActionData;
use super::code_lens;
use super::config;
use super::config::LspTsConfig;
use super::documents::AssetOrDocument;
use super::documents::Document;
use super::documents::DocumentsFilter;
use super::language_server;
use super::language_server::StateSnapshot;
use super::performance::Performance;
use super::performance::PerformanceMark;
use super::refactor::RefactorCodeActionData;
use super::refactor::ALL_KNOWN_REFACTOR_ACTION_KINDS;
use super::refactor::EXTRACT_CONSTANT;
use super::refactor::EXTRACT_INTERFACE;
use super::refactor::EXTRACT_TYPE;
use super::semantic_tokens;
use super::semantic_tokens::SemanticTokensBuilder;
use super::text::LineIndex;
use super::urls::uri_to_url;
use super::urls::url_to_uri;
use super::urls::INVALID_SPECIFIER;
use super::urls::INVALID_URI;
use crate::args::jsr_url;
use crate::args::FmtOptionsConfig;
use crate::lsp::logging::lsp_warn;
use crate::tsc;
use crate::tsc::ResolveArgs;
use crate::tsc::MISSING_DEPENDENCY_SPECIFIER;
use crate::util::path::relative_specifier;
use crate::util::path::to_percent_decoded_str;
use crate::util::result::InfallibleResultExt;
use crate::util::v8::convert;
use crate::worker::create_isolate_create_params;
static BRACKET_ACCESSOR_RE: Lazy<Regex> = static BRACKET_ACCESSOR_RE: Lazy<Regex> =
lazy_regex!(r#"^\[['"](.+)[\['"]\]$"#); lazy_regex!(r#"^\[['"](.+)[\['"]\]$"#);
static CAPTION_RE: Lazy<Regex> = static CAPTION_RE: Lazy<Regex> =
@ -5541,6 +5541,9 @@ impl TscRequest {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use pretty_assertions::assert_eq;
use test_util::TempDir;
use super::*; use super::*;
use crate::cache::HttpCache; use crate::cache::HttpCache;
use crate::lsp::cache::LspCache; use crate::lsp::cache::LspCache;
@ -5550,8 +5553,6 @@ mod tests {
use crate::lsp::documents::LanguageId; use crate::lsp::documents::LanguageId;
use crate::lsp::resolver::LspResolver; use crate::lsp::resolver::LspResolver;
use crate::lsp::text::LineIndex; use crate::lsp::text::LineIndex;
use pretty_assertions::assert_eq;
use test_util::TempDir;
async fn setup( async fn setup(
ts_config: Value, ts_config: Value,

View file

@ -1,5 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::collections::HashMap;
use std::str::FromStr;
use std::sync::Arc;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex; use deno_core::parking_lot::Mutex;
@ -8,9 +12,6 @@ use deno_core::url::Url;
use deno_core::ModuleSpecifier; use deno_core::ModuleSpecifier;
use lsp_types::Uri; use lsp_types::Uri;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::str::FromStr;
use std::sync::Arc;
use super::cache::LspCache; use super::cache::LspCache;
use super::logging::lsp_warn; use super::logging::lsp_warn;
@ -307,9 +308,10 @@ fn file_like_to_file_specifier(specifier: &Url) -> Option<Url> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use deno_core::resolve_url; use deno_core::resolve_url;
use super::*;
#[test] #[test]
fn test_hash_data_specifier() { fn test_hash_data_specifier() {
let fixture = resolve_url("data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=").unwrap(); let fixture = resolve_url("data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=").unwrap();

View file

@ -28,31 +28,6 @@ mod util;
mod version; mod version;
mod worker; mod worker;
use crate::args::flags_from_vec;
use crate::args::DenoSubcommand;
use crate::args::Flags;
use crate::util::display;
use crate::util::v8::get_v8_flags_from_env;
use crate::util::v8::init_v8_flags;
use args::TaskFlags;
use deno_resolver::npm::ByonmResolvePkgFolderFromDenoReqError;
use deno_resolver::npm::ResolvePkgFolderFromDenoReqError;
use deno_runtime::WorkerExecutionMode;
pub use deno_runtime::UNSTABLE_GRANULAR_FLAGS;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::error::JsError;
use deno_core::futures::FutureExt;
use deno_core::unsync::JoinHandle;
use deno_npm::resolution::SnapshotFromLockfileError;
use deno_runtime::fmt_errors::format_js_error;
use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics;
use deno_terminal::colors;
use factory::CliFactory;
use standalone::MODULE_NOT_FOUND;
use standalone::UNSUPPORTED_SCHEME;
use std::env; use std::env;
use std::future::Future; use std::future::Future;
use std::io::IsTerminal; use std::io::IsTerminal;
@ -60,6 +35,31 @@ use std::ops::Deref;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use args::TaskFlags;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::error::JsError;
use deno_core::futures::FutureExt;
use deno_core::unsync::JoinHandle;
use deno_npm::resolution::SnapshotFromLockfileError;
use deno_resolver::npm::ByonmResolvePkgFolderFromDenoReqError;
use deno_resolver::npm::ResolvePkgFolderFromDenoReqError;
use deno_runtime::fmt_errors::format_js_error;
use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics;
use deno_runtime::WorkerExecutionMode;
pub use deno_runtime::UNSTABLE_GRANULAR_FLAGS;
use deno_terminal::colors;
use factory::CliFactory;
use standalone::MODULE_NOT_FOUND;
use standalone::UNSUPPORTED_SCHEME;
use crate::args::flags_from_vec;
use crate::args::DenoSubcommand;
use crate::args::Flags;
use crate::util::display;
use crate::util::v8::get_v8_flags_from_env;
use crate::util::v8::init_v8_flags;
#[cfg(feature = "dhat-heap")] #[cfg(feature = "dhat-heap")]
#[global_allocator] #[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc; static ALLOC: dhat::Alloc = dhat::Alloc;

View file

@ -24,6 +24,12 @@ mod util;
mod version; mod version;
mod worker; mod worker;
use std::borrow::Cow;
use std::collections::HashMap;
use std::env;
use std::env::current_exe;
use std::sync::Arc;
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::error::JsError; use deno_core::error::JsError;
@ -34,12 +40,6 @@ use deno_terminal::colors;
use indexmap::IndexMap; use indexmap::IndexMap;
use standalone::DenoCompileFileSystem; use standalone::DenoCompileFileSystem;
use std::borrow::Cow;
use std::collections::HashMap;
use std::env;
use std::env::current_exe;
use std::sync::Arc;
use crate::args::Flags; use crate::args::Flags;
pub(crate) fn unstable_exit_cb(feature: &str, api_name: &str) { pub(crate) fn unstable_exit_cb(feature: &str, api_name: &str) {

View file

@ -11,8 +11,6 @@ use std::sync::atomic::AtomicU16;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::Arc;
use crate::node::CliNodeResolver;
use crate::sys::CliSys;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_ast::ModuleKind; use deno_ast::ModuleKind;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
@ -66,6 +64,7 @@ use crate::graph_container::ModuleGraphUpdatePermit;
use crate::graph_util::CreateGraphOptions; use crate::graph_util::CreateGraphOptions;
use crate::graph_util::ModuleGraphBuilder; use crate::graph_util::ModuleGraphBuilder;
use crate::node::CliNodeCodeTranslator; use crate::node::CliNodeCodeTranslator;
use crate::node::CliNodeResolver;
use crate::npm::CliNpmResolver; use crate::npm::CliNpmResolver;
use crate::resolver::CjsTracker; use crate::resolver::CjsTracker;
use crate::resolver::CliNpmReqResolver; use crate::resolver::CliNpmReqResolver;
@ -73,6 +72,7 @@ use crate::resolver::CliResolver;
use crate::resolver::ModuleCodeStringSource; use crate::resolver::ModuleCodeStringSource;
use crate::resolver::NotSupportedKindInNpmError; use crate::resolver::NotSupportedKindInNpmError;
use crate::resolver::NpmModuleLoader; use crate::resolver::NpmModuleLoader;
use crate::sys::CliSys;
use crate::tools::check; use crate::tools::check;
use crate::tools::check::TypeChecker; use crate::tools::check::TypeChecker;
use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBar;
@ -1161,9 +1161,10 @@ impl<TGraphContainer: ModuleGraphContainer> NodeRequireLoader
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use deno_graph::ParsedSourceStore; use deno_graph::ParsedSourceStore;
use super::*;
#[tokio::test] #[tokio::test]
async fn test_inflight_module_loads_tracker() { async fn test_inflight_module_loads_tracker() {
let tracker = InFlightModuleLoadsTracker { let tracker = InFlightModuleLoadsTracker {

View file

@ -4,7 +4,6 @@ use std::borrow::Cow;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use crate::sys::CliSys;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::serde_json; use deno_core::serde_json;
use deno_resolver::npm::ByonmNpmResolver; use deno_resolver::npm::ByonmNpmResolver;
@ -14,11 +13,11 @@ use deno_runtime::deno_node::NodePermissions;
use deno_runtime::ops::process::NpmProcessStateProvider; use deno_runtime::ops::process::NpmProcessStateProvider;
use node_resolver::NpmPackageFolderResolver; use node_resolver::NpmPackageFolderResolver;
use crate::args::NpmProcessState;
use crate::args::NpmProcessStateKind;
use super::CliNpmResolver; use super::CliNpmResolver;
use super::InnerCliNpmResolverRef; use super::InnerCliNpmResolverRef;
use crate::args::NpmProcessState;
use crate::args::NpmProcessStateKind;
use crate::sys::CliSys;
pub type CliByonmNpmResolverCreateOptions = pub type CliByonmNpmResolverCreateOptions =
ByonmNpmResolverCreateOptions<CliSys>; ByonmNpmResolverCreateOptions<CliSys>;

View file

@ -5,7 +5,6 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use crate::sys::CliSys;
use deno_ast::ModuleSpecifier; use deno_ast::ModuleSpecifier;
use deno_cache_dir::npm::NpmCacheDir; use deno_cache_dir::npm::NpmCacheDir;
use deno_core::anyhow::Context; use deno_core::anyhow::Context;
@ -35,20 +34,9 @@ use node_resolver::InNpmPackageChecker;
use node_resolver::NpmPackageFolderResolver; use node_resolver::NpmPackageFolderResolver;
use resolution::AddPkgReqsResult; use resolution::AddPkgReqsResult;
use crate::args::CliLockfile;
use crate::args::LifecycleScriptsConfig;
use crate::args::NpmInstallDepsProvider;
use crate::args::NpmProcessState;
use crate::args::NpmProcessStateKind;
use crate::args::PackageJsonDepValueParseWithLocationError;
use crate::cache::FastInsecureHasher;
use crate::util::progress_bar::ProgressBar;
use crate::util::sync::AtomicFlag;
use self::resolution::NpmResolution; use self::resolution::NpmResolution;
use self::resolvers::create_npm_fs_resolver; use self::resolvers::create_npm_fs_resolver;
use self::resolvers::NpmPackageFsResolver; use self::resolvers::NpmPackageFsResolver;
use super::CliNpmCache; use super::CliNpmCache;
use super::CliNpmCacheHttpClient; use super::CliNpmCacheHttpClient;
use super::CliNpmRegistryInfoProvider; use super::CliNpmRegistryInfoProvider;
@ -56,6 +44,16 @@ use super::CliNpmResolver;
use super::CliNpmTarballCache; use super::CliNpmTarballCache;
use super::InnerCliNpmResolverRef; use super::InnerCliNpmResolverRef;
use super::ResolvePkgFolderFromDenoReqError; use super::ResolvePkgFolderFromDenoReqError;
use crate::args::CliLockfile;
use crate::args::LifecycleScriptsConfig;
use crate::args::NpmInstallDepsProvider;
use crate::args::NpmProcessState;
use crate::args::NpmProcessStateKind;
use crate::args::PackageJsonDepValueParseWithLocationError;
use crate::cache::FastInsecureHasher;
use crate::sys::CliSys;
use crate::util::progress_bar::ProgressBar;
use crate::util::sync::AtomicFlag;
mod resolution; mod resolution;
mod resolvers; mod resolvers;

View file

@ -1,16 +1,18 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::npm::managed::NpmResolutionPackage;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_npm::resolution::NpmResolutionSnapshot;
use deno_npm::NpmPackageId;
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::HashSet; use std::collections::HashSet;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_npm::resolution::NpmResolutionSnapshot;
use deno_npm::NpmPackageId;
use crate::npm::managed::NpmResolutionPackage;
#[derive(Default)] #[derive(Default)]
pub struct BinEntries<'a> { pub struct BinEntries<'a> {
/// Packages that have colliding bin names /// Packages that have colliding bin names

View file

@ -1,24 +1,24 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::borrow::Cow;
use std::collections::HashSet;
use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_npm::resolution::NpmResolutionSnapshot;
use deno_npm::NpmResolutionPackage;
use deno_runtime::deno_io::FromRawIoHandle;
use deno_semver::package::PackageNv;
use deno_semver::Version;
use deno_task_shell::KillSignal;
use super::bin_entries::BinEntries; use super::bin_entries::BinEntries;
use crate::args::LifecycleScriptsConfig; use crate::args::LifecycleScriptsConfig;
use crate::task_runner::TaskStdio; use crate::task_runner::TaskStdio;
use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBar;
use deno_core::anyhow::Context;
use deno_npm::resolution::NpmResolutionSnapshot;
use deno_runtime::deno_io::FromRawIoHandle;
use deno_semver::package::PackageNv;
use deno_semver::Version;
use deno_task_shell::KillSignal;
use std::borrow::Cow;
use std::collections::HashSet;
use std::rc::Rc;
use std::path::Path;
use std::path::PathBuf;
use deno_core::error::AnyError;
use deno_npm::NpmResolutionPackage;
pub trait LifecycleScriptsStrategy { pub trait LifecycleScriptsStrategy {
fn can_run_scripts(&self) -> bool { fn can_run_scripts(&self) -> bool {

View file

@ -7,11 +7,6 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use crate::colors;
use crate::npm::managed::PackageCaching;
use crate::npm::CliNpmCache;
use crate::npm::CliNpmTarballCache;
use crate::sys::CliSys;
use async_trait::async_trait; use async_trait::async_trait;
use deno_ast::ModuleSpecifier; use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError; use deno_core::error::AnyError;
@ -24,14 +19,18 @@ use node_resolver::errors::PackageFolderResolveError;
use node_resolver::errors::PackageNotFoundError; use node_resolver::errors::PackageNotFoundError;
use node_resolver::errors::ReferrerNotFoundError; use node_resolver::errors::ReferrerNotFoundError;
use crate::args::LifecycleScriptsConfig;
use crate::cache::FastInsecureHasher;
use super::super::resolution::NpmResolution; use super::super::resolution::NpmResolution;
use super::common::cache_packages; use super::common::cache_packages;
use super::common::lifecycle_scripts::LifecycleScriptsStrategy; use super::common::lifecycle_scripts::LifecycleScriptsStrategy;
use super::common::NpmPackageFsResolver; use super::common::NpmPackageFsResolver;
use super::common::RegistryReadPermissionChecker; use super::common::RegistryReadPermissionChecker;
use crate::args::LifecycleScriptsConfig;
use crate::cache::FastInsecureHasher;
use crate::colors;
use crate::npm::managed::PackageCaching;
use crate::npm::CliNpmCache;
use crate::npm::CliNpmTarballCache;
use crate::sys::CliSys;
/// Resolves packages from the global npm cache. /// Resolves packages from the global npm cache.
#[derive(Debug)] #[derive(Debug)]

View file

@ -43,6 +43,10 @@ use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use sys_traits::FsMetadata; use sys_traits::FsMetadata;
use super::super::resolution::NpmResolution;
use super::common::bin_entries;
use super::common::NpmPackageFsResolver;
use super::common::RegistryReadPermissionChecker;
use crate::args::LifecycleScriptsConfig; use crate::args::LifecycleScriptsConfig;
use crate::args::NpmInstallDepsProvider; use crate::args::NpmInstallDepsProvider;
use crate::cache::CACHE_PERM; use crate::cache::CACHE_PERM;
@ -57,11 +61,6 @@ use crate::util::fs::LaxSingleProcessFsFlag;
use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBar;
use crate::util::progress_bar::ProgressMessagePrompt; use crate::util::progress_bar::ProgressMessagePrompt;
use super::super::resolution::NpmResolution;
use super::common::bin_entries;
use super::common::NpmPackageFsResolver;
use super::common::RegistryReadPermissionChecker;
/// Resolver that creates a local node_modules directory /// Resolver that creates a local node_modules directory
/// and resolves packages from it. /// and resolves packages from it.
#[derive(Debug)] #[derive(Debug)]

View file

@ -7,22 +7,19 @@ mod local;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use crate::sys::CliSys;
use deno_npm::NpmSystemInfo; use deno_npm::NpmSystemInfo;
pub use self::common::NpmPackageFsResolver;
use self::global::GlobalNpmPackageResolver;
use self::local::LocalNpmPackageResolver;
use super::resolution::NpmResolution;
use crate::args::LifecycleScriptsConfig; use crate::args::LifecycleScriptsConfig;
use crate::args::NpmInstallDepsProvider; use crate::args::NpmInstallDepsProvider;
use crate::npm::CliNpmCache; use crate::npm::CliNpmCache;
use crate::npm::CliNpmTarballCache; use crate::npm::CliNpmTarballCache;
use crate::sys::CliSys;
use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBar;
pub use self::common::NpmPackageFsResolver;
use self::global::GlobalNpmPackageResolver;
use self::local::LocalNpmPackageResolver;
use super::resolution::NpmResolution;
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn create_npm_fs_resolver( pub fn create_npm_fs_resolver(
npm_cache: Arc<CliNpmCache>, npm_cache: Arc<CliNpmCache>,

View file

@ -7,7 +7,6 @@ use std::borrow::Cow;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use crate::sys::CliSys;
use dashmap::DashMap; use dashmap::DashMap;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::serde_json; use deno_core::serde_json;
@ -28,10 +27,6 @@ use managed::create_managed_in_npm_pkg_checker;
use node_resolver::InNpmPackageChecker; use node_resolver::InNpmPackageChecker;
use node_resolver::NpmPackageFolderResolver; use node_resolver::NpmPackageFolderResolver;
use crate::file_fetcher::CliFileFetcher;
use crate::http_util::HttpClientProvider;
use crate::util::progress_bar::ProgressBar;
pub use self::byonm::CliByonmNpmResolver; pub use self::byonm::CliByonmNpmResolver;
pub use self::byonm::CliByonmNpmResolverCreateOptions; pub use self::byonm::CliByonmNpmResolverCreateOptions;
pub use self::managed::CliManagedInNpmPkgCheckerCreateOptions; pub use self::managed::CliManagedInNpmPkgCheckerCreateOptions;
@ -39,6 +34,10 @@ pub use self::managed::CliManagedNpmResolverCreateOptions;
pub use self::managed::CliNpmResolverManagedSnapshotOption; pub use self::managed::CliNpmResolverManagedSnapshotOption;
pub use self::managed::ManagedCliNpmResolver; pub use self::managed::ManagedCliNpmResolver;
pub use self::managed::PackageCaching; pub use self::managed::PackageCaching;
use crate::file_fetcher::CliFileFetcher;
use crate::http_util::HttpClientProvider;
use crate::sys::CliSys;
use crate::util::progress_bar::ProgressBar;
pub type CliNpmTarballCache = pub type CliNpmTarballCache =
deno_npm_cache::TarballCache<CliNpmCacheHttpClient, CliSys>; deno_npm_cache::TarballCache<CliNpmCacheHttpClient, CliSys>;

View file

@ -8,17 +8,16 @@ use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use jupyter_runtime::InputRequest;
use jupyter_runtime::JupyterMessage;
use jupyter_runtime::JupyterMessageContent;
use jupyter_runtime::KernelIoPubConnection;
use jupyter_runtime::StreamContent;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::op2; use deno_core::op2;
use deno_core::parking_lot::Mutex; use deno_core::parking_lot::Mutex;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::OpState; use deno_core::OpState;
use jupyter_runtime::InputRequest;
use jupyter_runtime::JupyterMessage;
use jupyter_runtime::JupyterMessageContent;
use jupyter_runtime::KernelIoPubConnection;
use jupyter_runtime::StreamContent;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use crate::tools::jupyter::server::StdinConnectionProxy; use crate::tools::jupyter::server::StdinConnectionProxy;

View file

@ -1,13 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::tools::test::TestContainer; use std::sync::atomic::AtomicUsize;
use crate::tools::test::TestDescription; use std::sync::atomic::Ordering;
use crate::tools::test::TestEvent;
use crate::tools::test::TestEventSender;
use crate::tools::test::TestFailure;
use crate::tools::test::TestLocation;
use crate::tools::test::TestStepDescription;
use crate::tools::test::TestStepResult;
use deno_core::error::generic_error; use deno_core::error::generic_error;
use deno_core::error::type_error; use deno_core::error::type_error;
@ -18,10 +12,17 @@ use deno_core::ModuleSpecifier;
use deno_core::OpState; use deno_core::OpState;
use deno_runtime::deno_permissions::ChildPermissionsArg; use deno_runtime::deno_permissions::ChildPermissionsArg;
use deno_runtime::deno_permissions::PermissionsContainer; use deno_runtime::deno_permissions::PermissionsContainer;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
use uuid::Uuid; use uuid::Uuid;
use crate::tools::test::TestContainer;
use crate::tools::test::TestDescription;
use crate::tools::test::TestEvent;
use crate::tools::test::TestEventSender;
use crate::tools::test::TestFailure;
use crate::tools::test::TestLocation;
use crate::tools::test::TestStepDescription;
use crate::tools::test::TestStepResult;
deno_core::extension!(deno_test, deno_core::extension!(deno_test,
ops = [ ops = [
op_pledge_test_permissions, op_pledge_test_permissions,

View file

@ -5,7 +5,6 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use crate::sys::CliSys;
use async_trait::async_trait; use async_trait::async_trait;
use dashmap::DashMap; use dashmap::DashMap;
use dashmap::DashSet; use dashmap::DashSet;
@ -40,6 +39,7 @@ use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS;
use crate::node::CliNodeCodeTranslator; use crate::node::CliNodeCodeTranslator;
use crate::npm::CliNpmResolver; use crate::npm::CliNpmResolver;
use crate::npm::InnerCliNpmResolverRef; use crate::npm::InnerCliNpmResolverRef;
use crate::sys::CliSys;
use crate::util::sync::AtomicFlag; use crate::util::sync::AtomicFlag;
use crate::util::text_encoding::from_utf8_lossy_cow; use crate::util::text_encoding::from_utf8_lossy_cow;

View file

@ -61,6 +61,23 @@ use log::Level;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::file_system::DenoCompileFileSystem;
use super::serialization::deserialize_binary_data_section;
use super::serialization::serialize_binary_data_section;
use super::serialization::DenoCompileModuleData;
use super::serialization::DeserializedDataSection;
use super::serialization::RemoteModulesStore;
use super::serialization::RemoteModulesStoreBuilder;
use super::serialization::SourceMapStore;
use super::virtual_fs::output_vfs;
use super::virtual_fs::BuiltVfs;
use super::virtual_fs::FileBackedVfs;
use super::virtual_fs::VfsBuilder;
use super::virtual_fs::VfsFileSubDataKind;
use super::virtual_fs::VfsRoot;
use super::virtual_fs::VirtualDirectory;
use super::virtual_fs::VirtualDirectoryEntries;
use super::virtual_fs::WindowsSystemRootablePath;
use crate::args::CaData; use crate::args::CaData;
use crate::args::CliOptions; use crate::args::CliOptions;
use crate::args::CompileFlags; use crate::args::CompileFlags;
@ -83,24 +100,6 @@ use crate::util::fs::canonicalize_path_maybe_not_exists;
use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBar;
use crate::util::progress_bar::ProgressBarStyle; use crate::util::progress_bar::ProgressBarStyle;
use super::file_system::DenoCompileFileSystem;
use super::serialization::deserialize_binary_data_section;
use super::serialization::serialize_binary_data_section;
use super::serialization::DenoCompileModuleData;
use super::serialization::DeserializedDataSection;
use super::serialization::RemoteModulesStore;
use super::serialization::RemoteModulesStoreBuilder;
use super::serialization::SourceMapStore;
use super::virtual_fs::output_vfs;
use super::virtual_fs::BuiltVfs;
use super::virtual_fs::FileBackedVfs;
use super::virtual_fs::VfsBuilder;
use super::virtual_fs::VfsFileSubDataKind;
use super::virtual_fs::VfsRoot;
use super::virtual_fs::VirtualDirectory;
use super::virtual_fs::VirtualDirectoryEntries;
use super::virtual_fs::WindowsSystemRootablePath;
pub static DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME: &str = pub static DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME: &str =
".deno_compile_node_modules"; ".deno_compile_node_modules";

View file

@ -395,10 +395,11 @@ fn deserialize_with_reader<T: Read>(
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::fs::File;
use test_util::TempDir; use test_util::TempDir;
use super::*; use super::*;
use std::fs::File;
#[test] #[test]
fn serialize_deserialize() { fn serialize_deserialize() {

View file

@ -5,6 +5,10 @@
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_imports)] #![allow(unused_imports)]
use std::borrow::Cow;
use std::rc::Rc;
use std::sync::Arc;
use binary::StandaloneData; use binary::StandaloneData;
use binary::StandaloneModules; use binary::StandaloneModules;
use code_cache::DenoCompileCodeCache; use code_cache::DenoCompileCodeCache;
@ -57,9 +61,6 @@ use node_resolver::NodeResolutionKind;
use node_resolver::ResolutionMode; use node_resolver::ResolutionMode;
use serialization::DenoCompileModuleSource; use serialization::DenoCompileModuleSource;
use serialization::SourceMapStore; use serialization::SourceMapStore;
use std::borrow::Cow;
use std::rc::Rc;
use std::sync::Arc;
use virtual_fs::FileBackedVfs; use virtual_fs::FileBackedVfs;
use virtual_fs::VfsFileSubDataKind; use virtual_fs::VfsFileSubDataKind;
@ -107,12 +108,12 @@ mod file_system;
mod serialization; mod serialization;
mod virtual_fs; mod virtual_fs;
pub use self::file_system::DenoCompileFileSystem;
pub use binary::extract_standalone; pub use binary::extract_standalone;
pub use binary::is_standalone_binary; pub use binary::is_standalone_binary;
pub use binary::DenoCompileBinaryWriter; pub use binary::DenoCompileBinaryWriter;
use self::binary::Metadata; use self::binary::Metadata;
pub use self::file_system::DenoCompileFileSystem;
struct SharedModuleLoaderState { struct SharedModuleLoaderState {
cjs_tracker: Arc<CjsTracker>, cjs_tracker: Arc<CjsTracker>,

View file

@ -25,12 +25,11 @@ use deno_semver::package::PackageReq;
use deno_semver::StackString; use deno_semver::StackString;
use indexmap::IndexMap; use indexmap::IndexMap;
use crate::standalone::virtual_fs::VirtualDirectory;
use super::binary::Metadata; use super::binary::Metadata;
use super::virtual_fs::BuiltVfs; use super::virtual_fs::BuiltVfs;
use super::virtual_fs::VfsBuilder; use super::virtual_fs::VfsBuilder;
use super::virtual_fs::VirtualDirectoryEntries; use super::virtual_fs::VirtualDirectoryEntries;
use crate::standalone::virtual_fs::VirtualDirectory;
const MAGIC_BYTES: &[u8; 8] = b"d3n0l4nd"; const MAGIC_BYTES: &[u8; 8] = b"d3n0l4nd";

View file

@ -34,13 +34,12 @@ use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use thiserror::Error; use thiserror::Error;
use super::binary::DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME;
use crate::util; use crate::util;
use crate::util::display::human_size; use crate::util::display::human_size;
use crate::util::display::DisplayTreeNode; use crate::util::display::DisplayTreeNode;
use crate::util::fs::canonicalize_path; use crate::util::fs::canonicalize_path;
use super::binary::DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME;
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub enum WindowsSystemRootablePath { pub enum WindowsSystemRootablePath {
/// The root of the system above any drive letters. /// The root of the system above any drive letters.
@ -1563,9 +1562,10 @@ impl FileBackedVfs {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::io::Write;
use console_static_text::ansi::strip_ansi_codes; use console_static_text::ansi::strip_ansi_codes;
use deno_io::fs::File; use deno_io::fs::File;
use std::io::Write;
use test_util::assert_contains; use test_util::assert_contains;
use test_util::TempDir; use test_util::TempDir;

View file

@ -1,20 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::BenchFlags; use std::collections::HashSet;
use crate::args::Flags; use std::path::Path;
use crate::colors; use std::sync::Arc;
use crate::display::write_json_to_stdout; use std::time::Duration;
use crate::factory::CliFactory;
use crate::graph_util::has_graph_root_local_dependent_changed;
use crate::ops;
use crate::sys::CliSys;
use crate::tools::test::format_test_error;
use crate::tools::test::TestFilter;
use crate::util::file_watcher;
use crate::util::fs::collect_specifiers;
use crate::util::path::is_script_ext;
use crate::util::path::matches_pattern_or_exact_path;
use crate::worker::CliMainWorkerFactory;
use deno_config::glob::WalkEntry; use deno_config::glob::WalkEntry;
use deno_core::error::generic_error; use deno_core::error::generic_error;
@ -39,13 +28,25 @@ use indexmap::IndexSet;
use log::Level; use log::Level;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use std::collections::HashSet;
use std::path::Path;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::unbounded_channel;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
use crate::args::BenchFlags;
use crate::args::Flags;
use crate::colors;
use crate::display::write_json_to_stdout;
use crate::factory::CliFactory;
use crate::graph_util::has_graph_root_local_dependent_changed;
use crate::ops;
use crate::sys::CliSys;
use crate::tools::test::format_test_error;
use crate::tools::test::TestFilter;
use crate::util::file_watcher;
use crate::util::fs::collect_specifiers;
use crate::util::path::is_script_ext;
use crate::util::path::matches_pattern_or_exact_path;
use crate::worker::CliMainWorkerFactory;
mod mitata; mod mitata;
mod reporters; mod reporters;

View file

@ -2,11 +2,10 @@
use serde::Serialize; use serde::Serialize;
use super::*;
use crate::tools::test::TestFailureFormatOptions; use crate::tools::test::TestFailureFormatOptions;
use crate::version; use crate::version;
use super::*;
pub trait BenchReporter { pub trait BenchReporter {
fn report_group_summary(&mut self); fn report_group_summary(&mut self);
fn report_plan(&mut self, plan: &BenchPlan); fn report_plan(&mut self, plan: &BenchPlan);

View file

@ -1,8 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::path::Path;
use deno_core::anyhow::Context; use deno_core::anyhow::Context;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use std::path::Path;
use crate::cache::DenoDir; use crate::cache::DenoDir;
use crate::colors; use crate::colors;

View file

@ -1,12 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::check_warn_tsconfig; use std::collections::HashSet;
use crate::args::CompileFlags; use std::collections::VecDeque;
use crate::args::Flags; use std::path::Path;
use crate::factory::CliFactory; use std::path::PathBuf;
use crate::http_util::HttpClientProvider; use std::sync::Arc;
use crate::standalone::binary::is_standalone_binary;
use crate::standalone::binary::WriteBinOptions;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_ast::ModuleSpecifier; use deno_ast::ModuleSpecifier;
use deno_core::anyhow::bail; use deno_core::anyhow::bail;
@ -19,13 +18,15 @@ use deno_path_util::url_from_file_path;
use deno_path_util::url_to_file_path; use deno_path_util::url_to_file_path;
use deno_terminal::colors; use deno_terminal::colors;
use rand::Rng; use rand::Rng;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use super::installer::infer_name_from_url; use super::installer::infer_name_from_url;
use crate::args::check_warn_tsconfig;
use crate::args::CompileFlags;
use crate::args::Flags;
use crate::factory::CliFactory;
use crate::http_util::HttpClientProvider;
use crate::standalone::binary::is_standalone_binary;
use crate::standalone::binary::WriteBinOptions;
pub async fn compile( pub async fn compile(
flags: Arc<Flags>, flags: Arc<Flags>,

View file

@ -3,14 +3,15 @@
// Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust // Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust
// Copyright 2021 Charles Samborski. All rights reserved. MIT license. // Copyright 2021 Charles Samborski. All rights reserved. MIT license.
use super::range_tree::RangeTree;
use super::range_tree::RangeTreeArena;
use crate::cdp;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::collections::HashMap; use std::collections::HashMap;
use std::iter::Peekable; use std::iter::Peekable;
use super::range_tree::RangeTree;
use super::range_tree::RangeTreeArena;
use crate::cdp;
#[derive(Eq, PartialEq, Clone, Debug)] #[derive(Eq, PartialEq, Clone, Debug)]
pub struct ProcessCoverage { pub struct ProcessCoverage {
pub result: Vec<cdp::ScriptCoverage>, pub result: Vec<cdp::ScriptCoverage>,

View file

@ -1,16 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::CliOptions; use std::fs;
use crate::args::CoverageFlags; use std::fs::File;
use crate::args::FileFlags; use std::io::BufWriter;
use crate::args::Flags; use std::io::Write;
use crate::cdp; use std::path::Path;
use crate::factory::CliFactory; use std::path::PathBuf;
use crate::file_fetcher::TextDecodedFile; use std::sync::Arc;
use crate::sys::CliSys;
use crate::tools::fmt::format_json;
use crate::tools::test::is_supported_test_path;
use crate::util::text_encoding::source_map_from_code;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_ast::ModuleKind; use deno_ast::ModuleKind;
@ -29,16 +25,21 @@ use deno_core::url::Url;
use deno_core::LocalInspectorSession; use deno_core::LocalInspectorSession;
use node_resolver::InNpmPackageChecker; use node_resolver::InNpmPackageChecker;
use regex::Regex; use regex::Regex;
use std::fs;
use std::fs::File;
use std::io::BufWriter;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use text_lines::TextLines; use text_lines::TextLines;
use uuid::Uuid; use uuid::Uuid;
use crate::args::CliOptions;
use crate::args::CoverageFlags;
use crate::args::FileFlags;
use crate::args::Flags;
use crate::cdp;
use crate::factory::CliFactory;
use crate::file_fetcher::TextDecodedFile;
use crate::sys::CliSys;
use crate::tools::fmt::format_json;
use crate::tools::test::is_supported_test_path;
use crate::util::text_encoding::source_map_from_code;
mod merge; mod merge;
mod range_tree; mod range_tree;
mod reporter; mod reporter;

View file

@ -3,10 +3,12 @@
// Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust // Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust
// Copyright 2021 Charles Samborski. All rights reserved. MIT license. // Copyright 2021 Charles Samborski. All rights reserved. MIT license.
use crate::cdp;
use std::iter::Peekable; use std::iter::Peekable;
use typed_arena::Arena; use typed_arena::Arena;
use crate::cdp;
pub struct RangeTreeArena<'a>(Arena<RangeTree<'a>>); pub struct RangeTreeArena<'a>(Arena<RangeTree<'a>>);
impl<'a> RangeTreeArena<'a> { impl<'a> RangeTreeArena<'a> {

View file

@ -1,11 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use super::util;
use super::CoverageReport;
use crate::args::CoverageType;
use crate::colors;
use deno_core::error::AnyError;
use deno_core::url::Url;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs; use std::fs;
use std::fs::File; use std::fs::File;
@ -15,6 +9,14 @@ use std::io::{self};
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use deno_core::error::AnyError;
use deno_core::url::Url;
use super::util;
use super::CoverageReport;
use crate::args::CoverageType;
use crate::colors;
#[derive(Default)] #[derive(Default)]
pub struct CoverageStats<'a> { pub struct CoverageStats<'a> {
pub line_hit: usize, pub line_hit: usize,

View file

@ -1,18 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::DocFlags; use std::collections::BTreeMap;
use crate::args::DocHtmlFlag; use std::rc::Rc;
use crate::args::DocSourceFileFlag; use std::sync::Arc;
use crate::args::Flags;
use crate::colors;
use crate::display;
use crate::factory::CliFactory;
use crate::graph_util::graph_exit_integrity_errors;
use crate::graph_util::graph_walk_errors;
use crate::graph_util::GraphWalkErrorsOptions;
use crate::sys::CliSys;
use crate::tsc::get_types_declaration_file_text;
use crate::util::fs::collect_specifiers;
use deno_ast::diagnostics::Diagnostic; use deno_ast::diagnostics::Diagnostic;
use deno_config::glob::FilePatterns; use deno_config::glob::FilePatterns;
use deno_config::glob::PathOrPatternSet; use deno_config::glob::PathOrPatternSet;
@ -32,9 +23,20 @@ use deno_graph::ModuleSpecifier;
use doc::html::ShortPath; use doc::html::ShortPath;
use doc::DocDiagnostic; use doc::DocDiagnostic;
use indexmap::IndexMap; use indexmap::IndexMap;
use std::collections::BTreeMap;
use std::rc::Rc; use crate::args::DocFlags;
use std::sync::Arc; use crate::args::DocHtmlFlag;
use crate::args::DocSourceFileFlag;
use crate::args::Flags;
use crate::colors;
use crate::display;
use crate::factory::CliFactory;
use crate::graph_util::graph_exit_integrity_errors;
use crate::graph_util::graph_walk_errors;
use crate::graph_util::GraphWalkErrorsOptions;
use crate::sys::CliSys;
use crate::tsc::get_types_declaration_file_text;
use crate::util::fs::collect_specifiers;
const JSON_SCHEMA_VERSION: u8 = 1; const JSON_SCHEMA_VERSION: u8 = 1;

View file

@ -7,21 +7,18 @@
//! the future it can be easily extended to provide //! the future it can be easily extended to provide
//! the same functions as ops available in JS runtime. //! the same functions as ops available in JS runtime.
use crate::args::CliOptions; use std::borrow::Cow;
use crate::args::Flags; use std::fs;
use crate::args::FmtFlags; use std::io::stdin;
use crate::args::FmtOptions; use std::io::stdout;
use crate::args::FmtOptionsConfig; use std::io::Read;
use crate::args::ProseWrap; use std::io::Write;
use crate::args::UnstableFmtOptions; use std::path::Path;
use crate::cache::Caches; use std::path::PathBuf;
use crate::colors; use std::sync::atomic::AtomicUsize;
use crate::factory::CliFactory; use std::sync::atomic::Ordering;
use crate::sys::CliSys; use std::sync::Arc;
use crate::util::diff::diff;
use crate::util::file_watcher;
use crate::util::fs::canonicalize_path;
use crate::util::path::get_extension;
use async_trait::async_trait; use async_trait::async_trait;
use deno_ast::ParsedSource; use deno_ast::ParsedSource;
use deno_config::glob::FileCollector; use deno_config::glob::FileCollector;
@ -38,19 +35,23 @@ use deno_core::url::Url;
use log::debug; use log::debug;
use log::info; use log::info;
use log::warn; use log::warn;
use std::borrow::Cow;
use std::fs;
use std::io::stdin;
use std::io::stdout;
use std::io::Read;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use crate::args::CliOptions;
use crate::args::Flags;
use crate::args::FmtFlags;
use crate::args::FmtOptions;
use crate::args::FmtOptionsConfig;
use crate::args::ProseWrap;
use crate::args::UnstableFmtOptions;
use crate::cache::Caches;
use crate::cache::IncrementalCache; use crate::cache::IncrementalCache;
use crate::colors;
use crate::factory::CliFactory;
use crate::sys::CliSys;
use crate::util::diff::diff;
use crate::util::file_watcher;
use crate::util::fs::canonicalize_path;
use crate::util::path::get_extension;
/// Format JavaScript/TypeScript files. /// Format JavaScript/TypeScript files.
pub async fn format( pub async fn format(

View file

@ -1,12 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::DenoSubcommand; use std::io::IsTerminal;
use crate::args::Flags; use std::io::Write;
use crate::args::InitFlags; use std::path::Path;
use crate::args::PackagesAllowedScripts;
use crate::args::PermissionFlags;
use crate::args::RunFlags;
use crate::colors;
use color_print::cformat; use color_print::cformat;
use color_print::cstr; use color_print::cstr;
use deno_config::deno_json::NodeModulesDirMode; use deno_config::deno_json::NodeModulesDirMode;
@ -15,9 +12,14 @@ use deno_core::error::AnyError;
use deno_core::serde_json::json; use deno_core::serde_json::json;
use deno_runtime::WorkerExecutionMode; use deno_runtime::WorkerExecutionMode;
use log::info; use log::info;
use std::io::IsTerminal;
use std::io::Write; use crate::args::DenoSubcommand;
use std::path::Path; use crate::args::Flags;
use crate::args::InitFlags;
use crate::args::PackagesAllowedScripts;
use crate::args::PermissionFlags;
use crate::args::RunFlags;
use crate::colors;
pub async fn init_project(init_flags: InitFlags) -> Result<i32, AnyError> { pub async fn init_project(init_flags: InitFlags) -> Result<i32, AnyError> {
if let Some(package) = &init_flags.package { if let Some(package) = &init_flags.package {

View file

@ -1,5 +1,29 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::env;
use std::fs;
use std::fs::File;
use std::io;
use std::io::Write;
#[cfg(not(windows))]
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use deno_cache_dir::file_fetcher::CacheSetting;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::resolve_url_or_path;
use deno_core::url::Url;
use deno_semver::npm::NpmPackageReqReference;
use log::Level;
use once_cell::sync::Lazy;
use regex::Regex;
use regex::RegexBuilder;
use crate::args::resolve_no_prompt; use crate::args::resolve_no_prompt;
use crate::args::AddFlags; use crate::args::AddFlags;
use crate::args::CaData; use crate::args::CaData;
@ -19,30 +43,6 @@ use crate::jsr::JsrFetchResolver;
use crate::npm::NpmFetchResolver; use crate::npm::NpmFetchResolver;
use crate::util::fs::canonicalize_path_maybe_not_exists; use crate::util::fs::canonicalize_path_maybe_not_exists;
use deno_cache_dir::file_fetcher::CacheSetting;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::resolve_url_or_path;
use deno_core::url::Url;
use deno_semver::npm::NpmPackageReqReference;
use log::Level;
use once_cell::sync::Lazy;
use regex::Regex;
use regex::RegexBuilder;
use std::env;
use std::fs;
use std::fs::File;
use std::io;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
#[cfg(not(windows))]
use std::os::unix::fs::PermissionsExt;
use std::sync::Arc;
static EXEC_NAME_RE: Lazy<Regex> = Lazy::new(|| { static EXEC_NAME_RE: Lazy<Regex> = Lazy::new(|| {
RegexBuilder::new(r"^[a-z0-9][\w-]*$") RegexBuilder::new(r"^[a-z0-9][\w-]*$")
.case_insensitive(true) .case_insensitive(true)
@ -659,16 +659,17 @@ fn is_in_path(dir: &Path) -> bool {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use std::process::Command;
use test_util::testdata_path;
use test_util::TempDir;
use super::*;
use crate::args::ConfigFlag; use crate::args::ConfigFlag;
use crate::args::PermissionFlags; use crate::args::PermissionFlags;
use crate::args::UninstallFlagsGlobal; use crate::args::UninstallFlagsGlobal;
use crate::args::UnstableConfig; use crate::args::UnstableConfig;
use crate::util::fs::canonicalize_path; use crate::util::fs::canonicalize_path;
use std::process::Command;
use test_util::testdata_path;
use test_util::TempDir;
#[tokio::test] #[tokio::test]
async fn install_infer_name_from_url() { async fn install_infer_name_from_url() {

View file

@ -1,12 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::json;
use std::env::current_exe; use std::env::current_exe;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::json;
use jupyter_runtime::dirs::user_data_dir; use jupyter_runtime::dirs::user_data_dir;
const DENO_ICON_32: &[u8] = include_bytes!("./resources/deno-logo-32x32.png"); const DENO_ICON_32: &[u8] = include_bytes!("./resources/deno-logo-32x32.png");

View file

@ -2,17 +2,6 @@
use std::sync::Arc; use std::sync::Arc;
use crate::args::Flags;
use crate::args::JupyterFlags;
use crate::cdp;
use crate::lsp::ReplCompletionItem;
use crate::ops;
use crate::tools::repl;
use crate::tools::test::create_single_test_event_channel;
use crate::tools::test::reporters::PrettyTestReporter;
use crate::tools::test::TestEventWorkerSender;
use crate::tools::test::TestFailureFormatOptions;
use crate::CliFactory;
use deno_core::anyhow::bail; use deno_core::anyhow::bail;
use deno_core::anyhow::Context; use deno_core::anyhow::Context;
use deno_core::error::generic_error; use deno_core::error::generic_error;
@ -34,6 +23,18 @@ use tokio::sync::mpsc;
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
use tokio::sync::oneshot; use tokio::sync::oneshot;
use crate::args::Flags;
use crate::args::JupyterFlags;
use crate::cdp;
use crate::lsp::ReplCompletionItem;
use crate::ops;
use crate::tools::repl;
use crate::tools::test::create_single_test_event_channel;
use crate::tools::test::reporters::PrettyTestReporter;
use crate::tools::test::TestEventWorkerSender;
use crate::tools::test::TestFailureFormatOptions;
use crate::CliFactory;
mod install; mod install;
pub mod server; pub mod server;

View file

@ -11,8 +11,6 @@ use std::collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use crate::cdp;
use crate::tools::repl;
use deno_core::anyhow::bail; use deno_core::anyhow::bail;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::futures; use deno_core::futures;
@ -20,12 +18,9 @@ use deno_core::parking_lot::Mutex;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::CancelFuture; use deno_core::CancelFuture;
use deno_core::CancelHandle; use deno_core::CancelHandle;
use jupyter_runtime::ExecutionCount;
use tokio::sync::mpsc;
use tokio::sync::oneshot;
use jupyter_runtime::messaging; use jupyter_runtime::messaging;
use jupyter_runtime::ConnectionInfo; use jupyter_runtime::ConnectionInfo;
use jupyter_runtime::ExecutionCount;
use jupyter_runtime::JupyterMessage; use jupyter_runtime::JupyterMessage;
use jupyter_runtime::JupyterMessageContent; use jupyter_runtime::JupyterMessageContent;
use jupyter_runtime::KernelControlConnection; use jupyter_runtime::KernelControlConnection;
@ -34,9 +29,13 @@ use jupyter_runtime::KernelShellConnection;
use jupyter_runtime::ReplyError; use jupyter_runtime::ReplyError;
use jupyter_runtime::ReplyStatus; use jupyter_runtime::ReplyStatus;
use jupyter_runtime::StreamContent; use jupyter_runtime::StreamContent;
use tokio::sync::mpsc;
use tokio::sync::oneshot;
use uuid::Uuid; use uuid::Uuid;
use super::JupyterReplProxy; use super::JupyterReplProxy;
use crate::cdp;
use crate::tools::repl;
pub struct JupyterServer { pub struct JupyterServer {
execution_count: ExecutionCount, execution_count: ExecutionCount,

View file

@ -17,12 +17,11 @@ use deno_lint::linter::Linter as DenoLintLinter;
use deno_lint::linter::LinterOptions; use deno_lint::linter::LinterOptions;
use deno_path_util::fs::atomic_write_file_with_retries; use deno_path_util::fs::atomic_write_file_with_retries;
use crate::sys::CliSys;
use crate::util::fs::specifier_from_file_path;
use super::rules::FileOrPackageLintRule; use super::rules::FileOrPackageLintRule;
use super::rules::PackageLintRule; use super::rules::PackageLintRule;
use super::ConfiguredRules; use super::ConfiguredRules;
use crate::sys::CliSys;
use crate::util::fs::specifier_from_file_path;
pub struct CliLinterOptions { pub struct CliLinterOptions {
pub configured_rules: ConfiguredRules, pub configured_rules: ConfiguredRules,

View file

@ -3,6 +3,14 @@
//! This module provides file linting utilities using //! This module provides file linting utilities using
//! [`deno_lint`](https://github.com/denoland/deno_lint). //! [`deno_lint`](https://github.com/denoland/deno_lint).
use std::collections::HashSet;
use std::fs;
use std::io::stdin;
use std::io::Read;
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
use deno_ast::ModuleSpecifier; use deno_ast::ModuleSpecifier;
use deno_ast::ParsedSource; use deno_ast::ParsedSource;
use deno_config::deno_json::LintRulesConfig; use deno_config::deno_json::LintRulesConfig;
@ -25,13 +33,6 @@ use log::debug;
use reporters::create_reporter; use reporters::create_reporter;
use reporters::LintReporter; use reporters::LintReporter;
use serde::Serialize; use serde::Serialize;
use std::collections::HashSet;
use std::fs;
use std::io::stdin;
use std::io::Read;
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
use crate::args::CliOptions; use crate::args::CliOptions;
use crate::args::Flags; use crate::args::Flags;
@ -596,11 +597,12 @@ struct LintError {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use serde::Deserialize; use serde::Deserialize;
use test_util as util; use test_util as util;
use super::*;
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct RulesSchema { struct RulesSchema {
#[serde(rename = "$schema")] #[serde(rename = "$schema")]

View file

@ -8,9 +8,8 @@ use deno_runtime::colors;
use log::info; use log::info;
use serde::Serialize; use serde::Serialize;
use crate::args::LintReporterKind;
use super::LintError; use super::LintError;
use crate::args::LintReporterKind;
const JSON_SCHEMA_VERSION: u8 = 1; const JSON_SCHEMA_VERSION: u8 = 1;

View file

@ -20,11 +20,10 @@ use deno_resolver::sloppy_imports::SloppyImportsResolution;
use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; use deno_resolver::sloppy_imports::SloppyImportsResolutionKind;
use text_lines::LineAndColumnIndex; use text_lines::LineAndColumnIndex;
use super::ExtendedLintRule;
use crate::graph_util::CliJsrUrlProvider; use crate::graph_util::CliJsrUrlProvider;
use crate::resolver::CliSloppyImportsResolver; use crate::resolver::CliSloppyImportsResolver;
use super::ExtendedLintRule;
#[derive(Debug)] #[derive(Debug)]
pub struct NoSloppyImportsRule { pub struct NoSloppyImportsRule {
sloppy_imports_resolver: Option<Arc<CliSloppyImportsResolver>>, sloppy_imports_resolver: Option<Arc<CliSloppyImportsResolver>>,

View file

@ -1,12 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::http_util;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::url::Url; use deno_core::url::Url;
use deno_runtime::deno_fetch; use deno_runtime::deno_fetch;
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use crate::http_util;
use crate::http_util::HttpClient; use crate::http_util::HttpClient;
#[derive(serde::Deserialize)] #[derive(serde::Deserialize)]

View file

@ -16,10 +16,9 @@ use deno_graph::WalkOptions;
use deno_semver::jsr::JsrPackageReqReference; use deno_semver::jsr::JsrPackageReqReference;
use deno_semver::npm::NpmPackageReqReference; use deno_semver::npm::NpmPackageReqReference;
use crate::cache::ParsedSourceCache;
use super::diagnostics::PublishDiagnostic; use super::diagnostics::PublishDiagnostic;
use super::diagnostics::PublishDiagnosticsCollector; use super::diagnostics::PublishDiagnosticsCollector;
use crate::cache::ParsedSourceCache;
pub struct GraphDiagnosticsCollector { pub struct GraphDiagnosticsCollector {
parsed_source_cache: Arc<ParsedSourceCache>, parsed_source_cache: Arc<ParsedSourceCache>,

View file

@ -73,11 +73,10 @@ pub use pm::AddRmPackageReq;
use publish_order::PublishOrderGraph; use publish_order::PublishOrderGraph;
use unfurl::SpecifierUnfurler; use unfurl::SpecifierUnfurler;
use super::check::TypeChecker;
use self::graph::GraphDiagnosticsCollector; use self::graph::GraphDiagnosticsCollector;
use self::paths::CollectedPublishPath; use self::paths::CollectedPublishPath;
use self::tar::PublishableTarball; use self::tar::PublishableTarball;
use super::check::TypeChecker;
pub async fn publish( pub async fn publish(
flags: Arc<Flags>, flags: Arc<Flags>,
@ -1281,14 +1280,14 @@ fn ring_bell() {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use deno_ast::ModuleSpecifier; use std::collections::HashMap;
use crate::tools::registry::has_license_file; use deno_ast::ModuleSpecifier;
use super::tar::PublishableTarball; use super::tar::PublishableTarball;
use super::tar::PublishableTarballFile; use super::tar::PublishableTarballFile;
use super::verify_version_manifest; use super::verify_version_manifest;
use std::collections::HashMap; use crate::tools::registry::has_license_file;
#[test] #[test]
fn test_verify_version_manifest() { fn test_verify_version_manifest() {

View file

@ -6,7 +6,6 @@ use std::collections::HashSet;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use crate::sys::CliSys;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_ast::ModuleSpecifier; use deno_ast::ModuleSpecifier;
use deno_config::glob::FileCollector; use deno_config::glob::FileCollector;
@ -14,10 +13,10 @@ use deno_config::glob::FilePatterns;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use thiserror::Error; use thiserror::Error;
use crate::args::CliOptions;
use super::diagnostics::PublishDiagnostic; use super::diagnostics::PublishDiagnostic;
use super::diagnostics::PublishDiagnosticsCollector; use super::diagnostics::PublishDiagnosticsCollector;
use crate::args::CliOptions;
use crate::sys::CliSys;
/// A package path, like '/foo' or '/foo/bar'. The path is prefixed with a slash /// A package path, like '/foo' or '/foo/bar'. The path is prefixed with a slash
/// and does not end with a slash. /// and does not end with a slash.

View file

@ -3,15 +3,16 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::sync::Arc; use std::sync::Arc;
use crate::factory::CliFactory;
use crate::graph_container::ModuleGraphContainer;
use crate::graph_container::ModuleGraphUpdatePermit;
use crate::graph_util::CreateGraphOptions;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::futures::stream::FuturesUnordered; use deno_core::futures::stream::FuturesUnordered;
use deno_core::futures::StreamExt; use deno_core::futures::StreamExt;
use deno_semver::jsr::JsrPackageReqReference; use deno_semver::jsr::JsrPackageReqReference;
use crate::factory::CliFactory;
use crate::graph_container::ModuleGraphContainer;
use crate::graph_container::ModuleGraphUpdatePermit;
use crate::graph_util::CreateGraphOptions;
pub async fn cache_top_level_deps( pub async fn cache_top_level_deps(
// todo(dsherret): don't pass the factory into this function. Instead use ctor deps // todo(dsherret): don't pass the factory into this function. Instead use ctor deps
factory: &CliFactory, factory: &CliFactory,

View file

@ -35,6 +35,7 @@ use import_map::ImportMapWithDiagnostics;
use import_map::SpecifierMapEntry; use import_map::SpecifierMapEntry;
use tokio::sync::Semaphore; use tokio::sync::Semaphore;
use super::ConfigUpdater;
use crate::args::CliLockfile; use crate::args::CliLockfile;
use crate::graph_container::MainModuleGraphContainer; use crate::graph_container::MainModuleGraphContainer;
use crate::graph_container::ModuleGraphContainer; use crate::graph_container::ModuleGraphContainer;
@ -45,8 +46,6 @@ use crate::npm::CliNpmResolver;
use crate::npm::NpmFetchResolver; use crate::npm::NpmFetchResolver;
use crate::util::sync::AtomicFlag; use crate::util::sync::AtomicFlag;
use super::ConfigUpdater;
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub enum ImportMapKind { pub enum ImportMapKind {
Inline, Inline,

View file

@ -12,6 +12,10 @@ use deno_semver::StackString;
use deno_semver::VersionReq; use deno_semver::VersionReq;
use deno_terminal::colors; use deno_terminal::colors;
use super::deps::Dep;
use super::deps::DepManager;
use super::deps::DepManagerArgs;
use super::deps::PackageLatestVersion;
use crate::args::CliOptions; use crate::args::CliOptions;
use crate::args::Flags; use crate::args::Flags;
use crate::args::OutdatedFlags; use crate::args::OutdatedFlags;
@ -21,11 +25,6 @@ use crate::jsr::JsrFetchResolver;
use crate::npm::NpmFetchResolver; use crate::npm::NpmFetchResolver;
use crate::tools::registry::pm::deps::DepKind; use crate::tools::registry::pm::deps::DepKind;
use super::deps::Dep;
use super::deps::DepManager;
use super::deps::DepManagerArgs;
use super::deps::PackageLatestVersion;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
struct OutdatedPackage { struct OutdatedPackage {
kind: DepKind, kind: DepKind,

View file

@ -1,11 +1,8 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::http_util; use std::collections::HashMap;
use crate::http_util::HttpClient; use std::env;
use super::api::OidcTokenResponse;
use super::auth::gha_oidc_token;
use super::auth::is_gha;
use base64::engine::general_purpose::STANDARD_NO_PAD; use base64::engine::general_purpose::STANDARD_NO_PAD;
use base64::prelude::BASE64_STANDARD; use base64::prelude::BASE64_STANDARD;
use base64::Engine as _; use base64::Engine as _;
@ -27,8 +24,12 @@ use sha2::Digest;
use spki::der::asn1; use spki::der::asn1;
use spki::der::pem::LineEnding; use spki::der::pem::LineEnding;
use spki::der::EncodePem; use spki::der::EncodePem;
use std::collections::HashMap;
use std::env; use super::api::OidcTokenResponse;
use super::auth::gha_oidc_token;
use super::auth::is_gha;
use crate::http_util;
use crate::http_util::HttpClient;
const PAE_PREFIX: &str = "DSSEv1"; const PAE_PREFIX: &str = "DSSEv1";
@ -706,10 +707,11 @@ async fn testify(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::env;
use super::ProvenanceAttestation; use super::ProvenanceAttestation;
use super::Subject; use super::Subject;
use super::SubjectDigest; use super::SubjectDigest;
use std::env;
#[test] #[test]
fn slsa_github_actions() { fn slsa_github_actions() {

View file

@ -1,22 +1,22 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::fmt::Write as FmtWrite;
use std::io::Write;
use std::path::Path;
use bytes::Bytes; use bytes::Bytes;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_core::anyhow::Context; use deno_core::anyhow::Context;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::url::Url; use deno_core::url::Url;
use sha2::Digest; use sha2::Digest;
use std::fmt::Write as FmtWrite;
use std::io::Write;
use std::path::Path;
use tar::Header; use tar::Header;
use crate::cache::LazyGraphSourceParser;
use super::diagnostics::PublishDiagnostic; use super::diagnostics::PublishDiagnostic;
use super::diagnostics::PublishDiagnosticsCollector; use super::diagnostics::PublishDiagnosticsCollector;
use super::paths::CollectedPublishPath; use super::paths::CollectedPublishPath;
use super::unfurl::SpecifierUnfurler; use super::unfurl::SpecifierUnfurler;
use crate::cache::LazyGraphSourceParser;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct PublishableTarballFile { pub struct PublishableTarballFile {

View file

@ -655,10 +655,6 @@ fn to_range(
mod tests { mod tests {
use std::sync::Arc; use std::sync::Arc;
use crate::resolver::SloppyImportsCachedFs;
use super::*;
use crate::sys::CliSys;
use deno_ast::MediaType; use deno_ast::MediaType;
use deno_ast::ModuleSpecifier; use deno_ast::ModuleSpecifier;
use deno_config::workspace::ResolverWorkspaceJsrPackage; use deno_config::workspace::ResolverWorkspaceJsrPackage;
@ -671,6 +667,10 @@ mod tests {
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use test_util::testdata_path; use test_util::testdata_path;
use super::*;
use crate::resolver::SloppyImportsCachedFs;
use crate::sys::CliSys;
fn parse_ast(specifier: &Url, source_code: &str) -> ParsedSource { fn parse_ast(specifier: &Url, source_code: &str) -> ParsedSource {
let media_type = MediaType::from_specifier(specifier); let media_type = MediaType::from_specifier(specifier);
deno_ast::parse_module(deno_ast::ParseParams { deno_ast::parse_module(deno_ast::ParseParams {

View file

@ -1,10 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use std::cell::RefCell;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::serde_json::Value; use deno_core::serde_json::Value;
use std::cell::RefCell;
use tokio::sync::mpsc::channel; use tokio::sync::mpsc::channel;
use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::unbounded_channel;
use tokio::sync::mpsc::Receiver; use tokio::sync::mpsc::Receiver;

View file

@ -1,7 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::cdp; use std::borrow::Cow;
use crate::colors; use std::path::PathBuf;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Arc;
use deno_ast::swc::parser::error::SyntaxError; use deno_ast::swc::parser::error::SyntaxError;
use deno_ast::swc::parser::token::BinOpToken; use deno_ast::swc::parser::token::BinOpToken;
use deno_ast::swc::parser::token::Token; use deno_ast::swc::parser::token::Token;
@ -32,14 +36,11 @@ use rustyline::Modifiers;
use rustyline::RepeatCount; use rustyline::RepeatCount;
use rustyline_derive::Helper; use rustyline_derive::Helper;
use rustyline_derive::Hinter; use rustyline_derive::Hinter;
use std::borrow::Cow;
use std::path::PathBuf;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Arc;
use super::channel::RustylineSyncMessageSender; use super::channel::RustylineSyncMessageSender;
use super::session::REPL_INTERNALS_NAME; use super::session::REPL_INTERNALS_NAME;
use crate::cdp;
use crate::colors;
// Provides helpers to the editor like validation for multi-line edits, completion candidates for // Provides helpers to the editor like validation for multi-line edits, completion candidates for
// tab completion. // tab completion.

View file

@ -2,9 +2,15 @@
use std::io; use std::io;
use std::io::Write; use std::io::Write;
use std::sync::Arc; use std::sync::Arc;
use deno_core::error::AnyError;
use deno_core::futures::StreamExt;
use deno_core::serde_json;
use deno_core::unsync::spawn_blocking;
use deno_runtime::WorkerExecutionMode;
use rustyline::error::ReadlineError;
use crate::args::CliOptions; use crate::args::CliOptions;
use crate::args::Flags; use crate::args::Flags;
use crate::args::ReplFlags; use crate::args::ReplFlags;
@ -13,12 +19,6 @@ use crate::colors;
use crate::factory::CliFactory; use crate::factory::CliFactory;
use crate::file_fetcher::CliFileFetcher; use crate::file_fetcher::CliFileFetcher;
use crate::file_fetcher::TextDecodedFile; use crate::file_fetcher::TextDecodedFile;
use deno_core::error::AnyError;
use deno_core::futures::StreamExt;
use deno_core::serde_json;
use deno_core::unsync::spawn_blocking;
use deno_runtime::WorkerExecutionMode;
use rustyline::error::ReadlineError;
mod channel; mod channel;
mod editor; mod editor;

Some files were not shown because too many files have changed in this diff Show more