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

Feature Request: Embedding Bun within other native applications (like a Rust program) #12017

Open
alshdavid opened this issue Jun 20, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@alshdavid
Copy link

alshdavid commented Jun 20, 2024

What is the problem this feature would solve?

Many native projects would like to be able to embed a JavaScript runtime that can leverage the Nodejs ecosystem and Nodejs standard library.

  • AWS Lambda
  • Supabase
  • Bundlers (Parcel, Rspack, etc)
  • Mongo
  • Applications that want to use JavaScript for plugins (like Lapce)
  • etc

What is the feature you are proposing to solve the problem?

Offer a dynamic C library (or a Rust crate) that allows Bun to be embedded within another native application

What alternatives have you considered?

  • Nodejs Embedding API
    • Very difficult to use, many projects try to use this and drop it
  • Deno
    • Embedding Deno is reasonably easy to get started with however using the Nodejs standard library is not easy. Deno requires you to fork the Deno CLI to extract support for the Nodejs API. Additionally, due to differences between Deno and Nodejs, certain features (like workspaces support) do not work as expected.
@alshdavid alshdavid added the enhancement New feature or request label Jun 20, 2024
@alshdavid alshdavid changed the title Feature Request: Embed Bun with libbun? Feature Request: Embedding Bun within other native applications (like a Rust program) Jun 20, 2024
@0xF6
Copy link

0xF6 commented Jun 23, 2024

+1
from my side cases: adding bun as a scripting provider to game engines

@DoctorGester
Copy link

@0xF6 I was looking for that as well.

Basically what I think Bun could do there:

  1. Offer an option to bun build --compile into a shared library instead of an exe, this shouldn't be too complicated.
  2. Extend bun ffi to also work backwards, i.e. define exported C ABI functions from javascript.

@bayasdev
Copy link

bayasdev commented Sep 4, 2024

+1

3 similar comments
@paranoikcodit
Copy link

+1

@voltration
Copy link

+1

@gornostay25
Copy link
Contributor

+1

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

No branches or pull requests

7 participants