Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
80c1355
chore(deps-dev): bump textlint-rule-stop-words from 1.0.17 to 2.0.8
dependabot-preview[bot] Jan 5, 2021
775b3de
fix(deps): bump autoprefixer from 9.6.1 to 9.8.6
dependabot-preview[bot] Jan 5, 2021
aeb8dce
fix(deps): [security] bump ini from 1.3.5 to 1.3.8
dependabot-preview[bot] Jan 5, 2021
77c63d0
chore(deps-dev): bump remark-cli from 7.0.0 to 9.0.0
dependabot-preview[bot] Jan 5, 2021
830dd4c
fix(deps): bump vue from 2.6.10 to 2.6.12
dependabot-preview[bot] Jan 6, 2021
4893b41
docs: add version filter for algolia search
meteorlxy Jan 24, 2021
ba89f39
fix($theme-default): override algoliaOptions correctly
meteorlxy Jan 26, 2021
50388d9
build: bump vue-server-renderer from 2.6.10 to 2.6.12
meteorlxy Jan 27, 2021
51277f8
fix($core): component CodeGroup loads correctly on clientfix #2711 (#…
d-pollard Feb 10, 2021
84649fb
build: release version 1.8.1
bencodezen Feb 11, 2021
3e1f5d8
chore: version 1.8.1 changelog
bencodezen Feb 11, 2021
1aceca1
refactor($core): use `some` instead of `filter` when checking route e…
hong4rc Feb 15, 2021
ce85580
docs: fix broken link for out-of-box plugin references (#2797)
adam0x01 Feb 17, 2021
843c943
docs($zh): translate register plugin description (#2788)
gtn1024 Feb 17, 2021
f23028e
docs: fix typo in Custom Page Class of default theme config (#2725)
sshine Feb 17, 2021
e79c8b7
docs($zh): update custom page class for default theme config (#2719)
Feb 17, 2021
3ab9fca
fix($default-theme): sidebar groups are not opened when directly navi…
echojoshchen Feb 18, 2021
bb4ae4e
fix($markdown): support path without file extension when importing co…
mitjat Feb 18, 2021
11eed0f
build: release version 1.8.2
billyyyyy3320 Feb 18, 2021
38e9863
chore: version 1.8.2 changelog
billyyyyy3320 Feb 18, 2021
b877b3b
fix($core): escape meta tags correctly (fix #2831) (#2832)
sangeeth96 May 17, 2021
5a15b1a
docs: remove sponsor
bencodezen Dec 3, 2020
f74a6ec
docs: add version navigation
meteorlxy Jun 11, 2021
f077f71
docs: improve getting started guide (#2710)
Jul 9, 2021
dceb2fe
docs: clean all invalid links (close #2955) (#2956)
ulivz Nov 29, 2021
1c20094
update readme
yyx990803 Dec 15, 2021
aef643d
docs: remove beta state for theme inheritance
ulivz Dec 18, 2021
6d3f3d3
docs: mention Algolia `appId` option in config snippet (#2957)
shortcuts Dec 18, 2021
b26be33
docs: front matter language example should use `lang` (#2939)
matharden Dec 18, 2021
d17b403
docs: update front matter language example for `zh-CN` (#2939)
ulivz Dec 18, 2021
78a7b70
docs: update using-vue.md for `zh-CN` (#2934)
ZweiRm Dec 18, 2021
f5834a2
docs: fix spelling error (#2890)
Mikmist Dec 18, 2021
c8d9986
docs(markdown): update page suffix translation (#2861)
Angus-Liu Dec 18, 2021
6d15511
fix(theme-default): fix display text for danger container (#2849)
taiga248 Dec 18, 2021
6c8f6a2
docs: fixes broken links to plugin-container (#2812)
abea Dec 18, 2021
2345902
feat(plugin-last-updated): inject `lastUpdatedTimestamp` to `$page` (…
psi-4ward Dec 20, 2021
145332b
docs: add a method to deploy vuepress site with github actions (#2179)
jenkey2011 Dec 20, 2021
e4184a2
docs: add favicon example in head config (#2259)
GustafHultgren Dec 20, 2021
22bae47
docs: add note to handle github pages custom domain (#2389)
flangel Dec 20, 2021
53cc2dd
docs: add `@source` alias (#2314)
peteruithoven Dec 20, 2021
f107149
ci: using `@nomadland/mono` for release flow (#2968)
ulivz Dec 20, 2021
469b33f
build: release version 1.8.3
ulivz Dec 20, 2021
67e50a4
chore: 1.8.3 changelog
ulivz Dec 20, 2021
f49e755
ci: tweak commit lint scope
ulivz Dec 20, 2021
cafd87f
chore: add `amour1688.ts-in-markdown` as recommended vscode extension
ulivz Dec 22, 2021
19eeb14
chore: add vscode settings
ulivz Dec 22, 2021
daa6404
feat: typescript support for config file (#2973)
ulivz Dec 22, 2021
15b6c75
docs: fix textlint
ulivz Dec 22, 2021
1440bbd
build: release version 1.9.0
ulivz Dec 22, 2021
b25ffe3
chore(all): 1.9.0 changelog
ulivz Dec 22, 2021
0bb97b3
chore: changelog
ulivz Dec 22, 2021
9897be0
chore: changelog image
ulivz Dec 22, 2021
eab6741
ci: allow scope `types` for commit
ulivz Dec 22, 2021
dd6e3ef
fix(types): support plain string usage for known third-party plugins
ulivz Dec 22, 2021
2ffd506
build: release version 1.9.1
ulivz Dec 22, 2021
6aaacdf
chore(all): 1.9.1 changelog
ulivz Dec 22, 2021
c8eff35
chore: clean outdated links
ulivz Dec 22, 2021
7ac6aa8
feat(types): init `@vuepress/types`
ulivz Dec 23, 2021
ac78df2
chore: clean outdated changelog
ulivz Dec 23, 2021
8c4b5bc
chore(types): tweaks
ulivz Dec 23, 2021
84250cc
feat(types): `defineThemeEntry` helper to infer type for theme entry
ulivz Dec 23, 2021
2f707a6
refactor(types): move helpers to `@vuepress/types`
ulivz Dec 23, 2021
cb07377
feat(types): `definePluginEntry` helper to infer type for plugin entry
ulivz Dec 23, 2021
b814133
refactor: typed all official plugins
ulivz Dec 23, 2021
f792d9a
chore: fix outdated links
ulivz Dec 23, 2021
f0ba93c
fix(types): regression issue of reusing define helpers
ulivz Dec 23, 2021
ed3cce6
build: release version 1.9.2
ulivz Dec 23, 2021
63a04f9
chore(all): 1.9.2 changelog
ulivz Dec 23, 2021
e5f8490
chore: changelog for 1.9.2
ulivz Dec 23, 2021
b37be8d
chore: tweaks
ulivz Dec 23, 2021
b5c4744
fix(types): all plugin option api should be optional
ulivz Dec 23, 2021
accfe87
build: release version 1.9.3
ulivz Dec 23, 2021
c8e479c
chore(all): 1.9.3 changelog
ulivz Dec 23, 2021
3e2e380
docs: add guide to deploy site to Layer0 (#2972)
Dec 23, 2021
9bf9583
chore(theme-default): type comment
ulivz Dec 23, 2021
e919d14
fix(types): cannot find module '../../shared-utils/src/datatypes'
ulivz Dec 24, 2021
66a6c27
fix(types): '_filePath' implicitly has an 'any' type
ulivz Dec 24, 2021
4280e7a
ci(types): lint types under development
ulivz Dec 24, 2021
54bd159
chore(types): tsconfig.json
ulivz Dec 24, 2021
075ec62
fix(types): add missing default theme config `activeHeaderLinks`
ulivz Dec 24, 2021
7aeff34
feat(types): expose all plugin types
ulivz Dec 24, 2021
e4a28db
build: release version 1.9.4
ulivz Dec 24, 2021
e402b57
chore(all): 1.9.4 changelog
ulivz Dec 24, 2021
5f1e3b0
feat(types): `definePlugin` supports declare theme config type
ulivz Dec 25, 2021
4269714
feat(types): `ctx.themeAPI`
ulivz Dec 25, 2021
332dac7
feat(types): `ctx.getSiteData`
ulivz Dec 25, 2021
17c8fe4
feat(types): `ctx.getLibFilePath`
ulivz Dec 25, 2021
c926aff
refactor(core): add type comments for internal plugins
ulivz Dec 25, 2021
ef6f87a
build: release version 1.9.5
ulivz Dec 25, 2021
5f0eba9
chore(all): 1.9.5 changelog
ulivz Dec 25, 2021
7cdb9a0
chore: fix lock file
ulivz Jan 15, 2022
2f9a394
feat: add build concurrency control (close: #1819) (#2953)
troyeagle Jan 15, 2022
f59598a
fix(core): compatibility with node 10 (close: #2981) (#2992)
ulivz Jan 15, 2022
753df05
feat(theme-default): set home footer with markdown slot (close: #2993…
ulivz Jan 17, 2022
5c6a16c
fix(types): missing `sidebarDepth` at default theme config
ulivz Jan 17, 2022
5699216
build: release version 1.9.6
ulivz Jan 17, 2022
a956e42
chore(all): 1.9.6 changelog
ulivz Jan 17, 2022
a7b12bf
fix(types): missing `ariaLabel` at default theme config
ulivz Jan 18, 2022
2f2357a
build: release version 1.9.7
ulivz Jan 18, 2022
1e33eee
chore(all): 1.9.7 changelog
ulivz Jan 18, 2022
89440ce
docs: update readme team members
bencodezen Feb 17, 2022
99294be
docs: fix deploy.md (#3060)
Force1ess Jul 4, 2022
d2f5b07
docs: fix clean-urls link (#3032)
ivancheban Jul 4, 2022
a048ef0
chore: add missing space (#3030)
rojvv Jul 4, 2022
d692cc8
chore: replace zh-cn (#3014)
peterroe Jul 4, 2022
f6430ac
chore: fix dead Algolia DocSearch links (#3097)
ThorNissen Nov 10, 2022
7cd8b30
fix(cli): `.vuepress/config.ts` does not respect custom command (clos…
ulivz Jan 6, 2023
cb87096
build: release version 1.9.8
ulivz Jan 6, 2023
1dee30f
chore(all): 1.9.8 changelog
ulivz Jan 6, 2023
5e3a5a0
fix: remove non-existing :blur css pseudo selector (#3118)
niknetniko Jan 20, 2023
74d5eec
fix(types): missing types for nested sidebar group (close: #3127) (#3…
ulivz Feb 25, 2023
970526f
chore: using `export default` at `config.ts`
ulivz Feb 25, 2023
9049d48
fix(types): missing types for `initialOpenGroupIndex` (close: #3129) …
ulivz Feb 25, 2023
5895594
chore(types): allow `algolia` to be `null`
ulivz Feb 25, 2023
5b74b51
docs: update typescript-as-config.md (#3101)
Michael18811380328 Feb 25, 2023
dacb7a8
chore: fixed broken anchor tag (#3081)
neuralpain Feb 25, 2023
af79757
docs: duplicate text (#2803)
evinma Feb 25, 2023
e5915a8
fix(theme-default): headings anchor should not be selectable (#3063)
ramiy Feb 25, 2023
f1cbdb6
build: release version 1.9.9
ulivz Feb 25, 2023
8f48b69
chore(all): 1.9.9 changelog
ulivz Feb 25, 2023
6343a8c
chore: changelog
ulivz Feb 25, 2023
df1fc26
workflow: using `monoo`
ulivz Feb 25, 2023
9044f14
docs: tweak `zh/guide/typescript-as-config.md`
ulivz Feb 25, 2023
cef64e6
fix(markdown): replace double quotation marks in classname(fix #3152)…
spencerHT Aug 14, 2023
3bcd4d0
docs: fix a typo in the palette in the faq documentation (#3143)
LooseLi Aug 14, 2023
355e73a
docs: Wrong "comma" position in the Algolia configuration sample code…
lete114 Aug 14, 2023
546499b
fix(core): failed to resolve theme components when using theme inheri…
ulivz Aug 14, 2023
a3e4bba
build: release version 1.9.10
ulivz Aug 14, 2023
087f8a1
chore(all): 1.9.10 changelog
ulivz Aug 14, 2023
9fb4bb0
docs: update project status
meteorlxy May 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@
"code"
]
},
{
"login": "bencodezen",
"name": "Ben Hong",
"avatar_url": "https://avatars0.githubusercontent.com/u/4836334?v=4",
"profile": "http://www.bencodezen.io",
"contributions": [
"code",
"doc",
"question"
]
},
{
"login": "meteorlxy",
"name": "meteorlxy",
Expand All @@ -49,7 +38,7 @@
"doc"
]
},
{
{
"login": "kefranabg",
"name": "Franck Abgrall",
"avatar_url": "https://avatars3.githubusercontent.com/u/9840435?v=4",
Expand Down
16 changes: 11 additions & 5 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
const fs = require('fs')
const path = require('path')

const VuepressPackages = fs.readdirSync(path.resolve(__dirname, 'packages/@vuepress'))
const vuepressPackages = fs.readdirSync(path.resolve(__dirname, 'packages/@vuepress'))
const availableScopes = [
'all',
'cli',
'zh',
'types',
...vuepressPackages
]

module.exports = {
extends: [
Expand All @@ -12,10 +19,9 @@ module.exports = {
2,
'always',
[
'cli',
'zh',
...VuepressPackages
].map(name => `$${name}`)
...availableScopes,
...availableScopes.map(name => `$${name}`)
]
]
}
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
!.vuepress
packages/@vuepress/shared-utils/lib
packages/@vuepress/shared-utils/types
packages/@vuepress/types
17 changes: 8 additions & 9 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ jobs:
pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
node-version: '14'
check-latest: true
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
${{ runner.os }}-
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ node_modules
TODOs.md

# Editors
.vscode
.idea

# VuePress temp directory
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"amour1688.ts-in-markdown",
]
}
48 changes: 48 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"markdown"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"search.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"docs/docs/out/**": true,
"packages/*/lib/**": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
},
"eslint.trace.server": "verbose",
"cSpell.words": [
"commitlint",
"monoo"
]
}

1,277 changes: 726 additions & 551 deletions CHANGELOG.md

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
</p>

<p align="center">
<img src="https://img.shields.io/npm/dm/vuepress.svg" alt="Downloads"></a>
<a href="#"><img src="https://img.shields.io/npm/dm/vuepress.svg" alt="Downloads"></a>
<a href="https://www.npmjs.com/package/vuepress"><img src="https://img.shields.io/npm/v/vuepress.svg" alt="Version"></a>
<a href="https://github.com/vuejs/vuepress/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/vuepress.svg" alt="License"></a>
<a href="https://discordapp.com/invite/HBherRA"><img src="https://img.shields.io/badge/Discord-join%20chat-738bd7.svg" alt="VuePress channel on Discord"></a>
</p>

> VuePress 2 is coming! Please check out [vuepress-next](https://github.com/vuepress/vuepress-next).
## Status

VuePress v1 is now in maintenance mode.

For a next-gen Vue-based SSG:
- [VitePress](https://vitepress.vuejs.org/): Vue.js official team supported. Built on top of Vue 3 + Vite.
- [VuePress v2+](https://github.com/vuepress/core): Community supported. Built on top of Vue 3 + Vite / Webpack / Other bundlers.

## Documentation

Expand Down Expand Up @@ -44,7 +50,7 @@ If you have a VuePress-related project/component/tool, add it with a pull reques

<table>
<td align="center"><a href="http://evanyou.me"><img src="https://avatars1.githubusercontent.com/u/499550?v=4" width="100px;" alt="Evan You"/><br /><sub><b>Evan You</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=yyx990803" title="Code">💻</a></td>
<td align="center"><a href="http://ulivz.com"><img src="https://avatars1.githubusercontent.com/u/23133919?v=4" width="100px;" alt="ULIVZ"/><br /><sub><b>ULIVZ</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=ulivz" title="Code">💻</a> <a href="https://github.com/vuejs/vuepress/commits?author=ulivz" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/ulivz"><img src="https://avatars1.githubusercontent.com/u/23133919?v=4" width="100px;" alt="ULIVZ"/><br /><sub><b>ULIVZ</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=ulivz" title="Code">💻</a> <a href="https://github.com/vuejs/vuepress/commits?author=ulivz" title="Documentation">📖</a></td>
</table>

### Active Core Team
Expand All @@ -55,7 +61,6 @@ If you have a VuePress-related project/component/tool, add it with a pull reques
<table>
<tr>
<td align="center"><a href="https://billychin.netlify.com/"><img src="https://avatars0.githubusercontent.com/u/38957202?v=4" width="100px;" alt="Billyyyyy3320"/><br /><sub><b>Billyyyyy3320</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=newsbielt703" title="Code">💻</a></td>
<td align="center"><a href="http://www.bencodezen.io"><img src="https://avatars0.githubusercontent.com/u/4836334?v=4" width="100px;" alt="Ben Hong"/><br /><sub><b>Ben Hong</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=bencodezen" title="Code">💻</a> <a href="https://github.com/vuejs/vuepress/commits?author=bencodezen" title="Documentation">📖</a> <a href="#question-bencodezen" title="Answering Questions">💬</a></td>
<td align="center"><a href="https://github.com/meteorlxy"><img src="https://avatars0.githubusercontent.com/u/18205362?s=400&v=4" width="100px;" alt="meteorlxy"/><br /><sub><b>meteorlxy</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=meteorlxy" title="Code">💻</a></td>
<td align="center"><a href="https://twitter.com/CodesOfRa"><img src="https://avatars0.githubusercontent.com/u/945186?v=4" width="100px;" alt="Ramona"/><br /><sub><b>Ramona</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=CodesOfRa" title="Code">💻</a> <a href="https://github.com/vuejs/vuepress/commits?author=CodesOfRa" title="Documentation">📖</a></td>
<td align="center"><a href="https://www.franck-abgrall.me/"><img src="https://avatars3.githubusercontent.com/u/9840435?v=4" width="100px;" alt="Franck Abgrall"/><br /><sub><b>Franck Abgrall</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=kefranabg" title="Code">💻</a> <a href="#question-kefranabg" title="Answering Questions">💬</a></td>
Expand All @@ -73,6 +78,7 @@ Here we honor some no-longer-active core team members who have made valuable con

<table>
<tr>
<td align="center"><a href="http://www.bencodezen.io"><img src="https://avatars0.githubusercontent.com/u/4836334?v=4" width="100px;" alt="Ben Hong"/><br /><sub><b>Ben Hong</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=bencodezen" title="Code">💻</a> <a href="https://github.com/vuejs/vuepress/commits?author=bencodezen" title="Documentation">📖</a> <a href="#question-bencodezen" title="Answering Questions">💬</a></td>
<td align="center"><a href="https://github.com/f3ltron"><img src="https://avatars1.githubusercontent.com/u/11556276?v=4" width="100px;" alt="Giraud Florent"/><br /><sub><b>Giraud Florent</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=f3ltron" title="Code">💻</a></td>
<td align="center"><a href="https://frontstuff.io/"><img src="https://avatars0.githubusercontent.com/u/5370675?v=4" width="100px;" alt="Sarah Dayan"/><br /><sub><b>Sarah Dayan</b></sub></a><br /><a href="https://github.com/vuejs/vuepress/commits?author=sarahdayan" title="Code">💻</a> <a href="https://github.com/vuejs/vuepress/commits?author=sarahdayan" title="Documentation">📖</a></td>
<td align="center"><a href="https://twitter.com/_vinayak_k"><img src="https://avatars2.githubusercontent.com/u/19776877?v=4" width="100px;" alt="Vinayak Kulkarni"/><br /><sub><b>Vinayak Kulkarni</b></sub></a><br /><a href="#plugin-vinayakkulkarni" title="Plugin/utility libraries">🔌</a> <a href="https://github.com/vuejs/vuepress/commits?author=vinayakkulkarni" title="Code">💻</a> <a href="#blog-vinayakkulkarni" title="Blogposts">📝</a></td>
Expand Down
8 changes: 7 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ module.exports = {
['@babel/preset-env', { 'targets': { 'node': 'current' }}]
],
'plugins': [
'@babel/plugin-syntax-dynamic-import'
'@babel/plugin-syntax-dynamic-import',
[
'@babel/plugin-proposal-class-properties',
{
'loose': true
}
]
]
}
}
Expand Down
116 changes: 116 additions & 0 deletions changelog/1.9.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# TS Support for VuePress Plugin and Theme.

## Motivation

We've announced [VuePress 1.9](https://github.com/vuejs/vuepress/releases/tag/v1.9.0) that takes full TypeScript Support for Config File, while VuePress 1.9.2 ships with **TS Support for VuePress Plugin and Theme**:

<p align="center">
<img src="./assets/showcase.png" width="400px"></img>
<p>

## Quick Start

In order to make the plugin developer not dependent on VuePress for development, we provide a completely independent type package `@vuepress/types`:

```bash
npm i @vuepress/types -D
```

`@vuepress/types` exports four functions:

- `defineConfig`
- `defineConfig4CustomTheme`
- `defineTheme`
- `definePlugin`

Note that using `@vuepress/types` is equivalent to using `vuepress/config`.

## Plugin Type

If you already have some VuePress plugins written in JS, you can leverage your IDE's intellisense with jsdoc type hints:

```js
/**
* @type {import('@vuepress/types').Plugin}
*/
module.exports = {
ready() {
// ...
}
};
```

Alternatively, you can use the defineConfig helper which should provide intellisense without the need for jsdoc annotations:

```js
import { definePlugin } from "@vuepress/types";

export default definePlugin({
// ...
});
```

## Plugin Options Type

Type of plugin options also supports passing in through generic type:

```ts
import { definePlugin } from "@vuepress/types";

interface Options {
name: string;
}

export default definePlugin<Options>((options, ctx) => {
return {
ready() {
return ctx.base + options.name;
}
};
});
```

## Theme Type

Similar to [plugin](plugin-type), the only difference is the type you use, and the define function:

```diff
/**
- * @type {import('@vuepress/types').Plugin}
+ * @type {import('@vuepress/types').Theme}
*/
```

```diff
-import { definePlugin } from "@vuepress/types";
+import { defineTheme } from "@vuepress/types";

-export default definePlugin({
+export default defineTheme({
// ...
});
```

## Theme Config Type

Type of theme config also supports passing in through generic type:

```ts
import { defineTheme } from "@vuepress/types";

interface ThemeConfig {
lang: string;
}

export default defineTheme<ThemeConfig>((themeConfig, ctx) => {
return {
ready() {
return ctx.base + themeConfig.lang;
}
};
});
```

## Notes

It is worth noting that, unlike the [site configuration](https://vuepress.vuejs.org/config/), i.e. `.vuepress/config.js`, if you use TypeScript to write theme or plugin, you still need to compile it into JavaScript before publishing it to NPM.
Binary file added changelog/assets/showcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.8.0",
"version": "1.9.10",
"command": {
"version": {
"allowBranch": "master",
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"packages:diff": "lerna diff",
"packages:list": "lerna ls -l",
"register-vuepress": "lerna exec --scope vuepress -- yarn link",
"release": "yarn lint && yarn build && yarn test && node scripts/release.js",
"release": "yarn lint && yarn build && monoo release",
"remote-version": "node scripts/remote-version.js",
"show-help": "yarn workspace docs show-help",
"test": "node scripts/test.js",
"tsc": "yarn workspace @vuepress/shared-utils tsc",
"tsc": "lerna run tsc --stream",
"unregister-vuepress": "lerna exec --scope vuepress -- yarn unlink",
"update-core-team": "all-contributors generate",
"view-info": "yarn tsc && yarn workspace docs view-info"
Expand All @@ -45,6 +45,7 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "7",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@types/escape-html": "^0.0.20",
Expand All @@ -66,7 +67,8 @@
"lerna": "3.16.4",
"lint-staged": "^9.3.0",
"minimist": "^1.2.0",
"monoo": "0.4.3",
"sort-package-json": "^1.24.0",
"typescript": "^3.6.3"
"typescript": "4.5.2"
}
}
3 changes: 2 additions & 1 deletion packages/@vuepress/core/lib/client/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ export function handleRedirectForCleanUrls (router) {
}

function isRouteExists (router, path) {
return router.options.routes.filter(route => route.path.toLowerCase() === path.toLowerCase()).length > 0
const pathLower = path.toLowerCase()
return router.options.routes.some(route => route.path.toLowerCase() === pathLower)
}
3 changes: 2 additions & 1 deletion packages/@vuepress/core/lib/client/root-mixins/updateMeta.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unionBy from 'lodash/unionBy'
import escape from 'escape-html'

export default {
// created will be called on both client and ssr
Expand Down Expand Up @@ -132,7 +133,7 @@ function renderPageMeta (meta) {
return meta.map(m => {
let res = `<meta`
Object.keys(m).forEach(key => {
res += ` ${key}="${m[key]}"`
res += ` ${key}="${escape(m[key])}"`
})
return res + `>`
}).join('\n ')
Expand Down
Loading