Browse Source

support banner/footer option

contingency-plan
Rich-Harris 9 years ago
parent
commit
41cd743ae6
  1. 3
      src/Bundle.js
  2. 7
      test/form/banner-and-footer/_config.js
  3. 7
      test/form/banner-and-footer/_expected/amd.js
  4. 5
      test/form/banner-and-footer/_expected/cjs.js
  5. 3
      test/form/banner-and-footer/_expected/es6.js
  6. 7
      test/form/banner-and-footer/_expected/iife.js
  7. 11
      test/form/banner-and-footer/_expected/umd.js
  8. 1
      test/form/banner-and-footer/main.js

3
src/Bundle.js

@ -337,6 +337,9 @@ export default class Bundle {
indentString: getIndentString( magicString, options ) indentString: getIndentString( magicString, options )
}, options ); }, options );
if ( options.banner ) magicString.prepend( options.banner + '\n' );
if ( options.footer ) magicString.append( '\n' + options.footer );
const code = magicString.toString(); const code = magicString.toString();
let map = null; let map = null;

7
test/form/banner-and-footer/_config.js

@ -0,0 +1,7 @@
module.exports = {
description: 'adds a banner/footer',
options: {
banner: '/* this is a banner */',
footer: '/* this is a footer */'
}
};

7
test/form/banner-and-footer/_expected/amd.js

@ -0,0 +1,7 @@
/* this is a banner */
define(function () { 'use strict';
console.log( 'hello world' );
});
/* this is a footer */

5
test/form/banner-and-footer/_expected/cjs.js

@ -0,0 +1,5 @@
/* this is a banner */
'use strict';
console.log( 'hello world' );
/* this is a footer */

3
test/form/banner-and-footer/_expected/es6.js

@ -0,0 +1,3 @@
/* this is a banner */
console.log( 'hello world' );
/* this is a footer */

7
test/form/banner-and-footer/_expected/iife.js

@ -0,0 +1,7 @@
/* this is a banner */
(function () { 'use strict';
console.log( 'hello world' );
})();
/* this is a footer */

11
test/form/banner-and-footer/_expected/umd.js

@ -0,0 +1,11 @@
/* this is a banner */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
factory();
}(this, function () { 'use strict';
console.log( 'hello world' );
}));
/* this is a footer */

1
test/form/banner-and-footer/main.js

@ -0,0 +1 @@
console.log( 'hello world' );
Loading…
Cancel
Save