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

Commitbd9cb6f

Browse files
authored
chore: refactor hash() (#2062)
1 parentfb9656c commitbd9cb6f

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

‎package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
},
3838
"dependencies": {
3939
"chalk":"^4.1.0",
40-
"hash-sum":"^2.0.0",
4140
"watchpack":"^2.4.0"
4241
},
4342
"peerDependencies": {
@@ -56,7 +55,6 @@
5655
"@babel/preset-env":"^7.11.5",
5756
"@intlify/vue-i18n-loader":"^3.0.0",
5857
"@types/estree":"^0.0.45",
59-
"@types/hash-sum":"^1.0.0",
6058
"@types/jest":"^26.0.13",
6159
"@types/jsdom":"^16.2.13",
6260
"@types/mini-css-extract-plugin":"^0.9.1",

‎src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
importtype{LoaderContext}from'webpack'
22
import*aspathfrom'path'
3+
import*ascryptofrom'crypto'
34
import*asqsfrom'querystring'
45

5-
importhash= require('hash-sum')
6-
76
import{compiler}from'./compiler'
87
importtype{
98
TemplateCompiler,
@@ -66,6 +65,10 @@ let errorEmitted = false
6665
const{ parse}=compiler
6766
constexportHelperPath=require.resolve('./exportHelper')
6867

68+
functionhash(text:string):string{
69+
returncrypto.createHash('sha256').update(text).digest('hex').substring(0,8)
70+
}
71+
6972
exportdefaultfunctionloader(
7073
this:LoaderContext<VueLoaderOptions>,
7174
source:string

‎test/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
/* env jest */
22
import*aspathfrom'path'
3+
import*ascryptofrom'crypto'
34
importwebpackfrom'webpack'
45
importmergefrom'webpack-merge'
5-
importhashfrom'hash-sum'
66
// import MiniCssExtractPlugin from 'mini-css-extract-plugin'
77
import{fsasmfs}from'memfs'
88
import{JSDOM,VirtualConsole}from'jsdom'
99
import{VueLoaderPlugin}from'..'
1010
importtype{VueLoaderOptions}from'..'
1111

12+
functionhash(text:string):string{
13+
returncrypto.createHash('sha256').update(text).digest('hex').substring(0,8)
14+
}
15+
1216
exportconstDEFAULT_VUE_USE={
1317
loader:'vue-loader',
1418
options:{

‎yarn.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,11 +1317,6 @@
13171317
dependencies:
13181318
"@types/node""*"
13191319

1320-
"@types/hash-sum@^1.0.0":
1321-
version "1.0.0"
1322-
resolved "https://registry.yarnpkg.com/@types/hash-sum/-/hash-sum-1.0.0.tgz#838f4e8627887d42b162d05f3d96ca636c2bc504"
1323-
integrity sha512-FdLBT93h3kcZ586Aee66HPCVJ6qvxVjBlDWNmxSGSbCZe9hTsjRKdSsl4y1T+3zfujxo9auykQMnFsfyHWD7wg==
1324-
13251320
"@types/html-minifier-terser@^5.0.0":
13261321
version "5.1.1"
13271322
resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#3c9ee980f1a10d6021ae6632ca3e79ca2ec4fb50"
@@ -4925,11 +4920,6 @@ hash-base@^3.0.0:
49254920
readable-stream "^3.6.0"
49264921
safe-buffer "^5.2.0"
49274922

4928-
hash-sum@^2.0.0:
4929-
version "2.0.0"
4930-
resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-2.0.0.tgz#81d01bb5de8ea4a214ad5d6ead1b523460b0b45a"
4931-
integrity sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==
4932-
49334923
hash.js@^1.0.0, hash.js@^1.0.3:
49344924
version "1.1.7"
49354925
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp