Skip to content

Commit f542cd3

Browse files
committed
feat: upgrade deps, support Vite 6
1 parent 825ffc0 commit f542cd3

15 files changed

+8117
-7005
lines changed

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ export default defineConfig({
3535

3636
Example: [`examples/vite`](./examples/vite/)
3737

38-
<br></details>
38+
<br>
39+
</details>
3940

4041
<details>
4142
<summary>Webpack</summary><br>
4243

4344
```ts
4445
// webpack.config.js
45-
const { VueLoaderPlugin } = require('vue-loader')
4646
const Markdown = require('unplugin-vue-markdown/webpack')
47+
const { VueLoaderPlugin } = require('vue-loader')
4748

4849
module.exports = {
4950
/* ... */
@@ -63,7 +64,8 @@ module.exports = {
6364
}
6465
```
6566

66-
<br></details>
67+
<br>
68+
</details>
6769

6870
<details>
6971
<summary>Vue CLI</summary><br>
@@ -92,7 +94,8 @@ module.exports = {
9294

9395
Example: [`examples/vue-cli`](./examples/vue-cli/)
9496

95-
<br></details>
97+
<br>
98+
</details>
9699

97100
## Import Markdown as Vue components
98101

@@ -199,12 +202,9 @@ export default {
199202

200203
```js
201204
// src/main.js
205+
import { createHead } from '@unhead/vue' // <--
202206
import { createApp } from 'vue'
203207

204-
import { createHead } from '@unhead/vue'
205-
206-
// <--
207-
208208
const app = createApp(App)
209209

210210
const head = createHead() // <--
@@ -230,9 +230,9 @@ For more options available, please refer to [`@unhead/vue`'s docs](https://unhea
230230

231231
```ts
232232
// vite.config.js
233-
import Markdown from 'unplugin-vue-markdown/vite'
234233
import MarkdownItAnchor from 'markdown-it-anchor'
235234
import MarkdownItPrism from 'markdown-it-prism'
235+
import Markdown from 'unplugin-vue-markdown/vite'
236236

237237
export default {
238238
plugins: [
@@ -295,8 +295,8 @@ Put your markdown under `./src/pages/xx.md`, then you can access the page via ro
295295

296296
```ts
297297
import Vue from '@vitejs/plugin-vue'
298-
import Markdown from 'unplugin-vue-markdown/vite'
299298
import Components from 'unplugin-vue-components/vite'
299+
import Markdown from 'unplugin-vue-markdown/vite'
300300

301301
export default {
302302
plugins: [

examples/vite/README.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
Compile Markdown to Vue component.
66

7-
- 📚 Use Markdown as Vue components
8-
- 💚 Use Vue components in Markdown
9-
- ⚡️ Supports Vite, Webpack, Vue CLI and more, powered by [unplugin](https://github.com/unjs/unplugin).
7+
- 📚 Use Markdown as Vue components.
8+
- 💚 Use Vue components in Markdown.
9+
- 🔌 Supports Vite, Webpack, Vue CLI and more, powered by [unplugin](https://github.com/unjs/unplugin).
10+
- ⚡️ The same transformation as [VitePress](https://vitepress.vuejs.org/).
1011

1112
## Install
1213

@@ -34,15 +35,16 @@ export default defineConfig({
3435

3536
Example: [`examples/vite`](./examples/vite/)
3637

37-
<br></details>
38+
<br>
39+
</details>
3840

3941
<details>
4042
<summary>Webpack</summary><br>
4143

4244
```ts
4345
// webpack.config.js
44-
const { VueLoaderPlugin } = require('vue-loader')
4546
const Markdown = require('unplugin-vue-markdown/webpack')
47+
const { VueLoaderPlugin } = require('vue-loader')
4648

4749
module.exports = {
4850
/* ... */
@@ -62,7 +64,8 @@ module.exports = {
6264
}
6365
```
6466

65-
<br></details>
67+
<br>
68+
</details>
6669

6770
<details>
6871
<summary>Vue CLI</summary><br>
@@ -91,7 +94,8 @@ module.exports = {
9194

9295
Example: [`examples/vue-cli`](./examples/vue-cli/)
9396

94-
<br></details>
97+
<br>
98+
</details>
9599

96100
## Import Markdown as Vue components
97101

@@ -144,7 +148,7 @@ import { Counter } from './Counter.vue'
144148
<Counter :init='5'/>
145149
```
146150

147-
Or you can use [`vite-plugin-components`](#work-with-vite-plugin-components) for auto components registration.
151+
Or you can use [`unplugin-vue-components`](#work-with-unplugin-vue-components) for auto components registration.
148152

149153
## Frontmatter
150154

@@ -198,12 +202,9 @@ export default {
198202

199203
```js
200204
// src/main.js
205+
import { createHead } from '@unhead/vue' // <--
201206
import { createApp } from 'vue'
202207

203-
import { createHead } from '@unhead/vue'
204-
205-
// <--
206-
207208
const app = createApp(App)
208209

209210
const head = createHead() // <--
@@ -229,9 +230,9 @@ For more options available, please refer to [`@unhead/vue`'s docs](https://unhea
229230

230231
```ts
231232
// vite.config.js
232-
import Markdown from 'unplugin-vue-markdown/vite'
233233
import MarkdownItAnchor from 'markdown-it-anchor'
234234
import MarkdownItPrism from 'markdown-it-prism'
235+
import Markdown from 'unplugin-vue-markdown/vite'
235236

236237
export default {
237238
plugins: [
@@ -260,7 +261,7 @@ See [the tsdoc](./src/types.ts) for more advanced options
260261

261262
## Example
262263

263-
See the [/example](./example).
264+
See the [/examples](./examples).
264265

265266
Or the pre-configured Markdown template [Vitesse](https://github.com/antfu/vitesse).
266267

@@ -290,12 +291,12 @@ Put your markdown under `./src/pages/xx.md`, then you can access the page via ro
290291

291292
### Work with [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components)
292293

293-
`vite-plugin-components` allows you to do on-demand components auto-importing without worrying about registration.
294+
`unplugin-vue-components` allows you to do on-demand components auto-importing without worrying about registration.
294295

295296
```ts
296297
import Vue from '@vitejs/plugin-vue'
297-
import Markdown from 'unplugin-vue-markdown/vite'
298298
import Components from 'unplugin-vue-components/vite'
299+
import Markdown from 'unplugin-vue-markdown/vite'
299300

300301
export default {
301302
plugins: [
@@ -309,7 +310,7 @@ export default {
309310
extensions: ['vue', 'md'],
310311

311312
// allow auto import and register components used in markdown
312-
customLoaderMatcher: path => path.endsWith('.md'),
313+
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
313314
})
314315
],
315316
}

examples/vite/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { createApp } from 'vue'
21
import { createHead } from '@unhead/vue'
2+
import routes from 'pages-generated'
3+
import { createApp } from 'vue'
34
import {
45
createRouter,
56
createWebHistory,
67
} from 'vue-router'
7-
import routes from 'pages-generated'
88
import App from './App.vue'
99
import Counter from './Counter.vue'
1010

examples/vite/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
"build": "cross-env DEBUG=unplugin-vue-markdown:* vite build"
77
},
88
"dependencies": {
9-
"@unhead/vue": "^1.9.5",
10-
"vue": "^3.4.21",
11-
"vue-router": "^4.3.0"
9+
"@unhead/vue": "^1.11.13",
10+
"vue": "^3.5.13",
11+
"vue-router": "^4.5.0"
1212
},
1313
"devDependencies": {
14-
"@vitejs/plugin-vue": "^5.0.4",
14+
"@vitejs/plugin-vue": "^5.2.1",
1515
"cross-env": "^7.0.3",
1616
"markdown-it-prism": "^2.3.0",
1717
"prismjs": "^1.29.0",
18-
"typescript": "^5.4.5",
18+
"typescript": "^5.7.2",
1919
"unplugin-vue-markdown": "workspace:*",
20-
"vite": "^5.2.8",
21-
"vite-plugin-inspect": "^0.8.3",
22-
"vite-plugin-pages": "^0.32.1"
20+
"vite": "^6.0.1",
21+
"vite-plugin-inspect": "^0.8.8",
22+
"vite-plugin-pages": "^0.32.4"
2323
}
2424
}

examples/vite/vite.config.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import { defineConfig } from 'vite'
21
import Vue from '@vitejs/plugin-vue'
3-
import Markdown from 'unplugin-vue-markdown/vite'
42
import prism from 'markdown-it-prism'
5-
import Pages from 'vite-plugin-pages'
3+
import Markdown from 'unplugin-vue-markdown/vite'
4+
import { defineConfig } from 'vite'
65
import Inspect from 'vite-plugin-inspect'
6+
import Pages from 'vite-plugin-pages'
77

88
export default defineConfig({
99
plugins: [
1010
Vue({
1111
include: [/\.vue$/, /\.md$/],
1212
}),
1313
Markdown({
14+
markdownItOptions: {
15+
16+
},
1417
headEnabled: true,
1518
markdownItUses: [
1619
prism,

examples/vue-cli/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"lint": "vue-cli-service lint"
99
},
1010
"dependencies": {
11-
"core-js": "^3.36.1",
12-
"vue": "^3.4.21"
11+
"core-js": "^3.39.0",
12+
"vue": "^3.5.13"
1313
},
1414
"devDependencies": {
15-
"@babel/core": "^7.24.4",
15+
"@babel/core": "^7.26.0",
1616
"@vue/cli-plugin-babel": "~5.0.8",
1717
"@vue/cli-service": "~5.0.8",
1818
"unplugin-vue-markdown": "workspace:*"

examples/vue-cli/vue.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { defineConfig } = require('@vue/cli-service')
2-
const Markdown = require('unplugin-vue-markdown/webpack')
32
const prism = require('markdown-it-prism')
3+
const Markdown = require('unplugin-vue-markdown/webpack')
44

55
module.exports = defineConfig({
66
transpileDependencies: true,

package.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "unplugin-vue-markdown",
33
"type": "module",
44
"version": "0.26.2",
5-
"packageManager": "pnpm@9.0.1",
5+
"packageManager": "pnpm@9.14.2",
66
"description": "Compile Markdown to Vue component",
77
"author": "Anthony Fu <[email protected]>",
88
"license": "MIT",
@@ -75,35 +75,35 @@
7575
"release": "bumpp && npm publish"
7676
},
7777
"peerDependencies": {
78-
"vite": "^2.0.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0"
78+
"vite": "^2.0.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0"
7979
},
8080
"dependencies": {
81-
"@mdit-vue/plugin-component": "^2.1.2",
82-
"@mdit-vue/plugin-frontmatter": "^2.1.2",
81+
"@mdit-vue/plugin-component": "^2.1.3",
82+
"@mdit-vue/plugin-frontmatter": "^2.1.3",
8383
"@mdit-vue/types": "^2.1.0",
84-
"@rollup/pluginutils": "^5.1.0",
85-
"@types/markdown-it": "^14.0.1",
84+
"@rollup/pluginutils": "^5.1.3",
85+
"@types/markdown-it": "^14.1.2",
8686
"markdown-it": "^14.1.0",
87-
"unplugin": "^1.10.1"
87+
"unplugin": "^1.16.0"
8888
},
8989
"devDependencies": {
90-
"@antfu/eslint-config": "^2.14.0",
91-
"@antfu/ni": "^0.21.12",
92-
"@antfu/utils": "^0.7.7",
93-
"@types/node": "^20.12.7",
94-
"@unhead/vue": "^1.9.5",
95-
"@vue/test-utils": "^2.4.5",
96-
"bumpp": "^9.4.0",
90+
"@antfu/eslint-config": "^3.10.0",
91+
"@antfu/ni": "^0.23.1",
92+
"@antfu/utils": "^0.7.10",
93+
"@types/node": "^22.10.0",
94+
"@unhead/vue": "^1.11.13",
95+
"@vue/test-utils": "^2.4.6",
96+
"bumpp": "^9.8.1",
9797
"chalk": "^5.3.0",
98-
"eslint": "^9.0.0",
99-
"esno": "^4.7.0",
98+
"eslint": "^9.15.0",
99+
"esno": "^4.8.0",
100100
"fast-glob": "^3.3.2",
101-
"rollup": "^4.14.3",
102-
"tsup": "^8.0.2",
103-
"typescript": "^5.4.5",
104-
"vite": "^5.2.9",
105-
"vitest": "^1.5.0",
106-
"vue": "^3.4.23",
107-
"webpack": "^5.91.0"
101+
"rollup": "^4.27.4",
102+
"tsup": "^8.3.5",
103+
"typescript": "^5.7.2",
104+
"vite": "^6.0.1",
105+
"vitest": "^2.1.6",
106+
"vue": "^3.5.13",
107+
"webpack": "^5.96.1"
108108
}
109109
}

0 commit comments

Comments
 (0)