mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
Move JSON ops to deno_core (#7336)
This commit is contained in:
parent
849431eb1d
commit
c821e8f2f1
78 changed files with 1492 additions and 2204 deletions
17
cli/build.rs
17
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue