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/isReactComponentClass.js
import isReactModuleName from './isReactModuleName.js';
import resolveToModule from './resolveToModule.js';
import resolveToValue from './resolveToValue.js';
import isDestructuringAssignment from './isDestructuringAssignment.js';
import isImportSpecifier from './isImportSpecifier.js';
function isRenderMethod(path) {
    if ((!path.isClassMethod() || path.node.kind !== 'method') &&
        !path.isClassProperty()) {
        return false;
    }
    if (path.node.computed || path.node.static) {
        return false;
    }
    const key = path.get('key');
    if (!key.isIdentifier() || key.node.name !== 'render') {
        return false;
    }
    return true;
}
function classExtendsReactComponent(path) {
    if (path.isMemberExpression()) {
        const property = path.get('property');
        if (property.isIdentifier({ name: 'Component' }) ||
            property.isIdentifier({ name: 'PureComponent' })) {
            return true;
        }
    }
    else if (isImportSpecifier(path, 'Component') ||
        isImportSpecifier(path, 'PureComponent')) {
        return true;
    }
    else if (isDestructuringAssignment(path, 'Component') ||
        isDestructuringAssignment(path, 'PureComponent')) {
        return true;
    }
    return false;
}
/**
 * Returns `true` of the path represents a class definition which either extends
 * `React.Component` or has a superclass and implements a `render()` method.
 */
export default function isReactComponentClass(path) {
    if (!path.isClass()) {
        return false;
    }
    // React.Component or React.PureComponent
    const superClass = path.get('superClass');
    if (superClass.hasNode()) {
        const resolvedSuperClass = resolveToValue(superClass);
        if (classExtendsReactComponent(resolvedSuperClass)) {
            const module = resolveToModule(resolvedSuperClass);
            if (module && isReactModuleName(module)) {
                return true;
            }
        }
    }
    else {
        // does not extend anything
        return false;
    }
    // render method
    if (path.get('body').get('body').some(isRenderMethod)) {
        return true;
    }
    return false;
}