@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,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPluginApiRegisterHooks = void 0;
|
|
4
|
-
const normalizeClientConfigFileHook_1 = require("./normalizeClientConfigFileHook");
|
|
5
|
-
const normalizeReturnObjectHook_1 = require("./normalizeReturnObjectHook");
|
|
6
|
-
const createPluginApiRegisterHooks = (plugins, hooks) => () => {
|
|
7
|
-
plugins.forEach(({ name: pluginName, alias, define, clientConfigFile, ...commonHooks }) => {
|
|
8
|
-
/**
|
|
9
|
-
* hooks that need to be normalized
|
|
10
|
-
*/
|
|
11
|
-
if (alias) {
|
|
12
|
-
hooks.alias.add({
|
|
13
|
-
pluginName,
|
|
14
|
-
hook: (0, normalizeReturnObjectHook_1.normalizeReturnObjectHook)(alias),
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
if (define) {
|
|
18
|
-
hooks.define.add({
|
|
19
|
-
pluginName,
|
|
20
|
-
hook: (0, normalizeReturnObjectHook_1.normalizeReturnObjectHook)(define),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
if (clientConfigFile) {
|
|
24
|
-
hooks.clientConfigFile.add({
|
|
25
|
-
pluginName,
|
|
26
|
-
hook: (0, normalizeClientConfigFileHook_1.normalizeClientConfigFileHook)(clientConfigFile),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* common hooks
|
|
31
|
-
*/
|
|
32
|
-
Object.entries(commonHooks).forEach(([key, hook]) => {
|
|
33
|
-
if (hooks[key] && hook) {
|
|
34
|
-
hooks[key].add({
|
|
35
|
-
pluginName,
|
|
36
|
-
hook,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
exports.createPluginApiRegisterHooks = createPluginApiRegisterHooks;
|
package/lib/pluginApi/index.d.ts
DELETED
package/lib/pluginApi/index.js
DELETED
|
@@ -1,22 +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("./createHookQueue"), exports);
|
|
18
|
-
__exportStar(require("./createPluginApi"), exports);
|
|
19
|
-
__exportStar(require("./createPluginApiHooks"), exports);
|
|
20
|
-
__exportStar(require("./createPluginApiRegisterHooks"), exports);
|
|
21
|
-
__exportStar(require("./normalizeClientConfigFileHook"), exports);
|
|
22
|
-
__exportStar(require("./normalizeReturnObjectHook"), exports);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeClientConfigFileHook = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
const utils_1 = require("@vuepress/utils");
|
|
6
|
-
/**
|
|
7
|
-
* Normalize hook for client config file
|
|
8
|
-
*/
|
|
9
|
-
const normalizeClientConfigFileHook = (hook) => async (app) => {
|
|
10
|
-
// resolve clientConfigFile result
|
|
11
|
-
const clientConfigFileResult = (0, shared_1.isFunction)(hook) ? await hook(app) : hook;
|
|
12
|
-
// filter files that do not exist
|
|
13
|
-
const isExisted = await utils_1.fs.pathExists(clientConfigFileResult);
|
|
14
|
-
if (!isExisted) {
|
|
15
|
-
throw utils_1.logger.createError(`client config file does not exist: ${clientConfigFileResult}`);
|
|
16
|
-
}
|
|
17
|
-
return clientConfigFileResult;
|
|
18
|
-
};
|
|
19
|
-
exports.normalizeClientConfigFileHook = normalizeClientConfigFileHook;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeReturnObjectHook = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
/**
|
|
6
|
-
* Normalize hook that returns an object
|
|
7
|
-
*/
|
|
8
|
-
const normalizeReturnObjectHook = (hook) => async (app) => (0, shared_1.isFunction)(hook) ? hook(app) : hook;
|
|
9
|
-
exports.normalizeReturnObjectHook = normalizeReturnObjectHook;
|
package/lib/types/app/app.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type { Markdown } from '@vuepress/markdown';
|
|
2
|
-
import type { SiteData } from '@vuepress/shared';
|
|
3
|
-
import type { Bundler } from '../bundler';
|
|
4
|
-
import type { Page } from '../page';
|
|
5
|
-
import type { Plugin } from '../plugin';
|
|
6
|
-
import type { PluginApi } from '../pluginApi';
|
|
7
|
-
import type { AppOptions } from './options';
|
|
8
|
-
import type { AppDir, AppEnv, AppWriteTemp } from './utils';
|
|
9
|
-
/**
|
|
10
|
-
* Vuepress app
|
|
11
|
-
*/
|
|
12
|
-
export interface App {
|
|
13
|
-
/**
|
|
14
|
-
* Directory utils
|
|
15
|
-
*/
|
|
16
|
-
dir: AppDir;
|
|
17
|
-
/**
|
|
18
|
-
* Environment flags
|
|
19
|
-
*/
|
|
20
|
-
env: AppEnv;
|
|
21
|
-
/**
|
|
22
|
-
* Options that filled all optional fields with a default value
|
|
23
|
-
*/
|
|
24
|
-
options: AppOptions;
|
|
25
|
-
/**
|
|
26
|
-
* Plugin system
|
|
27
|
-
*/
|
|
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
|
-
/**
|
|
38
|
-
* Write temp file
|
|
39
|
-
*/
|
|
40
|
-
writeTemp: AppWriteTemp;
|
|
41
|
-
/**
|
|
42
|
-
* Use a plugin
|
|
43
|
-
*/
|
|
44
|
-
use: (plugin: Plugin) => this;
|
|
45
|
-
/**
|
|
46
|
-
* Initialize app.
|
|
47
|
-
*
|
|
48
|
-
* - Theme and plugin will be loaded.
|
|
49
|
-
* - Layouts and pages will be resolved.
|
|
50
|
-
*/
|
|
51
|
-
init: () => Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Prepare data for client and write temp files.
|
|
54
|
-
*
|
|
55
|
-
* Should be called after `app.init()`.
|
|
56
|
-
*/
|
|
57
|
-
prepare: () => Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Layout components.
|
|
60
|
-
*
|
|
61
|
-
* Only available after initialization
|
|
62
|
-
*/
|
|
63
|
-
layouts: Record<string, string>;
|
|
64
|
-
/**
|
|
65
|
-
* Markdown-it instance.
|
|
66
|
-
*
|
|
67
|
-
* Only available after initialization
|
|
68
|
-
*/
|
|
69
|
-
markdown: Markdown;
|
|
70
|
-
/**
|
|
71
|
-
* Page objects.
|
|
72
|
-
*
|
|
73
|
-
* Only available after initialization
|
|
74
|
-
*/
|
|
75
|
-
pages: Page[];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Vuepress dev app
|
|
79
|
-
*/
|
|
80
|
-
export interface DevApp extends App {
|
|
81
|
-
/**
|
|
82
|
-
* Start dev server
|
|
83
|
-
*
|
|
84
|
-
* Should be called after `app.prepare()`.
|
|
85
|
-
*/
|
|
86
|
-
dev: () => ReturnType<Bundler['dev']>;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Vuepress build app
|
|
90
|
-
*/
|
|
91
|
-
export interface BuildApp extends App {
|
|
92
|
-
/**
|
|
93
|
-
* Build static files
|
|
94
|
-
*
|
|
95
|
-
* Should be called after `app.prepare()`.
|
|
96
|
-
*/
|
|
97
|
-
build: () => ReturnType<Bundler['build']>;
|
|
98
|
-
}
|
package/lib/types/app/app.js
DELETED
package/lib/types/app/index.d.ts
DELETED
package/lib/types/app/index.js
DELETED
|
@@ -1,19 +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("./options"), exports);
|
|
19
|
-
__exportStar(require("./utils"), exports);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { MarkdownOptions } from '@vuepress/markdown';
|
|
2
|
-
import type { SiteData } from '@vuepress/shared';
|
|
3
|
-
import type { Bundler } from '../bundler';
|
|
4
|
-
import type { PluginConfig } from '../plugin';
|
|
5
|
-
import type { Theme } from '../theme';
|
|
6
|
-
/**
|
|
7
|
-
* Vuepress app common config that shared between dev and build
|
|
8
|
-
*/
|
|
9
|
-
export interface AppConfigCommon extends Partial<SiteData> {
|
|
10
|
-
source: string;
|
|
11
|
-
dest?: string;
|
|
12
|
-
temp?: string;
|
|
13
|
-
cache?: string;
|
|
14
|
-
public?: string;
|
|
15
|
-
debug?: boolean;
|
|
16
|
-
markdown?: MarkdownOptions;
|
|
17
|
-
pagePatterns?: string[];
|
|
18
|
-
permalinkPattern?: string | null;
|
|
19
|
-
bundler: Bundler;
|
|
20
|
-
theme: Theme;
|
|
21
|
-
plugins?: PluginConfig;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Vuepress app config for dev
|
|
25
|
-
*/
|
|
26
|
-
export interface AppConfigDev {
|
|
27
|
-
/**
|
|
28
|
-
* Specify the host to use for the dev server
|
|
29
|
-
*
|
|
30
|
-
* @default '0.0.0.0'
|
|
31
|
-
*/
|
|
32
|
-
host?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Specify the port to use for the dev server
|
|
35
|
-
*
|
|
36
|
-
* @default 8080
|
|
37
|
-
*/
|
|
38
|
-
port?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Whether to open the browser after dev-server had been started
|
|
41
|
-
*
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
open?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Specify the path of the HTML template to be used for dev
|
|
47
|
-
*
|
|
48
|
-
* @default '@vuepress/client/templates/dev.html'
|
|
49
|
-
*/
|
|
50
|
-
templateDev?: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Vuepress app config for build
|
|
54
|
-
*/
|
|
55
|
-
export interface AppConfigBuild {
|
|
56
|
-
/**
|
|
57
|
-
* Determine what resource files should be preloaded. Use boolean value to
|
|
58
|
-
* totally enable / disable.
|
|
59
|
-
*
|
|
60
|
-
* @default true
|
|
61
|
-
*/
|
|
62
|
-
shouldPreload?: ((file: string, type: string) => boolean) | boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Determine what resource files should be prefetched. Use boolean value to
|
|
65
|
-
* totally enable / disable.
|
|
66
|
-
*
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
shouldPrefetch?: ((file: string, type: string) => boolean) | boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Specify the path of the HTML template to be used for build
|
|
72
|
-
*
|
|
73
|
-
* @default '@vuepress/client/templates/build.html'
|
|
74
|
-
*/
|
|
75
|
-
templateBuild?: string;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Vuepress app config
|
|
79
|
-
*/
|
|
80
|
-
export declare type AppConfig = AppConfigCommon & AppConfigDev & AppConfigBuild;
|
|
81
|
-
/**
|
|
82
|
-
* Vuepress app options
|
|
83
|
-
*/
|
|
84
|
-
export declare type AppOptions = Required<AppConfig>;
|
package/lib/types/app/options.js
DELETED
package/lib/types/app/utils.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Directory util function
|
|
3
|
-
*/
|
|
4
|
-
export declare type AppDirFunction = (...args: string[]) => string;
|
|
5
|
-
/**
|
|
6
|
-
* Directory utils
|
|
7
|
-
*/
|
|
8
|
-
export interface AppDir {
|
|
9
|
-
cache: AppDirFunction;
|
|
10
|
-
temp: AppDirFunction;
|
|
11
|
-
source: AppDirFunction;
|
|
12
|
-
dest: AppDirFunction;
|
|
13
|
-
public: AppDirFunction;
|
|
14
|
-
client: AppDirFunction;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Environment flags
|
|
18
|
-
*/
|
|
19
|
-
export interface AppEnv {
|
|
20
|
-
/**
|
|
21
|
-
* Is running in build mode or not
|
|
22
|
-
*/
|
|
23
|
-
isBuild: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Is running in dev mode or not
|
|
26
|
-
*/
|
|
27
|
-
isDev: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Is debug mode enabled or not
|
|
30
|
-
*/
|
|
31
|
-
isDebug: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Write temp file util
|
|
35
|
-
*/
|
|
36
|
-
export declare type AppWriteTemp = (file: string, content: string) => Promise<string>;
|
package/lib/types/app/utils.js
DELETED
package/lib/types/bundler.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { App } from './app';
|
|
2
|
-
/**
|
|
3
|
-
* Vuepress bundler
|
|
4
|
-
*
|
|
5
|
-
* It provides abilities to:
|
|
6
|
-
* - dev: run dev server for development
|
|
7
|
-
* - build: bundle assets for deployment
|
|
8
|
-
*/
|
|
9
|
-
export interface Bundler {
|
|
10
|
-
name: string;
|
|
11
|
-
dev: (app: App) => Promise<() => Promise<void>>;
|
|
12
|
-
build: (app: App) => Promise<void>;
|
|
13
|
-
}
|
package/lib/types/bundler.js
DELETED
package/lib/types/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, LocaleConfig, LocaleData, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig } from '@vuepress/shared';
|
|
2
|
-
export type { HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, HeadAttrsConfig, LocaleConfig, LocaleData, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig, };
|
|
3
|
-
export * from './app';
|
|
4
|
-
export * from './bundler';
|
|
5
|
-
export * from './page';
|
|
6
|
-
export * from './plugin';
|
|
7
|
-
export * from './pluginApi';
|
|
8
|
-
export * from './theme';
|
package/lib/types/index.js
DELETED
|
@@ -1,22 +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("./bundler"), exports);
|
|
19
|
-
__exportStar(require("./page"), exports);
|
|
20
|
-
__exportStar(require("./plugin"), exports);
|
|
21
|
-
__exportStar(require("./pluginApi"), exports);
|
|
22
|
-
__exportStar(require("./theme"), exports);
|
package/lib/types/page.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { MarkdownLink } from '@vuepress/markdown';
|
|
2
|
-
import type { PageBase, PageData, PageFrontmatter } from '@vuepress/shared';
|
|
3
|
-
/**
|
|
4
|
-
* Vuepress Page
|
|
5
|
-
*/
|
|
6
|
-
export declare type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>, ExtraPageFields extends Record<any, any> = Record<never, never>> = PageBase<ExtraPageFrontmatter> & ExtraPageFields & {
|
|
7
|
-
/**
|
|
8
|
-
* Data of the page, which will be available in client code
|
|
9
|
-
*/
|
|
10
|
-
data: PageData<ExtraPageData, ExtraPageFrontmatter>;
|
|
11
|
-
/**
|
|
12
|
-
* Raw Content of the page
|
|
13
|
-
*/
|
|
14
|
-
content: string;
|
|
15
|
-
/**
|
|
16
|
-
* Rendered content of the page
|
|
17
|
-
*/
|
|
18
|
-
contentRendered: string;
|
|
19
|
-
/**
|
|
20
|
-
* Date of the page, in 'yyyy-MM-dd' format
|
|
21
|
-
*
|
|
22
|
-
* @example '2020-09-09'
|
|
23
|
-
*/
|
|
24
|
-
date: string;
|
|
25
|
-
/**
|
|
26
|
-
* Dependencies of the page
|
|
27
|
-
*/
|
|
28
|
-
deps: string[];
|
|
29
|
-
/**
|
|
30
|
-
* Hoisted tags of the page
|
|
31
|
-
*/
|
|
32
|
-
hoistedTags: string[];
|
|
33
|
-
/**
|
|
34
|
-
* Links of the page
|
|
35
|
-
*/
|
|
36
|
-
links: MarkdownLink[];
|
|
37
|
-
/**
|
|
38
|
-
* Path of the page that inferred from file path
|
|
39
|
-
*
|
|
40
|
-
* If the page does not come from a file, it would be `null`
|
|
41
|
-
*
|
|
42
|
-
* @example '/guide/index.html'
|
|
43
|
-
*/
|
|
44
|
-
pathInferred: string | null;
|
|
45
|
-
/**
|
|
46
|
-
* Locale path prefix of the page
|
|
47
|
-
*
|
|
48
|
-
* @example '/getting-started.html' -> '/'
|
|
49
|
-
* @example '/en/getting-started.html' -> '/en/'
|
|
50
|
-
* @example '/zh/getting-started.html' -> '/zh/'
|
|
51
|
-
*/
|
|
52
|
-
pathLocale: string;
|
|
53
|
-
/**
|
|
54
|
-
* Permalink of the page
|
|
55
|
-
*
|
|
56
|
-
* If the page does not have a permalink, it would be `null`
|
|
57
|
-
*/
|
|
58
|
-
permalink: string | null;
|
|
59
|
-
/**
|
|
60
|
-
* Custom data to be attached to the page route record of vue-router
|
|
61
|
-
*
|
|
62
|
-
* @see https://router.vuejs.org/api/#meta
|
|
63
|
-
*/
|
|
64
|
-
routeMeta: Record<string, unknown>;
|
|
65
|
-
/**
|
|
66
|
-
* Slug of the page
|
|
67
|
-
*/
|
|
68
|
-
slug: string;
|
|
69
|
-
/**
|
|
70
|
-
* Source file path
|
|
71
|
-
*
|
|
72
|
-
* If the page does not come from a file, it would be `null`
|
|
73
|
-
*/
|
|
74
|
-
filePath: string | null;
|
|
75
|
-
/**
|
|
76
|
-
* Source file path relative to source directory
|
|
77
|
-
*
|
|
78
|
-
* If the page does not come from a file, it would be `null`
|
|
79
|
-
*/
|
|
80
|
-
filePathRelative: string | null;
|
|
81
|
-
/**
|
|
82
|
-
* Component file path
|
|
83
|
-
*/
|
|
84
|
-
componentFilePath: string;
|
|
85
|
-
/**
|
|
86
|
-
* Component file path relative to temp directory
|
|
87
|
-
*/
|
|
88
|
-
componentFilePathRelative: string;
|
|
89
|
-
/**
|
|
90
|
-
* Component file chunk name
|
|
91
|
-
*
|
|
92
|
-
* Only take effect in webpack
|
|
93
|
-
*/
|
|
94
|
-
componentFileChunkName: string;
|
|
95
|
-
/**
|
|
96
|
-
* Page data file path
|
|
97
|
-
*/
|
|
98
|
-
dataFilePath: string;
|
|
99
|
-
/**
|
|
100
|
-
* Page data file path relative to temp directory
|
|
101
|
-
*/
|
|
102
|
-
dataFilePathRelative: string;
|
|
103
|
-
/**
|
|
104
|
-
* Page data file chunk name
|
|
105
|
-
*
|
|
106
|
-
* Only take effect in webpack
|
|
107
|
-
*/
|
|
108
|
-
dataFileChunkName: string;
|
|
109
|
-
/**
|
|
110
|
-
* Rendered html file path
|
|
111
|
-
*/
|
|
112
|
-
htmlFilePath: string;
|
|
113
|
-
/**
|
|
114
|
-
* Rendered html file path relative to dest directory
|
|
115
|
-
*/
|
|
116
|
-
htmlFilePathRelative: string;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Options to create vuepress page
|
|
120
|
-
*/
|
|
121
|
-
export interface PageOptions {
|
|
122
|
-
/**
|
|
123
|
-
* If `filePath` is not set, this option will be used as the raw
|
|
124
|
-
* markdown content of the page.
|
|
125
|
-
*
|
|
126
|
-
* If `filePath` is set, this option will be ignored, while the
|
|
127
|
-
* content of the file will be used.
|
|
128
|
-
*/
|
|
129
|
-
content?: string;
|
|
130
|
-
/**
|
|
131
|
-
* Absolute file path of the markdown source file.
|
|
132
|
-
*/
|
|
133
|
-
filePath?: string;
|
|
134
|
-
/**
|
|
135
|
-
* Default frontmatter of the page, which could be overridden by
|
|
136
|
-
* the frontmatter of the markdown content.
|
|
137
|
-
*/
|
|
138
|
-
frontmatter?: PageFrontmatter;
|
|
139
|
-
/**
|
|
140
|
-
* If this option is set, it will be used as the final route path
|
|
141
|
-
* of the page, ignoring the relative path and permalink.
|
|
142
|
-
*/
|
|
143
|
-
path?: string;
|
|
144
|
-
}
|
package/lib/types/page.js
DELETED
package/lib/types/plugin.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { App } from './app';
|
|
2
|
-
import type { HooksExposed } from './pluginApi';
|
|
3
|
-
/**
|
|
4
|
-
* Vuepress plugin
|
|
5
|
-
*
|
|
6
|
-
* A plugin should be rather:
|
|
7
|
-
* - an object (`PluginObject`)
|
|
8
|
-
* - a function that returns an object (`PluginFunction`)
|
|
9
|
-
*
|
|
10
|
-
* A plugin package should have a `Plugin` as the default export
|
|
11
|
-
*/
|
|
12
|
-
export declare type Plugin<T extends PluginObject = PluginObject> = T | PluginFunction<T>;
|
|
13
|
-
/**
|
|
14
|
-
* Vuepress plugin function
|
|
15
|
-
*
|
|
16
|
-
* It accepts plugin options and vuepress app, returns plugin object
|
|
17
|
-
*/
|
|
18
|
-
export declare type PluginFunction<T extends PluginObject = PluginObject> = (app: App) => T;
|
|
19
|
-
/**
|
|
20
|
-
* Vuepress plugin object
|
|
21
|
-
*/
|
|
22
|
-
export interface PluginObject extends Partial<HooksExposed> {
|
|
23
|
-
name: string;
|
|
24
|
-
multiple?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Config field for plugins
|
|
28
|
-
*/
|
|
29
|
-
export declare type PluginConfig = (Plugin | Plugin[])[];
|
package/lib/types/plugin.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { Markdown, MarkdownOptions } from '@vuepress/markdown';
|
|
2
|
-
import type { App } from '../app';
|
|
3
|
-
import type { Page, PageOptions } from '../page';
|
|
4
|
-
declare type PromiseOrNot<T> = Promise<T> | T;
|
|
5
|
-
declare type Closable = {
|
|
6
|
-
close(): void;
|
|
7
|
-
};
|
|
8
|
-
export declare type Hook<Exposed, Normalized = Exposed, Result = Normalized extends (...args: any) => infer U ? U extends Promise<infer V> ? V : U : void> = {
|
|
9
|
-
exposed: Exposed;
|
|
10
|
-
normalized: Normalized;
|
|
11
|
-
result: Result;
|
|
12
|
-
};
|
|
13
|
-
export declare type LifeCycleHook<T extends unknown[] = []> = Hook<(app: App, ...args: T) => PromiseOrNot<void>>;
|
|
14
|
-
export declare type ExtendsHook<T> = Hook<(extendable: T, app: App) => PromiseOrNot<void>>;
|
|
15
|
-
export declare type ClientConfigFileHook = Hook<string | ((app: App) => PromiseOrNot<string>), (app: App) => Promise<string>>;
|
|
16
|
-
export declare type ReturnObjectHook = Hook<Record<string, any> | ((app: App) => PromiseOrNot<Record<string, any>>), (app: App) => Promise<Record<string, any>>>;
|
|
17
|
-
/**
|
|
18
|
-
* List of hooks
|
|
19
|
-
*/
|
|
20
|
-
export interface Hooks {
|
|
21
|
-
onInitialized: LifeCycleHook;
|
|
22
|
-
onPrepared: LifeCycleHook;
|
|
23
|
-
onWatched: LifeCycleHook<[watchers: Closable[], restart: () => Promise<void>]>;
|
|
24
|
-
onGenerated: LifeCycleHook;
|
|
25
|
-
extendsMarkdownOptions: ExtendsHook<MarkdownOptions>;
|
|
26
|
-
extendsMarkdown: ExtendsHook<Markdown>;
|
|
27
|
-
extendsPageOptions: ExtendsHook<PageOptions>;
|
|
28
|
-
extendsPage: ExtendsHook<Page>;
|
|
29
|
-
extendsBundlerOptions: ExtendsHook<any>;
|
|
30
|
-
clientConfigFile: ClientConfigFileHook;
|
|
31
|
-
alias: ReturnObjectHook;
|
|
32
|
-
define: ReturnObjectHook;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Name of hooks
|
|
36
|
-
*/
|
|
37
|
-
export declare type HooksName = keyof Hooks;
|
|
38
|
-
/**
|
|
39
|
-
* Exposed hooks API that can be accessed by a plugin
|
|
40
|
-
*/
|
|
41
|
-
export declare type HooksExposed = {
|
|
42
|
-
[K in HooksName]: Hooks[K]['exposed'];
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Normalized hooks
|
|
46
|
-
*/
|
|
47
|
-
export declare type HooksNormalized = {
|
|
48
|
-
[K in HooksName]: Hooks[K]['normalized'];
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Result of hooks
|
|
52
|
-
*/
|
|
53
|
-
export declare type HooksResult = {
|
|
54
|
-
[K in HooksName]: Hooks[K]['result'];
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Hook item
|
|
58
|
-
*/
|
|
59
|
-
export interface HookItem<T extends HooksName> {
|
|
60
|
-
pluginName: string;
|
|
61
|
-
hook: HooksNormalized[T];
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Hook items queue
|
|
65
|
-
*/
|
|
66
|
-
export interface HookQueue<T extends HooksName> {
|
|
67
|
-
name: T;
|
|
68
|
-
items: HookItem<T>[];
|
|
69
|
-
add: (item: HookItem<T>) => void;
|
|
70
|
-
process: (...args: Parameters<HooksNormalized[T]>) => Promise<HooksResult[T][]>;
|
|
71
|
-
}
|
|
72
|
-
export {};
|