Skip to content

Commit 75f7ca0

Browse files
Merge branch 'main' into jsdocs-websockets
2 parents 5c862cc + 15cfa05 commit 75f7ca0

File tree

128 files changed

+9512
-3128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+9512
-3128
lines changed

Cargo.lock

+170-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ deno_ast = { version = "=0.44.0", features = ["transpiling"] }
5454
deno_core = { version = "0.333.0" }
5555

5656
deno_bench_util = { version = "0.183.0", path = "./bench_util" }
57-
deno_config = { version = "=0.47.1", features = ["workspace"] }
57+
deno_config = { version = "=0.48.0", features = ["workspace"] }
5858
deno_lockfile = "=0.24.0"
5959
deno_media_type = { version = "=0.2.5", features = ["module_specifier"] }
6060
deno_npm = "=0.27.2"
@@ -123,7 +123,7 @@ cbc = { version = "=0.1.2", features = ["alloc"] }
123123
# Instead use util::time::utc_now()
124124
chrono = { version = "0.4", default-features = false, features = ["std", "serde"] }
125125
color-print = "0.3.5"
126-
console_static_text = "=0.8.1"
126+
console_static_text = "=0.8.3"
127127
ctr = { version = "0.9.2", features = ["alloc"] }
128128
dashmap = "5.5.3"
129129
data-encoding = "2.3.3"
@@ -155,6 +155,7 @@ hyper = { version = "1.6.0", features = ["full"] }
155155
hyper-rustls = { version = "0.27.2", default-features = false, features = ["http1", "http2", "tls12", "ring"] }
156156
hyper-util = { version = "0.1.10", features = ["tokio", "client", "client-legacy", "server", "server-auto"] }
157157
hyper_v014 = { package = "hyper", version = "0.14.26", features = ["runtime", "http1"] }
158+
import_map = { version = "0.21.0", features = ["ext"] }
158159
indexmap = { version = "2", features = ["serde"] }
159160
ipnet = "2.3"
160161
jsonc-parser = { version = "=0.26.2", features = ["serde"] }
@@ -184,7 +185,7 @@ rand = "=0.8.5"
184185
regex = "^1.7.0"
185186
reqwest = { version = "=0.12.5", default-features = false, features = ["rustls-tls", "stream", "gzip", "brotli", "socks", "json", "http2"] } # pinned because of https://github.com/seanmonstar/reqwest/pull/1955
186187
ring = "^0.17.0"
187-
rusqlite = { version = "0.32.0", features = ["unlock_notify", "bundled"] }
188+
rusqlite = { version = "0.32.0", features = ["unlock_notify", "bundled", "session"] }
188189
rustls = { version = "0.23.11", default-features = false, features = ["logging", "std", "tls12", "ring"] }
189190
rustls-pemfile = "2"
190191
rustls-tokio-stream = "=0.3.0"

cli/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ deno_doc = { version = "=0.164.0", features = ["rust", "comrak"] }
7474
deno_error.workspace = true
7575
deno_graph = { version = "=0.87.2" }
7676
deno_lib.workspace = true
77-
deno_lint = { version = "0.70.0" }
77+
deno_lint = { version = "0.71.0" }
7878
deno_lockfile.workspace = true
7979
deno_media_type = { workspace = true, features = ["data_url", "decoding", "module_specifier"] }
8080
deno_npm.workspace = true
@@ -105,6 +105,7 @@ clap_complete = "=4.5.24"
105105
clap_complete_fig = "=4.5.2"
106106
color-print.workspace = true
107107
console_static_text.workspace = true
108+
crossterm = "0.28.1"
108109
dashmap.workspace = true
109110
data-encoding.workspace = true
110111
dhat = { version = "0.3.3", optional = true }
@@ -169,6 +170,7 @@ tower-lsp.workspace = true
169170
tracing = { version = "0.1", features = ["log", "default"] }
170171
twox-hash.workspace = true
171172
typed-arena = "=2.0.2"
173+
unicode-width = "0.1.3"
172174
uuid = { workspace = true, features = ["serde"] }
173175
walkdir.workspace = true
174176
which.workspace = true

cli/args/flags.rs

