-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(poseidon-proof): add conditional bundles
- Loading branch information
Showing
13 changed files
with
108 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import alias from "@rollup/plugin-alias" | ||
import json from "@rollup/plugin-json" | ||
import * as fs from "fs" | ||
import cleanup from "rollup-plugin-cleanup" | ||
import typescript from "rollup-plugin-typescript2" | ||
|
||
const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8")) | ||
const banner = `/** | ||
* @module ${pkg.name} | ||
* @version ${pkg.version} | ||
* @file ${pkg.description} | ||
* @copyright Ethereum Foundation 2023 | ||
* @license ${pkg.license} | ||
* @see [Github]{@link ${pkg.homepage}} | ||
*/` | ||
|
||
export default { | ||
input: "src/index.ts", | ||
output: [ | ||
{ | ||
file: pkg.exports.browser, | ||
format: "es", | ||
banner | ||
} | ||
], | ||
external: Object.keys(pkg.dependencies), | ||
plugins: [ | ||
alias({ | ||
entries: [{ find: "./get-snark-artifacts.node", replacement: "./get-snark-artifacts.browser" }] | ||
}), | ||
typescript({ | ||
tsconfig: "./build.tsconfig.json", | ||
useTsconfigDeclarationDir: true | ||
}), | ||
cleanup({ comments: "jsdoc" }), | ||
json() | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* istanbul ignore file */ | ||
import { defaultSnarkArtifacts } from "./config" | ||
|
||
export default async function getSnarkArtifacts() { | ||
return defaultSnarkArtifacts | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* istanbul ignore file */ | ||
import download from "download" | ||
import tmp from "tmp" | ||
import fs from "fs" | ||
import { defaultSnarkArtifacts } from "./config" | ||
|
||
export default async function getSnarkArtifacts() { | ||
const tmpDir = "poseidon-proof" | ||
const tmpPath = `${tmp.tmpdir}/${tmpDir}` | ||
|
||
if (!fs.existsSync(tmpPath)) { | ||
tmp.dirSync({ name: tmpDir }) | ||
|
||
await download(defaultSnarkArtifacts.wasmFilePath, tmpPath) | ||
await download(defaultSnarkArtifacts.zkeyFilePath, tmpPath) | ||
} | ||
|
||
return { | ||
wasmFilePath: `${tmpPath}/poseidon-proof.wasm`, | ||
zkeyFilePath: `${tmpPath}/poseidon-proof.zkey` | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters