@vuepress/core 2.0.0-beta.48 → 2.0.0-beta.50-pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +30 -13
- package/lib/app/appInit.d.ts +0 -7
- package/lib/app/appInit.js +0 -27
- package/lib/app/appPrepare.d.ts +0 -10
- package/lib/app/appPrepare.js +0 -39
- package/lib/app/appUse.d.ts +0 -2
- package/lib/app/appUse.js +0 -28
- package/lib/app/createBaseApp.d.ts +0 -5
- package/lib/app/createBaseApp.js +0 -46
- package/lib/app/createBuildApp.d.ts +0 -5
- package/lib/app/createBuildApp.js +0 -13
- package/lib/app/createDevApp.d.ts +0 -5
- package/lib/app/createDevApp.js +0 -13
- package/lib/app/index.d.ts +0 -17
- package/lib/app/index.js +0 -33
- package/lib/app/prepare/index.d.ts +0 -8
- package/lib/app/prepare/index.js +0 -24
- package/lib/app/prepare/prepareClientConfigs.d.ts +0 -5
- package/lib/app/prepare/prepareClientConfigs.js +0 -22
- package/lib/app/prepare/prepareLayoutComponents.d.ts +0 -5
- package/lib/app/prepare/prepareLayoutComponents.js +0 -20
- package/lib/app/prepare/preparePageComponent.d.ts +0 -5
- package/lib/app/prepare/preparePageComponent.js +0 -16
- package/lib/app/prepare/preparePageData.d.ts +0 -5
- package/lib/app/prepare/preparePageData.js +0 -31
- package/lib/app/prepare/preparePagesComponents.d.ts +0 -5
- package/lib/app/prepare/preparePagesComponents.js +0 -24
- package/lib/app/prepare/preparePagesData.d.ts +0 -5
- package/lib/app/prepare/preparePagesData.js +0 -20
- package/lib/app/prepare/preparePagesRoutes.d.ts +0 -5
- package/lib/app/prepare/preparePagesRoutes.js +0 -48
- package/lib/app/prepare/prepareSiteData.d.ts +0 -5
- package/lib/app/prepare/prepareSiteData.js +0 -31
- package/lib/app/resolveAppDir.d.ts +0 -9
- package/lib/app/resolveAppDir.js +0 -32
- package/lib/app/resolveAppEnv.d.ts +0 -5
- package/lib/app/resolveAppEnv.js +0 -12
- package/lib/app/resolveAppMarkdown.d.ts +0 -6
- package/lib/app/resolveAppMarkdown.js +0 -16
- package/lib/app/resolveAppOptions.d.ts +0 -5
- package/lib/app/resolveAppOptions.js +0 -45
- package/lib/app/resolveAppPages.d.ts +0 -5
- package/lib/app/resolveAppPages.js +0 -31
- package/lib/app/resolveAppSiteData.d.ts +0 -7
- package/lib/app/resolveAppSiteData.js +0 -17
- package/lib/app/resolveAppVersion.d.ts +0 -4
- package/lib/app/resolveAppVersion.js +0 -10
- package/lib/app/resolveAppWriteTemp.d.ts +0 -5
- package/lib/app/resolveAppWriteTemp.js +0 -21
- package/lib/app/resolvePluginObject.d.ts +0 -5
- package/lib/app/resolvePluginObject.js +0 -9
- package/lib/app/resolveThemeInfo.d.ts +0 -5
- package/lib/app/resolveThemeInfo.js +0 -31
- package/lib/app/resolveThemeLayouts.d.ts +0 -5
- package/lib/app/resolveThemeLayouts.js +0 -25
- package/lib/app/setupAppThemeAndPlugins.d.ts +0 -5
- package/lib/app/setupAppThemeAndPlugins.js +0 -21
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -20
- package/lib/page/createPage.d.ts +0 -2
- package/lib/page/createPage.js +0 -135
- package/lib/page/index.d.ts +0 -18
- package/lib/page/index.js +0 -34
- package/lib/page/inferPagePath.d.ts +0 -11
- package/lib/page/inferPagePath.js +0 -27
- package/lib/page/renderPageContent.d.ts +0 -19
- package/lib/page/renderPageContent.js +0 -26
- package/lib/page/renderPageExcerpt.d.ts +0 -11
- package/lib/page/renderPageExcerpt.js +0 -17
- package/lib/page/resolvePageComponentInfo.d.ts +0 -13
- package/lib/page/resolvePageComponentInfo.js +0 -19
- package/lib/page/resolvePageContent.d.ts +0 -11
- package/lib/page/resolvePageContent.js +0 -30
- package/lib/page/resolvePageDataInfo.d.ts +0 -13
- package/lib/page/resolvePageDataInfo.js +0 -18
- package/lib/page/resolvePageDate.d.ts +0 -10
- package/lib/page/resolvePageDate.js +0 -45
- package/lib/page/resolvePageFileContent.d.ts +0 -8
- package/lib/page/resolvePageFileContent.js +0 -23
- package/lib/page/resolvePageFilePath.d.ts +0 -11
- package/lib/page/resolvePageFilePath.js +0 -24
- package/lib/page/resolvePageFrontmatter.d.ts +0 -8
- package/lib/page/resolvePageFrontmatter.js +0 -12
- package/lib/page/resolvePageHtmlInfo.d.ts +0 -11
- package/lib/page/resolvePageHtmlInfo.js +0 -18
- package/lib/page/resolvePageKey.d.ts +0 -6
- package/lib/page/resolvePageKey.js +0 -9
- package/lib/page/resolvePageLang.d.ts +0 -9
- package/lib/page/resolvePageLang.js +0 -14
- package/lib/page/resolvePagePath.d.ts +0 -9
- package/lib/page/resolvePagePath.js +0 -19
- package/lib/page/resolvePagePermalink.d.ts +0 -12
- package/lib/page/resolvePagePermalink.js +0 -41
- package/lib/page/resolvePageRouteMeta.d.ts +0 -7
- package/lib/page/resolvePageRouteMeta.js +0 -8
- package/lib/page/resolvePageSlug.d.ts +0 -6
- package/lib/page/resolvePageSlug.js +0 -17
- package/lib/pluginApi/createHookQueue.d.ts +0 -5
- package/lib/pluginApi/createHookQueue.js +0 -42
- package/lib/pluginApi/createPluginApi.d.ts +0 -2
- package/lib/pluginApi/createPluginApi.js +0 -16
- package/lib/pluginApi/createPluginApiHooks.d.ts +0 -2
- package/lib/pluginApi/createPluginApiHooks.js +0 -23
- package/lib/pluginApi/createPluginApiRegisterHooks.d.ts +0 -2
- package/lib/pluginApi/createPluginApiRegisterHooks.js +0 -42
- package/lib/pluginApi/index.d.ts +0 -6
- package/lib/pluginApi/index.js +0 -22
- package/lib/pluginApi/normalizeClientConfigFileHook.d.ts +0 -5
- package/lib/pluginApi/normalizeClientConfigFileHook.js +0 -19
- package/lib/pluginApi/normalizeReturnObjectHook.d.ts +0 -5
- package/lib/pluginApi/normalizeReturnObjectHook.js +0 -9
- package/lib/types/app/app.d.ts +0 -98
- package/lib/types/app/app.js +0 -2
- package/lib/types/app/index.d.ts +0 -3
- package/lib/types/app/index.js +0 -19
- package/lib/types/app/options.d.ts +0 -84
- package/lib/types/app/options.js +0 -2
- package/lib/types/app/utils.d.ts +0 -36
- package/lib/types/app/utils.js +0 -2
- package/lib/types/bundler.d.ts +0 -13
- package/lib/types/bundler.js +0 -2
- package/lib/types/index.d.ts +0 -8
- package/lib/types/index.js +0 -22
- package/lib/types/page.d.ts +0 -144
- package/lib/types/page.js +0 -2
- package/lib/types/plugin.d.ts +0 -29
- package/lib/types/plugin.js +0 -2
- package/lib/types/pluginApi/hooks.d.ts +0 -72
- package/lib/types/pluginApi/hooks.js +0 -2
- package/lib/types/pluginApi/index.d.ts +0 -2
- package/lib/types/pluginApi/index.js +0 -18
- package/lib/types/pluginApi/pluginApi.d.ts +0 -23
- package/lib/types/pluginApi/pluginApi.js +0 -2
- package/lib/types/theme.d.ts +0 -61
- package/lib/types/theme.js +0 -2
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AppDir, AppDirFunction, AppOptions } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Create directory util function
|
|
4
|
-
*/
|
|
5
|
-
export declare const createAppDirFunction: (baseDir: string) => AppDirFunction;
|
|
6
|
-
/**
|
|
7
|
-
* Resolve directory utils for vuepress app
|
|
8
|
-
*/
|
|
9
|
-
export declare const resolveAppDir: (options: AppOptions) => AppDir;
|
package/lib/app/resolveAppDir.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppDir = exports.createAppDirFunction = void 0;
|
|
4
|
-
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
/**
|
|
6
|
-
* Create directory util function
|
|
7
|
-
*/
|
|
8
|
-
const createAppDirFunction = (baseDir) => {
|
|
9
|
-
return (...args) => utils_1.path.resolve(baseDir, ...args);
|
|
10
|
-
};
|
|
11
|
-
exports.createAppDirFunction = createAppDirFunction;
|
|
12
|
-
/**
|
|
13
|
-
* Resolve directory utils for vuepress app
|
|
14
|
-
*/
|
|
15
|
-
const resolveAppDir = (options) => {
|
|
16
|
-
const cache = (0, exports.createAppDirFunction)(options.cache);
|
|
17
|
-
const temp = (0, exports.createAppDirFunction)(options.temp);
|
|
18
|
-
const source = (0, exports.createAppDirFunction)(options.source);
|
|
19
|
-
const dest = (0, exports.createAppDirFunction)(options.dest);
|
|
20
|
-
const publicDir = (0, exports.createAppDirFunction)(options.public);
|
|
21
|
-
// @vuepress/client
|
|
22
|
-
const client = (0, exports.createAppDirFunction)(utils_1.path.resolve(require.resolve('@vuepress/client/package.json'), '..'));
|
|
23
|
-
return {
|
|
24
|
-
cache,
|
|
25
|
-
temp,
|
|
26
|
-
source,
|
|
27
|
-
dest,
|
|
28
|
-
client,
|
|
29
|
-
public: publicDir,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.resolveAppDir = resolveAppDir;
|
package/lib/app/resolveAppEnv.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppEnv = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Resolve environment flags for vuepress app
|
|
6
|
-
*/
|
|
7
|
-
const resolveAppEnv = (options, isBuild) => ({
|
|
8
|
-
isBuild,
|
|
9
|
-
isDev: !isBuild,
|
|
10
|
-
isDebug: options.debug,
|
|
11
|
-
});
|
|
12
|
-
exports.resolveAppEnv = resolveAppEnv;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppMarkdown = void 0;
|
|
4
|
-
const markdown_1 = require("@vuepress/markdown");
|
|
5
|
-
/**
|
|
6
|
-
* Resolve markdown-it instance for vuepress app
|
|
7
|
-
*/
|
|
8
|
-
const resolveAppMarkdown = async (app) => {
|
|
9
|
-
// plugin hook: extendsMarkdownOptions
|
|
10
|
-
await app.pluginApi.hooks.extendsMarkdownOptions.process(app.options.markdown, app);
|
|
11
|
-
const markdown = (0, markdown_1.createMarkdown)(app.options.markdown);
|
|
12
|
-
// plugin hook: extendsMarkdown
|
|
13
|
-
await app.pluginApi.hooks.extendsMarkdown.process(markdown, app);
|
|
14
|
-
return markdown;
|
|
15
|
-
};
|
|
16
|
-
exports.resolveAppMarkdown = resolveAppMarkdown;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AppConfig, AppOptions } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Create app options with default values
|
|
4
|
-
*/
|
|
5
|
-
export declare const resolveAppOptions: ({ base, lang, title, description, head, locales, source, dest, temp, cache, public: publicDir, host, port, open, templateDev, shouldPreload, shouldPrefetch, templateBuild, bundler, debug, markdown, pagePatterns, permalinkPattern, plugins, theme, }: AppConfig) => AppOptions;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppOptions = void 0;
|
|
4
|
-
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
/**
|
|
6
|
-
* Create app options with default values
|
|
7
|
-
*/
|
|
8
|
-
const resolveAppOptions = ({
|
|
9
|
-
// site config
|
|
10
|
-
base = '/', lang = 'en-US', title = '', description = '', head = [], locales = {},
|
|
11
|
-
// directory config
|
|
12
|
-
source, dest = utils_1.path.resolve(source, '.vuepress/dist'), temp = utils_1.path.resolve(source, '.vuepress/.temp'), cache = utils_1.path.resolve(source, '.vuepress/.cache'), public: publicDir = utils_1.path.resolve(source, '.vuepress/public'),
|
|
13
|
-
// dev config
|
|
14
|
-
host = '0.0.0.0', port = 8080, open = false, templateDev = utils_1.path.normalize(require.resolve('@vuepress/client/templates/dev.html')),
|
|
15
|
-
// build config
|
|
16
|
-
shouldPreload = true, shouldPrefetch = true, templateBuild = utils_1.path.normalize(require.resolve('@vuepress/client/templates/build.html')),
|
|
17
|
-
// common config
|
|
18
|
-
bundler, debug = false, markdown = {}, pagePatterns = ['**/*.md', '!.vuepress', '!node_modules'], permalinkPattern = null, plugins = [], theme, }) => ({
|
|
19
|
-
base,
|
|
20
|
-
lang,
|
|
21
|
-
title,
|
|
22
|
-
description,
|
|
23
|
-
head,
|
|
24
|
-
locales,
|
|
25
|
-
source,
|
|
26
|
-
dest,
|
|
27
|
-
temp,
|
|
28
|
-
cache,
|
|
29
|
-
public: publicDir,
|
|
30
|
-
host,
|
|
31
|
-
port,
|
|
32
|
-
open,
|
|
33
|
-
templateDev,
|
|
34
|
-
shouldPreload,
|
|
35
|
-
shouldPrefetch,
|
|
36
|
-
templateBuild,
|
|
37
|
-
bundler,
|
|
38
|
-
debug,
|
|
39
|
-
markdown,
|
|
40
|
-
pagePatterns,
|
|
41
|
-
permalinkPattern,
|
|
42
|
-
plugins,
|
|
43
|
-
theme,
|
|
44
|
-
});
|
|
45
|
-
exports.resolveAppOptions = resolveAppOptions;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppPages = void 0;
|
|
4
|
-
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
const page_1 = require("../page");
|
|
6
|
-
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
|
-
/**
|
|
8
|
-
* Resolve pages for vuepress app
|
|
9
|
-
*/
|
|
10
|
-
const resolveAppPages = async (app) => {
|
|
11
|
-
log('resolveAppPages start');
|
|
12
|
-
// resolve page absolute file paths according to the page patterns
|
|
13
|
-
const pageFilePaths = await (0, utils_1.globby)(app.options.pagePatterns, {
|
|
14
|
-
absolute: true,
|
|
15
|
-
cwd: app.dir.source(),
|
|
16
|
-
});
|
|
17
|
-
// create pages from files
|
|
18
|
-
const pages = await Promise.all(pageFilePaths.map((filePath) => (0, page_1.createPage)(app, { filePath })));
|
|
19
|
-
// if there is no 404 page, add one
|
|
20
|
-
if (!pages.some((page) => page.path === '/404.html')) {
|
|
21
|
-
pages.push(await (0, page_1.createPage)(app, {
|
|
22
|
-
path: '/404.html',
|
|
23
|
-
frontmatter: {
|
|
24
|
-
layout: '404',
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
log('resolveAppPages finish');
|
|
29
|
-
return pages;
|
|
30
|
-
};
|
|
31
|
-
exports.resolveAppPages = resolveAppPages;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppSiteData = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Resolve site data for vuepress app
|
|
6
|
-
*
|
|
7
|
-
* Site data will also be used in client
|
|
8
|
-
*/
|
|
9
|
-
const resolveAppSiteData = (options) => ({
|
|
10
|
-
base: options.base,
|
|
11
|
-
lang: options.lang,
|
|
12
|
-
title: options.title,
|
|
13
|
-
description: options.description,
|
|
14
|
-
head: options.head,
|
|
15
|
-
locales: options.locales,
|
|
16
|
-
});
|
|
17
|
-
exports.resolveAppSiteData = resolveAppSiteData;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppVersion = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Resolve version of vuepress app
|
|
6
|
-
*/
|
|
7
|
-
const resolveAppVersion = () => {
|
|
8
|
-
return require('../../package.json').version;
|
|
9
|
-
};
|
|
10
|
-
exports.resolveAppVersion = resolveAppVersion;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAppWriteTemp = void 0;
|
|
4
|
-
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
/**
|
|
6
|
-
* Resolve write temp file util for vuepress app
|
|
7
|
-
*/
|
|
8
|
-
const resolveAppWriteTemp = (dir) => {
|
|
9
|
-
const tempCache = new Map();
|
|
10
|
-
const writeTemp = async (file, content) => {
|
|
11
|
-
const filePath = dir.temp(file);
|
|
12
|
-
const contentCached = tempCache.get(filePath);
|
|
13
|
-
if (contentCached !== content) {
|
|
14
|
-
await utils_1.fs.outputFile(filePath, content);
|
|
15
|
-
tempCache.set(filePath, content);
|
|
16
|
-
}
|
|
17
|
-
return filePath;
|
|
18
|
-
};
|
|
19
|
-
return writeTemp;
|
|
20
|
-
};
|
|
21
|
-
exports.resolveAppWriteTemp = resolveAppWriteTemp;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolvePluginObject = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
/**
|
|
6
|
-
* Resolve a plugin object according to name / path / module and config
|
|
7
|
-
*/
|
|
8
|
-
const resolvePluginObject = (app, plugin) => ((0, shared_1.isFunction)(plugin) ? plugin(app) : plugin);
|
|
9
|
-
exports.resolvePluginObject = resolvePluginObject;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveThemeInfo = void 0;
|
|
4
|
-
const resolvePluginObject_1 = require("./resolvePluginObject");
|
|
5
|
-
const resolveThemeLayouts_1 = require("./resolveThemeLayouts");
|
|
6
|
-
/**
|
|
7
|
-
* Resolve theme info and its parent theme info
|
|
8
|
-
*/
|
|
9
|
-
const resolveThemeInfo = (app, theme) => {
|
|
10
|
-
// resolve current theme info
|
|
11
|
-
const themeObject = (0, resolvePluginObject_1.resolvePluginObject)(app, theme);
|
|
12
|
-
const themeInfo = {
|
|
13
|
-
layouts: (0, resolveThemeLayouts_1.resolveThemeLayouts)(themeObject.layouts),
|
|
14
|
-
plugins: [...(themeObject.plugins ?? []), themeObject],
|
|
15
|
-
templateBuild: themeObject.templateBuild,
|
|
16
|
-
templateDev: themeObject.templateDev,
|
|
17
|
-
};
|
|
18
|
-
// return if current theme does not have a parent theme
|
|
19
|
-
if (!themeObject.extends) {
|
|
20
|
-
return themeInfo;
|
|
21
|
-
}
|
|
22
|
-
// resolve parent theme info recursively
|
|
23
|
-
const parentThemeInfo = (0, exports.resolveThemeInfo)(app, themeObject.extends);
|
|
24
|
-
return {
|
|
25
|
-
layouts: { ...parentThemeInfo.layouts, ...themeInfo.layouts },
|
|
26
|
-
plugins: [...parentThemeInfo.plugins, ...themeInfo.plugins],
|
|
27
|
-
templateBuild: themeObject.templateBuild ?? parentThemeInfo.templateBuild,
|
|
28
|
-
templateDev: themeObject.templateDev ?? parentThemeInfo.templateDev,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
exports.resolveThemeInfo = resolveThemeInfo;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveThemeLayouts = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
const utils_1 = require("@vuepress/utils");
|
|
6
|
-
/**
|
|
7
|
-
* Resolve layouts from `layouts` option
|
|
8
|
-
*/
|
|
9
|
-
const resolveThemeLayouts = (layouts = {}) => {
|
|
10
|
-
// use the layouts component map directly
|
|
11
|
-
if ((0, shared_1.isPlainObject)(layouts)) {
|
|
12
|
-
return layouts;
|
|
13
|
-
}
|
|
14
|
-
// resolve the layouts directory
|
|
15
|
-
if (!utils_1.fs.pathExistsSync(layouts)) {
|
|
16
|
-
throw utils_1.logger.createError(`layouts directory does not exist: ${utils_1.chalk.magenta(layouts)}`);
|
|
17
|
-
}
|
|
18
|
-
// load all files in layouts directory, then take matched files
|
|
19
|
-
// as theme layouts
|
|
20
|
-
return Object.fromEntries(utils_1.fs
|
|
21
|
-
.readdirSync(layouts)
|
|
22
|
-
.filter((file) => /\.(vue|ts|js)$/.test(file))
|
|
23
|
-
.map((file) => [utils_1.path.trimExt(file), utils_1.path.resolve(layouts, file)]));
|
|
24
|
-
};
|
|
25
|
-
exports.resolveThemeLayouts = resolveThemeLayouts;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupAppThemeAndPlugins = void 0;
|
|
4
|
-
const resolveThemeInfo_1 = require("./resolveThemeInfo");
|
|
5
|
-
/**
|
|
6
|
-
* Setup theme and plugins for vuepress app
|
|
7
|
-
*/
|
|
8
|
-
const setupAppThemeAndPlugins = (app, config) => {
|
|
9
|
-
// recursively resolve theme info
|
|
10
|
-
const themeInfo = (0, resolveThemeInfo_1.resolveThemeInfo)(app, app.options.theme);
|
|
11
|
-
// set up app layouts and templates
|
|
12
|
-
app.layouts = themeInfo.layouts;
|
|
13
|
-
app.options.templateDev =
|
|
14
|
-
config.templateDev ?? themeInfo.templateDev ?? app.options.templateDev;
|
|
15
|
-
app.options.templateBuild =
|
|
16
|
-
config.templateBuild ?? themeInfo.templateBuild ?? app.options.templateBuild;
|
|
17
|
-
[...themeInfo.plugins, ...app.options.plugins]
|
|
18
|
-
.flat()
|
|
19
|
-
.forEach((plugin) => app.use(plugin));
|
|
20
|
-
};
|
|
21
|
-
exports.setupAppThemeAndPlugins = setupAppThemeAndPlugins;
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./app"), exports);
|
|
18
|
-
__exportStar(require("./page"), exports);
|
|
19
|
-
__exportStar(require("./pluginApi"), exports);
|
|
20
|
-
__exportStar(require("./types"), exports);
|
package/lib/page/createPage.d.ts
DELETED
package/lib/page/createPage.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPage = void 0;
|
|
4
|
-
const inferPagePath_1 = require("./inferPagePath");
|
|
5
|
-
const renderPageContent_1 = require("./renderPageContent");
|
|
6
|
-
const renderPageExcerpt_1 = require("./renderPageExcerpt");
|
|
7
|
-
const resolvePageComponentInfo_1 = require("./resolvePageComponentInfo");
|
|
8
|
-
const resolvePageContent_1 = require("./resolvePageContent");
|
|
9
|
-
const resolvePageDataInfo_1 = require("./resolvePageDataInfo");
|
|
10
|
-
const resolvePageDate_1 = require("./resolvePageDate");
|
|
11
|
-
const resolvePageFileContent_1 = require("./resolvePageFileContent");
|
|
12
|
-
const resolvePageFilePath_1 = require("./resolvePageFilePath");
|
|
13
|
-
const resolvePageFrontmatter_1 = require("./resolvePageFrontmatter");
|
|
14
|
-
const resolvePageHtmlInfo_1 = require("./resolvePageHtmlInfo");
|
|
15
|
-
const resolvePageKey_1 = require("./resolvePageKey");
|
|
16
|
-
const resolvePageLang_1 = require("./resolvePageLang");
|
|
17
|
-
const resolvePagePath_1 = require("./resolvePagePath");
|
|
18
|
-
const resolvePagePermalink_1 = require("./resolvePagePermalink");
|
|
19
|
-
const resolvePageRouteMeta_1 = require("./resolvePageRouteMeta");
|
|
20
|
-
const resolvePageSlug_1 = require("./resolvePageSlug");
|
|
21
|
-
const createPage = async (app, options) => {
|
|
22
|
-
// plugin hook: extendsPageOptions
|
|
23
|
-
await app.pluginApi.hooks.extendsPageOptions.process(options, app);
|
|
24
|
-
// resolve page file absolute path and relative path
|
|
25
|
-
const { filePath, filePathRelative } = (0, resolvePageFilePath_1.resolvePageFilePath)({
|
|
26
|
-
app,
|
|
27
|
-
options,
|
|
28
|
-
});
|
|
29
|
-
// read the raw file content according to the absolute file path
|
|
30
|
-
const contentRaw = await (0, resolvePageFileContent_1.resolvePageFileContent)({ filePath, options });
|
|
31
|
-
// resolve content & frontmatter & raw excerpt from raw content
|
|
32
|
-
const { content, frontmatterRaw, excerptRaw } = (0, resolvePageContent_1.resolvePageContent)({
|
|
33
|
-
contentRaw,
|
|
34
|
-
});
|
|
35
|
-
// resolve frontmatter from raw frontmatter and page options
|
|
36
|
-
const frontmatter = (0, resolvePageFrontmatter_1.resolvePageFrontmatter)({ frontmatterRaw, options });
|
|
37
|
-
// render excerpt
|
|
38
|
-
const excerpt = (0, renderPageExcerpt_1.renderPageExcerpt)({
|
|
39
|
-
app,
|
|
40
|
-
excerptRaw,
|
|
41
|
-
filePath,
|
|
42
|
-
filePathRelative,
|
|
43
|
-
frontmatter,
|
|
44
|
-
});
|
|
45
|
-
// render page content and extract information
|
|
46
|
-
const { contentRendered, deps, headers, hoistedTags, links, title } = await (0, renderPageContent_1.renderPageContent)({
|
|
47
|
-
app,
|
|
48
|
-
content,
|
|
49
|
-
filePath,
|
|
50
|
-
filePathRelative,
|
|
51
|
-
frontmatter,
|
|
52
|
-
});
|
|
53
|
-
// resolve route meta from frontmatter
|
|
54
|
-
const routeMeta = (0, resolvePageRouteMeta_1.resolvePageRouteMeta)({ frontmatter });
|
|
55
|
-
// resolve slug from file path
|
|
56
|
-
const slug = (0, resolvePageSlug_1.resolvePageSlug)({ filePathRelative });
|
|
57
|
-
// resolve date from file path
|
|
58
|
-
const date = (0, resolvePageDate_1.resolvePageDate)({ frontmatter, filePathRelative });
|
|
59
|
-
// infer page path according to file path
|
|
60
|
-
const { pathInferred, pathLocale } = (0, inferPagePath_1.inferPagePath)({ app, filePathRelative });
|
|
61
|
-
// resolve language from frontmatter and site options
|
|
62
|
-
const lang = (0, resolvePageLang_1.resolvePageLang)({ app, frontmatter, pathLocale });
|
|
63
|
-
// resolve page permalink
|
|
64
|
-
const permalink = (0, resolvePagePermalink_1.resolvePagePermalink)({
|
|
65
|
-
app,
|
|
66
|
-
frontmatter,
|
|
67
|
-
slug,
|
|
68
|
-
date,
|
|
69
|
-
pathInferred,
|
|
70
|
-
pathLocale,
|
|
71
|
-
});
|
|
72
|
-
// resolve page path
|
|
73
|
-
const path = (0, resolvePagePath_1.resolvePagePath)({ permalink, pathInferred, options });
|
|
74
|
-
// resolve page key
|
|
75
|
-
const key = (0, resolvePageKey_1.resolvePageKey)({ path });
|
|
76
|
-
// resolve page rendered html file path
|
|
77
|
-
const { htmlFilePath, htmlFilePathRelative } = (0, resolvePageHtmlInfo_1.resolvePageHtmlInfo)({
|
|
78
|
-
app,
|
|
79
|
-
path,
|
|
80
|
-
});
|
|
81
|
-
// resolve page component and extract headers & links
|
|
82
|
-
const { componentFilePath, componentFilePathRelative, componentFileChunkName, } = await (0, resolvePageComponentInfo_1.resolvePageComponentInfo)({
|
|
83
|
-
app,
|
|
84
|
-
htmlFilePathRelative,
|
|
85
|
-
key,
|
|
86
|
-
});
|
|
87
|
-
const { dataFilePath, dataFilePathRelative, dataFileChunkName } = (0, resolvePageDataInfo_1.resolvePageDataInfo)({ app, htmlFilePathRelative, key });
|
|
88
|
-
const page = {
|
|
89
|
-
// page data
|
|
90
|
-
data: {
|
|
91
|
-
key,
|
|
92
|
-
path,
|
|
93
|
-
title,
|
|
94
|
-
lang,
|
|
95
|
-
frontmatter,
|
|
96
|
-
excerpt,
|
|
97
|
-
headers,
|
|
98
|
-
},
|
|
99
|
-
// base fields
|
|
100
|
-
key,
|
|
101
|
-
path,
|
|
102
|
-
title,
|
|
103
|
-
lang,
|
|
104
|
-
frontmatter,
|
|
105
|
-
excerpt,
|
|
106
|
-
headers,
|
|
107
|
-
// extra fields
|
|
108
|
-
content,
|
|
109
|
-
contentRendered,
|
|
110
|
-
date,
|
|
111
|
-
deps,
|
|
112
|
-
hoistedTags,
|
|
113
|
-
links,
|
|
114
|
-
pathInferred,
|
|
115
|
-
pathLocale,
|
|
116
|
-
permalink,
|
|
117
|
-
routeMeta,
|
|
118
|
-
slug,
|
|
119
|
-
// file info
|
|
120
|
-
filePath,
|
|
121
|
-
filePathRelative,
|
|
122
|
-
componentFilePath,
|
|
123
|
-
componentFilePathRelative,
|
|
124
|
-
componentFileChunkName,
|
|
125
|
-
dataFilePath,
|
|
126
|
-
dataFilePathRelative,
|
|
127
|
-
dataFileChunkName,
|
|
128
|
-
htmlFilePath,
|
|
129
|
-
htmlFilePathRelative,
|
|
130
|
-
};
|
|
131
|
-
// plugin hook: extendsPage
|
|
132
|
-
await app.pluginApi.hooks.extendsPage.process(page, app);
|
|
133
|
-
return page;
|
|
134
|
-
};
|
|
135
|
-
exports.createPage = createPage;
|
package/lib/page/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export * from './createPage';
|
|
2
|
-
export * from './inferPagePath';
|
|
3
|
-
export * from './renderPageContent';
|
|
4
|
-
export * from './renderPageExcerpt';
|
|
5
|
-
export * from './resolvePageComponentInfo';
|
|
6
|
-
export * from './resolvePageContent';
|
|
7
|
-
export * from './resolvePageDataInfo';
|
|
8
|
-
export * from './resolvePageDate';
|
|
9
|
-
export * from './resolvePageFileContent';
|
|
10
|
-
export * from './resolvePageFilePath';
|
|
11
|
-
export * from './resolvePageFrontmatter';
|
|
12
|
-
export * from './resolvePageHtmlInfo';
|
|
13
|
-
export * from './resolvePageKey';
|
|
14
|
-
export * from './resolvePageLang';
|
|
15
|
-
export * from './resolvePagePath';
|
|
16
|
-
export * from './resolvePagePermalink';
|
|
17
|
-
export * from './resolvePageRouteMeta';
|
|
18
|
-
export * from './resolvePageSlug';
|
package/lib/page/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./createPage"), exports);
|
|
18
|
-
__exportStar(require("./inferPagePath"), exports);
|
|
19
|
-
__exportStar(require("./renderPageContent"), exports);
|
|
20
|
-
__exportStar(require("./renderPageExcerpt"), exports);
|
|
21
|
-
__exportStar(require("./resolvePageComponentInfo"), exports);
|
|
22
|
-
__exportStar(require("./resolvePageContent"), exports);
|
|
23
|
-
__exportStar(require("./resolvePageDataInfo"), exports);
|
|
24
|
-
__exportStar(require("./resolvePageDate"), exports);
|
|
25
|
-
__exportStar(require("./resolvePageFileContent"), exports);
|
|
26
|
-
__exportStar(require("./resolvePageFilePath"), exports);
|
|
27
|
-
__exportStar(require("./resolvePageFrontmatter"), exports);
|
|
28
|
-
__exportStar(require("./resolvePageHtmlInfo"), exports);
|
|
29
|
-
__exportStar(require("./resolvePageKey"), exports);
|
|
30
|
-
__exportStar(require("./resolvePageLang"), exports);
|
|
31
|
-
__exportStar(require("./resolvePagePath"), exports);
|
|
32
|
-
__exportStar(require("./resolvePagePermalink"), exports);
|
|
33
|
-
__exportStar(require("./resolvePageRouteMeta"), exports);
|
|
34
|
-
__exportStar(require("./resolvePageSlug"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { App } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Infer page path according to file path
|
|
4
|
-
*/
|
|
5
|
-
export declare const inferPagePath: ({ app, filePathRelative, }: {
|
|
6
|
-
app: App;
|
|
7
|
-
filePathRelative: string | null;
|
|
8
|
-
}) => {
|
|
9
|
-
pathInferred: string | null;
|
|
10
|
-
pathLocale: string;
|
|
11
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inferPagePath = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
/**
|
|
6
|
-
* Infer page path according to file path
|
|
7
|
-
*/
|
|
8
|
-
const inferPagePath = ({ app, filePathRelative, }) => {
|
|
9
|
-
if (!filePathRelative) {
|
|
10
|
-
return {
|
|
11
|
-
pathInferred: null,
|
|
12
|
-
pathLocale: '/',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
// infer page route path from file path
|
|
16
|
-
// foo/bar.md -> /foo/bar.html
|
|
17
|
-
const pathInferred = (0, shared_1.ensureLeadingSlash)(filePathRelative)
|
|
18
|
-
.replace(/\.md$/, '.html')
|
|
19
|
-
.replace(/\/(README|index).html$/i, '/');
|
|
20
|
-
// resolve page locale path
|
|
21
|
-
const pathLocale = (0, shared_1.resolveLocalePath)(app.siteData.locales, pathInferred);
|
|
22
|
-
return {
|
|
23
|
-
pathInferred,
|
|
24
|
-
pathLocale,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.inferPagePath = inferPagePath;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { MarkdownHeader, MarkdownLink } from '@vuepress/markdown';
|
|
2
|
-
import type { App, PageFrontmatter } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Render page content and extract related info
|
|
5
|
-
*/
|
|
6
|
-
export declare const renderPageContent: ({ app, content, frontmatter, filePath, filePathRelative, }: {
|
|
7
|
-
app: App;
|
|
8
|
-
content: string;
|
|
9
|
-
frontmatter: PageFrontmatter;
|
|
10
|
-
filePath: string | null;
|
|
11
|
-
filePathRelative: string | null;
|
|
12
|
-
}) => Promise<{
|
|
13
|
-
contentRendered: string;
|
|
14
|
-
deps: string[];
|
|
15
|
-
headers: MarkdownHeader[];
|
|
16
|
-
hoistedTags: string[];
|
|
17
|
-
links: MarkdownLink[];
|
|
18
|
-
title: string;
|
|
19
|
-
}>;
|