2024-04-24 20:25:54 +03:00
|
|
|
import esbuild from 'rollup-plugin-esbuild';
|
|
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
|
|
import json from '@rollup/plugin-json';
|
2024-04-24 20:26:02 +03:00
|
|
|
import pkgJson from './package.json' assert { type: 'json' };
|
|
|
|
|
2024-04-25 13:51:42 +03:00
|
|
|
const external = Object.keys(pkgJson.dependencies).concat(
|
|
|
|
Object.keys(pkgJson.optionalDependencies),
|
|
|
|
[
|
|
|
|
'@tornado/websnark/src/utils',
|
|
|
|
'@tornado/websnark/src/groth16',
|
|
|
|
]
|
|
|
|
);
|
2024-04-24 20:25:54 +03:00
|
|
|
|
|
|
|
const config = [
|
|
|
|
{
|
|
|
|
input: 'src/index.ts',
|
|
|
|
output: [
|
|
|
|
{
|
2024-04-24 20:26:02 +03:00
|
|
|
file: pkgJson.main,
|
|
|
|
format: "cjs",
|
|
|
|
esModule: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
external,
|
|
|
|
plugins: [
|
|
|
|
esbuild({
|
|
|
|
include: /\.[jt]sx?$/,
|
|
|
|
minify: false,
|
|
|
|
sourceMap: true,
|
|
|
|
target: 'es2016',
|
|
|
|
}),
|
|
|
|
commonjs(),
|
2024-04-25 13:51:42 +03:00
|
|
|
nodeResolve(),
|
2024-04-24 20:26:02 +03:00
|
|
|
json()
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/index.ts',
|
|
|
|
output: [
|
|
|
|
{
|
|
|
|
file: pkgJson.module,
|
|
|
|
format: "esm",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
external,
|
|
|
|
plugins: [
|
|
|
|
esbuild({
|
|
|
|
include: /\.[jt]sx?$/,
|
|
|
|
minify: false,
|
|
|
|
sourceMap: true,
|
|
|
|
target: 'es2016',
|
|
|
|
}),
|
|
|
|
nodeResolve(),
|
|
|
|
json()
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/cli.ts',
|
|
|
|
output: [
|
|
|
|
{
|
|
|
|
file: pkgJson.bin[pkgJson.name],
|
2024-04-24 20:25:54 +03:00
|
|
|
format: "cjs",
|
|
|
|
esModule: false,
|
|
|
|
banner: '#!/usr/bin/env node\n'
|
|
|
|
},
|
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
esbuild({
|
|
|
|
include: /\.[jt]sx?$/,
|
|
|
|
minify: false,
|
|
|
|
sourceMap: true,
|
|
|
|
target: 'es2016',
|
|
|
|
}),
|
|
|
|
commonjs(),
|
2024-04-25 13:51:42 +03:00
|
|
|
nodeResolve(),
|
2024-04-24 20:25:54 +03:00
|
|
|
json()
|
|
|
|
],
|
2024-04-24 20:26:02 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/merkleTreeWorker.ts',
|
|
|
|
output: [
|
|
|
|
{
|
|
|
|
file: 'static/merkleTreeWorker.js',
|
|
|
|
format: "cjs",
|
|
|
|
esModule: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
treeshake: 'smallest',
|
|
|
|
plugins: [
|
|
|
|
esbuild({
|
|
|
|
include: /\.[jt]sx?$/,
|
|
|
|
minify: false,
|
|
|
|
sourceMap: true,
|
|
|
|
target: 'es2016',
|
|
|
|
}),
|
|
|
|
commonjs(),
|
|
|
|
nodeResolve(),
|
2024-04-25 13:51:42 +03:00
|
|
|
json()
|
2024-04-24 20:26:02 +03:00
|
|
|
],
|
2024-04-24 20:25:54 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
export default config;
|