Browse Source

prevent leaky state, always clone magic-string

rewrite
Rich Harris 8 years ago
parent
commit
1d7c853ce6
  1. 2
      src/Module.js
  2. 4
      test/test.js

2
src/Module.js

@ -448,7 +448,7 @@ export default class Module {
} }
render ( es ) { render ( es ) {
const magicString = this.magicString; const magicString = this.magicString.clone();
this.statements.forEach( statement => { this.statements.forEach( statement => {
if ( !statement.isIncluded ) { if ( !statement.isIncluded ) {

4
test/test.js

@ -291,9 +291,11 @@ describe( 'rollup', function () {
}, config.options ); }, config.options );
( config.skip ? describe.skip : config.solo ? describe.only : describe )( dir, () => { ( config.skip ? describe.skip : config.solo ? describe.only : describe )( dir, () => {
const promise = rollup.rollup( options );
PROFILES.forEach( profile => { PROFILES.forEach( profile => {
it( 'generates ' + profile.format, () => { it( 'generates ' + profile.format, () => {
return rollup.rollup( options ).then( bundle => { return promise.then( bundle => {
const options = extend( {}, config.options, { const options = extend( {}, config.options, {
dest: FORM + '/' + dir + '/_actual/' + profile.format + '.js', dest: FORM + '/' + dir + '/_actual/' + profile.format + '.js',
format: profile.format format: profile.format

Loading…
Cancel
Save