Skip to content

Commit 5de85f6

Browse files
authored
refactor: always use crypto.hash (#606)
1 parent 5feb9a2 commit 5de85f6

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

packages/plugin-vue/src/utils/descriptorCache.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,6 @@ export function setSrcDescriptor(
148148
cache.set(filename, entry)
149149
}
150150

151-
const hash =
152-
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- crypto.hash is supported in Node 21.7.0+, 20.12.0+
153-
crypto.hash ??
154-
((
155-
algorithm: string,
156-
data: crypto.BinaryLike,
157-
outputEncoding: crypto.BinaryToTextEncoding,
158-
) => crypto.createHash(algorithm).update(data).digest(outputEncoding))
159-
160151
function getHash(text: string): string {
161-
return hash('sha256', text, 'hex').substring(0, 8)
152+
return crypto.hash('sha256', text, 'hex').substring(0, 8)
162153
}

0 commit comments

Comments
 (0)