Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb75070

Browse files
committed
perf: usehash to replacecreateHash
ref:vitejs/vite-plugin-vue@de88394
1 parent739d78b commitfb75070

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎src/core/utils/descriptorCache.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{createHash}from'node:crypto'
1+
importcryptofrom'node:crypto'
22
importfsfrom'node:fs'
33
importpathfrom'node:path'
44
import{normalizePath}from'vite'
@@ -121,6 +121,14 @@ export function setSrcDescriptor(
121121
cache.set(filename,entry)
122122
}
123123

124+
consthash=
125+
crypto.hash??
126+
((
127+
algorithm:string,
128+
data:crypto.BinaryLike,
129+
outputEncoding:crypto.BinaryToTextEncoding,
130+
)=>crypto.createHash(algorithm).update(data).digest(outputEncoding))
131+
124132
functiongetHash(text:string):string{
125-
returncreateHash('sha256').update(text).digest('hex').slice(0,8)
133+
returnhash('sha256',text,'hex').slice(0,8)
126134
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp