Browse Source

change option from bundle to cache

ghi-672
Rich Harris 9 years ago
parent
commit
fc7e0f1ce2
  1. 4
      src/Bundle.js
  2. 4
      src/rollup.js
  3. 6
      test/test.js

4
src/Bundle.js

@ -19,8 +19,8 @@ import { dirname, isRelative, isAbsolute, relative, resolve } from './utils/path
export default class Bundle { export default class Bundle {
constructor ( options ) { constructor ( options ) {
if ( typeof options.bundle === 'object' ) { if ( typeof options.cache === 'object' ) {
this.cachedModules = options.bundle.modules.reduce((modules, module) => { this.cachedModules = options.cache.modules.reduce((modules, module) => {
modules[module.id] = module; modules[module.id] = module;
return modules; return modules;
}, {}); }, {});

4
src/rollup.js

@ -9,6 +9,7 @@ export const VERSION = '<@VERSION@>';
const ALLOWED_KEYS = [ const ALLOWED_KEYS = [
'banner', 'banner',
'cache',
'dest', 'dest',
'entry', 'entry',
'exports', 'exports',
@ -28,8 +29,7 @@ const ALLOWED_KEYS = [
'sourceMap', 'sourceMap',
'targets', 'targets',
'treeshake', 'treeshake',
'useStrict', 'useStrict'
'bundle'
]; ];
export function rollup ( options ) { export function rollup ( options ) {

6
test/test.js

@ -431,7 +431,7 @@ describe( 'rollup', function () {
}); });
done( error ); done( error );
} }
else { else {
var expected = sander.readFileSync( '_expected.js' ).toString(); var expected = sander.readFileSync( '_expected.js' ).toString();
try { try {
@ -464,7 +464,7 @@ describe( 'rollup', function () {
return rollup.rollup({ return rollup.rollup({
entry: path.join( INCREMENTAL, 'not-transform-twice', 'main.js' ), entry: path.join( INCREMENTAL, 'not-transform-twice', 'main.js' ),
plugins: [counter], plugins: [counter],
bundle cache: bundle
}); });
}).then( function ( bundle ) { }).then( function ( bundle ) {
assert.equal( calls, 2 ); assert.equal( calls, 2 );
@ -509,7 +509,7 @@ describe( 'rollup', function () {
return rollup.rollup({ return rollup.rollup({
entry: path.join( INCREMENTAL, 'transform-changed', 'main.js' ), entry: path.join( INCREMENTAL, 'transform-changed', 'main.js' ),
plugins: [counter], plugins: [counter],
bundle cache: bundle
}); });
}).then( function ( bundle ) { }).then( function ( bundle ) {
assert.equal( calls, 3 ); assert.equal( calls, 3 );

Loading…
Cancel
Save