Skip to content

Commit 0641f63

Browse files
authored
0.25.0 (#228)
1 parent 1a86ee0 commit 0641f63

File tree

7 files changed

+85
-47
lines changed

7 files changed

+85
-47
lines changed

Cargo.lock

Lines changed: 49 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "deno_doc"
3-
version = "0.24.0"
3+
version = "0.25.0"
44
edition = "2021"
55
description = "doc generation for deno"
66
authors = ["the Deno authors"]
@@ -16,8 +16,8 @@ name = "ddoc"
1616
[dependencies]
1717
anyhow = { version = "1.0.43", optional = true }
1818
cfg-if = "1.0.0"
19-
deno_ast = "0.7.0"
20-
deno_graph = "0.16.0"
19+
deno_ast = "0.8.0"
20+
deno_graph = "0.17.0"
2121
futures = "0.3.17"
2222
js-sys = { version = "0.3.55", optional = true }
2323
lazy_static = "1.4.0"

lib/deno_doc.generated.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license.
1+
// Copyright 2020-2022 the Deno authors. All rights reserved. MIT license.
22
// @generated file from build script, do not edit
33
// deno-lint-ignore-file
44

@@ -206,7 +206,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
206206
}
207207
function __wbg_adapter_20(arg0, arg1, arg2) {
208208
wasm
209-
._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hda9c9576d99a9cb9(
209+
._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__haac610891b5b0a41(
210210
arg0,
211211
arg1,
212212
addHeapObject(arg2),
@@ -248,7 +248,7 @@ function handleError(f, args) {
248248
}
249249
}
250250
function __wbg_adapter_36(arg0, arg1, arg2, arg3) {
251-
wasm.wasm_bindgen__convert__closures__invoke2_mut__hc6e807ee3b243fa0(
251+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h5878b1a6fd198edd(
252252
arg0,
253253
arg1,
254254
addHeapObject(arg2),

lib/deno_doc_bg.wasm

31.5 KB
Binary file not shown.

src/class.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::decorators::decorators_to_defs;
99
use crate::decorators::DecoratorDef;
1010
use crate::function::function_to_function_def;
1111
use crate::function::FunctionDef;
12-
use crate::interface::expr_to_name;
1312
use crate::js_doc::JsDoc;
1413
use crate::node::DeclarationKind;
1514
use crate::params::assign_pat_to_param_def;
@@ -307,7 +306,8 @@ pub fn class_to_class_def(
307306

308307
let ts_type = class_prop.type_ann.as_ref().map(ts_type_ann_to_def);
309308

310-
let prop_name = expr_to_name(&*class_prop.key);
309+
let prop_name =
310+
prop_name_to_string(Some(parsed_source), &class_prop.key);
311311

312312
let decorators =
313313
decorators_to_defs(parsed_source, &class_prop.decorators);

src/parser.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::node::DocNode;
88
use crate::node::ModuleDoc;
99
use crate::swc_util::get_location;
1010
use crate::swc_util::js_doc_for_span;
11+
use crate::swc_util::module_export_name_value;
1112
use crate::swc_util::module_js_doc_for_source;
1213
use crate::ImportDef;
1314
use crate::Location;
@@ -324,7 +325,7 @@ impl<'a> DocParser<'a> {
324325
named_specifier
325326
.imported
326327
.as_ref()
327-
.map(|ident| ident.sym.to_string())
328+
.map(module_export_name_value)
328329
.or_else(|| Some(named_specifier.local.sym.to_string())),
329330
import_decl.src.value.to_string(),
330331
),
@@ -558,7 +559,7 @@ impl<'a> DocParser<'a> {
558559
named_specifier
559560
.imported
560561
.as_ref()
561-
.map(|ident| ident.sym.to_string()),
562+
.map(module_export_name_value),
562563
),
563564
src: import_decl.src.value.to_string(),
564565
},
@@ -633,10 +634,14 @@ impl<'a> DocParser<'a> {
633634
src: src_str.to_string(),
634635
},
635636
ExportSpecifier::Named(named_export) => {
636-
let ident = named_export.orig.sym.to_string();
637-
let maybe_alias =
638-
named_export.exported.as_ref().map(|e| e.sym.to_string());
639-
let kind = node::ReexportKind::Named(ident, maybe_alias);
637+
let export_name =
638+
module_export_name_value(&named_export.orig);
639+
let maybe_alias = named_export
640+
.exported
641+
.as_ref()
642+
.map(module_export_name_value);
643+
let kind =
644+
node::ReexportKind::Named(export_name, maybe_alias);
640645
node::Reexport {
641646
kind,
642647
src: src_str.to_string(),
@@ -651,20 +656,17 @@ impl<'a> DocParser<'a> {
651656
.filter_map(|specifier| {
652657
if let ExportSpecifier::Named(specifier) = specifier {
653658
if let Some(import) =
654-
imports.get(&specifier.orig.sym.to_string())
659+
imports.get(&module_export_name_value(&specifier.orig))
655660
{
656661
// If it has the same name as the original import and private values are exported,
657662
// don't export this again and document the same value twice.
658663
if self.private && specifier.exported.is_none() {
659664
return None;
660665
}
661666

662-
let name = specifier
663-
.exported
664-
.as_ref()
665-
.unwrap_or(&specifier.orig)
666-
.sym
667-
.to_string();
667+
let name = module_export_name_value(
668+
specifier.exported.as_ref().unwrap_or(&specifier.orig),
669+
);
668670
Some(node::Reexport {
669671
src: import.src.clone(),
670672
kind: match &import.kind {
@@ -788,11 +790,12 @@ impl<'a> DocParser<'a> {
788790
for specifier in &export_named.specifiers {
789791
match specifier {
790792
ExportSpecifier::Named(named_specifier) => {
791-
let symbol = named_specifier.orig.sym.to_string();
793+
let symbol =
794+
module_export_name_value(&named_specifier.orig);
792795
if let Some(doc_node) = symbols.get(&symbol) {
793796
let mut doc_node = doc_node.clone();
794797
if let Some(exported) = &named_specifier.exported {
795-
doc_node.name = exported.sym.to_string()
798+
doc_node.name = module_export_name_value(exported)
796799
}
797800
doc_node.declaration_kind = DeclarationKind::Export;
798801
doc_entries.push(doc_node)

src/swc_util.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license.
22

3+
use deno_ast::swc::ast::ModuleExportName;
34
use deno_ast::swc::common::comments::Comment;
45
use deno_ast::swc::common::comments::CommentKind;
56
use deno_ast::swc::common::comments::Comments;
@@ -83,3 +84,12 @@ pub fn get_location(parsed_source: &ParsedSource, pos: BytePos) -> Location {
8384
col: line_and_column_index.column_number - 1,
8485
}
8586
}
87+
88+
pub fn module_export_name_value(
89+
module_export_name: &ModuleExportName,
90+
) -> String {
91+
match module_export_name {
92+
ModuleExportName::Ident(ident) => ident.sym.to_string(),
93+
ModuleExportName::Str(str) => str.value.to_string(),
94+
}
95+
}

0 commit comments

Comments
 (0)