Skip to content

Commit

Permalink
0.26.0 (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Jan 13, 2022
1 parent ef48de9 commit 76d4667
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 39 deletions.
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deno_doc"
version = "0.25.0"
version = "0.26.0"
edition = "2021"
description = "doc generation for deno"
authors = ["the Deno authors"]
Expand All @@ -16,8 +16,8 @@ name = "ddoc"
[dependencies]
anyhow = { version = "1.0.43", optional = true }
cfg-if = "1.0.0"
deno_ast = "0.8.0"
deno_graph = "0.17.0"
deno_ast = "0.9.0"
deno_graph = "0.18.0"
futures = "0.3.17"
js-sys = { version = "0.3.55", optional = true }
lazy_static = "1.4.0"
Expand Down
1 change: 1 addition & 0 deletions benches/doc_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async fn parse_with_reexports() -> Vec<DocNode> {
None,
None,
None,
None,
)
.await;
let source_parser = deno_graph::DefaultSourceParser::new();
Expand Down
3 changes: 2 additions & 1 deletion examples/ddoc/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Loader for SourceFileLoader {
} else {
Ok(None)
};
Box::pin(future::ready((specifier.clone(), result)))
Box::pin(future::ready(result))
}
}

Expand Down Expand Up @@ -69,6 +69,7 @@ fn main() {
None,
None,
Some(&source_parser),
None,
)
.await;
let parser = DocParser::new(graph, false, &source_parser);
Expand Down
14 changes: 8 additions & 6 deletions src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,19 @@ pub struct InterfaceDef {

pub fn expr_to_name(expr: &deno_ast::swc::ast::Expr) -> String {
use deno_ast::swc::ast::Expr::*;
use deno_ast::swc::ast::ExprOrSuper::*;
use deno_ast::swc::ast::MemberProp;

match expr {
Ident(ident) => ident.sym.to_string(),
Member(member_expr) => {
let left = match &member_expr.obj {
Super(_) => "super".to_string(),
Expr(boxed_expr) => expr_to_name(&*boxed_expr),
let left = expr_to_name(&*member_expr.obj);
let right = match &member_expr.prop {
MemberProp::Ident(ident) => format!(".{}", ident.sym.to_string()),
MemberProp::Computed(_) | MemberProp::PrivateName(_) => {
"[UNSUPPORTED]".to_string()
}
};
let right = expr_to_name(&*member_expr.prop);
format!("[{}.{}]", left, right)
format!("[{}{}]", left, right)
}
Lit(lit) => {
use deno_ast::swc::ast::BigInt;
Expand Down
11 changes: 4 additions & 7 deletions src/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ impl Loader for JsLoader {
specifier: &ModuleSpecifier,
is_dynamic: bool,
) -> LoadFuture {
let specifier = specifier.clone();
let this = JsValue::null();
let arg0 = JsValue::from(specifier.to_string());
let arg1 = JsValue::from(is_dynamic);
Expand All @@ -38,12 +37,9 @@ impl Loader for JsLoader {
Ok(result) => JsFuture::from(js_sys::Promise::resolve(&result)).await,
Err(err) => Err(err),
};
(
specifier,
response
.map(|value| value.into_serde().unwrap())
.map_err(|_| anyhow!("load rejected or errored")),
)
response
.map(|value| value.into_serde().unwrap())
.map_err(|_| anyhow!("load rejected or errored"))
};
Box::pin(f)
}
Expand Down Expand Up @@ -98,6 +94,7 @@ pub async fn doc(
maybe_resolver.as_ref().map(|r| r as &dyn Resolver),
None,
None,
None,
)
.await;
let source_parser = deno_graph::DefaultSourceParser::new();
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ impl<'a> DocParser<'a> {
.map(|export_specifier| match export_specifier {
ExportSpecifier::Namespace(ns_export) => node::Reexport {
kind: node::ReexportKind::Namespace(
ns_export.name.sym.to_string(),
module_export_name_value(&ns_export.name),
),
src: src_str.to_string(),
},
Expand Down
5 changes: 4 additions & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub(crate) async fn setup<S: AsRef<str> + Copy>(
None,
None,
None,
None,
)
.await;
(graph, root)
Expand Down Expand Up @@ -137,6 +138,7 @@ async fn content_type_handling() {
None,
None,
None,
None,
)
.await;
let source_parser = deno_graph::DefaultSourceParser::new();
Expand Down Expand Up @@ -182,6 +184,7 @@ async fn types_header_handling() {
None,
None,
None,
None,
)
.await;
let source_parser = deno_graph::DefaultSourceParser::new();
Expand Down Expand Up @@ -893,7 +896,7 @@ export class A {
/**
* Some leading documentation here.
*
*
* @param {string} name some comment
* @param {string} a some other comment that
* spans two lines
Expand Down
2 changes: 1 addition & 1 deletion src/ts_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ fn infer_ts_type_from_new_expr(new_expr: &NewExpr) -> Option<TsTypeDef> {

fn infer_ts_type_from_call_expr(call_expr: &CallExpr) -> Option<TsTypeDef> {
match &call_expr.callee {
ExprOrSuper::Expr(expr) => {
Callee::Expr(expr) => {
if let Expr::Ident(ident) = expr.as_ref() {
let sym = ident.sym.to_string();
match sym.as_str() {
Expand Down

0 comments on commit 76d4667

Please sign in to comment.