summaryrefslogtreecommitdiff
path: root/deno_typescript
diff options
context:
space:
mode:
Diffstat (limited to 'deno_typescript')
-rw-r--r--deno_typescript/compiler_main.js13
-rw-r--r--deno_typescript/lib.rs26
2 files changed, 3 insertions, 36 deletions
diff --git a/deno_typescript/compiler_main.js b/deno_typescript/compiler_main.js
index 1cc42072a..3a916f540 100644
--- a/deno_typescript/compiler_main.js
+++ b/deno_typescript/compiler_main.js
@@ -3,15 +3,10 @@
const ASSETS = "$asset$";
-let replacements;
-
-function main(configText, rootNames, replacements_) {
+function main(configText, rootNames) {
println(`>>> ts version ${ts.version}`);
println(`>>> rootNames ${rootNames}`);
- replacements = replacements_;
- println(`>>> replacements ${JSON.stringify(replacements)}`);
-
const host = new Host();
assert(rootNames.length > 0);
@@ -148,12 +143,6 @@ class Host {
sourceCode = sourceCode.replace("export = ts;", "");
}
- // TODO(ry) A terrible hack. Please remove ASAP.
- for (let key of Object.keys(replacements)) {
- let val = replacements[key];
- sourceCode = sourceCode.replace(key, val);
- }
-
let sourceFile = ts.createSourceFile(fileName, sourceCode, languageVersion);
sourceFile.moduleName = moduleName;
return sourceFile;
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()
-}