From 73523e29b53ad0d2093a635ecbf82da3a3d17d80 Mon Sep 17 00:00:00 2001 From: Alec LaLonde Date: Wed, 2 Mar 2016 15:07:14 -0700 Subject: [PATCH 1/3] Allow 'exports' key --- src/rollup.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rollup.js b/src/rollup.js index d509bd2..9e042de 100644 --- a/src/rollup.js +++ b/src/rollup.js @@ -13,6 +13,7 @@ const ALLOWED_KEYS = [ 'dest', 'entry', 'external', + 'exports', 'footer', 'format', 'globals', From 6096a72856338eb5f899f2b58544773bc47579b5 Mon Sep 17 00:00:00 2001 From: Alec LaLonde Date: Wed, 2 Mar 2016 23:21:07 -0700 Subject: [PATCH 2/3] Added test for exports flag, fixed test flag assertion comparator --- src/rollup.js | 1 + .../exports-flag-allowed-in-options/_config.js | 12 ++++++++++++ test/function/exports-flag-allowed-in-options/foo.js | 1 + .../function/exports-flag-allowed-in-options/main.js | 1 + test/test.js | 3 ++- 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/function/exports-flag-allowed-in-options/_config.js create mode 100644 test/function/exports-flag-allowed-in-options/foo.js create mode 100644 test/function/exports-flag-allowed-in-options/main.js diff --git a/src/rollup.js b/src/rollup.js index d509bd2..1b171bd 100644 --- a/src/rollup.js +++ b/src/rollup.js @@ -12,6 +12,7 @@ const ALLOWED_KEYS = [ 'banner', 'dest', 'entry', + 'exports', 'external', 'footer', 'format', diff --git a/test/function/exports-flag-allowed-in-options/_config.js b/test/function/exports-flag-allowed-in-options/_config.js new file mode 100644 index 0000000..9fb6472 --- /dev/null +++ b/test/function/exports-flag-allowed-in-options/_config.js @@ -0,0 +1,12 @@ +var assert = require( 'assert' ); + +module.exports = { + description: 'exports flag is passed through to bundle options', + options: { + exports: 'named' + }, + exports: function ( exports ) { + assert.equal( exports.y, 42 ); + assert.ok( !( 'x' in exports ) ); + } +}; diff --git a/test/function/exports-flag-allowed-in-options/foo.js b/test/function/exports-flag-allowed-in-options/foo.js new file mode 100644 index 0000000..a48ffd9 --- /dev/null +++ b/test/function/exports-flag-allowed-in-options/foo.js @@ -0,0 +1 @@ +export var x = 42; diff --git a/test/function/exports-flag-allowed-in-options/main.js b/test/function/exports-flag-allowed-in-options/main.js new file mode 100644 index 0000000..04b166b --- /dev/null +++ b/test/function/exports-flag-allowed-in-options/main.js @@ -0,0 +1 @@ +export { x as y } from './foo'; diff --git a/test/test.js b/test/test.js index 2ccc21c..e4da991 100644 --- a/test/test.js +++ b/test/test.js @@ -76,7 +76,7 @@ describe( 'rollup', function () { return rollup.rollup({ entry: 'x', plUgins: [] }).then( function () { throw new Error( 'Missing expected error' ); }, function ( err ) { - assert.equal( 'Unexpected key \'plUgins\' found, expected one of: banner, dest, entry, external, footer, format, globals, indent, intro, moduleId, moduleName, onwarn, outro, plugins, sourceMap', err.message ); + assert.equal( 'Unexpected key \'plUgins\' found, expected one of: banner, dest, entry, exports, external, footer, format, globals, indent, intro, moduleId, moduleName, onwarn, outro, plugins, sourceMap', err.message ); }); }); }); @@ -149,6 +149,7 @@ describe( 'rollup', function () { // try to generate output try { + if(config.bundleOptions) { console.log(config.bundleOptions); } var result = bundle.generate( extend( {}, config.bundleOptions, { format: 'cjs' })); From 69bac2eb1c2031825bf7610808fe3ae35c3711a6 Mon Sep 17 00:00:00 2001 From: Alec LaLonde Date: Wed, 2 Mar 2016 23:25:36 -0700 Subject: [PATCH 3/3] fixed bad merge --- src/rollup.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rollup.js b/src/rollup.js index e08a10a..1b171bd 100644 --- a/src/rollup.js +++ b/src/rollup.js @@ -14,7 +14,6 @@ const ALLOWED_KEYS = [ 'entry', 'exports', 'external', - 'exports', 'footer', 'format', 'globals',