@vuepress/core 2.0.0-beta.50-pre.1 → 2.0.0-beta.50
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 +8 -8
- package/dist/index.js +9 -9
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ declare type Hook<Exposed, Normalized = Exposed, Result = Normalized extends (..
|
|
|
170
170
|
declare type LifeCycleHook<T extends unknown[] = []> = Hook<(app: App, ...args: T) => PromiseOrNot<void>>;
|
|
171
171
|
declare type ExtendsHook<T> = Hook<(extendable: T, app: App) => PromiseOrNot<void>>;
|
|
172
172
|
declare type ClientConfigFileHook = Hook<string | ((app: App) => PromiseOrNot<string>), (app: App) => Promise<string>>;
|
|
173
|
-
declare type
|
|
173
|
+
declare type AliasDefineHook = Hook<Record<string, any> | ((app: App, isServer: boolean) => PromiseOrNot<Record<string, any>>), (app: App, isServer: boolean) => Promise<Record<string, any>>>;
|
|
174
174
|
/**
|
|
175
175
|
* List of hooks
|
|
176
176
|
*/
|
|
@@ -185,8 +185,8 @@ interface Hooks {
|
|
|
185
185
|
extendsPage: ExtendsHook<Page>;
|
|
186
186
|
extendsBundlerOptions: ExtendsHook<any>;
|
|
187
187
|
clientConfigFile: ClientConfigFileHook;
|
|
188
|
-
alias:
|
|
189
|
-
define:
|
|
188
|
+
alias: AliasDefineHook;
|
|
189
|
+
define: AliasDefineHook;
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
192
|
* Name of hooks
|
|
@@ -838,13 +838,13 @@ declare const createPluginApiHooks: () => PluginApi['hooks'];
|
|
|
838
838
|
declare const createPluginApiRegisterHooks: (plugins: PluginApi['plugins'], hooks: PluginApi['hooks']) => PluginApi['registerHooks'];
|
|
839
839
|
|
|
840
840
|
/**
|
|
841
|
-
* Normalize
|
|
841
|
+
* Normalize alias and define hook
|
|
842
842
|
*/
|
|
843
|
-
declare const
|
|
843
|
+
declare const normalizeAliasDefineHook: (hook: AliasDefineHook['exposed']) => AliasDefineHook['normalized'];
|
|
844
844
|
|
|
845
845
|
/**
|
|
846
|
-
* Normalize hook
|
|
846
|
+
* Normalize hook for client config file
|
|
847
847
|
*/
|
|
848
|
-
declare const
|
|
848
|
+
declare const normalizeClientConfigFileHook: (hook: ClientConfigFileHook['exposed']) => ClientConfigFileHook['normalized'];
|
|
849
849
|
|
|
850
|
-
export { App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppWriteTemp, BuildApp, Bundler, ClientConfigFileHook, DevApp, ExtendsHook, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, Page, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject,
|
|
850
|
+
export { AliasDefineHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppWriteTemp, BuildApp, Bundler, ClientConfigFileHook, DevApp, ExtendsHook, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, Page, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, Theme, ThemeFunction, ThemeInfo, ThemeObject, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, prepareClientConfigs, prepareLayoutComponents, preparePageComponent, preparePageData, preparePagesComponents, preparePagesData, preparePagesRoutes, prepareSiteData, renderPageContent, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageComponentInfo, resolvePageDataInfo, resolvePageDate, resolvePageFileContent, resolvePageFilePath, resolvePageHtmlInfo, resolvePageKey, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo, resolveThemeLayouts };
|
package/dist/index.js
CHANGED
|
@@ -713,11 +713,15 @@ var createPluginApiHooks = () => ({
|
|
|
713
713
|
define: createHookQueue("define")
|
|
714
714
|
});
|
|
715
715
|
|
|
716
|
-
// src/pluginApi/
|
|
716
|
+
// src/pluginApi/normalizeAliasDefineHook.ts
|
|
717
717
|
import { isFunction as isFunction2 } from "@vuepress/shared";
|
|
718
|
+
var normalizeAliasDefineHook = (hook) => async (app, isServer) => isFunction2(hook) ? hook(app, isServer) : hook;
|
|
719
|
+
|
|
720
|
+
// src/pluginApi/normalizeClientConfigFileHook.ts
|
|
721
|
+
import { isFunction as isFunction3 } from "@vuepress/shared";
|
|
718
722
|
import { fs as fs2, logger as logger4 } from "@vuepress/utils";
|
|
719
723
|
var normalizeClientConfigFileHook = (hook) => async (app) => {
|
|
720
|
-
const clientConfigFileResult =
|
|
724
|
+
const clientConfigFileResult = isFunction3(hook) ? await hook(app) : hook;
|
|
721
725
|
const isExisted = await fs2.pathExists(clientConfigFileResult);
|
|
722
726
|
if (!isExisted) {
|
|
723
727
|
throw logger4.createError(
|
|
@@ -727,10 +731,6 @@ var normalizeClientConfigFileHook = (hook) => async (app) => {
|
|
|
727
731
|
return clientConfigFileResult;
|
|
728
732
|
};
|
|
729
733
|
|
|
730
|
-
// src/pluginApi/normalizeReturnObjectHook.ts
|
|
731
|
-
import { isFunction as isFunction3 } from "@vuepress/shared";
|
|
732
|
-
var normalizeReturnObjectHook = (hook) => async (app) => isFunction3(hook) ? hook(app) : hook;
|
|
733
|
-
|
|
734
734
|
// src/pluginApi/createPluginApiRegisterHooks.ts
|
|
735
735
|
var createPluginApiRegisterHooks = (plugins, hooks) => () => {
|
|
736
736
|
plugins.forEach(
|
|
@@ -744,13 +744,13 @@ var createPluginApiRegisterHooks = (plugins, hooks) => () => {
|
|
|
744
744
|
if (alias) {
|
|
745
745
|
hooks.alias.add({
|
|
746
746
|
pluginName,
|
|
747
|
-
hook:
|
|
747
|
+
hook: normalizeAliasDefineHook(alias)
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
if (define) {
|
|
751
751
|
hooks.define.add({
|
|
752
752
|
pluginName,
|
|
753
|
-
hook:
|
|
753
|
+
hook: normalizeAliasDefineHook(define)
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
756
|
if (clientConfigFile) {
|
|
@@ -1014,8 +1014,8 @@ export {
|
|
|
1014
1014
|
createPluginApiHooks,
|
|
1015
1015
|
createPluginApiRegisterHooks,
|
|
1016
1016
|
inferPagePath,
|
|
1017
|
+
normalizeAliasDefineHook,
|
|
1017
1018
|
normalizeClientConfigFileHook,
|
|
1018
|
-
normalizeReturnObjectHook,
|
|
1019
1019
|
prepareClientConfigs,
|
|
1020
1020
|
prepareLayoutComponents,
|
|
1021
1021
|
preparePageComponent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/core",
|
|
3
|
-
"version": "2.0.0-beta.50
|
|
3
|
+
"version": "2.0.0-beta.50",
|
|
4
4
|
"description": "Core package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@vuepress/client": "2.0.0-beta.50
|
|
31
|
-
"@vuepress/markdown": "2.0.0-beta.50
|
|
32
|
-
"@vuepress/shared": "2.0.0-beta.50
|
|
33
|
-
"@vuepress/utils": "2.0.0-beta.50
|
|
30
|
+
"@vuepress/client": "2.0.0-beta.50",
|
|
31
|
+
"@vuepress/markdown": "2.0.0-beta.50",
|
|
32
|
+
"@vuepress/shared": "2.0.0-beta.50",
|
|
33
|
+
"@vuepress/utils": "2.0.0-beta.50",
|
|
34
34
|
"vue": "^3.2.37"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|