nl_tokens: Return a Rollup configuration for a pkg with env and target .
pl_tokens: function configure ( pkg , env , target ) { const isModule = target === 'module' ; const input = ` ` ; const deps = [ ] . concat ( pkg . dependencies ? Object . keys ( pkg . dependencies ) : [ ] ) . concat ( pkg . peerDependencies ? Object . keys ( pkg . peerDependencies ) : [ ] ) ; const plugins = [ // Allow Rollup to resolve modules from `node_modules`, since it only // resolves local modules by default. resolve ( { browser : true } ) , // Convert JSON imports to ES6 modules. json ( ) , // Replace `process.env.NODE_ENV` with its value, which enables some modules // like React and Slate to use their production variant. replace ( { 'process.env.NODE_ENV' : JSON . stringify ( env ) } ) , // Register Node.js builtins for browserify compatibility. builtins ( ) , // Use Babel to transpile the result, limiting it to the source code. babel ( { include : [ ` ` ] } ) , // Register Node.js globals for browserify compatibility. globals ( ) ] . filter ( Boolean ) ; if ( isModule ) { return { plugins , input , output : [ { file : ` ${ pkg . module } ` , format : 'es' , sourcemap : true } , { file : ` ${ pkg . main } ` , <mask> : 'cjs' , exports : 'named' , sourcemap : true } ] , // We need to explicitly state which modules are external, meaning that // they are present at runtime. In the case of non-UMD configs, this means // all non-Slate packages. external : id => ! ! deps . find ( dep => dep === id || id . startsWith ( ` ${ dep } ` ) ) } ; } return undefined ; }