'use strict';

const fs = require('fs');
const path = require('path');

const regex = /module\.exports = punycode;/;
const output = 'export { ucs2decode, ucs2encode, decode, encode, toASCII, toUnicode };\nexport default punycode;';

const sourceContents = fs.readFileSync(path.resolve(__dirname, '../punycode.js'), 'utf-8');

if (!regex.test(sourceContents)) {
	throw new Error('The underlying library has changed. Please update the prepublish script.');
}

const outputContents = sourceContents.replace(regex, output);

fs.writeFileSync(path.resolve(__dirname, '../punycode.es6.js'), outputContents);

'use strict';

const fs = require('fs');
const path = require('path');

const regex = /module\.exports = punycode;/;

const sourceContents = fs.readFileSync(path.resolve(__dirname, '../punycode.js'), 'utf-8');

if (!regex.test(sourceContents)) {
	throw new Error('The underlying library has changed. Please update the prepublish script.');
}

const outputContents = sourceContents.replace(regex, 'export default punycode;');

fs.writeFileSync(path.resolve(__dirname, '../punycode.es6.js'), outputContents);

--- 
+++ 
@@ -4,7 +4,6 @@
 const path = require('path');
 
 const regex = /module\.exports = punycode;/;
-const output = 'export { ucs2decode, ucs2encode, decode, encode, toASCII, toUnicode };\nexport default punycode;';
 
 const sourceContents = fs.readFileSync(path.resolve(__dirname, '../punycode.js'), 'utf-8');
 
@@ -12,6 +11,6 @@
 	throw new Error('The underlying library has changed. Please update the prepublish script.');
 }
 
-const outputContents = sourceContents.replace(regex, output);
+const outputContents = sourceContents.replace(regex, 'export default punycode;');
 
 fs.writeFileSync(path.resolve(__dirname, '../punycode.es6.js'), outputContents);
Add support for named exports

Closes #63.