2019-11-23 15:15:06 +03:00
|
|
|
"use strict";
|
|
|
|
|
2020-11-15 01:42:36 +03:00
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
|
|
//import inject from '@rollup/plugin-inject';
|
|
|
|
import resolveNode from "@rollup/plugin-node-resolve";
|
2019-11-23 15:15:06 +03:00
|
|
|
|
2020-11-15 01:42:36 +03:00
|
|
|
import nodePolyfills from "rollup-plugin-node-polyfills";
|
2019-11-23 15:15:06 +03:00
|
|
|
|
2020-11-15 01:42:36 +03:00
|
|
|
import json from "@rollup/plugin-json";
|
2019-11-23 15:15:06 +03:00
|
|
|
|
2020-11-17 05:20:35 +03:00
|
|
|
function getConfig(format) {
|
|
|
|
|
|
|
|
// ESM config
|
|
|
|
let input = "./packages/tests/lib.esm/index.js";
|
|
|
|
let mainFields = undefined;
|
|
|
|
let globals = undefined;
|
|
|
|
|
|
|
|
if (format === "umd") {
|
|
|
|
input = "./packages/tests/lib/index.js";
|
|
|
|
mainFields = [ "browser", "main" ];
|
|
|
|
globals = { ethers: "ethers" };
|
|
|
|
}
|
|
|
|
|
2019-11-23 15:15:06 +03:00
|
|
|
const plugins = [
|
|
|
|
json(),
|
2020-11-15 01:42:36 +03:00
|
|
|
/*
|
|
|
|
inject({
|
|
|
|
modules: {
|
|
|
|
Buffer: [ "buffer", "Buffer" ],
|
|
|
|
},
|
|
|
|
include: "* * /test-utils.js"
|
|
|
|
}),
|
|
|
|
*/
|
|
|
|
commonjs({
|
|
|
|
}),
|
|
|
|
nodePolyfills({
|
|
|
|
assert: true
|
|
|
|
}),
|
2020-11-18 04:36:19 +03:00
|
|
|
resolveNode({ mainFields }),
|
2019-11-23 15:15:06 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
return {
|
|
|
|
input: input,
|
|
|
|
output: {
|
|
|
|
file: ("./packages/tests/dist/tests." + format + ".js"),
|
2020-11-17 05:20:35 +03:00
|
|
|
name: "testing",
|
|
|
|
format,
|
|
|
|
globals
|
2019-11-23 15:15:06 +03:00
|
|
|
},
|
2020-09-05 08:14:25 +03:00
|
|
|
context: "window",
|
2019-11-23 15:15:06 +03:00
|
|
|
treeshake: false,
|
2020-11-17 05:20:35 +03:00
|
|
|
external: [ "ethers" ],
|
2019-11-23 15:15:06 +03:00
|
|
|
plugins: plugins
|
|
|
|
};
|
|
|
|
}
|
2020-11-15 01:42:36 +03:00
|
|
|
|
|
|
|
const configs = [
|
2020-11-17 05:20:35 +03:00
|
|
|
getConfig("umd"),
|
|
|
|
getConfig("esm"),
|
2020-11-15 01:42:36 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
export default configs;
|