mirror of https://github.com/lukechilds/rollup.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
614 B
28 lines
614 B
const fs = require( 'fs' );
|
|
const path = require( 'path' );
|
|
const assert = require( 'assert' );
|
|
|
|
const HELPER = '\0helper';
|
|
|
|
module.exports = {
|
|
description: 'excludes plugin helpers from sources',
|
|
options: {
|
|
format: 'cjs',
|
|
plugins: [{
|
|
resolveId ( id ) {
|
|
if ( id === HELPER ) return id;
|
|
},
|
|
|
|
load ( id ) {
|
|
if ( id === HELPER ) {
|
|
return fs.readFileSync( path.join( __dirname, 'helper.js' ), 'utf-8' );
|
|
}
|
|
}
|
|
}]
|
|
},
|
|
test: ( code, map ) => {
|
|
assert.equal( map.sources.length, 1 );
|
|
assert.equal( map.sourcesContent.length, 1 );
|
|
assert.ok( /main/.test( map.sources[0] ) );
|
|
}
|
|
};
|
|
|