dillon1000/react
Commit
Browse files Implement JSX whitespace rules
So far we've been preserving JSX whitespace all the way through to codegen. But JSX has clear rules around whitespace handling, which allows us to trim whitespace in the input in lots of cases. For the most part this doesn't change our output, but I think that’s generally because of prettier. This PR should make a big difference when debugging the compiler, by removing all the whitespace JsxText values. But in some edge-cases it really makes a difference in the output since we can avoid memo slots for strings like `"\n "`.. ## Test Plan * Experimented with our internal tool to verify transform output to confirm that JSXText whitespace does not impact fbt transform results. * Synced and tested profile page, looks fine
Changed paths8 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-element-content.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-instruction-from-merge-consecutive-scopes.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/timers.expect.md ModifiedPatch
Files changed
Rendering syntax-highlighted changes…