fix(es/parser): Reset ctx for cond while parsing a stmt (#7232)

This commit is contained in:
Donny/강동윤 2023-04-10 19:45:49 +09:00 committed by GitHub
parent c06690ec9c
commit 01db30f91e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1430 additions and 1 deletions

View File

@ -101,7 +101,12 @@ impl<'a, I: Tokens> Parser<I> {
return self.handle_import_export(top_level, decorators);
}
self.parse_stmt_internal(start, include_decl, top_level, decorators)
let ctx = Context {
will_expect_colon_for_cond: false,
..self.ctx()
};
self.with_ctx(ctx)
.parse_stmt_internal(start, include_decl, top_level, decorators)
.map(From::from)
}

View File

@ -0,0 +1,34 @@
export async function postProcessHTML(
) {
const postProcessors: Array<PostProcessorFunction> = [
process.env.NEXT_RUNTIME !== 'edge' && inAmpMode
? async (html: string) => {
const optimizeAmp = require('./optimize-amp')
.default as typeof import('./optimize-amp').default
html = await optimizeAmp!(html, renderOpts.ampOptimizerConfig)
if (!renderOpts.ampSkipValidation && renderOpts.ampValidator) {
await renderOpts.ampValidator(html, pathname)
}
return html
}
: null,
process.env.NEXT_RUNTIME !== 'edge' && renderOpts.optimizeFonts
? async (html: string) => {
const getFontDefinition = (url: string): string => {
}
}
: null,
process.env.NEXT_RUNTIME !== 'edge' && renderOpts.optimizeCss
? async (html: string) => {
}
: null,
inAmpMode || hybridAmp
? (html: string) => {
return html.replace(/&amp;amp=1/g, '&amp=1')
}
: null,
].filter(nonNullable)
}

File diff suppressed because it is too large Load Diff