mirror of
https://github.com/denoland/deno.git
synced 2025-10-01 06:31:15 +00:00
feat(doc): Improve terminal printer (#6594)
- Add more support for generics - Add the --private flag - displays documentation for not exported and private nodes - Display more attributes like abstract, static and readonly - Display type aliases - Refactor module to use the Display trait - Use a bit more color
This commit is contained in:
parent
871f9255e3
commit
3374c73fba
16 changed files with 2888 additions and 1743 deletions
|
@ -1,5 +1,6 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
use super::params::pat_to_param_def;
|
||||
use super::parser::DocParser;
|
||||
use super::ts_type::ts_type_ann_to_def;
|
||||
use super::ts_type::TsTypeDef;
|
||||
use super::ts_type_param::maybe_type_param_decl_to_type_param_defs;
|
||||
|
@ -20,12 +21,14 @@ pub struct FunctionDef {
|
|||
}
|
||||
|
||||
pub fn function_to_function_def(
|
||||
doc_parser: &DocParser,
|
||||
function: &swc_ecma_ast::Function,
|
||||
) -> FunctionDef {
|
||||
let mut params = vec![];
|
||||
|
||||
for param in &function.params {
|
||||
let param_def = pat_to_param_def(¶m.pat);
|
||||
let param_def =
|
||||
pat_to_param_def(¶m.pat, Some(&doc_parser.ast_parser.source_map));
|
||||
params.push(param_def);
|
||||
}
|
||||
|
||||
|
@ -47,9 +50,10 @@ pub fn function_to_function_def(
|
|||
}
|
||||
|
||||
pub fn get_doc_for_fn_decl(
|
||||
doc_parser: &DocParser,
|
||||
fn_decl: &swc_ecma_ast::FnDecl,
|
||||
) -> (String, FunctionDef) {
|
||||
let name = fn_decl.ident.sym.to_string();
|
||||
let fn_def = function_to_function_def(&fn_decl.function);
|
||||
let fn_def = function_to_function_def(&doc_parser, &fn_decl.function);
|
||||
(name, fn_def)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue