From 595b4daa77771458457e178b6b590a044cd41ad0 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sat, 7 Sep 2019 01:57:15 +0900 Subject: Remove replacements hack in deno_typescript (#2864) --- deno_typescript/lib.rs | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'deno_typescript/lib.rs') diff --git a/deno_typescript/lib.rs b/deno_typescript/lib.rs index cf4b39d09..a9b95421d 100644 --- a/deno_typescript/lib.rs +++ b/deno_typescript/lib.rs @@ -12,7 +12,6 @@ use deno::ModuleSpecifier; use deno::StartupData; pub use ops::EmitResult; use ops::WrittenFile; -use std::collections::HashMap; use std::fs; use std::path::Path; use std::path::PathBuf; @@ -78,12 +77,8 @@ impl TSIsolate { root_names: Vec, ) -> Result>, ErrBox> { let root_names_json = serde_json::json!(root_names).to_string(); - let source = &format!( - "main({:?}, {}, {})", - config_json.to_string(), - root_names_json, - preprocessor_replacements_json() - ); + let source = + &format!("main({:?}, {})", config_json.to_string(), root_names_json); self.isolate.execute("", source)?; Ok(self.state.clone()) } @@ -269,20 +264,3 @@ pub fn trace_serializer() { deno::v8_set_flags(vec![dummy.clone(), "--trace-serializer".to_string()]); assert_eq!(r, vec![dummy]); } - -fn preprocessor_replacements_json() -> String { - /// BUILD_OS and BUILD_ARCH match the values in Deno.build. See js/build.ts. - #[cfg(target_os = "macos")] - static BUILD_OS: &str = "mac"; - #[cfg(target_os = "linux")] - static BUILD_OS: &str = "linux"; - #[cfg(target_os = "windows")] - static BUILD_OS: &str = "win"; - #[cfg(target_arch = "x86_64")] - static BUILD_ARCH: &str = "x64"; - - let mut replacements = HashMap::new(); - replacements.insert("DENO_REPLACE_OS", BUILD_OS); - replacements.insert("DENO_REPLACE_ARCH", BUILD_ARCH); - serde_json::json!(replacements).to_string() -} -- cgit v1.2.3