From e79108cce040b5068531452864cd6a0a28c2ef42 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 10 Dec 2020 13:35:13 +0100 Subject: [PATCH 01/78] build: fix release script --- scripts/release.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/scripts/release.js b/scripts/release.js index b9b13aa7..39d5c1c3 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -8,8 +8,6 @@ const currentVersion = require('../package.json').version const versionIncrements = ['patch', 'minor', 'major'] -const tags = ['latest', 'next'] - const inc = (i) => semver.inc(currentVersion, i) const bin = (name) => path.resolve(__dirname, `../node_modules/.bin/${name}`) const run = (bin, args, opts = {}) => @@ -43,19 +41,10 @@ async function main() { throw new Error(`Invalid target version: ${targetVersion}`) } - const { tag } = await prompt({ - type: 'select', - name: 'tag', - message: 'Select tag type', - choices: tags - }) - - console.log(tag) - const { yes: tagOk } = await prompt({ type: 'confirm', name: 'yes', - message: `Releasing v${targetVersion} with the "${tag}" tag. Confirm?` + message: `Releasing v${targetVersion}. Confirm?` }) if (!tagOk) { @@ -73,6 +62,7 @@ async function main() { // Generate the changelog. step('\nGenerating the changelog...') await run('yarn', ['changelog']) + await run('yarn', ['prettier', '--write', 'CHANGELOG.md']) const { yes: changelogOk } = await prompt({ type: 'confirm', @@ -84,17 +74,16 @@ async function main() { return } - // Commit changes to the Git. + // Commit changes to the Git and create a tag. step('\nCommitting changes...') - await run('git', ['add', '-A']) + await run('git', ['add', 'CHANGELOG.md', 'package.json']) await run('git', ['commit', '-m', `release: v${targetVersion}`]) + await run('git', ['tag', `v${targetVersion}`]) // Publish the package. step('\nPublishing the package...') await run('yarn', [ 'publish', - '--tag', - tag, '--new-version', targetVersion, '--no-commit-hooks', @@ -103,7 +92,6 @@ async function main() { // Push to GitHub. step('\nPushing to GitHub...') - await run('git', ['tag', `v${targetVersion}`]) await run('git', ['push', 'origin', `refs/tags/v${targetVersion}`]) await run('git', ['push']) } From 309aa7a8d0e7ab08c1c9db258c74709a66b295cb Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 10 Dec 2020 13:39:22 +0100 Subject: [PATCH 02/78] release: v0.9.2 --- CHANGELOG.md | 70 +++++++++++++++++++++++++++------------------------- package.json | 2 +- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f075f778..a7d65527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,65 +1,67 @@ -## [0.9.1](https://github.com/vuejs/vitepress/compare/v0.9.0...v0.9.1) (2020-12-05) +## [0.9.2](https://github.com/vuejs/vitepress/compare/v0.9.1...v0.9.2) (2020-12-10) +Fix build files -### Bug Fixes +## [0.9.1](https://github.com/vuejs/vitepress/compare/v0.9.0...v0.9.1) (2020-12-05) -* **theme:** the actionLink miss withBase ([#168](https://github.com/vuejs/vitepress/issues/168)) ([#169](https://github.com/vuejs/vitepress/issues/169)) ([ffaca73](https://github.com/vuejs/vitepress/commit/ffaca73992675cef789fe8e13dd8132ae14bbd53)) -* align $title with vuepress ([#158](https://github.com/vuejs/vitepress/issues/158)) ([#163](https://github.com/vuejs/vitepress/issues/163)) ([30740d3](https://github.com/vuejs/vitepress/commit/30740d3516e3f7cce0e083faa90a732d9916f9af)) -* fix h2 anchor hover ([9bd79e8](https://github.com/vuejs/vitepress/commit/9bd79e8de1827251796d1647b5d258818a94f3b3)), closes [#174](https://github.com/vuejs/vitepress/issues/174) -* fix inline code not inheriting the parent font size ([f5a570f](https://github.com/vuejs/vitepress/commit/f5a570f640c539d96cfa2104613521a70cf2f199)) -* fix link prefetch ([ade6ddd](https://github.com/vuejs/vitepress/commit/ade6dddbb5ea72cc7569fcfc46f5e6a362af58ce)) -* hydration mismatch when home page having action link ([a7686b7](https://github.com/vuejs/vitepress/commit/a7686b7691a3e3d7d10226fd4f7971929701965a)) -* make home page look better ([#154](https://github.com/vuejs/vitepress/issues/154)) ([a084cd3](https://github.com/vuejs/vitepress/commit/a084cd3f782f2aaf78a6542b0c86f67676580a73)) -* prevLinks and nextLinks config type ([#165](https://github.com/vuejs/vitepress/issues/165)) ([1b6981a](https://github.com/vuejs/vitepress/commit/1b6981a9157588bc4e29e591ba8a0d9ca5c9c9e8)) -* siteData passed to enhanceApp being siteDataByRoute ([#159](https://github.com/vuejs/vitepress/issues/159)) ([01d2837](https://github.com/vuejs/vitepress/commit/01d2837474caef19daaf0be4b3c283dbe85a09da)) +### Bug Fixes +- **theme:** the actionLink miss withBase ([#168](https://github.com/vuejs/vitepress/issues/168)) ([#169](https://github.com/vuejs/vitepress/issues/169)) ([ffaca73](https://github.com/vuejs/vitepress/commit/ffaca73992675cef789fe8e13dd8132ae14bbd53)) +- align $title with vuepress ([#158](https://github.com/vuejs/vitepress/issues/158)) ([#163](https://github.com/vuejs/vitepress/issues/163)) ([30740d3](https://github.com/vuejs/vitepress/commit/30740d3516e3f7cce0e083faa90a732d9916f9af)) +- fix h2 anchor hover ([9bd79e8](https://github.com/vuejs/vitepress/commit/9bd79e8de1827251796d1647b5d258818a94f3b3)), closes [#174](https://github.com/vuejs/vitepress/issues/174) +- fix inline code not inheriting the parent font size ([f5a570f](https://github.com/vuejs/vitepress/commit/f5a570f640c539d96cfa2104613521a70cf2f199)) +- fix link prefetch ([ade6ddd](https://github.com/vuejs/vitepress/commit/ade6dddbb5ea72cc7569fcfc46f5e6a362af58ce)) +- hydration mismatch when home page having action link ([a7686b7](https://github.com/vuejs/vitepress/commit/a7686b7691a3e3d7d10226fd4f7971929701965a)) +- make home page look better ([#154](https://github.com/vuejs/vitepress/issues/154)) ([a084cd3](https://github.com/vuejs/vitepress/commit/a084cd3f782f2aaf78a6542b0c86f67676580a73)) +- prevLinks and nextLinks config type ([#165](https://github.com/vuejs/vitepress/issues/165)) ([1b6981a](https://github.com/vuejs/vitepress/commit/1b6981a9157588bc4e29e591ba8a0d9ca5c9c9e8)) +- siteData passed to enhanceApp being siteDataByRoute ([#159](https://github.com/vuejs/vitepress/issues/159)) ([01d2837](https://github.com/vuejs/vitepress/commit/01d2837474caef19daaf0be4b3c283dbe85a09da)) ### Features -* built-in ClientOnly component ([8809d2d](https://github.com/vuejs/vitepress/commit/8809d2dbfc6818ba1618fa43368a45130d940890)) -* **default-theme:** support customLayout: true in frontmatter ([f32771f](https://github.com/vuejs/vitepress/commit/f32771fe8646701410ba4b231a2b0ce38230ab64)) -* add `$withBase` global app function ([15e18df](https://github.com/vuejs/vitepress/commit/15e18df01e6e5ca8af605365896fee0024244b37)) -* add Algolia DocSearch ([#40](https://github.com/vuejs/vitepress/issues/40)) ([#153](https://github.com/vuejs/vitepress/issues/153)) ([5bb4730](https://github.com/vuejs/vitepress/commit/5bb4730f7f48153ae006d7878431d0b58b0fffee)) -* add native support for carbon ads ([#86](https://github.com/vuejs/vitepress/issues/86)) ([9d6b8ca](https://github.com/vuejs/vitepress/commit/9d6b8cadcc6cd59bde6b9b20037f9038190672ce)) -* support customizing default theme via slots ([b8e892e](https://github.com/vuejs/vitepress/commit/b8e892e94a2fd2cedf7b25651548a08a758ccbdb)) -* add more global and computed properties (#152) ([c6bdcfb](https://github.com/vuejs/vitepress/commit/c6bdcfbf4f14916f20a7192b44941d33d4bee51e)), closes [#152](https://github.com/vuejs/vitepress/issues/152) +- built-in ClientOnly component ([8809d2d](https://github.com/vuejs/vitepress/commit/8809d2dbfc6818ba1618fa43368a45130d940890)) +- **default-theme:** support customLayout: true in frontmatter ([f32771f](https://github.com/vuejs/vitepress/commit/f32771fe8646701410ba4b231a2b0ce38230ab64)) +- add `$withBase` global app function ([15e18df](https://github.com/vuejs/vitepress/commit/15e18df01e6e5ca8af605365896fee0024244b37)) +- add Algolia DocSearch ([#40](https://github.com/vuejs/vitepress/issues/40)) ([#153](https://github.com/vuejs/vitepress/issues/153)) ([5bb4730](https://github.com/vuejs/vitepress/commit/5bb4730f7f48153ae006d7878431d0b58b0fffee)) +- add native support for carbon ads ([#86](https://github.com/vuejs/vitepress/issues/86)) ([9d6b8ca](https://github.com/vuejs/vitepress/commit/9d6b8cadcc6cd59bde6b9b20037f9038190672ce)) +- support customizing default theme via slots ([b8e892e](https://github.com/vuejs/vitepress/commit/b8e892e94a2fd2cedf7b25651548a08a758ccbdb)) +- add more global and computed properties (#152) ([c6bdcfb](https://github.com/vuejs/vitepress/commit/c6bdcfbf4f14916f20a7192b44941d33d4bee51e)), closes [#152](https://github.com/vuejs/vitepress/issues/152) # [0.9.0](https://github.com/vuejs/vitepress/compare/v0.8.1...v0.9.0) (2020-11-24) ### Bug Fixes -* avoid 300ms click delay on touch devices ([621ca3e](https://github.com/vuejs/vitepress/commit/621ca3e26f65e13e504724aef76aba3f3361ce81)) -* fix nested list having too much margin ([b0cf2be](https://github.com/vuejs/vitepress/commit/b0cf2be5614505731a3b6dcebeab949c3639c2b2)) -* fix sidebar active status not working as expected ([#140](https://github.com/vuejs/vitepress/issues/140)) ([#149](https://github.com/vuejs/vitepress/issues/149)) ([0b181e7](https://github.com/vuejs/vitepress/commit/0b181e7582ea4be7dca51ec399c697e32b7116f3)) -* make code block look prettier ([#146](https://github.com/vuejs/vitepress/issues/146)) ([242fcc1](https://github.com/vuejs/vitepress/commit/242fcc1098f606f13e7d8e123c081e73a3d89366)) -* some color in code block not working as expected ([#143](https://github.com/vuejs/vitepress/issues/143)) ([da09266](https://github.com/vuejs/vitepress/commit/da09266f5eede3796bb150ccd9d6a173e90354a4)) +- avoid 300ms click delay on touch devices ([621ca3e](https://github.com/vuejs/vitepress/commit/621ca3e26f65e13e504724aef76aba3f3361ce81)) +- fix nested list having too much margin ([b0cf2be](https://github.com/vuejs/vitepress/commit/b0cf2be5614505731a3b6dcebeab949c3639c2b2)) +- fix sidebar active status not working as expected ([#140](https://github.com/vuejs/vitepress/issues/140)) ([#149](https://github.com/vuejs/vitepress/issues/149)) ([0b181e7](https://github.com/vuejs/vitepress/commit/0b181e7582ea4be7dca51ec399c697e32b7116f3)) +- make code block look prettier ([#146](https://github.com/vuejs/vitepress/issues/146)) ([242fcc1](https://github.com/vuejs/vitepress/commit/242fcc1098f606f13e7d8e123c081e73a3d89366)) +- some color in code block not working as expected ([#143](https://github.com/vuejs/vitepress/issues/143)) ([da09266](https://github.com/vuejs/vitepress/commit/da09266f5eede3796bb150ccd9d6a173e90354a4)) ### Features -* add "last updated" feature ([40d204b](https://github.com/vuejs/vitepress/commit/40d204b2f68b90bd2c5e9940cd128c4c16cd5274)) +- add "last updated" feature ([40d204b](https://github.com/vuejs/vitepress/commit/40d204b2f68b90bd2c5e9940cd128c4c16cd5274)) ## [0.8.1](https://github.com/vuejs/vitepress/compare/v0.8.0...v0.8.1) (2020-11-20) ### Bug Fixes -* fix "next and prev link" not working when `link` has extention ([6dcf6b3](https://github.com/vuejs/vitepress/commit/6dcf6b3796bb3d6e703fddd79c6b0c0a7adfd567)) -* fix "next and prev links" not working when the `base` option is set ([#139](https://github.com/vuejs/vitepress/issues/139)) ([018a9b4](https://github.com/vuejs/vitepress/commit/018a9b46d924d0d08f7ff67f18a813348c84ab0a)) +- fix "next and prev link" not working when `link` has extention ([6dcf6b3](https://github.com/vuejs/vitepress/commit/6dcf6b3796bb3d6e703fddd79c6b0c0a7adfd567)) +- fix "next and prev links" not working when the `base` option is set ([#139](https://github.com/vuejs/vitepress/issues/139)) ([018a9b4](https://github.com/vuejs/vitepress/commit/018a9b46d924d0d08f7ff67f18a813348c84ab0a)) # [0.8.0](https://github.com/vuejs/vitepress/compare/v0.7.4...v0.8.0) (2020-11-20) ### Bug Fixes -* exit process with non-zero code on error ([fb09f8e](https://github.com/vuejs/vitepress/commit/fb09f8e638c06aec32494f731554fb1b989daaf0)) -* fix edit link and prev and next links display ([#97](https://github.com/vuejs/vitepress/issues/97)) ([c3b7172](https://github.com/vuejs/vitepress/commit/c3b71729513592112e233165782e60c9c5b425c4)) -* fix next and prev links not working ([#130](https://github.com/vuejs/vitepress/issues/130)) ([fdd498b](https://github.com/vuejs/vitepress/commit/fdd498be70cc09a4331dadd17c4a5339318f21bf)) -* display header-anchor links when using keyboard navigation ([ddc3640](https://github.com/vuejs/vitepress/commit/ddc3640ce66f606894b31e1b7ebeacaaf7b0f1b5)) -* show top part of scrollbar in sidebar ([#129](https://github.com/vuejs/vitepress/issues/129)) ([1ba209a](https://github.com/vuejs/vitepress/commit/1ba209a4d2b606bee1abb7ec1d383467d98cf198)) +- exit process with non-zero code on error ([fb09f8e](https://github.com/vuejs/vitepress/commit/fb09f8e638c06aec32494f731554fb1b989daaf0)) +- fix edit link and prev and next links display ([#97](https://github.com/vuejs/vitepress/issues/97)) ([c3b7172](https://github.com/vuejs/vitepress/commit/c3b71729513592112e233165782e60c9c5b425c4)) +- fix next and prev links not working ([#130](https://github.com/vuejs/vitepress/issues/130)) ([fdd498b](https://github.com/vuejs/vitepress/commit/fdd498be70cc09a4331dadd17c4a5339318f21bf)) +- display header-anchor links when using keyboard navigation ([ddc3640](https://github.com/vuejs/vitepress/commit/ddc3640ce66f606894b31e1b7ebeacaaf7b0f1b5)) +- show top part of scrollbar in sidebar ([#129](https://github.com/vuejs/vitepress/issues/129)) ([1ba209a](https://github.com/vuejs/vitepress/commit/1ba209a4d2b606bee1abb7ec1d383467d98cf198)) ### Features -* add ability to configure markdown options ([#127](https://github.com/vuejs/vitepress/issues/127)) ([#128](https://github.com/vuejs/vitepress/issues/128)) ([463a03a](https://github.com/vuejs/vitepress/commit/463a03a9815ce8fc9f55293dda07bc211ef4f62b)) -* add serve command ([#136](https://github.com/vuejs/vitepress/issues/136)) ([67868bd](https://github.com/vuejs/vitepress/commit/67868bd9281077a4ce708e666bf61a7824afb8b2)) -* better build command output ([e435eec](https://github.com/vuejs/vitepress/commit/e435eec94a841ab0e1c14d59bb13608d5ad6a011)) +- add ability to configure markdown options ([#127](https://github.com/vuejs/vitepress/issues/127)) ([#128](https://github.com/vuejs/vitepress/issues/128)) ([463a03a](https://github.com/vuejs/vitepress/commit/463a03a9815ce8fc9f55293dda07bc211ef4f62b)) +- add serve command ([#136](https://github.com/vuejs/vitepress/issues/136)) ([67868bd](https://github.com/vuejs/vitepress/commit/67868bd9281077a4ce708e666bf61a7824afb8b2)) +- better build command output ([e435eec](https://github.com/vuejs/vitepress/commit/e435eec94a841ab0e1c14d59bb13608d5ad6a011)) ## [0.7.4](https://github.com/vuejs/vitepress/compare/v0.7.3...v0.7.4) (2020-11-11) diff --git a/package.json b/package.json index e31fb257..55a24fa9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "0.9.1", + "version": "0.9.2", "description": "Vite & Vue powered static site generator", "main": "dist/node/index.js", "typings": "types/index.d.ts", From 5fc2ee09cd2ea1ce3e310d4d54c2ba16ea9b4c58 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 15 Dec 2020 16:10:09 +0800 Subject: [PATCH 03/78] chore: typo --- src/node/build/build.ts | 4 ++-- src/node/build/bundle.ts | 4 ++-- src/node/build/render.ts | 4 ++-- src/node/markdown/plugins/highlight.ts | 2 +- src/node/markdown/plugins/slugify.ts | 2 +- src/node/resolver.ts | 2 +- src/node/utils/parseHeader.ts | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/node/build/build.ts b/src/node/build/build.ts index ed34c4b8..090e2a65 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -43,7 +43,7 @@ export async function build(buildOptions: BuildOptions = {}) { // alter the main chunk's hash on every build. It's also embedded as a // string and JSON.parsed from the client because it's faster than embedding // as JS object literal. - const hashMapStirng = JSON.stringify(JSON.stringify(pageToHashMap)) + const hashMapString = JSON.stringify(JSON.stringify(pageToHashMap)) for (const page of siteConfig.pages) { await renderPage( @@ -53,7 +53,7 @@ export async function build(buildOptions: BuildOptions = {}) { appChunk, cssChunk, pageToHashMap, - hashMapStirng + hashMapString ) } } catch (e) { diff --git a/src/node/build/bundle.ts b/src/node/build/bundle.ts index 29762178..b3c928a4 100644 --- a/src/node/build/bundle.ts +++ b/src/node/build/bundle.ts @@ -104,7 +104,7 @@ export async function bundle( fileName: chunk.fileName.replace(/\.js$/, '.lean.js'), code: chunk.code.replace(staticStripRE, ``) } - // remove static markers from orginal code + // remove static markers from original code chunk.code = chunk.code.replace(staticRestoreRE, '') } } @@ -145,7 +145,7 @@ export async function bundle( }, rollupOutputOptions: { ...rollupOutputOptions, - chunkFileNames: (chunk) => { + chunkFileNames(chunk): string { if (/runtime-dom/.test(chunk.name)) { return `framework.[hash].js` } diff --git a/src/node/build/render.ts b/src/node/build/render.ts index a3887b01..3883e38f 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -14,7 +14,7 @@ export async function renderPage( appChunk: OutputChunk, cssChunk: OutputAsset, pageToHashMap: Record, - hashMapStirng: string + hashMapString: string ) { const { createApp } = require(path.join(config.tempDir, `_assets/app.js`)) const { app, router } = createApp() @@ -71,7 +71,7 @@ export async function renderPage(
${content}
- + `.trim() diff --git a/src/node/markdown/plugins/highlight.ts b/src/node/markdown/plugins/highlight.ts index 63d41f48..b9dbe0c9 100644 --- a/src/node/markdown/plugins/highlight.ts +++ b/src/node/markdown/plugins/highlight.ts @@ -37,7 +37,7 @@ export const highlight = (str: string, lang: string) => { } catch (e) { console.warn( chalk.yellow( - `[vuepress] Syntax highlight for language "${lang}" is not supported.` + `[vitepress] Syntax highlight for language "${lang}" is not supported.` ) ) } diff --git a/src/node/markdown/plugins/slugify.ts b/src/node/markdown/plugins/slugify.ts index 0fa4c54f..33d0fe32 100644 --- a/src/node/markdown/plugins/slugify.ts +++ b/src/node/markdown/plugins/slugify.ts @@ -12,7 +12,7 @@ export const slugify = (str: string): string => { .replace(rControl, '') // Replace special characters .replace(rSpecial, '-') - // Remove continous separators + // Remove continuos separators .replace(/\-{2,}/g, '-') // Remove prefixing and trailing separtors .replace(/^\-+|\-+$/g, '') diff --git a/src/node/resolver.ts b/src/node/resolver.ts index 5c829011..4438b12d 100644 --- a/src/node/resolver.ts +++ b/src/node/resolver.ts @@ -10,7 +10,7 @@ export const DEFAULT_THEME_PATH = path.join( ) // special virtual file -// we can't directly import '/@siteData' becase +// we can't directly import '/@siteData' because // - it's not an actual file so we can't use tsconfig paths to redirect it // - TS doesn't allow shimming a module that starts with '/' export const SITE_DATA_ID = '@siteData' diff --git a/src/node/utils/parseHeader.ts b/src/node/utils/parseHeader.ts index 87271c5f..a0b591d0 100644 --- a/src/node/utils/parseHeader.ts +++ b/src/node/utils/parseHeader.ts @@ -5,7 +5,7 @@ // // But header's parsing in the markdown content is done by the markdown // loader based on markdown-it. markdown-it parser will will always keep -// HTML in headers, so in VuePress, after being parsed by the markdiwn +// HTML in headers, so in VuePress, after being parsed by the markdown // loader, the raw HTML in headers will finally be parsed by Vue-loader. // so that we can write HTML/Vue in the header. One exception is the HTML // wrapped by (markdown token: '`') tag. From eefbd76b7a6778324e1591d237a1e5ab30658106 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 23 Dec 2020 18:07:14 +0800 Subject: [PATCH 04/78] chore: typo --- src/client/theme-default/config.ts | 2 +- src/client/theme-default/support/sideBar.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/theme-default/config.ts b/src/client/theme-default/config.ts index b8a36049..e049bcb7 100644 --- a/src/client/theme-default/config.ts +++ b/src/client/theme-default/config.ts @@ -15,7 +15,7 @@ export namespace DefaultTheme { * Customize the header label. Defaults to GitHub/Gitlab/Bitbucket * depending on the provided repo. * - * @exampe `"Contribute!"` + * @example `"Contribute!"` */ repoLabel?: string diff --git a/src/client/theme-default/support/sideBar.ts b/src/client/theme-default/support/sideBar.ts index fb90d6b1..c44d624f 100644 --- a/src/client/theme-default/support/sideBar.ts +++ b/src/client/theme-default/support/sideBar.ts @@ -32,7 +32,7 @@ export function getSideBarConfig( return sidebar } - // get the very first segment of the path to compare with nulti sidebar keys + // get the very first segment of the path to compare with multiple sidebar keys // and make sure it's surrounded by slash path = removeExtention(path) path = ensureStartingSlash(path).split('/')[1] || '/' From 5ba4ea2ef0ef76ffd2a445de3958ecb1b0495161 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 23 Dec 2020 18:08:45 +0800 Subject: [PATCH 05/78] refactor: refactor for diff --git a/src/client/theme-default/components/LastUpdated.vue b/src/client/theme-default/components/LastUpdated.vue index c46b4da9..d33ab0a2 100644 --- a/src/client/theme-default/components/LastUpdated.vue +++ b/src/client/theme-default/components/LastUpdated.vue @@ -5,39 +5,29 @@

- diff --git a/src/client/theme-default/components/PageFooter.vue b/src/client/theme-default/components/PageFooter.vue index dca324fe..4e3295ba 100644 --- a/src/client/theme-default/components/PageFooter.vue +++ b/src/client/theme-default/components/PageFooter.vue @@ -9,17 +9,9 @@ - From 8dfa70839f06c94f308a61863a62b722068ad17d Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 12 Jan 2021 00:02:26 -0500 Subject: [PATCH 66/78] release: v0.11.1 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ab50f05..95639246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [0.11.1](https://github.com/vuejs/vitepress/compare/v0.11.0...v0.11.1) (2021-01-12) + +### Features + +- render content on home page ([ca631c7](https://github.com/vuejs/vitepress/commit/ca631c7f516ad6c643d252dd81e03e29fb3b9e05)) + # [0.11.0](https://github.com/vuejs/vitepress/compare/v0.10.8...v0.11.0) (2021-01-12) ### Code Refactoring diff --git a/package.json b/package.json index 9b13eded..f7464b3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "0.11.0", + "version": "0.11.1", "description": "Vite & Vue powered static site generator", "main": "dist/node/index.js", "typings": "types/index.d.ts", From a0f463af8fd828d24d9a01c3d808d85af8a71c9f Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 12 Jan 2021 16:49:42 -0500 Subject: [PATCH 67/78] fix: aria label id --- src/client/theme-default/components/HomeHero.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/theme-default/components/HomeHero.vue b/src/client/theme-default/components/HomeHero.vue index 145a0721..3e4072b0 100644 --- a/src/client/theme-default/components/HomeHero.vue +++ b/src/client/theme-default/components/HomeHero.vue @@ -4,7 +4,7 @@ -

{{ heroText }}

+

{{ heroText }}

{{ tagline }}

Date: Tue, 12 Jan 2021 17:11:12 -0500 Subject: [PATCH 68/78] chore: remove build setup in docs-serve script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f7464b3b..ae81f886 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "docs-dev": "node ./bin/vitepress dev docs", "docs-debug": "node --inspect-brk ./bin/vitepress dev docs", "docs-build": "yarn build && node ./bin/vitepress build docs", - "docs-serve": "yarn docs-build && node ./bin/vitepress serve docs" + "docs-serve": "node ./bin/vitepress serve docs" }, "engines": { "node": ">=12.0.0" From b9fc0cb78d43949b417376498939daa892a33334 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 12 Jan 2021 17:11:26 -0500 Subject: [PATCH 69/78] perf: generate preload directives for dynamicImport chunks too --- src/node/build/render.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node/build/render.ts b/src/node/build/render.ts index 89689166..9102fd09 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -88,12 +88,18 @@ function resolvePageImports( ) { // find the page's js chunk and inject script tags for its imports so that // they are start fetching as early as possible - const srcPath = normalizePath(path.resolve(config.root, page)) const pageChunk = result.output.find( (chunk) => chunk.type === 'chunk' && chunk.facadeModuleId === srcPath ) as OutputChunk - return Array.from(new Set([...indexChunk.imports, ...pageChunk.imports])) + return Array.from( + new Set([ + ...indexChunk.imports, + ...indexChunk.dynamicImports, + ...pageChunk.imports, + ...pageChunk.dynamicImports + ]) + ) } function renderHead(head: HeadConfig[]) { From 122e0263bd8b738a8a909586e51f41268617e7bf Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 12 Jan 2021 17:23:21 -0500 Subject: [PATCH 70/78] release: v0.11.2 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95639246..e96609dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [0.11.2](https://github.com/vuejs/vitepress/compare/v0.11.1...v0.11.2) (2021-01-12) + +### Bug Fixes + +- aria label id ([a0f463a](https://github.com/vuejs/vitepress/commit/a0f463af8fd828d24d9a01c3d808d85af8a71c9f)) + +### Performance Improvements + +- generate preload directives for dynamicImport chunks too ([b9fc0cb](https://github.com/vuejs/vitepress/commit/b9fc0cb78d43949b417376498939daa892a33334)) + ## [0.11.1](https://github.com/vuejs/vitepress/compare/v0.11.0...v0.11.1) (2021-01-12) ### Features diff --git a/package.json b/package.json index ae81f886..b3b37446 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "0.11.1", + "version": "0.11.2", "description": "Vite & Vue powered static site generator", "main": "dist/node/index.js", "typings": "types/index.d.ts", From 3e6e61bcea8d4a34079428fcce3ecd25af1ae4f7 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 13 Jan 2021 12:28:14 -0500 Subject: [PATCH 71/78] fix: ignore non-html links in router and prefetch --- src/client/app/composables/preFetch.ts | 5 +++++ src/client/app/router.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/client/app/composables/preFetch.ts b/src/client/app/composables/preFetch.ts index 04c8dfde..e35bcecb 100644 --- a/src/client/app/composables/preFetch.ts +++ b/src/client/app/composables/preFetch.ts @@ -75,6 +75,11 @@ export function usePrefetch() { rIC(() => { document.querySelectorAll('#app a').forEach((link) => { const { target, hostname, pathname } = link as HTMLAnchorElement + const extMatch = pathname.match(/\.\w+$/) + if (extMatch && extMatch[0] !== '.html') { + return + } + if ( // only prefetch same tab navigation, since a new tab will load // the lean js chunk instead. diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 6a99e132..7e445d29 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -114,6 +114,7 @@ export function createRouter( if (link) { const { href, protocol, hostname, pathname, hash, target } = link const currentUrl = window.location + const extMatch = pathname.match(/\.\w+$/) // only intercept inbound links if ( !e.ctrlKey && @@ -122,7 +123,8 @@ export function createRouter( !e.metaKey && target !== `_blank` && protocol === currentUrl.protocol && - hostname === currentUrl.hostname + hostname === currentUrl.hostname && + !(extMatch && extMatch[0] !== '.html') ) { e.preventDefault() if (pathname === currentUrl.pathname) { From 187815cc9a143bc99db178cce379cd424d17201a Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 13 Jan 2021 12:28:42 -0500 Subject: [PATCH 72/78] release: v0.11.3 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e96609dc..82dd03d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [0.11.3](https://github.com/vuejs/vitepress/compare/v0.11.2...v0.11.3) (2021-01-13) + +### Bug Fixes + +- ignore non-html links in router and prefetch ([3e6e61b](https://github.com/vuejs/vitepress/commit/3e6e61bcea8d4a34079428fcce3ecd25af1ae4f7)) + ## [0.11.2](https://github.com/vuejs/vitepress/compare/v0.11.1...v0.11.2) (2021-01-12) ### Bug Fixes diff --git a/package.json b/package.json index b3b37446..92e717da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "0.11.2", + "version": "0.11.3", "description": "Vite & Vue powered static site generator", "main": "dist/node/index.js", "typings": "types/index.d.ts", From b4bdaf648d4506fc3a75251cdeea41f631f815a3 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 17 Jan 2021 23:49:13 -0500 Subject: [PATCH 73/78] refactor: vite ssr compat --- src/node/alias.ts | 1 - src/node/build/bundle.ts | 36 ++++++------------------------------ src/node/config.ts | 2 +- src/node/plugin.ts | 6 ++---- 4 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/node/alias.ts b/src/node/alias.ts index 15bc8290..bb2314c2 100644 --- a/src/node/alias.ts +++ b/src/node/alias.ts @@ -18,7 +18,6 @@ export const SITE_DATA_ID = '@siteData' export const SITE_DATA_REQUEST_PATH = '/' + SITE_DATA_ID export function resolveAliases( - root: string, themeDir: string, userConfig: UserConfig ): AliasOptions { diff --git a/src/node/build/bundle.ts b/src/node/build/bundle.ts index 9489364c..7f499958 100644 --- a/src/node/build/bundle.ts +++ b/src/node/build/bundle.ts @@ -3,7 +3,7 @@ import path from 'path' import slash from 'slash' import { APP_PATH } from '../alias' import { SiteConfig } from '../config' -import { RollupOutput, ExternalOption } from 'rollup' +import { RollupOutput } from 'rollup' import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite' import { createVitePressPlugin } from '../plugin' @@ -38,8 +38,12 @@ export async function bundle( root, logLevel: 'warn', plugins: createVitePressPlugin(root, config, ssr, pageToHashMap), + ssr: { + noExternal: ['vitepress'] + }, build: { ...options, + emptyOutDir: true, ssr, base: config.site.base, outDir: ssr ? config.tempDir : config.outDir, @@ -47,20 +51,13 @@ export async function bundle( rollupOptions: { ...rollupOptions, input, - external: ssr - ? resolveExternal(rollupOptions?.external) - : rollupOptions?.external, // important so that each page chunk and the index export things for each // other preserveEntrySignatures: 'allow-extension', output: { ...rollupOptions?.output, ...(ssr - ? { - format: 'cjs', - exports: 'named', - entryFileNames: '[name].js' - } + ? {} : { chunkFileNames(chunk): string { if (!chunk.isEntry && /runtime/.test(chunk.name)) { @@ -97,24 +94,3 @@ export async function bundle( return [clientResult, serverResult, pageToHashMap] } - -function resolveExternal( - userExternal: ExternalOption | undefined -): ExternalOption { - const required = ['vue', /^@vue\//] - if (!userExternal) { - return required - } - if (Array.isArray(userExternal)) { - return [...required, ...userExternal] - } else if (typeof userExternal === 'function') { - return (src, importer, isResolved) => { - if (src === 'vue' || /^@vue\//.test(src)) { - return true - } - return userExternal(src, importer, isResolved) - } - } else { - return [...required, userExternal] - } -} diff --git a/src/node/config.ts b/src/node/config.ts index f5625643..d5af0e59 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -59,7 +59,7 @@ export async function resolveConfig( outDir: resolve(root, 'dist'), tempDir: path.resolve(APP_PATH, 'temp'), markdown: userConfig.markdown, - alias: resolveAliases(root, themeDir, userConfig) + alias: resolveAliases(themeDir, userConfig) } return config diff --git a/src/node/plugin.ts b/src/node/plugin.ts index 3dcd70f8..1cebd379 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -31,8 +31,7 @@ export function createVitePressPlugin( const markdownToVue = createMarkdownToVueRenderFn(root, markdown) const vuePlugin = createVuePlugin({ - include: [/\.vue$/, /\.md$/], - ssr + include: [/\.vue$/, /\.md$/] }) let siteData = site @@ -73,8 +72,7 @@ export function createVitePressPlugin( configureServer(server) { // serve our index.html after vite history fallback return () => { - // @ts-ignore - server.app.use((req, res, next) => { + server.middlewares.use((req, res, next) => { if (req.url!.endsWith('.html')) { res.statusCode = 200 res.end( From c11055c5fb31ff31502400de3e5f6f05011edd1d Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 19 Jan 2021 10:36:35 -0500 Subject: [PATCH 74/78] chore: bump vite --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 92e717da..8cf2fe4c 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "prismjs": "^1.20.0", "sirv": "^1.0.10", "slash": "^3.0.0", - "vite": "^2.0.0-beta.21", + "vite": "^2.0.0-beta.32", "vue": "^3.0.5" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index a837c342..32f9f6d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6031,10 +6031,10 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vite@^2.0.0-beta.21: - version "2.0.0-beta.21" - resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.21.tgz#9a7233c93ed59c5b5de28c3a74f1e94b815d746e" - integrity sha512-B6OhGHwh4DTkDBxZXtGhxmDkK75M3o0sKFz/cfZ2bdqxRze870sJgH66kPuYWjgSVDdPz0NTIKBaxrbcA8wwmw== +vite@^2.0.0-beta.32: + version "2.0.0-beta.32" + resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.32.tgz#c9281013dfd73794887fc0ed7e96579677beb79a" + integrity sha512-RluPnnm4Zyjfu/IBxEmGZe/2QcFqc7qXfhjxzFNiqzyVkmc935HcmSnejkVa7KoW/PeX0wKrtag432esByKVGg== dependencies: esbuild "^0.8.26" postcss "^8.2.1" From 8cd0023176793783315cfa5d9999788f53fe32d4 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 19 Jan 2021 10:46:43 -0500 Subject: [PATCH 75/78] chore: bump plugin-vue --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8cf2fe4c..09338fbf 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "dependencies": { "@docsearch/css": "^1.0.0-alpha.28", "@docsearch/js": "^1.0.0-alpha.28", - "@vitejs/plugin-vue": "^1.0.3", + "@vitejs/plugin-vue": "^1.1.0", "@vue/compiler-sfc": "^3.0.5", "@vue/server-renderer": "^3.0.5", "chalk": "^4.1.0", diff --git a/yarn.lock b/yarn.lock index 32f9f6d9..bcf66913 100644 --- a/yarn.lock +++ b/yarn.lock @@ -948,10 +948,10 @@ dependencies: "@types/yargs-parser" "*" -"@vitejs/plugin-vue@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-1.0.3.tgz#2df3c22802f2d2142ae3bd8d3e93623df790446d" - integrity sha512-sOVHFS97zxuRLAMj10C9Vaiv3WeEwnhtee9V+yv/G/xoJTXPJIRct4Nj2unPtp5zAUoCL+iTVbIC6LnNmNE4Hw== +"@vitejs/plugin-vue@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-1.1.0.tgz#8ae0b11388897b07259c9e5198c0e3fb5e4b37d9" + integrity sha512-ExlAt3nb3PB31jV9AgRZSMoGd+aQRU53fc/seghV8/l0JCzaX2mqlgpG8iytWkRxbBPgtAx4TpCPdiVKnTFT/A== "@vue/compiler-core@3.0.5": version "3.0.5" From 1eed0536edb34f92efb5d523614db5985881872c Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 19 Jan 2021 10:50:15 -0500 Subject: [PATCH 76/78] release: v0.11.4 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82dd03d7..7d89f259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.11.4](https://github.com/vuejs/vitepress/compare/v0.11.3...v0.11.4) (2021-01-19) + +- Latest Vite beta.32 compat (internal changes). + ## [0.11.3](https://github.com/vuejs/vitepress/compare/v0.11.2...v0.11.3) (2021-01-13) ### Bug Fixes diff --git a/package.json b/package.json index 09338fbf..78f6b74f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "0.11.3", + "version": "0.11.4", "description": "Vite & Vue powered static site generator", "main": "dist/node/index.js", "typings": "types/index.d.ts", From 417caf3c28a14e4c223a65823ab0d5705a3ef9a1 Mon Sep 17 00:00:00 2001 From: Kia King Ishii Date: Fri, 22 Jan 2021 23:05:34 +0900 Subject: [PATCH 77/78] docs: update serve command default port --- docs/guide/deploy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/deploy.md b/docs/guide/deploy.md index 056a7aff..e189cc27 100644 --- a/docs/guide/deploy.md +++ b/docs/guide/deploy.md @@ -34,7 +34,7 @@ $ yarn docs:build $ yarn docs:serve ``` -The `serve` command will boot up local static web server that serves the files from `.vitepress/dist` at http://localhost:3000. It's an easy way to check if the production build looks OK in your local environment. +The `serve` command will boot up local static web server that serves the files from `.vitepress/dist` at http://localhost:5000. It's an easy way to check if the production build looks OK in your local environment. You may configure the port of the server py passing `--port` flag as an argument. From 481c4513d78450951add6177824b7996b89ae034 Mon Sep 17 00:00:00 2001 From: Matias Capeletto Date: Fri, 22 Jan 2021 15:47:08 +0100 Subject: [PATCH 78/78] feat: $lang and $localePath globals (#166) (#167) close #166 Co-authored-by: Kia King Ishii --- docs/guide/global-computed.md | 8 ++++++++ src/client/app/mixin.ts | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/docs/guide/global-computed.md b/docs/guide/global-computed.md index d1c0d3f1..384d0e38 100644 --- a/docs/guide/global-computed.md +++ b/docs/guide/global-computed.md @@ -64,6 +64,14 @@ Reference of `$page.frontmatter`. } ``` +## $lang + +The language of the current page. Default: `en-US`. + +## $localePath + +The locale path prefix for the current page. Default: `/`. + ## $title Value of the `` label used for the current page. diff --git a/src/client/app/mixin.ts b/src/client/app/mixin.ts index 24841ce8..061c046a 100644 --- a/src/client/app/mixin.ts +++ b/src/client/app/mixin.ts @@ -42,6 +42,25 @@ export function mixinGlobalComputed( } }, + $lang: { + get() { + return siteByRoute.value.lang + } + }, + + $localePath: { + get() { + const { locales } = site.value + const { lang } = siteByRoute.value + + const path = Object.keys(locales).find( + (lp) => locales[lp].lang === lang + ) + + return (locales && path) || '/' + } + }, + $title: { get() { return page.value.title