File tree Expand file tree Collapse file tree 2 files changed +4
-15
lines changed Expand file tree Collapse file tree 2 files changed +4
-15
lines changed Original file line number Diff line number Diff line change 45
45
"prettier" : " ^3.5.3"
46
46
},
47
47
"dependencies" : {
48
- "@11ty/eleventy-utils" : " ^2.0.1 " ,
48
+ "@11ty/eleventy-utils" : " ^2.0.7 " ,
49
49
"@rgrove/parse-xml" : " ^4.2.0" ,
50
50
"debug" : " ^4.4.0" ,
51
51
"flatted" : " ^3.3.3" ,
Original file line number Diff line number Diff line change 1
1
const fs = require ( "node:fs" ) ;
2
2
const path = require ( "node:path" ) ;
3
- const { createHash } = require ( "node:crypto" ) ;
4
- const { DateCompare } = require ( "@11ty/eleventy-utils" ) ;
3
+ const { DateCompare, createHashHexSync } = require ( "@11ty/eleventy-utils" ) ;
5
4
6
5
const FileCache = require ( "./FileCache.js" ) ;
7
6
const Sources = require ( "./Sources.js" ) ;
@@ -88,22 +87,12 @@ class AssetCache {
88
87
// Defult hashLength also set in global options, duplicated here for tests
89
88
// v5.0+ key can be Array or literal
90
89
static getHash ( key , hashLength = 30 ) {
91
- let hash = createHash ( "sha256" ) ;
92
-
93
90
if ( ! Array . isArray ( key ) ) {
94
91
key = [ key ] ;
95
92
}
96
93
97
- for ( let k of key ) {
98
- k = "" + k ;
99
- if ( k ) {
100
- hash . update ( k ) ;
101
- } else {
102
- throw new Error ( `Not able to convert asset key (${ k } ) to string.` ) ;
103
- }
104
- }
105
-
106
- return ( "" + hash . digest ( "hex" ) ) . slice ( 0 , hashLength ) ;
94
+ let result = createHashHexSync ( ...key ) ;
95
+ return result . slice ( 0 , hashLength ) ;
107
96
}
108
97
109
98
get source ( ) {
You can’t perform that action at this time.
0 commit comments