Files
hive/frontend/node_modules/react-docgen/dist/utils/resolveToModule.js
anthonyrawlins e89f2f4b7b Add comprehensive development roadmap via GitHub Issues
Created 10 detailed GitHub issues covering:
- Project activation and management UI (#1-2)
- Worker node coordination and visualization (#3-4)
- Automated GitHub repository scanning (#5)
- Intelligent model-to-issue matching (#6)
- Multi-model task execution system (#7)
- N8N workflow integration (#8)
- Hive-Bzzz P2P bridge (#9)
- Peer assistance protocol (#10)

Each issue includes detailed specifications, acceptance criteria,
technical implementation notes, and dependency mapping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 19:41:01 +10:00

42 lines
1.4 KiB
JavaScript

import getMemberExpressionRoot from './getMemberExpressionRoot.js';
import resolveToValue from './resolveToValue.js';
/**
* Given a path (e.g. call expression, member expression or identifier),
* this function tries to find the name of module from which the "root value"
* was imported.
*/
export default function resolveToModule(path) {
if (path.isVariableDeclarator()) {
if (path.node.init) {
return resolveToModule(path.get('init'));
}
}
else if (path.isCallExpression()) {
const callee = path.get('callee');
if (callee.isIdentifier({ name: 'require' })) {
return path.node.arguments[0].value;
}
return resolveToModule(callee);
}
else if (path.isIdentifier() || path.isJSXIdentifier()) {
const valuePath = resolveToValue(path);
if (valuePath !== path) {
return resolveToModule(valuePath);
}
if (path.parentPath.isObjectProperty()) {
return resolveToModule(path.parentPath);
}
}
else if (path.isObjectProperty() || path.isObjectPattern()) {
return resolveToModule(path.parentPath);
}
else if (path.parentPath?.isImportDeclaration()) {
return path.parentPath.node.source.value;
}
else if (path.isMemberExpression()) {
path = getMemberExpressionRoot(path);
return resolveToModule(path);
}
return null;
}