load("@io_bazel_rules_go//go:def.bzl", "go_library") load("//tools:nodejs_test.bzl", "nodejs_test") load("//tools:vendored_js.bzl", "vendored_js_test") # prover.wasm is a gitignored build artifact (23 MB). Don't let Gazelle glob the # on-disk copy into embedsrcs — it's produced hermetically by :gen_prover_wasm # below (the //cmd/prover-wasm binary cross-built for js/wasm). # gazelle:exclude prover.wasm genrule( name = "gen_prover_wasm", srcs = ["//cmd/prover-wasm"], outs = ["prover.wasm"], cmd = "cp $< $@", ) go_library( name = "public", srcs = ["embed.go"], embedsrcs = [ "prover.wasm", # keep: generated by :gen_prover_wasm (hermetic wasm build) "bitwrap.css", "bitwrap.js", "bridge.js", "coercion_parity_test.mjs", "dev-wallet.js", "editor.html", "favicon.svg", "index.html", "llms-full.txt", "llms.txt", "logo.svg", "merkle.js", "mimc.js", "model.js", "parity_test.mjs", "pedersen.js", "pedersen_parity_test.mjs", "petri-sim.js", "petri-solver.js", "petri-view.css", "petri-view.js", "poll.html", "poll.js", "prover-worker.js", "prover.js", "prover_wasm_circuits_smoke.mjs", "remix-plugin.html", "remix-plugin.js", "safemath.js", "seal-cid.mjs", "sk-creator-store.js", "sk_creator_store_test.mjs", "state.js", "v3_wasm_compile_prove_diag.mjs", "v3_wasm_export_diag.mjs", "v3_wasm_prove_diag.mjs", "vendor/jsonld.bundle.mjs", "wasm_exec.js", "wasm_load_native_diag.mjs", "wasm_load_wasm_diag.mjs", "wasm_roundtrip_diag.mjs", "witness-builder.js", "witness_v3_parity.mjs", "petri-colors.js", ], importpath = "github.com/stackdump/bitwrap-io/public", visibility = ["//visibility:public"], ) # --- Go<->JS parity tests (hermetic Node toolchain) --- # The browser-side ES modules + their parity fixture, staged as runfiles for the # nodejs_test targets. Each .mjs resolves "./foo.js" relative to its own # location, so no cwd assumptions. filegroup( name = "js_parity_srcs", srcs = glob( [ "*.js", "vendor/*.mjs", "pedersen_vectors.json", ], allow_empty = False, ), ) # Pure-JS parity/smoke checks (no wasm). The 6 WASM-dependent diagnostics # (v3_wasm_*, wasm_load_*, wasm_roundtrip, prover_wasm_circuits_smoke) need a # prover.wasm + Go runtime harness and aren't wired yet — see CLAUDE.md. [ nodejs_test( name = name, data = [ name + ".mjs", ":js_parity_srcs", ], entry_point = name + ".mjs", ) for name in [ "coercion_parity_test", "parity_test", "pedersen_parity_test", "seal-cid", "sk_creator_store_test", "witness_v3_parity", ] ] # The browser modules here are copies of pflow-xyz's. pflow-js.lock pins their # bytes offline; this pins their VERSION, by diffing them against # @pflow_xyz//public:browser_modules at the commit git_override names in # MODULE.bazel. Bumping that pin is then a deliberate, reviewable act, and # "how far behind is this copy" becomes a build question rather than an # archaeological one. # # Order must match: each vendored file is compared against the upstream file at # the same index. vendored_js_test( name = "vendored_js_matches_upstream", upstream = ["@pflow_xyz//public:browser_modules"], vendored = [ "petri-colors.js", "petri-sim.js", "petri-solver.js", "petri-view.js", "petri-view.css", "seal-cid.mjs", "vendor/jsonld.bundle.mjs", ], )