rescript-bun icon indicating copy to clipboard operation
rescript-bun copied to clipboard

0.4.1 doesn't work with the last versions of bun and ReScript #10563

Open cherifGsoul opened this issue 1 year ago • 2 comments

What version of Bun is running?

1.1.5

What platform is your computer?

Linux Ubuntu

What steps can reproduce the bug?

  • Start an app using https://github.com/zth/rescript-bun-starter.
  • Upgrade dependencies to:
 "dependencies": {
    "@rescript/core": "1.3.0",
    "rescript": "11.1.0",
    "rescript-bun": "^0.4.1"
  }

and ReScript config

ReScript config

{
  "name": "rescript-bun-examinr",
  "sources": {
    "dir": "src",
    "subdirs": true
  },
  "package-specs": {
    "module": "esmodule",
    "in-source": true
  },
  "suffix": ".res.js",
  "bs-dependencies": [
    "@rescript/core",
    "rescript-bun"
  ],
  "bsc-flags": [
    "-open RescriptCore",
    "-open RescriptBun",
    "-open RescriptBun.Globals"
  ]
}
  • Try to run res:dev

  • You should see the following error

$ rescript build -w
>>>> Start compiling
Dependency on @rescript/core
Dependency on rescript-bun
rescript: [1/5] src/Process-RescriptBun.cmj
FAILED: src/Process-RescriptBun.cmj

  We've found a bug for you!
  /home/cherif/Dev/rescript-pg/rescript-bun-examinr/node_modules/rescript-bun/src/Process.res:148:29-36

  146 │ @send external hrtime: t => (int, int) = "hrtime"
  147 │ @send @scope("hrtime")
  148 │ external hrtimeBigInt: t => BigInt.t = "bigint"
  149 │ @get external stderr: t => Stream.Writable.t<Buffer.t> = "stderr"
  150 │ @get external stdin: t => Stream.Readable.t<Buffer.t> = "stdin"

  This type constructor, `BigInt.t`, can't be found.
  If you wanted to write a recursive type, don't forget the `rec` in `type rec`

rescript: [4/5] src/Bun-RescriptBun.cmj
FAILED: src/Bun-RescriptBun.cmj

  We've found a bug for you!
  /home/cherif/Dev/rescript-pg/rescript-bun-examinr/node_modules/rescript-bun/src/Bun.res:1193:44-51

  1191 ┆ module Algorithms = {
  1192 ┆   module WyHash = {
  1193 ┆     external hashString: (string, ~seed: BigInt.t=?) => BigInt.t = "B
       ┆ un.hash.wyhash"
  1194 ┆     external hashArrayBufferView: (ArrayBufferView.t, ~seed: BigInt.t
       ┆ =?) => BigInt.t =
  1195 ┆       "Bun.hash.wyhash"

  This type constructor, `BigInt.t`, can't be found.
  If you wanted to write a recursive type, don't forget the `rec` in `type rec`

FAILED: cannot make progress due to previous errors.
Failure: /home/cherif/Dev/rescript-pg/rescript-bun-examinr/node_modules/rescript/linux/ninja.exe 
Location: /home/cherif/Dev/rescript-pg/rescript-bun-examinr/node_modules/rescript-bun/lib/bs
>>>> Finish compiling 61 mseconds

What is the expected behavior?

See an up and running app;

What do you see instead?

No response

Additional information

I tried it on Linux Ubuntu

cherifGsoul avatar Apr 27 '24 02:04 cherifGsoul

The problem could be seen when using stable ReScript 11 and ReScript core 1.3 stable version. Could it be a conflict between rescipt-bun BigInt and ReScript BigInt modules?

cherifGsoul avatar Apr 27 '24 02:04 cherifGsoul

ReScript core 1.3 break the BigInt.t, use the 1.2 can fix and waiting the next version.

bnse avatar Apr 28 '24 14:04 bnse

Fixed in 0.5.0. Sorry for the delay!

zth avatar Jun 05 '24 08:06 zth