From 89e95b3f143682ed9a006991bacf45c9dcba4818 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:43:05 +0800 Subject: remove node_modules --- .../lib/default-theme/AlgoliaSearchBox.vue | 156 ------------- .../vuepress/lib/default-theme/DropdownLink.vue | 181 --------------- .../lib/default-theme/DropdownTransition.vue | 33 --- node_modules/vuepress/lib/default-theme/Home.vue | 162 -------------- node_modules/vuepress/lib/default-theme/Layout.vue | 183 --------------- .../vuepress/lib/default-theme/NavLink.vue | 49 ---- .../vuepress/lib/default-theme/NavLinks.vue | 151 ------------- node_modules/vuepress/lib/default-theme/Navbar.vue | 133 ----------- .../vuepress/lib/default-theme/NotFound.vue | 26 --- node_modules/vuepress/lib/default-theme/Page.vue | 246 --------------------- .../vuepress/lib/default-theme/SWUpdatePopup.vue | 85 ------- .../vuepress/lib/default-theme/SearchBox.vue | 238 -------------------- .../vuepress/lib/default-theme/Sidebar.vue | 113 ---------- .../vuepress/lib/default-theme/SidebarButton.vue | 28 --- .../vuepress/lib/default-theme/SidebarGroup.vue | 77 ------- .../vuepress/lib/default-theme/SidebarLink.vue | 91 -------- node_modules/vuepress/lib/default-theme/search.svg | 1 - .../vuepress/lib/default-theme/styles/arrow.styl | 22 -- .../vuepress/lib/default-theme/styles/code.styl | 129 ----------- .../vuepress/lib/default-theme/styles/config.styl | 22 -- .../lib/default-theme/styles/custom-blocks.styl | 28 --- .../vuepress/lib/default-theme/styles/mobile.styl | 37 ---- .../lib/default-theme/styles/nprogress.styl | 48 ---- .../vuepress/lib/default-theme/styles/theme.styl | 190 ---------------- .../vuepress/lib/default-theme/styles/toc.styl | 3 - .../vuepress/lib/default-theme/styles/wrapper.styl | 9 - node_modules/vuepress/lib/default-theme/util.js | 216 ------------------ 27 files changed, 2657 deletions(-) delete mode 100644 node_modules/vuepress/lib/default-theme/AlgoliaSearchBox.vue delete mode 100644 node_modules/vuepress/lib/default-theme/DropdownLink.vue delete mode 100644 node_modules/vuepress/lib/default-theme/DropdownTransition.vue delete mode 100644 node_modules/vuepress/lib/default-theme/Home.vue delete mode 100644 node_modules/vuepress/lib/default-theme/Layout.vue delete mode 100644 node_modules/vuepress/lib/default-theme/NavLink.vue delete mode 100644 node_modules/vuepress/lib/default-theme/NavLinks.vue delete mode 100644 node_modules/vuepress/lib/default-theme/Navbar.vue delete mode 100644 node_modules/vuepress/lib/default-theme/NotFound.vue delete mode 100644 node_modules/vuepress/lib/default-theme/Page.vue delete mode 100644 node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue delete mode 100644 node_modules/vuepress/lib/default-theme/SearchBox.vue delete mode 100644 node_modules/vuepress/lib/default-theme/Sidebar.vue delete mode 100644 node_modules/vuepress/lib/default-theme/SidebarButton.vue delete mode 100644 node_modules/vuepress/lib/default-theme/SidebarGroup.vue delete mode 100644 node_modules/vuepress/lib/default-theme/SidebarLink.vue delete mode 100644 node_modules/vuepress/lib/default-theme/search.svg delete mode 100644 node_modules/vuepress/lib/default-theme/styles/arrow.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/code.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/config.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/custom-blocks.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/mobile.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/nprogress.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/theme.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/toc.styl delete mode 100644 node_modules/vuepress/lib/default-theme/styles/wrapper.styl delete mode 100644 node_modules/vuepress/lib/default-theme/util.js (limited to 'node_modules/vuepress/lib/default-theme') diff --git a/node_modules/vuepress/lib/default-theme/AlgoliaSearchBox.vue b/node_modules/vuepress/lib/default-theme/AlgoliaSearchBox.vue deleted file mode 100644 index 0334ae0b..00000000 --- a/node_modules/vuepress/lib/default-theme/AlgoliaSearchBox.vue +++ /dev/null @@ -1,156 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/DropdownLink.vue b/node_modules/vuepress/lib/default-theme/DropdownLink.vue deleted file mode 100644 index e6000a60..00000000 --- a/node_modules/vuepress/lib/default-theme/DropdownLink.vue +++ /dev/null @@ -1,181 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/DropdownTransition.vue b/node_modules/vuepress/lib/default-theme/DropdownTransition.vue deleted file mode 100644 index 8c711a15..00000000 --- a/node_modules/vuepress/lib/default-theme/DropdownTransition.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/Home.vue b/node_modules/vuepress/lib/default-theme/Home.vue deleted file mode 100644 index a172eb9b..00000000 --- a/node_modules/vuepress/lib/default-theme/Home.vue +++ /dev/null @@ -1,162 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/Layout.vue b/node_modules/vuepress/lib/default-theme/Layout.vue deleted file mode 100644 index ee2e6abe..00000000 --- a/node_modules/vuepress/lib/default-theme/Layout.vue +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - diff --git a/node_modules/vuepress/lib/default-theme/NavLink.vue b/node_modules/vuepress/lib/default-theme/NavLink.vue deleted file mode 100644 index d9fa4886..00000000 --- a/node_modules/vuepress/lib/default-theme/NavLink.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - diff --git a/node_modules/vuepress/lib/default-theme/NavLinks.vue b/node_modules/vuepress/lib/default-theme/NavLinks.vue deleted file mode 100644 index 4037f288..00000000 --- a/node_modules/vuepress/lib/default-theme/NavLinks.vue +++ /dev/null @@ -1,151 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/Navbar.vue b/node_modules/vuepress/lib/default-theme/Navbar.vue deleted file mode 100644 index 12795665..00000000 --- a/node_modules/vuepress/lib/default-theme/Navbar.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/NotFound.vue b/node_modules/vuepress/lib/default-theme/NotFound.vue deleted file mode 100644 index 6aefe797..00000000 --- a/node_modules/vuepress/lib/default-theme/NotFound.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/node_modules/vuepress/lib/default-theme/Page.vue b/node_modules/vuepress/lib/default-theme/Page.vue deleted file mode 100644 index 37d65b41..00000000 --- a/node_modules/vuepress/lib/default-theme/Page.vue +++ /dev/null @@ -1,246 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue b/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue deleted file mode 100644 index b224db31..00000000 --- a/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/SearchBox.vue b/node_modules/vuepress/lib/default-theme/SearchBox.vue deleted file mode 100644 index 98608552..00000000 --- a/node_modules/vuepress/lib/default-theme/SearchBox.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/Sidebar.vue b/node_modules/vuepress/lib/default-theme/Sidebar.vue deleted file mode 100644 index 7bcf0059..00000000 --- a/node_modules/vuepress/lib/default-theme/Sidebar.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/SidebarButton.vue b/node_modules/vuepress/lib/default-theme/SidebarButton.vue deleted file mode 100644 index 0a222434..00000000 --- a/node_modules/vuepress/lib/default-theme/SidebarButton.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/node_modules/vuepress/lib/default-theme/SidebarGroup.vue b/node_modules/vuepress/lib/default-theme/SidebarGroup.vue deleted file mode 100644 index 119dfa14..00000000 --- a/node_modules/vuepress/lib/default-theme/SidebarGroup.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - - diff --git a/node_modules/vuepress/lib/default-theme/SidebarLink.vue b/node_modules/vuepress/lib/default-theme/SidebarLink.vue deleted file mode 100644 index 8288bf96..00000000 --- a/node_modules/vuepress/lib/default-theme/SidebarLink.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - diff --git a/node_modules/vuepress/lib/default-theme/search.svg b/node_modules/vuepress/lib/default-theme/search.svg deleted file mode 100644 index 03d83913..00000000 --- a/node_modules/vuepress/lib/default-theme/search.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/vuepress/lib/default-theme/styles/arrow.styl b/node_modules/vuepress/lib/default-theme/styles/arrow.styl deleted file mode 100644 index 20bffc0d..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/arrow.styl +++ /dev/null @@ -1,22 +0,0 @@ -@require './config' - -.arrow - display inline-block - width 0 - height 0 - &.up - border-left 4px solid transparent - border-right 4px solid transparent - border-bottom 6px solid $arrowBgColor - &.down - border-left 4px solid transparent - border-right 4px solid transparent - border-top 6px solid $arrowBgColor - &.right - border-top 4px solid transparent - border-bottom 4px solid transparent - border-left 6px solid $arrowBgColor - &.left - border-top 4px solid transparent - border-bottom 4px solid transparent - border-right 6px solid $arrowBgColor diff --git a/node_modules/vuepress/lib/default-theme/styles/code.styl b/node_modules/vuepress/lib/default-theme/styles/code.styl deleted file mode 100644 index 8383c6e3..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/code.styl +++ /dev/null @@ -1,129 +0,0 @@ -@require './config' - -.content - code - color lighten($textColor, 20%) - padding 0.25rem 0.5rem - margin 0 - font-size 0.85em - background-color rgba(27,31,35,0.05) - border-radius 3px - -.content - pre, pre[class*="language-"] - line-height 1.4 - padding 1.25rem 1.5rem - margin 0.85rem 0 - background-color $codeBgColor - border-radius 6px - overflow auto - code - color #fff - padding 0 - background-color transparent - border-radius 0 - -div[class*="language-"] - position relative - background-color $codeBgColor - border-radius 6px - .highlight-lines - user-select none - padding-top 1.3rem - position absolute - top 0 - left 0 - width 100% - line-height 1.4 - .highlighted - background-color rgba(0, 0, 0, 66%) - pre, pre[class*="language-"] - background transparent - position relative - z-index 1 - &::before - position absolute - z-index 3 - top 0.8em - right 1em - font-size 0.75rem - color rgba(255, 255, 255, 0.4) - &:not(.line-numbers-mode) - .line-numbers-wrapper - display none - &.line-numbers-mode - .highlight-lines .highlighted - position relative - &:before - content ' ' - position absolute - z-index 3 - left 0 - top 0 - display block - width $lineNumbersWrapperWidth - height 100% - background-color rgba(0, 0, 0, 66%) - pre - padding-left $lineNumbersWrapperWidth + 1 rem - vertical-align middle - .line-numbers-wrapper - position absolute - top 0 - width $lineNumbersWrapperWidth - text-align center - color rgba(255, 255, 255, 0.3) - padding 1.25rem 0 - line-height 1.4 - br - user-select none - .line-number - position relative - z-index 4 - user-select none - font-size 0.85em - &::after - content '' - position absolute - z-index 2 - top 0 - left 0 - width $lineNumbersWrapperWidth - height 100% - border-radius 6px 0 0 6px - border-right 1px solid rgba(0, 0, 0, 66%) - background-color $codeBgColor - - -for lang in $codeLang - div{'[class~="language-' + lang + '"]'} - &:before - content ('' + lang) - -div[class~="language-javascript"] - &:before - content "js" - -div[class~="language-typescript"] - &:before - content "ts" - -div[class~="language-markup"] - &:before - content "html" - -div[class~="language-markdown"] - &:before - content "md" - -div[class~="language-json"]:before - content "json" - -div[class~="language-ruby"]:before - content "rb" - -div[class~="language-python"]:before - content "py" - -div[class~="language-bash"]:before - content "sh" diff --git a/node_modules/vuepress/lib/default-theme/styles/config.styl b/node_modules/vuepress/lib/default-theme/styles/config.styl deleted file mode 100644 index a57d4484..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/config.styl +++ /dev/null @@ -1,22 +0,0 @@ -// colors -$accentColor = #3eaf7c -$textColor = #2c3e50 -$borderColor = #eaecef -$codeBgColor = #282c34 -$arrowBgColor = #ccc - -// layout -$navbarHeight = 3.6rem -$sidebarWidth = 20rem -$contentWidth = 740px - -// responsive breakpoints -$MQNarrow = 959px -$MQMobile = 719px -$MQMobileNarrow = 419px - -// code -$lineNumbersWrapperWidth = 3.5rem -$codeLang = js ts html md vue css sass scss less stylus go java c sh yaml py - -@import '~@temp/override.styl' diff --git a/node_modules/vuepress/lib/default-theme/styles/custom-blocks.styl b/node_modules/vuepress/lib/default-theme/styles/custom-blocks.styl deleted file mode 100644 index 3ccc2df2..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/custom-blocks.styl +++ /dev/null @@ -1,28 +0,0 @@ -.custom-block - .custom-block-title - font-weight 600 - margin-bottom -0.4rem - &.tip, &.warning, &.danger - padding .1rem 1.5rem - border-left-width .5rem - border-left-style solid - margin 1rem 0 - &.tip - background-color #f3f5f7 - border-color #42b983 - &.warning - background-color rgba(255,229,100,.3) - border-color darken(#ffe564, 35%) - color darken(#ffe564, 70%) - .custom-block-title - color darken(#ffe564, 50%) - a - color $textColor - &.danger - background-color #ffe6e6 - border-color darken(red, 20%) - color darken(red, 70%) - .custom-block-title - color darken(red, 40%) - a - color $textColor diff --git a/node_modules/vuepress/lib/default-theme/styles/mobile.styl b/node_modules/vuepress/lib/default-theme/styles/mobile.styl deleted file mode 100644 index b35e59c5..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/mobile.styl +++ /dev/null @@ -1,37 +0,0 @@ -@require './config' - -$mobileSidebarWidth = $sidebarWidth * 0.82 - -// narrow desktop / iPad -@media (max-width: $MQNarrow) - .sidebar - font-size 15px - width $mobileSidebarWidth - .page - padding-left $mobileSidebarWidth - -// wide mobile -@media (max-width: $MQMobile) - .sidebar - top 0 - padding-top $navbarHeight - transform translateX(-100%) - transition transform .2s ease - .page - padding-left 0 - .theme-container - &.sidebar-open - .sidebar - transform translateX(0) - &.no-navbar - .sidebar - padding-top: 0 - -// narrow mobile -@media (max-width: $MQMobileNarrow) - h1 - font-size 1.9rem - .content - div[class*="language-"] - margin 0.85rem -1.5rem - border-radius 0 diff --git a/node_modules/vuepress/lib/default-theme/styles/nprogress.styl b/node_modules/vuepress/lib/default-theme/styles/nprogress.styl deleted file mode 100644 index f186a67e..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/nprogress.styl +++ /dev/null @@ -1,48 +0,0 @@ -#nprogress - pointer-events none - .bar - background $accentColor - position fixed - z-index 1031 - top 0 - left 0 - width 100% - height 2px - .peg - display block - position absolute - right 0px - width 100px - height 100% - box-shadow 0 0 10px $accentColor, 0 0 5px $accentColor - opacity 1.0 - transform rotate(3deg) translate(0px, -4px) - .spinner - display block - position fixed - z-index 1031 - top 15px - right 15px - .spinner-icon - width 18px - height 18px - box-sizing border-box - border solid 2px transparent - border-top-color $accentColor - border-left-color $accentColor - border-radius 50% - animation nprogress-spinner 400ms linear infinite - -.nprogress-custom-parent - overflow hidden - position relative - -.nprogress-custom-parent #nprogress .spinner, -.nprogress-custom-parent #nprogress .bar - position absolute - -@keyframes nprogress-spinner - 0% - transform rotate(0deg) - 100% - transform rotate(360deg) diff --git a/node_modules/vuepress/lib/default-theme/styles/theme.styl b/node_modules/vuepress/lib/default-theme/styles/theme.styl deleted file mode 100644 index a733861f..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/theme.styl +++ /dev/null @@ -1,190 +0,0 @@ -@require './config' -@require './nprogress' -@require './code' -@require './custom-blocks' -@require './arrow' -@require './wrapper' -@require './toc' - -html, body - padding 0 - margin 0 - -body - font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif - -webkit-font-smoothing antialiased - -moz-osx-font-smoothing grayscale - font-size 16px - color $textColor - -.page - padding-left $sidebarWidth - -.navbar - position fixed - z-index 20 - top 0 - left 0 - right 0 - height $navbarHeight - background-color #fff - box-sizing border-box - border-bottom 1px solid $borderColor - -.sidebar-mask - position fixed - z-index 9 - top 0 - left 0 - width 100vw - height 100vh - display none - -.sidebar - font-size 15px - background-color #fff - width $sidebarWidth - position fixed - z-index 10 - margin 0 - top $navbarHeight - left 0 - bottom 0 - box-sizing border-box - border-right 1px solid $borderColor - overflow-y auto - -.content:not(.custom) - @extend $wrapper - > *:first-child - margin-top $navbarHeight - a:hover - text-decoration underline - p.demo - padding 1rem 1.5rem - border 1px solid #ddd - border-radius 4px - img - max-width 100% - -.content.custom - padding 0 - margin 0 - img - max-width 100% - -a - font-weight 500 - color $accentColor - text-decoration none - -p a code - font-weight 400 - color $accentColor - -kbd - background #eee - border solid 0.15rem #ddd - border-bottom solid 0.25rem #ddd - border-radius 0.15rem - padding 0 0.15em - -blockquote - font-size 1.2rem - color #999 - border-left .25rem solid #dfe2e5 - margin-left 0 - padding-left 1rem - -ul, ol - padding-left 1.2em - -strong - font-weight 600 - -h1, h2, h3, h4, h5, h6 - font-weight 600 - line-height 1.25 - .content:not(.custom) > & - margin-top (0.5rem - $navbarHeight) - padding-top ($navbarHeight + 1rem) - margin-bottom 0 - &:first-child - margin-top -1.5rem - margin-bottom 1rem - + p, + pre, + .custom-block - margin-top 2rem - &:hover .header-anchor - opacity: 1 - -h1 - font-size 2.2rem - -h2 - font-size 1.65rem - padding-bottom .3rem - border-bottom 1px solid $borderColor - -h3 - font-size 1.35rem - -a.header-anchor - font-size 0.85em - float left - margin-left -0.87em - padding-right 0.23em - margin-top 0.125em - opacity 0 - &:hover - text-decoration none - -code, kbd, .line-number - font-family source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace - -p, ul, ol - line-height 1.7 - -hr - border 0 - border-top 1px solid $borderColor - -table - border-collapse collapse - margin 1rem 0 - display: block - overflow-x: auto - -tr - border-top 1px solid #dfe2e5 - &:nth-child(2n) - background-color #f6f8fa - -th, td - border 1px solid #dfe2e5 - padding .6em 1em - -.custom-layout - padding-top $navbarHeight - -.theme-container - &.sidebar-open - .sidebar-mask - display: block - &.no-navbar - .content:not(.custom) > h1, h2, h3, h4, h5, h6 - margin-top 1.5rem - padding-top 0 - .sidebar - top 0 - .custom-layout - padding-top 0 - - -@media (min-width: ($MQMobile + 1px)) - .theme-container.no-sidebar - .sidebar - display none - .page - padding-left 0 - -@require './mobile.styl' diff --git a/node_modules/vuepress/lib/default-theme/styles/toc.styl b/node_modules/vuepress/lib/default-theme/styles/toc.styl deleted file mode 100644 index d3e71069..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/toc.styl +++ /dev/null @@ -1,3 +0,0 @@ -.table-of-contents - .badge - vertical-align middle diff --git a/node_modules/vuepress/lib/default-theme/styles/wrapper.styl b/node_modules/vuepress/lib/default-theme/styles/wrapper.styl deleted file mode 100644 index a99262c7..00000000 --- a/node_modules/vuepress/lib/default-theme/styles/wrapper.styl +++ /dev/null @@ -1,9 +0,0 @@ -$wrapper - max-width $contentWidth - margin 0 auto - padding 2rem 2.5rem - @media (max-width: $MQNarrow) - padding 2rem - @media (max-width: $MQMobileNarrow) - padding 1.5rem - diff --git a/node_modules/vuepress/lib/default-theme/util.js b/node_modules/vuepress/lib/default-theme/util.js deleted file mode 100644 index ef95bea5..00000000 --- a/node_modules/vuepress/lib/default-theme/util.js +++ /dev/null @@ -1,216 +0,0 @@ -export const hashRE = /#.*$/ -export const extRE = /\.(md|html)$/ -export const endingSlashRE = /\/$/ -export const outboundRE = /^(https?:|mailto:|tel:)/ - -export function normalize (path) { - return decodeURI(path) - .replace(hashRE, '') - .replace(extRE, '') -} - -export function getHash (path) { - const match = path.match(hashRE) - if (match) { - return match[0] - } -} - -export function isExternal (path) { - return outboundRE.test(path) -} - -export function isMailto (path) { - return /^mailto:/.test(path) -} - -export function isTel (path) { - return /^tel:/.test(path) -} - -export function ensureExt (path) { - if (isExternal(path)) { - return path - } - const hashMatch = path.match(hashRE) - const hash = hashMatch ? hashMatch[0] : '' - const normalized = normalize(path) - - if (endingSlashRE.test(normalized)) { - return path - } - return normalized + '.html' + hash -} - -export function isActive (route, path) { - const routeHash = route.hash - const linkHash = getHash(path) - if (linkHash && routeHash !== linkHash) { - return false - } - const routePath = normalize(route.path) - const pagePath = normalize(path) - return routePath === pagePath -} - -export function resolvePage (pages, rawPath, base) { - if (base) { - rawPath = resolvePath(rawPath, base) - } - const path = normalize(rawPath) - for (let i = 0; i < pages.length; i++) { - if (normalize(pages[i].path) === path) { - return Object.assign({}, pages[i], { - type: 'page', - path: ensureExt(rawPath) - }) - } - } - console.error(`[vuepress] No matching page found for sidebar item "${rawPath}"`) - return {} -} - -function resolvePath (relative, base, append) { - const firstChar = relative.charAt(0) - if (firstChar === '/') { - return relative - } - - if (firstChar === '?' || firstChar === '#') { - return base + relative - } - - const stack = base.split('/') - - // remove trailing segment if: - // - not appending - // - appending to trailing slash (last segment is empty) - if (!append || !stack[stack.length - 1]) { - stack.pop() - } - - // resolve relative path - const segments = relative.replace(/^\//, '').split('/') - for (let i = 0; i < segments.length; i++) { - const segment = segments[i] - if (segment === '..') { - stack.pop() - } else if (segment !== '.') { - stack.push(segment) - } - } - - // ensure leading slash - if (stack[0] !== '') { - stack.unshift('') - } - - return stack.join('/') -} - -export function resolveSidebarItems (page, route, site, localePath) { - const { pages, themeConfig } = site - - const localeConfig = localePath && themeConfig.locales - ? themeConfig.locales[localePath] || themeConfig - : themeConfig - - const pageSidebarConfig = page.frontmatter.sidebar || localeConfig.sidebar || themeConfig.sidebar - if (pageSidebarConfig === 'auto') { - return resolveHeaders(page) - } - - const sidebarConfig = localeConfig.sidebar || themeConfig.sidebar - if (!sidebarConfig) { - return [] - } else { - const { base, config } = resolveMatchingConfig(route, sidebarConfig) - return config - ? config.map(item => resolveItem(item, pages, base)) - : [] - } -} - -function resolveHeaders (page) { - const headers = groupHeaders(page.headers || []) - return [{ - type: 'group', - collapsable: false, - title: page.title, - children: headers.map(h => ({ - type: 'auto', - title: h.title, - basePath: page.path, - path: page.path + '#' + h.slug, - children: h.children || [] - })) - }] -} - -export function groupHeaders (headers) { - // group h3s under h2 - headers = headers.map(h => Object.assign({}, h)) - let lastH2 - headers.forEach(h => { - if (h.level === 2) { - lastH2 = h - } else if (lastH2) { - (lastH2.children || (lastH2.children = [])).push(h) - } - }) - return headers.filter(h => h.level === 2) -} - -export function resolveNavLinkItem (linkItem) { - return Object.assign(linkItem, { - type: linkItem.items && linkItem.items.length ? 'links' : 'link' - }) -} - -export function resolveMatchingConfig (route, config) { - if (Array.isArray(config)) { - return { - base: '/', - config: config - } - } - for (const base in config) { - if (ensureEndingSlash(route.path).indexOf(base) === 0) { - return { - base, - config: config[base] - } - } - } - return {} -} - -function ensureEndingSlash (path) { - return /(\.html|\/)$/.test(path) - ? path - : path + '/' -} - -function resolveItem (item, pages, base, isNested) { - if (typeof item === 'string') { - return resolvePage(pages, item, base) - } else if (Array.isArray(item)) { - return Object.assign(resolvePage(pages, item[0], base), { - title: item[1] - }) - } else { - if (isNested) { - console.error( - '[vuepress] Nested sidebar groups are not supported. ' + - 'Consider using navbar + categories instead.' - ) - } - const children = item.children || [] - return { - type: 'group', - title: item.title, - children: children.map(child => resolveItem(child, pages, base, true)), - collapsable: item.collapsable !== false - } - } -} -- cgit v1.2.3