Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bun.sh as runtime #119

Closed
yagarea opened this issue Nov 23, 2022 · 4 comments · Fixed by #127
Closed

bun.sh as runtime #119

yagarea opened this issue Nov 23, 2022 · 4 comments · Fixed by #127

Comments

@yagarea
Copy link

yagarea commented Nov 23, 2022

Hello, is there way to use bun.sh as runtime ?

Thanks for support

@casperisfine
Copy link

See #116

You can probably define an ExternalRuntime that call bun run https://github.com/rails/execjs/blob/master/lib/execjs/runtimes.rb#L21-L26

@yagarea
Copy link
Author

yagarea commented Nov 27, 2022

Thanks for suggestion. I tried this:

require 'execjs'
require "execjs/external_runtime"

PATH_TO_JS = File.join(__dir__, "/katex.min.js")
BUN = ExternalRuntime.new(
      name:        "Bun",
      command:     ["bun run"],
      #runner_path: ExecJS.root + "/support/node_runner.js",
      encoding:    'UTF-8'
)
KATEX = BUN.compile(open(PATH_TO_JS).read)

But I get

project.rb:10:in `<top (required)>': uninitialized constant ExternalRuntime (NameError)

Am I accessing the ExternalRuntime class right ?

@casperisfine
Copy link

ExecJS::ExternalRuntime.new

@yagarea
Copy link
Author

yagarea commented Sep 11, 2023

Thank you! You did great job.

Is there a way to force my program to select bun as runtime even I have nodejs and bun installed at the same time ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants