Skip to content

Commit 8f51f54

Browse files
committed
feat: support unplugin-vue-macros 2.11.0
1 parent f3346ee commit 8f51f54

File tree

7 files changed

+356
-783
lines changed

7 files changed

+356
-783
lines changed

auto-imports.d.ts

-572
Large diffs are not rendered by default.

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"@unocss/reset": "^0.61.5",
2727
"@vitejs/plugin-vue": "^5.1.0",
2828
"@vitejs/plugin-vue-jsx": "^4.0.0",
29-
"@vue-macros/volar": "^0.25.0",
3029
"@vue/test-utils": "^2.4.6",
3130
"eslint": "^9.7.0",
3231
"eslint-plugin-format": "^0.1.2",
@@ -40,7 +39,7 @@
4039
"unocss": "^0.61.5",
4140
"unplugin-auto-import": "^0.18.2",
4241
"unplugin-vue-components-jsx": "0.27.3-1",
43-
"unplugin-vue-macros": "^2.10.0",
42+
"unplugin-vue-macros": "^2.11.0",
4443
"unplugin-vue-router": "^0.10.1",
4544
"vite": "^5.3.5",
4645
"vite-plugin-inspect": "^0.8.5",

pnpm-lock.yaml

+330-171
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

-6
This file was deleted.

src/pages/index.setup.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ function go() {
1010
router.push(`/hi/${encodeURIComponent(name.value)}`)
1111
}
1212

13+
const route = useRoute('/')
14+
1315
export default (
1416
<div>
1517
<div i-carbon-campsite inline-block text-4xl />
1618
<p>
1719
<a rel="noreferrer" href="https://github.com/antfu/vitesse-lite" target="_blank">
18-
Vitesse Lite
20+
Vitesse
21+
{' '}
22+
{route.meta.title}
1923
</a>
2024
</p>
2125
<p>
@@ -41,3 +45,9 @@ export default (
4145
</div>
4246
</div>
4347
)
48+
49+
definePage({
50+
meta: {
51+
title: 'JSX',
52+
},
53+
})

tsconfig.json

+6-17
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,13 @@
2626
},
2727
"vueCompilerOptions": {
2828
"plugins": [
29-
"@vue-macros/volar/define-options",
30-
"@vue-macros/volar/define-models",
31-
"@vue-macros/volar/define-emit",
32-
"@vue-macros/volar/define-prop",
33-
"@vue-macros/volar/define-props",
34-
"@vue-macros/volar/define-props-refs",
35-
"@vue-macros/volar/short-vmodel",
36-
"@vue-macros/volar/define-slots",
37-
"@vue-macros/volar/export-expose",
38-
"@vue-macros/volar/jsx-directive",
39-
"@vue-macros/volar/export-render",
40-
"@vue-macros/volar/setup-jsdoc",
41-
"@vue-macros/volar/setup-lang",
42-
"@vue-macros/volar/template-ref",
43-
"@vue-macros/volar/define-generic",
44-
"@vue-macros/volar/setup-sfc",
29+
"unplugin-vue-macros/volar",
4530
"volar-plugin-ignore-attributes"
46-
]
31+
],
32+
"vueMacros": {
33+
"setupSFC": true,
34+
"exportRender": true
35+
}
4736
},
4837
"exclude": [
4938
"dist",

vite.config.ts

+8-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import UnoCSS from 'unocss/vite'
99
import VueMacros from 'unplugin-vue-macros/vite'
1010
import VueRouter from 'unplugin-vue-router/vite'
1111
import { VueRouterAutoImports } from 'unplugin-vue-router'
12-
import SetupSFC from '@vue-macros/setup-sfc/vite'
1312
import vueJsx from '@vitejs/plugin-vue-jsx'
1413
import Inspect from 'vite-plugin-inspect'
1514

@@ -20,22 +19,18 @@ export default defineConfig({
2019
},
2120
},
2221
plugins: [
23-
SetupSFC({
24-
include: [/\.setup\.[cm]?[jt]sx?(?=\?definePage|$)/],
25-
}),
26-
27-
// https://github.com/posva/unplugin-vue-router
28-
VueRouter({
29-
extensions: ['.vue', '.setup.tsx'],
30-
}),
31-
3222
VueMacros({
3323
plugins: {
3424
vue: Vue({
35-
include: [/\.vue$/, /\.setup\.[cm]?[jt]sx?$/],
25+
include: [/\.vue$/, /\.setup.[jt]sx$/],
3626
}),
3727
vueJsx: vueJsx(),
28+
// https://github.com/posva/unplugin-vue-router
29+
vueRouter: VueRouter({
30+
extensions: ['.vue', '.setup.tsx', '.setup.jsx'],
31+
}),
3832
},
33+
setupSFC: true,
3934
}),
4035

4136
// https://github.com/antfu/unplugin-auto-import
@@ -53,14 +48,13 @@ export default defineConfig({
5348
dirs: [
5449
'./src/composables',
5550
],
56-
vueTemplate: true,
5751
}),
5852

5953
// https://github.com/antfu/vite-plugin-components
6054
Components({
6155
dts: true,
62-
extensions: ['vue', 'setup.tsx'],
63-
include: [/\.vue$/, /\.setup\.[cm]?[jt]sx?/],
56+
extensions: ['vue', 'setup.tsx', 'setup.jsx'],
57+
include: [/\.setup\.[jt]sx?/],
6458
types: [{
6559
from: 'vue-router/auto',
6660
names: ['RouterLink', 'RouterView'],

0 commit comments

Comments
 (0)