Skip to content

Commit aab2876

Browse files
authored
perf: replace json5 and yaml with confbox (#2769)
1 parent 626cb07 commit aab2876

3 files changed

Lines changed: 13 additions & 17 deletions

File tree

packages/router/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"@vue/devtools-api": "^8.1.5",
142142
"ast-walker-scope": "^0.9.0",
143143
"chokidar": "^5.0.0",
144-
"json5": "^2.2.3",
144+
"confbox": "^0.2.4",
145145
"local-pkg": "^1.2.1",
146146
"magic-string": "^0.30.21",
147147
"mlly": "^1.8.2",
@@ -152,8 +152,7 @@
152152
"scule": "^1.3.0",
153153
"tinyglobby": "^0.2.17",
154154
"unplugin": "^3.3.0",
155-
"unplugin-utils": "^0.3.2",
156-
"yaml": "^2.9.0"
155+
"unplugin-utils": "^0.3.2"
157156
},
158157
"devDependencies": {
159158
"@babel/types": "^8.0.0",

packages/router/src/unplugin/core/customBlock.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { SFCBlock } from '@vue/compiler-sfc'
22
import { parse as parseSFC } from '@vue/compiler-sfc'
33
import type { ResolvedOptions } from '../options'
4-
import JSON5 from 'json5'
5-
import { parse as parseYaml } from 'yaml'
4+
import { parseJSON5 } from 'confbox/json5'
5+
import { parseYAML } from 'confbox/yaml'
66
import { diagnostics } from '../diagnostics'
77
import type { DefinePageQueryParamOptions } from '../../experimental/runtime'
88
import type { RouteRecordRaw } from '../../types'
@@ -60,7 +60,7 @@ function parseCustomBlock(
6060

6161
if (lang === 'json5') {
6262
try {
63-
return JSON5.parse(block.content)
63+
return parseJSON5(block.content)
6464
} catch (err: any) {
6565
diagnostics.VUE_ROUTER_B0012({
6666
type: block.type,
@@ -80,7 +80,7 @@ function parseCustomBlock(
8080
}
8181
} else if (lang === 'yaml' || lang === 'yml') {
8282
try {
83-
return parseYaml(block.content)
83+
return parseYAML(block.content)
8484
} catch (err: any) {
8585
diagnostics.VUE_ROUTER_B0014({
8686
type: block.type,

pnpm-lock.yaml

Lines changed: 7 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)