function parseInlineableAlias()

in packages/babel-preset-fbjs/plugins/inline-requires.js [171:191]


function parseInlineableAlias(path, state) {
  const module = getInlineableModule(path, state);
  if (module == null) {
    return null;
  }

  const { moduleName, requireFnName } = module;
  const isValid =
    path.parent.type === 'VariableDeclarator' &&
    path.parent.id.type === 'Identifier' &&
    path.parentPath.parent.type === 'VariableDeclaration' &&
    path.parentPath.parentPath.parent.type === 'Program';

  return !isValid || path.parentPath.node == null
    ? null
    : {
      declarationPath: path.parentPath,
      moduleName,
      requireFnName,
    };
}