HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/design.system/node_modules/react-docgen/dist/utils/resolveToModule.js
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;
}