File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
packages/@vuepress/core/lib/node Expand file tree Collapse file tree 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
@@ -283,13 +283,13 @@ module.exports = class Page {
283
283
*/
284
284
285
285
enhance ( enhancers ) {
286
- for ( const { name : pluginName , value : enhancer } of enhancers ) {
287
- try {
288
- enhancer ( this )
289
- } catch ( error ) {
290
- console . log ( error )
291
- throw new Error ( `[${ pluginName } ] excuete extendPageData failed.` )
292
- }
293
- }
286
+ return enhancers . reduce ( async ( accumulator , { pluginName, value } ) => {
287
+ return accumulator
288
+ . then ( ( ) => value ( this ) )
289
+ . catch ( error => {
290
+ console . log ( error )
291
+ throw new Error ( `[${ pluginName } ] execute extendPageData failed.` )
292
+ } )
293
+ } , Promise . resolve ( ) )
294
294
}
295
295
}
You can’t perform that action at this time.
0 commit comments