2019-12-02 18:12:59 +01:00
|
|
|
// rollup.config.js
|
2020-04-06 17:35:51 +02:00
|
|
|
import commonjs from "rollup-plugin-commonjs";
|
|
|
|
import nodeResolve from "rollup-plugin-node-resolve";
|
|
|
|
import json from "@rollup/plugin-json";
|
|
|
|
import replace from "@rollup/plugin-replace";
|
|
|
|
import builtins from "builtin-modules";
|
|
|
|
import { terser } from "rollup-plugin-terser";
|
2019-12-02 18:12:59 +01:00
|
|
|
|
|
|
|
const walletCli = {
|
2020-04-06 17:35:51 +02:00
|
|
|
input: "dist/node/headless/taler-wallet-cli.js",
|
2019-12-02 18:12:59 +01:00
|
|
|
output: {
|
2020-04-06 17:35:51 +02:00
|
|
|
file: "dist/standalone/taler-wallet-cli.js",
|
|
|
|
format: "cjs",
|
2019-12-02 18:12:59 +01:00
|
|
|
},
|
2019-12-16 16:59:09 +01:00
|
|
|
external: builtins,
|
2019-12-02 18:12:59 +01:00
|
|
|
plugins: [
|
2020-04-07 11:44:02 +02:00
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
commonjs({
|
2020-04-07 11:44:02 +02:00
|
|
|
include: ["node_modules/**", "dist/node/**"],
|
2020-04-06 17:35:51 +02:00
|
|
|
extensions: [".js", ".ts"],
|
|
|
|
ignoreGlobal: false, // Default: false
|
|
|
|
sourceMap: false,
|
|
|
|
ignore: ["taler-wallet"],
|
|
|
|
}),
|
|
|
|
json(),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
const walletAndroid = {
|
|
|
|
input: "dist/node/android/index.js",
|
|
|
|
output: {
|
|
|
|
file: "dist/standalone/taler-wallet-android.js",
|
|
|
|
format: "cjs",
|
|
|
|
exports: "named",
|
|
|
|
},
|
|
|
|
external: builtins,
|
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
|
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
2019-12-02 18:12:59 +01:00
|
|
|
commonjs({
|
2020-04-06 17:35:51 +02:00
|
|
|
include: ["node_modules/**", "dist/node/**"],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false, // Default: false
|
2019-12-02 18:12:59 +01:00
|
|
|
sourceMap: false,
|
2020-04-06 17:35:51 +02:00
|
|
|
ignore: ["taler-wallet"],
|
2019-12-16 16:59:09 +01:00
|
|
|
}),
|
2020-04-06 17:35:51 +02:00
|
|
|
],
|
|
|
|
};
|
2019-12-16 16:59:09 +01:00
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
const webExtensionPageEntryPoint = {
|
|
|
|
input: "dist/node/webex/pageEntryPoint.js",
|
|
|
|
output: {
|
|
|
|
file: "dist/webextension/pageEntryPoint.js",
|
|
|
|
format: "iife",
|
|
|
|
exports: "default",
|
|
|
|
name: "webExtensionPageEntry",
|
|
|
|
},
|
|
|
|
external: builtins,
|
|
|
|
plugins: [
|
2019-12-16 16:59:09 +01:00
|
|
|
json(),
|
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
terser(),
|
|
|
|
|
|
|
|
replace({
|
|
|
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
|
|
}),
|
|
|
|
|
|
|
|
commonjs({
|
|
|
|
include: ["node_modules/**", "dist/node/**"],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false, // Default: false
|
|
|
|
sourceMap: false,
|
|
|
|
ignore: ["taler-wallet"],
|
|
|
|
}),
|
|
|
|
],
|
2019-12-02 18:12:59 +01:00
|
|
|
};
|
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
const webExtensionBackgroundPageScript = {
|
|
|
|
input: "dist/node/webex/background.js",
|
2019-12-05 19:38:19 +01:00
|
|
|
output: {
|
2020-04-06 17:35:51 +02:00
|
|
|
file: "dist/webextension/background.js",
|
|
|
|
format: "iife",
|
|
|
|
exports: "default",
|
|
|
|
name: "webExtensionBackgroundScript",
|
2019-12-05 19:38:19 +01:00
|
|
|
},
|
2019-12-16 16:59:09 +01:00
|
|
|
external: builtins,
|
2019-12-05 19:38:19 +01:00
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
|
|
|
|
nodeResolve({
|
2020-04-06 17:35:51 +02:00
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
terser(),
|
|
|
|
|
|
|
|
replace({
|
|
|
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
2019-12-05 19:38:19 +01:00
|
|
|
}),
|
|
|
|
|
|
|
|
commonjs({
|
2020-04-06 17:35:51 +02:00
|
|
|
include: ["node_modules/**", "dist/node/**"],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false, // Default: false
|
2019-12-05 19:38:19 +01:00
|
|
|
sourceMap: false,
|
2020-04-06 17:35:51 +02:00
|
|
|
ignore: ["taler-wallet", "crypto"],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
const webExtensionCryptoWorker = {
|
|
|
|
input: "dist/node/crypto/workers/browserWorkerEntry.js",
|
|
|
|
output: {
|
|
|
|
file: "dist/webextension/browserWorkerEntry.js",
|
|
|
|
format: "iife",
|
|
|
|
exports: "default",
|
|
|
|
name: "webExtensionCryptoWorker",
|
|
|
|
},
|
|
|
|
external: builtins,
|
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
|
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
terser(),
|
|
|
|
|
|
|
|
replace({
|
|
|
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
|
|
}),
|
|
|
|
|
|
|
|
commonjs({
|
|
|
|
include: ["node_modules/**", "dist/node/**"],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false, // Default: false
|
|
|
|
sourceMap: false,
|
|
|
|
ignore: ["taler-wallet", "crypto"],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
const webExtensionContentScript = {
|
|
|
|
input: "dist/node/webex/notify.js",
|
|
|
|
output: {
|
|
|
|
file: "dist/webextension/contentScript.js",
|
|
|
|
format: "iife",
|
|
|
|
exports: "default",
|
|
|
|
name: "webExtensionContentScript",
|
|
|
|
},
|
|
|
|
external: builtins,
|
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
|
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
terser(),
|
|
|
|
|
|
|
|
replace({
|
|
|
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
|
|
}),
|
|
|
|
|
|
|
|
commonjs({
|
|
|
|
include: ["node_modules/**", "dist/node/**"],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false, // Default: false
|
|
|
|
sourceMap: false,
|
|
|
|
ignore: ["taler-wallet"],
|
|
|
|
}),
|
|
|
|
],
|
2019-12-05 19:38:19 +01:00
|
|
|
};
|
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
export default [
|
|
|
|
walletCli,
|
|
|
|
walletAndroid,
|
|
|
|
webExtensionPageEntryPoint,
|
|
|
|
webExtensionBackgroundPageScript,
|
|
|
|
webExtensionCryptoWorker,
|
|
|
|
webExtensionContentScript,
|
|
|
|
];
|