From c3e294ff76aff4654c7218645c7a13b539f66a36 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期二, 18 六月 2024 20:08:43 +0800
Subject: [PATCH] internal

---
 internal/vite-config/src/utils/hash.ts |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/internal/vite-config/src/utils/hash.ts b/internal/vite-config/src/utils/hash.ts
index 83dc0fd..0b5a7c9 100644
--- a/internal/vite-config/src/utils/hash.ts
+++ b/internal/vite-config/src/utils/hash.ts
@@ -4,5 +4,13 @@
   const hash = createHash('sha256').update(content);
   return hash.digest('hex').slice(0, hashLSize);
 }
+function strToHex(str: string) {
+  const result: string[] = [];
+  for (let i = 0; i < str.length; ++i) {
+    const hex = str.charCodeAt(i).toString(16);
+    result.push(('000' + hex).slice(-4));
+  }
+  return result.join('').toUpperCase();
+}
 
-export { createContentHash };
+export { createContentHash, strToHex };

--
Gitblit v1.9.3