summaryrefslogtreecommitdiff
path: root/deno_typescript/lib.rs
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2019-09-07 01:57:15 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-09-06 12:57:15 -0400
commit595b4daa77771458457e178b6b590a044cd41ad0 (patch)
treed8b19636e4795bcb11ba5c45982d32334da60115 /deno_typescript/lib.rs
parentca000392857b4c79a3609ddbc20073222498998b (diff)
Remove replacements hack in deno_typescript (#2864)
Diffstat (limited to 'deno_typescript/lib.rs')
-rw-r--r--deno_typescript/lib.rs26
1 files changed, 2 insertions, 24 deletions
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<String>,
) -> Result<Arc<Mutex<TSState>>, 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("<anon>", 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()
-}