Skip to content

Commit

Permalink
Fixed rollup wasm file issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzc0re committed Jul 4, 2023
1 parent e6d6149 commit 0c7fa80
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 39 deletions.
3 changes: 2 additions & 1 deletion examples/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<script src="https://cdn.jsdelivr.net/npm/@deliberative/crypto@latest/lib/index.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/@deliberative/crypto@latest/lib/index.min.js"></script> -->
<script src="../../lib/index.min.js"></script>
<script type="text/javascript">
const uint8ToHex = (array) => {
return array.reduce(
Expand Down
146 changes: 128 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@deliberative/crypto",
"description": "Libsodium and Shamir secret sharing wasm module for nodejs and the browser.",
"version": "0.9.2",
"version": "0.9.3",
"repository": {
"type": "git",
"url": "https://github.com/deliberative/crypto.git"
Expand Down Expand Up @@ -91,7 +91,6 @@
"@rollup/plugin-replace": "^5.0.0",
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-url": "^8.0.0",
"@rollup/plugin-wasm": "^6.0.0",
"@types/emscripten": "^1.39.6",
"@types/jest": "^29.0.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
Expand All @@ -110,6 +109,7 @@
"prettier": "^2.3.1",
"rollup": "^3.1.0",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-copy": "^3.4.0",
"terser": "^5.15.1",
"ts-jest": "^29.0.0-next.1",
"tslib": "^2.3.1",
Expand Down
35 changes: 19 additions & 16 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import typescript from "@rollup/plugin-typescript";
import url from "@rollup/plugin-url";
// import { terser } from "rollup-plugin-terser";
import analyzer from "rollup-plugin-analyzer";
import copy from "rollup-plugin-copy";

import pkg from "./package.json" assert { type: "json" };

Expand Down Expand Up @@ -40,32 +41,34 @@ const plugins = [
sourceMap: true,
inlineSources: !production,
declarationMap: true,
exclude: ["__tests__", "__tests__/*.test.ts"],
exclude: [
"__tests__",
"__tests__/*.test.ts",
"__specs__",
"__specs__/*.spec.ts",
"playwright*",
"rollup*",
],
outDir: `${dir}`,
}),

copy({
targets: [
{
src: "src/c/build/dcryptoMethodsModule.wasm",
dest: `${dir}`,
},
],
}),

analyzer(),
];

export default [
// UMD
{
input,
plugins: [
...plugins,

// terser({
// ecma: 2020,
// mangle: { toplevel: true },
// compress: {
// module: true,
// toplevel: true,
// unsafe_arrows: true,
// drop_console: true,
// drop_debugger: true,
// },
// }),
],
plugins,
output: {
name: "dcrypto",
file: pkg.browser,
Expand Down
1 change: 0 additions & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const withJS = ` \
-s MODULARIZE=1 \
-s MAIN_MODULE=2 \
-s POLYFILL=0 \
-s SINGLE_FILE=1 \
`;

const memory = `\
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src", "__tests__"],
"include": ["src", "__tests__", "__specs__", "playwright.config.ts", "rollup.config.ts"],
"exclude": ["node_modules"]
}

0 comments on commit 0c7fa80

Please sign in to comment.