You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keep in mind, make is needed to create the WASM files. You will need a simple clang installation, with the WABT and Binaryen toolchains installed.
This is similar to #14037 , but now using a plugin to create a module using contents instead of exports as that causes the build to just output nothing. The plugin below is being exported to then be called in scripts/build.ts
#!/usr/bin/env bun
import{plugin,typeBunPlugin}from"bun"exportconstbinayloader: BunPlugin={name: "binaryloader",asyncsetup(build){// create a toBinary module, one per buildbuild.onLoad({filter: /^__toBinary$/},async(args)=>{return{contents: `export default /* @__PURE__ */ (() => { var table = new Uint8Array(128); for (var i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i; return (base64) => { var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0); for (var i2 = 0, j = 0; i2 < n; ) { var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)]; var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)]; bytes[j++] = c0 << 2 | c1 >> 4; bytes[j++] = c1 << 4 | c2 >> 2; bytes[j++] = c2 << 6 | c3; } return bytes; }; })();`,}})build.onLoad({filter: /\.(wasm)$/},async(args)=>{constbuffer=awaitBun.file(args.path).arrayBuffer()/* return { exports: { default: new Uint8Array(buffer) }, loader: "object", } */return{contents: `import __toBinary from "__toBinary"; export default __toBinary("${Buffer.from(buffer).toString('base64')}");`,}})},}awaitplugin(binayloader)
Relevant log output
No response
Stack Trace (bun.report)
Bun v1.1.29 (6d43b36) on linux x86_64 [AutoCommand]
How can we reproduce the crash?
Clone the repository randomx.js at commit hash
b76bb84
. Then perform a simple bun build pointing at the library root, after runningmake
.Keep in mind,
make
is needed to create the WASM files. You will need a simple clang installation, with the WABT and Binaryen toolchains installed.This is similar to #14037 , but now using a plugin to create a module using
contents
instead ofexports
as that causes the build to just output nothing. The plugin below is being exported to then be called inscripts/build.ts
Relevant log output
No response
Stack Trace (bun.report)
Bun v1.1.29 (
6d43b36
) on linux x86_64 [AutoCommand]Segmentation fault at address 0x00000004
bundle_v2.zig:9588
:src.bundler.bundle_v2.LinkerContext.generateChunksInParallel
bundle_v2.zig:1712
:Thread.PosixThreadImpl.spawn__anon_171286.Instance.entryFn
Features: jsc, bunfig, tsconfig
The text was updated successfully, but these errors were encountered: