From 9166e598f1cc60cbff81e32847712740be5b1806 Mon Sep 17 00:00:00 2001 From: Okinea Dev Date: Fri, 11 Apr 2025 08:39:50 +0200 Subject: [PATCH 1/3] feat(docs): add a plugin to generate documentation for LLMs (#3202) --- .vitepress/config.ts | 29 +++++++++++- package.json | 1 + pnpm-lock.yaml | 101 ++++++++++++++++++++++++++++++++++++++++++ src/public/_redirects | 5 +++ 4 files changed, 134 insertions(+), 2 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index adce7914..d9dcdf60 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -1,7 +1,8 @@ import fs from 'fs' import path from 'path' -import { defineConfigWithTheme, type HeadConfig } from 'vitepress' +import { defineConfigWithTheme, type HeadConfig, type Plugin } from 'vitepress' import type { Config as ThemeConfig } from '@vue/theme' +import llmstxt from 'vitepress-plugin-llms' import baseConfig from '@vue/theme/config' import { headerPlugin } from './headerMdPlugin' // import { textAdPlugin } from './textAdMdPlugin' @@ -800,6 +801,30 @@ export default defineConfigWithTheme({ }, json: { stringify: true - } + }, + plugins: [ + llmstxt({ + ignoreFiles: [ + 'about/team/**/*', + 'about/team.md', + 'about/privacy.md', + 'about/coc.md', + 'developers/**/*', + 'ecosystem/themes.md', + 'examples/**/*', + 'partners/**/*', + 'sponsor/**/*', + 'index.md' + ], + customLLMsTxtTemplate: `\ +# Vue.js + +Vue.js - The Progressive JavaScript Framework + +## Table of Contents + +{toc}` + }) as Plugin + ] } }) diff --git a/package.json b/package.json index 568981f0..aab3d1f5 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@types/markdown-it": "^14.1.2", "@types/node": "^22.7.5", "typescript": "^5.6.3", + "vitepress-plugin-llms": "^0.0.8", "vue-tsc": "^2.1.6" }, "packageManager": "pnpm@9.12.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83087e72..113334ec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,6 +39,9 @@ importers: typescript: specifier: ^5.6.3 version: 5.6.3 + vitepress-plugin-llms: + specifier: ^0.0.8 + version: 0.0.8 vue-tsc: specifier: ^2.1.6 version: 2.1.6(typescript@5.6.3) @@ -692,6 +695,9 @@ packages: resolution: {integrity: sha512-groO71Fvi5SWpxjI9Ia+chy0QBwT61mg6yxJV27f5YFf+Mw+STT75K6SHySpP8Co5LsCrtsbCH5dJZSRtkSKaQ==} engines: {node: '>= 14.0.0'} + argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -751,9 +757,18 @@ packages: engines: {node: '>=12'} hasBin: true + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + extend-shallow@2.0.1: + resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==} + engines: {node: '>=0.10.0'} + focus-trap@7.6.4: resolution: {integrity: sha512-xx560wGBk7seZ6y933idtjJQc1l+ck+pI3sKvhKozdBV1dRZoKhkW5xoCaFv9tQiX5RH1xfSxjuNu6g+lmN/gw==} @@ -762,6 +777,10 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + gray-matter@4.0.3: + resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} + engines: {node: '>=6.0'} + gsap@3.12.5: resolution: {integrity: sha512-srBfnk4n+Oe/ZnMIOXt3gT605BX9x5+rh/prT2F1SsNJsU1XuMiP0E2aptW481OnonOGACZWBqseH5Z7csHxhQ==} @@ -781,16 +800,32 @@ packages: html-void-elements@3.0.0: resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==} + is-extendable@0.1.1: + resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==} + engines: {node: '>=0.10.0'} + is-what@4.1.16: resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} engines: {node: '>=12.13'} + js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + + kind-of@6.0.3: + resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} + engines: {node: '>=0.10.0'} + magic-string@0.30.12: resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} mark.js@8.11.1: resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} + markdown-title@1.0.2: + resolution: {integrity: sha512-MqIQVVkz+uGEHi3TsHx/czcxxCbRIL7sv5K5DnYw/tI+apY54IbPefV/cmgxp6LoJSEx/TqcHdLs/298afG5QQ==} + engines: {node: '>=6'} + mdast-util-to-hast@13.2.0: resolution: {integrity: sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==} @@ -809,6 +844,10 @@ packages: micromark-util-types@2.0.1: resolution: {integrity: sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==} + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -875,6 +914,10 @@ packages: search-insights@2.17.2: resolution: {integrity: sha512-zFNpOpUO+tY2D85KrxJ+aqwnIfdEGi06UH2+xEb+Bp9Mwznmauqc9djbnBibJO5mpfUPPa8st6Sx65+vbeO45g==} + section-matter@1.0.0: + resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} + engines: {node: '>=4'} + semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -894,9 +937,16 @@ packages: resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==} engines: {node: '>=0.10.0'} + sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + stringify-entities@4.0.4: resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==} + strip-bom-string@1.0.0: + resolution: {integrity: sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==} + engines: {node: '>=0.10.0'} + superjson@2.2.2: resolution: {integrity: sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q==} engines: {node: '>=16'} @@ -974,6 +1024,9 @@ packages: terser: optional: true + vitepress-plugin-llms@0.0.8: + resolution: {integrity: sha512-xz4wb87TqAn75RbKwQs+w+63OToK7W57pmLKIEY849Izpzi/WvTI9T+rCDwabdhPFirI3LLT2P2nErsSrik0/A==} + vitepress@1.6.3: resolution: {integrity: sha512-fCkfdOk8yRZT8GD9BFqusW3+GggWYZ/rYncOfmgcDtP3ualNHCAg+Robxp2/6xfH1WwPHtGpPwv7mbA3qomtBw==} hasBin: true @@ -1717,6 +1770,10 @@ snapshots: '@algolia/requester-fetch': 5.20.0 '@algolia/requester-node-http': 5.20.0 + argparse@1.0.10: + dependencies: + sprintf-js: 1.0.3 + balanced-match@1.0.2: {} birpc@0.2.19: {} @@ -1783,8 +1840,14 @@ snapshots: '@esbuild/win32-ia32': 0.21.5 '@esbuild/win32-x64': 0.21.5 + esprima@4.0.1: {} + estree-walker@2.0.2: {} + extend-shallow@2.0.1: + dependencies: + is-extendable: 0.1.1 + focus-trap@7.6.4: dependencies: tabbable: 6.2.0 @@ -1792,6 +1855,13 @@ snapshots: fsevents@2.3.3: optional: true + gray-matter@4.0.3: + dependencies: + js-yaml: 3.14.1 + kind-of: 6.0.3 + section-matter: 1.0.0 + strip-bom-string: 1.0.0 + gsap@3.12.5: {} hast-util-to-html@9.0.4: @@ -1818,14 +1888,25 @@ snapshots: html-void-elements@3.0.0: {} + is-extendable@0.1.1: {} + is-what@4.1.16: {} + js-yaml@3.14.1: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + + kind-of@6.0.3: {} + magic-string@0.30.12: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 mark.js@8.11.1: {} + markdown-title@1.0.2: {} + mdast-util-to-hast@13.2.0: dependencies: '@types/hast': 3.0.4 @@ -1855,6 +1936,10 @@ snapshots: micromark-util-types@2.0.1: {} + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.1 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -1933,6 +2018,11 @@ snapshots: search-insights@2.17.2: {} + section-matter@1.0.0: + dependencies: + extend-shallow: 2.0.1 + kind-of: 6.0.3 + semver@7.6.3: {} shiki@2.1.0: @@ -1952,11 +2042,15 @@ snapshots: speakingurl@14.0.1: {} + sprintf-js@1.0.3: {} + stringify-entities@4.0.4: dependencies: character-entities-html4: 2.1.0 character-entities-legacy: 3.0.0 + strip-bom-string@1.0.0: {} + superjson@2.2.2: dependencies: copy-anything: 3.0.5 @@ -2017,6 +2111,13 @@ snapshots: '@types/node': 22.7.5 fsevents: 2.3.3 + vitepress-plugin-llms@0.0.8: + dependencies: + gray-matter: 4.0.3 + markdown-title: 1.0.2 + minimatch: 10.0.1 + picocolors: 1.1.1 + vitepress@1.6.3(@algolia/client-search@5.20.0)(@types/node@22.7.5)(postcss@8.5.1)(search-insights@2.17.2)(typescript@5.6.3): dependencies: '@docsearch/css': 3.8.2 diff --git a/src/public/_redirects b/src/public/_redirects index a7c80a7e..039432c6 100644 --- a/src/public/_redirects +++ b/src/public/_redirects @@ -61,3 +61,8 @@ /v2/guide/reactivity.html /guide/extras/reactivity-in-depth.html /v2/* https://v2.vuejs.org/v2/:splat?redirect=true 302 + +/*.txt /:splat.md 301 +/llms.md /llms.txt 301 +/llms.txt /llms.txt 200! +/llms-full.txt /llms-full.txt 200! From e9a19d5416ad94a4956e29d9e862f8b1542a066b Mon Sep 17 00:00:00 2001 From: Star Date: Fri, 11 Apr 2025 14:31:48 +0800 Subject: [PATCH 2/3] Fix: Update Russian translation repository link in config.ts (#3220) Co-authored-by: wild61 --- .vitepress/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index d9dcdf60..6a7313aa 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -711,7 +711,7 @@ export default defineConfigWithTheme({ { link: 'https://ru.vuejs.org', text: 'Русский', - repo: 'https://github.com/translation-gang/docs-ru' + repo: 'https://github.com/vuejs-translations/docs-ru' }, { link: 'https://cs.vuejs.org', From 16c47b5f6bde5bc2856dccb72a3656cf0e2b187a Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 11 Apr 2025 18:31:30 +1200 Subject: [PATCH 3/3] docs: include example of `@vue-generic` directive (#3219) --- src/api/sfc-script-setup.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/api/sfc-script-setup.md b/src/api/sfc-script-setup.md index 24584387..281c71f4 100644 --- a/src/api/sfc-script-setup.md +++ b/src/api/sfc-script-setup.md @@ -522,6 +522,18 @@ defineProps<{ ``` +You can use `@vue-generic` the directive to pass in explicit types, for when the type cannot be inferred: + +```vue + +``` + In order to use a reference to a generic component in a `ref` you need to use the [`vue-component-type-helpers`](https://www.npmjs.com/package/vue-component-type-helpers) library as `InstanceType` won't work. ```vue