summaryrefslogtreecommitdiff
path: root/cli/tsc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tsc.rs')
-rw-r--r--cli/tsc.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tsc.rs b/cli/tsc.rs
index 9b944125f..f1e49167a 100644
--- a/cli/tsc.rs
+++ b/cli/tsc.rs
@@ -942,6 +942,11 @@ impl TsCompiler {
}
}
+#[derive(Debug, Deserialize)]
+struct CreateHashArgs {
+ data: String,
+}
+
fn execute_in_tsc(
global_state: Arc<GlobalState>,
req: String,
@@ -975,6 +980,14 @@ fn execute_in_tsc(
Ok(json!({}))
}),
);
+ js_runtime.register_op(
+ "op_create_hash",
+ json_op_sync(move |_s, args, _bufs| {
+ let v: CreateHashArgs = serde_json::from_value(args)?;
+ let hash = crate::checksum::gen(&[v.data.as_bytes()]);
+ Ok(json!({ "hash": hash }))
+ }),
+ );
}
let bootstrap_script = format!(