summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 89958325b..31dfc0aba 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -1,4 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+//
+mod op_fetch_asset;
use deno_core::js_check;
use deno_core::CoreIsolate;
@@ -64,16 +66,23 @@ fn create_compiler_snapshot(
);
runtime_isolate.register_op(
"op_fetch_asset",
- deno_typescript::op_fetch_asset(custom_libs),
+ op_fetch_asset::op_fetch_asset(custom_libs),
);
- js_check(
- runtime_isolate.execute("typescript.js", deno_typescript::TYPESCRIPT_CODE),
- );
+ js_check(runtime_isolate.execute(
+ "typescript.js",
+ &std::fs::read_to_string("typescript/lib/typescript.js").unwrap(),
+ ));
create_snapshot(runtime_isolate, snapshot_path, files);
}
+fn ts_version() -> String {
+ let data = include_str!("typescript/package.json");
+ let pkg: serde_json::Value = serde_json::from_str(data).unwrap();
+ pkg["version"].as_str().unwrap().to_string()
+}
+
fn main() {
// Don't build V8 if "cargo doc" is being run. This is to support docs.rs.
if env::var_os("RUSTDOCFLAGS").is_some() {
@@ -81,12 +90,9 @@ fn main() {
}
// To debug snapshot issues uncomment:
- // deno_typescript::trace_serializer();
+ // op_fetch_asset::trace_serializer();
- println!(
- "cargo:rustc-env=TS_VERSION={}",
- deno_typescript::ts_version()
- );
+ println!("cargo:rustc-env=TS_VERSION={}", ts_version());
println!(
"cargo:rustc-env=TARGET={}",