@vuepress/core 2.0.0-beta.26 → 2.0.0-beta.27
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 +2 -2
- package/lib/app/appPrepare.js +11 -11
- package/lib/app/appUse.js +3 -3
- package/lib/app/createAppDir.js +6 -6
- package/lib/app/createAppPages.js +4 -4
- package/lib/app/createBaseApp.js +13 -13
- package/lib/app/createBuildApp.d.ts +1 -1
- package/lib/app/createBuildApp.js +2 -2
- package/lib/app/createDevApp.d.ts +1 -1
- package/lib/app/createDevApp.js +2 -2
- package/lib/app/normalizePluginConfig.d.ts +1 -1
- package/lib/app/normalizePluginConfig.js +1 -1
- package/lib/app/prepare/preparePagesRoutes.js +1 -1
- package/lib/app/resolveBundler.js +1 -1
- package/lib/app/resolvePlugin.js +3 -3
- package/lib/app/resolvePluginModule.js +2 -2
- package/lib/app/resolvePluginsFromConfig.js +2 -2
- package/lib/app/resolveTheme.js +3 -3
- package/lib/app/resolveThemeInfo.js +4 -4
- package/lib/app/resolveThemeLayouts.js +1 -1
- package/lib/page/createPage.js +18 -18
- package/lib/page/inferPagePath.js +2 -2
- package/lib/page/resolvePageDate.d.ts +1 -1
- package/lib/page/resolvePageDate.js +5 -5
- package/lib/page/resolvePageFileContent.js +2 -2
- package/lib/page/resolvePageHtmlInfo.js +1 -1
- package/lib/page/resolvePageKey.js +1 -1
- package/lib/page/resolvePageLang.js +1 -1
- package/lib/page/resolvePagePath.js +1 -1
- package/lib/page/resolvePagePermalink.js +3 -3
- package/lib/pluginApi/createHookQueue.js +3 -3
- package/lib/pluginApi/createPluginApi.js +2 -2
- package/lib/pluginApi/createPluginApiHooks.js +12 -12
- package/lib/pluginApi/createPluginApiRegisterHooks.js +5 -5
- package/lib/pluginApi/normalizeClientFilesHook.js +2 -2
- package/lib/pluginApi/normalizeReturnObjectHook.js +1 -1
- package/lib/types/app/app.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +6 -6
package/lib/app/appInit.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.appInit = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const createAppPages_1 = require("./createAppPages");
|
|
6
|
-
const log = utils_1.debug('vuepress:core/app');
|
|
6
|
+
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
7
|
/**
|
|
8
8
|
* Initialize a vuepress app
|
|
9
9
|
*
|
|
@@ -18,7 +18,7 @@ const appInit = async (app) => {
|
|
|
18
18
|
// plugin hook: extendsMarkdown
|
|
19
19
|
await app.pluginApi.hooks.extendsMarkdown.process(app.markdown, app);
|
|
20
20
|
// create pages
|
|
21
|
-
app.pages = await createAppPages_1.createAppPages(app);
|
|
21
|
+
app.pages = await (0, createAppPages_1.createAppPages)(app);
|
|
22
22
|
// plugin hook: onInitialized
|
|
23
23
|
await app.pluginApi.hooks.onInitialized.process(app);
|
|
24
24
|
log('init finish');
|
package/lib/app/appPrepare.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.appPrepare = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const prepare_1 = require("./prepare");
|
|
6
|
-
const log = utils_1.debug('vuepress:core/app');
|
|
6
|
+
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
7
|
/**
|
|
8
8
|
* Prepare files for development or build
|
|
9
9
|
*
|
|
@@ -16,26 +16,26 @@ const appPrepare = async (app) => {
|
|
|
16
16
|
log('prepare start');
|
|
17
17
|
// generate page component files
|
|
18
18
|
for (const page of app.pages) {
|
|
19
|
-
await prepare_1.preparePageComponent(app, page);
|
|
19
|
+
await (0, prepare_1.preparePageComponent)(app, page);
|
|
20
20
|
}
|
|
21
|
-
await prepare_1.preparePagesComponents(app);
|
|
21
|
+
await (0, prepare_1.preparePagesComponents)(app);
|
|
22
22
|
// generate page data files
|
|
23
23
|
for (const page of app.pages) {
|
|
24
|
-
await prepare_1.preparePageData(app, page);
|
|
24
|
+
await (0, prepare_1.preparePageData)(app, page);
|
|
25
25
|
}
|
|
26
|
-
await prepare_1.preparePagesData(app);
|
|
26
|
+
await (0, prepare_1.preparePagesData)(app);
|
|
27
27
|
// generate routes file
|
|
28
|
-
await prepare_1.preparePagesRoutes(app);
|
|
28
|
+
await (0, prepare_1.preparePagesRoutes)(app);
|
|
29
29
|
// generate layout components map file
|
|
30
|
-
await prepare_1.prepareLayoutComponents(app);
|
|
30
|
+
await (0, prepare_1.prepareLayoutComponents)(app);
|
|
31
31
|
// generate site data file
|
|
32
|
-
await prepare_1.prepareSiteData(app);
|
|
32
|
+
await (0, prepare_1.prepareSiteData)(app);
|
|
33
33
|
// generate client app enhances file
|
|
34
|
-
await prepare_1.prepareClientAppEnhances(app);
|
|
34
|
+
await (0, prepare_1.prepareClientAppEnhances)(app);
|
|
35
35
|
// generate client app root components file
|
|
36
|
-
await prepare_1.prepareClientAppRootComponents(app);
|
|
36
|
+
await (0, prepare_1.prepareClientAppRootComponents)(app);
|
|
37
37
|
// generate client app setups file
|
|
38
|
-
await prepare_1.prepareClientAppSetups(app);
|
|
38
|
+
await (0, prepare_1.prepareClientAppSetups)(app);
|
|
39
39
|
// plugin hook: onPrepared
|
|
40
40
|
await app.pluginApi.hooks.onPrepared.process(app);
|
|
41
41
|
log('prepare finish');
|
package/lib/app/appUse.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.appUse = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const resolvePlugin_1 = require("./resolvePlugin");
|
|
6
|
-
const log = utils_1.debug('vuepress:core/app');
|
|
6
|
+
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
7
|
const appUse = (app, rawPlugin, config) => {
|
|
8
|
-
const plugin = resolvePlugin_1.resolvePlugin(app, rawPlugin, config);
|
|
8
|
+
const plugin = (0, resolvePlugin_1.resolvePlugin)(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
|
|
@@ -13,7 +13,7 @@ const appUse = (app, rawPlugin, config) => {
|
|
|
13
13
|
if (duplicateIndex !== -1) {
|
|
14
14
|
app.pluginApi.plugins.splice(duplicateIndex, 1);
|
|
15
15
|
// show warning when duplicate plugins are detected
|
|
16
|
-
utils_1.warn(`plugin ${utils_1.chalk.magenta(plugin.name)} has been used multiple times, only the last one will take effect`);
|
|
16
|
+
(0, utils_1.warn)(`plugin ${utils_1.chalk.magenta(plugin.name)} has been used multiple times, only the last one will take effect`);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
// use plugin
|
package/lib/app/createAppDir.js
CHANGED
|
@@ -13,13 +13,13 @@ exports.createAppDirFunction = createAppDirFunction;
|
|
|
13
13
|
* Create directory utils for vuepress app
|
|
14
14
|
*/
|
|
15
15
|
const createAppDir = (options) => {
|
|
16
|
-
const cache = exports.createAppDirFunction(options.cache);
|
|
17
|
-
const temp = exports.createAppDirFunction(options.temp);
|
|
18
|
-
const source = exports.createAppDirFunction(options.source);
|
|
19
|
-
const dest = exports.createAppDirFunction(options.dest);
|
|
20
|
-
const publicDir = exports.createAppDirFunction(options.public);
|
|
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
21
|
// @vuepress/client
|
|
22
|
-
const client = exports.createAppDirFunction(utils_1.path.resolve(require.resolve('@vuepress/client/package.json'), '..'));
|
|
22
|
+
const client = (0, exports.createAppDirFunction)(utils_1.path.resolve(require.resolve('@vuepress/client/package.json'), '..'));
|
|
23
23
|
return {
|
|
24
24
|
cache,
|
|
25
25
|
temp,
|
|
@@ -3,22 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createAppPages = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const page_1 = require("../page");
|
|
6
|
-
const log = utils_1.debug('vuepress:core/app');
|
|
6
|
+
const log = (0, utils_1.debug)('vuepress:core/app');
|
|
7
7
|
/**
|
|
8
8
|
* Create pages for vuepress app
|
|
9
9
|
*/
|
|
10
10
|
const createAppPages = async (app) => {
|
|
11
11
|
log('createAppPages start');
|
|
12
12
|
// resolve page absolute file paths according to the page patterns
|
|
13
|
-
const pageFilePaths = await utils_1.globby(app.options.pagePatterns, {
|
|
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((filePath) => page_1.createPage(app, { filePath })));
|
|
18
|
+
const pages = await Promise.all(pageFilePaths.map((filePath) => (0, page_1.createPage)(app, { filePath })));
|
|
19
19
|
// if there is no 404 page, add one
|
|
20
20
|
if (!pages.some((page) => page.path === '/404.html')) {
|
|
21
|
-
pages.push(await page_1.createPage(app, {
|
|
21
|
+
pages.push(await (0, page_1.createPage)(app, {
|
|
22
22
|
path: '/404.html',
|
|
23
23
|
frontmatter: {
|
|
24
24
|
layout: '404',
|
package/lib/app/createBaseApp.js
CHANGED
|
@@ -18,14 +18,14 @@ const resolveThemeInfo_1 = require("./resolveThemeInfo");
|
|
|
18
18
|
* Create vuepress app
|
|
19
19
|
*/
|
|
20
20
|
const createBaseApp = (config, isBuild = false) => {
|
|
21
|
-
const version = createAppVersion_1.createAppVersion();
|
|
22
|
-
const options = createAppOptions_1.createAppOptions(config);
|
|
23
|
-
const dir = createAppDir_1.createAppDir(options);
|
|
24
|
-
const env = createAppEnv_1.createAppEnv(options, isBuild);
|
|
25
|
-
const siteData = createAppSiteData_1.createAppSiteData(options);
|
|
26
|
-
const markdown = markdown_1.createMarkdown(options.markdown);
|
|
27
|
-
const pluginApi = pluginApi_1.createPluginApi();
|
|
28
|
-
const writeTemp = createAppWriteTemp_1.createAppWriteTemp(dir);
|
|
21
|
+
const version = (0, createAppVersion_1.createAppVersion)();
|
|
22
|
+
const options = (0, createAppOptions_1.createAppOptions)(config);
|
|
23
|
+
const dir = (0, createAppDir_1.createAppDir)(options);
|
|
24
|
+
const env = (0, createAppEnv_1.createAppEnv)(options, isBuild);
|
|
25
|
+
const siteData = (0, createAppSiteData_1.createAppSiteData)(options);
|
|
26
|
+
const markdown = (0, markdown_1.createMarkdown)(options.markdown);
|
|
27
|
+
const pluginApi = (0, pluginApi_1.createPluginApi)();
|
|
28
|
+
const writeTemp = (0, createAppWriteTemp_1.createAppWriteTemp)(dir);
|
|
29
29
|
const app = {
|
|
30
30
|
version,
|
|
31
31
|
options,
|
|
@@ -35,16 +35,16 @@ const createBaseApp = (config, isBuild = false) => {
|
|
|
35
35
|
markdown,
|
|
36
36
|
pluginApi,
|
|
37
37
|
writeTemp,
|
|
38
|
-
use: (...args) => appUse_1.appUse(app, ...args),
|
|
39
|
-
init: () => appInit_1.appInit(app),
|
|
40
|
-
prepare: () => appPrepare_1.appPrepare(app),
|
|
38
|
+
use: (...args) => (0, appUse_1.appUse)(app, ...args),
|
|
39
|
+
init: () => (0, appInit_1.appInit)(app),
|
|
40
|
+
prepare: () => (0, appPrepare_1.appPrepare)(app),
|
|
41
41
|
};
|
|
42
42
|
// resolve theme info and use theme plugins
|
|
43
|
-
const themeInfo = resolveThemeInfo_1.resolveThemeInfo(app, options.theme);
|
|
43
|
+
const themeInfo = (0, resolveThemeInfo_1.resolveThemeInfo)(app, options.theme);
|
|
44
44
|
themeInfo.plugins.forEach((plugin) => app.use(plugin));
|
|
45
45
|
app.layouts = themeInfo.layouts;
|
|
46
46
|
// resolve plugins
|
|
47
|
-
const plugins = resolvePluginsFromConfig_1.resolvePluginsFromConfig(app, options.plugins);
|
|
47
|
+
const plugins = (0, resolvePluginsFromConfig_1.resolvePluginsFromConfig)(app, options.plugins);
|
|
48
48
|
plugins.forEach((plugin) => app.use(plugin));
|
|
49
49
|
return app;
|
|
50
50
|
};
|
|
@@ -7,8 +7,8 @@ const resolveBundler_1 = require("./resolveBundler");
|
|
|
7
7
|
* Create vuepress build app
|
|
8
8
|
*/
|
|
9
9
|
const createBuildApp = (config) => {
|
|
10
|
-
const app = createBaseApp_1.createBaseApp(config, true);
|
|
11
|
-
app.build = () => resolveBundler_1.resolveBundler(app.options).build(app);
|
|
10
|
+
const app = (0, createBaseApp_1.createBaseApp)(config, true);
|
|
11
|
+
app.build = () => (0, resolveBundler_1.resolveBundler)(app.options).build(app);
|
|
12
12
|
return app;
|
|
13
13
|
};
|
|
14
14
|
exports.createBuildApp = createBuildApp;
|
package/lib/app/createDevApp.js
CHANGED
|
@@ -7,8 +7,8 @@ const resolveBundler_1 = require("./resolveBundler");
|
|
|
7
7
|
* Create vuepress dev app
|
|
8
8
|
*/
|
|
9
9
|
const createDevApp = (config) => {
|
|
10
|
-
const app = createBaseApp_1.createBaseApp(config, false);
|
|
11
|
-
app.dev = () => resolveBundler_1.resolveBundler(app.options).dev(app);
|
|
10
|
+
const app = (0, createBaseApp_1.createBaseApp)(config, false);
|
|
11
|
+
app.dev = () => (0, resolveBundler_1.resolveBundler)(app.options).dev(app);
|
|
12
12
|
return app;
|
|
13
13
|
};
|
|
14
14
|
exports.createDevApp = createDevApp;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginConfig, PluginConfigNormalized, PluginOptions } from '../types';
|
|
2
2
|
export declare const normalizePluginConfig: <T extends PluginOptions>(pluginConfig: PluginConfig<T>) => PluginConfigNormalized<T>;
|
|
@@ -6,7 +6,7 @@ const normalizePluginConfig = (pluginConfig) => {
|
|
|
6
6
|
var _a;
|
|
7
7
|
// ['container'] -> ['container', true]
|
|
8
8
|
// ['container', options] -> ['container', options]
|
|
9
|
-
if (shared_1.isArray(pluginConfig)) {
|
|
9
|
+
if ((0, shared_1.isArray)(pluginConfig)) {
|
|
10
10
|
return [pluginConfig[0], (_a = pluginConfig[1]) !== null && _a !== void 0 ? _a : true];
|
|
11
11
|
}
|
|
12
12
|
// 'container' -> ['container', true]
|
|
@@ -33,7 +33,7 @@ ${app.pages
|
|
|
33
33
|
}
|
|
34
34
|
// redirect from filename path
|
|
35
35
|
if (filePathRelative !== null) {
|
|
36
|
-
const filenamePath = shared_1.ensureLeadingSlash(filePathRelative);
|
|
36
|
+
const filenamePath = (0, shared_1.ensureLeadingSlash)(filePathRelative);
|
|
37
37
|
redirectsSet.add(filenamePath);
|
|
38
38
|
redirectsSet.add(encodeURI(filenamePath));
|
|
39
39
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveBundler = void 0;
|
|
4
4
|
const shared_1 = require("@vuepress/shared");
|
|
5
5
|
const resolveBundler = ({ bundler, bundlerConfig, }) => {
|
|
6
|
-
const bundlerPackage = shared_1.normalizePackageName(bundler, 'vuepress', 'bundler');
|
|
6
|
+
const bundlerPackage = (0, shared_1.normalizePackageName)(bundler, 'vuepress', 'bundler');
|
|
7
7
|
const { createBundler } = require(bundlerPackage);
|
|
8
8
|
return createBundler(bundlerConfig);
|
|
9
9
|
};
|
package/lib/app/resolvePlugin.js
CHANGED
|
@@ -8,13 +8,13 @@ const resolvePluginModule_1 = require("./resolvePluginModule");
|
|
|
8
8
|
* Resolve a plugin according to name / path / module and config
|
|
9
9
|
*/
|
|
10
10
|
const resolvePlugin = (app, plugin, config = {}) => {
|
|
11
|
-
const pluginModule = shared_1.isString(plugin)
|
|
12
|
-
? resolvePluginModule_1.resolvePluginModule(plugin)
|
|
11
|
+
const pluginModule = (0, shared_1.isString)(plugin)
|
|
12
|
+
? (0, resolvePluginModule_1.resolvePluginModule)(plugin)
|
|
13
13
|
: plugin;
|
|
14
14
|
if (pluginModule === null) {
|
|
15
15
|
throw utils_1.logger.createError(`plugin is not found: ${utils_1.chalk.magenta(plugin)}`);
|
|
16
16
|
}
|
|
17
|
-
const pluginObject = shared_1.isFunction(pluginModule)
|
|
17
|
+
const pluginObject = (0, shared_1.isFunction)(pluginModule)
|
|
18
18
|
? pluginModule(config, app)
|
|
19
19
|
: pluginModule;
|
|
20
20
|
return pluginObject;
|
|
@@ -9,12 +9,12 @@ const utils_1 = require("@vuepress/utils");
|
|
|
9
9
|
const resolvePluginModule = (pluginName) => {
|
|
10
10
|
const pluginEntry = utils_1.path.isAbsolute(pluginName)
|
|
11
11
|
? pluginName
|
|
12
|
-
: utils_1.requireResolve(shared_1.normalizePackageName(pluginName, 'vuepress', 'plugin'));
|
|
12
|
+
: (0, utils_1.requireResolve)((0, shared_1.normalizePackageName)(pluginName, 'vuepress', 'plugin'));
|
|
13
13
|
if (pluginEntry === null) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
const pluginModule = require(pluginEntry);
|
|
17
17
|
// allow default export
|
|
18
|
-
return utils_1.hasExportDefault(pluginModule) ? pluginModule.default : pluginModule;
|
|
18
|
+
return (0, utils_1.hasExportDefault)(pluginModule) ? pluginModule.default : pluginModule;
|
|
19
19
|
};
|
|
20
20
|
exports.resolvePluginModule = resolvePluginModule;
|
|
@@ -7,9 +7,9 @@ const resolvePlugin_1 = require("./resolvePlugin");
|
|
|
7
7
|
* Resolve plugins from plugin config array
|
|
8
8
|
*/
|
|
9
9
|
const resolvePluginsFromConfig = (app, plugins = []) => plugins.reduce((prev, item) => {
|
|
10
|
-
const [plugin, config] = normalizePluginConfig_1.normalizePluginConfig(item);
|
|
10
|
+
const [plugin, config] = (0, normalizePluginConfig_1.normalizePluginConfig)(item);
|
|
11
11
|
if (config !== false) {
|
|
12
|
-
prev.push(resolvePlugin_1.resolvePlugin(app, plugin, config === true ? {} : config));
|
|
12
|
+
prev.push((0, resolvePlugin_1.resolvePlugin)(app, plugin, config === true ? {} : config));
|
|
13
13
|
}
|
|
14
14
|
return prev;
|
|
15
15
|
}, []);
|
package/lib/app/resolveTheme.js
CHANGED
|
@@ -9,14 +9,14 @@ const resolvePlugin_1 = require("./resolvePlugin");
|
|
|
9
9
|
*/
|
|
10
10
|
const resolveTheme = (app, themeName) => {
|
|
11
11
|
// resolve theme entry according to theme name
|
|
12
|
-
const themeEntry = utils_1.requireResolve(utils_1.path.isAbsolute(themeName)
|
|
12
|
+
const themeEntry = (0, utils_1.requireResolve)(utils_1.path.isAbsolute(themeName)
|
|
13
13
|
? themeName
|
|
14
|
-
: shared_1.normalizePackageName(themeName, 'vuepress', 'theme'));
|
|
14
|
+
: (0, shared_1.normalizePackageName)(themeName, 'vuepress', 'theme'));
|
|
15
15
|
if (themeEntry === null) {
|
|
16
16
|
throw utils_1.logger.createError(`theme is not found: ${utils_1.chalk.magenta(themeName)}`);
|
|
17
17
|
}
|
|
18
18
|
// resolve theme from theme entry
|
|
19
|
-
const theme = resolvePlugin_1.resolvePlugin(app, themeEntry, app.options.themeConfig);
|
|
19
|
+
const theme = (0, resolvePlugin_1.resolvePlugin)(app, themeEntry, app.options.themeConfig);
|
|
20
20
|
return theme;
|
|
21
21
|
};
|
|
22
22
|
exports.resolveTheme = resolveTheme;
|
|
@@ -9,17 +9,17 @@ const resolveThemeLayouts_1 = require("./resolveThemeLayouts");
|
|
|
9
9
|
*/
|
|
10
10
|
const resolveThemeInfo = (app, themeName) => {
|
|
11
11
|
// resolve current theme info
|
|
12
|
-
const theme = resolveTheme_1.resolveTheme(app, themeName);
|
|
12
|
+
const theme = (0, resolveTheme_1.resolveTheme)(app, themeName);
|
|
13
13
|
const themeInfo = {
|
|
14
|
-
layouts: resolveThemeLayouts_1.resolveThemeLayouts(theme.layouts),
|
|
15
|
-
plugins: [theme, ...resolvePluginsFromConfig_1.resolvePluginsFromConfig(app, theme.plugins)],
|
|
14
|
+
layouts: (0, resolveThemeLayouts_1.resolveThemeLayouts)(theme.layouts),
|
|
15
|
+
plugins: [theme, ...(0, resolvePluginsFromConfig_1.resolvePluginsFromConfig)(app, theme.plugins)],
|
|
16
16
|
};
|
|
17
17
|
// return if current theme does not have a parent theme
|
|
18
18
|
if (!theme.extends) {
|
|
19
19
|
return themeInfo;
|
|
20
20
|
}
|
|
21
21
|
// resolve parent theme info recursively
|
|
22
|
-
const parentThemeInfo = exports.resolveThemeInfo(app, theme.extends);
|
|
22
|
+
const parentThemeInfo = (0, exports.resolveThemeInfo)(app, theme.extends);
|
|
23
23
|
return {
|
|
24
24
|
layouts: { ...parentThemeInfo.layouts, ...themeInfo.layouts },
|
|
25
25
|
plugins: [...parentThemeInfo.plugins, ...themeInfo.plugins],
|
|
@@ -8,7 +8,7 @@ const utils_1 = require("@vuepress/utils");
|
|
|
8
8
|
*/
|
|
9
9
|
const resolveThemeLayouts = (layouts = {}) => {
|
|
10
10
|
// use the layouts component map directly
|
|
11
|
-
if (shared_1.isPlainObject(layouts)) {
|
|
11
|
+
if ((0, shared_1.isPlainObject)(layouts)) {
|
|
12
12
|
return layouts;
|
|
13
13
|
}
|
|
14
14
|
// resolve the layouts directory
|
package/lib/page/createPage.js
CHANGED
|
@@ -21,22 +21,22 @@ const resolvePagePermalink_1 = require("./resolvePagePermalink");
|
|
|
21
21
|
const resolvePageSlug_1 = require("./resolvePageSlug");
|
|
22
22
|
const createPage = async (app, optionsRaw) => {
|
|
23
23
|
// resolve page options from raw options
|
|
24
|
-
const options = await resolvePageOptions_1.resolvePageOptions({ app, optionsRaw });
|
|
24
|
+
const options = await (0, resolvePageOptions_1.resolvePageOptions)({ app, optionsRaw });
|
|
25
25
|
// resolve page file absolute path and relative path
|
|
26
|
-
const { filePath, filePathRelative } = resolvePageFilePath_1.resolvePageFilePath({
|
|
26
|
+
const { filePath, filePathRelative } = (0, resolvePageFilePath_1.resolvePageFilePath)({
|
|
27
27
|
app,
|
|
28
28
|
options,
|
|
29
29
|
});
|
|
30
30
|
// read the raw file content according to the absolute file path
|
|
31
|
-
const contentRaw = await resolvePageFileContent_1.resolvePageFileContent({ filePath, options });
|
|
31
|
+
const contentRaw = await (0, resolvePageFileContent_1.resolvePageFileContent)({ filePath, options });
|
|
32
32
|
// resolve content & frontmatter & raw excerpt from raw content
|
|
33
|
-
const { content, frontmatterRaw, excerptRaw } = resolvePageContent_1.resolvePageContent({
|
|
33
|
+
const { content, frontmatterRaw, excerptRaw } = (0, resolvePageContent_1.resolvePageContent)({
|
|
34
34
|
contentRaw,
|
|
35
35
|
});
|
|
36
36
|
// resolve frontmatter from raw frontmatter and page options
|
|
37
|
-
const frontmatter = resolvePageFrontmatter_1.resolvePageFrontmatter({ frontmatterRaw, options });
|
|
37
|
+
const frontmatter = (0, resolvePageFrontmatter_1.resolvePageFrontmatter)({ frontmatterRaw, options });
|
|
38
38
|
// render excerpt
|
|
39
|
-
const excerpt = renderPageExcerpt_1.renderPageExcerpt({
|
|
39
|
+
const excerpt = (0, renderPageExcerpt_1.renderPageExcerpt)({
|
|
40
40
|
app,
|
|
41
41
|
excerptRaw,
|
|
42
42
|
filePath,
|
|
@@ -44,7 +44,7 @@ const createPage = async (app, optionsRaw) => {
|
|
|
44
44
|
frontmatter,
|
|
45
45
|
});
|
|
46
46
|
// render page content and extract information
|
|
47
|
-
const { contentRendered, deps, headers, hoistedTags, links, title, } = await renderPageContent_1.renderPageContent({
|
|
47
|
+
const { contentRendered, deps, headers, hoistedTags, links, title, } = await (0, renderPageContent_1.renderPageContent)({
|
|
48
48
|
app,
|
|
49
49
|
content,
|
|
50
50
|
filePath,
|
|
@@ -52,15 +52,15 @@ const createPage = async (app, optionsRaw) => {
|
|
|
52
52
|
frontmatter,
|
|
53
53
|
});
|
|
54
54
|
// resolve slug from file path
|
|
55
|
-
const slug = resolvePageSlug_1.resolvePageSlug({ filePathRelative });
|
|
55
|
+
const slug = (0, resolvePageSlug_1.resolvePageSlug)({ filePathRelative });
|
|
56
56
|
// resolve date from file path
|
|
57
|
-
const date = resolvePageDate_1.resolvePageDate({ frontmatter, filePathRelative });
|
|
57
|
+
const date = (0, resolvePageDate_1.resolvePageDate)({ frontmatter, filePathRelative });
|
|
58
58
|
// infer page path according to file path
|
|
59
|
-
const { pathInferred, pathLocale } = inferPagePath_1.inferPagePath({ app, filePathRelative });
|
|
59
|
+
const { pathInferred, pathLocale } = (0, inferPagePath_1.inferPagePath)({ app, filePathRelative });
|
|
60
60
|
// resolve language from frontmatter and site options
|
|
61
|
-
const lang = resolvePageLang_1.resolvePageLang({ app, frontmatter, pathLocale });
|
|
61
|
+
const lang = (0, resolvePageLang_1.resolvePageLang)({ app, frontmatter, pathLocale });
|
|
62
62
|
// resolve page permalink
|
|
63
|
-
const permalink = resolvePagePermalink_1.resolvePagePermalink({
|
|
63
|
+
const permalink = (0, resolvePagePermalink_1.resolvePagePermalink)({
|
|
64
64
|
frontmatter,
|
|
65
65
|
slug,
|
|
66
66
|
date,
|
|
@@ -68,22 +68,22 @@ const createPage = async (app, optionsRaw) => {
|
|
|
68
68
|
pathLocale,
|
|
69
69
|
});
|
|
70
70
|
// resolve page path
|
|
71
|
-
const path = resolvePagePath_1.resolvePagePath({ permalink, pathInferred, options });
|
|
71
|
+
const path = (0, resolvePagePath_1.resolvePagePath)({ permalink, pathInferred, options });
|
|
72
72
|
// resolve path key
|
|
73
|
-
const key = resolvePageKey_1.resolvePageKey({ path });
|
|
73
|
+
const key = (0, resolvePageKey_1.resolvePageKey)({ path });
|
|
74
74
|
// resolve page rendered html file path
|
|
75
|
-
const { htmlFilePath, htmlFilePathRelative } = resolvePageHtmlInfo_1.resolvePageHtmlInfo({
|
|
75
|
+
const { htmlFilePath, htmlFilePathRelative } = (0, resolvePageHtmlInfo_1.resolvePageHtmlInfo)({
|
|
76
76
|
app,
|
|
77
77
|
path,
|
|
78
78
|
});
|
|
79
79
|
// resolve page component and extract headers & links
|
|
80
|
-
const { componentFilePath, componentFilePathRelative, componentFileChunkName, } = await resolvePageComponentInfo_1.resolvePageComponentInfo({
|
|
80
|
+
const { componentFilePath, componentFilePathRelative, componentFileChunkName, } = await (0, resolvePageComponentInfo_1.resolvePageComponentInfo)({
|
|
81
81
|
app,
|
|
82
82
|
hoistedTags,
|
|
83
83
|
htmlFilePathRelative,
|
|
84
84
|
key,
|
|
85
85
|
});
|
|
86
|
-
const { dataFilePath, dataFilePathRelative, dataFileChunkName, } = resolvePageDataInfo_1.resolvePageDataInfo({ app, htmlFilePathRelative, key });
|
|
86
|
+
const { dataFilePath, dataFilePathRelative, dataFileChunkName, } = (0, resolvePageDataInfo_1.resolvePageDataInfo)({ app, htmlFilePathRelative, key });
|
|
87
87
|
const page = {
|
|
88
88
|
// base fields
|
|
89
89
|
key,
|
|
@@ -117,7 +117,7 @@ const createPage = async (app, optionsRaw) => {
|
|
|
117
117
|
htmlFilePathRelative,
|
|
118
118
|
};
|
|
119
119
|
// resolve page data
|
|
120
|
-
page.data = await resolvePageData_1.resolvePageData({ app, page });
|
|
120
|
+
page.data = await (0, resolvePageData_1.resolvePageData)({ app, page });
|
|
121
121
|
return page;
|
|
122
122
|
};
|
|
123
123
|
exports.createPage = createPage;
|
|
@@ -14,11 +14,11 @@ const inferPagePath = ({ app, filePathRelative, }) => {
|
|
|
14
14
|
}
|
|
15
15
|
// infer page route path from file path
|
|
16
16
|
// foo/bar.md -> /foo/bar.html
|
|
17
|
-
const pathInferred = shared_1.ensureLeadingSlash(filePathRelative)
|
|
17
|
+
const pathInferred = (0, shared_1.ensureLeadingSlash)(filePathRelative)
|
|
18
18
|
.replace(/\.md$/, '.html')
|
|
19
19
|
.replace(/\/(README|index).html$/i, '/');
|
|
20
20
|
// resolve page locale path
|
|
21
|
-
const pathLocale = shared_1.resolveLocalePath(app.siteData.locales, pathInferred);
|
|
21
|
+
const pathLocale = (0, shared_1.resolveLocalePath)(app.siteData.locales, pathInferred);
|
|
22
22
|
return {
|
|
23
23
|
pathInferred,
|
|
24
24
|
pathLocale,
|
|
@@ -15,14 +15,14 @@ const resolvePageDate = ({ frontmatter, filePathRelative, }) => {
|
|
|
15
15
|
var _a, _b;
|
|
16
16
|
// `frontmatter.date` could be parsed as UTC Date directly
|
|
17
17
|
if (frontmatter.date instanceof Date) {
|
|
18
|
-
return shared_1.formatDateString([
|
|
18
|
+
return (0, shared_1.formatDateString)([
|
|
19
19
|
frontmatter.date.getUTCFullYear(),
|
|
20
20
|
frontmatter.date.getUTCMonth() + 1,
|
|
21
21
|
frontmatter.date.getUTCDate(),
|
|
22
22
|
].join('-'), DEFAULT_DATE);
|
|
23
23
|
}
|
|
24
|
-
if (shared_1.isString(frontmatter.date)) {
|
|
25
|
-
return shared_1.formatDateString(frontmatter.date, DEFAULT_DATE);
|
|
24
|
+
if ((0, shared_1.isString)(frontmatter.date)) {
|
|
25
|
+
return (0, shared_1.formatDateString)(frontmatter.date, DEFAULT_DATE);
|
|
26
26
|
}
|
|
27
27
|
if (filePathRelative === null) {
|
|
28
28
|
return DEFAULT_DATE;
|
|
@@ -31,14 +31,14 @@ const resolvePageDate = ({ frontmatter, filePathRelative, }) => {
|
|
|
31
31
|
if (filename) {
|
|
32
32
|
const matches = filename.match(FILENAME_DATE_RE);
|
|
33
33
|
if (matches) {
|
|
34
|
-
return shared_1.formatDateString(`${matches[1]}-${matches[2]}-${(_a = matches[3]) !== null && _a !== void 0 ? _a : '01'}`, DEFAULT_DATE);
|
|
34
|
+
return (0, shared_1.formatDateString)(`${matches[1]}-${matches[2]}-${(_a = matches[3]) !== null && _a !== void 0 ? _a : '01'}`, DEFAULT_DATE);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
const dirname = utils_1.path.dirname(filePathRelative);
|
|
38
38
|
if (dirname !== '.') {
|
|
39
39
|
const matches = dirname.match(DIRNAME_DATE_RE);
|
|
40
40
|
if (matches) {
|
|
41
|
-
return shared_1.formatDateString(`${matches[1]}-${matches[2]}-${(_b = matches[3]) !== null && _b !== void 0 ? _b : '01'}`, DEFAULT_DATE);
|
|
41
|
+
return (0, shared_1.formatDateString)(`${matches[1]}-${matches[2]}-${(_b = matches[3]) !== null && _b !== void 0 ? _b : '01'}`, DEFAULT_DATE);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
return DEFAULT_DATE;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolvePageFileContent = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
const log = utils_1.debug('vuepress:core/page');
|
|
5
|
+
const log = (0, utils_1.debug)('vuepress:core/page');
|
|
6
6
|
/**
|
|
7
7
|
* Resolve page file content according to filePath or options content
|
|
8
8
|
*/
|
|
@@ -15,7 +15,7 @@ const resolvePageFileContent = async ({ filePath, options, }) => {
|
|
|
15
15
|
return content;
|
|
16
16
|
}
|
|
17
17
|
catch (e) {
|
|
18
|
-
log(e.message);
|
|
18
|
+
log(e instanceof Error ? e.message : e);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
// load raw content from options
|
|
@@ -8,7 +8,7 @@ const shared_1 = require("@vuepress/shared");
|
|
|
8
8
|
const resolvePageHtmlInfo = ({ app, path: pagePath, }) => {
|
|
9
9
|
// /foo.html -> foo.html
|
|
10
10
|
// /foo/ -> foo/index.html
|
|
11
|
-
const htmlFilePathRelative = shared_1.removeLeadingSlash(decodeURI(pagePath.replace(/\/$/, '/index.html')));
|
|
11
|
+
const htmlFilePathRelative = (0, shared_1.removeLeadingSlash)(decodeURI(pagePath.replace(/\/$/, '/index.html')));
|
|
12
12
|
const htmlFilePath = app.dir.dest(htmlFilePathRelative);
|
|
13
13
|
return {
|
|
14
14
|
htmlFilePath,
|
|
@@ -5,5 +5,5 @@ const utils_1 = require("@vuepress/utils");
|
|
|
5
5
|
/**
|
|
6
6
|
* Resolve page key to identify the page
|
|
7
7
|
*/
|
|
8
|
-
const resolvePageKey = ({ path }) => `v-${utils_1.hash(path)}`;
|
|
8
|
+
const resolvePageKey = ({ path }) => `v-${(0, utils_1.hash)(path)}`;
|
|
9
9
|
exports.resolvePageKey = resolvePageKey;
|
|
@@ -7,7 +7,7 @@ const shared_1 = require("@vuepress/shared");
|
|
|
7
7
|
*/
|
|
8
8
|
const resolvePageLang = ({ app, frontmatter, pathLocale, }) => {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
if (shared_1.isString(frontmatter.lang) && frontmatter.lang) {
|
|
10
|
+
if ((0, shared_1.isString)(frontmatter.lang) && frontmatter.lang) {
|
|
11
11
|
return frontmatter.lang;
|
|
12
12
|
}
|
|
13
13
|
return (_b = (_a = app.siteData.locales[pathLocale]) === null || _a === void 0 ? void 0 : _a.lang) !== null && _b !== void 0 ? _b : app.siteData.lang;
|
|
@@ -12,7 +12,7 @@ const resolvePagePath = ({ permalink, pathInferred, options, }) => {
|
|
|
12
12
|
throw utils_1.logger.createError(`page path is empty, page options: ${JSON.stringify(options, null, 2)}`);
|
|
13
13
|
}
|
|
14
14
|
if (!pagePath.endsWith('.html')) {
|
|
15
|
-
pagePath = shared_1.ensureEndingSlash(pagePath);
|
|
15
|
+
pagePath = (0, shared_1.ensureEndingSlash)(pagePath);
|
|
16
16
|
}
|
|
17
17
|
return encodeURI(pagePath);
|
|
18
18
|
};
|
|
@@ -9,11 +9,11 @@ const utils_1 = require("@vuepress/utils");
|
|
|
9
9
|
const resolvePagePermalink = ({ frontmatter, slug, date, pathInferred, pathLocale, }) => {
|
|
10
10
|
var _a;
|
|
11
11
|
// use permalink in frontmatter directly
|
|
12
|
-
if (shared_1.isString(frontmatter.permalink)) {
|
|
12
|
+
if ((0, shared_1.isString)(frontmatter.permalink)) {
|
|
13
13
|
return frontmatter.permalink;
|
|
14
14
|
}
|
|
15
15
|
// get permalink pattern from frontmatter or options
|
|
16
|
-
const pattern = shared_1.isString(frontmatter.permalinkPattern)
|
|
16
|
+
const pattern = (0, shared_1.isString)(frontmatter.permalinkPattern)
|
|
17
17
|
? frontmatter.permalinkPattern
|
|
18
18
|
: null;
|
|
19
19
|
if (!pattern) {
|
|
@@ -27,6 +27,6 @@ const resolvePagePermalink = ({ frontmatter, slug, date, pathInferred, pathLocal
|
|
|
27
27
|
.replace(/:day/, day)
|
|
28
28
|
.replace(/:slug/, slug)
|
|
29
29
|
.replace(/:raw/, (_a = pathInferred === null || pathInferred === void 0 ? void 0 : pathInferred.replace(/^\//, '')) !== null && _a !== void 0 ? _a : ''));
|
|
30
|
-
return shared_1.ensureLeadingSlash(link);
|
|
30
|
+
return (0, shared_1.ensureLeadingSlash)(link);
|
|
31
31
|
};
|
|
32
32
|
exports.resolvePagePermalink = resolvePagePermalink;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createHookQueue = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
|
-
const log = utils_1.debug('vuepress:core/plugin-api');
|
|
5
|
+
const log = (0, utils_1.debug)('vuepress:core/plugin-api');
|
|
6
6
|
/**
|
|
7
7
|
* Create hook queue for plugin system
|
|
8
8
|
*/
|
|
@@ -29,9 +29,9 @@ const createHookQueue = (name) => {
|
|
|
29
29
|
results.push(result);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
catch (
|
|
32
|
+
catch (e) {
|
|
33
33
|
utils_1.logger.error(`error in hook ${utils_1.chalk.magenta(name)} from ${utils_1.chalk.magenta(item.pluginName)}`);
|
|
34
|
-
throw
|
|
34
|
+
throw e;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return results;
|
|
@@ -5,8 +5,8 @@ const createPluginApiHooks_1 = require("./createPluginApiHooks");
|
|
|
5
5
|
const createPluginApiRegisterHooks_1 = require("./createPluginApiRegisterHooks");
|
|
6
6
|
const createPluginApi = () => {
|
|
7
7
|
const plugins = [];
|
|
8
|
-
const hooks = createPluginApiHooks_1.createPluginApiHooks();
|
|
9
|
-
const registerHooks = createPluginApiRegisterHooks_1.createPluginApiRegisterHooks(plugins, hooks);
|
|
8
|
+
const hooks = (0, createPluginApiHooks_1.createPluginApiHooks)();
|
|
9
|
+
const registerHooks = (0, createPluginApiRegisterHooks_1.createPluginApiRegisterHooks)(plugins, hooks);
|
|
10
10
|
return {
|
|
11
11
|
plugins,
|
|
12
12
|
hooks,
|
|
@@ -4,21 +4,21 @@ exports.createPluginApiHooks = void 0;
|
|
|
4
4
|
const createHookQueue_1 = require("./createHookQueue");
|
|
5
5
|
const createPluginApiHooks = () => ({
|
|
6
6
|
// life cycle hooks
|
|
7
|
-
onInitialized: createHookQueue_1.createHookQueue('onInitialized'),
|
|
8
|
-
onPrepared: createHookQueue_1.createHookQueue('onPrepared'),
|
|
9
|
-
onWatched: createHookQueue_1.createHookQueue('onWatched'),
|
|
10
|
-
onGenerated: createHookQueue_1.createHookQueue('onGenerated'),
|
|
7
|
+
onInitialized: (0, createHookQueue_1.createHookQueue)('onInitialized'),
|
|
8
|
+
onPrepared: (0, createHookQueue_1.createHookQueue)('onPrepared'),
|
|
9
|
+
onWatched: (0, createHookQueue_1.createHookQueue)('onWatched'),
|
|
10
|
+
onGenerated: (0, createHookQueue_1.createHookQueue)('onGenerated'),
|
|
11
11
|
// page hooks
|
|
12
|
-
extendsPageOptions: createHookQueue_1.createHookQueue('extendsPageOptions'),
|
|
13
|
-
extendsPageData: createHookQueue_1.createHookQueue('extendsPageData'),
|
|
12
|
+
extendsPageOptions: (0, createHookQueue_1.createHookQueue)('extendsPageOptions'),
|
|
13
|
+
extendsPageData: (0, createHookQueue_1.createHookQueue)('extendsPageData'),
|
|
14
14
|
// markdown hooks
|
|
15
|
-
extendsMarkdown: createHookQueue_1.createHookQueue('extendsMarkdown'),
|
|
15
|
+
extendsMarkdown: (0, createHookQueue_1.createHookQueue)('extendsMarkdown'),
|
|
16
16
|
// client files hooks
|
|
17
|
-
clientAppEnhanceFiles: createHookQueue_1.createHookQueue('clientAppEnhanceFiles'),
|
|
18
|
-
clientAppRootComponentFiles: createHookQueue_1.createHookQueue('clientAppRootComponentFiles'),
|
|
19
|
-
clientAppSetupFiles: createHookQueue_1.createHookQueue('clientAppSetupFiles'),
|
|
17
|
+
clientAppEnhanceFiles: (0, createHookQueue_1.createHookQueue)('clientAppEnhanceFiles'),
|
|
18
|
+
clientAppRootComponentFiles: (0, createHookQueue_1.createHookQueue)('clientAppRootComponentFiles'),
|
|
19
|
+
clientAppSetupFiles: (0, createHookQueue_1.createHookQueue)('clientAppSetupFiles'),
|
|
20
20
|
// bundler hooks
|
|
21
|
-
alias: createHookQueue_1.createHookQueue('alias'),
|
|
22
|
-
define: createHookQueue_1.createHookQueue('define'),
|
|
21
|
+
alias: (0, createHookQueue_1.createHookQueue)('alias'),
|
|
22
|
+
define: (0, createHookQueue_1.createHookQueue)('define'),
|
|
23
23
|
});
|
|
24
24
|
exports.createPluginApiHooks = createPluginApiHooks;
|
|
@@ -11,31 +11,31 @@ const createPluginApiRegisterHooks = (plugins, hooks) => () => {
|
|
|
11
11
|
if (alias) {
|
|
12
12
|
hooks.alias.add({
|
|
13
13
|
pluginName,
|
|
14
|
-
hook: normalizeReturnObjectHook_1.normalizeReturnObjectHook(alias),
|
|
14
|
+
hook: (0, normalizeReturnObjectHook_1.normalizeReturnObjectHook)(alias),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
if (define) {
|
|
18
18
|
hooks.define.add({
|
|
19
19
|
pluginName,
|
|
20
|
-
hook: normalizeReturnObjectHook_1.normalizeReturnObjectHook(define),
|
|
20
|
+
hook: (0, normalizeReturnObjectHook_1.normalizeReturnObjectHook)(define),
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
if (clientAppEnhanceFiles) {
|
|
24
24
|
hooks.clientAppEnhanceFiles.add({
|
|
25
25
|
pluginName,
|
|
26
|
-
hook: normalizeClientFilesHook_1.normalizeClientFilesHook(clientAppEnhanceFiles),
|
|
26
|
+
hook: (0, normalizeClientFilesHook_1.normalizeClientFilesHook)(clientAppEnhanceFiles),
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
if (clientAppRootComponentFiles) {
|
|
30
30
|
hooks.clientAppRootComponentFiles.add({
|
|
31
31
|
pluginName,
|
|
32
|
-
hook: normalizeClientFilesHook_1.normalizeClientFilesHook(clientAppRootComponentFiles),
|
|
32
|
+
hook: (0, normalizeClientFilesHook_1.normalizeClientFilesHook)(clientAppRootComponentFiles),
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
if (clientAppSetupFiles) {
|
|
36
36
|
hooks.clientAppSetupFiles.add({
|
|
37
37
|
pluginName,
|
|
38
|
-
hook: normalizeClientFilesHook_1.normalizeClientFilesHook(clientAppSetupFiles),
|
|
38
|
+
hook: (0, normalizeClientFilesHook_1.normalizeClientFilesHook)(clientAppSetupFiles),
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -8,8 +8,8 @@ const utils_1 = require("@vuepress/utils");
|
|
|
8
8
|
*/
|
|
9
9
|
const normalizeClientFilesHook = (hook) => async (app) => {
|
|
10
10
|
// resolve clientFiles result
|
|
11
|
-
const clientFilesResult = shared_1.isFunction(hook) ? await hook(app) : hook;
|
|
12
|
-
const clientFiles = shared_1.isArray(clientFilesResult)
|
|
11
|
+
const clientFilesResult = (0, shared_1.isFunction)(hook) ? await hook(app) : hook;
|
|
12
|
+
const clientFiles = (0, shared_1.isArray)(clientFilesResult)
|
|
13
13
|
? clientFilesResult
|
|
14
14
|
: [clientFilesResult];
|
|
15
15
|
// filter files that do not exist
|
|
@@ -5,5 +5,5 @@ const shared_1 = require("@vuepress/shared");
|
|
|
5
5
|
/**
|
|
6
6
|
* Normalize hook that returns an object
|
|
7
7
|
*/
|
|
8
|
-
const normalizeReturnObjectHook = (hook) => async (app) => shared_1.isFunction(hook) ? hook(app) : hook;
|
|
8
|
+
const normalizeReturnObjectHook = (hook) => async (app) => (0, shared_1.isFunction)(hook) ? hook(app) : hook;
|
|
9
9
|
exports.normalizeReturnObjectHook = normalizeReturnObjectHook;
|
package/lib/types/app/app.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Markdown } from '@vuepress/markdown';
|
|
2
2
|
import type { SiteData } from '@vuepress/shared';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BundlerBuild, BundlerDev } from '../bundler';
|
|
4
4
|
import type { Page } from '../page';
|
|
5
5
|
import type { Plugin, PluginOptions } from '../plugin';
|
|
6
6
|
import type { PluginApi } from '../pluginApi';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty,
|
|
1
|
+
import type { HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, LocaleConfig, LocaleData, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig } from '@vuepress/shared';
|
|
2
2
|
export type { HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, HeadAttrsConfig, LocaleConfig, LocaleData, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig, };
|
|
3
3
|
export * from './app';
|
|
4
4
|
export * from './bundler';
|
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.27",
|
|
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.27",
|
|
30
|
+
"@vuepress/markdown": "2.0.0-beta.27",
|
|
31
|
+
"@vuepress/shared": "2.0.0-beta.27",
|
|
32
|
+
"@vuepress/utils": "2.0.0-beta.27",
|
|
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": "2671a94fe6864e215eb84f318b7e657744a0bc5d"
|
|
40
40
|
}
|