1
1
import * as path from 'path'
2
2
import { handleOptions } from './handleOptions'
3
- import { registerPagination } from './pagination'
3
+ import { registerPaginations } from './pagination'
4
4
import { BlogPluginOptions } from './interface/Options'
5
- import { AppContext , Page } from './interface/VuePress'
6
5
import { logPages , resolvePaginationConfig } from './util'
7
6
import { ClassifierTypeEnum , DefaultLayoutEnum } from './interface/Classifier'
7
+ import { VuePressContext , VuePressPage } from './interface/VuePress'
8
8
9
- function injectExtraAPI ( ctx : AppContext ) {
9
+ function injectExtraAPI ( ctx : VuePressContext ) {
10
10
const { layoutComponentMap } = ctx . themeAPI
11
11
12
12
/**
@@ -22,7 +22,7 @@ function injectExtraAPI(ctx: AppContext) {
22
22
}
23
23
}
24
24
25
- module . exports = ( options : BlogPluginOptions , ctx : AppContext ) => {
25
+ module . exports = ( options : BlogPluginOptions , ctx : VuePressContext ) => {
26
26
injectExtraAPI ( ctx )
27
27
28
28
const {
@@ -38,7 +38,7 @@ module.exports = (options: BlogPluginOptions, ctx: AppContext) => {
38
38
/**
39
39
* 1. Execute `pageEnhancers` generated in handleOptions
40
40
*/
41
- extendPageData ( pageCtx : Page ) {
41
+ extendPageData ( pageCtx : VuePressPage ) {
42
42
const { frontmatter : rawFrontmatter } = pageCtx
43
43
44
44
pageEnhancers . forEach ( ( { when, data = { } , frontmatter = { } } ) => {
@@ -143,14 +143,14 @@ module.exports = (options: BlogPluginOptions, ctx: AppContext) => {
143
143
logPages ( `Automatically Added Index Pages` , allExtraPages )
144
144
145
145
await Promise . all ( allExtraPages . map ( async page => ctx . addPage ( page ) ) )
146
- await registerPagination ( paginations , ctx )
146
+ await registerPaginations ( paginations , ctx )
147
147
} ,
148
148
149
149
/**
150
150
* Generate tag and category metadata.
151
151
*/
152
152
async clientDynamicModules ( ) {
153
- const frontmatterClassifiedPageMap = ctx . frontmatterClassificationPages . reduce (
153
+ const frontmatterClassifiedMap = ctx . frontmatterClassificationPages . reduce (
154
154
( map , page ) => {
155
155
map [ page . id ] = page . map
156
156
return map
@@ -164,7 +164,7 @@ module.exports = (options: BlogPluginOptions, ctx: AppContext) => {
164
164
{
165
165
name : `${ PREFIX } /frontmatterClassified.js` ,
166
166
content : `export default ${ JSON . stringify (
167
- frontmatterClassifiedPageMap ,
167
+ frontmatterClassifiedMap ,
168
168
null ,
169
169
2 ,
170
170
) } `,
@@ -193,8 +193,8 @@ export default ${serializePaginations(ctx.serializedPaginations, [
193
193
} ,
194
194
195
195
enhanceAppFiles : [
196
- path . resolve ( __dirname , 'client/classification.js' ) ,
197
- path . resolve ( __dirname , 'client/pagination.js' ) ,
196
+ path . resolve ( __dirname , '../ client/classification.js' ) ,
197
+ path . resolve ( __dirname , '../ client/pagination.js' ) ,
198
198
] ,
199
199
}
200
200
}
0 commit comments