diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/vuepress/lib/app | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/vuepress/lib/app')
22 files changed, 1393 insertions, 0 deletions
diff --git a/node_modules/vuepress/lib/app/.temp/enhanceApp.js b/node_modules/vuepress/lib/app/.temp/enhanceApp.js new file mode 100644 index 00000000..16a79b36 --- /dev/null +++ b/node_modules/vuepress/lib/app/.temp/enhanceApp.js @@ -0,0 +1 @@ +export { default } from "/Users/ruki/projects/personal/xmake-docs/src/.vuepress/enhanceApp.js"
\ No newline at end of file diff --git a/node_modules/vuepress/lib/app/.temp/override.styl b/node_modules/vuepress/lib/app/.temp/override.styl new file mode 100644 index 00000000..c7969f18 --- /dev/null +++ b/node_modules/vuepress/lib/app/.temp/override.styl @@ -0,0 +1 @@ +@import("/Users/ruki/projects/personal/xmake-docs/src/.vuepress/override.styl")
\ No newline at end of file diff --git a/node_modules/vuepress/lib/app/.temp/routes.js b/node_modules/vuepress/lib/app/.temp/routes.js new file mode 100644 index 00000000..625e7fb6 --- /dev/null +++ b/node_modules/vuepress/lib/app/.temp/routes.js @@ -0,0 +1,178 @@ +import Vue from 'vue' + +import ThemeLayout from '@themeLayout' +import ThemeNotFound from '@themeNotFound' +import { injectMixins } from '@app/util' +import rootMixins from '@app/root-mixins' + +injectMixins(ThemeLayout, rootMixins) +injectMixins(ThemeNotFound, rootMixins) + +export const routes = [ + { + name: "v-ddf4be195b958", + path: "/", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/README.md").then(comp => { + Vue.component("v-ddf4be195b958", comp.default) + next() + }) + } + }, + { + path: "/index.html", + redirect: "/" + }, + { + name: "v-8644851cf91dd", + path: "/api/introduction.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/api/introduction.md").then(comp => { + Vue.component("v-8644851cf91dd", comp.default) + next() + }) + } + }, + { + name: "v-b6ee77db64501", + path: "/guide/faq.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/guide/faq.md").then(comp => { + Vue.component("v-b6ee77db64501", comp.default) + next() + }) + } + }, + { + name: "v-fcba2a8896d43", + path: "/guide/getting-started.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/guide/getting-started.md").then(comp => { + Vue.component("v-fcba2a8896d43", comp.default) + next() + }) + } + }, + { + name: "v-cda17500cdb0c", + path: "/guide/introduction.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/guide/introduction.md").then(comp => { + Vue.component("v-cda17500cdb0c", comp.default) + next() + }) + } + }, + { + name: "v-745d22bfe3ef4", + path: "/guide/sponsors.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/guide/sponsors.md").then(comp => { + Vue.component("v-745d22bfe3ef4", comp.default) + next() + }) + } + }, + { + name: "v-360e42fea8e33", + path: "/plugin/introduction.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/plugin/introduction.md").then(comp => { + Vue.component("v-360e42fea8e33", comp.default) + next() + }) + } + }, + { + name: "v-1856b116362c7", + path: "/zh/", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/README.md").then(comp => { + Vue.component("v-1856b116362c7", comp.default) + next() + }) + } + }, + { + path: "/zh/index.html", + redirect: "/zh/" + }, + { + name: "v-6812df0250aa3", + path: "/zh/api/introduction.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/api/introduction.md").then(comp => { + Vue.component("v-6812df0250aa3", comp.default) + next() + }) + } + }, + { + name: "v-d3636509f8935", + path: "/zh/guide/faq.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/guide/faq.md").then(comp => { + Vue.component("v-d3636509f8935", comp.default) + next() + }) + } + }, + { + name: "v-53a48e3593d7c", + path: "/zh/guide/getting-started.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/guide/getting-started.md").then(comp => { + Vue.component("v-53a48e3593d7c", comp.default) + next() + }) + } + }, + { + name: "v-cd45bc6f8fdb", + path: "/zh/guide/introduction.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/guide/introduction.md").then(comp => { + Vue.component("v-cd45bc6f8fdb", comp.default) + next() + }) + } + }, + { + name: "v-bef402580c1cc", + path: "/zh/guide/sponsors.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/guide/sponsors.md").then(comp => { + Vue.component("v-bef402580c1cc", comp.default) + next() + }) + } + }, + { + name: "v-faf113f1b77ae", + path: "/zh/plugin/introduction.html", + component: ThemeLayout, + beforeEnter: (to, from, next) => { + import("/Users/ruki/projects/personal/xmake-docs/src/zh/plugin/introduction.md").then(comp => { + Vue.component("v-faf113f1b77ae", comp.default) + next() + }) + } + }, + { + path: '*', + component: ThemeNotFound + } +]
\ No newline at end of file diff --git a/node_modules/vuepress/lib/app/.temp/siteData.js b/node_modules/vuepress/lib/app/.temp/siteData.js new file mode 100644 index 00000000..9af62f7a --- /dev/null +++ b/node_modules/vuepress/lib/app/.temp/siteData.js @@ -0,0 +1,634 @@ +export const siteData = { + "title": "", + "description": "", + "base": "/", + "pages": [ + { + "key": "v-ddf4be195b958", + "path": "/", + "lastUpdated": null, + "title": "Home", + "headers": [ + { + "level": 2, + "title": "Simple description", + "slug": "simple-description" + }, + { + "level": 2, + "title": "Package dependences", + "slug": "package-dependences" + }, + { + "level": 2, + "title": "Build project", + "slug": "build-project" + }, + { + "level": 2, + "title": "Run target", + "slug": "run-target" + }, + { + "level": 2, + "title": "Debug target", + "slug": "debug-target" + }, + { + "level": 2, + "title": "Configure platform", + "slug": "configure-platform" + }, + { + "level": 2, + "title": "Menu configuration", + "slug": "menu-configuration" + }, + { + "level": 2, + "title": "Package management", + "slug": "package-management" + }, + { + "level": 2, + "title": "Supported platforms", + "slug": "supported-platforms" + }, + { + "level": 2, + "title": "Supported Languages", + "slug": "supported-languages" + }, + { + "level": 2, + "title": "Supported Projects", + "slug": "supported-projects" + }, + { + "level": 2, + "title": "Builtin Plugins", + "slug": "builtin-plugins" + }, + { + "level": 2, + "title": "More Plugins", + "slug": "more-plugins" + }, + { + "level": 2, + "title": "IDE/Editor Integration", + "slug": "ide-editor-integration" + }, + { + "level": 2, + "title": "More Examples", + "slug": "more-examples" + }, + { + "level": 2, + "title": "Project Examples", + "slug": "project-examples" + }, + { + "level": 2, + "title": "Example Video", + "slug": "example-video" + }, + { + "level": 2, + "title": "Contacts", + "slug": "contacts" + } + ], + "frontmatter": { + "home": true, + "heroImage": "/hero.png", + "actionText": "Get Started →", + "actionLink": "/guide/getting-started", + "features": [ + { + "title": "Why", + "details": "Making development and building easier, so that any developer can quickly pick it up and enjoy the productivity boost when developing and building project." + }, + { + "title": "Powerful", + "details": "Provides lots of features (e.g. package, install, plugin, macro, action, option, task and etc)." + }, + { + "title": "Cross-platform", + "details": "Supports windows, macOS, linux, android, ios." + } + ], + "footer": "Apache-2.0 Licensed | Copyright © 2015-present tboox.org" + } + }, + { + "key": "v-8644851cf91dd", + "path": "/api/introduction.html", + "lastUpdated": null, + "title": "Title1", + "headers": [ + { + "level": 2, + "title": "Title2", + "slug": "title2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-2" + }, + { + "level": 2, + "title": "Title2", + "slug": "title2-2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-3" + } + ] + }, + { + "key": "v-b6ee77db64501", + "path": "/guide/faq.html", + "lastUpdated": null, + "title": "FAQ", + "headers": [ + { + "level": 2, + "title": "How to get verbose command-line arguments info?", + "slug": "how-to-get-verbose-command-line-arguments-info" + }, + { + "level": 2, + "title": "How to suppress all output info?", + "slug": "how-to-suppress-all-output-info" + }, + { + "level": 2, + "title": "How to do if xmake fails?", + "slug": "how-to-do-if-xmake-fails" + }, + { + "level": 2, + "title": "How to see verbose compiling warnings?", + "slug": "how-to-see-verbose-compiling-warnings" + }, + { + "level": 2, + "title": "How to scan source code and generate xmake.lua automaticlly", + "slug": "how-to-scan-source-code-and-generate-xmake-lua-automaticlly" + } + ] + }, + { + "key": "v-fcba2a8896d43", + "path": "/guide/getting-started.html", + "lastUpdated": null, + "title": "Getting Started", + "headers": [ + { + "level": 2, + "title": "Installation", + "slug": "installation" + }, + { + "level": 2, + "title": "Quick Start", + "slug": "quick-start" + }, + { + "level": 2, + "title": "Project Examples", + "slug": "project-examples" + }, + { + "level": 2, + "title": "Configuration", + "slug": "configuration" + }, + { + "level": 2, + "title": "Dependency Package Management", + "slug": "dependency-package-management" + } + ] + }, + { + "key": "v-cda17500cdb0c", + "path": "/guide/introduction.html", + "lastUpdated": null, + "title": "Introduction", + "headers": [ + { + "level": 2, + "title": "Introduction", + "slug": "introduction" + } + ] + }, + { + "key": "v-745d22bfe3ef4", + "path": "/guide/sponsors.html", + "lastUpdated": null, + "title": "Sponsors" + }, + { + "key": "v-360e42fea8e33", + "path": "/plugin/introduction.html", + "lastUpdated": null, + "title": "Title1", + "headers": [ + { + "level": 2, + "title": "Title2", + "slug": "title2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-2" + }, + { + "level": 2, + "title": "Title2", + "slug": "title2-2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-3" + } + ] + }, + { + "key": "v-1856b116362c7", + "path": "/zh/", + "lastUpdated": null, + "title": "Home", + "headers": [ + { + "level": 2, + "title": "简单的工程描述", + "slug": "简单的工程描述" + }, + { + "level": 2, + "title": "包依赖描述", + "slug": "包依赖描述" + }, + { + "level": 2, + "title": "构建工程", + "slug": "构建工程" + }, + { + "level": 2, + "title": "运行目标", + "slug": "运行目标" + }, + { + "level": 2, + "title": "调试程序", + "slug": "调试程序" + }, + { + "level": 2, + "title": "配置平台", + "slug": "配置平台" + }, + { + "level": 2, + "title": "图形化菜单配置", + "slug": "图形化菜单配置" + }, + { + "level": 2, + "title": "包依赖管理", + "slug": "包依赖管理" + }, + { + "level": 2, + "title": "支持平台", + "slug": "支持平台" + }, + { + "level": 2, + "title": "支持语言", + "slug": "支持语言" + }, + { + "level": 2, + "title": "工程类型", + "slug": "工程类型" + }, + { + "level": 2, + "title": "内置插件", + "slug": "内置插件" + }, + { + "level": 2, + "title": "更多插件", + "slug": "更多插件" + }, + { + "level": 2, + "title": "IDE和编辑器插件", + "slug": "ide和编辑器插件" + }, + { + "level": 2, + "title": "更多例子", + "slug": "更多例子" + }, + { + "level": 2, + "title": "项目例子", + "slug": "项目例子" + }, + { + "level": 2, + "title": "演示视频", + "slug": "演示视频" + }, + { + "level": 2, + "title": "联系方式", + "slug": "联系方式" + } + ], + "frontmatter": { + "home": true, + "heroImage": "/hero.png", + "actionText": "快速上手 →", + "actionLink": "/zh/guide/getting-started", + "features": [ + { + "title": "为什么使用", + "details": "让开发者更加关注于项目本身开发,简化项目的描述和构建,并且提供平台无关性,使得一次编写,随处构建" + }, + { + "title": "强大", + "details": "提供大量的实用特性(例如:插件扩展、脚本宏记录、批量打包、自动文档生成等常用插件)" + }, + { + "title": "跨平台", + "details": "支持windows, macOS, linux, android, ios" + } + ], + "footer": "Apache-2.0 Licensed | Copyright © 2015-present tboox.org" + } + }, + { + "key": "v-6812df0250aa3", + "path": "/zh/api/introduction.html", + "lastUpdated": null, + "title": "Title1", + "headers": [ + { + "level": 2, + "title": "Title2", + "slug": "title2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-2" + }, + { + "level": 2, + "title": "Title2", + "slug": "title2-2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-3" + } + ] + }, + { + "key": "v-d3636509f8935", + "path": "/zh/guide/faq.html", + "lastUpdated": null + }, + { + "key": "v-53a48e3593d7c", + "path": "/zh/guide/getting-started.html", + "lastUpdated": null, + "title": "快速开始", + "headers": [ + { + "level": 2, + "title": "编译", + "slug": "编译" + }, + { + "level": 2, + "title": "例子", + "slug": "例子" + } + ] + }, + { + "key": "v-cd45bc6f8fdb", + "path": "/zh/guide/introduction.html", + "lastUpdated": null, + "title": "简介", + "headers": [ + { + "level": 2, + "title": "特性", + "slug": "特性" + }, + { + "level": 2, + "title": "项目例子", + "slug": "项目例子" + }, + { + "level": 2, + "title": "联系方式", + "slug": "联系方式" + } + ] + }, + { + "key": "v-bef402580c1cc", + "path": "/zh/guide/sponsors.html", + "lastUpdated": null + }, + { + "key": "v-faf113f1b77ae", + "path": "/zh/plugin/introduction.html", + "lastUpdated": null, + "title": "Title1", + "headers": [ + { + "level": 2, + "title": "Title2", + "slug": "title2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-2" + }, + { + "level": 2, + "title": "Title2", + "slug": "title2-2" + }, + { + "level": 3, + "title": "Title3", + "slug": "title3-3" + } + ] + } + ], + "themeConfig": { + "repo": "tboox/xmake", + "docsRepo": "tboox/xmake-docs", + "docsDir": "src", + "editLinks": true, + "sidebarDepth": 2, + "locales": { + "/": { + "label": "English", + "selectText": "Languages", + "editLinkText": "Edit this page on GitHub", + "lastUpdated": "Last Updated", + "nav": [ + { + "text": "Guide", + "link": "/guide/introduction" + }, + { + "text": "Plugin", + "link": "/plugin/introduction" + }, + { + "text": "API", + "link": "/api/introduction" + }, + { + "text": "Articles", + "link": "http://www.tboox.org/category/#xmake" + }, + { + "text": "Feedback", + "link": "https://github.com/tboox/xmake/issues" + }, + { + "text": "Community", + "link": "https://www.reddit.com/r/tboox/" + }, + { + "text": "Donation", + "link": "http://tboox.org/cn/donation/" + } + ], + "sidebar": { + "/guide/": [ + "introduction", + "getting-started", + "faq", + "sponsors" + ], + "/plugin/": [ + "introduction" + ], + "/api/": [ + "introduction" + ] + } + }, + "/zh/": { + "label": "简体中文", + "selectText": "选择语言", + "editLinkText": "在 GitHub 上编辑此页", + "lastUpdated": "上次更新", + "nav": [ + { + "text": "指南", + "link": "/zh/guide/introduction" + }, + { + "text": "插件", + "link": "/zh/plugin/introduction" + }, + { + "text": "接口", + "link": "/zh/api/introduction" + }, + { + "text": "文章", + "link": "http://www.tboox.org/cn/category/#xmake" + }, + { + "text": "反馈", + "link": "https://github.com/tboox/xmake/issues" + }, + { + "text": "社区", + "link": "https://www.reddit.com/r/tboox/" + }, + { + "text": "捐助", + "link": "http://tboox.org/cn/donation/" + } + ], + "sidebar": { + "/zh/guide/": [ + "introduction", + "getting-started", + "faq", + "sponsors" + ], + "/zh/plugin/": [ + "introduction" + ], + "/zh/api/": [ + "introduction" + ] + } + } + } + }, + "locales": { + "/": { + "lang": "en-US", + "title": "xmake", + "description": "A cross-platform build utility based on Lua" + }, + "/zh/": { + "lang": "zh-CN", + "title": "xmake", + "description": "一个基于Lua的轻量级跨平台自动构建工具" + } + } +}
\ No newline at end of file diff --git a/node_modules/vuepress/lib/app/.temp/style.styl b/node_modules/vuepress/lib/app/.temp/style.styl new file mode 100644 index 00000000..b3deab99 --- /dev/null +++ b/node_modules/vuepress/lib/app/.temp/style.styl @@ -0,0 +1 @@ +@import("/Users/ruki/projects/personal/xmake-docs/src/.vuepress/style.styl")
\ No newline at end of file diff --git a/node_modules/vuepress/lib/app/.temp/themeEnhanceApp.js b/node_modules/vuepress/lib/app/.temp/themeEnhanceApp.js new file mode 100644 index 00000000..03c095d5 --- /dev/null +++ b/node_modules/vuepress/lib/app/.temp/themeEnhanceApp.js @@ -0,0 +1 @@ +export default function () {}
\ No newline at end of file diff --git a/node_modules/vuepress/lib/app/SWUpdateEvent.js b/node_modules/vuepress/lib/app/SWUpdateEvent.js new file mode 100644 index 00000000..fe6ab31c --- /dev/null +++ b/node_modules/vuepress/lib/app/SWUpdateEvent.js @@ -0,0 +1,43 @@ +export default class SWUpdateEvent { + constructor (registration) { + Object.defineProperty(this, 'registration', { + value: registration, + configurable: true, + writable: true + }) + } + + /** + * Check if the new service worker exists or not. + */ + update () { + return this.registration.update() + } + + /** + * Activate new service worker to work 'location.reload()' with new data. + */ + skipWaiting () { + const worker = this.registration.waiting + if (!worker) { + return Promise.resolve() + } + + console.log('[vuepress:sw] Doing worker.skipWaiting().') + return new Promise((resolve, reject) => { + const channel = new MessageChannel() + + channel.port1.onmessage = (event) => { + console.log('[vuepress:sw] Done worker.skipWaiting().') + if (event.data.error) { + reject(event.data.error) + } else { + resolve(event.data) + } + } + + worker.postMessage({ type: 'skip-waiting' }, [channel.port2]) + }) + } +} + diff --git a/node_modules/vuepress/lib/app/app.js b/node_modules/vuepress/lib/app/app.js new file mode 100644 index 00000000..511abbd4 --- /dev/null +++ b/node_modules/vuepress/lib/app/app.js @@ -0,0 +1,102 @@ +import Vue from 'vue' +import Router from 'vue-router' +import dataMixin from './dataMixin' +import store from './store' +import { routes } from '@temp/routes' +import { siteData } from '@temp/siteData' +import enhanceApp from '@temp/enhanceApp' +import themeEnhanceApp from '@temp/themeEnhanceApp' + +// generated from user config +import('@temp/style.styl') + +// built-in components +import Content from './components/Content' +import OutboundLink from './components/OutboundLink.vue' +import ClientOnly from './components/ClientOnly' + +// suggest dev server restart on base change +if (module.hot) { + const prevBase = siteData.base + module.hot.accept('./.temp/siteData', () => { + if (siteData.base !== prevBase) { + window.alert( + `[vuepress] Site base has changed. ` + + `Please restart dev server to ensure correct asset paths.` + ) + } + }) +} + +Vue.config.productionTip = false +Vue.use(Router) +// mixin for exposing $site and $page +Vue.mixin(dataMixin(siteData)) +// component for rendering markdown content and setting title etc. +Vue.component('Content', Content) +Vue.component('OutboundLink', OutboundLink) +Vue.component('Badge', () => import('./components/Badge.vue')) +// component for client-only content +Vue.component('ClientOnly', ClientOnly) + +// global helper for adding base path to absolute urls +Vue.prototype.$withBase = function (path) { + const base = this.$site.base + if (path.charAt(0) === '/') { + return base + path.slice(1) + } else { + return path + } +} + +export function createApp () { + const router = new Router({ + base: siteData.base, + mode: 'history', + fallback: false, + routes, + scrollBehavior: (to, from, saved) => { + if (saved) { + return saved + } else if (to.hash) { + if (store.disableScrollBehavior) { + return false + } + return { + selector: to.hash + } + } else { + return { x: 0, y: 0 } + } + } + }) + + // redirect /foo to /foo/ + router.beforeEach((to, from, next) => { + if (!/(\/|\.html)$/.test(to.path)) { + next(Object.assign({}, to, { + path: to.path + '/' + })) + } else { + next() + } + }) + + const options = {} + + themeEnhanceApp({ Vue, options, router, siteData }) + enhanceApp({ Vue, options, router, siteData }) + + const app = new Vue( + Object.assign(options, { + router, + render (h) { + return h('div', { attrs: { id: 'app' }}, [ + h('router-view', { ref: 'layout' }) + ]) + } + }) + ) + + return { app, router } +} diff --git a/node_modules/vuepress/lib/app/clientEntry.js b/node_modules/vuepress/lib/app/clientEntry.js new file mode 100644 index 00000000..dc86314a --- /dev/null +++ b/node_modules/vuepress/lib/app/clientEntry.js @@ -0,0 +1,74 @@ +/* global BASE_URL, GA_ID, ga, SW_ENABLED, VUEPRESS_VERSION, LAST_COMMIT_HASH*/ + +import { createApp } from './app' +import SWUpdateEvent from './SWUpdateEvent' +import { register } from 'register-service-worker' + +const { app, router } = createApp() + +window.__VUEPRESS_VERSION__ = { + version: VUEPRESS_VERSION, + hash: LAST_COMMIT_HASH +} + +// Google analytics integration +if (process.env.NODE_ENV === 'production' && GA_ID) { + (function (i, s, o, g, r, a, m) { + i['GoogleAnalyticsObject'] = r + i[r] = i[r] || function () { + (i[r].q = i[r].q || []).push(arguments) + } + i[r].l = 1 * new Date() + a = s.createElement(o) + m = s.getElementsByTagName(o)[0] + a.async = 1 + a.src = g + m.parentNode.insertBefore(a, m) + })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga') + + ga('create', GA_ID, 'auto') + ga('send', 'pageview') + + router.afterEach(function (to) { + ga('set', 'page', app.$withBase(to.fullPath)) + ga('send', 'pageview') + }) +} + +router.onReady(() => { + app.$mount('#app') + + // Register service worker + if (process.env.NODE_ENV === 'production' && + SW_ENABLED && + window.location.protocol === 'https:') { + register(`${BASE_URL}service-worker.js`, { + ready () { + console.log('[vuepress:sw] Service worker is active.') + app.$refs.layout.$emit('sw-ready') + }, + cached (registration) { + console.log('[vuepress:sw] Content has been cached for offline use.') + app.$refs.layout.$emit('sw-cached', new SWUpdateEvent(registration)) + }, + updated (registration) { + console.log('[vuepress:sw] Content updated.') + app.$refs.layout.$emit('sw-updated', new SWUpdateEvent(registration)) + }, + offline () { + console.log('[vuepress:sw] No internet connection found. App is running in offline mode.') + app.$refs.layout.$emit('sw-offline') + }, + error (err) { + console.error('[vuepress:sw] Error during service worker registration:', err) + app.$refs.layout.$emit('sw-error', err) + if (GA_ID) { + ga('send', 'exception', { + exDescription: err.message, + exFatal: false + }) + } + } + }) + } +}) diff --git a/node_modules/vuepress/lib/app/components/Badge.vue b/node_modules/vuepress/lib/app/components/Badge.vue new file mode 100644 index 00000000..17e6ba6e --- /dev/null +++ b/node_modules/vuepress/lib/app/components/Badge.vue @@ -0,0 +1,46 @@ +<script> +export default { + functional: true, + props: { + type: { + type: String, + default: 'tip' + }, + text: String, + vertical: { + type: String, + default: 'top' + } + }, + render (h, { props, slots }) { + return h('span', { + class: ['badge', props.type, props.vertical] + }, props.text || slots().default) + } +} +</script> + +<style lang="stylus" scoped> +@import '../../default-theme/styles/config.styl' + +.badge + display inline-block + font-size 14px + height 18px + line-height 18px + border-radius 3px + padding 0 6px + color white + margin-right 5px + background-color #42b983 + &.middle + vertical-align middle + &.top + vertical-align top + &.tip, &.green + background-color #42b983 + &.error + background-color #DA5961 //#f66 + &.warning, &.warn, &.yellow + background-color darken(#ffe564, 35%) +</style> diff --git a/node_modules/vuepress/lib/app/components/ClientOnly.js b/node_modules/vuepress/lib/app/components/ClientOnly.js new file mode 100644 index 00000000..c786d1af --- /dev/null +++ b/node_modules/vuepress/lib/app/components/ClientOnly.js @@ -0,0 +1,12 @@ +export default { + functional: true, + render (h, { parent, children }) { + if (parent._isMounted) { + return children + } else { + parent.$once('hook:mounted', () => { + parent.$forceUpdate() + }) + } + } +} diff --git a/node_modules/vuepress/lib/app/components/Content.js b/node_modules/vuepress/lib/app/components/Content.js new file mode 100644 index 00000000..46628195 --- /dev/null +++ b/node_modules/vuepress/lib/app/components/Content.js @@ -0,0 +1,17 @@ +export default { + functional: true, + + props: { + custom: { + type: Boolean, + default: true + } + }, + + render (h, { parent, props, data }) { + return h(parent.$page.key, { + class: [props.custom ? 'custom' : '', data.class, data.staticClass], + style: data.style + }) + } +} diff --git a/node_modules/vuepress/lib/app/components/OutboundLink.vue b/node_modules/vuepress/lib/app/components/OutboundLink.vue new file mode 100644 index 00000000..a3aa7f2d --- /dev/null +++ b/node_modules/vuepress/lib/app/components/OutboundLink.vue @@ -0,0 +1,12 @@ +<template functional> + <svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"> + <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> + <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon> + </svg> +</template> + +<style lang="stylus"> +.icon.outbound + color #aaa + display inline-block +</style> diff --git a/node_modules/vuepress/lib/app/dataMixin.js b/node_modules/vuepress/lib/app/dataMixin.js new file mode 100644 index 00000000..fd003d92 --- /dev/null +++ b/node_modules/vuepress/lib/app/dataMixin.js @@ -0,0 +1,90 @@ +import Vue from 'vue' +import { findPageForPath } from './util' + +export default function dataMixin (siteData) { + prepare(siteData) + const store = new Vue({ + data: { siteData } + }) + + if (module.hot) { + module.hot.accept('./.temp/siteData', () => { + prepare(siteData) + store.siteData = siteData + }) + } + + return { + computed: { + $site () { + return store.siteData + }, + $localeConfig () { + const { locales = {}} = this.$site + let targetLang + let defaultLang + for (const path in locales) { + if (path === '/') { + defaultLang = locales[path] + } else if (this.$page.path.indexOf(path) === 0) { + targetLang = locales[path] + } + } + return targetLang || defaultLang || {} + }, + $siteTitle () { + return this.$localeConfig.title || this.$site.title || '' + }, + $title () { + const page = this.$page + const siteTitle = this.$siteTitle + const selfTitle = page.frontmatter.home ? null : ( + page.frontmatter.title || // explicit title + page.title // inferred title + ) + return siteTitle + ? selfTitle + ? (selfTitle + ' | ' + siteTitle) + : siteTitle + : selfTitle || 'VuePress' + }, + $description () { + // #565 hoist description from meta + if (this.$page.frontmatter.meta) { + const descriptionMeta = this.$page.frontmatter.meta.filter(item => item.name === 'description')[0] + if (descriptionMeta) return descriptionMeta.content + } + return this.$page.frontmatter.description || this.$localeConfig.description || this.$site.description || '' + }, + $lang () { + return this.$page.frontmatter.lang || this.$localeConfig.lang || 'en-US' + }, + $localePath () { + return this.$localeConfig.path || '/' + }, + $themeLocaleConfig () { + return (this.$site.themeConfig.locales || {})[this.$localePath] || {} + }, + $page () { + return findPageForPath( + this.$site.pages, + this.$route.path + ) + } + } + } +} + +function prepare (siteData) { + siteData.pages.forEach(page => { + if (!page.frontmatter) { + page.frontmatter = {} + } + }) + if (siteData.locales) { + Object.keys(siteData.locales).forEach(path => { + siteData.locales[path].path = path + }) + } + Object.freeze(siteData) +} diff --git a/node_modules/vuepress/lib/app/index.dev.html b/node_modules/vuepress/lib/app/index.dev.html new file mode 100644 index 00000000..06f743c5 --- /dev/null +++ b/node_modules/vuepress/lib/app/index.dev.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <title></title> + </head> + <body> + <div id="app"></div> + </body> +</html> diff --git a/node_modules/vuepress/lib/app/index.ssr.html b/node_modules/vuepress/lib/app/index.ssr.html new file mode 100644 index 00000000..32d310a9 --- /dev/null +++ b/node_modules/vuepress/lib/app/index.ssr.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html lang="{{ lang }}"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <title>{{ title }}</title> + <meta name="description" content="{{ description }}"> + {{{ userHeadTags }}} + {{{ pageMeta }}} + {{{ renderResourceHints() }}} + {{{ renderStyles() }}} + </head> + <body> + <!--vue-ssr-outlet--> + {{{ renderScripts() }}} + </body> +</html> diff --git a/node_modules/vuepress/lib/app/root-mixins/activeHeaderLinks.js b/node_modules/vuepress/lib/app/root-mixins/activeHeaderLinks.js new file mode 100644 index 00000000..6cad69d5 --- /dev/null +++ b/node_modules/vuepress/lib/app/root-mixins/activeHeaderLinks.js @@ -0,0 +1,47 @@ +import store from '@app/store' +import throttle from 'lodash.throttle' + +export default { + mounted () { + window.addEventListener('scroll', this.onScroll) + }, + methods: { + onScroll: throttle(function () { + this.setActiveHash() + }, 300), + setActiveHash () { + const sidebarLinks = [].slice.call(document.querySelectorAll('.sidebar-link')) + const anchors = [].slice.call(document.querySelectorAll('.header-anchor')) + .filter(anchor => sidebarLinks.some(sidebarLink => sidebarLink.hash === anchor.hash)) + + const scrollTop = Math.max( + window.pageYOffset, + document.documentElement.scrollTop, + document.body.scrollTop + ) + + for (let i = 0; i < anchors.length; i++) { + const anchor = anchors[i] + const nextAnchor = anchors[i + 1] + + const isActive = i === 0 && scrollTop === 0 || + (scrollTop >= anchor.parentElement.offsetTop + 10 && + (!nextAnchor || scrollTop < nextAnchor.parentElement.offsetTop - 10)) + + if (isActive && decodeURIComponent(this.$route.hash) !== decodeURIComponent(anchor.hash)) { + store.disableScrollBehavior = true + this.$router.replace(decodeURIComponent(anchor.hash), () => { + // execute after scrollBehavior handler. + this.$nextTick(() => { + store.disableScrollBehavior = false + }) + }) + return + } + } + } + }, + beforeDestroy () { + window.removeEventListener('scroll', this.onScroll) + } +} diff --git a/node_modules/vuepress/lib/app/root-mixins/index.js b/node_modules/vuepress/lib/app/root-mixins/index.js new file mode 100644 index 00000000..fd966f39 --- /dev/null +++ b/node_modules/vuepress/lib/app/root-mixins/index.js @@ -0,0 +1,7 @@ +import updateMeta from './updateMeta' +import activeHeaderLinks from '@activeHeaderLinks' + +export default [ + updateMeta, // required + activeHeaderLinks // optional +] diff --git a/node_modules/vuepress/lib/app/root-mixins/updateMeta.js b/node_modules/vuepress/lib/app/root-mixins/updateMeta.js new file mode 100644 index 00000000..ff2703ac --- /dev/null +++ b/node_modules/vuepress/lib/app/root-mixins/updateMeta.js @@ -0,0 +1,59 @@ +export default { + created () { + if (this.$ssrContext) { + this.$ssrContext.title = this.$title + this.$ssrContext.lang = this.$lang + this.$ssrContext.description = this.$page.description || this.$description + } + }, + + mounted () { + // update title / meta tags + this.currentMetaTags = new Set() + + const updateMeta = () => { + document.title = this.$title + document.documentElement.lang = this.$lang + const userMeta = this.$page.frontmatter.meta || [] + const meta = userMeta.slice(0) + const useGlobalDescription = userMeta.filter(m => m.name === 'description').length === 0 + + // #665 Avoid duplicate description meta at runtime. + if (useGlobalDescription) { + meta.push({ name: 'description', content: this.$description }) + } + + // Including description meta coming from SSR. + const descriptionMetas = document.querySelectorAll('meta[name="description"]') + if (descriptionMetas.length) { + descriptionMetas.forEach(m => this.currentMetaTags.add(m)) + } + + this.currentMetaTags = new Set(updateMetaTags(meta, this.currentMetaTags)) + } + this.$watch('$page', updateMeta) + updateMeta() + }, + + beforeDestroy () { + updateMetaTags(null, this.currentMetaTags) + } +} + +function updateMetaTags (meta, current) { + if (current) { + [...current].forEach(c => { + document.head.removeChild(c) + }) + } + if (meta) { + return meta.map(m => { + const tag = document.createElement('meta') + Object.keys(m).forEach(key => { + tag.setAttribute(key, m[key]) + }) + document.head.appendChild(tag) + return tag + }) + } +} diff --git a/node_modules/vuepress/lib/app/serverEntry.js b/node_modules/vuepress/lib/app/serverEntry.js new file mode 100644 index 00000000..715fc956 --- /dev/null +++ b/node_modules/vuepress/lib/app/serverEntry.js @@ -0,0 +1,14 @@ +import { createApp } from './app' + +export default context => new Promise((resolve, reject) => { + const { app, router } = createApp() + const { url } = context + const { fullPath } = router.resolve(url).route + + if (fullPath !== url) { + return reject({ url: fullPath }) + } + + router.push(url) + router.onReady(() => resolve(app)) +}) diff --git a/node_modules/vuepress/lib/app/store.js b/node_modules/vuepress/lib/app/store.js new file mode 100644 index 00000000..115fe0b9 --- /dev/null +++ b/node_modules/vuepress/lib/app/store.js @@ -0,0 +1,7 @@ +// It is not yet time to use Vuex to manage the global state +// singleton object as a global store. +const state = { + disableScrollBehavior: false +} + +export default state diff --git a/node_modules/vuepress/lib/app/util.js b/node_modules/vuepress/lib/app/util.js new file mode 100644 index 00000000..c1117224 --- /dev/null +++ b/node_modules/vuepress/lib/app/util.js @@ -0,0 +1,19 @@ +export function injectMixins (options, mixins) { + if (!options.mixins) { + options.mixins = [] + } + options.mixins.push(...mixins) +} + +export function findPageForPath (pages, path) { + for (let i = 0; i < pages.length; i++) { + const page = pages[i] + if (page.path === path) { + return page + } + } + return { + path: '', + frontmatter: {} + } +} |