+44-10
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ pub enum DenoSubcommand {
475475

476476
#[derive(Clone, Debug, PartialEq, Eq)]
477477
pub enum OutdatedKind {
478-
Update { latest: bool },
478+
Update { latest: bool, interactive: bool },
479479
PrintOutdated { compatible: bool },
480480
}
481481

@@ -499,6 +499,7 @@ impl DenoSubcommand {
499499
| Self::Jupyter(_)
500500
| Self::Repl(_)
501501
| Self::Bench(_)
502+
| Self::Lint(_)
502503
| Self::Lsp
503504
)
504505
}
@@ -2660,7 +2661,7 @@ Specific version requirements to update to can be specified:
26602661
.long("latest")
26612662
.action(ArgAction::SetTrue)
26622663
.help(
2663-
"Update to the latest version, regardless of semver constraints",
2664+
"Consider the latest version, regardless of semver constraints",
26642665
)
26652666
.conflicts_with("compatible"),
26662667
)
@@ -2669,15 +2670,21 @@ Specific version requirements to update to can be specified:
26692670
.long("update")
26702671
.short('u')
26712672
.action(ArgAction::SetTrue)
2672-
.conflicts_with("compatible")
26732673
.help("Update dependency versions"),
26742674
)
2675+
.arg(
2676+
Arg::new("interactive")
2677+
.long("interactive")
2678+
.short('i')
2679+
.action(ArgAction::SetTrue)
2680+
.requires("update")
2681+
.help("Interactively select which dependencies to update")
2682+
)
26752683
.arg(
26762684
Arg::new("compatible")
26772685
.long("compatible")
26782686
.action(ArgAction::SetTrue)
2679-
.help("Only output versions that satisfy semver requirements")
2680-
.conflicts_with("update"),
2687+
.help("Only consider versions that satisfy semver requirements")
26812688
)
26822689
.arg(
26832690
Arg::new("recursive")
@@ -4462,7 +4469,11 @@ fn outdated_parse(
44624469
let update = matches.get_flag("update");
44634470
let kind = if update {
44644471
let latest = matches.get_flag("latest");
4465-
OutdatedKind::Update { latest }
4472+
let interactive = matches.get_flag("interactive");
4473+
OutdatedKind::Update {
4474+
latest,
4475+
interactive,
4476+
}
44664477
} else {
44674478
let compatible = matches.get_flag("compatible");
44684479
OutdatedKind::PrintOutdated { compatible }
@@ -11646,31 +11657,43 @@ Usage: deno repl [OPTIONS] [-- [ARGS]...]\n"
1164611657
svec!["--update"],
1164711658
OutdatedFlags {
1164811659
filters: vec![],
11649-
kind: OutdatedKind::Update { latest: false },
11660+
kind: OutdatedKind::Update {
11661+
latest: false,
11662+
interactive: false,
11663+
},
1165011664
recursive: false,
1165111665
},
1165211666
),
1165311667
(
1165411668
svec!["--update", "--latest"],
1165511669
OutdatedFlags {
1165611670
filters: vec![],
11657-
kind: OutdatedKind::Update { latest: true },
11671+
kind: OutdatedKind::Update {
11672+
latest: true,
11673+
interactive: false,
11674+
},
1165811675
recursive: false,
1165911676
},
1166011677
),
1166111678
(
1166211679
svec!["--update", "--recursive"],
1166311680
OutdatedFlags {
1166411681
filters: vec![],
11665-
kind: OutdatedKind::Update { latest: false },
11682+
kind: OutdatedKind::Update {
11683+
latest: false,
11684+
interactive: false,
11685+
},
1166611686
recursive: true,
1166711687
},
1166811688
),
1166911689
(
1167011690
svec!["--update", "@foo/bar"],
1167111691
OutdatedFlags {
1167211692
filters: svec!["@foo/bar"],
11673-
kind: OutdatedKind::Update { latest: false },
11693+
kind: OutdatedKind::Update {
11694+
latest: false,
11695+
interactive: false,
11696+
},
1167411697
recursive: false,
1167511698
},
1167611699
),
@@ -11682,6 +11705,17 @@ Usage: deno repl [OPTIONS] [-- [ARGS]...]\n"
1168211705
recursive: false,
1168311706
},
1168411707
),
11708+
(
11709+
svec!["--update", "--latest", "--interactive"],
11710+
OutdatedFlags {
11711+
filters: svec![],
11712+
kind: OutdatedKind::Update {
11713+
latest: true,
11714+
interactive: true,
11715+
},
11716+
recursive: false,
11717+
},
11718+
),
1168511719
];
1168611720
for (input, expected) in cases {
1168711721
let mut args = svec!["deno", "outdated"];

cli/args/mod.rs

+32-10
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ pub struct LintOptions {
366366
pub rules: LintRulesConfig,
367367
pub files: FilePatterns,
368368
pub fix: bool,
369+
pub plugins: Vec<Url>,
369370
}
370371

371372
impl Default for LintOptions {
@@ -380,20 +381,41 @@ impl LintOptions {
380381
rules: Default::default(),
381382
files: FilePatterns::new_with_base(base),
382383
fix: false,
384+
plugins: vec![],
383385
}
384386
}
385387

386-
pub fn resolve(lint_config: LintConfig, lint_flags: &LintFlags) -> Self {
387-
Self {
388+
pub fn resolve(
389+
dir_path: PathBuf,
390+
lint_config: LintConfig,
391+
lint_flags: &LintFlags,
392+
) -> Result<Self, AnyError> {
393+
let rules = resolve_lint_rules_options(
394+
lint_config.options.rules,
395+
lint_flags.maybe_rules_tags.clone(),
396+
lint_flags.maybe_rules_include.clone(),
397+
lint_flags.maybe_rules_exclude.clone(),
398+
);
399+
400+
let plugins = {
401+
let plugin_specifiers = lint_config.options.plugins;
402+
let mut plugins = Vec::with_capacity(plugin_specifiers.len());
403+
for plugin in &plugin_specifiers {
404+
// TODO(bartlomieju): handle import-mapped specifiers
405+
let url = resolve_url_or_path(plugin, &dir_path)?;
406+
plugins.push(url);
407+
}
408+
// ensure stability for hasher
409+
plugins.sort_unstable();
410+
plugins
411+
};
412+
413+
Ok(Self {
388414
files: lint_config.files,
389-
rules: resolve_lint_rules_options(
390-
lint_config.options.rules,
391-
lint_flags.maybe_rules_tags.clone(),
392-
lint_flags.maybe_rules_include.clone(),
393-
lint_flags.maybe_rules_exclude.clone(),
394-
),
415+
rules,
395416
fix: lint_flags.fix,
396-
}
417+
plugins,
418+
})
397419
}
398420
}
399421

@@ -759,7 +781,7 @@ impl CliOptions {
759781
.resolve_lint_config_for_members(&cli_arg_patterns)?;
760782
let mut result = Vec::with_capacity(member_configs.len());
761783
for (ctx, config) in member_configs {
762-
let options = LintOptions::resolve(config, lint_flags);
784+
let options = LintOptions::resolve(ctx.dir_path(), config, lint_flags)?;
763785
result.push((ctx, options));
764786
}
765787
Ok(result)

cli/factory.rs

+9-17
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::sync::Arc;
99
use deno_cache_dir::npm::NpmCacheDir;
1010
use deno_config::workspace::Workspace;
1111
use deno_config::workspace::WorkspaceDirectory;
12-
use deno_config::workspace::WorkspaceResolver;
1312
use deno_core::anyhow::Context;
1413
use deno_core::error::AnyError;
1514
use deno_core::futures::FutureExt;
@@ -38,6 +37,7 @@ use deno_resolver::factory::ResolverFactoryOptions;
3837
use deno_resolver::factory::SpecifiedImportMapProvider;
3938
use deno_resolver::npm::managed::NpmResolutionCell;
4039
use deno_resolver::npm::DenoInNpmPackageChecker;
40+
use deno_resolver::workspace::WorkspaceResolver;
4141
use deno_runtime::deno_fs;
4242
use deno_runtime::deno_fs::RealFs;
4343
use deno_runtime::deno_permissions::Permissions;
@@ -97,7 +97,6 @@ use crate::resolver::CliDenoResolver;
9797
use crate::resolver::CliNpmGraphResolver;
9898
use crate::resolver::CliNpmReqResolver;
9999
use crate::resolver::CliResolver;
100-
use crate::resolver::CliSloppyImportsResolver;
101100
use crate::resolver::FoundPackageJsonDepFlag;
102101
use crate::standalone::binary::DenoCompileBinaryWriter;
103102
use crate::sys::CliSys;
@@ -160,7 +159,8 @@ struct CliSpecifiedImportMapProvider {
160159
impl SpecifiedImportMapProvider for CliSpecifiedImportMapProvider {
161160
async fn get(
162161
&self,
163-
) -> Result<Option<deno_config::workspace::SpecifiedImportMap>, AnyError> {
162+
) -> Result<Option<deno_resolver::workspace::SpecifiedImportMap>, AnyError>
163+
{
164164
async fn resolve_import_map_value_from_specifier(
165165
specifier: &Url,
166166
file_fetcher: &CliFileFetcher,
@@ -189,7 +189,7 @@ impl SpecifiedImportMapProvider for CliSpecifiedImportMapProvider {
189189
.with_context(|| {
190190
format!("Unable to load '{}' import map", specifier)
191191
})?;
192-
Ok(Some(deno_config::workspace::SpecifiedImportMap {
192+
Ok(Some(deno_resolver::workspace::SpecifiedImportMap {
193193
base_url: specifier,
194194
value,
195195
}))
@@ -199,7 +199,7 @@ impl SpecifiedImportMapProvider for CliSpecifiedImportMapProvider {
199199
self.workspace_external_import_map_loader.get_or_load()?
200200
{
201201
let path_url = deno_path_util::url_from_file_path(&import_map.path)?;
202-
Ok(Some(deno_config::workspace::SpecifiedImportMap {
202+
Ok(Some(deno_resolver::workspace::SpecifiedImportMap {
203203
base_url: path_url,
204204
value: import_map.value.clone(),
205205
}))
@@ -646,7 +646,6 @@ impl CliFactory {
646646
ResolverFactoryOptions {
647647
conditions_from_resolution_mode: Default::default(),
648648
node_resolution_cache: Some(Arc::new(NodeResolutionThreadLocalCache)),
649-
no_sloppy_imports_cache: false,
650649
npm_system_info: self.flags.subcommand.npm_system_info(),
651650
specified_import_map: Some(Box::new(CliSpecifiedImportMapProvider {
652651
cli_options: self.cli_options()?.clone(),
@@ -663,7 +662,7 @@ impl CliFactory {
663662
DenoSubcommand::Publish(_) => {
664663
// the node_modules directory is not published to jsr, so resolve
665664
// dependencies via the package.json rather than using node resolution
666-
Some(deno_config::workspace::PackageJsonDepResolution::Enabled)
665+
Some(deno_resolver::workspace::PackageJsonDepResolution::Enabled)
667666
}
668667
_ => None,
669668
},
@@ -672,12 +671,6 @@ impl CliFactory {
672671
})
673672
}
674673

675-
pub fn sloppy_imports_resolver(
676-
&self,
677-
) -> Result<Option<&Arc<CliSloppyImportsResolver>>, AnyError> {
678-
self.resolver_factory()?.sloppy_imports_resolver()
679-
}
680-
681674
pub fn workspace(&self) -> Result<&Arc<Workspace>, AnyError> {
682675
Ok(&self.workspace_directory()?.workspace)
683676
}
@@ -790,10 +783,9 @@ impl CliFactory {
790783
}
791784

792785
pub async fn lint_rule_provider(&self) -> Result<LintRuleProvider, AnyError> {
793-
Ok(LintRuleProvider::new(
794-
self.sloppy_imports_resolver()?.cloned(),
795-
Some(self.workspace_resolver().await?.clone()),
796-
))
786+
Ok(LintRuleProvider::new(Some(
787+
self.workspace_resolver().await?.clone(),
788+
)))
797789
}
798790

799791
pub async fn node_resolver(&self) -> Result<&Arc<CliNodeResolver>, AnyError> {

cli/graph_util.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ use deno_graph::SpecifierError;
3434
use deno_graph::WorkspaceFastCheckOption;
3535
use deno_path_util::url_to_file_path;
3636
use deno_resolver::npm::DenoInNpmPackageChecker;
37-
use deno_resolver::sloppy_imports::SloppyImportsCachedFs;
38-
use deno_resolver::sloppy_imports::SloppyImportsResolutionKind;
37+
use deno_resolver::workspace::sloppy_imports_resolve;
3938
use deno_runtime::deno_node;
4039
use deno_runtime::deno_permissions::PermissionsContainer;
4140
use deno_semver::jsr::JsrDepPackageReq;
@@ -62,7 +61,6 @@ use crate::npm::CliNpmResolver;
6261
use crate::resolver::CliCjsTracker;
6362
use crate::resolver::CliNpmGraphResolver;
6463
use crate::resolver::CliResolver;
65-
use crate::resolver::CliSloppyImportsResolver;
6664
use crate::sys::CliSys;
6765
use crate::tools::check;
6866
use crate::tools::check::CheckError;
@@ -949,11 +947,14 @@ pub fn maybe_additional_sloppy_imports_message(
949947
sys: &CliSys,
950948
specifier: &ModuleSpecifier,
951949
) -> Option<String> {
950+
let (resolved, sloppy_reason) = sloppy_imports_resolve(
951+
specifier,
952+
deno_resolver::workspace::ResolutionKind::Execution,
953+
sys.clone(),
954+
)?;
952955
Some(format!(
953956
"{} {}",
954-
CliSloppyImportsResolver::new(SloppyImportsCachedFs::new(sys.clone()))
955-
.resolve(specifier, SloppyImportsResolutionKind::Execution)?
956-
.as_suggestion_message(),
957+
sloppy_reason.suggestion_message_for_specifier(&resolved),
957958
RUN_WITH_SLOPPY_IMPORTS_MSG
958959
))
959960
}

0 commit comments

Comments
 (0)