// import pkg from './package.json';

const pkg = require('./package');

const externals = [
    // ...Object.keys(pkg.dependencies || {}),
    // ...Object.keys(pkg.peerDependencies || {}),
];

const makeExternalPredicate = (externalsArr => {
    if (externalsArr.length === 0) {
        return (() => false);
    }
    const externalPattern = new RegExp(`^(${externalsArr.join('|')})($|/)`);
    return (id => externalPattern.test(id));
});
const ex = {
    input: pkg.input,
    external
        :
        makeExternalPredicate(externals),
    output
        :
        [{
            format: 'es',
            file: pkg.output,
            nameFile: pkg.namesOutput,
        }],
};
if (typeof module !== 'undefined') {
    module.exports = ex;
    return;
}
// export default ex;