Skip to content

Commit

Permalink
fix(build): clean up of build-www rewriteImports (follow-up to facebo…
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed May 1, 2024
1 parent d76b93b commit 4aae60d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/www/rewriteImports.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ async function transformFlowFileContents(source) {
node.docblock.comment &&
node.docblock.comment.value.includes('@flow strict')
) {
// This is mutated in-place because I couldn't find a mutation that
// did not fail for replacing the Program node.
node.docblock.comment.value = node.docblock.comment.value.replace(
/ \* @flow strict/g,
' * @flow strict\n * @generated\n * @oncall lexical_web_text_editor',
);
// Let the transform know we actually did something.
// Could not figure out the right way to update the
// docblock without an in-place update
context.addLeadingComments(node, '');
// We need the mutations array to be non-empty, so remove something
// that is not there. The AST traversals use object identity in a
// Set so we don't have to worry about some other line changing.
context.removeComments(t.LineComment({value: ''}));
}
},
}),
Expand Down

0 comments on commit 4aae60d

Please sign in to comment.