Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fs = require('fs');
const path = require('path');
const builtinModules = require('builtin-modules');
const commonjs = require('rollup-plugin-commonjs');
const copy = require('rollup-plugin-copy');
const nodeResolve = require('rollup-plugin-node-resolve');
const replace = require('rollup-plugin-replace');
const { terser } = require('rollup-plugin-terser');
const builtinModulesMap = builtinModules.reduce((result, item) => {
result[item] = item;
return result;
}, {});
const formats = ['cjs', 'es'];
const project = process.env.PROJECT;
if (typeof project !== 'string') {
throw new TypeError(`'${project}' is not a valid project`);
}
const sourcePath = path.join(__dirname, project);
const outputPath = path.join(__dirname, 'dist', project);
const createEntry = (inputFilePath, libraryFilePath, format, outputFilePath) => ({
input: inputFilePath,
const path = require('path');
const builtinModules = require('builtin-modules');
const commonjs = require('rollup-plugin-commonjs');
const copy = require('rollup-plugin-copy');
const nodeResolve = require('rollup-plugin-node-resolve');
const { terser } = require('rollup-plugin-terser');
const UMD_NAME = 'Foundation';
const wasmBuildRoot = path.join(__dirname, '..', '..', '..', 'build', 'wrappers', 'wasm', 'foundation');
const sourceRoot = path.join(__dirname, 'src');
const outputFolder = path.join(__dirname, 'dist');
const builtinModulesMap = builtinModules.reduce((result, item) => {
result[item] = item;
return result;
}, {});
const format = process.env.FORMAT;
const formats = {
cjs: 'cjs',
es: 'es',
umd: 'umd',
};
if (!formats[format]) {
throw new TypeError(`'${format}' is not a valid format`);
}
module.exports = {
input: path.join(sourceRoot, 'index.js'),