(path: NodePath<t.ImportDeclaration>)
| 12 | |
| 13 | traverse(ast, { |
| 14 | ImportDeclaration(path: NodePath<t.ImportDeclaration>) { |
| 15 | if (!params.moduleName.includes(path.node.source.value)) return; |
| 16 | |
| 17 | const importNames = new Map<string, boolean | string>(); |
| 18 | const specifiers = path.node.specifiers; |
| 19 | |
| 20 | specifiers.forEach((specifier: t.ImportSpecifier | t.ImportDefaultSpecifier | t.ImportNamespaceSpecifier) => { |
| 21 | if ( |
| 22 | t.isImportSpecifier(specifier) && |
| 23 | t.isIdentifier(specifier.imported) && |
| 24 | specifier.imported.name === params.functionName |
| 25 | ) { |
| 26 | importNames.set(specifier.local.name, true); |
| 27 | } else if ( |
| 28 | t.isImportDefaultSpecifier(specifier) && |
| 29 | params.functionName === "default" |
| 30 | ) { |
| 31 | importNames.set(specifier.local.name, true); |
| 32 | } else if (t.isImportNamespaceSpecifier(specifier)) { |
| 33 | importNames.set(specifier.local.name, "namespace"); |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | collectCallExpressions(path, importNames, result, params.functionName); |
| 38 | }, |
| 39 | }); |
| 40 | |
| 41 | return result; |
nothing calls this directly
no test coverage detected