function exportDeclaration()

in src/resolver/findExportedComponentDefinition.ts [78:106]


  function exportDeclaration(path: NodePath): false {
    const definitions = resolveExportDeclaration(path, importer).reduce(
      (acc: NodePath[], definition: NodePath) => {
        if (isComponentDefinition(definition, importer)) {
          acc.push(definition);
        } else {
          const resolved = resolveToValue(
            resolveHOC(definition, importer),
            importer,
          );
          if (isComponentDefinition(resolved, importer)) {
            acc.push(resolved);
          }
        }
        return acc;
      },
      [],
    );

    if (definitions.length === 0) {
      return false;
    }
    if (definitions.length > 1 || foundDefinition) {
      // If a file exports multiple components, ... complain!
      throw new Error(ERROR_MULTIPLE_DEFINITIONS);
    }
    foundDefinition = resolveDefinition(definitions[0], importer);
    return false;
  }