Skip to content

Commit

Permalink
feat: Handle the "export from" statement (#129)
Browse files Browse the repository at this point in the history
Closes #128
  • Loading branch information
fatfisz authored and tleunen committed Feb 25, 2017
1 parent e3597b8 commit 627b897
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.js
Expand Up @@ -84,5 +84,10 @@ export default ({ types: t }) => ({
transformImportCall(t, nodePath, mapModule, state, this.moduleResolverCWD);
},
},
ExportDeclaration: {
exit(nodePath, state) {
transformImportCall(t, nodePath, mapModule, state, this.moduleResolverCWD);
},
},
},
});
14 changes: 14 additions & 0 deletions test/index.test.js
Expand Up @@ -18,6 +18,20 @@ describe('module-resolver', () => {

expect(result.code).toBe(`import something from "${output}";`);
});

it('with an "export from" statement', () => {
const code = `export { something } from "${source}";`;
const result = transform(code, transformerOpts);

expect(result.code).toBe(`export { something } from "${output}";`);
});

it('with an export statement', () => {
const code = 'export { something };';
const result = transform(code, transformerOpts);

expect(result.code).toBe('export { something };');
});
}

describe('root', () => {
Expand Down

0 comments on commit 627b897

Please sign in to comment.