mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
BREAKING(unstable): remove --compat mode (#15678)
This commit removes "compat" mode. We shipped support for "npm:" specifier support in v1.25 and that is preferred way to interact with Node code that we will iterate and improve upon.
This commit is contained in:
parent
fc4025c878
commit
e324151520
79 changed files with 12 additions and 2355 deletions
|
@ -312,9 +312,6 @@ pub struct Flags {
|
|||
pub lock: Option<PathBuf>,
|
||||
pub log_level: Option<Level>,
|
||||
pub no_remote: bool,
|
||||
/// If true, a list of Node built-in modules will be injected into
|
||||
/// the import map.
|
||||
pub compat: bool,
|
||||
pub no_prompt: bool,
|
||||
pub reload: bool,
|
||||
pub seed: Option<u64>,
|
||||
|
@ -1869,7 +1866,6 @@ fn runtime_args(
|
|||
.arg(v8_flags_arg())
|
||||
.arg(seed_arg())
|
||||
.arg(enable_testing_features_arg())
|
||||
.arg(compat_arg())
|
||||
}
|
||||
|
||||
fn inspect_args(app: Command) -> Command {
|
||||
|
@ -2009,21 +2005,6 @@ fn seed_arg<'a>() -> Arg<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
static COMPAT_HELP: Lazy<String> = Lazy::new(|| {
|
||||
format!(
|
||||
"See https://deno.land/manual@v{}/node/compatibility_mode",
|
||||
SHORT_VERSION.as_str()
|
||||
)
|
||||
});
|
||||
|
||||
fn compat_arg<'a>() -> Arg<'a> {
|
||||
Arg::new("compat")
|
||||
.long("compat")
|
||||
.requires("unstable")
|
||||
.help("UNSTABLE: Node compatibility mode.")
|
||||
.long_help(COMPAT_HELP.as_str())
|
||||
}
|
||||
|
||||
fn watch_arg<'a>(takes_files: bool) -> Arg<'a> {
|
||||
let arg = Arg::new("watch")
|
||||
.long("watch")
|
||||
|
@ -2916,7 +2897,6 @@ fn runtime_args_parse(
|
|||
location_arg_parse(flags, matches);
|
||||
v8_flags_arg_parse(flags, matches);
|
||||
seed_arg_parse(flags, matches);
|
||||
compat_arg_parse(flags, matches);
|
||||
enable_testing_features_arg_parse(flags, matches);
|
||||
}
|
||||
|
||||
|
@ -3001,12 +2981,6 @@ fn seed_arg_parse(flags: &mut Flags, matches: &ArgMatches) {
|
|||
}
|
||||
}
|
||||
|
||||
fn compat_arg_parse(flags: &mut Flags, matches: &ArgMatches) {
|
||||
if matches.is_present("compat") {
|
||||
flags.compat = true;
|
||||
}
|
||||
}
|
||||
|
||||
fn no_check_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
|
||||
if let Some(cache_type) = matches.value_of("no-check") {
|
||||
match cache_type {
|
||||
|
@ -5565,23 +5539,6 @@ mod tests {
|
|||
.contains("Expected protocol \"http\" or \"https\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compat() {
|
||||
let r =
|
||||
flags_from_vec(svec!["deno", "run", "--compat", "--unstable", "foo.js"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
subcommand: DenoSubcommand::Run(RunFlags {
|
||||
script: "foo.js".to_string(),
|
||||
}),
|
||||
compat: true,
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_config_path_args() {
|
||||
let flags = flags_from_vec(svec!["deno", "run", "foo.js"]).unwrap();
|
||||
|
|
|
@ -35,7 +35,6 @@ use std::net::SocketAddr;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use crate::args::config_file::JsxImportSourceConfig;
|
||||
use crate::compat;
|
||||
use crate::deno_dir::DenoDir;
|
||||
use crate::emit::get_ts_config_for_emit;
|
||||
use crate::emit::TsConfigType;
|
||||
|
@ -230,9 +229,6 @@ impl CliOptions {
|
|||
imports.extend(config_imports);
|
||||
}
|
||||
}
|
||||
if self.flags.compat {
|
||||
imports.extend(compat::get_node_imports());
|
||||
}
|
||||
if imports.is_empty() {
|
||||
Ok(None)
|
||||
} else {
|
||||
|
@ -277,10 +273,6 @@ impl CliOptions {
|
|||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn compat(&self) -> bool {
|
||||
self.flags.compat
|
||||
}
|
||||
|
||||
pub fn coverage_dir(&self) -> Option<String> {
|
||||
fn allow_coverage(sub_command: &DenoSubcommand) -> bool {
|
||||
match sub_command {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue