MCPcopy
hub / github.com/prettier/prettier / postprocess

Function postprocess

src/language-html/parse/postprocess.js:38–71  ·  view source on GitHub ↗
(rawAst, frontMatter, parseOptions, parseSubHtml)

Source from the content-addressed store, hash-verified

36}
37
38function postprocess(rawAst, frontMatter, parseOptions, parseSubHtml) {
39 const isAngular = parseOptions.name === "angular";
40
41 visitAll(new Visitor(), rawAst.children, { parseOptions });
42
43 if (frontMatter) {
44 rawAst.children.unshift(frontMatter);
45 }
46
47 const ast = new Node(rawAst);
48
49 ast.walk((node) => {
50 if (node.kind === "comment") {
51 const ieConditionalComment = parseIeConditionalComment(
52 node,
53 parseSubHtml,
54 );
55 if (ieConditionalComment) {
56 node.parent.replaceChild(node, ieConditionalComment);
57 }
58 } else if (isAngular && node.kind === "element" && node.comments) {
59 node.startTagComments = node.comments;
60 delete node.comments;
61 }
62
63 if (isAngular) {
64 normalizeAngularControlFlowBlock(node);
65 normalizeAngularLetDeclaration(node);
66 normalizeAngularIcuExpression(node);
67 }
68 });
69
70 return ast;
71}
72
73// `@else if`
74function normalizeAngularControlFlowBlock(node) {

Callers 1

parseFunction · 0.90

Calls 6

walkMethod · 0.95
replaceChildMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…