summaryrefslogtreecommitdiff
path: root/cli/lib.rs
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-04-30 17:23:40 +0200
committerGitHub <noreply@github.com>2020-04-30 11:23:40 -0400
commit80e22111416751ce34dbc5cb32ffa9f293517370 (patch)
tree5b3fe5d16ee07143e5dcb2c766a1f48c296ad9d6 /cli/lib.rs
parent4993a6504b4b447e0e02454094cffb02ee18c081 (diff)
Unstable methods should not appear in runtime or d.ts (#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'cli/lib.rs')
-rw-r--r--cli/lib.rs28
1 files changed, 19 insertions, 9 deletions
diff --git a/cli/lib.rs b/cli/lib.rs
index 9d35710ab..fc37ff2af 100644
--- a/cli/lib.rs
+++ b/cli/lib.rs
@@ -253,13 +253,23 @@ async fn print_file_info(
Ok(())
}
-fn get_types() -> String {
- format!(
- "{}\n{}\n{}",
- crate::js::DENO_NS_LIB,
- crate::js::SHARED_GLOBALS_LIB,
- crate::js::WINDOW_LIB
- )
+fn get_types(unstable: bool) -> String {
+ if unstable {
+ format!(
+ "{}\n{}\n{}\n{}",
+ crate::js::DENO_NS_LIB,
+ crate::js::SHARED_GLOBALS_LIB,
+ crate::js::WINDOW_LIB,
+ crate::js::UNSTABLE_NS_LIB,
+ )
+ } else {
+ format!(
+ "{}\n{}\n{}",
+ crate::js::DENO_NS_LIB,
+ crate::js::SHARED_GLOBALS_LIB,
+ crate::js::WINDOW_LIB,
+ )
+ }
}
async fn info_command(
@@ -409,7 +419,7 @@ async fn doc_command(
let doc_parser = doc::DocParser::new(loader);
let parse_result = if source_file == "--builtin" {
- doc_parser.parse_source("lib.deno.d.ts", get_types().as_str())
+ doc_parser.parse_source("lib.deno.d.ts", get_types(flags.unstable).as_str())
} else {
let module_specifier =
ModuleSpecifier::resolve_url_or_path(&source_file).unwrap();
@@ -598,7 +608,7 @@ pub fn main() {
return;
}
DenoSubcommand::Types => {
- let types = get_types();
+ let types = get_types(flags.unstable);
if let Err(e) = write_to_stdout_ignore_sigpipe(types.as_bytes()) {
eprintln!("{}", e);
std::process::exit(1);