tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rollup.config.mjs (1371B)


      1 import path from "path";
      2 import fs from "fs";
      3 import { fileURLToPath } from "url";
      4 import typescript from "rollup-plugin-typescript2";
      5 import dts from "rollup-plugin-dts";
      6 import { nodeResolve } from "@rollup/plugin-node-resolve";
      7 const __dirname = path.dirname(fileURLToPath(import.meta.url));
      8 const pkg = JSON.parse(fs.readFileSync("./package.json", "utf8"));
      9 
     10 const LICENSE = fs.readFileSync("LICENSE", { encoding: "utf-8" });
     11 const banner = [
     12  "/*!",
     13  ...LICENSE.split("\n").map(o => ` * ${o}`),
     14  " */",
     15  "",
     16 ].join("\n");
     17 const input = "src/index.ts";
     18 const external = Object.keys(pkg.dependencies || {});
     19 external.push('@noble/hashes/sha1');
     20 external.push('@noble/hashes/sha2');
     21 
     22 export default [
     23  {
     24    input,
     25    plugins: [
     26      typescript({
     27        check: false,
     28        clean: true,
     29        tsconfigOverride: {
     30          compilerOptions: {
     31            module: "ES2020",
     32            removeComments: true,
     33          }
     34        }
     35      }),
     36      nodeResolve(),
     37    ],
     38    output: [
     39      {
     40        banner,
     41        file: pkg.main,
     42        format: "cjs",
     43      },
     44      {
     45        banner,
     46        file: pkg.module,
     47        format: "es",
     48      },
     49    ],
     50  },
     51  {
     52    input,
     53    plugins: [
     54      dts({
     55        tsconfig: path.resolve(__dirname, "./tsconfig.json")
     56      })
     57    ],
     58    output: [
     59      {
     60        banner,
     61        file: pkg.types,
     62      }
     63    ]
     64  },
     65 ];