diff options
author | Ry Dahl <ry@tinyclouds.org> | 2019-11-03 10:39:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-03 10:39:27 -0500 |
commit | 86b3ac5108e2893091475a0318fcba6c14e19140 (patch) | |
tree | 11c977dcad8271cc047e5707130b0811507370c4 /cli/compilers | |
parent | 65e91796720ea68d69ac7f925a8f239aee8fb19e (diff) |
feat: lockfiles (#3231)
Use --lock-write=lock.json or --lock-check=lock.json on the command
line.
Diffstat (limited to 'cli/compilers')
-rw-r--r-- | cli/compilers/ts.rs | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs index e38920820..c2a4ccc4a 100644 --- a/cli/compilers/ts.rs +++ b/cli/compilers/ts.rs @@ -18,9 +18,7 @@ use deno::ModuleSpecifier; use futures::Future; use futures::Stream; use regex::Regex; -use ring; use std::collections::HashSet; -use std::fmt::Write; use std::fs; use std::io; use std::path::PathBuf; @@ -178,20 +176,6 @@ fn req( j.to_string().into_boxed_str().into_boxed_bytes() } -fn gen_hash(v: Vec<&[u8]>) -> String { - let mut ctx = ring::digest::Context::new(&ring::digest::SHA256); - for src in v.iter() { - ctx.update(src); - } - let digest = ctx.finish(); - let mut out = String::new(); - // TODO There must be a better way to do this... - for byte in digest.as_ref() { - write!(&mut out, "{:02x}", byte).unwrap(); - } - out -} - /// Emit a SHA256 hash based on source code, deno version and TS config. /// Used to check if a recompilation for source code is needed. pub fn source_code_version_hash( @@ -199,7 +183,7 @@ pub fn source_code_version_hash( version: &str, config_hash: &[u8], ) -> String { - gen_hash(vec![source_code, version.as_bytes(), config_hash]) + crate::checksum::gen(vec![source_code, version.as_bytes(), config_hash]) } pub struct TsCompiler { |