Skip to content

Commit

Permalink
BREAKING(unstable): remove --compat mode (#15678)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bartlomieju authored and kt3k committed Sep 9, 2022
1 parent a83a263 commit beff2f8
Show file tree
Hide file tree
Showing 79 changed files with 12 additions and 2,355 deletions.
43 changes: 0 additions & 43 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 0 additions & 8 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit beff2f8

Please sign in to comment.