@vuepress/core 2.0.0-beta.9 → 2.0.0-rc.0
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/dist/index.d.ts +845 -0
- package/dist/index.js +1039 -0
- package/package.json +34 -17
- package/CHANGELOG.md +0 -338
- package/lib/app/appInit.d.ts +0 -7
- package/lib/app/appInit.js +0 -26
- package/lib/app/appPrepare.d.ts +0 -10
- package/lib/app/appPrepare.js +0 -46
- package/lib/app/appUse.d.ts +0 -2
- package/lib/app/appUse.js +0 -28
- package/lib/app/appUseByConfig.d.ts +0 -2
- package/lib/app/appUseByConfig.js +0 -11
- package/lib/app/createApp.d.ts +0 -5
- package/lib/app/createApp.js +0 -55
- package/lib/app/createAppDir.d.ts +0 -9
- package/lib/app/createAppDir.js +0 -32
- package/lib/app/createAppEnv.d.ts +0 -5
- package/lib/app/createAppEnv.js +0 -14
- package/lib/app/createAppOptions.d.ts +0 -5
- package/lib/app/createAppOptions.js +0 -47
- package/lib/app/createAppPages.d.ts +0 -5
- package/lib/app/createAppPages.js +0 -36
- package/lib/app/createAppSiteData.d.ts +0 -7
- package/lib/app/createAppSiteData.js +0 -19
- 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/createAppWriteTemp.js +0 -21
- package/lib/app/index.d.ts +0 -16
- package/lib/app/index.js +0 -28
- package/lib/app/normalizePlugin.d.ts +0 -2
- package/lib/app/normalizePlugin.js +0 -17
- package/lib/app/normalizePluginConfig.d.ts +0 -2
- package/lib/app/normalizePluginConfig.js +0 -15
- package/lib/app/prepare/index.d.ts +0 -12
- package/lib/app/prepare/index.js +0 -24
- package/lib/app/prepare/prepareClientAppEnhances.d.ts +0 -5
- package/lib/app/prepare/prepareClientAppEnhances.js +0 -24
- package/lib/app/prepare/prepareClientAppRootComponents.d.ts +0 -5
- package/lib/app/prepare/prepareClientAppRootComponents.js +0 -24
- package/lib/app/prepare/prepareClientAppSetups.d.ts +0 -5
- package/lib/app/prepare/prepareClientAppSetups.js +0 -24
- 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 -10
- package/lib/app/prepare/preparePageData.d.ts +0 -5
- package/lib/app/prepare/preparePageData.js +0 -37
- package/lib/app/prepare/preparePageRoutes.d.ts +0 -5
- package/lib/app/prepare/preparePageRoutes.js +0 -57
- package/lib/app/prepare/preparePagesComponent.d.ts +0 -5
- package/lib/app/prepare/preparePagesComponent.js +0 -23
- package/lib/app/prepare/preparePagesData.d.ts +0 -5
- package/lib/app/prepare/preparePagesData.js +0 -19
- package/lib/app/prepare/preparePagesRoutes.d.ts +0 -5
- package/lib/app/prepare/preparePagesRoutes.js +0 -25
- package/lib/app/prepare/prepareSiteData.d.ts +0 -5
- package/lib/app/prepare/prepareSiteData.js +0 -31
- package/lib/app/prepare/resolvePageData.d.ts +0 -5
- package/lib/app/prepare/resolvePageData.js +0 -18
- package/lib/app/resolveBundler.d.ts +0 -2
- package/lib/app/resolveBundler.js +0 -10
- package/lib/app/resolvePlugin.d.ts +0 -5
- package/lib/app/resolvePlugin.js +0 -20
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -17
- package/lib/page/createPage.d.ts +0 -2
- package/lib/page/createPage.js +0 -112
- package/lib/page/index.d.ts +0 -18
- package/lib/page/index.js +0 -30
- package/lib/page/inferPagePath.d.ts +0 -11
- package/lib/page/inferPagePath.js +0 -27
- package/lib/page/resolvePageComponentInfo.d.ts +0 -20
- package/lib/page/resolvePageComponentInfo.js +0 -38
- package/lib/page/resolvePageContent.d.ts +0 -11
- package/lib/page/resolvePageContent.js +0 -30
- package/lib/page/resolvePageDataInfo.d.ts +0 -12
- package/lib/page/resolvePageDataInfo.js +0 -17
- package/lib/page/resolvePageDate.d.ts +0 -10
- package/lib/page/resolvePageDate.js +0 -46
- package/lib/page/resolvePageExcerpt.d.ts +0 -10
- package/lib/page/resolvePageExcerpt.js +0 -16
- package/lib/page/resolvePageFileContent.d.ts +0 -8
- package/lib/page/resolvePageFileContent.js +0 -24
- package/lib/page/resolvePageFilePath.d.ts +0 -11
- package/lib/page/resolvePageFilePath.js +0 -29
- 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 -15
- package/lib/page/resolvePagePath.d.ts +0 -9
- package/lib/page/resolvePagePath.js +0 -19
- package/lib/page/resolvePagePermalink.d.ts +0 -11
- package/lib/page/resolvePagePermalink.js +0 -32
- package/lib/page/resolvePageRoutesInfo.d.ts +0 -11
- package/lib/page/resolvePageRoutesInfo.js +0 -15
- package/lib/page/resolvePageSlug.d.ts +0 -6
- package/lib/page/resolvePageSlug.js +0 -17
- package/lib/page/resolvePageTitle.d.ts +0 -9
- package/lib/page/resolvePageTitle.js +0 -26
- package/lib/pluginApi/createHookQueue.d.ts +0 -5
- package/lib/pluginApi/createHookQueue.js +0 -81
- 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 -24
- package/lib/pluginApi/createPluginApiRegisterHooks.d.ts +0 -2
- package/lib/pluginApi/createPluginApiRegisterHooks.js +0 -54
- package/lib/pluginApi/index.d.ts +0 -6
- package/lib/pluginApi/index.js +0 -18
- package/lib/pluginApi/normalizeClientFilesHook.d.ts +0 -5
- package/lib/pluginApi/normalizeClientFilesHook.js +0 -28
- package/lib/pluginApi/normalizeReturnObjectHook.d.ts +0 -5
- package/lib/pluginApi/normalizeReturnObjectHook.js +0 -9
- package/lib/themeApi/createThemeApi.d.ts +0 -7
- package/lib/themeApi/createThemeApi.js +0 -30
- package/lib/themeApi/index.d.ts +0 -3
- package/lib/themeApi/index.js +0 -15
- package/lib/themeApi/resolveThemeInfo.d.ts +0 -2
- package/lib/themeApi/resolveThemeInfo.js +0 -32
- package/lib/themeApi/resolveThemeLayouts.d.ts +0 -5
- package/lib/themeApi/resolveThemeLayouts.js +0 -32
- package/lib/types/app/app.d.ts +0 -30
- package/lib/types/app/app.js +0 -2
- package/lib/types/app/index.d.ts +0 -3
- package/lib/types/app/index.js +0 -15
- package/lib/types/app/options.d.ts +0 -31
- package/lib/types/app/options.js +0 -2
- package/lib/types/app/utils.d.ts +0 -29
- package/lib/types/app/utils.js +0 -2
- package/lib/types/bundler.d.ts +0 -34
- package/lib/types/bundler.js +0 -2
- package/lib/types/index.d.ts +0 -9
- package/lib/types/index.js +0 -19
- package/lib/types/page.d.ts +0 -110
- package/lib/types/page.js +0 -2
- package/lib/types/plugin.d.ts +0 -48
- package/lib/types/plugin.js +0 -2
- package/lib/types/pluginApi/hooks.d.ts +0 -75
- package/lib/types/pluginApi/hooks.js +0 -2
- package/lib/types/pluginApi/index.d.ts +0 -2
- package/lib/types/pluginApi/index.js +0 -14
- package/lib/types/pluginApi/pluginApi.d.ts +0 -23
- package/lib/types/pluginApi/pluginApi.js +0 -2
- package/lib/types/theme.d.ts +0 -33
- package/lib/types/theme.js +0 -2
- package/lib/types/themeApi/index.d.ts +0 -1
- package/lib/types/themeApi/index.js +0 -13
- package/lib/types/themeApi/themeApi.d.ts +0 -44
- package/lib/types/themeApi/themeApi.js +0 -2
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveThemeLayouts = void 0;
|
|
4
|
-
const shared_1 = require("@vuepress/shared");
|
|
5
|
-
const utils_1 = require("@vuepress/utils");
|
|
6
|
-
const resolveThemeLayouts = ({ themePath, themePlugin, }) => {
|
|
7
|
-
if (!themePlugin.layouts) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
// use the layouts component map directly
|
|
11
|
-
if (shared_1.isPlainObject(themePlugin.layouts)) {
|
|
12
|
-
return Object.entries(themePlugin.layouts).map(([name, file]) => ({
|
|
13
|
-
name,
|
|
14
|
-
path: file,
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
// resolve the layouts directory
|
|
18
|
-
if (!utils_1.fs.pathExistsSync(themePlugin.layouts)) {
|
|
19
|
-
throw utils_1.logger.createError(`layouts directory does not exist: ${utils_1.chalk.magenta(themePlugin.layouts)}`);
|
|
20
|
-
}
|
|
21
|
-
// load all files in layouts directory
|
|
22
|
-
const files = utils_1.fs.readdirSync(themePlugin.layouts);
|
|
23
|
-
// take matched files as theme layouts
|
|
24
|
-
const layouts = files
|
|
25
|
-
.filter((file) => /\.(vue|ts|js)$/.test(file))
|
|
26
|
-
.map((file) => ({
|
|
27
|
-
name: utils_1.path.trimExt(file),
|
|
28
|
-
path: utils_1.path.resolve(themePlugin.layouts, file),
|
|
29
|
-
}));
|
|
30
|
-
return layouts;
|
|
31
|
-
};
|
|
32
|
-
exports.resolveThemeLayouts = resolveThemeLayouts;
|
package/lib/types/app/app.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Markdown } from '@vuepress/markdown';
|
|
2
|
-
import type { SiteData } from '@vuepress/shared';
|
|
3
|
-
import type { BundlerDev, BundlerBuild } from '../bundler';
|
|
4
|
-
import type { Page } from '../page';
|
|
5
|
-
import type { Plugin, PluginOptions, PluginConfig } from '../plugin';
|
|
6
|
-
import type { PluginApi } from '../pluginApi';
|
|
7
|
-
import type { ThemeApi } from '../themeApi';
|
|
8
|
-
import type { AppOptions } from './options';
|
|
9
|
-
import type { AppDir, AppEnv, AppWriteTemp } from './utils';
|
|
10
|
-
/**
|
|
11
|
-
* Vuepress app
|
|
12
|
-
*/
|
|
13
|
-
export interface App {
|
|
14
|
-
version: string;
|
|
15
|
-
options: AppOptions;
|
|
16
|
-
dir: AppDir;
|
|
17
|
-
env: AppEnv;
|
|
18
|
-
siteData: SiteData;
|
|
19
|
-
markdown: Markdown;
|
|
20
|
-
pluginApi: PluginApi;
|
|
21
|
-
themeApi: ThemeApi;
|
|
22
|
-
pages: Page[];
|
|
23
|
-
writeTemp: AppWriteTemp;
|
|
24
|
-
use: <T extends PluginOptions>(plugin: Plugin<T> | string, config?: Partial<T>) => void;
|
|
25
|
-
useByConfig: <T extends PluginOptions>(pluginConfig: PluginConfig<T>) => void;
|
|
26
|
-
init: () => Promise<void>;
|
|
27
|
-
prepare: () => Promise<void>;
|
|
28
|
-
dev: () => ReturnType<BundlerDev>;
|
|
29
|
-
build: () => ReturnType<BundlerBuild>;
|
|
30
|
-
}
|
package/lib/types/app/app.js
DELETED
package/lib/types/app/index.d.ts
DELETED
package/lib/types/app/index.js
DELETED
|
@@ -1,15 +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
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./app"), exports);
|
|
14
|
-
__exportStar(require("./options"), exports);
|
|
15
|
-
__exportStar(require("./utils"), exports);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { MarkdownOptions } from '@vuepress/markdown';
|
|
2
|
-
import type { SiteLocaleConfig, SiteLocaleData } from '@vuepress/shared';
|
|
3
|
-
import type { BundlerConfig } from '../bundler';
|
|
4
|
-
import type { ThemeConfig } from '../theme';
|
|
5
|
-
/**
|
|
6
|
-
* Vuepress app options
|
|
7
|
-
*/
|
|
8
|
-
export interface AppOptions<T extends ThemeConfig = ThemeConfig, U extends BundlerConfig = BundlerConfig> extends SiteLocaleData {
|
|
9
|
-
base: string;
|
|
10
|
-
locales: SiteLocaleConfig;
|
|
11
|
-
theme: string;
|
|
12
|
-
themeConfig: Partial<T>;
|
|
13
|
-
bundler: string;
|
|
14
|
-
bundlerConfig: Partial<U>;
|
|
15
|
-
source: string;
|
|
16
|
-
dest: string;
|
|
17
|
-
temp: string;
|
|
18
|
-
cache: string;
|
|
19
|
-
public: string;
|
|
20
|
-
markdown: MarkdownOptions;
|
|
21
|
-
debug: boolean;
|
|
22
|
-
host: string;
|
|
23
|
-
port: number;
|
|
24
|
-
open: boolean;
|
|
25
|
-
pagePatterns: string[];
|
|
26
|
-
templateDev: string;
|
|
27
|
-
templateSSR: string;
|
|
28
|
-
shouldPreload: ((file: string, type: string) => boolean) | boolean;
|
|
29
|
-
shouldPrefetch: ((file: string, type: string) => boolean) | boolean;
|
|
30
|
-
}
|
|
31
|
-
export declare type AppConfig = Partial<AppOptions> & Pick<AppOptions, 'source'>;
|
package/lib/types/app/options.js
DELETED
package/lib/types/app/utils.d.ts
DELETED
|
@@ -1,29 +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
|
-
isProd: boolean;
|
|
21
|
-
isTest: boolean;
|
|
22
|
-
isDev: boolean;
|
|
23
|
-
isDebug: boolean;
|
|
24
|
-
nodeEnv: string | undefined;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Write temp file util
|
|
28
|
-
*/
|
|
29
|
-
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,34 +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
|
-
dev: BundlerDev;
|
|
11
|
-
build: BundlerBuild;
|
|
12
|
-
}
|
|
13
|
-
export declare type BundlerDev = (app: App) => Promise<() => Promise<void>>;
|
|
14
|
-
export declare type BundlerBuild = (app: App) => Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* A function that returns a bundler instance
|
|
17
|
-
*
|
|
18
|
-
* A bundler package should have a `CreateBundlerFunction` as the default export
|
|
19
|
-
*/
|
|
20
|
-
export declare type CreateBundlerFunction<BundlerOptions extends BundlerConfig = Partial<BundlerConfig>> = (options: BundlerOptions) => Bundler;
|
|
21
|
-
/**
|
|
22
|
-
* Bundler entry type
|
|
23
|
-
*/
|
|
24
|
-
export interface BundlerEntry {
|
|
25
|
-
createBundler: CreateBundlerFunction;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* User config type of bundler
|
|
29
|
-
*
|
|
30
|
-
* @remark suffix `Config` means this is for user config
|
|
31
|
-
*/
|
|
32
|
-
export interface BundlerConfig {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}
|
package/lib/types/bundler.js
DELETED
package/lib/types/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, HeadAttrsConfig, 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';
|
|
9
|
-
export * from './themeApi';
|
package/lib/types/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
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./app"), exports);
|
|
14
|
-
__exportStar(require("./bundler"), exports);
|
|
15
|
-
__exportStar(require("./page"), exports);
|
|
16
|
-
__exportStar(require("./plugin"), exports);
|
|
17
|
-
__exportStar(require("./pluginApi"), exports);
|
|
18
|
-
__exportStar(require("./theme"), exports);
|
|
19
|
-
__exportStar(require("./themeApi"), exports);
|
package/lib/types/page.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { MarkdownLink } from '@vuepress/markdown';
|
|
2
|
-
import type { PageData, PageFrontmatter } from '@vuepress/shared';
|
|
3
|
-
/**
|
|
4
|
-
* Vuepress Page
|
|
5
|
-
*/
|
|
6
|
-
export interface Page extends PageData {
|
|
7
|
-
/**
|
|
8
|
-
* Path of the page that inferred from file path
|
|
9
|
-
*
|
|
10
|
-
* If the page does not come from a file, it would be `null`
|
|
11
|
-
*
|
|
12
|
-
* @example '/guide/index.html'
|
|
13
|
-
*/
|
|
14
|
-
pathInferred: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Locale path prefix of the page
|
|
17
|
-
*
|
|
18
|
-
* @example '/getting-started.html' -> '/'
|
|
19
|
-
* @example '/en/getting-started.html' -> '/en/'
|
|
20
|
-
* @example '/zh/getting-started.html' -> '/zh/'
|
|
21
|
-
*/
|
|
22
|
-
pathLocale: string;
|
|
23
|
-
/**
|
|
24
|
-
* Source file path
|
|
25
|
-
*
|
|
26
|
-
* If the page does not come from a file, it would be `null`
|
|
27
|
-
*/
|
|
28
|
-
filePath: string | null;
|
|
29
|
-
/**
|
|
30
|
-
* Source file path relative to source directory
|
|
31
|
-
*
|
|
32
|
-
* If the page does not come from a file, it would be `null`
|
|
33
|
-
*/
|
|
34
|
-
filePathRelative: string | null;
|
|
35
|
-
/**
|
|
36
|
-
* Rendered html file path
|
|
37
|
-
*/
|
|
38
|
-
htmlFilePath: string;
|
|
39
|
-
/**
|
|
40
|
-
* Rendered html file path relative to dest directory
|
|
41
|
-
*/
|
|
42
|
-
htmlFilePathRelative: string;
|
|
43
|
-
/**
|
|
44
|
-
* Component file path
|
|
45
|
-
*/
|
|
46
|
-
componentFilePath: string;
|
|
47
|
-
/**
|
|
48
|
-
* Component file path relative to temp directory
|
|
49
|
-
*/
|
|
50
|
-
componentFilePathRelative: string;
|
|
51
|
-
/**
|
|
52
|
-
* Component file content that generated from the source file
|
|
53
|
-
*/
|
|
54
|
-
componentFileContent: string;
|
|
55
|
-
/**
|
|
56
|
-
* Component file chunk name
|
|
57
|
-
*
|
|
58
|
-
* Only take effect in webpack
|
|
59
|
-
*/
|
|
60
|
-
componentFileChunkName: string;
|
|
61
|
-
/**
|
|
62
|
-
* Page data file path
|
|
63
|
-
*/
|
|
64
|
-
dataFilePath: string;
|
|
65
|
-
/**
|
|
66
|
-
* Page data file path relative to temp directory
|
|
67
|
-
*/
|
|
68
|
-
dataFilePathRelative: string;
|
|
69
|
-
/**
|
|
70
|
-
* Page data file chunk name
|
|
71
|
-
*
|
|
72
|
-
* Only take effect in webpack
|
|
73
|
-
*/
|
|
74
|
-
dataFileChunkName: string;
|
|
75
|
-
/**
|
|
76
|
-
* Page routes file path
|
|
77
|
-
*/
|
|
78
|
-
routesFilePath: string;
|
|
79
|
-
/**
|
|
80
|
-
* Page routes file path relative to temp directory
|
|
81
|
-
*/
|
|
82
|
-
routesFilePathRelative: string;
|
|
83
|
-
/**
|
|
84
|
-
* Content of the page
|
|
85
|
-
*/
|
|
86
|
-
content: string;
|
|
87
|
-
/**
|
|
88
|
-
* Links of the page
|
|
89
|
-
*/
|
|
90
|
-
links: MarkdownLink[];
|
|
91
|
-
/**
|
|
92
|
-
* Slug of the page
|
|
93
|
-
*/
|
|
94
|
-
slug: string;
|
|
95
|
-
/**
|
|
96
|
-
* Date of the page, in 'yyyy-MM-dd' format
|
|
97
|
-
*
|
|
98
|
-
* @example '2020-09-09'
|
|
99
|
-
*/
|
|
100
|
-
date: string;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Options to create vuepress page
|
|
104
|
-
*/
|
|
105
|
-
export interface PageOptions {
|
|
106
|
-
path?: string;
|
|
107
|
-
filePath?: string;
|
|
108
|
-
frontmatter?: PageFrontmatter;
|
|
109
|
-
content?: string;
|
|
110
|
-
}
|
package/lib/types/page.js
DELETED
package/lib/types/plugin.d.ts
DELETED
|
@@ -1,48 +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 PluginOptions = PluginOptions, U extends PluginObject = PluginObject> = U | PluginFunction<T, U>;
|
|
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 PluginOptions = PluginOptions, U extends PluginObject = PluginObject> = (pluginConfig: Partial<T>, app: App) => U;
|
|
19
|
-
/**
|
|
20
|
-
* Vuepress plugin object
|
|
21
|
-
*/
|
|
22
|
-
export interface PluginObject extends Partial<HooksExposed> {
|
|
23
|
-
name: string;
|
|
24
|
-
multiple?: boolean;
|
|
25
|
-
plugins?: PluginConfig[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Vuepress plugin options
|
|
29
|
-
*
|
|
30
|
-
* It can be set by user in user config, and will be passed to plugin function
|
|
31
|
-
*/
|
|
32
|
-
export declare type PluginOptions = Record<string, any>;
|
|
33
|
-
/**
|
|
34
|
-
* Plugin config to be used in user config file
|
|
35
|
-
*
|
|
36
|
-
* Users can use this config to control which plugins to be used,
|
|
37
|
-
* and set the plugin options
|
|
38
|
-
*
|
|
39
|
-
* @remark suffix `Config` means this is for user config
|
|
40
|
-
*/
|
|
41
|
-
export declare type PluginConfig<T extends PluginOptions = PluginOptions> = string | Plugin<T> | [string | Plugin<T>] | [string | Plugin<T>, Partial<T> | boolean];
|
|
42
|
-
/**
|
|
43
|
-
* Normalized plugin config
|
|
44
|
-
*/
|
|
45
|
-
export declare type PluginConfigNormalized<T extends PluginOptions = PluginOptions> = [
|
|
46
|
-
Plugin<T> | string,
|
|
47
|
-
Partial<T> | boolean
|
|
48
|
-
];
|
package/lib/types/plugin.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { Markdown } 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 ClientFilesHook = Hook<string | string[] | ((app: App) => PromiseOrNot<string | string[]>), (app: App) => Promise<string[]>>;
|
|
15
|
-
export declare type ReturnObjectHook = Hook<Record<string, any> | ((app: App) => Record<string, any>), (app: App) => Record<string, any>>;
|
|
16
|
-
export declare type ExtendsMarkdownHook = Hook<(md: Markdown, app: App) => void>;
|
|
17
|
-
export declare type ExtendsPageOptionsHook = Hook<(filePath: string, app: App) => PromiseOrNot<PageOptions>>;
|
|
18
|
-
export declare type ExtendsPageDataHook = Hook<(page: Page, app: App) => PromiseOrNot<Record<string, any>>>;
|
|
19
|
-
/**
|
|
20
|
-
* List of hooks
|
|
21
|
-
*/
|
|
22
|
-
export interface Hooks {
|
|
23
|
-
onInitialized: LifeCycleHook;
|
|
24
|
-
onPrepared: LifeCycleHook;
|
|
25
|
-
onWatched: LifeCycleHook<[watchers: Closable[], restart: () => Promise<void>]>;
|
|
26
|
-
onGenerated: LifeCycleHook;
|
|
27
|
-
extendsMarkdown: ExtendsMarkdownHook;
|
|
28
|
-
extendsPageOptions: ExtendsPageOptionsHook;
|
|
29
|
-
extendsPageData: ExtendsPageDataHook;
|
|
30
|
-
clientAppEnhanceFiles: ClientFilesHook;
|
|
31
|
-
clientAppRootComponentFiles: ClientFilesHook;
|
|
32
|
-
clientAppSetupFiles: ClientFilesHook;
|
|
33
|
-
alias: ReturnObjectHook;
|
|
34
|
-
define: ReturnObjectHook;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Name of hooks
|
|
38
|
-
*/
|
|
39
|
-
export declare type HooksName = keyof Hooks;
|
|
40
|
-
/**
|
|
41
|
-
* Exposed hooks API that can be accessed by a plugin
|
|
42
|
-
*/
|
|
43
|
-
export declare type HooksExposed = {
|
|
44
|
-
[K in HooksName]: Hooks[K]['exposed'];
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Normalized hooks
|
|
48
|
-
*/
|
|
49
|
-
export declare type HooksNormalized = {
|
|
50
|
-
[K in HooksName]: Hooks[K]['normalized'];
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Result of hooks
|
|
54
|
-
*/
|
|
55
|
-
export declare type HooksResult = {
|
|
56
|
-
[K in HooksName]: Hooks[K]['result'];
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Hook item
|
|
60
|
-
*/
|
|
61
|
-
export interface HookItem<T extends HooksName> {
|
|
62
|
-
pluginName: string;
|
|
63
|
-
hook: HooksNormalized[T];
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Hook items queue
|
|
67
|
-
*/
|
|
68
|
-
export interface HookQueue<T extends HooksName> {
|
|
69
|
-
name: T;
|
|
70
|
-
items: HookItem<T>[];
|
|
71
|
-
add: (item: HookItem<T>) => void;
|
|
72
|
-
process: (...args: Parameters<HooksNormalized[T]>) => Promise<HooksResult[T][]>;
|
|
73
|
-
processSync: (...args: Parameters<HooksNormalized[T]>) => HooksResult[T][];
|
|
74
|
-
}
|
|
75
|
-
export {};
|
|
@@ -1,14 +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
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./hooks"), exports);
|
|
14
|
-
__exportStar(require("./pluginApi"), exports);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { PluginObject } from '../plugin';
|
|
2
|
-
import type { HookQueue, HooksName } from './hooks';
|
|
3
|
-
/**
|
|
4
|
-
* Vuepress plugin system
|
|
5
|
-
*/
|
|
6
|
-
export interface PluginApi {
|
|
7
|
-
/**
|
|
8
|
-
* Plugins that have been used
|
|
9
|
-
*/
|
|
10
|
-
plugins: PluginObject[];
|
|
11
|
-
/**
|
|
12
|
-
* All available hooks
|
|
13
|
-
*/
|
|
14
|
-
hooks: {
|
|
15
|
-
[K in HooksName]: HookQueue<K>;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Register hooks of plugins
|
|
19
|
-
*
|
|
20
|
-
* Should be invoked before applying a hook
|
|
21
|
-
*/
|
|
22
|
-
registerHooks: () => void;
|
|
23
|
-
}
|
package/lib/types/theme.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Plugin, PluginFunction, PluginObject } from './plugin';
|
|
2
|
-
/**
|
|
3
|
-
* Vuepress theme
|
|
4
|
-
*
|
|
5
|
-
* Theme is a special type of plugin, it should be rather:
|
|
6
|
-
* - an object (`ThemeObject`)
|
|
7
|
-
* - a function that returns an object (`ThemeFunction`)
|
|
8
|
-
*
|
|
9
|
-
* A theme package should have a `Theme` as the default export
|
|
10
|
-
*/
|
|
11
|
-
export declare type Theme<T extends ThemeConfig = ThemeConfig> = Plugin<T, ThemeObject>;
|
|
12
|
-
/**
|
|
13
|
-
* Vuepress theme function
|
|
14
|
-
*/
|
|
15
|
-
export declare type ThemeFunction<T extends ThemeConfig = ThemeConfig> = PluginFunction<T, ThemeObject>;
|
|
16
|
-
/**
|
|
17
|
-
* Vuepress theme object
|
|
18
|
-
*/
|
|
19
|
-
export interface ThemeObject extends PluginObject {
|
|
20
|
-
multiple?: false;
|
|
21
|
-
extends?: string;
|
|
22
|
-
layouts?: string | Record<string, string>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Theme config to be used in user config file
|
|
26
|
-
*
|
|
27
|
-
* It will be used by a theme itself, but not by vuepress.
|
|
28
|
-
*
|
|
29
|
-
* Vuepress will only transfer this config to theme
|
|
30
|
-
*
|
|
31
|
-
* @remark suffix `Config` means this is for user config
|
|
32
|
-
*/
|
|
33
|
-
export declare type ThemeConfig = Record<string, any>;
|
package/lib/types/theme.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './themeApi';
|
|
@@ -1,13 +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
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./themeApi"), exports);
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { ThemeObject } from '../theme';
|
|
2
|
-
/**
|
|
3
|
-
* Vuepress theme system
|
|
4
|
-
*/
|
|
5
|
-
export interface ThemeApi {
|
|
6
|
-
/**
|
|
7
|
-
* Current theme
|
|
8
|
-
*/
|
|
9
|
-
theme: ThemeInfo;
|
|
10
|
-
/**
|
|
11
|
-
* Parent theme
|
|
12
|
-
*/
|
|
13
|
-
parentTheme: ThemeInfo | null;
|
|
14
|
-
/**
|
|
15
|
-
* Layouts
|
|
16
|
-
*/
|
|
17
|
-
layouts: ThemeLayout[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Vuepress theme info
|
|
21
|
-
*/
|
|
22
|
-
export interface ThemeInfo {
|
|
23
|
-
/**
|
|
24
|
-
* Theme plugin object
|
|
25
|
-
*/
|
|
26
|
-
plugin: ThemeObject;
|
|
27
|
-
/**
|
|
28
|
-
* Theme layouts
|
|
29
|
-
*/
|
|
30
|
-
layouts: ThemeLayout[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Vuepress theme layout
|
|
34
|
-
*/
|
|
35
|
-
export interface ThemeLayout {
|
|
36
|
-
/**
|
|
37
|
-
* Path of layout
|
|
38
|
-
*/
|
|
39
|
-
path: string;
|
|
40
|
-
/**
|
|
41
|
-
* Name of layout
|
|
42
|
-
*/
|
|
43
|
-
name: string;
|
|
44
|
-
}
|