Browse Source

Merge pull request #542 from alalonde/master

Allow 'exports' key
gh-669
Rich Harris 9 years ago
parent
commit
b50167646e
  1. 1
      src/rollup.js
  2. 12
      test/function/exports-flag-allowed-in-options/_config.js
  3. 1
      test/function/exports-flag-allowed-in-options/foo.js
  4. 1
      test/function/exports-flag-allowed-in-options/main.js
  5. 3
      test/test.js

1
src/rollup.js

@ -12,6 +12,7 @@ const ALLOWED_KEYS = [
'banner', 'banner',
'dest', 'dest',
'entry', 'entry',
'exports',
'external', 'external',
'footer', 'footer',
'format', 'format',

12
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 ) );
}
};

1
test/function/exports-flag-allowed-in-options/foo.js

@ -0,0 +1 @@
export var x = 42;

1
test/function/exports-flag-allowed-in-options/main.js

@ -0,0 +1 @@
export { x as y } from './foo';

3
test/test.js

@ -76,7 +76,7 @@ describe( 'rollup', function () {
return rollup.rollup({ entry: 'x', plUgins: [] }).then( function () { return rollup.rollup({ entry: 'x', plUgins: [] }).then( function () {
throw new Error( 'Missing expected error' ); throw new Error( 'Missing expected error' );
}, function ( err ) { }, 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 to generate output
try { try {
if(config.bundleOptions) { console.log(config.bundleOptions); }
var result = bundle.generate( extend( {}, config.bundleOptions, { var result = bundle.generate( extend( {}, config.bundleOptions, {
format: 'cjs' format: 'cjs'
})); }));

Loading…
Cancel
Save