mirror of
https://gitee.com/openharmony/third_party_weex-loader
synced 2024-11-27 01:20:23 +00:00
!152 delete hash-sun md5 add jssha
Merge pull request !152 from Bo Jiang/replaceVERSION
This commit is contained in:
commit
5c3f5ff925
6
deps/weex-scripter/lib/require-parse.js
vendored
6
deps/weex-scripter/lib/require-parse.js
vendored
@ -1,6 +1,6 @@
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var md5 = require('md5')
|
||||
const crypto = require("crypto")
|
||||
var existsSync = fs.existsSync || path.existsSync
|
||||
|
||||
var nodePaths = process.env.NODE_PATH ? process.env.NODE_PATH.split(':') : []
|
||||
@ -83,7 +83,9 @@ function parseAndReplaceRequire(code, curPath) {
|
||||
return $0
|
||||
}
|
||||
else {
|
||||
var md5Path = md5(subModulePath)
|
||||
const hash = crypto.createHash('sha256')
|
||||
hash.update(subModulePath.toString())
|
||||
var md5Path = hash.digest('hex')
|
||||
requires[md5Path] = subModulePath
|
||||
return 'browserifyRequire("' + md5Path + '")'
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import loaderUtils from 'loader-utils'
|
||||
import hash from 'hash-sum'
|
||||
const crypto = require("crypto")
|
||||
import {
|
||||
SourceMapGenerator,
|
||||
SourceMapConsumer
|
||||
@ -37,7 +37,9 @@ export function getNameByPath (resourcePath) {
|
||||
|
||||
export function getFileNameWithHash (resourcePath, content) {
|
||||
const filename = path.relative('.', resourcePath)
|
||||
const cacheKey = hash(filename + content)
|
||||
const hash = crypto.createHash('sha256')
|
||||
hash.update((filename + content).toString())
|
||||
const cacheKey = hash.digest('hex')
|
||||
return `./${filename}?${cacheKey}`
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user