Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions modules/iframe-app/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// WASM support inspired by https://stackoverflow.com/a/59720645

module.exports = function override(config, env) {
const wasmExtensionRegExp = /\.wasm$/;

config.resolve.extensions.push(".wasm");

// make file-loader ignore WASM files
config.module.rules.forEach((rule) => {
(rule.oneOf || []).forEach((oneOf) => {
if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) {
oneOf.exclude.push(wasmExtensionRegExp);
}
});
});

// add a dedicated loader for WASM
config.module.rules.push({
test: wasmExtensionRegExp,

// necessary to avoid "Module parse failed: magic header not detected" errors;
// see https://github.com/pine/arraybuffer-loader/issues/12#issuecomment-390834140
type: "javascript/auto",

use: [{ loader: require.resolve("wasm-loader"), options: {} }],
});

return config;
};
14 changes: 8 additions & 6 deletions modules/iframe-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
"react": "17.0.1",
"react-dom": "17.0.1",
"react-scripts": "3.4.3",
"typescript": "4.2.4"
"react-app-rewired": "2.1.8",
"typescript": "4.2.4",
"wasm-loader": "1.3.0"
},
"scripts": {
"start": "BROWSER=none PORT=3030 react-scripts start",
"build": "REACT_APP_VECTOR_CONFIG=$(cat \"../../ops/config/browser.default.json\") SKIP_PREFLIGHT_CHECK=true react-scripts build",
"build-prod": "SKIP_PREFLIGHT_CHECK=true react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "BROWSER=none PORT=3030 react-app-rewired start",
"build": "REACT_APP_VECTOR_CONFIG=$(cat \"../../ops/config/browser.default.json\") SKIP_PREFLIGHT_CHECK=true react-app-rewired build",
"build-prod": "SKIP_PREFLIGHT_CHECK=true react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
"eslintConfig": {
"extends": [
Expand Down
6 changes: 5 additions & 1 deletion modules/utils/src/merkle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ describe("generateMerkleTreeData", () => {
});
};

let toFree: merkle.Tree;
let toFree: merkle.Tree | undefined;

const getMerkleTreeRoot = (transfers: CoreTransferState[]): string => {
const data = generateMerkleTreeData(transfers);
toFree = data.tree;
return data.root;
};

beforeEach(() => {
toFree = undefined;
});

afterEach(() => {
if (toFree) {
toFree.free();
Expand Down
56 changes: 56 additions & 0 deletions package-lock.json

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