Skip to content

How to reuse full-featured Deno in my Rust project? #28443

Closed Answered by typed-sigterm
typed-sigterm asked this question in Q&A
Discussion options

You must be logged in to vote

Found answer on SO from @IndevSmiles:

You're looking for the deno_runtime crate. It includes everything you're looking for. It notably doesn't include typescript support if you're looking for that.

You can find an example of bootstrapping the runtime from Rust and two-way communication here, but TLDR; you need to bootstrap a main worker, pass in some options, and then run your JavaScript.

let mut worker = MainWorker::bootstrap_from_options(
  &main_module,
  WorkerServiceOptions::<
    DenoInNpmPackageChecker,
    NpmResolver<sys_traits::impls::RealSys>,
    sys_traits::impls::RealSys,
  > {
    module_loader: Rc::new(FsModuleLoader),
    permissions: PermissionsContainer::allow_all(perm…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by typed-sigterm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant