Skip to content

Commit

Permalink
feat: migrate to unplugins
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 13, 2021
1 parent 071cb21 commit b14d0f7
Show file tree
Hide file tree
Showing 8 changed files with 995 additions and 992 deletions.
3 changes: 2 additions & 1 deletion demo/starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@slidev/theme-default": "^0.19.1",
"@slidev/theme-seriph": "^0.19.1",
"@slidev/types": "workspace:*",
"nodemon": "^2.0.12"
"nodemon": "^2.0.12",
"vite-plugin-inspect": "^0.2.2"
}
}
8 changes: 8 additions & 0 deletions demo/starter/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Inspect from 'vite-plugin-inspect'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [
Inspect()
]
})
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
]
},
"devDependencies": {
"@antfu/eslint-config": "^0.7.0",
"@antfu/ni": "^0.7.0",
"@antfu/utils": "^0.2.4",
"@antfu/eslint-config": "^0.8.0",
"@antfu/ni": "^0.9.3",
"@antfu/utils": "^0.3.0",
"@slidev/cli": "workspace:*",
"@slidev/parser": "workspace:*",
"@slidev/types": "workspace:*",
Expand All @@ -40,40 +40,40 @@
"@types/file-saver": "^2.0.3",
"@types/fs-extra": "^9.0.12",
"@types/jest": "^27.0.1",
"@types/js-yaml": "^4.0.2",
"@types/js-yaml": "^4.0.3",
"@types/katex": "^0.11.1",
"@types/markdown-it": "^12.2.0",
"@types/markdown-it": "^12.2.1",
"@types/mermaid": "^8.2.7",
"@types/node": "^16.6.1",
"@types/node": "^16.7.13",
"@types/prettier": "^2.3.2",
"@types/prismjs": "^1.16.6",
"@types/prompts": "^2.4.0",
"@types/recordrtc": "^5.6.6",
"@types/resolve": "^1.20.1",
"@types/semver": "^7.3.8",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@vueuse/core": "^6.0.0",
"bumpp": "^6.0.6",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@vueuse/core": "^6.2.1",
"bumpp": "^7.1.1",
"cross-env": "^7.0.3",
"cypress": "^7.7.0",
"eslint": "^7.32.0",
"eslint-plugin-cypress": "^2.11.3",
"eslint-plugin-jest": "^24.4.0",
"esno": "^0.8.0",
"esno": "^0.9.1",
"husky": "4.3.7",
"jest": "^27.0.6",
"katex": "^0.13.13",
"jest": "^27.1.0",
"katex": "^0.13.18",
"lint-staged": "^11.1.2",
"mermaid": "^8.11.0",
"playwright-chromium": "^1.14.0",
"pnpm": "^6.13.0",
"playwright-chromium": "^1.14.1",
"pnpm": "^6.14.7",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.4",
"tsup": "4.13.1",
"typescript": "^4.3.5",
"vite": "^2.4.4",
"vite-plugin-windicss": "^1.2.7",
"zx": "^2.1.0"
"ts-jest": "^27.0.5",
"tsup": "4.14.0",
"typescript": "^4.4.2",
"vite": "^2.5.4",
"vite-plugin-windicss": "^1.4.2",
"zx": "^4.2.0"
},
"engines": {
"node": ">=14.0.0"
Expand Down
16 changes: 8 additions & 8 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
"funding": "https://github.com/sponsors/antfu",
"author": "antfu <anthonyfu117@hotmail.com>",
"dependencies": {
"@antfu/utils": "^0.2.4",
"@antfu/utils": "^0.3.0",
"@slidev/parser": "workspace:*",
"@slidev/types": "workspace:*",
"@vueuse/core": "^6.0.0",
"@vueuse/core": "^6.2.1",
"@vueuse/head": "^0.6.0",
"@vueuse/motion": "^1.5.6",
"codemirror": "^5.62.2",
"@vueuse/motion": "^1.6.0",
"codemirror": "^5.62.3",
"drauu": "^0.1.0-beta.3",
"file-saver": "^2.0.5",
"js-base64": "^3.6.1",
"js-yaml": "^4.1.0",
"katex": "^0.13.13",
"katex": "^0.13.18",
"mermaid": "8.5.0",
"monaco-editor": "^0.26.1",
"monaco-editor": "^0.27.0",
"nanoid": "^3.1.25",
"prettier": "^2.3.2",
"recordrtc": "^5.6.2",
"resolve": "^1.20.0",
"vite-plugin-windicss": "^1.2.7",
"vue": "^3.2.2",
"vite-plugin-windicss": "^1.4.2",
"vue": "^3.2.10",
"vue-router": "^4.0.11",
"windicss": "^3.1.7"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/slidev/node/options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve, dirname, join } from 'path'
import Vue from '@vitejs/plugin-vue'
import ViteIcons from 'vite-plugin-icons'
import ViteComponents from 'vite-plugin-components'
import Icons from 'unplugin-icons/vite'
import Components from 'unplugin-vue-components/vite'
import Markdown from 'vite-plugin-md'
import WindiCSS from 'vite-plugin-windicss'
import RemoteAssets from 'vite-plugin-remote-assets'
Expand Down Expand Up @@ -50,9 +50,9 @@ export interface ResolvedSlidevOptions {
export interface SlidevPluginOptions extends SlidevEntryOptions {
vue?: ArgumentsType<typeof Vue>[0]
markdown?: ArgumentsType<typeof Markdown>[0]
components?: ArgumentsType<typeof ViteComponents>[0]
components?: ArgumentsType<typeof Components>[0]
windicss?: ArgumentsType<typeof WindiCSS>[0]
icons?: ArgumentsType<typeof ViteIcons>[0]
icons?: ArgumentsType<typeof Icons>[0]
remoteAssets?: ArgumentsType<typeof RemoteAssets>[0]
}

Expand Down
17 changes: 10 additions & 7 deletions packages/slidev/node/plugins/preset.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

import { Plugin } from 'vite'
import Vue from '@vitejs/plugin-vue'
import ViteIcons, { ViteIconsResolver } from 'vite-plugin-icons'
import ViteComponents from 'vite-plugin-components'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
import RemoteAssets, { DefaultRules } from 'vite-plugin-remote-assets'
import ServerRef from 'vite-plugin-vue-server-ref'
import { notNullish } from '@antfu/utils'
Expand Down Expand Up @@ -82,7 +83,7 @@ export async function ViteSlidevPlugin(

createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),

ViteComponents({
Components({
extensions: ['vue', 'md', 'ts'],

dirs: [
Expand All @@ -93,17 +94,19 @@ export async function ViteSlidevPlugin(
'components',
],

customLoaderMatcher: id => id.endsWith('.md'),
customComponentResolvers: [
ViteIconsResolver({
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
exclude: [],

resolvers: [
IconsResolver({
componentPrefix: '',
}),
],

...componentsOptions,
}),

ViteIcons({
Icons({
...iconsOptions,
}),

Expand Down
28 changes: 14 additions & 14 deletions packages/slidev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
}
},
"dependencies": {
"@antfu/utils": "^0.2.4",
"@antfu/utils": "^0.3.0",
"@iconify/json": "^1.1.338",
"@slidev/client": "workspace:*",
"@slidev/parser": "workspace:*",
"@slidev/types": "workspace:*",
"@vitejs/plugin-vue": "^1.4.0",
"@vue/compiler-sfc": "^3.2.2",
"@vitejs/plugin-vue": "^1.6.1",
"@vue/compiler-sfc": "^3.2.10",
"cli-progress": "^3.9.0",
"codemirror": "^5.62.2",
"codemirror": "^5.62.3",
"connect": "^3.7.0",
"debug": "^4.3.2",
"fast-glob": "^3.2.7",
Expand All @@ -62,12 +62,12 @@
"is-installed-globally": "^0.4.0",
"jiti": "^1.11.0",
"js-base64": "^3.6.1",
"katex": "^0.13.13",
"katex": "^0.13.18",
"kolorist": "^1.5.0",
"markdown-it": "^12.2.0",
"markdown-it-footnote": "^3.0.3",
"markdown-it-link-attributes": "^3.0.0",
"monaco-editor": "^0.26.1",
"monaco-editor": "^0.27.0",
"nanoid": "^3.1.25",
"open": "^8.2.1",
"pdf-lib": "^1.16.0",
Expand All @@ -76,22 +76,22 @@
"resolve": "^1.20.0",
"resolve-from": "^5.0.0",
"resolve-global": "^1.0.0",
"shiki": "^0.9.6",
"vite": "^2.4.4",
"vite-plugin-components": "^0.13.2",
"vite-plugin-icons": "^0.6.5",
"vite-plugin-md": "^0.10.0",
"shiki": "^0.9.10",
"unplugin-icons": "^0.7.6",
"unplugin-vue-components": "^0.15.0",
"vite": "^2.5.4",
"vite-plugin-md": "^0.11.0",
"vite-plugin-remote-assets": "^0.2.2",
"vite-plugin-vue-server-ref": "^0.2.2",
"vite-plugin-windicss": "^1.2.7",
"vue": "^3.2.2",
"vite-plugin-windicss": "^1.4.2",
"vue": "^3.2.10",
"windicss": "^3.1.7",
"yargs": "^17.1.1"
},
"devDependencies": {
"fast-deep-equal": "^3.1.3",
"semver": "^7.3.5",
"sirv": "^1.0.14"
"sirv": "^1.0.17"
},
"engines": {
"node": ">=14.0.0"
Expand Down

0 comments on commit b14d0f7

Please sign in to comment.