import path = require ( 'path' ) ; import pMap = require ( 'p-map' ) ; import { getInput } from './getInput' ; import { getOutput } from './getOutput' ; import { getPlugins } from './getPlugins' ; import { CoreProperties as PackageManifest } from '@schemastore/package' ; import { RollupOptions } from 'rollup' ; export { RollupOutputOptions } from './getOutput' ; param { PackageManifest } pkg param opts param { String } opts . cwd export default async function pectin ( pkg , opts ? ) { const cwd = path . resolve ( ( opts && opts . cwd ) || '.' ) ; const input = getInput ( pkg , cwd ) ; const outputs = getOutput ( pkg , cwd ) ; return pMap ( outputs , async ( output ) => { const plugins = await getPlugins ( pkg , cwd , output ) ; return { input , output : [ output ] , plugins , inlineDynamicImports : output . browser === true || output . format === 'umd' , } ; } ) ; }