diff --git a/CHANGELOG.md b/CHANGELOG.md index 6468b70aee..ebc8c17319 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ + +# [1.0.0-alpha.48](https://github.com/vuejs/vuepress/compare/v1.0.0-alpha.47...v1.0.0-alpha.48) (2019-05-14) + + +### Bug Fixes + +* **$core:** Failed to load theme when using `layouts/Layout.vue` as entry file (close: [#1563](https://github.com/vuejs/vuepress/issues/1563)) ([#1564](https://github.com/vuejs/vuepress/issues/1564)) ([057d8bf](https://github.com/vuejs/vuepress/commit/057d8bf)) +* **$core:** Search result cannot jump to the correct hash anchor (close: [#1594](https://github.com/vuejs/vuepress/issues/1594)) ([#1599](https://github.com/vuejs/vuepress/issues/1599)) ([e6af68f](https://github.com/vuejs/vuepress/commit/e6af68f)) +* **$core:** Use directory name to compute slug if filename is readme or index (close: [#1443](https://github.com/vuejs/vuepress/issues/1443)) ([#1535](https://github.com/vuejs/vuepress/issues/1535)) ([9efc678](https://github.com/vuejs/vuepress/commit/9efc678)) +* **$core:** webpack externals (ref: [#451](https://github.com/vuejs/vuepress/issues/451)) ([fb324d5](https://github.com/vuejs/vuepress/commit/fb324d5)) + + +### Features + +* **$core:** Infer page's date via directory name ([#1553](https://github.com/vuejs/vuepress/issues/1553)) ([2c930c9](https://github.com/vuejs/vuepress/commit/2c930c9)) +* **$core:** `info` command ([#1573](https://github.com/vuejs/vuepress/issues/1573)) ([3eeb080](https://github.com/vuejs/vuepress/commit/3eeb080)) +* **$core:** Prevent duplicate route ([#1525](https://github.com/vuejs/vuepress/issues/1525)) ([441f023](https://github.com/vuejs/vuepress/commit/441f023)) +* **$theme-default:** Support external links in sidebar (close: [#764](https://github.com/vuejs/vuepress/issues/764))([#1534](https://github.com/vuejs/vuepress/issues/1534)) ([141bd11](https://github.com/vuejs/vuepress/commit/141bd11)) + + + # [1.0.0-alpha.47](https://github.com/vuejs/vuepress/compare/v1.0.0-alpha.46...v1.0.0-alpha.47) (2019-04-06) diff --git a/lerna.json b/lerna.json index 4fd2a88976..1fa0496e23 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "lerna": "2.5.1", "npmClient": "yarn", "useWorkspaces": true, - "version": "1.0.0-alpha.48" + "version": "1.0.0-alpha.49" } diff --git a/package.json b/package.json index eaf3689196..66ece12c6f 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "eslint": "^4.19.1", "eslint-plugin-jest": "^21.15.1", "eslint-plugin-vue-libs": "^3.0.0", - "lerna": "^3.6.0", + "lerna": "^3.14.1", "lint-staged": "^8.1.5", "minimist": "^1.2.0", "yorkie": "^2.0.0", diff --git a/packages/@vuepress/core/lib/client/clientEntry.js b/packages/@vuepress/core/lib/client/clientEntry.js index b7f795f613..7a8e568f5d 100644 --- a/packages/@vuepress/core/lib/client/clientEntry.js +++ b/packages/@vuepress/core/lib/client/clientEntry.js @@ -4,7 +4,7 @@ import { createApp } from './app' const { app, router } = createApp(false /* isServer */) -window.__VUEPRESS_VERSION__ = { +window.__VUEPRESS__ = { version: VUEPRESS_VERSION, hash: LAST_COMMIT_HASH } diff --git a/packages/@vuepress/core/lib/client/components/Content.js b/packages/@vuepress/core/lib/client/components/Content.js index 126dba6fb2..cc06182820 100644 --- a/packages/@vuepress/core/lib/client/components/Content.js +++ b/packages/@vuepress/core/lib/client/components/Content.js @@ -1,3 +1,4 @@ +import { setGlobalInfo } from '@app/util' export default { props: { @@ -9,6 +10,8 @@ export default { }, render (h) { const pageKey = this.pageKey || this.$parent.$page.key + setGlobalInfo('pageKey', pageKey) + if (pageKey) { return h(pageKey) } diff --git a/packages/@vuepress/core/lib/client/components/ContentSlotsDistributor.js b/packages/@vuepress/core/lib/client/components/ContentSlotsDistributor.js index 4de753a566..857b3e41de 100644 --- a/packages/@vuepress/core/lib/client/components/ContentSlotsDistributor.js +++ b/packages/@vuepress/core/lib/client/components/ContentSlotsDistributor.js @@ -8,8 +8,7 @@ export default { return h('div', { class: [ - 'content', - props.slotKey + `content__${props.slotKey}` ] }, slots()[props.slotKey] diff --git a/packages/@vuepress/core/lib/client/components/GlobalLayout.vue b/packages/@vuepress/core/lib/client/components/GlobalLayout.vue index 077c65a59b..72f28a76f1 100644 --- a/packages/@vuepress/core/lib/client/components/GlobalLayout.vue +++ b/packages/@vuepress/core/lib/client/components/GlobalLayout.vue @@ -3,9 +3,11 @@ diff --git a/packages/@vuepress/core/lib/client/util.js b/packages/@vuepress/core/lib/client/util.js index 02b85feefe..65b814d783 100644 --- a/packages/@vuepress/core/lib/client/util.js +++ b/packages/@vuepress/core/lib/client/util.js @@ -182,3 +182,16 @@ export function normalizeConfig (component, rawConfig) { } return rawConfig } + +/** + * Set global info in `window.__VUEPRESS__` for debugging. + * + * @param {string}key + * @param {any} value + */ +export function setGlobalInfo (key, value) { + if (!window.__VUEPRESS__ || typeof window === 'undefined') { + return + } + window.__VUEPRESS__[key] = value +} diff --git a/packages/@vuepress/core/lib/node/loadTheme.js b/packages/@vuepress/core/lib/node/loadTheme.js index 11d9d295a5..f85a5b1d20 100755 --- a/packages/@vuepress/core/lib/node/loadTheme.js +++ b/packages/@vuepress/core/lib/node/loadTheme.js @@ -32,11 +32,15 @@ const ThemeAPI = require('./theme-api') module.exports = function loadTheme (ctx) { const themeResolver = getThemeResolver() - const theme = resolveTheme(ctx, themeResolver) + if (!theme.path) { - throw new Error(`[vuepress] You must specify a theme, or create a local custom theme. \n For more details, refer to https://vuepress.vuejs.org/guide/custom-themes.html#custom-themes. \n`) + throw new Error( + '[vuepress] You must specify a theme, or create a local custom theme. \n' + + 'For more details, refer to https://vuepress.vuejs.org/guide/custom-themes.html#custom-themes. \n' + ) } + let applyTip = `Apply theme ${chalk.magenta(theme.name)}` theme.entry.name = '@vuepress/internal-theme-entry-file' @@ -46,6 +50,7 @@ module.exports = function loadTheme (ctx) { parentTheme.entry.name = '@vuepress/internal-parent-theme-entry-file' applyTip += chalk.gray(` (extends ${chalk.magenta(parentTheme.name)})`) } + logger.tip(applyTip + ' ...') logger.debug('theme', theme.name, theme.path) @@ -54,9 +59,9 @@ module.exports = function loadTheme (ctx) { } function normalizeThemePath (resolved) { - const { entry, name, fromDep } = resolved + const { entry, fromDep } = resolved if (fromDep) { - return parse(require.resolve(name)).dir + return parse(require.resolve(entry)).dir } else if (entry.endsWith('.js') || entry.endsWith('.vue')) { return parse(entry).dir } else { @@ -74,7 +79,9 @@ function resolveTheme (ctx, resolver, ignoreLocal, theme) { let shortcut let entry = {} - // 1. From local + /** + * 1. From `.vuepress/theme` directory. + */ if (!ignoreLocal && !fs.existsSync(theme) && fs.existsSync(localThemePath) @@ -84,15 +91,31 @@ function resolveTheme (ctx, resolver, ignoreLocal, theme) { name = shortcut = 'local' logger.tip(`Apply local theme at ${chalk.gray(path)}...`) - // 2. From dep + /** + * 2. From deps or custom local path. + * - vuepress-plugin-foo + * - /path/to/a-theme/index.js + */ } else if (isString(theme)) { + /** + * To let theme resolver get the correct theme name. + */ + if (theme.endsWith('/index.js')) { + theme = theme.replace(/\/index\.js$/, '') + } + const resolved = resolver.resolve(theme, sourceDir) if (resolved.entry === null) { throw new Error(`Cannot resolve theme: ${theme}.`) } + path = normalizeThemePath(resolved) name = resolved.name shortcut = resolved.shortcut + + /** + * 3. fallback + */ } else { return {} } diff --git a/packages/@vuepress/core/package.json b/packages/@vuepress/core/package.json index e7a45d31f2..d4939d3208 100644 --- a/packages/@vuepress/core/package.json +++ b/packages/@vuepress/core/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/core", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "Minimalistic doc generator with Vue component based layout system", "main": "lib/index.js", "repository": { @@ -63,7 +63,7 @@ "vuepress-plugin-container": "^2.0.0", "webpack": "^4.8.1", "webpack-chain": "^4.6.0", - "webpack-dev-server": "^3.1.14", + "webpack-dev-server": "^3.5.1", "webpack-merge": "^4.1.2", "webpackbar": "3.2.0" }, diff --git a/packages/@vuepress/markdown-loader/package.json b/packages/@vuepress/markdown-loader/package.json index 505f26638b..c496786072 100644 --- a/packages/@vuepress/markdown-loader/package.json +++ b/packages/@vuepress/markdown-loader/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/markdown-loader", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "markdown-loader for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/markdown/package.json b/packages/@vuepress/markdown/package.json index 35a3d09b9c..54569eb97c 100644 --- a/packages/@vuepress/markdown/package.json +++ b/packages/@vuepress/markdown/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/markdown", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "markdown for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-active-header-links/package.json b/packages/@vuepress/plugin-active-header-links/package.json index eea1b86372..460aa351c0 100644 --- a/packages/@vuepress/plugin-active-header-links/package.json +++ b/packages/@vuepress/plugin-active-header-links/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-active-header-links", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "active-header-links plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-back-to-top/package.json b/packages/@vuepress/plugin-back-to-top/package.json index bf16aab22e..53e486c720 100644 --- a/packages/@vuepress/plugin-back-to-top/package.json +++ b/packages/@vuepress/plugin-back-to-top/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-back-to-top", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "back-to-top plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-blog/package.json b/packages/@vuepress/plugin-blog/package.json index bf437adabf..dcc85a751e 100644 --- a/packages/@vuepress/plugin-blog/package.json +++ b/packages/@vuepress/plugin-blog/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-blog", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "blog plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-google-analytics/package.json b/packages/@vuepress/plugin-google-analytics/package.json index 485c0ff53a..c5e6210b4c 100644 --- a/packages/@vuepress/plugin-google-analytics/package.json +++ b/packages/@vuepress/plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-google-analytics", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "google-analytics plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-last-updated/package.json b/packages/@vuepress/plugin-last-updated/package.json index 27fb768dee..e739d75e5f 100644 --- a/packages/@vuepress/plugin-last-updated/package.json +++ b/packages/@vuepress/plugin-last-updated/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-last-updated", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "last-updated plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-medium-zoom/package.json b/packages/@vuepress/plugin-medium-zoom/package.json index 71f434486a..e860e7a8e2 100644 --- a/packages/@vuepress/plugin-medium-zoom/package.json +++ b/packages/@vuepress/plugin-medium-zoom/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-medium-zoom", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "medium-zoom plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-nprogress/package.json b/packages/@vuepress/plugin-nprogress/package.json index db6688459a..2595b58c7a 100644 --- a/packages/@vuepress/plugin-nprogress/package.json +++ b/packages/@vuepress/plugin-nprogress/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-nprogress", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "nprogress plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-pagination/package.json b/packages/@vuepress/plugin-pagination/package.json index 2bf54364b0..fc7c2d6091 100644 --- a/packages/@vuepress/plugin-pagination/package.json +++ b/packages/@vuepress/plugin-pagination/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-pagination", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "pagination plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/plugin-pwa/package.json b/packages/@vuepress/plugin-pwa/package.json index c35f701a19..77abeaa61c 100644 --- a/packages/@vuepress/plugin-pwa/package.json +++ b/packages/@vuepress/plugin-pwa/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-pwa", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "pwa plugin for vuepress", "main": "index.js", "publishConfig": { @@ -18,7 +18,7 @@ "generator" ], "dependencies": { - "@vuepress/shared-utils": "^1.0.0-alpha.48", + "@vuepress/shared-utils": "^1.0.0-alpha.49", "register-service-worker": "^1.5.2", "workbox-build": "^3.1.0" }, diff --git a/packages/@vuepress/plugin-register-components/package.json b/packages/@vuepress/plugin-register-components/package.json index 83c28afdfd..a3453623e5 100644 --- a/packages/@vuepress/plugin-register-components/package.json +++ b/packages/@vuepress/plugin-register-components/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-register-components", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "register-global-components plugin for vuepress", "main": "index.js", "publishConfig": { @@ -24,6 +24,6 @@ }, "homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/plugin-register-components#readme", "dependencies": { - "@vuepress/shared-utils": "^1.0.0-alpha.48" + "@vuepress/shared-utils": "^1.0.0-alpha.49" } } diff --git a/packages/@vuepress/plugin-search/package.json b/packages/@vuepress/plugin-search/package.json index 97bab8888c..3259f05898 100644 --- a/packages/@vuepress/plugin-search/package.json +++ b/packages/@vuepress/plugin-search/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/plugin-search", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "search plugin for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/shared-utils/package.json b/packages/@vuepress/shared-utils/package.json index b990589ca2..3b89c91c87 100644 --- a/packages/@vuepress/shared-utils/package.json +++ b/packages/@vuepress/shared-utils/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/shared-utils", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "shared-utils for vuepress", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@vuepress/test-utils/package.json b/packages/@vuepress/test-utils/package.json index d4ff35795a..16e65e5f38 100644 --- a/packages/@vuepress/test-utils/package.json +++ b/packages/@vuepress/test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@vuepress/test-utils", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "test-utils for vuepress", "main": "index.js", "publishConfig": { diff --git a/packages/@vuepress/theme-blog/package.json b/packages/@vuepress/theme-blog/package.json index 76b119e72e..392ff35691 100644 --- a/packages/@vuepress/theme-blog/package.json +++ b/packages/@vuepress/theme-blog/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@vuepress/theme-blog", - "version": "1.0.0-alpha.48", + "version": "1.0.0-alpha.49", "description": "theme-blog for vuepress", "main": "index.js", "publishConfig": { @@ -19,10 +19,10 @@ "generator" ], "dependencies": { - "@vuepress/plugin-blog": "^1.0.0-alpha.48", - "@vuepress/plugin-medium-zoom": "^1.0.0-alpha.48", - "@vuepress/plugin-pagination": "^1.0.0-alpha.48", - "@vuepress/plugin-search": "^1.0.0-alpha.48" + "@vuepress/plugin-blog": "^1.0.0-alpha.49", + "@vuepress/plugin-medium-zoom": "^1.0.0-alpha.49", + "@vuepress/plugin-pagination": "^1.0.0-alpha.49", + "@vuepress/plugin-search": "^1.0.0-alpha.49" }, "author": "ULIVZ ", "license": "MIT", diff --git a/packages/@vuepress/theme-default/components/Home.vue b/packages/@vuepress/theme-default/components/Home.vue index 518595003a..926428a5c8 100644 --- a/packages/@vuepress/theme-default/components/Home.vue +++ b/packages/@vuepress/theme-default/components/Home.vue @@ -38,7 +38,7 @@ - +