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:
parent
88bd5f09f7
commit
ac7b33a340
298 changed files with 2160 additions and 1951 deletions
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"exec": {
|
||||
"commands": [{
|
||||
"command": "rustfmt --config imports_granularity=item",
|
||||
"command": "rustfmt --config imports_granularity=item --config group_imports=StdExternalCrate",
|
||||
"exts": ["rs"]
|
||||
}]
|
||||
},
|
||||
|
|
|
@ -7,7 +7,6 @@ use deno_bench_util::bench_js_sync;
|
|||
use deno_bench_util::bench_or_profile;
|
||||
use deno_bench_util::bencher::benchmark_group;
|
||||
use deno_bench_util::bencher::Bencher;
|
||||
|
||||
use deno_core::Extension;
|
||||
|
||||
#[op2]
|
||||
|
|
|
@ -43,11 +43,10 @@ use log::Level;
|
|||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::args::resolve_no_prompt;
|
||||
use crate::util::fs::canonicalize_path;
|
||||
|
||||
use super::flags_net;
|
||||
use super::jsr_url;
|
||||
use crate::args::resolve_no_prompt;
|
||||
use crate::util::fs::canonicalize_path;
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub enum ConfigFlag {
|
||||
|
@ -6059,9 +6058,10 @@ pub fn resolve_urls(urls: Vec<String>) -> Vec<String> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Creates vector of strings, Vec<String>
|
||||
macro_rules! svec {
|
||||
($($x:expr),* $(,)?) => (vec![$($x.to_string().into()),*]);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// 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_runtime::deno_permissions::NetDescriptor;
|
||||
use std::net::IpAddr;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct ParsePortError(String);
|
||||
|
|
|
@ -10,6 +10,7 @@ use deno_core::error::AnyError;
|
|||
use deno_core::parking_lot::Mutex;
|
||||
use deno_core::parking_lot::MutexGuard;
|
||||
use deno_core::serde_json;
|
||||
use deno_lockfile::Lockfile;
|
||||
use deno_lockfile::WorkspaceMemberConfig;
|
||||
use deno_package_json::PackageJsonDepValue;
|
||||
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 crate::args::deno_json::import_map_deps;
|
||||
use crate::args::DenoSubcommand;
|
||||
use crate::args::InstallFlags;
|
||||
use crate::cache;
|
||||
use crate::sys::CliSys;
|
||||
use crate::Flags;
|
||||
|
||||
use crate::args::DenoSubcommand;
|
||||
use crate::args::InstallFlags;
|
||||
|
||||
use deno_lockfile::Lockfile;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CliLockfileReadFromPathOptions {
|
||||
pub file_path: PathBuf,
|
||||
|
|
134
cli/args/mod.rs
134
cli/args/mod.rs
|
@ -7,70 +7,6 @@ mod import_map;
|
|||
mod lockfile;
|
||||
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::collections::HashMap;
|
||||
use std::env;
|
||||
|
@ -83,6 +19,72 @@ use std::num::NonZeroUsize;
|
|||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
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 thiserror::Error;
|
||||
|
||||
|
@ -92,10 +94,6 @@ use crate::sys::CliSys;
|
|||
use crate::util::fs::canonicalize_path_maybe_not_exists;
|
||||
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 {
|
||||
static NPM_REGISTRY_DEFAULT_URL: Lazy<Url> = Lazy::new(|| {
|
||||
let env_var_name = "NPM_CONFIG_REGISTRY";
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
// 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_json;
|
||||
use deno_core::serde_json::json;
|
||||
use deno_core::serde_json::Value;
|
||||
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::PathRef;
|
||||
use tower_lsp::lsp_types as lsp;
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
#![allow(clippy::print_stdout)]
|
||||
#![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::convert::From;
|
||||
use std::env;
|
||||
|
@ -15,6 +12,10 @@ use std::path::PathBuf;
|
|||
use std::process::Command;
|
||||
use std::process::Stdio;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::serde_json;
|
||||
use deno_core::serde_json::Value;
|
||||
use test_util::PathRef;
|
||||
|
||||
mod lsp;
|
||||
|
|
12
cli/build.rs
12
cli/build.rs
|
@ -8,16 +8,18 @@ use deno_runtime::*;
|
|||
mod shared;
|
||||
|
||||
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::AnyError;
|
||||
use deno_core::op2;
|
||||
use deno_core::OpState;
|
||||
use serde::Serialize;
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
|
9
cli/cache/cache_db.rs
vendored
9
cli/cache/cache_db.rs
vendored
|
@ -1,5 +1,10 @@
|
|||
// 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::parking_lot::Mutex;
|
||||
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::Params;
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::io::IsTerminal;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::FastInsecureHasher;
|
||||
|
||||
|
|
7
cli/cache/check.rs
vendored
7
cli/cache/check.rs
vendored
|
@ -1,12 +1,13 @@
|
|||
// 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::CacheDBConfiguration;
|
||||
use super::cache_db::CacheDBHash;
|
||||
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 {
|
||||
table_initializer: concat!(
|
||||
|
|
3
cli/cache/code_cache.rs
vendored
3
cli/cache/code_cache.rs
vendored
|
@ -7,12 +7,11 @@ use deno_core::error::AnyError;
|
|||
use deno_runtime::code_cache;
|
||||
use deno_runtime::deno_webstorage::rusqlite::params;
|
||||
|
||||
use crate::worker::CliCodeCache;
|
||||
|
||||
use super::cache_db::CacheDB;
|
||||
use super::cache_db::CacheDBConfiguration;
|
||||
use super::cache_db::CacheDBHash;
|
||||
use super::cache_db::CacheFailure;
|
||||
use crate::worker::CliCodeCache;
|
||||
|
||||
pub static CODE_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
|
||||
table_initializer: concat!(
|
||||
|
|
9
cli/cache/deno_dir.rs
vendored
9
cli/cache/deno_dir.rs
vendored
|
@ -1,14 +1,13 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use deno_cache_dir::DenoDirResolutionError;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
|
||||
use super::DiskCache;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use crate::sys::CliSys;
|
||||
|
||||
/// Lazily creates the deno dir which might be useful in scenarios
|
||||
/// where functionality wants to continue if the DENO_DIR can't be created.
|
||||
|
|
19
cli/cache/disk_cache.rs
vendored
19
cli/cache/disk_cache.rs
vendored
|
@ -1,13 +1,5 @@
|
|||
// 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::fs;
|
||||
use std::path::Component;
|
||||
|
@ -16,6 +8,14 @@ use std::path::PathBuf;
|
|||
use std::path::Prefix;
|
||||
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)]
|
||||
pub struct DiskCache {
|
||||
sys: CliSys,
|
||||
|
@ -130,9 +130,10 @@ impl DiskCache {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_set_get_cache_file() {
|
||||
let temp_dir = TempDir::new();
|
||||
|
|
3
cli/cache/emit.rs
vendored
3
cli/cache/emit.rs
vendored
|
@ -159,9 +159,8 @@ impl EmitFileSerializer {
|
|||
mod test {
|
||||
use test_util::TempDir;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
|
||||
use super::*;
|
||||
use crate::sys::CliSys;
|
||||
|
||||
#[test]
|
||||
pub fn emit_cache_general_use() {
|
||||
|
|
24
cli/cache/mod.rs
vendored
24
cli/cache/mod.rs
vendored
|
@ -1,11 +1,8 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::args::jsr_url;
|
||||
use crate::file_fetcher::CliFetchNoFollowErrorKind;
|
||||
use crate::file_fetcher::CliFileFetcher;
|
||||
use crate::file_fetcher::FetchNoFollowOptions;
|
||||
use crate::file_fetcher::FetchPermissionsOptionRef;
|
||||
use crate::sys::CliSys;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_ast::MediaType;
|
||||
use deno_cache_dir::file_fetcher::CacheSetting;
|
||||
|
@ -21,9 +18,13 @@ use deno_graph::source::LoadResponse;
|
|||
use deno_graph::source::Loader;
|
||||
use deno_runtime::deno_permissions::PermissionsContainer;
|
||||
use node_resolver::InNpmPackageChecker;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::args::jsr_url;
|
||||
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 caches;
|
||||
|
@ -44,6 +45,8 @@ pub use caches::Caches;
|
|||
pub use check::TypeCheckCache;
|
||||
pub use code_cache::CodeCache;
|
||||
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::DenoDirProvider;
|
||||
pub use disk_cache::DiskCache;
|
||||
|
@ -55,9 +58,6 @@ pub use node::NodeAnalysisCache;
|
|||
pub use parsed_source::LazyGraphSourceParser;
|
||||
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 LocalHttpCache = deno_cache_dir::LocalHttpCache<CliSys>;
|
||||
pub type LocalLspHttpCache = deno_cache_dir::LocalLspHttpCache<CliSys>;
|
||||
|
|
3
cli/cache/node.rs
vendored
3
cli/cache/node.rs
vendored
|
@ -4,12 +4,11 @@ use deno_core::error::AnyError;
|
|||
use deno_core::serde_json;
|
||||
use deno_runtime::deno_webstorage::rusqlite::params;
|
||||
|
||||
use crate::node::CliCjsAnalysis;
|
||||
|
||||
use super::cache_db::CacheDB;
|
||||
use super::cache_db::CacheDBConfiguration;
|
||||
use super::cache_db::CacheFailure;
|
||||
use super::CacheDBHash;
|
||||
use crate::node::CliCjsAnalysis;
|
||||
|
||||
pub static NODE_ANALYSIS_CACHE_DB: CacheDBConfiguration =
|
||||
CacheDBConfiguration {
|
||||
|
|
11
cli/emit.rs
11
cli/emit.rs
|
@ -1,9 +1,6 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::cache::EmitCache;
|
||||
use crate::cache::FastInsecureHasher;
|
||||
use crate::cache::ParsedSourceCache;
|
||||
use crate::resolver::CjsTracker;
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_ast::EmittedSourceText;
|
||||
use deno_ast::ModuleKind;
|
||||
|
@ -21,7 +18,11 @@ use deno_core::ModuleSpecifier;
|
|||
use deno_graph::MediaType;
|
||||
use deno_graph::Module;
|
||||
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)]
|
||||
pub struct Emitter {
|
||||
|
|
|
@ -1,5 +1,34 @@
|
|||
// 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::get_root_cert_store;
|
||||
use crate::args::CaData;
|
||||
|
@ -63,35 +92,6 @@ use crate::util::progress_bar::ProgressBar;
|
|||
use crate::util::progress_bar::ProgressBarStyle;
|
||||
use crate::worker::CliMainWorkerFactory;
|
||||
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 {
|
||||
cell: OnceCell<RootCertStore>,
|
||||
|
|
|
@ -498,10 +498,6 @@ fn validate_scheme(specifier: &Url) -> Result<(), UnsupportedSchemeError> {
|
|||
|
||||
#[cfg(test)]
|
||||
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::HttpClient;
|
||||
use deno_core::resolve_url;
|
||||
|
@ -509,6 +505,10 @@ mod tests {
|
|||
use deno_runtime::deno_web::InMemoryBlobPart;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
use crate::cache::GlobalHttpCache;
|
||||
use crate::http_util::HttpClientProvider;
|
||||
|
||||
fn setup(
|
||||
cache_setting: CacheSetting,
|
||||
maybe_temp_dir: Option<TempDir>,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::util::progress_bar::UpdateGuard;
|
||||
use crate::version;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::thread::ThreadId;
|
||||
|
||||
use boxed_error::Boxed;
|
||||
use deno_cache_dir::file_fetcher::RedirectHeaderParseError;
|
||||
|
@ -23,12 +24,11 @@ use http::header::CONTENT_LENGTH;
|
|||
use http::HeaderMap;
|
||||
use http::StatusCode;
|
||||
use http_body_util::BodyExt;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::thread::ThreadId;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::util::progress_bar::UpdateGuard;
|
||||
use crate::version;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SendError {
|
||||
#[error(transparent)]
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::args::jsr_url;
|
||||
use crate::file_fetcher::CliFileFetcher;
|
||||
use std::sync::Arc;
|
||||
|
||||
use dashmap::DashMap;
|
||||
use deno_core::serde_json;
|
||||
use deno_graph::packages::JsrPackageInfo;
|
||||
use deno_graph::packages::JsrPackageVersionInfo;
|
||||
use deno_semver::package::PackageNv;
|
||||
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
|
||||
/// just reads the cache. Keep in sync!
|
||||
|
|
|
@ -1,25 +1,15 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use deno_config::workspace::MappedResolution;
|
||||
use deno_lint::diagnostic::LintDiagnosticRange;
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::path::Path;
|
||||
|
||||
use deno_ast::SourceRange;
|
||||
use deno_ast::SourceRangedForSpanned;
|
||||
use deno_ast::SourceTextInfo;
|
||||
use deno_config::workspace::MappedResolution;
|
||||
use deno_core::error::custom_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::serde::Deserialize;
|
||||
|
@ -27,6 +17,7 @@ use deno_core::serde::Serialize;
|
|||
use deno_core::serde_json;
|
||||
use deno_core::serde_json::json;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_lint::diagnostic::LintDiagnosticRange;
|
||||
use deno_path_util::url_to_file_path;
|
||||
use deno_runtime::deno_node::PathClean;
|
||||
use deno_semver::jsr::JsrPackageNvReference;
|
||||
|
@ -44,16 +35,25 @@ use node_resolver::NodeResolutionKind;
|
|||
use node_resolver::ResolutionMode;
|
||||
use once_cell::sync::Lazy;
|
||||
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 tower_lsp::lsp_types as lsp;
|
||||
use tower_lsp::lsp_types::Position;
|
||||
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
|
||||
/// fixes we treat them the same.
|
||||
static FIX_ALL_ERROR_CODES: Lazy<HashMap<&'static str, &'static str>> =
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
// 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::GlobalHttpCache;
|
||||
use crate::cache::HttpCache;
|
||||
|
@ -9,15 +19,6 @@ use crate::lsp::logging::lsp_log;
|
|||
use crate::lsp::logging::lsp_warn;
|
||||
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(
|
||||
cache: &LspCache,
|
||||
specifier: &ModuleSpecifier,
|
||||
|
|
|
@ -12,12 +12,11 @@ use lsp_types::Uri;
|
|||
use tower_lsp::lsp_types as lsp;
|
||||
use tower_lsp::lsp_types::ConfigurationItem;
|
||||
|
||||
use crate::lsp::repl::get_repl_workspace_settings;
|
||||
|
||||
use super::config::WorkspaceSettings;
|
||||
use super::config::SETTINGS_SECTION;
|
||||
use super::lsp_custom;
|
||||
use super::testing::lsp_custom as testing_lsp_custom;
|
||||
use crate::lsp::repl::get_repl_workspace_settings;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum TestingNotification {
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::lsp::logging::lsp_warn;
|
||||
|
||||
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 std::cell::RefCell;
|
||||
use std::collections::HashSet;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_ast::swc::ast;
|
||||
use deno_ast::swc::visit::Visit;
|
||||
|
@ -25,13 +21,17 @@ use deno_core::ModuleSpecifier;
|
|||
use lazy_regex::lazy_regex;
|
||||
use once_cell::sync::Lazy;
|
||||
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::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 EXPORT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\bexport\b");
|
||||
|
|
|
@ -1,5 +1,27 @@
|
|||
// 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::config::Config;
|
||||
use super::config::WorkspaceSettings;
|
||||
|
@ -12,33 +34,10 @@ use super::registries::ModuleRegistry;
|
|||
use super::resolver::LspResolver;
|
||||
use super::search::PackageSearchApi;
|
||||
use super::tsc;
|
||||
|
||||
use crate::graph_util::to_node_resolution_mode;
|
||||
use crate::jsr::JsrFetchResolver;
|
||||
use crate::util::path::is_importable_ext;
|
||||
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> =
|
||||
lazy_regex::lazy_regex!(r#"^file:/{2}(?:/[A-Za-z]:)?"#);
|
||||
|
@ -822,16 +821,18 @@ fn get_workspace_completions(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::collections::HashMap;
|
||||
|
||||
use deno_core::resolve_url;
|
||||
use pretty_assertions::assert_eq;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
use crate::cache::HttpCache;
|
||||
use crate::lsp::cache::LspCache;
|
||||
use crate::lsp::documents::Documents;
|
||||
use crate::lsp::documents::LanguageId;
|
||||
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(
|
||||
open_sources: &[(&str, &str, i32, LanguageId)],
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
// 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_config::deno_json::DenoJsonCache;
|
||||
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 indexmap::IndexSet;
|
||||
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 super::logging::lsp_log;
|
||||
|
|
|
@ -1,32 +1,11 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
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 deno_ast::MediaType;
|
||||
use deno_config::deno_json::LintConfig;
|
||||
|
@ -57,18 +36,39 @@ use deno_semver::package::PackageReq;
|
|||
use import_map::ImportMap;
|
||||
use import_map::ImportMapError;
|
||||
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::Mutex;
|
||||
use tokio::time::Duration;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
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)]
|
||||
pub struct DiagnosticServerUpdateMessage {
|
||||
pub snapshot: Arc<StateSnapshot>,
|
||||
|
@ -1646,6 +1646,12 @@ fn generate_deno_diagnostics(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_config::deno_json::ConfigFile;
|
||||
use pretty_assertions::assert_eq;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
use crate::lsp::cache::LspCache;
|
||||
use crate::lsp::config::Config;
|
||||
|
@ -1656,11 +1662,6 @@ mod tests {
|
|||
use crate::lsp::language_server::StateSnapshot;
|
||||
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 {
|
||||
let root_url = resolve_url("file:///").unwrap();
|
||||
let root_uri = url_to_uri(&root_url).unwrap();
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
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 dashmap::DashMap;
|
||||
use deno_ast::swc::visit::VisitWith;
|
||||
|
@ -36,20 +35,21 @@ use indexmap::IndexMap;
|
|||
use indexmap::IndexSet;
|
||||
use node_resolver::NodeResolutionKind;
|
||||
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 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] =
|
||||
["data", "blob", "file", "http", "https"];
|
||||
|
||||
|
@ -1754,9 +1754,6 @@ fn bytes_to_content(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::lsp::cache::LspCache;
|
||||
|
||||
use deno_config::deno_json::ConfigFile;
|
||||
use deno_config::deno_json::ConfigParseOptions;
|
||||
use deno_core::serde_json;
|
||||
|
@ -1764,6 +1761,9 @@ mod tests {
|
|||
use pretty_assertions::assert_eq;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
use crate::lsp::cache::LspCache;
|
||||
|
||||
async fn setup() -> (Documents, LspCache, TempDir) {
|
||||
let temp_dir = TempDir::new();
|
||||
temp_dir.create_dir_all(".deno_dir");
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use dashmap::DashMap;
|
||||
use deno_cache_dir::HttpCache;
|
||||
use deno_core::anyhow::anyhow;
|
||||
|
@ -21,11 +18,15 @@ use deno_semver::package::PackageReq;
|
|||
use deno_semver::StackString;
|
||||
use deno_semver::Version;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::config::ConfigData;
|
||||
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`!
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
// 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_cache_dir::file_fetcher::CacheSetting;
|
||||
use deno_config::workspace::WorkspaceDirectory;
|
||||
|
@ -27,16 +38,6 @@ use node_resolver::NodeResolutionKind;
|
|||
use node_resolver::ResolutionMode;
|
||||
use serde::Deserialize;
|
||||
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::UnboundedReceiver;
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
|
@ -3963,10 +3964,11 @@ impl Inner {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_walk_workspace() {
|
||||
let temp_dir = TempDir::new();
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
// 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::io::prelude::*;
|
||||
use std::path::Path;
|
||||
|
@ -12,6 +9,10 @@ use std::sync::atomic::Ordering;
|
|||
use std::thread;
|
||||
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_LOG_LEVEL: AtomicUsize = AtomicUsize::new(log::Level::Info as usize);
|
||||
static LSP_WARN_LEVEL: AtomicUsize =
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::unsync::spawn;
|
||||
pub use repl::ReplCompletionItem;
|
||||
pub use repl::ReplLanguageServer;
|
||||
use tower_lsp::LspService;
|
||||
use tower_lsp::Server;
|
||||
|
||||
use self::diagnostics::should_send_diagnostic_batch_index_notifications;
|
||||
use crate::lsp::language_server::LanguageServer;
|
||||
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 cache;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use dashmap::DashMap;
|
||||
use deno_core::anyhow::anyhow;
|
||||
use deno_core::error::AnyError;
|
||||
|
@ -8,15 +10,13 @@ use deno_npm::npm_rc::NpmRc;
|
|||
use deno_semver::package::PackageNv;
|
||||
use deno_semver::Version;
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::search::PackageSearchApi;
|
||||
use crate::args::npm_registry_url;
|
||||
use crate::file_fetcher::CliFileFetcher;
|
||||
use crate::file_fetcher::TextDecodedFile;
|
||||
use crate::npm::NpmFetchResolver;
|
||||
|
||||
use super::search::PackageSearchApi;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CliNpmSearchApi {
|
||||
file_fetcher: Arc<CliFileFetcher>,
|
||||
|
|
|
@ -52,10 +52,12 @@ fn is_process_active(process_id: u32) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::is_process_active;
|
||||
use std::process::Command;
|
||||
|
||||
use test_util::deno_exe_path;
|
||||
|
||||
use super::is_process_active;
|
||||
|
||||
#[test]
|
||||
fn process_active() {
|
||||
// launch a long running process
|
||||
|
|
|
@ -26,15 +26,16 @@
|
|||
// 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::error::AnyError;
|
||||
use fancy_regex::Regex as FancyRegex;
|
||||
use once_cell::sync::Lazy;
|
||||
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> =
|
||||
lazy_regex::lazy_regex!(r"([.+*?=^!:${}()\[\]|/\\])");
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
// 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::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
|
@ -12,6 +8,11 @@ use std::sync::Arc;
|
|||
use std::time::Duration;
|
||||
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;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_cache_dir::file_fetcher::CacheSetting;
|
||||
use deno_core::anyhow::anyhow;
|
||||
|
@ -35,12 +19,28 @@ use deno_core::ModuleSpecifier;
|
|||
use deno_graph::Dependency;
|
||||
use log::error;
|
||||
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 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 COMPONENT: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
|
||||
.add(b' ')
|
||||
|
@ -1128,9 +1128,10 @@ FetchPermissionsOptionRef::AllowAll,
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_validate_registry_configuration() {
|
||||
assert!(validate_config(&RegistryConfigurationJson {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
// 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 deno_ast::MediaType;
|
||||
use deno_cache_dir::file_fetcher::CacheSetting;
|
||||
|
@ -28,12 +35,6 @@ use indexmap::IndexMap;
|
|||
use node_resolver::InNpmPackageChecker;
|
||||
use node_resolver::NodeResolutionKind;
|
||||
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::jsr::JsrCacheResolver;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_core::error::AnyError;
|
||||
use deno_semver::package::PackageNv;
|
||||
use deno_semver::Version;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait PackageSearchApi {
|
||||
|
@ -15,10 +16,12 @@ pub trait PackageSearchApi {
|
|||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use deno_core::anyhow::anyhow;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use deno_core::anyhow::anyhow;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct TestPackageSearchApi {
|
||||
/// [(name -> [(version -> [export])])]
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
use std::ops::Index;
|
||||
use std::ops::IndexMut;
|
||||
|
||||
use tower_lsp::lsp_types as lsp;
|
||||
use tower_lsp::lsp_types::SemanticToken;
|
||||
use tower_lsp::lsp_types::SemanticTokenModifier;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::lsp::analysis::source_range_to_lsp_range;
|
||||
|
||||
use super::definitions::TestModule;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use deno_ast::swc::ast;
|
||||
use deno_ast::swc::visit::Visit;
|
||||
|
@ -11,10 +10,11 @@ use deno_ast::SourceRangedForSpanned;
|
|||
use deno_ast::SourceTextInfo;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use lsp::Range;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
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.
|
||||
fn visit_arrow(
|
||||
arrow_expr: &ast::ArrowExpr,
|
||||
|
@ -626,12 +626,12 @@ impl Visit for TestCollector {
|
|||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use crate::lsp::testing::definitions::TestDefinition;
|
||||
|
||||
use super::*;
|
||||
use deno_core::resolve_url;
|
||||
use lsp::Position;
|
||||
|
||||
use super::*;
|
||||
use crate::lsp::testing::definitions::TestDefinition;
|
||||
|
||||
pub fn new_range(l1: u32, c1: u32, l2: u32, c2: u32) -> Range {
|
||||
Range::new(Position::new(l1, c1), Position::new(l2, c2))
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
// 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::TestData;
|
||||
|
||||
use crate::lsp::client::TestingNotification;
|
||||
use crate::lsp::logging::lsp_warn;
|
||||
use crate::lsp::urls::url_to_uri;
|
||||
|
@ -10,13 +17,6 @@ use crate::tools::test::TestDescription;
|
|||
use crate::tools::test::TestStepDescription;
|
||||
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)]
|
||||
pub struct TestDefinition {
|
||||
pub id: String,
|
||||
|
|
|
@ -1,24 +1,12 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
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 deno_core::anyhow::anyhow;
|
||||
use deno_core::error::AnyError;
|
||||
|
@ -34,16 +22,28 @@ use deno_runtime::deno_permissions::Permissions;
|
|||
use deno_runtime::deno_permissions::PermissionsContainer;
|
||||
use deno_runtime::tokio_util::create_and_run_current_thread;
|
||||
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 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
|
||||
/// any filters to be applied to those tests
|
||||
fn as_queue_and_filters(
|
||||
|
@ -794,9 +794,10 @@ impl LspTestReporter {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use deno_core::serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::lsp::testing::collectors::tests::new_range;
|
||||
use deno_core::serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn test_as_queue_and_filters() {
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
use deno_core::error::AnyError;
|
||||
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::ModuleSpecifier;
|
||||
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 tower_lsp::jsonrpc::Error as LspError;
|
||||
use tower_lsp::jsonrpc::Result as LspResult;
|
||||
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(
|
||||
url: &ModuleSpecifier,
|
||||
) -> Result<TestingNotification, AnyError> {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// 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::AnyError;
|
||||
use dissimilar::diff;
|
||||
use dissimilar::Chunk;
|
||||
use std::collections::HashMap;
|
||||
use text_size::TextRange;
|
||||
use text_size::TextSize;
|
||||
use tower_lsp::jsonrpc;
|
||||
|
|
109
cli/lsp/tsc.rs
109
cli/lsp/tsc.rs
|
@ -1,52 +1,29 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
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 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 dashmap::DashMap;
|
||||
use deno_ast::MediaType;
|
||||
use deno_core::anyhow::anyhow;
|
||||
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::StdAnyError;
|
||||
use deno_core::futures::stream::FuturesOrdered;
|
||||
use deno_core::futures::FutureExt;
|
||||
use deno_core::futures::StreamExt;
|
||||
use deno_core::op2;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
use deno_core::resolve_url;
|
||||
|
@ -77,18 +54,6 @@ use regex::Captures;
|
|||
use regex::Regex;
|
||||
use serde_repr::Deserialize_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::TextSize;
|
||||
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::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> =
|
||||
lazy_regex!(r#"^\[['"](.+)[\['"]\]$"#);
|
||||
static CAPTION_RE: Lazy<Regex> =
|
||||
|
@ -5541,6 +5541,9 @@ impl TscRequest {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
use crate::cache::HttpCache;
|
||||
use crate::lsp::cache::LspCache;
|
||||
|
@ -5550,8 +5553,6 @@ mod tests {
|
|||
use crate::lsp::documents::LanguageId;
|
||||
use crate::lsp::resolver::LspResolver;
|
||||
use crate::lsp::text::LineIndex;
|
||||
use pretty_assertions::assert_eq;
|
||||
use test_util::TempDir;
|
||||
|
||||
async fn setup(
|
||||
ts_config: Value,
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
// 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_core::error::AnyError;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
|
@ -8,9 +12,6 @@ use deno_core::url::Url;
|
|||
use deno_core::ModuleSpecifier;
|
||||
use lsp_types::Uri;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::HashMap;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::cache::LspCache;
|
||||
use super::logging::lsp_warn;
|
||||
|
@ -307,9 +308,10 @@ fn file_like_to_file_specifier(specifier: &Url) -> Option<Url> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use deno_core::resolve_url;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_hash_data_specifier() {
|
||||
let fixture = resolve_url("data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=").unwrap();
|
||||
|
|
50
cli/main.rs
50
cli/main.rs
|
@ -28,31 +28,6 @@ mod util;
|
|||
mod version;
|
||||
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::future::Future;
|
||||
use std::io::IsTerminal;
|
||||
|
@ -60,6 +35,31 @@ use std::ops::Deref;
|
|||
use std::path::PathBuf;
|
||||
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")]
|
||||
#[global_allocator]
|
||||
static ALLOC: dhat::Alloc = dhat::Alloc;
|
||||
|
|
|
@ -24,6 +24,12 @@ mod util;
|
|||
mod version;
|
||||
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::AnyError;
|
||||
use deno_core::error::JsError;
|
||||
|
@ -34,12 +40,6 @@ use deno_terminal::colors;
|
|||
use indexmap::IndexMap;
|
||||
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;
|
||||
|
||||
pub(crate) fn unstable_exit_cb(feature: &str, api_name: &str) {
|
||||
|
|
|
@ -11,8 +11,6 @@ use std::sync::atomic::AtomicU16;
|
|||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::node::CliNodeResolver;
|
||||
use crate::sys::CliSys;
|
||||
use deno_ast::MediaType;
|
||||
use deno_ast::ModuleKind;
|
||||
use deno_core::anyhow::anyhow;
|
||||
|
@ -66,6 +64,7 @@ use crate::graph_container::ModuleGraphUpdatePermit;
|
|||
use crate::graph_util::CreateGraphOptions;
|
||||
use crate::graph_util::ModuleGraphBuilder;
|
||||
use crate::node::CliNodeCodeTranslator;
|
||||
use crate::node::CliNodeResolver;
|
||||
use crate::npm::CliNpmResolver;
|
||||
use crate::resolver::CjsTracker;
|
||||
use crate::resolver::CliNpmReqResolver;
|
||||
|
@ -73,6 +72,7 @@ use crate::resolver::CliResolver;
|
|||
use crate::resolver::ModuleCodeStringSource;
|
||||
use crate::resolver::NotSupportedKindInNpmError;
|
||||
use crate::resolver::NpmModuleLoader;
|
||||
use crate::sys::CliSys;
|
||||
use crate::tools::check;
|
||||
use crate::tools::check::TypeChecker;
|
||||
use crate::util::progress_bar::ProgressBar;
|
||||
|
@ -1161,9 +1161,10 @@ impl<TGraphContainer: ModuleGraphContainer> NodeRequireLoader
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use deno_graph::ParsedSourceStore;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_inflight_module_loads_tracker() {
|
||||
let tracker = InFlightModuleLoadsTracker {
|
||||
|
|
|
@ -4,7 +4,6 @@ use std::borrow::Cow;
|
|||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::serde_json;
|
||||
use deno_resolver::npm::ByonmNpmResolver;
|
||||
|
@ -14,11 +13,11 @@ use deno_runtime::deno_node::NodePermissions;
|
|||
use deno_runtime::ops::process::NpmProcessStateProvider;
|
||||
use node_resolver::NpmPackageFolderResolver;
|
||||
|
||||
use crate::args::NpmProcessState;
|
||||
use crate::args::NpmProcessStateKind;
|
||||
|
||||
use super::CliNpmResolver;
|
||||
use super::InnerCliNpmResolverRef;
|
||||
use crate::args::NpmProcessState;
|
||||
use crate::args::NpmProcessStateKind;
|
||||
use crate::sys::CliSys;
|
||||
|
||||
pub type CliByonmNpmResolverCreateOptions =
|
||||
ByonmNpmResolverCreateOptions<CliSys>;
|
||||
|
|
|
@ -5,7 +5,6 @@ use std::path::Path;
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
use deno_ast::ModuleSpecifier;
|
||||
use deno_cache_dir::npm::NpmCacheDir;
|
||||
use deno_core::anyhow::Context;
|
||||
|
@ -35,20 +34,9 @@ use node_resolver::InNpmPackageChecker;
|
|||
use node_resolver::NpmPackageFolderResolver;
|
||||
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::resolvers::create_npm_fs_resolver;
|
||||
use self::resolvers::NpmPackageFsResolver;
|
||||
|
||||
use super::CliNpmCache;
|
||||
use super::CliNpmCacheHttpClient;
|
||||
use super::CliNpmRegistryInfoProvider;
|
||||
|
@ -56,6 +44,16 @@ use super::CliNpmResolver;
|
|||
use super::CliNpmTarballCache;
|
||||
use super::InnerCliNpmResolverRef;
|
||||
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 resolvers;
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
// 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::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::path::Path;
|
||||
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)]
|
||||
pub struct BinEntries<'a> {
|
||||
/// Packages that have colliding bin names
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
// 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 crate::args::LifecycleScriptsConfig;
|
||||
use crate::task_runner::TaskStdio;
|
||||
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 {
|
||||
fn can_run_scripts(&self) -> bool {
|
||||
|
|
|
@ -7,11 +7,6 @@ use std::path::Path;
|
|||
use std::path::PathBuf;
|
||||
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 deno_ast::ModuleSpecifier;
|
||||
use deno_core::error::AnyError;
|
||||
|
@ -24,14 +19,18 @@ use node_resolver::errors::PackageFolderResolveError;
|
|||
use node_resolver::errors::PackageNotFoundError;
|
||||
use node_resolver::errors::ReferrerNotFoundError;
|
||||
|
||||
use crate::args::LifecycleScriptsConfig;
|
||||
use crate::cache::FastInsecureHasher;
|
||||
|
||||
use super::super::resolution::NpmResolution;
|
||||
use super::common::cache_packages;
|
||||
use super::common::lifecycle_scripts::LifecycleScriptsStrategy;
|
||||
use super::common::NpmPackageFsResolver;
|
||||
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.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -43,6 +43,10 @@ use serde::Deserialize;
|
|||
use serde::Serialize;
|
||||
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::NpmInstallDepsProvider;
|
||||
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::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
|
||||
/// and resolves packages from it.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -7,22 +7,19 @@ mod local;
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
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::NpmInstallDepsProvider;
|
||||
use crate::npm::CliNpmCache;
|
||||
use crate::npm::CliNpmTarballCache;
|
||||
use crate::sys::CliSys;
|
||||
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)]
|
||||
pub fn create_npm_fs_resolver(
|
||||
npm_cache: Arc<CliNpmCache>,
|
||||
|
|
|
@ -7,7 +7,6 @@ use std::borrow::Cow;
|
|||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
use dashmap::DashMap;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::serde_json;
|
||||
|
@ -28,10 +27,6 @@ use managed::create_managed_in_npm_pkg_checker;
|
|||
use node_resolver::InNpmPackageChecker;
|
||||
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::CliByonmNpmResolverCreateOptions;
|
||||
pub use self::managed::CliManagedInNpmPkgCheckerCreateOptions;
|
||||
|
@ -39,6 +34,10 @@ pub use self::managed::CliManagedNpmResolverCreateOptions;
|
|||
pub use self::managed::CliNpmResolverManagedSnapshotOption;
|
||||
pub use self::managed::ManagedCliNpmResolver;
|
||||
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 =
|
||||
deno_npm_cache::TarballCache<CliNpmCacheHttpClient, CliSys>;
|
||||
|
|
|
@ -8,17 +8,16 @@ use std::cell::RefCell;
|
|||
use std::rc::Rc;
|
||||
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::op2;
|
||||
use deno_core::parking_lot::Mutex;
|
||||
use deno_core::serde_json;
|
||||
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 crate::tools::jupyter::server::StdinConnectionProxy;
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use deno_core::error::generic_error;
|
||||
use deno_core::error::type_error;
|
||||
|
@ -18,10 +12,17 @@ use deno_core::ModuleSpecifier;
|
|||
use deno_core::OpState;
|
||||
use deno_runtime::deno_permissions::ChildPermissionsArg;
|
||||
use deno_runtime::deno_permissions::PermissionsContainer;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
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,
|
||||
ops = [
|
||||
op_pledge_test_permissions,
|
||||
|
|
|
@ -5,7 +5,6 @@ use std::path::Path;
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
use async_trait::async_trait;
|
||||
use dashmap::DashMap;
|
||||
use dashmap::DashSet;
|
||||
|
@ -40,6 +39,7 @@ use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS;
|
|||
use crate::node::CliNodeCodeTranslator;
|
||||
use crate::npm::CliNpmResolver;
|
||||
use crate::npm::InnerCliNpmResolverRef;
|
||||
use crate::sys::CliSys;
|
||||
use crate::util::sync::AtomicFlag;
|
||||
use crate::util::text_encoding::from_utf8_lossy_cow;
|
||||
|
||||
|
|
|
@ -61,6 +61,23 @@ use log::Level;
|
|||
use serde::Deserialize;
|
||||
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::CliOptions;
|
||||
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::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 =
|
||||
".deno_compile_node_modules";
|
||||
|
||||
|
|
|
@ -395,10 +395,11 @@ fn deserialize_with_reader<T: Read>(
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::fs::File;
|
||||
|
||||
use test_util::TempDir;
|
||||
|
||||
use super::*;
|
||||
use std::fs::File;
|
||||
|
||||
#[test]
|
||||
fn serialize_deserialize() {
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
#![allow(dead_code)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use binary::StandaloneData;
|
||||
use binary::StandaloneModules;
|
||||
use code_cache::DenoCompileCodeCache;
|
||||
|
@ -57,9 +61,6 @@ use node_resolver::NodeResolutionKind;
|
|||
use node_resolver::ResolutionMode;
|
||||
use serialization::DenoCompileModuleSource;
|
||||
use serialization::SourceMapStore;
|
||||
use std::borrow::Cow;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use virtual_fs::FileBackedVfs;
|
||||
use virtual_fs::VfsFileSubDataKind;
|
||||
|
||||
|
@ -107,12 +108,12 @@ mod file_system;
|
|||
mod serialization;
|
||||
mod virtual_fs;
|
||||
|
||||
pub use self::file_system::DenoCompileFileSystem;
|
||||
pub use binary::extract_standalone;
|
||||
pub use binary::is_standalone_binary;
|
||||
pub use binary::DenoCompileBinaryWriter;
|
||||
|
||||
use self::binary::Metadata;
|
||||
pub use self::file_system::DenoCompileFileSystem;
|
||||
|
||||
struct SharedModuleLoaderState {
|
||||
cjs_tracker: Arc<CjsTracker>,
|
||||
|
|
|
@ -25,12 +25,11 @@ use deno_semver::package::PackageReq;
|
|||
use deno_semver::StackString;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use crate::standalone::virtual_fs::VirtualDirectory;
|
||||
|
||||
use super::binary::Metadata;
|
||||
use super::virtual_fs::BuiltVfs;
|
||||
use super::virtual_fs::VfsBuilder;
|
||||
use super::virtual_fs::VirtualDirectoryEntries;
|
||||
use crate::standalone::virtual_fs::VirtualDirectory;
|
||||
|
||||
const MAGIC_BYTES: &[u8; 8] = b"d3n0l4nd";
|
||||
|
||||
|
|
|
@ -34,13 +34,12 @@ use serde::Deserialize;
|
|||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
|
||||
use super::binary::DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME;
|
||||
use crate::util;
|
||||
use crate::util::display::human_size;
|
||||
use crate::util::display::DisplayTreeNode;
|
||||
use crate::util::fs::canonicalize_path;
|
||||
|
||||
use super::binary::DENO_COMPILE_GLOBAL_NODE_MODULES_DIR_NAME;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum WindowsSystemRootablePath {
|
||||
/// The root of the system above any drive letters.
|
||||
|
@ -1563,9 +1562,10 @@ impl FileBackedVfs {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::io::Write;
|
||||
|
||||
use console_static_text::ansi::strip_ansi_codes;
|
||||
use deno_io::fs::File;
|
||||
use std::io::Write;
|
||||
use test_util::assert_contains;
|
||||
use test_util::TempDir;
|
||||
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use std::collections::HashSet;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use deno_config::glob::WalkEntry;
|
||||
use deno_core::error::generic_error;
|
||||
|
@ -39,13 +28,25 @@ use indexmap::IndexSet;
|
|||
use log::Level;
|
||||
use serde::Deserialize;
|
||||
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::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 reporters;
|
||||
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use super::*;
|
||||
use crate::tools::test::TestFailureFormatOptions;
|
||||
use crate::version;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub trait BenchReporter {
|
||||
fn report_group_summary(&mut self);
|
||||
fn report_plan(&mut self, plan: &BenchPlan);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use deno_core::anyhow::Context;
|
||||
use deno_core::error::AnyError;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::cache::DenoDir;
|
||||
use crate::colors;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_ast::MediaType;
|
||||
use deno_ast::ModuleSpecifier;
|
||||
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_terminal::colors;
|
||||
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 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(
|
||||
flags: Arc<Flags>,
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
// Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust
|
||||
// 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::BTreeSet;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::Peekable;
|
||||
|
||||
use super::range_tree::RangeTree;
|
||||
use super::range_tree::RangeTreeArena;
|
||||
use crate::cdp;
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug)]
|
||||
pub struct ProcessCoverage {
|
||||
pub result: Vec<cdp::ScriptCoverage>,
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
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;
|
||||
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 deno_ast::MediaType;
|
||||
use deno_ast::ModuleKind;
|
||||
|
@ -29,16 +25,21 @@ use deno_core::url::Url;
|
|||
use deno_core::LocalInspectorSession;
|
||||
use node_resolver::InNpmPackageChecker;
|
||||
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 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 range_tree;
|
||||
mod reporter;
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
// Forked from https://github.com/demurgos/v8-coverage/tree/d0ca18da8740198681e0bc68971b0a6cdb11db3e/rust
|
||||
// Copyright 2021 Charles Samborski. All rights reserved. MIT license.
|
||||
|
||||
use crate::cdp;
|
||||
use std::iter::Peekable;
|
||||
|
||||
use typed_arena::Arena;
|
||||
|
||||
use crate::cdp;
|
||||
|
||||
pub struct RangeTreeArena<'a>(Arena<RangeTree<'a>>);
|
||||
|
||||
impl<'a> RangeTreeArena<'a> {
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
// 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::fs;
|
||||
use std::fs::File;
|
||||
|
@ -15,6 +9,14 @@ use std::io::{self};
|
|||
use std::path::Path;
|
||||
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)]
|
||||
pub struct CoverageStats<'a> {
|
||||
pub line_hit: usize,
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::args::DocFlags;
|
||||
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;
|
||||
use std::collections::BTreeMap;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use deno_ast::diagnostics::Diagnostic;
|
||||
use deno_config::glob::FilePatterns;
|
||||
use deno_config::glob::PathOrPatternSet;
|
||||
|
@ -32,9 +23,20 @@ use deno_graph::ModuleSpecifier;
|
|||
use doc::html::ShortPath;
|
||||
use doc::DocDiagnostic;
|
||||
use indexmap::IndexMap;
|
||||
use std::collections::BTreeMap;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::args::DocFlags;
|
||||
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;
|
||||
|
||||
|
|
|
@ -7,21 +7,18 @@
|
|||
//! the future it can be easily extended to provide
|
||||
//! the same functions as ops available in JS runtime.
|
||||
|
||||
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::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;
|
||||
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 async_trait::async_trait;
|
||||
use deno_ast::ParsedSource;
|
||||
use deno_config::glob::FileCollector;
|
||||
|
@ -38,19 +35,23 @@ use deno_core::url::Url;
|
|||
use log::debug;
|
||||
use log::info;
|
||||
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::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.
|
||||
pub async fn format(
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::args::DenoSubcommand;
|
||||
use crate::args::Flags;
|
||||
use crate::args::InitFlags;
|
||||
use crate::args::PackagesAllowedScripts;
|
||||
use crate::args::PermissionFlags;
|
||||
use crate::args::RunFlags;
|
||||
use crate::colors;
|
||||
use std::io::IsTerminal;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
use color_print::cformat;
|
||||
use color_print::cstr;
|
||||
use deno_config::deno_json::NodeModulesDirMode;
|
||||
|
@ -15,9 +12,14 @@ use deno_core::error::AnyError;
|
|||
use deno_core::serde_json::json;
|
||||
use deno_runtime::WorkerExecutionMode;
|
||||
use log::info;
|
||||
use std::io::IsTerminal;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::args::DenoSubcommand;
|
||||
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> {
|
||||
if let Some(package) = &init_flags.package {
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
// 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::AddFlags;
|
||||
use crate::args::CaData;
|
||||
|
@ -19,30 +43,6 @@ use crate::jsr::JsrFetchResolver;
|
|||
use crate::npm::NpmFetchResolver;
|
||||
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(|| {
|
||||
RegexBuilder::new(r"^[a-z0-9][\w-]*$")
|
||||
.case_insensitive(true)
|
||||
|
@ -659,16 +659,17 @@ fn is_in_path(dir: &Path) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
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::PermissionFlags;
|
||||
use crate::args::UninstallFlagsGlobal;
|
||||
use crate::args::UnstableConfig;
|
||||
use crate::util::fs::canonicalize_path;
|
||||
use std::process::Command;
|
||||
use test_util::testdata_path;
|
||||
use test_util::TempDir;
|
||||
|
||||
#[tokio::test]
|
||||
async fn install_infer_name_from_url() {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// 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::io::Write;
|
||||
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;
|
||||
|
||||
const DENO_ICON_32: &[u8] = include_bytes!("./resources/deno-logo-32x32.png");
|
||||
|
|
|
@ -2,17 +2,6 @@
|
|||
|
||||
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::Context;
|
||||
use deno_core::error::generic_error;
|
||||
|
@ -34,6 +23,18 @@ use tokio::sync::mpsc;
|
|||
use tokio::sync::mpsc::UnboundedSender;
|
||||
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;
|
||||
pub mod server;
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ use std::collections::HashMap;
|
|||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::cdp;
|
||||
use crate::tools::repl;
|
||||
use deno_core::anyhow::bail;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures;
|
||||
|
@ -20,12 +18,9 @@ use deno_core::parking_lot::Mutex;
|
|||
use deno_core::serde_json;
|
||||
use deno_core::CancelFuture;
|
||||
use deno_core::CancelHandle;
|
||||
use jupyter_runtime::ExecutionCount;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use jupyter_runtime::messaging;
|
||||
use jupyter_runtime::ConnectionInfo;
|
||||
use jupyter_runtime::ExecutionCount;
|
||||
use jupyter_runtime::JupyterMessage;
|
||||
use jupyter_runtime::JupyterMessageContent;
|
||||
use jupyter_runtime::KernelControlConnection;
|
||||
|
@ -34,9 +29,13 @@ use jupyter_runtime::KernelShellConnection;
|
|||
use jupyter_runtime::ReplyError;
|
||||
use jupyter_runtime::ReplyStatus;
|
||||
use jupyter_runtime::StreamContent;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::oneshot;
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::JupyterReplProxy;
|
||||
use crate::cdp;
|
||||
use crate::tools::repl;
|
||||
|
||||
pub struct JupyterServer {
|
||||
execution_count: ExecutionCount,
|
||||
|
|
|
@ -17,12 +17,11 @@ use deno_lint::linter::Linter as DenoLintLinter;
|
|||
use deno_lint::linter::LinterOptions;
|
||||
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::PackageLintRule;
|
||||
use super::ConfiguredRules;
|
||||
use crate::sys::CliSys;
|
||||
use crate::util::fs::specifier_from_file_path;
|
||||
|
||||
pub struct CliLinterOptions {
|
||||
pub configured_rules: ConfiguredRules,
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
//! This module provides file linting utilities using
|
||||
//! [`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::ParsedSource;
|
||||
use deno_config::deno_json::LintRulesConfig;
|
||||
|
@ -25,13 +33,6 @@ use log::debug;
|
|||
use reporters::create_reporter;
|
||||
use reporters::LintReporter;
|
||||
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::Flags;
|
||||
|
@ -596,11 +597,12 @@ struct LintError {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde::Deserialize;
|
||||
use test_util as util;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct RulesSchema {
|
||||
#[serde(rename = "$schema")]
|
||||
|
|
|
@ -8,9 +8,8 @@ use deno_runtime::colors;
|
|||
use log::info;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::args::LintReporterKind;
|
||||
|
||||
use super::LintError;
|
||||
use crate::args::LintReporterKind;
|
||||
|
||||
const JSON_SCHEMA_VERSION: u8 = 1;
|
||||
|
||||
|
|
|
@ -20,11 +20,10 @@ use deno_resolver::sloppy_imports::SloppyImportsResolution;
|
|||
use deno_resolver::sloppy_imports::SloppyImportsResolutionKind;
|
||||
use text_lines::LineAndColumnIndex;
|
||||
|
||||
use super::ExtendedLintRule;
|
||||
use crate::graph_util::CliJsrUrlProvider;
|
||||
use crate::resolver::CliSloppyImportsResolver;
|
||||
|
||||
use super::ExtendedLintRule;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NoSloppyImportsRule {
|
||||
sloppy_imports_resolver: Option<Arc<CliSloppyImportsResolver>>,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::http_util;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::serde_json;
|
||||
use deno_core::url::Url;
|
||||
use deno_runtime::deno_fetch;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
use crate::http_util;
|
||||
use crate::http_util::HttpClient;
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
|
|
|
@ -16,10 +16,9 @@ use deno_graph::WalkOptions;
|
|||
use deno_semver::jsr::JsrPackageReqReference;
|
||||
use deno_semver::npm::NpmPackageReqReference;
|
||||
|
||||
use crate::cache::ParsedSourceCache;
|
||||
|
||||
use super::diagnostics::PublishDiagnostic;
|
||||
use super::diagnostics::PublishDiagnosticsCollector;
|
||||
use crate::cache::ParsedSourceCache;
|
||||
|
||||
pub struct GraphDiagnosticsCollector {
|
||||
parsed_source_cache: Arc<ParsedSourceCache>,
|
||||
|
|
|
@ -73,11 +73,10 @@ pub use pm::AddRmPackageReq;
|
|||
use publish_order::PublishOrderGraph;
|
||||
use unfurl::SpecifierUnfurler;
|
||||
|
||||
use super::check::TypeChecker;
|
||||
|
||||
use self::graph::GraphDiagnosticsCollector;
|
||||
use self::paths::CollectedPublishPath;
|
||||
use self::tar::PublishableTarball;
|
||||
use super::check::TypeChecker;
|
||||
|
||||
pub async fn publish(
|
||||
flags: Arc<Flags>,
|
||||
|
@ -1281,14 +1280,14 @@ fn ring_bell() {
|
|||
|
||||
#[cfg(test)]
|
||||
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::PublishableTarballFile;
|
||||
use super::verify_version_manifest;
|
||||
use std::collections::HashMap;
|
||||
use crate::tools::registry::has_license_file;
|
||||
|
||||
#[test]
|
||||
fn test_verify_version_manifest() {
|
||||
|
|
|
@ -6,7 +6,6 @@ use std::collections::HashSet;
|
|||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::sys::CliSys;
|
||||
use deno_ast::MediaType;
|
||||
use deno_ast::ModuleSpecifier;
|
||||
use deno_config::glob::FileCollector;
|
||||
|
@ -14,10 +13,10 @@ use deno_config::glob::FilePatterns;
|
|||
use deno_core::error::AnyError;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::args::CliOptions;
|
||||
|
||||
use super::diagnostics::PublishDiagnostic;
|
||||
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
|
||||
/// and does not end with a slash.
|
||||
|
|
|
@ -3,15 +3,16 @@
|
|||
use std::borrow::Cow;
|
||||
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::futures::stream::FuturesUnordered;
|
||||
use deno_core::futures::StreamExt;
|
||||
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(
|
||||
// todo(dsherret): don't pass the factory into this function. Instead use ctor deps
|
||||
factory: &CliFactory,
|
||||
|
|
|
@ -35,6 +35,7 @@ use import_map::ImportMapWithDiagnostics;
|
|||
use import_map::SpecifierMapEntry;
|
||||
use tokio::sync::Semaphore;
|
||||
|
||||
use super::ConfigUpdater;
|
||||
use crate::args::CliLockfile;
|
||||
use crate::graph_container::MainModuleGraphContainer;
|
||||
use crate::graph_container::ModuleGraphContainer;
|
||||
|
@ -45,8 +46,6 @@ use crate::npm::CliNpmResolver;
|
|||
use crate::npm::NpmFetchResolver;
|
||||
use crate::util::sync::AtomicFlag;
|
||||
|
||||
use super::ConfigUpdater;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ImportMapKind {
|
||||
Inline,
|
||||
|
|
|
@ -12,6 +12,10 @@ use deno_semver::StackString;
|
|||
use deno_semver::VersionReq;
|
||||
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::Flags;
|
||||
use crate::args::OutdatedFlags;
|
||||
|
@ -21,11 +25,6 @@ use crate::jsr::JsrFetchResolver;
|
|||
use crate::npm::NpmFetchResolver;
|
||||
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)]
|
||||
struct OutdatedPackage {
|
||||
kind: DepKind,
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::http_util;
|
||||
use crate::http_util::HttpClient;
|
||||
use std::collections::HashMap;
|
||||
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::prelude::BASE64_STANDARD;
|
||||
use base64::Engine as _;
|
||||
|
@ -27,8 +24,12 @@ use sha2::Digest;
|
|||
use spki::der::asn1;
|
||||
use spki::der::pem::LineEnding;
|
||||
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";
|
||||
|
||||
|
@ -706,10 +707,11 @@ async fn testify(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::env;
|
||||
|
||||
use super::ProvenanceAttestation;
|
||||
use super::Subject;
|
||||
use super::SubjectDigest;
|
||||
use std::env;
|
||||
|
||||
#[test]
|
||||
fn slsa_github_actions() {
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
// 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 deno_ast::MediaType;
|
||||
use deno_core::anyhow::Context;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::url::Url;
|
||||
use sha2::Digest;
|
||||
use std::fmt::Write as FmtWrite;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use tar::Header;
|
||||
|
||||
use crate::cache::LazyGraphSourceParser;
|
||||
|
||||
use super::diagnostics::PublishDiagnostic;
|
||||
use super::diagnostics::PublishDiagnosticsCollector;
|
||||
use super::paths::CollectedPublishPath;
|
||||
use super::unfurl::SpecifierUnfurler;
|
||||
use crate::cache::LazyGraphSourceParser;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PublishableTarballFile {
|
||||
|
|
|
@ -655,10 +655,6 @@ fn to_range(
|
|||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::resolver::SloppyImportsCachedFs;
|
||||
|
||||
use super::*;
|
||||
use crate::sys::CliSys;
|
||||
use deno_ast::MediaType;
|
||||
use deno_ast::ModuleSpecifier;
|
||||
use deno_config::workspace::ResolverWorkspaceJsrPackage;
|
||||
|
@ -671,6 +667,10 @@ mod tests {
|
|||
use pretty_assertions::assert_eq;
|
||||
use test_util::testdata_path;
|
||||
|
||||
use super::*;
|
||||
use crate::resolver::SloppyImportsCachedFs;
|
||||
use crate::sys::CliSys;
|
||||
|
||||
fn parse_ast(specifier: &Url, source_code: &str) -> ParsedSource {
|
||||
let media_type = MediaType::from_specifier(specifier);
|
||||
deno_ast::parse_module(deno_ast::ParseParams {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use deno_core::anyhow::anyhow;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::serde_json;
|
||||
use deno_core::serde_json::Value;
|
||||
use std::cell::RefCell;
|
||||
use tokio::sync::mpsc::channel;
|
||||
use tokio::sync::mpsc::unbounded_channel;
|
||||
use tokio::sync::mpsc::Receiver;
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::cdp;
|
||||
use crate::colors;
|
||||
use std::borrow::Cow;
|
||||
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::token::BinOpToken;
|
||||
use deno_ast::swc::parser::token::Token;
|
||||
|
@ -32,14 +36,11 @@ use rustyline::Modifiers;
|
|||
use rustyline::RepeatCount;
|
||||
use rustyline_derive::Helper;
|
||||
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::session::REPL_INTERNALS_NAME;
|
||||
use crate::cdp;
|
||||
use crate::colors;
|
||||
|
||||
// Provides helpers to the editor like validation for multi-line edits, completion candidates for
|
||||
// tab completion.
|
||||
|
|
|
@ -2,9 +2,15 @@
|
|||
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
|
||||
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::Flags;
|
||||
use crate::args::ReplFlags;
|
||||
|
@ -13,12 +19,6 @@ use crate::colors;
|
|||
use crate::factory::CliFactory;
|
||||
use crate::file_fetcher::CliFileFetcher;
|
||||
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 editor;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue