@@ -3,7 +3,7 @@ const babel = require('@babel/core')
3
3
const jsx = require ( '@vue/babel-plugin-jsx' )
4
4
const importMeta = require ( '@babel/plugin-syntax-import-meta' )
5
5
const { createFilter, normalizePath } = require ( '@rollup/pluginutils' )
6
- const hash = require ( 'hash-sum ' )
6
+ const { createHash } = require ( 'crypto ' )
7
7
const path = require ( 'path' )
8
8
9
9
const ssrRegisterHelperId = '/__vue-jsx-ssr-register-helper'
@@ -152,7 +152,7 @@ function vueJsxPlugin(options = {}) {
152
152
( { name } ) => ( {
153
153
local : name ,
154
154
exported : name ,
155
- id : hash ( id + name )
155
+ id : getHash ( id + name )
156
156
} )
157
157
)
158
158
)
@@ -169,7 +169,7 @@ function vueJsxPlugin(options = {}) {
169
169
hotComponents . push ( {
170
170
local : spec . local . name ,
171
171
exported : spec . exported . name ,
172
- id : hash ( id + spec . exported . name )
172
+ id : getHash ( id + spec . exported . name )
173
173
} )
174
174
}
175
175
}
@@ -187,15 +187,15 @@ function vueJsxPlugin(options = {}) {
187
187
hotComponents . push ( {
188
188
local : node . declaration . name ,
189
189
exported : 'default' ,
190
- id : hash ( id + 'default' )
190
+ id : getHash ( id + 'default' )
191
191
} )
192
192
}
193
193
} else if ( isDefineComponentCall ( node . declaration ) ) {
194
194
hasDefault = true
195
195
hotComponents . push ( {
196
196
local : '__default__' ,
197
197
exported : 'default' ,
198
- id : hash ( id + 'default' )
198
+ id : getHash ( id + 'default' )
199
199
} )
200
200
}
201
201
}
@@ -276,5 +276,13 @@ function isDefineComponentCall(node) {
276
276
)
277
277
}
278
278
279
+ /**
280
+ * @param {string } text
281
+ * @returns {string }
282
+ */
283
+ function getHash ( text ) {
284
+ return createHash ( 'sha256' ) . update ( text ) . digest ( 'hex' ) . substring ( 0 , 8 )
285
+ }
286
+
279
287
module . exports = vueJsxPlugin
280
288
vueJsxPlugin . default = vueJsxPlugin
0 commit comments