File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ type middlewareSignature = {
2222 condition : ( ( options : postProcessOptions ) => boolean ) | null
2323}
2424
25+ type PostProcessorFunction =
26+ | ( ( html : string ) => Promise < string > )
27+ | ( ( html : string ) => string )
28+
2529const middlewareRegistry : Array < middlewareSignature > = [ ]
2630
2731function registerPostProcessor (
@@ -175,7 +179,7 @@ async function postProcessHTML(
175179 renderOpts : RenderOpts ,
176180 { inAmpMode, hybridAmp } : { inAmpMode : boolean ; hybridAmp : boolean }
177181) {
178- const postProcessors : Array < ( html : string ) => Promise < string > > = [
182+ const postProcessors : Array < PostProcessorFunction > = [
179183 process . env . NEXT_RUNTIME !== 'edge' && inAmpMode
180184 ? async ( html : string ) => {
181185 const optimizeAmp = require ( './optimize-amp' )
@@ -226,8 +230,8 @@ async function postProcessHTML(
226230 }
227231 : null ,
228232 inAmpMode || hybridAmp
229- ? async ( html : string ) => {
230- return html . replace ( / & a m p ; a m p = 1 / g , '&=1' )
233+ ? ( html : string ) => {
234+ return html . replaceAll ( ' &amp=1' , '&=1' )
231235 }
232236 : null ,
233237 ] . filter ( nonNullable )
You can’t perform that action at this time.
0 commit comments