Skip to content

Commit

Permalink
refactor: externalize component plugin (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy authored Jun 30, 2022
1 parent ed39eb9 commit 0f18612
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 201 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
},
"dependencies": {
"@antfu/utils": "^0.5.2",
"@mdit-vue/plugin-component": "^0.1.1",
"@rollup/pluginutils": "^4.2.1",
"@types/markdown-it": "^12.2.3",
"gray-matter": "^4.0.3",
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import MarkdownIt from 'markdown-it'
import matter from 'gray-matter'
import { toArray, uniq } from '@antfu/utils'
import { componentPlugin } from '@mdit-vue/plugin-component'
import type { ResolvedOptions } from './types'
import { componentPlugin } from './plugins/component'

const scriptSetupRE = /<\s*script([^>]*)\bsetup\b([^>]*)>([\s\S]*)<\/script>/mg
const defineExposeRE = /defineExpose\s*\(/mg
Expand Down
199 changes: 0 additions & 199 deletions src/plugins/component.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/__snapshots__/transform.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`transform > Vue directives 1`] = `
"<template><div class=\\"markdown-body\\">
<button @click=\\"onClick\\"></button>
<p><button @click=\\"onClick\\"></button></p>
</div></template>
<script setup lang=\\"ts\\">
const frontmatter = {\\"name\\":\\"My Cool App\\"}
Expand Down

0 comments on commit 0f18612

Please sign in to comment.