mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
feat(npm): support bare specifiers from package.json in more subcommands and language server (#17891)
This commit is contained in:
parent
214bdbbc2b
commit
344317ec50
41 changed files with 472 additions and 95 deletions
|
@ -19,6 +19,8 @@ use std::num::NonZeroUsize;
|
|||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::util::fs::canonicalize_path;
|
||||
|
||||
use super::flags_allow_net;
|
||||
|
||||
static LONG_VERSION: Lazy<String> = Lazy::new(|| {
|
||||
|
@ -499,6 +501,16 @@ impl Flags {
|
|||
Some(vec![])
|
||||
}
|
||||
}
|
||||
Task(TaskFlags {
|
||||
cwd: Some(path), ..
|
||||
}) => {
|
||||
// attempt to resolve the config file from the task subcommand's
|
||||
// `--cwd` when specified
|
||||
match canonicalize_path(&PathBuf::from(path)) {
|
||||
Ok(path) => Some(vec![path]),
|
||||
Err(_) => Some(vec![]),
|
||||
}
|
||||
}
|
||||
_ => Some(vec![]),
|
||||
}
|
||||
}
|
||||
|
@ -533,7 +545,8 @@ impl Flags {
|
|||
.to_file_path()
|
||||
.ok()
|
||||
}
|
||||
Task(TaskFlags { cwd: None, .. }) => std::env::current_dir().ok(),
|
||||
Task(_) | Check(_) | Coverage(_) | Cache(_) | Info(_) | Eval(_)
|
||||
| Test(_) | Bench(_) => std::env::current_dir().ok(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue