Skip to content

Commit 329b844

Browse files
authored
refactor(plugin-vue): remove querystring import (#7997)
1 parent a064262 commit 329b844

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

packages/plugin-vue/src/main.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import qs from 'querystring'
21
import path from 'path'
32
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
43
import type { ResolvedOptions } from '.'
@@ -426,8 +425,8 @@ function attrsToQuery(
426425
for (const name in attrs) {
427426
const value = attrs[name]
428427
if (!ignoreList.includes(name)) {
429-
query += `&${qs.escape(name)}${
430-
value ? `=${qs.escape(String(value))}` : ``
428+
query += `&${encodeURIComponent(name)}${
429+
value ? `=${encodeURIComponent(value)}` : ``
431430
}`
432431
}
433432
}

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import qs from 'querystring'
2-
31
export interface VueQuery {
42
vue?: boolean
53
src?: string
@@ -14,7 +12,7 @@ export function parseVueRequest(id: string): {
1412
query: VueQuery
1513
} {
1614
const [filename, rawQuery] = id.split(`?`, 2)
17-
const query = qs.parse(rawQuery) as VueQuery
15+
const query = Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery
1816
if (query.vue != null) {
1917
query.vue = true
2018
}

0 commit comments

Comments
 (0)