File tree 1 file changed +9
-9
lines changed
packages/@vuepress/core/lib/node
1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ module.exports = class Page {
142
142
this . _computed = computed
143
143
this . _localePath = computed . $localePath
144
144
145
- this . enhance ( enhancers )
145
+ await this . enhance ( enhancers )
146
146
this . buildPermalink ( )
147
147
}
148
148
@@ -245,13 +245,13 @@ module.exports = class Page {
245
245
*/
246
246
247
247
enhance ( enhancers ) {
248
- for ( const { name : pluginName , value : enhancer } of enhancers ) {
249
- try {
250
- enhancer ( this )
251
- } catch ( error ) {
252
- console . log ( error )
253
- throw new Error ( `[${ pluginName } ] excuete extendPageData failed.` )
254
- }
255
- }
248
+ return enhancers . reduce ( async ( accumulator , { pluginName, value } ) => {
249
+ return accumulator
250
+ . then ( ( ) => value ( this ) )
251
+ . catch ( error => {
252
+ console . log ( error )
253
+ throw new Error ( `[${ pluginName } ] execute extendPageData failed.` )
254
+ } )
255
+ } , Promise . resolve ( ) )
256
256
}
257
257
}
You can’t perform that action at this time.
0 commit comments