Skip to content

Commit

Permalink
Support export all declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed May 4, 2019
1 parent 840ca88 commit 79a814f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/__tests__/fixtures/component_32.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export function SuperDuperCustomButton({color, ...otherProps}) {
}

SuperDuperCustomButton.propTypes = sharedProps;
export * from './component_31';
2 changes: 1 addition & 1 deletion src/__tests__/fixtures/component_33.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as C31 from './component_31';
import * as C31 from './component_32';
import PropTypes from 'prop-types';

export function SuperDuperCustomButton({color, ...otherProps}) {
Expand Down
11 changes: 8 additions & 3 deletions src/utils/resolveImportedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import fs from 'fs';
const { namedTypes: t, NodePath } = types;

export default function resolveImportedValue(path: NodePath, name: string) {
t.ImportDeclaration.assert(path.node);

// Bail if no filename was provided for the current source file.
// Also never traverse into react itself.
const source = path.node.source.value;
Expand Down Expand Up @@ -101,7 +99,14 @@ function findExportedValue(ast, name) {

return false;
},
// TODO: visitExportAllDeclaration
visitExportAllDeclaration(path: NodePath) {
const resolvedPath = resolveImportedValue(path, name);
if (resolvedPath) {
resultPath = resolvedPath;
}

return false;
}
});

return resultPath;
Expand Down

0 comments on commit 79a814f

Please sign in to comment.