From 56f79c30a1a3ef2c893a9d4c2927d38d11bb97ed Mon Sep 17 00:00:00 2001 From: markthree <1801982702@qq.com> Date: Sat, 20 May 2023 18:25:53 +0800 Subject: [PATCH] =?UTF-8?q?feat!:=20markdown=20=E6=94=AF=E6=8C=81=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=20vue=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- pnpm-lock.yaml | 149 ++++++++++++++++++++++++++++++++------------- presets/index.ts | 3 +- src/pages/about.md | 5 ++ 4 files changed, 114 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 330c73f..72029ba 100644 --- a/package.json +++ b/package.json @@ -76,11 +76,11 @@ "vite-auto-import-resolvers": "^3.0.5", "vite-plugin-compression": "^0.5.1", "vite-plugin-env-types": "^0.1.3", - "vite-plugin-md": "^0.22.5", "vite-plugin-mock": "^2.9.8", "vite-plugin-removelog": "^0.2.1", "vite-plugin-use-modules": "^1.3.1", "vite-plugin-vue-devtools": "^0.0.15", + "vite-plugin-vue-markdown": "^0.23.5", "vite-plugin-vue-meta-layouts": "^0.2.2", "vite-plugin-warmup": "^0.1.0", "vitest": "^0.31.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e161a8d..a3ca23e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,10 +15,10 @@ devDependencies: version: 20.2.1 '@typescript-eslint/parser': specifier: ^5.59.6 - version: 5.59.6(eslint@8.40.0)(typescript@5.0.4) + version: 5.59.6(eslint@8.41.0)(typescript@5.0.4) '@unocss/eslint-config': specifier: ^0.51.13 - version: 0.51.13(eslint@8.40.0)(typescript@5.0.4) + version: 0.51.13(eslint@8.41.0)(typescript@5.0.4) '@unocss/reset': specifier: ^0.51.13 version: 0.51.13 @@ -59,17 +59,17 @@ devDependencies: specifier: ^5.4.2 version: 5.4.2 eslint: - specifier: ^8.40.0 - version: 8.40.0 + specifier: ^8.41.0 + version: 8.41.0 eslint-config-prettier: specifier: ^8.8.0 - version: 8.8.0(eslint@8.40.0) + version: 8.8.0(eslint@8.41.0) eslint-plugin-prettier: specifier: ^4.2.1 - version: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.40.0)(prettier@2.8.8) + version: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.41.0)(prettier@2.8.8) eslint-plugin-vue: specifier: ^9.13.0 - version: 9.13.0(eslint@8.40.0) + version: 9.13.0(eslint@8.41.0) husky: specifier: ^8.0.3 version: 8.0.3 @@ -154,6 +154,9 @@ devDependencies: vite-plugin-vue-devtools: specifier: ^0.0.15 version: 0.0.15(vite@4.3.8)(vue@3.3.4) + vite-plugin-vue-markdown: + specifier: ^0.23.5 + version: 0.23.5(vite@4.3.8) vite-plugin-vue-meta-layouts: specifier: ^0.2.2 version: 0.2.2(vite@4.3.8)(vue-router@4.2.1) @@ -1627,13 +1630,13 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.40.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.41.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.40.0 + eslint: 8.41.0 eslint-visitor-keys: 3.4.1 dev: true @@ -1659,8 +1662,8 @@ packages: - supports-color dev: true - /@eslint/js@8.40.0: - resolution: {integrity: sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==} + /@eslint/js@8.41.0: + resolution: {integrity: sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true @@ -1869,6 +1872,26 @@ packages: type-detect: 4.0.8 dev: true + /@mdit-vue/plugin-component@0.12.0: + resolution: {integrity: sha512-LrwV3f0Y6H7b7m/w1Y3bkGuR3HOiBK4QiHHW3HuRMza6MZodDQbj8Baik5/V5GiSg1/ltijS1CymVcycd1EfTw==} + dependencies: + '@types/markdown-it': 12.2.3 + markdown-it: 13.0.1 + dev: true + + /@mdit-vue/plugin-frontmatter@0.12.0: + resolution: {integrity: sha512-26Y3JktjGgNoCVH7NLqi5RcdAauAqxepTt2qXueRcRHtGpiRQV2/M1FveIhCOTCtHSuG5bBOHUxGaV6vRK3Vbw==} + dependencies: + '@mdit-vue/types': 0.12.0 + '@types/markdown-it': 12.2.3 + gray-matter: 4.0.3 + markdown-it: 13.0.1 + dev: true + + /@mdit-vue/types@0.12.0: + resolution: {integrity: sha512-mrC4y8n88BYvgcgzq9bvTlDgFyi2zuvzmPilRvRc3Uz1iIvq8mDhxJ0rHKFUNzPEScpDvJdIujqiDrulMqiudA==} + dev: true + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -2001,7 +2024,7 @@ packages: resolution: {integrity: sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==} dev: true - /@typescript-eslint/parser@5.59.6(eslint@8.40.0)(typescript@5.0.4): + /@typescript-eslint/parser@5.59.6(eslint@8.41.0)(typescript@5.0.4): resolution: {integrity: sha512-7pCa6al03Pv1yf/dUg/s1pXz/yGMUBAw5EeWqNTFiSueKvRNonze3hma3lhdsOrQcaOXhbk5gKu2Fludiho9VA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2015,7 +2038,7 @@ packages: '@typescript-eslint/types': 5.59.6 '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.4) debug: 4.3.4 - eslint: 8.40.0 + eslint: 8.41.0 typescript: 5.0.4 transitivePeerDependencies: - supports-color @@ -2055,19 +2078,19 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@5.59.6(eslint@8.40.0)(typescript@5.0.4): + /@typescript-eslint/utils@5.59.6(eslint@8.41.0)(typescript@5.0.4): resolution: {integrity: sha512-vzaaD6EXbTS29cVH0JjXBdzMt6VBlv+hE31XktDRMX1j3462wZCJa7VzO2AxXEXcIl8GQqZPcOPuW/Z1tZVogg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.40.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.41.0) '@types/json-schema': 7.0.11 '@types/semver': 7.5.0 '@typescript-eslint/scope-manager': 5.59.6 '@typescript-eslint/types': 5.59.6 '@typescript-eslint/typescript-estree': 5.59.6(typescript@5.0.4) - eslint: 8.40.0 + eslint: 8.41.0 eslint-scope: 5.1.1 semver: 7.5.1 transitivePeerDependencies: @@ -2128,22 +2151,22 @@ packages: resolution: {integrity: sha512-SclWkqY2c+p5+PiqrbQkhJNEExPdeo71/aGFye10tpBkgPJWd5xC7dhg5F8M4VPNBtuNCrvBWyqNnunMyuz/WQ==} dev: true - /@unocss/eslint-config@0.51.13(eslint@8.40.0)(typescript@5.0.4): + /@unocss/eslint-config@0.51.13(eslint@8.41.0)(typescript@5.0.4): resolution: {integrity: sha512-x5wmPi112y0LeYgNFWA3E1ZERho2WvMVkX4G2VwKVTJNJuADfR2QY1Syax1nWef2K1DFmKijsE/MmG93SJXIUw==} engines: {node: '>=14'} dependencies: - '@unocss/eslint-plugin': 0.51.13(eslint@8.40.0)(typescript@5.0.4) + '@unocss/eslint-plugin': 0.51.13(eslint@8.41.0)(typescript@5.0.4) transitivePeerDependencies: - eslint - supports-color - typescript dev: true - /@unocss/eslint-plugin@0.51.13(eslint@8.40.0)(typescript@5.0.4): + /@unocss/eslint-plugin@0.51.13(eslint@8.41.0)(typescript@5.0.4): resolution: {integrity: sha512-SEMiwkvLa5V8FCeYQL5iCSPUUQHKJUQs6mD1AhCsp8/rbZQZZIyjfCnvFhlfoENXDQjuzm1NmdLR6V9P4ZhT8w==} engines: {node: '>=14'} dependencies: - '@typescript-eslint/utils': 5.59.6(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.6(eslint@8.41.0)(typescript@5.0.4) '@unocss/config': 0.51.13 '@unocss/core': 0.51.13 magic-string: 0.30.0 @@ -2808,6 +2831,12 @@ packages: resolution: {integrity: sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==} dev: true + /argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + dependencies: + sprintf-js: 1.0.3 + dev: true + /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} dev: true @@ -3892,16 +3921,16 @@ packages: source-map: 0.6.1 dev: true - /eslint-config-prettier@8.8.0(eslint@8.40.0): + /eslint-config-prettier@8.8.0(eslint@8.41.0): resolution: {integrity: sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.40.0 + eslint: 8.41.0 dev: true - /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.8.0)(eslint@8.40.0)(prettier@2.8.8): + /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.8.0)(eslint@8.41.0)(prettier@2.8.8): resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -3912,25 +3941,25 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.40.0 - eslint-config-prettier: 8.8.0(eslint@8.40.0) + eslint: 8.41.0 + eslint-config-prettier: 8.8.0(eslint@8.41.0) prettier: 2.8.8 prettier-linter-helpers: 1.0.0 dev: true - /eslint-plugin-vue@9.13.0(eslint@8.40.0): + /eslint-plugin-vue@9.13.0(eslint@8.41.0): resolution: {integrity: sha512-aBz9A8WB4wmpnVv0pYUt86cmH9EkcwWzgEwecBxMoRNhQjTL5i4sqadnwShv/hOdr8Hbl8XANGV7dtX9UQIAyA==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.2.0 || ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.40.0) - eslint: 8.40.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.41.0) + eslint: 8.41.0 natural-compare: 1.4.0 nth-check: 2.1.1 postcss-selector-parser: 6.0.13 semver: 7.5.1 - vue-eslint-parser: 9.3.0(eslint@8.40.0) + vue-eslint-parser: 9.3.0(eslint@8.41.0) xml-name-validator: 4.0.0 transitivePeerDependencies: - supports-color @@ -3969,15 +3998,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.40.0: - resolution: {integrity: sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==} + /eslint@8.41.0: + resolution: {integrity: sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.40.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.41.0) '@eslint-community/regexpp': 4.5.1 '@eslint/eslintrc': 2.0.3 - '@eslint/js': 8.40.0 + '@eslint/js': 8.41.0 '@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -3997,13 +4026,12 @@ packages: find-up: 5.0.0 glob-parent: 6.0.2 globals: 13.20.0 - grapheme-splitter: 1.0.4 + graphemer: 1.4.0 ignore: 5.2.4 import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-sdsl: 4.4.0 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -4508,8 +4536,18 @@ packages: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: true - /grapheme-splitter@1.0.4: - resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + dev: true + + /gray-matter@4.0.3: + resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} + engines: {node: '>=6.0'} + dependencies: + js-yaml: 3.14.1 + kind-of: 6.0.3 + section-matter: 1.0.0 + strip-bom-string: 1.0.0 dev: true /gzip-size@6.0.0: @@ -4975,10 +5013,6 @@ packages: hasBin: true dev: true - /js-sdsl@4.4.0: - resolution: {integrity: sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==} - dev: true - /js-string-escape@1.0.1: resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} engines: {node: '>= 0.8'} @@ -4988,6 +5022,14 @@ packages: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true + /js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true + /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -6442,6 +6484,10 @@ packages: resolution: {integrity: sha512-r3Mq2ITFQ5a2VXLOy4/Sb2Ptp7OfEO8YIbhVJqJXoFc9hc5nTXXkCvtVDjIGbvC0vdE7tse+xTM9BMjsszP6bw==} dev: true + /sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true + /stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} dev: true @@ -7277,6 +7323,23 @@ packages: - supports-color dev: true + /vite-plugin-vue-markdown@0.23.5(vite@4.3.8): + resolution: {integrity: sha512-NXTZ4y+n691gLPWayMBbh4jldQeaqDp9e9WjWUYbn9obsLqS9qU+hr4RAruDq5kP4siTOp7JDV34Sw5eA7WxLg==} + peerDependencies: + vite: ^2.0.0 || ^3.0.0-0 || ^4.0.0 + dependencies: + '@antfu/utils': 0.7.2 + '@mdit-vue/plugin-component': 0.12.0 + '@mdit-vue/plugin-frontmatter': 0.12.0 + '@mdit-vue/types': 0.12.0 + '@rollup/pluginutils': 5.0.2 + '@types/markdown-it': 12.2.3 + markdown-it: 13.0.1 + vite: 4.3.8(@types/node@20.2.1)(terser@5.17.4) + transitivePeerDependencies: + - rollup + dev: true + /vite-plugin-vue-meta-layouts@0.2.2(vite@4.3.8)(vue-router@4.2.1): resolution: {integrity: sha512-u3WHlSzqE7tfOFFN7IygkQXDgnhVYD+GSfSXeMk1m/xI/gMtJtLeVwjBTow4kOn3oEkJcj/I9yCZoWpQeRHTFw==} peerDependencies: @@ -7500,14 +7563,14 @@ packages: vue-demi: 0.13.11(vue@3.3.4) dev: true - /vue-eslint-parser@9.3.0(eslint@8.40.0): + /vue-eslint-parser@9.3.0(eslint@8.41.0): resolution: {integrity: sha512-48IxT9d0+wArT1+3wNIy0tascRoywqSUe2E1YalIC1L8jsUGe5aJQItWfRok7DVFGz3UYvzEI7n5wiTXsCMAcQ==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' dependencies: debug: 4.3.4 - eslint: 8.40.0 + eslint: 8.41.0 eslint-scope: 7.2.0 eslint-visitor-keys: 3.4.1 espree: 9.5.2 diff --git a/presets/index.ts b/presets/index.ts index 04d5a55..47409b7 100644 --- a/presets/index.ts +++ b/presets/index.ts @@ -31,11 +31,11 @@ import { loadEnv } from 'vite' import { AutoGenerateImports } from 'vite-auto-import-resolvers' import Compression from 'vite-plugin-compression' import EnvTypes from 'vite-plugin-env-types' -import Markdown from 'vite-plugin-md' import { viteMockServe as Mock } from 'vite-plugin-mock' import Removelog from 'vite-plugin-removelog' import Modules from 'vite-plugin-use-modules' import VueDevTools from 'vite-plugin-vue-devtools' +import Markdown from 'vite-plugin-vue-markdown' import Layouts from 'vite-plugin-vue-meta-layouts' import { warmup as Warmup } from 'vite-plugin-warmup' import { HtmlPolyfill } from 'vue-dark-switch/vite' @@ -90,6 +90,7 @@ export default function () { // 组件自动按需引入 Components({ directoryAsNamespace: true, + include: [/\.vue$/, /\.[tj]sx$/, /\.md$/], extensions: ['md', 'vue', 'tsx', 'jsx'], dts: resolve(__dirname, './types/components.d.ts'), types: [ diff --git a/src/pages/about.md b/src/pages/about.md index c670a8f..93177fa 100644 --- a/src/pages/about.md +++ b/src/pages/about.md @@ -5,3 +5,8 @@ ```js console.log("hello"); ``` + +
+ + +