MCPcopy
hub / github.com/vitejs/vite / getHash

Function getHash

packages/vite/src/node/utils.ts:1130–1134  ·  view source on GitHub ↗
(text: Buffer | string, length = 8)

Source from the content-addressed store, hash-verified

1128export const blankReplacer = (match: string): string => ' '.repeat(match.length)
1129
1130export function getHash(text: Buffer | string, length = 8): string {
1131 const h = crypto.hash('sha256', text, 'hex').substring(0, length)
1132 if (length <= 64) return h
1133 return h.padEnd(length, '_')
1134}
1135
1136export function emptyCssComments(raw: string): string {
1137 return raw.replace(multilineCommentsRE, blankReplacer)

Callers 15

devHtmlHookFunction · 0.90
handlerFunction · 0.90
publicFileToBuiltUrlFunction · 0.90
transformCjsImportFunction · 0.90
removeBundleMethod · 0.90
handlerFunction · 0.90
nameLayerFunction · 0.90
utils.spec.tsFile · 0.90
runOptimizeDepsFunction · 0.90
getTempSuffixFunction · 0.90
getConfigHashFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected