diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-04-27 12:44:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 12:44:36 +0200 |
commit | baf7092ea2ac97bee93213ddf639bb9b41f0888e (patch) | |
tree | a89f9794f4e1fcb0cd8eae9d1e8058d90668a8f4 /cli | |
parent | 83770e898e365579dcc30650f706116a312bd9f6 (diff) |
remove --unstable flag from CLI features (#10190)
Diffstat (limited to 'cli')
-rw-r--r-- | cli/flags.rs | 93 | ||||
-rw-r--r-- | cli/main.rs | 18 | ||||
-rw-r--r-- | cli/program_state.rs | 8 |
3 files changed, 27 insertions, 92 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 0a1ae5ee8..9c3316497 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -482,12 +482,12 @@ fn compile_subcommand<'a, 'b>() -> App<'a, 'b> { .takes_value(true) .possible_values(&["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "x86_64-apple-darwin", "aarch64-apple-darwin"]) ) - .about("Compile the script into a self contained executable") + .about("UNSTABLE: Compile the script into a self contained executable") .long_about( - "Compiles the given script into a self contained executable. + "UNSTABLE: Compiles the given script into a self contained executable. - deno compile --unstable -A https://deno.land/std/http/file_server.ts - deno compile --unstable --output /usr/local/bin/color_util https://deno.land/std/examples/colors.ts + deno compile -A https://deno.land/std/http/file_server.ts + deno compile --output /usr/local/bin/color_util https://deno.land/std/examples/colors.ts Any flags passed which affect runtime behavior, such as '--unstable', '--allow-*', '--v8-flags', etc. are encoded into the output executable and used @@ -751,7 +751,7 @@ Ignore formatting a file by adding an ignore comment at the top of the file: .takes_value(true) .use_delimiter(true) .require_equals(true) - .help("Ignore formatting particular source files. Use with --unstable"), + .help("Ignore formatting particular source files"), ) .arg( Arg::with_name("files") @@ -795,7 +795,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.", .arg( Arg::with_name("json") .long("json") - .help("Outputs the information in JSON format") + .help("UNSTABLE: Outputs the information in JSON format") .takes_value(false), ) } @@ -873,25 +873,25 @@ https://deno.land/manual/getting_started/setup_your_environment#editors-and-ides fn lint_subcommand<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("lint") - .about("Lint source files") + .about("UNSTABLE: Lint source files") .long_about( - "Lint JavaScript/TypeScript source code. + "UNSTABLE: Lint JavaScript/TypeScript source code. - deno lint --unstable - deno lint --unstable myfile1.ts myfile2.js + deno lint + deno lint myfile1.ts myfile2.js Print result as JSON: - deno lint --unstable --json + deno lint --json Read from stdin: - cat file.ts | deno lint --unstable - - cat file.ts | deno lint --unstable --json - + cat file.ts | deno lint - + cat file.ts | deno lint --json - List available rules: - deno lint --unstable --rules + deno lint --rules Ignore diagnostics on the next line by preceding it with an ignore comment and rule name: @@ -914,7 +914,6 @@ Ignore linting a file by adding an ignore comment at the top of the file: .arg( Arg::with_name("ignore") .long("ignore") - .requires("unstable") .takes_value(true) .use_delimiter(true) .require_equals(true) @@ -982,8 +981,7 @@ fn test_subcommand<'a, 'b>() -> App<'a, 'b> { Arg::with_name("no-run") .long("no-run") .help("Cache test modules, but don't run tests") - .takes_value(false) - .requires("unstable"), + .takes_value(false), ) .arg( Arg::with_name("fail-fast") @@ -1010,10 +1008,9 @@ fn test_subcommand<'a, 'b>() -> App<'a, 'b> { .long("coverage") .require_equals(true) .takes_value(true) - .requires("unstable") .conflicts_with("inspect") .conflicts_with("inspect-brk") - .help("Collect coverage profile data"), + .help("UNSTABLE: Collect coverage profile data"), ) .arg( Arg::with_name("files") @@ -1333,11 +1330,10 @@ fn seed_arg<'a, 'b>() -> Arg<'a, 'b> { fn watch_arg<'a, 'b>() -> Arg<'a, 'b> { Arg::with_name("watch") - .requires("unstable") .long("watch") - .help("Watch for file changes and restart process automatically") + .help("UNSTABLE: Watch for file changes and restart process automatically") .long_help( - "Watch for file changes and restart process automatically. + "UNSTABLE: Watch for file changes and restart process automatically. Only local files from entry point module graph are watched.", ) } @@ -2010,13 +2006,7 @@ mod tests { #[test] fn run_watch() { - let r = flags_from_vec(svec![ - "deno", - "run", - "--unstable", - "--watch", - "script.ts" - ]); + let r = flags_from_vec(svec!["deno", "run", "--watch", "script.ts"]); let flags = r.unwrap(); assert_eq!( flags, @@ -2025,7 +2015,6 @@ mod tests { script: "script.ts".to_string(), }, watch: true, - unstable: true, ..Flags::default() } ); @@ -2228,7 +2217,7 @@ mod tests { } ); - let r = flags_from_vec(svec!["deno", "fmt", "--watch", "--unstable"]); + let r = flags_from_vec(svec!["deno", "fmt", "--watch"]); assert_eq!( r.unwrap(), Flags { @@ -2239,7 +2228,6 @@ mod tests { ext: "ts".to_string(), }, watch: true, - unstable: true, ..Flags::default() } ); @@ -2249,7 +2237,6 @@ mod tests { "fmt", "--check", "--watch", - "--unstable", "foo.ts", "--ignore=bar.js" ]); @@ -2263,7 +2250,6 @@ mod tests { ext: "ts".to_string(), }, watch: true, - unstable: true, ..Flags::default() } ); @@ -2283,13 +2269,7 @@ mod tests { #[test] fn lint() { - let r = flags_from_vec(svec![ - "deno", - "lint", - "--unstable", - "script_1.ts", - "script_2.ts" - ]); + let r = flags_from_vec(svec!["deno", "lint", "script_1.ts", "script_2.ts"]); assert_eq!( r.unwrap(), Flags { @@ -2302,17 +2282,12 @@ mod tests { json: false, ignore: vec![], }, - unstable: true, ..Flags::default() } ); - let r = flags_from_vec(svec![ - "deno", - "lint", - "--unstable", - "--ignore=script_1.ts,script_2.ts" - ]); + let r = + flags_from_vec(svec!["deno", "lint", "--ignore=script_1.ts,script_2.ts"]); assert_eq!( r.unwrap(), Flags { @@ -2325,12 +2300,11 @@ mod tests { PathBuf::from("script_2.ts") ], }, - unstable: true, ..Flags::default() } ); - let r = flags_from_vec(svec!["deno", "lint", "--unstable", "--rules"]); + let r = flags_from_vec(svec!["deno", "lint", "--rules"]); assert_eq!( r.unwrap(), Flags { @@ -2340,18 +2314,11 @@ mod tests { json: false, ignore: vec![], }, - unstable: true, ..Flags::default() } ); - let r = flags_from_vec(svec![ - "deno", - "lint", - "--unstable", - "--json", - "script_1.ts" - ]); + let r = flags_from_vec(svec!["deno", "lint", "--json", "script_1.ts"]); assert_eq!( r.unwrap(), Flags { @@ -2361,7 +2328,6 @@ mod tests { json: true, ignore: vec![], }, - unstable: true, ..Flags::default() } ); @@ -2894,13 +2860,7 @@ mod tests { #[test] fn bundle_watch() { - let r = flags_from_vec(svec![ - "deno", - "bundle", - "--watch", - "--unstable", - "source.ts" - ]); + let r = flags_from_vec(svec!["deno", "bundle", "--watch", "source.ts"]); assert_eq!( r.unwrap(), Flags { @@ -2909,7 +2869,6 @@ mod tests { out_file: None, }, watch: true, - unstable: true, ..Flags::default() } ) diff --git a/cli/main.rs b/cli/main.rs index f33bdd3a9..d66bdcee9 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -44,7 +44,6 @@ use crate::flags::Flags; use crate::fmt_errors::PrettyJsError; use crate::media_type::MediaType; use crate::module_loader::CliModuleLoader; -use crate::program_state::exit_unstable; use crate::program_state::ProgramState; use crate::source_maps::apply_source_map; use crate::specifier_handler::FetchHandler; @@ -320,10 +319,6 @@ async fn compile_command( args: Vec<String>, target: Option<String>, ) -> Result<(), AnyError> { - if !flags.unstable { - exit_unstable("compile"); - } - let debug = flags.log_level == Some(log::Level::Debug); let run_flags = @@ -382,9 +377,6 @@ async fn info_command( maybe_specifier: Option<String>, json: bool, ) -> Result<(), AnyError> { - if json && !flags.unstable { - exit_unstable("--json"); - } let program_state = ProgramState::build(flags).await?; if let Some(specifier) = maybe_specifier { let specifier = resolve_url_or_path(&specifier)?; @@ -441,16 +433,12 @@ async fn lsp_command() -> Result<(), AnyError> { } async fn lint_command( - flags: Flags, + _flags: Flags, files: Vec<PathBuf>, list_rules: bool, ignore: Vec<PathBuf>, json: bool, ) -> Result<(), AnyError> { - if !flags.unstable { - exit_unstable("lint"); - } - if list_rules { tools::lint::print_rules_list(json); return Ok(()); @@ -898,10 +886,6 @@ async fn coverage_command( exclude: Vec<String>, lcov: bool, ) -> Result<(), AnyError> { - if !flags.unstable { - exit_unstable("coverage"); - } - if files.is_empty() { println!("No matching coverage profiles found"); std::process::exit(1); diff --git a/cli/program_state.rs b/cli/program_state.rs index 056928e7b..c52f4efef 100644 --- a/cli/program_state.rs +++ b/cli/program_state.rs @@ -34,14 +34,6 @@ use std::fs::read; use std::sync::Arc; use std::sync::Mutex; -pub fn exit_unstable(api_name: &str) { - eprintln!( - "Unstable API '{}'. The --unstable flag must be provided.", - api_name - ); - std::process::exit(70); -} - /// This structure represents state of single "deno" program. /// /// It is shared by all created workers (thus V8 isolates). |