From d1e4455d01d41a386896733413f631c070c37da1 Mon Sep 17 00:00:00 2001 From: Christopher Currie Date: Sun, 12 May 2019 19:42:37 -0700 Subject: [PATCH] Verbose variable names --- src/ExportMap.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/ExportMap.js b/src/ExportMap.js index c563c94ac..949df3f19 100644 --- a/src/ExportMap.js +++ b/src/ExportMap.js @@ -514,19 +514,27 @@ ExportMap.parse = function (path, content, context) { // This doesn't declare anything, but changes what's being exported. if (n.type === 'TSExportAssignment') { - const md = ast.body.find( - (b) => b.type === 'TSModuleDeclaration' && b.id.name === n.expression.name + const moduleDecl = ast.body.find((bodyNode) => + bodyNode.type === 'TSModuleDeclaration' && bodyNode.id.name === n.expression.name ) - if (md && md.body && md.body.body) { - md.body.body.forEach((b) => { + log(moduleDecl) + log(moduleDecl.body) + if (moduleDecl && moduleDecl.body && moduleDecl.body.body) { + moduleDecl.body.body.forEach((moduleBlockNode) => { // Export-assignment exports all members in the namespace, explicitly exported or not. - const s = b.type === 'ExportNamedDeclaration' ? b.declaration : b - if (s.type === 'VariableDeclaration') { - s.declarations.forEach((d) => - recursivePatternCapture(d.id, - id => m.namespace.set(id.name, captureDoc(source, docStyleParsers, d, n)))) + const exportedDecl = moduleBlockNode.type === 'ExportNamedDeclaration' ? + moduleBlockNode.declaration : + moduleBlockNode + + if (exportedDecl.type === 'VariableDeclaration') { + exportedDecl.declarations.forEach((decl) => + recursivePatternCapture(decl.id,(id) => m.namespace.set( + id.name, captureDoc(source, docStyleParsers, decl, exportedDecl, moduleBlockNode)) + ) + ) } else { - m.namespace.set(s.id.name, captureDoc(source, docStyleParsers, b)) + m.namespace.set(exportedDecl.id.name, + captureDoc(source, docStyleParsers, moduleBlockNode)) } }) }