Skip to content

Commit

Permalink
feat: upgrade deps, support Vite 6
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 27, 2024
1 parent 825ffc0 commit f542cd3
Show file tree
Hide file tree
Showing 15 changed files with 8,117 additions and 7,005 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ export default defineConfig({

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

<br></details>
<br>
</details>

<details>
<summary>Webpack</summary><br>

```ts
// webpack.config.js
const { VueLoaderPlugin } = require('vue-loader')
const Markdown = require('unplugin-vue-markdown/webpack')
const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
/* ... */
Expand All @@ -63,7 +64,8 @@ module.exports = {
}
```

<br></details>
<br>
</details>

<details>
<summary>Vue CLI</summary><br>
Expand Down Expand Up @@ -92,7 +94,8 @@ module.exports = {

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

<br></details>
<br>
</details>

## Import Markdown as Vue components

Expand Down Expand Up @@ -199,12 +202,9 @@ export default {

```js
// src/main.js
import { createHead } from '@unhead/vue' // <--
import { createApp } from 'vue'

import { createHead } from '@unhead/vue'

// <--

const app = createApp(App)

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

```ts
// vite.config.js
import Markdown from 'unplugin-vue-markdown/vite'
import MarkdownItAnchor from 'markdown-it-anchor'
import MarkdownItPrism from 'markdown-it-prism'
import Markdown from 'unplugin-vue-markdown/vite'

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

```ts
import Vue from '@vitejs/plugin-vue'
import Markdown from 'unplugin-vue-markdown/vite'
import Components from 'unplugin-vue-components/vite'
import Markdown from 'unplugin-vue-markdown/vite'

export default {
plugins: [
Expand Down
35 changes: 18 additions & 17 deletions examples/vite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

Compile Markdown to Vue component.

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

## Install

Expand Down Expand Up @@ -34,15 +35,16 @@ export default defineConfig({

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

<br></details>
<br>
</details>

<details>
<summary>Webpack</summary><br>

```ts
// webpack.config.js
const { VueLoaderPlugin } = require('vue-loader')
const Markdown = require('unplugin-vue-markdown/webpack')
const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
/* ... */
Expand All @@ -62,7 +64,8 @@ module.exports = {
}
```

<br></details>
<br>
</details>

<details>
<summary>Vue CLI</summary><br>
Expand Down Expand Up @@ -91,7 +94,8 @@ module.exports = {

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

<br></details>
<br>
</details>

## Import Markdown as Vue components

Expand Down Expand Up @@ -144,7 +148,7 @@ import { Counter } from './Counter.vue'
<Counter :init='5'/>
```

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

## Frontmatter

Expand Down Expand Up @@ -198,12 +202,9 @@ export default {

```js
// src/main.js
import { createHead } from '@unhead/vue' // <--
import { createApp } from 'vue'

import { createHead } from '@unhead/vue'

// <--

const app = createApp(App)

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

```ts
// vite.config.js
import Markdown from 'unplugin-vue-markdown/vite'
import MarkdownItAnchor from 'markdown-it-anchor'
import MarkdownItPrism from 'markdown-it-prism'
import Markdown from 'unplugin-vue-markdown/vite'

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

## Example

See the [/example](./example).
See the [/examples](./examples).

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

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

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

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

```ts
import Vue from '@vitejs/plugin-vue'
import Markdown from 'unplugin-vue-markdown/vite'
import Components from 'unplugin-vue-components/vite'
import Markdown from 'unplugin-vue-markdown/vite'

export default {
plugins: [
Expand All @@ -309,7 +310,7 @@ export default {
extensions: ['vue', 'md'],

// allow auto import and register components used in markdown
customLoaderMatcher: path => path.endsWith('.md'),
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
})
],
}
Expand Down
4 changes: 2 additions & 2 deletions examples/vite/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createApp } from 'vue'
import { createHead } from '@unhead/vue'
import routes from 'pages-generated'
import { createApp } from 'vue'
import {
createRouter,
createWebHistory,
} from 'vue-router'
import routes from 'pages-generated'
import App from './App.vue'
import Counter from './Counter.vue'

Expand Down
16 changes: 8 additions & 8 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"build": "cross-env DEBUG=unplugin-vue-markdown:* vite build"
},
"dependencies": {
"@unhead/vue": "^1.9.5",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
"@unhead/vue": "^1.11.13",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue": "^5.2.1",
"cross-env": "^7.0.3",
"markdown-it-prism": "^2.3.0",
"prismjs": "^1.29.0",
"typescript": "^5.4.5",
"typescript": "^5.7.2",
"unplugin-vue-markdown": "workspace:*",
"vite": "^5.2.8",
"vite-plugin-inspect": "^0.8.3",
"vite-plugin-pages": "^0.32.1"
"vite": "^6.0.1",
"vite-plugin-inspect": "^0.8.8",
"vite-plugin-pages": "^0.32.4"
}
}
9 changes: 6 additions & 3 deletions examples/vite/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Markdown from 'unplugin-vue-markdown/vite'
import prism from 'markdown-it-prism'
import Pages from 'vite-plugin-pages'
import Markdown from 'unplugin-vue-markdown/vite'
import { defineConfig } from 'vite'
import Inspect from 'vite-plugin-inspect'
import Pages from 'vite-plugin-pages'

export default defineConfig({
plugins: [
Vue({
include: [/\.vue$/, /\.md$/],
}),
Markdown({
markdownItOptions: {

},
headEnabled: true,
markdownItUses: [
prism,
Expand Down
6 changes: 3 additions & 3 deletions examples/vue-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.36.1",
"vue": "^3.4.21"
"core-js": "^3.39.0",
"vue": "^3.5.13"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/core": "^7.26.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"unplugin-vue-markdown": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-cli/vue.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { defineConfig } = require('@vue/cli-service')
const Markdown = require('unplugin-vue-markdown/webpack')
const prism = require('markdown-it-prism')
const Markdown = require('unplugin-vue-markdown/webpack')

module.exports = defineConfig({
transpileDependencies: true,
Expand Down
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "unplugin-vue-markdown",
"type": "module",
"version": "0.26.2",
"packageManager": "pnpm@9.0.1",
"packageManager": "pnpm@9.14.2",
"description": "Compile Markdown to Vue component",
"author": "Anthony Fu <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -75,35 +75,35 @@
"release": "bumpp && npm publish"
},
"peerDependencies": {
"vite": "^2.0.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0"
"vite": "^2.0.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0"
},
"dependencies": {
"@mdit-vue/plugin-component": "^2.1.2",
"@mdit-vue/plugin-frontmatter": "^2.1.2",
"@mdit-vue/plugin-component": "^2.1.3",
"@mdit-vue/plugin-frontmatter": "^2.1.3",
"@mdit-vue/types": "^2.1.0",
"@rollup/pluginutils": "^5.1.0",
"@types/markdown-it": "^14.0.1",
"@rollup/pluginutils": "^5.1.3",
"@types/markdown-it": "^14.1.2",
"markdown-it": "^14.1.0",
"unplugin": "^1.10.1"
"unplugin": "^1.16.0"
},
"devDependencies": {
"@antfu/eslint-config": "^2.14.0",
"@antfu/ni": "^0.21.12",
"@antfu/utils": "^0.7.7",
"@types/node": "^20.12.7",
"@unhead/vue": "^1.9.5",
"@vue/test-utils": "^2.4.5",
"bumpp": "^9.4.0",
"@antfu/eslint-config": "^3.10.0",
"@antfu/ni": "^0.23.1",
"@antfu/utils": "^0.7.10",
"@types/node": "^22.10.0",
"@unhead/vue": "^1.11.13",
"@vue/test-utils": "^2.4.6",
"bumpp": "^9.8.1",
"chalk": "^5.3.0",
"eslint": "^9.0.0",
"esno": "^4.7.0",
"eslint": "^9.15.0",
"esno": "^4.8.0",
"fast-glob": "^3.3.2",
"rollup": "^4.14.3",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"vite": "^5.2.9",
"vitest": "^1.5.0",
"vue": "^3.4.23",
"webpack": "^5.91.0"
"rollup": "^4.27.4",
"tsup": "^8.3.5",
"typescript": "^5.7.2",
"vite": "^6.0.1",
"vitest": "^2.1.6",
"vue": "^3.5.13",
"webpack": "^5.96.1"
}
}
Loading

0 comments on commit f542cd3

Please sign in to comment.