Skip to content

Commit

Permalink
refactor(plugin-vue): remove querystring import (#7997)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed May 3, 2022
1 parent 642d65b commit f3d15f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions packages/plugin-vue/src/main.ts
@@ -1,4 +1,3 @@
import qs from 'querystring'
import path from 'path'
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
import type { ResolvedOptions } from '.'
Expand Down Expand Up @@ -426,8 +425,8 @@ function attrsToQuery(
for (const name in attrs) {
const value = attrs[name]
if (!ignoreList.includes(name)) {
query += `&${qs.escape(name)}${
value ? `=${qs.escape(String(value))}` : ``
query += `&${encodeURIComponent(name)}${
value ? `=${encodeURIComponent(value)}` : ``
}`
}
}
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-vue/src/utils/query.ts
@@ -1,5 +1,3 @@
import qs from 'querystring'

export interface VueQuery {
vue?: boolean
src?: string
Expand All @@ -14,7 +12,7 @@ export function parseVueRequest(id: string): {
query: VueQuery
} {
const [filename, rawQuery] = id.split(`?`, 2)
const query = qs.parse(rawQuery) as VueQuery
const query = Object.fromEntries(new URLSearchParams(rawQuery)) as VueQuery
if (query.vue != null) {
query.vue = true
}
Expand Down

0 comments on commit f3d15f1

Please sign in to comment.