feat: use es2015 syntax to re-export default export (#32)

BREAKING CHANGE:

This changes the output generated by create-index and can effect CI if it runs linting tests against create-index.
This commit is contained in:
Guillaume Boddaert
2017-01-27 14:44:07 +00:00
committed by Gajus Kuizinas
parent 893d9931d4
commit 65892e3bb8
4 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ const buildExportBlock = (files) => {
let importBlock;
importBlock = _.map(files, (fileName) => {
return 'export ' + safeVariableName(fileName) + ' from \'./' + fileName + '\';';
return 'export { default as ' + safeVariableName(fileName) + ' } from \'./' + fileName + '\';';
});
importBlock = importBlock.join('\n');
+6 -6
View File
@@ -20,7 +20,7 @@ describe('createIndexCode()', () => {
expect(indexCode).to.equal(codeExample(`
// @create-index
export foo from './foo';
export { default as foo } from './foo';
`));
});
it('describes multiple children', () => {
@@ -29,8 +29,8 @@ export foo from './foo';
expect(indexCode).to.equal(codeExample(`
// @create-index
export bar from './bar';
export foo from './foo';
export { default as bar } from './bar';
export { default as foo } from './foo';
`));
});
context('file with extension', () => {
@@ -40,7 +40,7 @@ export foo from './foo';
expect(indexCode).to.equal(codeExample(`
// @create-index
export foo from './foo.js';
export { default as foo } from './foo.js';
`));
});
});
@@ -51,8 +51,8 @@ export foo from './foo.js';
expect(indexCode).to.equal(codeExample(`
// @create-index
export bar from './bar';
export foo from './foo';
export { default as bar } from './bar';
export { default as foo } from './foo';
`));
});
});
+2 -2
View File
@@ -1,5 +1,5 @@
// @create-index
export bar from './bar';
export foo from './foo.js';
export { default as bar } from './bar';
export { default as foo } from './foo.js';
+2 -2
View File
@@ -29,8 +29,8 @@ describe('writeIndex()', () => {
expect(indexCode).to.equal(codeExample(`
// @create-index
export bar from './bar';
export foo from './foo.js';
export { default as bar } from './bar';
export { default as foo } from './foo.js';
`));
});
});