Skip to content

Commit 79a814f

Browse files
committed
Support export all declaration
1 parent 840ca88 commit 79a814f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/__tests__/fixtures/component_32.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export function SuperDuperCustomButton({color, ...otherProps}) {
66
}
77

88
SuperDuperCustomButton.propTypes = sharedProps;
9+
export * from './component_31';

src/__tests__/fixtures/component_33.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as C31 from './component_31';
1+
import * as C31 from './component_32';
22
import PropTypes from 'prop-types';
33

44
export function SuperDuperCustomButton({color, ...otherProps}) {

src/utils/resolveImportedValue.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import fs from 'fs';
1717
const { namedTypes: t, NodePath } = types;
1818

1919
export default function resolveImportedValue(path: NodePath, name: string) {
20-
t.ImportDeclaration.assert(path.node);
21-
2220
// Bail if no filename was provided for the current source file.
2321
// Also never traverse into react itself.
2422
const source = path.node.source.value;
@@ -101,7 +99,14 @@ function findExportedValue(ast, name) {
10199

102100
return false;
103101
},
104-
// TODO: visitExportAllDeclaration
102+
visitExportAllDeclaration(path: NodePath) {
103+
const resolvedPath = resolveImportedValue(path, name);
104+
if (resolvedPath) {
105+
resultPath = resolvedPath;
106+
}
107+
108+
return false;
109+
}
105110
});
106111

107112
return resultPath;

0 commit comments

Comments
 (0)