Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! use deno core for fe…
Browse files Browse the repository at this point in the history
…atures like source maps
  • Loading branch information
urbas committed Jul 20, 2024
1 parent 56bdd0e commit 7295048
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/eval/execution.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::path::Path;
use std::sync::Once;

use deno_core::v8;
use deno_core::v8::{HandleScope, Local, ModuleStatus, Object};
Expand All @@ -11,10 +10,8 @@ use super::error::NixError;
use super::helpers::{call_js_function, get_nixrt_type, try_get_js_object_key};
use super::types::js_value_to_nix;

static INIT_V8: Once = Once::new();

pub fn evaluate(nix_expr: &str, workdir: &Path) -> EvalResult {
initialize_v8();
deno_core::JsRuntime::init_platform(None);
// Declare the V8 execution context
let isolate = &mut v8::Isolate::new(Default::default());
let scope = &mut v8::HandleScope::new(isolate);
Expand Down Expand Up @@ -158,14 +155,6 @@ fn exec_module<'a>(
Ok(obj)
}

fn initialize_v8() {
INIT_V8.call_once(|| {
let platform = v8::new_default_platform(0, false).make_shared();
v8::V8::initialize_platform(platform);
v8::V8::initialize();
});
}

fn nix_value_from_module(
scope: &mut v8::ContextScope<v8::HandleScope>,
nix_module_fn: v8::Local<v8::Function>,
Expand Down

0 comments on commit 7295048

Please sign in to comment.