Skip to content

Commit e699df7

Browse files
authored
feat: upgrade deno_ast to 0.7 (#216)
1 parent cc14e65 commit e699df7

File tree

11 files changed

+50
-70
lines changed

11 files changed

+50
-70
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install rust
3030
uses: hecrj/setup-rust-action@v1.3.4
3131
with:
32-
rust-version: 1.56.0
32+
rust-version: 1.57.0
3333

3434
- name: Install clippy and rustfmt
3535
run: |

Cargo.lock

Lines changed: 26 additions & 25 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.21.0"
3+
version = "0.22.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.5.0"
20-
deno_graph = "0.12.0"
19+
deno_ast = "0.7.0"
20+
deno_graph = "0.13.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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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__h1a8fcdae8f66ba52(
209+
._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h549293aed5fa1e6a(
210210
arg0,
211211
arg1,
212212
addHeapObject(arg2),
@@ -221,7 +221,8 @@ function isLikeNone(x) {
221221
* @param {boolean} include_all
222222
* @param {Function} load
223223
* @param {Function | undefined} maybe_resolve
224-
* @returns {Promise<any>} */
224+
* @returns {Promise<any>}
225+
*/
225226
export function doc(root_specifier, include_all, load, maybe_resolve) {
226227
var ptr0 = passStringToWasm0(
227228
root_specifier,
@@ -247,7 +248,7 @@ function handleError(f, args) {
247248
}
248249
}
249250
function __wbg_adapter_36(arg0, arg1, arg2, arg3) {
250-
wasm.wasm_bindgen__convert__closures__invoke2_mut__hdf4cefd48e3ddd54(
251+
wasm.wasm_bindgen__convert__closures__invoke2_mut__hd87b62b08b802ff6(
251252
arg0,
252253
arg1,
253254
addHeapObject(arg2),
@@ -405,7 +406,7 @@ const imports = {
405406
__wbindgen_throw: function (arg0, arg1) {
406407
throw new Error(getStringFromWasm0(arg0, arg1));
407408
},
408-
__wbindgen_closure_wrapper834: function (arg0, arg1, arg2) {
409+
__wbindgen_closure_wrapper835: function (arg0, arg1, arg2) {
409410
var ret = makeMutClosure(arg0, arg1, 156, __wbg_adapter_20);
410411
return addHeapObject(ret);
411412
},

lib/deno_doc_bg.wasm

-11.4 KB
Binary file not shown.

src/class.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,7 @@ pub fn class_to_class_def(
304304
ClassProp(class_prop) => {
305305
let prop_js_doc = js_doc_for_span(parsed_source, &class_prop.span());
306306

307-
let ts_type = class_prop
308-
.type_ann
309-
.as_ref()
310-
.map(|rt| ts_type_ann_to_def(rt));
307+
let ts_type = class_prop.type_ann.as_ref().map(ts_type_ann_to_def);
311308

312309
let prop_name = expr_to_name(&*class_prop.key);
313310

src/function.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ pub fn function_to_function_def(
3434
params.push(param_def);
3535
}
3636

37-
let maybe_return_type = function
38-
.return_type
39-
.as_ref()
40-
.map(|rt| ts_type_ann_to_def(rt));
37+
let maybe_return_type = function.return_type.as_ref().map(ts_type_ann_to_def);
4138

4239
let type_params =
4340
maybe_type_param_decl_to_type_param_defs(function.type_params.as_ref());

src/interface.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,8 @@ pub fn get_doc_for_ts_interface_decl(
245245

246246
let name = expr_to_name(&*ts_method_sig.key);
247247

248-
let maybe_return_type = ts_method_sig
249-
.type_ann
250-
.as_ref()
251-
.map(|rt| ts_type_ann_to_def(rt));
248+
let maybe_return_type =
249+
ts_method_sig.type_ann.as_ref().map(ts_type_ann_to_def);
252250

253251
let type_params = maybe_type_param_decl_to_type_param_defs(
254252
ts_method_sig.type_params.as_ref(),
@@ -271,10 +269,8 @@ pub fn get_doc_for_ts_interface_decl(
271269
let method_js_doc = js_doc_for_span(parsed_source, &ts_getter_sig.span);
272270
let name = expr_to_name(&*ts_getter_sig.key);
273271

274-
let maybe_return_type = ts_getter_sig
275-
.type_ann
276-
.as_ref()
277-
.map(|rt| ts_type_ann_to_def(rt));
272+
let maybe_return_type =
273+
ts_getter_sig.type_ann.as_ref().map(ts_type_ann_to_def);
278274

279275
let method_def = InterfaceMethodDef {
280276
name,
@@ -322,10 +318,7 @@ pub fn get_doc_for_ts_interface_decl(
322318
params.push(param_def);
323319
}
324320

325-
let ts_type = ts_prop_sig
326-
.type_ann
327-
.as_ref()
328-
.map(|rt| ts_type_ann_to_def(rt));
321+
let ts_type = ts_prop_sig.type_ann.as_ref().map(ts_type_ann_to_def);
329322

330323
let type_params = maybe_type_param_decl_to_type_param_defs(
331324
ts_prop_sig.type_params.as_ref(),
@@ -353,10 +346,7 @@ pub fn get_doc_for_ts_interface_decl(
353346
params.push(param_def);
354347
}
355348

356-
let ts_type = ts_call_sig
357-
.type_ann
358-
.as_ref()
359-
.map(|rt| ts_type_ann_to_def(rt));
349+
let ts_type = ts_call_sig.type_ann.as_ref().map(ts_type_ann_to_def);
360350

361351
let type_params = maybe_type_param_decl_to_type_param_defs(
362352
ts_call_sig.type_params.as_ref(),

src/params.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn ident_to_param_def(
144144
_parsed_source: Option<&ParsedSource>,
145145
ident: &deno_ast::swc::ast::BindingIdent,
146146
) -> ParamDef {
147-
let ts_type = ident.type_ann.as_ref().map(|rt| ts_type_ann_to_def(rt));
147+
let ts_type = ident.type_ann.as_ref().map(ts_type_ann_to_def);
148148

149149
ParamDef::Identifier {
150150
name: ident.id.sym.to_string(),
@@ -157,7 +157,7 @@ fn rest_pat_to_param_def(
157157
parsed_source: Option<&ParsedSource>,
158158
rest_pat: &deno_ast::swc::ast::RestPat,
159159
) -> ParamDef {
160-
let ts_type = rest_pat.type_ann.as_ref().map(|rt| ts_type_ann_to_def(rt));
160+
let ts_type = rest_pat.type_ann.as_ref().map(ts_type_ann_to_def);
161161

162162
ParamDef::Rest {
163163
arg: Box::new(pat_to_param_def(parsed_source, &*rest_pat.arg)),
@@ -193,10 +193,7 @@ fn object_pat_to_param_def(
193193
.iter()
194194
.map(|prop| object_pat_prop_to_def(parsed_source, prop))
195195
.collect::<Vec<_>>();
196-
let ts_type = object_pat
197-
.type_ann
198-
.as_ref()
199-
.map(|rt| ts_type_ann_to_def(rt));
196+
let ts_type = object_pat.type_ann.as_ref().map(ts_type_ann_to_def);
200197

201198
ParamDef::Object {
202199
props,
@@ -214,7 +211,7 @@ fn array_pat_to_param_def(
214211
.iter()
215212
.map(|elem| elem.as_ref().map(|e| pat_to_param_def(parsed_source, e)))
216213
.collect::<Vec<Option<_>>>();
217-
let ts_type = array_pat.type_ann.as_ref().map(|rt| ts_type_ann_to_def(rt));
214+
let ts_type = array_pat.type_ann.as_ref().map(ts_type_ann_to_def);
218215

219216
ParamDef::Array {
220217
elements,
@@ -227,10 +224,7 @@ pub fn assign_pat_to_param_def(
227224
parsed_source: Option<&ParsedSource>,
228225
assign_pat: &deno_ast::swc::ast::AssignPat,
229226
) -> ParamDef {
230-
let ts_type = assign_pat
231-
.type_ann
232-
.as_ref()
233-
.map(|rt| ts_type_ann_to_def(rt));
227+
let ts_type = assign_pat.type_ann.as_ref().map(ts_type_ann_to_def);
234228

235229
ParamDef::Assign {
236230
left: Box::new(pat_to_param_def(parsed_source, &*assign_pat.left)),

src/ts_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ impl From<&TsImportType> for TsTypeDef {
580580

581581
let import_type_def = TsImportTypeDef {
582582
specifier: other.arg.value.to_string(),
583-
qualifier: other.qualifier.as_ref().map(|e| ts_entity_name_to_name(e)),
583+
qualifier: other.qualifier.as_ref().map(ts_entity_name_to_name),
584584
type_params,
585585
};
586586

0 commit comments

Comments
 (0)