Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Allow configuring js runtime for the compiler

Open sigmaSd opened this issue 2 years ago • 3 comments

Summary

Adding a nim configuration option to choose which javascript runtime to run the js examples with docgen

Description

Currently docgen runs the javascript examples with node, but I want to run it with deno because I depend on Deno apis (when targeting deno) also maybe someone wants to target bun

Currently its hard coded here https://github.com/nim-lang/Nim/blob/1e0165186bb8539cfd8aca1a7af8d01dc278bd46/compiler/nim.nim#L101

I propose adding a configuration option that allows the user to choose the runtime.

Alternatives

No response

Standard Output Examples

No response

Backwards Compatibility

No response

Links

No response

sigmaSd avatar Sep 25 '22 09:09 sigmaSd

I noticed this also affects nim c -r --backend=js file.nim

sigmaSd avatar Sep 25 '22 16:09 sigmaSd

My current workaround is to use nimble tasks, for example https://github.com/sigmaSd/deno-nim/blob/master/deno_nim.nimble#L26 and mark the docs with "-r:off", while making nimble docs run them with deno

This allows me to write inline tests/examples image

sigmaSd avatar Sep 26 '22 21:09 sigmaSd

I was about to create a new issue but I noticed this exists. It would be amazing to let us use Bun for running the JS transpiler.

koaledu avatar Feb 13 '24 20:02 koaledu