@vuepress/core 2.0.0-beta.28 → 2.0.0-beta.34
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/lib/app/appInit.js +4 -4
- package/lib/app/appUse.js +2 -2
- package/lib/app/createBaseApp.js +23 -23
- package/lib/app/index.d.ts +9 -9
- package/lib/app/index.js +9 -9
- package/lib/app/{createAppDir.d.ts → resolveAppDir.d.ts} +2 -2
- package/lib/app/{createAppDir.js → resolveAppDir.js} +4 -4
- package/lib/app/resolveAppEnv.d.ts +5 -0
- package/lib/app/resolveAppEnv.js +12 -0
- package/lib/app/resolveAppMarkdown.d.ts +6 -0
- package/lib/app/{createAppMarkdown.js → resolveAppMarkdown.js} +4 -4
- package/lib/app/resolveAppOptions.d.ts +5 -0
- package/lib/app/{createAppOptions.js → resolveAppOptions.js} +7 -7
- package/lib/app/resolveAppPages.d.ts +5 -0
- package/lib/app/{createAppPages.js → resolveAppPages.js} +7 -15
- package/lib/app/resolveAppSiteData.d.ts +7 -0
- package/lib/app/{createAppSiteData.js → resolveAppSiteData.js} +4 -4
- package/lib/app/resolveAppVersion.d.ts +4 -0
- package/lib/app/resolveAppVersion.js +10 -0
- package/lib/app/resolveAppWriteTemp.d.ts +5 -0
- package/lib/app/{createAppWriteTemp.js → resolveAppWriteTemp.js} +4 -4
- package/lib/app/resolvePluginObject.d.ts +5 -0
- package/lib/app/{resolvePlugin.js → resolvePluginObject.js} +5 -5
- package/lib/app/resolvePluginsFromConfig.d.ts +1 -1
- package/lib/app/resolvePluginsFromConfig.js +3 -3
- package/lib/app/resolveThemeInfo.d.ts +2 -2
- package/lib/app/resolveThemeInfo.js +15 -7
- package/lib/app/resolveThemeObject.d.ts +5 -0
- package/lib/app/resolveThemeObject.js +22 -0
- package/lib/app/setupAppPlugins.d.ts +5 -0
- package/lib/app/setupAppPlugins.js +14 -0
- package/lib/app/setupAppTheme.d.ts +5 -0
- package/lib/app/setupAppTheme.js +21 -0
- package/lib/page/createPage.js +4 -0
- package/lib/pluginApi/createHookQueue.js +1 -1
- package/lib/types/app/app.d.ts +10 -10
- package/lib/types/app/options.d.ts +36 -25
- package/lib/types/theme.d.ts +28 -0
- package/package.json +6 -6
- package/lib/app/createAppEnv.d.ts +0 -5
- package/lib/app/createAppEnv.js +0 -12
- package/lib/app/createAppMarkdown.d.ts +0 -6
- package/lib/app/createAppOptions.d.ts +0 -5
- package/lib/app/createAppPages.d.ts +0 -5
- package/lib/app/createAppSiteData.d.ts +0 -7
- package/lib/app/createAppVersion.d.ts +0 -4
- package/lib/app/createAppVersion.js +0 -10
- package/lib/app/createAppWriteTemp.d.ts +0 -5
- package/lib/app/resolvePlugin.d.ts +0 -5
- package/lib/app/resolveTheme.d.ts +0 -5
- package/lib/app/resolveTheme.js +0 -22
package/lib/app/appInit.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.appInit = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const resolveAppMarkdown_1 = require("./resolveAppMarkdown");
|
|
6
|
+
const resolveAppPages_1 = require("./resolveAppPages");
|
|
7
7
|
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
8
8
|
/**
|
|
9
9
|
* Initialize a vuepress app
|
|
@@ -17,9 +17,9 @@ const appInit = async (app) => {
|
|
|
17
17
|
// hooks in plugins will take effect after `registerHooks()`
|
|
18
18
|
app.pluginApi.registerHooks();
|
|
19
19
|
// create markdown
|
|
20
|
-
app.markdown = await (0,
|
|
20
|
+
app.markdown = await (0, resolveAppMarkdown_1.resolveAppMarkdown)(app);
|
|
21
21
|
// create pages
|
|
22
|
-
app.pages = await (0,
|
|
22
|
+
app.pages = await (0, resolveAppPages_1.resolveAppPages)(app);
|
|
23
23
|
// plugin hook: onInitialized
|
|
24
24
|
await app.pluginApi.hooks.onInitialized.process(app);
|
|
25
25
|
log('init finish');
|
package/lib/app/appUse.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.appUse = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
const
|
|
5
|
+
const resolvePluginObject_1 = require("./resolvePluginObject");
|
|
6
6
|
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
7
|
const appUse = (app, rawPlugin, config) => {
|
|
8
|
-
const plugin = (0,
|
|
8
|
+
const plugin = (0, resolvePluginObject_1.resolvePluginObject)(app, rawPlugin, config);
|
|
9
9
|
log(`use plugin ${utils_1.chalk.magenta(plugin.name)}`);
|
|
10
10
|
if (plugin.multiple !== true) {
|
|
11
11
|
// remove duplicated plugin
|
package/lib/app/createBaseApp.js
CHANGED
|
@@ -5,44 +5,44 @@ const pluginApi_1 = require("../pluginApi");
|
|
|
5
5
|
const appInit_1 = require("./appInit");
|
|
6
6
|
const appPrepare_1 = require("./appPrepare");
|
|
7
7
|
const appUse_1 = require("./appUse");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
8
|
+
const resolveAppDir_1 = require("./resolveAppDir");
|
|
9
|
+
const resolveAppEnv_1 = require("./resolveAppEnv");
|
|
10
|
+
const resolveAppOptions_1 = require("./resolveAppOptions");
|
|
11
|
+
const resolveAppSiteData_1 = require("./resolveAppSiteData");
|
|
12
|
+
const resolveAppVersion_1 = require("./resolveAppVersion");
|
|
13
|
+
const resolveAppWriteTemp_1 = require("./resolveAppWriteTemp");
|
|
14
|
+
const setupAppPlugins_1 = require("./setupAppPlugins");
|
|
15
|
+
const setupAppTheme_1 = require("./setupAppTheme");
|
|
16
16
|
/**
|
|
17
17
|
* Create vuepress app
|
|
18
18
|
*/
|
|
19
19
|
const createBaseApp = (config, isBuild = false) => {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const env = (0, createAppEnv_1.createAppEnv)(options, isBuild);
|
|
24
|
-
const siteData = (0, createAppSiteData_1.createAppSiteData)(options);
|
|
20
|
+
const options = (0, resolveAppOptions_1.resolveAppOptions)(config);
|
|
21
|
+
const dir = (0, resolveAppDir_1.resolveAppDir)(options);
|
|
22
|
+
const env = (0, resolveAppEnv_1.resolveAppEnv)(options, isBuild);
|
|
25
23
|
const pluginApi = (0, pluginApi_1.createPluginApi)();
|
|
26
|
-
const
|
|
24
|
+
const siteData = (0, resolveAppSiteData_1.resolveAppSiteData)(options);
|
|
25
|
+
const version = (0, resolveAppVersion_1.resolveAppVersion)();
|
|
26
|
+
const writeTemp = (0, resolveAppWriteTemp_1.resolveAppWriteTemp)(dir);
|
|
27
27
|
const app = {
|
|
28
|
-
version,
|
|
29
28
|
options,
|
|
29
|
+
siteData,
|
|
30
|
+
version,
|
|
31
|
+
// utils
|
|
30
32
|
dir,
|
|
31
33
|
env,
|
|
32
|
-
siteData,
|
|
33
34
|
pluginApi,
|
|
34
35
|
writeTemp,
|
|
36
|
+
// methods
|
|
35
37
|
use: (...args) => (0, appUse_1.appUse)(app, ...args),
|
|
36
38
|
init: () => (0, appInit_1.appInit)(app),
|
|
37
39
|
prepare: () => (0, appPrepare_1.appPrepare)(app),
|
|
38
40
|
};
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
app
|
|
43
|
-
|
|
44
|
-
const plugins = (0, resolvePluginsFromConfig_1.resolvePluginsFromConfig)(app, options.plugins);
|
|
45
|
-
plugins.forEach((plugin) => app.use(plugin));
|
|
41
|
+
// setup theme and plugins
|
|
42
|
+
// notice that we setup theme before plugins,
|
|
43
|
+
// so user plugins could override theme plugins
|
|
44
|
+
(0, setupAppTheme_1.setupAppTheme)(app, config);
|
|
45
|
+
(0, setupAppPlugins_1.setupAppPlugins)(app);
|
|
46
46
|
return app;
|
|
47
47
|
};
|
|
48
48
|
exports.createBaseApp = createBaseApp;
|
package/lib/app/index.d.ts
CHANGED
|
@@ -2,21 +2,21 @@ export * from './prepare';
|
|
|
2
2
|
export * from './appInit';
|
|
3
3
|
export * from './appPrepare';
|
|
4
4
|
export * from './appUse';
|
|
5
|
-
export * from './createAppDir';
|
|
6
|
-
export * from './createAppEnv';
|
|
7
|
-
export * from './createAppOptions';
|
|
8
|
-
export * from './createAppPages';
|
|
9
|
-
export * from './createAppSiteData';
|
|
10
|
-
export * from './createAppVersion';
|
|
11
|
-
export * from './createAppWriteTemp';
|
|
12
5
|
export * from './createBaseApp';
|
|
13
6
|
export * from './createBuildApp';
|
|
14
7
|
export * from './createDevApp';
|
|
15
8
|
export * from './normalizePluginConfig';
|
|
9
|
+
export * from './resolveAppDir';
|
|
10
|
+
export * from './resolveAppEnv';
|
|
11
|
+
export * from './resolveAppOptions';
|
|
12
|
+
export * from './resolveAppPages';
|
|
13
|
+
export * from './resolveAppSiteData';
|
|
14
|
+
export * from './resolveAppVersion';
|
|
15
|
+
export * from './resolveAppWriteTemp';
|
|
16
16
|
export * from './resolveBundler';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './resolvePluginObject';
|
|
18
18
|
export * from './resolvePluginModule';
|
|
19
19
|
export * from './resolvePluginsFromConfig';
|
|
20
|
-
export * from './
|
|
20
|
+
export * from './resolveThemeObject';
|
|
21
21
|
export * from './resolveThemeInfo';
|
|
22
22
|
export * from './resolveThemeLayouts';
|
package/lib/app/index.js
CHANGED
|
@@ -14,21 +14,21 @@ __exportStar(require("./prepare"), exports);
|
|
|
14
14
|
__exportStar(require("./appInit"), exports);
|
|
15
15
|
__exportStar(require("./appPrepare"), exports);
|
|
16
16
|
__exportStar(require("./appUse"), exports);
|
|
17
|
-
__exportStar(require("./createAppDir"), exports);
|
|
18
|
-
__exportStar(require("./createAppEnv"), exports);
|
|
19
|
-
__exportStar(require("./createAppOptions"), exports);
|
|
20
|
-
__exportStar(require("./createAppPages"), exports);
|
|
21
|
-
__exportStar(require("./createAppSiteData"), exports);
|
|
22
|
-
__exportStar(require("./createAppVersion"), exports);
|
|
23
|
-
__exportStar(require("./createAppWriteTemp"), exports);
|
|
24
17
|
__exportStar(require("./createBaseApp"), exports);
|
|
25
18
|
__exportStar(require("./createBuildApp"), exports);
|
|
26
19
|
__exportStar(require("./createDevApp"), exports);
|
|
27
20
|
__exportStar(require("./normalizePluginConfig"), exports);
|
|
21
|
+
__exportStar(require("./resolveAppDir"), exports);
|
|
22
|
+
__exportStar(require("./resolveAppEnv"), exports);
|
|
23
|
+
__exportStar(require("./resolveAppOptions"), exports);
|
|
24
|
+
__exportStar(require("./resolveAppPages"), exports);
|
|
25
|
+
__exportStar(require("./resolveAppSiteData"), exports);
|
|
26
|
+
__exportStar(require("./resolveAppVersion"), exports);
|
|
27
|
+
__exportStar(require("./resolveAppWriteTemp"), exports);
|
|
28
28
|
__exportStar(require("./resolveBundler"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./resolvePluginObject"), exports);
|
|
30
30
|
__exportStar(require("./resolvePluginModule"), exports);
|
|
31
31
|
__exportStar(require("./resolvePluginsFromConfig"), exports);
|
|
32
|
-
__exportStar(require("./
|
|
32
|
+
__exportStar(require("./resolveThemeObject"), exports);
|
|
33
33
|
__exportStar(require("./resolveThemeInfo"), exports);
|
|
34
34
|
__exportStar(require("./resolveThemeLayouts"), exports);
|
|
@@ -4,6 +4,6 @@ import type { AppDir, AppDirFunction, AppOptions } from '../types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const createAppDirFunction: (baseDir: string) => AppDirFunction;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Resolve directory utils for vuepress app
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const resolveAppDir: (options: AppOptions) => AppDir;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveAppDir = exports.createAppDirFunction = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
/**
|
|
6
6
|
* Create directory util function
|
|
@@ -10,9 +10,9 @@ const createAppDirFunction = (baseDir) => {
|
|
|
10
10
|
};
|
|
11
11
|
exports.createAppDirFunction = createAppDirFunction;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Resolve directory utils for vuepress app
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
15
|
+
const resolveAppDir = (options) => {
|
|
16
16
|
const cache = (0, exports.createAppDirFunction)(options.cache);
|
|
17
17
|
const temp = (0, exports.createAppDirFunction)(options.temp);
|
|
18
18
|
const source = (0, exports.createAppDirFunction)(options.source);
|
|
@@ -29,4 +29,4 @@ const createAppDir = (options) => {
|
|
|
29
29
|
public: publicDir,
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
exports.
|
|
32
|
+
exports.resolveAppDir = resolveAppDir;
|
|
@@ -0,0 +1,12 @@
|
|
|
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,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveAppMarkdown = void 0;
|
|
4
4
|
const markdown_1 = require("@vuepress/markdown");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Resolve markdown-it instance for vuepress app
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const resolveAppMarkdown = async (app) => {
|
|
9
9
|
// plugin hook: extendsMarkdownOptions
|
|
10
10
|
await app.pluginApi.hooks.extendsMarkdownOptions.process(app.options.markdown, app);
|
|
11
11
|
const markdown = (0, markdown_1.createMarkdown)(app.options.markdown);
|
|
@@ -13,4 +13,4 @@ const createAppMarkdown = async (app) => {
|
|
|
13
13
|
await app.pluginApi.hooks.extendsMarkdown.process(markdown, app);
|
|
14
14
|
return markdown;
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
16
|
+
exports.resolveAppMarkdown = resolveAppMarkdown;
|
|
@@ -0,0 +1,5 @@
|
|
|
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, theme, themeConfig, bundler, bundlerConfig, source, dest, temp, cache, public: publicDir, markdown, host, port, debug, open, pagePatterns, templateDev, templateBuild, shouldPreload, shouldPrefetch, plugins, }: AppConfig) => AppOptions;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveAppOptions = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
/**
|
|
6
6
|
* Create app options with default values
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const resolveAppOptions = ({
|
|
9
9
|
// site config
|
|
10
10
|
base = '/', lang = 'en-US', title = '', description = '', head = [], locales = {},
|
|
11
11
|
// theme config
|
|
12
|
-
theme = '@vuepress/default', themeConfig = {},
|
|
12
|
+
theme = '@vuepress/theme-default', themeConfig = {},
|
|
13
13
|
// bundler config
|
|
14
|
-
bundler = '@vuepress/
|
|
14
|
+
bundler = '@vuepress/bundler-vite', bundlerConfig = {},
|
|
15
15
|
// directory config
|
|
16
16
|
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'),
|
|
17
17
|
// markdown config
|
|
18
18
|
markdown = {},
|
|
19
19
|
// development config
|
|
20
|
-
host = '0.0.0.0', port = 8080, debug = false, open = false, pagePatterns = ['**/*.md', '!.vuepress', '!node_modules'], templateDev = utils_1.path.normalize(require.resolve('@vuepress/client/templates/index.dev.html')),
|
|
20
|
+
host = '0.0.0.0', port = 8080, debug = false, open = false, pagePatterns = ['**/*.md', '!.vuepress', '!node_modules'], templateDev = utils_1.path.normalize(require.resolve('@vuepress/client/templates/index.dev.html')), templateBuild = utils_1.path.normalize(require.resolve('@vuepress/client/templates/index.build.html')), shouldPreload = true, shouldPrefetch = false,
|
|
21
21
|
// plugin config
|
|
22
22
|
plugins = [], }) => ({
|
|
23
23
|
base,
|
|
@@ -42,9 +42,9 @@ plugins = [], }) => ({
|
|
|
42
42
|
open,
|
|
43
43
|
pagePatterns,
|
|
44
44
|
templateDev,
|
|
45
|
-
|
|
45
|
+
templateBuild,
|
|
46
46
|
shouldPreload,
|
|
47
47
|
shouldPrefetch,
|
|
48
48
|
plugins,
|
|
49
49
|
});
|
|
50
|
-
exports.
|
|
50
|
+
exports.resolveAppOptions = resolveAppOptions;
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveAppPages = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const page_1 = require("../page");
|
|
6
6
|
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Resolve pages for vuepress app
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
11
|
-
log('
|
|
10
|
+
const resolveAppPages = async (app) => {
|
|
11
|
+
log('resolveAppPages start');
|
|
12
12
|
// resolve page absolute file paths according to the page patterns
|
|
13
13
|
const pageFilePaths = await (0, utils_1.globby)(app.options.pagePatterns, {
|
|
14
14
|
absolute: true,
|
|
15
15
|
cwd: app.dir.source(),
|
|
16
16
|
});
|
|
17
17
|
// create pages from files
|
|
18
|
-
const pages = await Promise.all(pageFilePaths.map(
|
|
19
|
-
const pageOptions = { filePath };
|
|
20
|
-
// plugin hook: extendsPageOptions
|
|
21
|
-
await app.pluginApi.hooks.extendsPageOptions.process(pageOptions, app);
|
|
22
|
-
const page = await (0, page_1.createPage)(app, pageOptions);
|
|
23
|
-
// plugin hook: extendsPage
|
|
24
|
-
await app.pluginApi.hooks.extendsPage.process(page, app);
|
|
25
|
-
return page;
|
|
26
|
-
}));
|
|
18
|
+
const pages = await Promise.all(pageFilePaths.map((filePath) => (0, page_1.createPage)(app, { filePath })));
|
|
27
19
|
// if there is no 404 page, add one
|
|
28
20
|
if (!pages.some((page) => page.path === '/404.html')) {
|
|
29
21
|
pages.push(await (0, page_1.createPage)(app, {
|
|
@@ -33,7 +25,7 @@ const createAppPages = async (app) => {
|
|
|
33
25
|
},
|
|
34
26
|
}));
|
|
35
27
|
}
|
|
36
|
-
log('
|
|
28
|
+
log('resolveAppPages finish');
|
|
37
29
|
return pages;
|
|
38
30
|
};
|
|
39
|
-
exports.
|
|
31
|
+
exports.resolveAppPages = resolveAppPages;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveAppSiteData = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Resolve site data for vuepress app
|
|
6
6
|
*
|
|
7
7
|
* Site data will also be used in client
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const resolveAppSiteData = (options) => ({
|
|
10
10
|
base: options.base,
|
|
11
11
|
lang: options.lang,
|
|
12
12
|
title: options.title,
|
|
@@ -14,4 +14,4 @@ const createAppSiteData = (options) => ({
|
|
|
14
14
|
head: options.head,
|
|
15
15
|
locales: options.locales,
|
|
16
16
|
});
|
|
17
|
-
exports.
|
|
17
|
+
exports.resolveAppSiteData = resolveAppSiteData;
|
|
@@ -0,0 +1,10 @@
|
|
|
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,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveAppWriteTemp = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Resolve write temp file util for vuepress app
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const resolveAppWriteTemp = (dir) => {
|
|
9
9
|
const tempCache = new Map();
|
|
10
10
|
const writeTemp = async (file, content) => {
|
|
11
11
|
const filePath = dir.temp(file);
|
|
@@ -18,4 +18,4 @@ const createAppWriteTemp = (dir) => {
|
|
|
18
18
|
};
|
|
19
19
|
return writeTemp;
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
21
|
+
exports.resolveAppWriteTemp = resolveAppWriteTemp;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { App, Plugin, PluginObject, PluginOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a plugin object according to name / path / module and config
|
|
4
|
+
*/
|
|
5
|
+
export declare const resolvePluginObject: <T extends PluginOptions = PluginOptions, U extends PluginObject = PluginObject>(app: App, plugin: string | Plugin<T, U>, pluginConfig?: Partial<T>) => U;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolvePluginObject = void 0;
|
|
4
4
|
const shared_1 = require("@vuepress/shared");
|
|
5
5
|
const utils_1 = require("@vuepress/utils");
|
|
6
6
|
const resolvePluginModule_1 = require("./resolvePluginModule");
|
|
7
7
|
/**
|
|
8
|
-
* Resolve a plugin according to name / path / module and config
|
|
8
|
+
* Resolve a plugin object according to name / path / module and config
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const resolvePluginObject = (app, plugin, pluginConfig = {}) => {
|
|
11
11
|
const pluginModule = (0, shared_1.isString)(plugin)
|
|
12
12
|
? (0, resolvePluginModule_1.resolvePluginModule)(plugin)
|
|
13
13
|
: plugin;
|
|
@@ -15,8 +15,8 @@ const resolvePlugin = (app, plugin, config = {}) => {
|
|
|
15
15
|
throw utils_1.logger.createError(`plugin is not found: ${utils_1.chalk.magenta(plugin)}`);
|
|
16
16
|
}
|
|
17
17
|
const pluginObject = (0, shared_1.isFunction)(pluginModule)
|
|
18
|
-
? pluginModule(
|
|
18
|
+
? pluginModule(pluginConfig, app)
|
|
19
19
|
: pluginModule;
|
|
20
20
|
return pluginObject;
|
|
21
21
|
};
|
|
22
|
-
exports.
|
|
22
|
+
exports.resolvePluginObject = resolvePluginObject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { App, PluginConfig, PluginObject } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Resolve
|
|
3
|
+
* Resolve plugin objects from plugin config array
|
|
4
4
|
*/
|
|
5
5
|
export declare const resolvePluginsFromConfig: (app: App, plugins?: PluginConfig[]) => PluginObject[];
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolvePluginsFromConfig = void 0;
|
|
4
4
|
const normalizePluginConfig_1 = require("./normalizePluginConfig");
|
|
5
|
-
const
|
|
5
|
+
const resolvePluginObject_1 = require("./resolvePluginObject");
|
|
6
6
|
/**
|
|
7
|
-
* Resolve
|
|
7
|
+
* Resolve plugin objects from plugin config array
|
|
8
8
|
*/
|
|
9
9
|
const resolvePluginsFromConfig = (app, plugins = []) => plugins.reduce((prev, item) => {
|
|
10
10
|
const [plugin, config] = (0, normalizePluginConfig_1.normalizePluginConfig)(item);
|
|
11
11
|
if (config !== false) {
|
|
12
|
-
prev.push((0,
|
|
12
|
+
prev.push((0, resolvePluginObject_1.resolvePluginObject)(app, plugin, config === true ? {} : config));
|
|
13
13
|
}
|
|
14
14
|
return prev;
|
|
15
15
|
}, []);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { App, ThemeInfo } from '../types';
|
|
1
|
+
import type { App, ThemeConfig, ThemeInfo } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Resolve theme info and its parent theme info
|
|
4
4
|
*/
|
|
5
|
-
export declare const resolveThemeInfo: (app: App,
|
|
5
|
+
export declare const resolveThemeInfo: (app: App, theme: string, themeConfig: ThemeConfig) => ThemeInfo;
|
|
@@ -2,27 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveThemeInfo = void 0;
|
|
4
4
|
const resolvePluginsFromConfig_1 = require("./resolvePluginsFromConfig");
|
|
5
|
-
const resolveTheme_1 = require("./resolveTheme");
|
|
6
5
|
const resolveThemeLayouts_1 = require("./resolveThemeLayouts");
|
|
6
|
+
const resolveThemeObject_1 = require("./resolveThemeObject");
|
|
7
7
|
/**
|
|
8
8
|
* Resolve theme info and its parent theme info
|
|
9
9
|
*/
|
|
10
|
-
const resolveThemeInfo = (app,
|
|
10
|
+
const resolveThemeInfo = (app, theme, themeConfig) => {
|
|
11
|
+
var _a, _b;
|
|
11
12
|
// resolve current theme info
|
|
12
|
-
const
|
|
13
|
+
const themeObject = (0, resolveThemeObject_1.resolveThemeObject)(app, theme, themeConfig);
|
|
13
14
|
const themeInfo = {
|
|
14
|
-
layouts: (0, resolveThemeLayouts_1.resolveThemeLayouts)(
|
|
15
|
-
plugins: [
|
|
15
|
+
layouts: (0, resolveThemeLayouts_1.resolveThemeLayouts)(themeObject.layouts),
|
|
16
|
+
plugins: [
|
|
17
|
+
...(0, resolvePluginsFromConfig_1.resolvePluginsFromConfig)(app, themeObject.plugins),
|
|
18
|
+
themeObject,
|
|
19
|
+
],
|
|
20
|
+
templateBuild: themeObject.templateBuild,
|
|
21
|
+
templateDev: themeObject.templateDev,
|
|
16
22
|
};
|
|
17
23
|
// return if current theme does not have a parent theme
|
|
18
|
-
if (!
|
|
24
|
+
if (!themeObject.extends) {
|
|
19
25
|
return themeInfo;
|
|
20
26
|
}
|
|
21
27
|
// resolve parent theme info recursively
|
|
22
|
-
const parentThemeInfo = (0, exports.resolveThemeInfo)(app,
|
|
28
|
+
const parentThemeInfo = (0, exports.resolveThemeInfo)(app, themeObject.extends, themeConfig);
|
|
23
29
|
return {
|
|
24
30
|
layouts: { ...parentThemeInfo.layouts, ...themeInfo.layouts },
|
|
25
31
|
plugins: [...parentThemeInfo.plugins, ...themeInfo.plugins],
|
|
32
|
+
templateBuild: (_a = themeObject.templateBuild) !== null && _a !== void 0 ? _a : parentThemeInfo.templateBuild,
|
|
33
|
+
templateDev: (_b = themeObject.templateDev) !== null && _b !== void 0 ? _b : parentThemeInfo.templateDev,
|
|
26
34
|
};
|
|
27
35
|
};
|
|
28
36
|
exports.resolveThemeInfo = resolveThemeInfo;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveThemeObject = void 0;
|
|
4
|
+
const shared_1 = require("@vuepress/shared");
|
|
5
|
+
const utils_1 = require("@vuepress/utils");
|
|
6
|
+
const resolvePluginObject_1 = require("./resolvePluginObject");
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a theme object according to the theme name
|
|
9
|
+
*/
|
|
10
|
+
const resolveThemeObject = (app, theme, themeConfig) => {
|
|
11
|
+
// resolve theme entry according to theme name
|
|
12
|
+
const themeEntry = (0, utils_1.requireResolve)(utils_1.path.isAbsolute(theme)
|
|
13
|
+
? theme
|
|
14
|
+
: (0, shared_1.normalizePackageName)(theme, 'vuepress', 'theme'));
|
|
15
|
+
if (themeEntry === null) {
|
|
16
|
+
throw utils_1.logger.createError(`theme is not found: ${utils_1.chalk.magenta(theme)}`);
|
|
17
|
+
}
|
|
18
|
+
// resolve theme object from theme entry
|
|
19
|
+
const themeObject = (0, resolvePluginObject_1.resolvePluginObject)(app, themeEntry, themeConfig);
|
|
20
|
+
return themeObject;
|
|
21
|
+
};
|
|
22
|
+
exports.resolveThemeObject = resolveThemeObject;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupAppPlugins = void 0;
|
|
4
|
+
const resolvePluginsFromConfig_1 = require("./resolvePluginsFromConfig");
|
|
5
|
+
/**
|
|
6
|
+
* Setup plugins for vuepress app
|
|
7
|
+
*/
|
|
8
|
+
const setupAppPlugins = (app) => {
|
|
9
|
+
// resolve plugins from options
|
|
10
|
+
const plugins = (0, resolvePluginsFromConfig_1.resolvePluginsFromConfig)(app, app.options.plugins);
|
|
11
|
+
// use plugins
|
|
12
|
+
plugins.forEach((plugin) => app.use(plugin));
|
|
13
|
+
};
|
|
14
|
+
exports.setupAppPlugins = setupAppPlugins;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupAppTheme = void 0;
|
|
4
|
+
const resolveThemeInfo_1 = require("./resolveThemeInfo");
|
|
5
|
+
/**
|
|
6
|
+
* Setup theme for vuepress app
|
|
7
|
+
*/
|
|
8
|
+
const setupAppTheme = (app, config) => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
// recursively resolve theme info
|
|
11
|
+
const themeInfo = (0, resolveThemeInfo_1.resolveThemeInfo)(app, app.options.theme, app.options.themeConfig);
|
|
12
|
+
// set up app layouts and templates
|
|
13
|
+
app.layouts = themeInfo.layouts;
|
|
14
|
+
app.options.templateDev =
|
|
15
|
+
(_b = (_a = config.templateDev) !== null && _a !== void 0 ? _a : themeInfo.templateDev) !== null && _b !== void 0 ? _b : app.options.templateDev;
|
|
16
|
+
app.options.templateBuild =
|
|
17
|
+
(_d = (_c = config.templateBuild) !== null && _c !== void 0 ? _c : themeInfo.templateBuild) !== null && _d !== void 0 ? _d : app.options.templateBuild;
|
|
18
|
+
// use theme plugins
|
|
19
|
+
themeInfo.plugins.forEach((plugin) => app.use(plugin));
|
|
20
|
+
};
|
|
21
|
+
exports.setupAppTheme = setupAppTheme;
|
package/lib/page/createPage.js
CHANGED
|
@@ -19,6 +19,8 @@ const resolvePagePermalink_1 = require("./resolvePagePermalink");
|
|
|
19
19
|
const resolvePageRouteMeta_1 = require("./resolvePageRouteMeta");
|
|
20
20
|
const resolvePageSlug_1 = require("./resolvePageSlug");
|
|
21
21
|
const createPage = async (app, options) => {
|
|
22
|
+
// plugin hook: extendsPageOptions
|
|
23
|
+
await app.pluginApi.hooks.extendsPageOptions.process(options, app);
|
|
22
24
|
// resolve page file absolute path and relative path
|
|
23
25
|
const { filePath, filePathRelative } = (0, resolvePageFilePath_1.resolvePageFilePath)({
|
|
24
26
|
app,
|
|
@@ -126,6 +128,8 @@ const createPage = async (app, options) => {
|
|
|
126
128
|
htmlFilePath,
|
|
127
129
|
htmlFilePathRelative,
|
|
128
130
|
};
|
|
131
|
+
// plugin hook: extendsPage
|
|
132
|
+
await app.pluginApi.hooks.extendsPage.process(page, app);
|
|
129
133
|
return page;
|
|
130
134
|
};
|
|
131
135
|
exports.createPage = createPage;
|
|
@@ -22,7 +22,7 @@ const createHookQueue = (name) => {
|
|
|
22
22
|
log(`process ${utils_1.chalk.magenta(name)} from ${utils_1.chalk.magenta(item.pluginName)}`);
|
|
23
23
|
try {
|
|
24
24
|
// process and get the result of the the hook item
|
|
25
|
-
// @ts-
|
|
25
|
+
// @ts-expect-error: the types could not be narrowed correctly
|
|
26
26
|
const result = (await item.hook(...args));
|
|
27
27
|
// push the result to results array
|
|
28
28
|
if (result !== undefined) {
|
package/lib/types/app/app.d.ts
CHANGED
|
@@ -10,14 +10,6 @@ import type { AppDir, AppEnv, AppWriteTemp } from './utils';
|
|
|
10
10
|
* Vuepress app
|
|
11
11
|
*/
|
|
12
12
|
export interface App {
|
|
13
|
-
/**
|
|
14
|
-
* Version of vuepress core
|
|
15
|
-
*/
|
|
16
|
-
version: string;
|
|
17
|
-
/**
|
|
18
|
-
* Options that filled all optional fields with a default value
|
|
19
|
-
*/
|
|
20
|
-
options: AppOptions;
|
|
21
13
|
/**
|
|
22
14
|
* Directory utils
|
|
23
15
|
*/
|
|
@@ -27,13 +19,21 @@ export interface App {
|
|
|
27
19
|
*/
|
|
28
20
|
env: AppEnv;
|
|
29
21
|
/**
|
|
30
|
-
*
|
|
22
|
+
* Options that filled all optional fields with a default value
|
|
31
23
|
*/
|
|
32
|
-
|
|
24
|
+
options: AppOptions;
|
|
33
25
|
/**
|
|
34
26
|
* Plugin system
|
|
35
27
|
*/
|
|
36
28
|
pluginApi: PluginApi;
|
|
29
|
+
/**
|
|
30
|
+
* Site data, which will be used in client side
|
|
31
|
+
*/
|
|
32
|
+
siteData: SiteData;
|
|
33
|
+
/**
|
|
34
|
+
* Version of vuepress core
|
|
35
|
+
*/
|
|
36
|
+
version: string;
|
|
37
37
|
/**
|
|
38
38
|
* Write temp file
|
|
39
39
|
*/
|
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
import type { MarkdownOptions } from '@vuepress/markdown';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SiteData } from '@vuepress/shared';
|
|
3
3
|
import type { BundlerConfig } from '../bundler';
|
|
4
4
|
import type { PluginConfig } from '../plugin';
|
|
5
5
|
import type { ThemeConfig } from '../theme';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Config to create vuepress app
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
bundler: string;
|
|
15
|
-
bundlerConfig: Partial<U>;
|
|
9
|
+
export declare type AppConfig<T extends ThemeConfig = ThemeConfig, U extends BundlerConfig = BundlerConfig> = Partial<SiteData> & AppConfigDev & AppConfigBuild & {
|
|
10
|
+
theme?: string;
|
|
11
|
+
themeConfig?: Partial<T>;
|
|
12
|
+
bundler?: string;
|
|
13
|
+
bundlerConfig?: Partial<U>;
|
|
16
14
|
source: string;
|
|
17
|
-
dest
|
|
18
|
-
temp
|
|
19
|
-
cache
|
|
20
|
-
public
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
dest?: string;
|
|
16
|
+
temp?: string;
|
|
17
|
+
cache?: string;
|
|
18
|
+
public?: string;
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
pagePatterns?: string[];
|
|
21
|
+
markdown?: MarkdownOptions;
|
|
22
|
+
plugins?: PluginConfig[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Vuepress app config for dev
|
|
26
|
+
*/
|
|
27
|
+
export interface AppConfigDev {
|
|
28
|
+
host?: string;
|
|
29
|
+
port?: number;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
templateDev?: string;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Vuepress app config for build
|
|
35
|
+
*/
|
|
36
|
+
export interface AppConfigBuild {
|
|
37
|
+
shouldPreload?: ((file: string, type: string) => boolean) | boolean;
|
|
38
|
+
shouldPrefetch?: ((file: string, type: string) => boolean) | boolean;
|
|
39
|
+
templateBuild?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Vuepress app options
|
|
43
|
+
*/
|
|
44
|
+
export declare type AppOptions<T extends ThemeConfig = ThemeConfig, U extends BundlerConfig = BundlerConfig> = Required<AppConfig<T, U>>;
|
package/lib/types/theme.d.ts
CHANGED
|
@@ -17,10 +17,30 @@ export declare type ThemeFunction<T extends ThemeConfig = ThemeConfig> = PluginF
|
|
|
17
17
|
* Vuepress theme object
|
|
18
18
|
*/
|
|
19
19
|
export interface ThemeObject extends PluginObject {
|
|
20
|
+
/**
|
|
21
|
+
* Theme plugin should never be multiple
|
|
22
|
+
*/
|
|
20
23
|
multiple?: false;
|
|
24
|
+
/**
|
|
25
|
+
* Extended parent theme
|
|
26
|
+
*/
|
|
21
27
|
extends?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Specify the layouts directory or components map
|
|
30
|
+
*/
|
|
22
31
|
layouts?: string | Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Allow using plugins in theme
|
|
34
|
+
*/
|
|
23
35
|
plugins?: PluginConfig[];
|
|
36
|
+
/**
|
|
37
|
+
* Allow overriding default templateBuild
|
|
38
|
+
*/
|
|
39
|
+
templateBuild?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Allow overriding default templateDev
|
|
42
|
+
*/
|
|
43
|
+
templateDev?: string;
|
|
24
44
|
}
|
|
25
45
|
/**
|
|
26
46
|
* Theme config to be used in user config file
|
|
@@ -44,4 +64,12 @@ export interface ThemeInfo {
|
|
|
44
64
|
* Plugins, including theme itself and plugins used by theme
|
|
45
65
|
*/
|
|
46
66
|
plugins: PluginObject[];
|
|
67
|
+
/**
|
|
68
|
+
* Default build template
|
|
69
|
+
*/
|
|
70
|
+
templateBuild?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Default dev template
|
|
73
|
+
*/
|
|
74
|
+
templateDev?: string;
|
|
47
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.34",
|
|
4
4
|
"description": "Core package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"clean": "rimraf lib *.tsbuildinfo"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@vuepress/client": "2.0.0-beta.
|
|
30
|
-
"@vuepress/markdown": "2.0.0-beta.
|
|
31
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
32
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
29
|
+
"@vuepress/client": "2.0.0-beta.34",
|
|
30
|
+
"@vuepress/markdown": "2.0.0-beta.33",
|
|
31
|
+
"@vuepress/shared": "2.0.0-beta.33",
|
|
32
|
+
"@vuepress/utils": "2.0.0-beta.33",
|
|
33
33
|
"gray-matter": "^4.0.3",
|
|
34
34
|
"toml": "^3.0.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "aba907994697f4d0a691f2e3668dad4bea388f20"
|
|
40
40
|
}
|
package/lib/app/createAppEnv.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAppEnv = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Create environment flags for vuepress app
|
|
6
|
-
*/
|
|
7
|
-
const createAppEnv = (options, isBuild) => ({
|
|
8
|
-
isBuild,
|
|
9
|
-
isDev: !isBuild,
|
|
10
|
-
isDebug: options.debug,
|
|
11
|
-
});
|
|
12
|
-
exports.createAppEnv = createAppEnv;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AppConfig, AppOptions } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Create app options with default values
|
|
4
|
-
*/
|
|
5
|
-
export declare const createAppOptions: ({ base, lang, title, description, head, locales, theme, themeConfig, bundler, bundlerConfig, source, dest, temp, cache, public: publicDir, markdown, host, port, debug, open, pagePatterns, templateDev, templateSSR, shouldPreload, shouldPrefetch, plugins, }: AppConfig) => AppOptions;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAppVersion = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Create version of vuepress app
|
|
6
|
-
*/
|
|
7
|
-
const createAppVersion = () => {
|
|
8
|
-
return require('../../package.json').version;
|
|
9
|
-
};
|
|
10
|
-
exports.createAppVersion = createAppVersion;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { App, Plugin, PluginObject, PluginOptions } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Resolve a plugin according to name / path / module and config
|
|
4
|
-
*/
|
|
5
|
-
export declare const resolvePlugin: <T extends PluginOptions = PluginOptions, U extends PluginObject = PluginObject>(app: App, plugin: string | Plugin<T, U>, config?: Partial<T>) => U;
|
package/lib/app/resolveTheme.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveTheme = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
const utils_1 = require("@vuepress/utils");
|
|
6
|
-
const resolvePlugin_1 = require("./resolvePlugin");
|
|
7
|
-
/**
|
|
8
|
-
* Resolve a theme according to the theme name
|
|
9
|
-
*/
|
|
10
|
-
const resolveTheme = (app, themeName) => {
|
|
11
|
-
// resolve theme entry according to theme name
|
|
12
|
-
const themeEntry = (0, utils_1.requireResolve)(utils_1.path.isAbsolute(themeName)
|
|
13
|
-
? themeName
|
|
14
|
-
: (0, shared_1.normalizePackageName)(themeName, 'vuepress', 'theme'));
|
|
15
|
-
if (themeEntry === null) {
|
|
16
|
-
throw utils_1.logger.createError(`theme is not found: ${utils_1.chalk.magenta(themeName)}`);
|
|
17
|
-
}
|
|
18
|
-
// resolve theme from theme entry
|
|
19
|
-
const theme = (0, resolvePlugin_1.resolvePlugin)(app, themeEntry, app.options.themeConfig);
|
|
20
|
-
return theme;
|
|
21
|
-
};
|
|
22
|
-
exports.resolveTheme = resolveTheme;
|