52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import dts from "vite-plugin-dts";
|
|
|
|
export default defineConfig({
|
|
root: __dirname,
|
|
cacheDir: "../../../node_modules/.vite/packages/crypto-cipher",
|
|
plugins: [
|
|
dts({
|
|
entryRoot: "src",
|
|
tsconfigPath: "./tsconfig.lib.json",
|
|
insertTypesEntry: true,
|
|
}),
|
|
],
|
|
build: {
|
|
outDir: "./dist",
|
|
emptyOutDir: true,
|
|
reportCompressedSize: true,
|
|
sourcemap: true,
|
|
lib: {
|
|
entry: {
|
|
index: "src/index.ts",
|
|
"primitives/aes-256-gcm/aes-256-gcm": "src/primitives/aes-256-gcm/aes-256-gcm.ts",
|
|
"primitives/chacha20-poly1305/chacha20-poly1305": "src/primitives/chacha20-poly1305/chacha20-poly1305.ts",
|
|
"primitives/xchacha20-poly1305/xchacha20-poly1305": "src/primitives/xchacha20-poly1305/xchacha20-poly1305.ts",
|
|
"streaming/streaming-aead/index": "src/streaming/streaming-aead/index.ts",
|
|
"streaming/streaming-aead-aes-gcm/index": "src/streaming/streaming-aead-aes-gcm/index.ts",
|
|
"streaming/streaming-aead-xchacha20/index": "src/streaming/streaming-aead-xchacha20/index.ts",
|
|
},
|
|
formats: ["es"],
|
|
},
|
|
rollupOptions: {
|
|
treeshake: true,
|
|
output: {
|
|
preserveModules: true,
|
|
preserveModulesRoot: "src",
|
|
entryFileNames: "[name].js",
|
|
},
|
|
external: [
|
|
"@noble/ciphers",
|
|
/^@noble\//,
|
|
"@suaveplan/crypto-utils",
|
|
/^@suaveplan\/crypto-utils\//,
|
|
"@suaveplan/error",
|
|
"@suaveplan/types",
|
|
"tslib",
|
|
"zod",
|
|
/^node:/,
|
|
],
|
|
},
|
|
},
|
|
});
|