summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2020-09-06 02:34:02 +0200
committerGitHub <noreply@github.com>2020-09-06 02:34:02 +0200
commitc821e8f2f1fb8ad5e9eb00854277cafc8c80b2f5 (patch)
treec429a3c2707a4047fb512443a8468b7e15e5730d /cli/build.rs
parent849431eb1d112d1f79f4a327830dc1a5bf22dd47 (diff)
Move JSON ops to deno_core (#7336)
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 4b26a24b0..40b803979 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -1,8 +1,11 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+
mod op_fetch_asset;
use deno_core::js_check;
+use deno_core::BasicState;
use deno_core::CoreIsolate;
+use deno_core::OpRegistry;
use deno_core::StartupData;
use std::collections::HashMap;
use std::env;
@@ -28,8 +31,9 @@ fn create_snapshot(
}
fn create_runtime_snapshot(snapshot_path: &Path, files: Vec<String>) {
- let runtime_isolate = CoreIsolate::new(StartupData::None, true);
- create_snapshot(runtime_isolate, snapshot_path, files);
+ let state = BasicState::new();
+ let isolate = CoreIsolate::new(state, StartupData::None, true);
+ create_snapshot(isolate, snapshot_path, files);
}
fn create_compiler_snapshot(
@@ -37,7 +41,6 @@ fn create_compiler_snapshot(
files: Vec<String>,
cwd: &Path,
) {
- let mut runtime_isolate = CoreIsolate::new(StartupData::None, true);
let mut custom_libs: HashMap<String, PathBuf> = HashMap::new();
custom_libs
.insert("lib.deno.web.d.ts".to_string(), deno_web::get_declaration());
@@ -61,11 +64,15 @@ fn create_compiler_snapshot(
"lib.deno.unstable.d.ts".to_string(),
cwd.join("dts/lib.deno.unstable.d.ts"),
);
- runtime_isolate.register_op(
+
+ let state = BasicState::new();
+ state.register_op(
"op_fetch_asset",
op_fetch_asset::op_fetch_asset(custom_libs),
);
- create_snapshot(runtime_isolate, snapshot_path, files);
+
+ let isolate = CoreIsolate::new(state, StartupData::None, true);
+ create_snapshot(isolate, snapshot_path, files);
}
fn ts_version() -> String {