Skip to content

Commit 2eac3b0

Browse files
authored
Merge branch 'main' into edison/fix/423
2 parents 50cc9cd + 2bd79f9 commit 2eac3b0

File tree

11 files changed

+1176
-870
lines changed

11 files changed

+1176
-870
lines changed

.github/workflows/release-continuous.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
run: pnpm build
2323

2424
- name: Publish
25-
run: pnpm dlx [email protected] publish --pnpm './packages/*'
25+
run: pnpm dlx [email protected] publish --pnpm --compact './packages/*'

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
"execa": "^9.3.1",
5353
"fs-extra": "^11.2.0",
5454
"lint-staged": "^15.2.9",
55-
"npm-run-all2": "^6.2.2",
55+
"npm-run-all2": "^7.0.1",
5656
"picocolors": "^1.0.1",
5757
"playwright-chromium": "^1.46.1",
5858
"prettier": "3.3.3",
59-
"rollup": "^4.21.3",
59+
"rollup": "^4.24.3",
6060
"simple-git-hooks": "^2.11.1",
6161
"tsx": "^4.19.0",
6262
"typescript": "^5.5.4",

packages/plugin-vue-jsx/src/index.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createHash } from 'node:crypto'
1+
import crypto from 'node:crypto'
22
import path from 'node:path'
33
import type { types } from '@babel/core'
44
import * as babel from '@babel/core'
@@ -293,8 +293,17 @@ function isDefineComponentCall(
293293
)
294294
}
295295

296+
const hash =
297+
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- crypto.hash is supported in Node 21.7.0+, 20.12.0+
298+
crypto.hash ??
299+
((
300+
algorithm: string,
301+
data: crypto.BinaryLike,
302+
outputEncoding: crypto.BinaryToTextEncoding,
303+
) => crypto.createHash(algorithm).update(data).digest(outputEncoding))
304+
296305
function getHash(text: string) {
297-
return createHash('sha256').update(text).digest('hex').substring(0, 8)
306+
return hash('sha256', text, 'hex').substring(0, 8)
298307
}
299308

300309
export default vueJsxPlugin

packages/plugin-vue/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@jridgewell/gen-mapping": "^0.3.5",
4343
"@jridgewell/trace-mapping": "^0.3.25",
4444
"debug": "^4.3.6",
45-
"rollup": "^4.21.3",
45+
"rollup": "^4.24.3",
4646
"slash": "^5.1.0",
4747
"source-map-js": "^1.2.0",
4848
"vite": "catalog:",

packages/plugin-vue/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export async function transformMain(
5050
// for vue files, create descriptor from fs read to be consistent with
5151
// logic in handleHotUpdate()
5252
// for non vue files, e.g. md files in vitepress, we assume
53-
// `hmrContext.read` is overwriten so handleHotUpdate() is dealing with
53+
// `hmrContext.read` is overwritten so handleHotUpdate() is dealing with
5454
// post-transform code, so we populate the descriptor with post-transform
5555
// code here as well.
5656
filename.endsWith('.vue') ? undefined : code,

packages/plugin-vue/src/utils/descriptorCache.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
3-
import { createHash } from 'node:crypto'
3+
import crypto from 'node:crypto'
44
import type { CompilerError, SFCDescriptor } from 'vue/compiler-sfc'
55
import { normalizePath } from 'vite'
66
import type { ResolvedOptions, VueQuery } from '../index'
@@ -120,6 +120,15 @@ export function setSrcDescriptor(
120120
cache.set(filename, entry)
121121
}
122122

123+
const hash =
124+
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- crypto.hash is supported in Node 21.7.0+, 20.12.0+
125+
crypto.hash ??
126+
((
127+
algorithm: string,
128+
data: crypto.BinaryLike,
129+
outputEncoding: crypto.BinaryToTextEncoding,
130+
) => crypto.createHash(algorithm).update(data).digest(outputEncoding))
131+
123132
function getHash(text: string): string {
124-
return createHash('sha256').update(text).digest('hex').substring(0, 8)
133+
return hash('sha256', text, 'hex').substring(0, 8)
125134
}

playground/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"css-color-names": "^1.0.1",
99
"kill-port": "^1.6.1",
1010
"node-fetch": "^3.3.2",
11-
"sirv": "^2.0.4"
11+
"sirv": "^3.0.0"
1212
}
1313
}

playground/vue-legacy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
},
1414
"devDependencies": {
1515
"@vitejs/plugin-vue": "workspace:*",
16-
"@vitejs/plugin-legacy": "^5.4.2"
16+
"@vitejs/plugin-legacy": "^5.4.3"
1717
}
1818
}

playground/vue-sourcemap/__tests__/__snapshots__/vue-sourcemap.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ exports[`serve:vue-sourcemap > css scoped > serve-css-scoped 1`] = `
147147
exports[`serve:vue-sourcemap > js > serve-js 1`] = `
148148
{
149149
"ignoreList": [],
150-
"mappings": "AAIQ;AACR,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;AAGP;AACd,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;wBARlB,oBAAiB,WAAd,MAAU",
150+
"mappings": ";AAKA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;AAIpB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;wBARjB,oBAAiB,WAAd,MAAU",
151151
"sources": [
152152
"Js.vue",
153153
],
@@ -210,7 +210,7 @@ exports[`serve:vue-sourcemap > no script > serve-no-script 1`] = `
210210

211211
exports[`serve:vue-sourcemap > no template > serve-no-template 1`] = `
212212
{
213-
"mappings": "AAAQ;AACR,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;AAGP;AACd,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;",
213+
"mappings": ";AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;AAIpB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;",
214214
"sources": [
215215
"NoTemplate.vue",
216216
],

0 commit comments

Comments
 (0)