From e15c5b15c67202b30faecf24a66547725cd08480 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Thu, 18 Jul 2024 15:33:51 -0400 Subject: [PATCH 01/78] [compiler][patch] Fix jsx non-ascii regex pattern ghstack-source-id: 97ed49112453c2ca3165361e758b6f31fbd0da20 Pull Request resolved: https://github.com/facebook/react/pull/30382 --- .../ReactiveScopes/CodegenReactiveFunction.ts | 2 +- .../compiler/fbt/fbt-params.expect.md | 41 ++++++++++++++++--- .../fixtures/compiler/fbt/fbt-params.js | 11 +++-- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts index 38d030cd71..ff11c09939 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -2206,7 +2206,7 @@ function codegenInstructionValue( * https://en.wikipedia.org/wiki/List_of_Unicode_characters#Control_codes */ const STRING_REQUIRES_EXPR_CONTAINER_PATTERN = - /[\u{0000}-\u{001F}|\u{007F}|\u{0080}-\u{FFFF}]|"/u; + /[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}]|"/u; function codegenJsxAttribute( cx: Context, attribute: JsxAttribute diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.expect.md index d5ec6eb468..c15244491f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.expect.md @@ -6,9 +6,14 @@ import fbt from "fbt"; function Component(props) { return ( - - Hello {props.name} - +
+ + Hello {props.name} + + + {props.actions} + +
); } @@ -27,7 +32,7 @@ import { c as _c } from "react/compiler-runtime"; import fbt from "fbt"; function Component(props) { - const $ = _c(2); + const $ = _c(7); let t0; if ($[0] !== props.name) { t0 = fbt._("Hello {user name}", [fbt._param("user name", props.name)], { @@ -38,7 +43,33 @@ function Component(props) { } else { t0 = $[1]; } - return t0; + let t1; + if ($[2] !== props.actions) { + t1 = fbt._( + "{actions|response}", + [fbt._param("actions|response", props.actions)], + { hk: "1cjfbg" }, + ); + $[2] = props.actions; + $[3] = t1; + } else { + t1 = $[3]; + } + let t2; + if ($[4] !== t0 || $[5] !== t1) { + t2 = ( +
+ {t0} + {t1} +
+ ); + $[4] = t0; + $[5] = t1; + $[6] = t2; + } else { + t2 = $[6]; + } + return t2; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.js index b2959036e5..4750fcf8a7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-params.js @@ -2,9 +2,14 @@ import fbt from "fbt"; function Component(props) { return ( - - Hello {props.name} - +
+ + Hello {props.name} + + + {props.actions} + +
); } From 378ab81522c3da436943980cbb537c9ce523fbf8 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Thu, 18 Jul 2024 15:33:51 -0400 Subject: [PATCH 02/78] [compiler][fixtures] Repro for fbt + non-ascii strings ghstack-source-id: 05211980566f8c061ac2ca8ce51e442d234beacc Pull Request resolved: https://github.com/facebook/react/pull/30386 --- ...rror.todo-fbt-param-with-newline.expect.md | 36 +++++++++++++++++++ .../fbt/error.todo-fbt-param-with-newline.js | 21 +++++++++++ ...error.todo-fbt-param-with-quotes.expect.md | 30 ++++++++++++++++ .../fbt/error.todo-fbt-param-with-quotes.js | 15 ++++++++ ...rror.todo-fbt-param-with-unicode.expect.md | 30 ++++++++++++++++ .../fbt/error.todo-fbt-param-with-unicode.js | 15 ++++++++ 6 files changed, 147 insertions(+) create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md new file mode 100644 index 0000000000..054804c3e1 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md @@ -0,0 +1,36 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello{" "} + + {props.name} + + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + + +## Error + +``` +Cannot read properties of undefined (reading 'replace') +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js new file mode 100644 index 0000000000..a1c07335b0 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js @@ -0,0 +1,21 @@ +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello{" "} + + {props.name} + + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md new file mode 100644 index 0000000000..9d616baf58 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md @@ -0,0 +1,30 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello {props.name} + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + + +## Error + +``` +Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer" +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js new file mode 100644 index 0000000000..9fd41f80bf --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js @@ -0,0 +1,15 @@ +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello {props.name} + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md new file mode 100644 index 0000000000..ef75314048 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md @@ -0,0 +1,30 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello {props.name} + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + + +## Error + +``` +Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer" +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js new file mode 100644 index 0000000000..3e1883fa1d --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js @@ -0,0 +1,15 @@ +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello {props.name} + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; From b2ec0445b4801e067f624adb2a29afcd06d1de55 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Thu, 18 Jul 2024 15:33:51 -0400 Subject: [PATCH 03/78] [compiler][patch] Don't wrap non-ascii fbt operands in JSXExpressionContainer ghstack-source-id: 4b5505aa5e58d1bcc0813452762e9921c74417d7 Pull Request resolved: https://github.com/facebook/react/pull/30389 --- .../src/Entrypoint/Pipeline.ts | 7 +- .../ReactiveScopes/CodegenReactiveFunction.ts | 22 +++++- .../MemoizeFbtAndMacroOperandsInSameScope.ts | 5 +- ...rror.todo-fbt-param-with-newline.expect.md | 36 --------- ...error.todo-fbt-param-with-quotes.expect.md | 30 -------- ...rror.todo-fbt-param-with-unicode.expect.md | 30 -------- .../fbt/fbt-param-with-newline.expect.md | 75 +++++++++++++++++++ ...h-newline.js => fbt-param-with-newline.js} | 0 .../fbt/fbt-param-with-quotes.expect.md | 61 +++++++++++++++ ...ith-quotes.js => fbt-param-with-quotes.js} | 0 .../fbt/fbt-param-with-unicode.expect.md | 63 ++++++++++++++++ ...h-unicode.js => fbt-param-with-unicode.js} | 0 12 files changed, 227 insertions(+), 102 deletions(-) delete mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md delete mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md delete mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md rename compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/{error.todo-fbt-param-with-newline.js => fbt-param-with-newline.js} (100%) create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md rename compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/{error.todo-fbt-param-with-quotes.js => fbt-param-with-quotes.js} (100%) create mode 100644 compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md rename compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/{error.todo-fbt-param-with-unicode.js => fbt-param-with-unicode.js} (100%) diff --git a/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts b/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts index b1480d76dc..077d30f121 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts @@ -262,7 +262,7 @@ function* runWithEnvironment( value: hir, }); - memoizeFbtOperandsInSameScope(hir); + const fbtOperands = memoizeFbtOperandsInSameScope(hir); yield log({ kind: "hir", name: "MemoizeFbtAndMacroOperandsInSameScope", @@ -484,7 +484,10 @@ function* runWithEnvironment( validatePreservedManualMemoization(reactiveFunction); } - const ast = codegenFunction(reactiveFunction, uniqueIdentifiers).unwrap(); + const ast = codegenFunction(reactiveFunction, { + uniqueIdentifiers, + fbtOperands, + }).unwrap(); yield log({ kind: "ast", name: "Codegen", value: ast }); for (const outlined of ast.outlined) { yield log({ kind: "ast", name: "Codegen (outlined)", value: outlined.fn }); diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts index ff11c09939..bd44b18423 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -100,12 +100,19 @@ export type CodegenFunction = { export function codegenFunction( fn: ReactiveFunction, - uniqueIdentifiers: Set + { + uniqueIdentifiers, + fbtOperands, + }: { + uniqueIdentifiers: Set; + fbtOperands: Set; + } ): Result { const cx = new Context( fn.env, fn.id ?? "[[ anonymous ]]", uniqueIdentifiers, + fbtOperands, null ); @@ -281,7 +288,8 @@ export function codegenFunction( new Context( cx.env, reactiveFunction.id ?? "[[ anonymous ]]", - identifiers + identifiers, + cx.fbtOperands ), reactiveFunction ); @@ -391,17 +399,20 @@ class Context { errors: CompilerError = new CompilerError(); objectMethods: Map = new Map(); uniqueIdentifiers: Set; + fbtOperands: Set; synthesizedNames: Map = new Map(); constructor( env: Environment, fnName: string, uniqueIdentifiers: Set, + fbtOperands: Set, temporaries: Temporaries | null = null ) { this.env = env; this.fnName = fnName; this.uniqueIdentifiers = uniqueIdentifiers; + this.fbtOperands = fbtOperands; this.temp = temporaries !== null ? new Map(temporaries) : new Map(); } get nextCacheIndex(): number { @@ -1776,6 +1787,7 @@ function codegenInstructionValue( cx.env, reactiveFunction.id ?? "[[ anonymous ]]", cx.uniqueIdentifiers, + cx.fbtOperands, cx.temp ), reactiveFunction @@ -1979,6 +1991,7 @@ function codegenInstructionValue( cx.env, reactiveFunction.id ?? "[[ anonymous ]]", cx.uniqueIdentifiers, + cx.fbtOperands, cx.temp ), reactiveFunction @@ -2229,7 +2242,10 @@ function codegenJsxAttribute( switch (innerValue.type) { case "StringLiteral": { value = innerValue; - if (STRING_REQUIRES_EXPR_CONTAINER_PATTERN.test(value.value)) { + if ( + STRING_REQUIRES_EXPR_CONTAINER_PATTERN.test(value.value) && + !cx.fbtOperands.has(attribute.place.identifier.id) + ) { value = createJsxExpressionContainer(value.loc, value); } break; diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts index 91121cd9bf..037765f1e9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts @@ -39,7 +39,9 @@ import { eachReactiveValueOperand } from "./visitors"; * Users can also specify their own functions to be treated similarly to fbt via the * `customMacros` environment configuration. */ -export function memoizeFbtAndMacroOperandsInSameScope(fn: HIRFunction): void { +export function memoizeFbtAndMacroOperandsInSameScope( + fn: HIRFunction +): Set { const fbtMacroTags = new Set([ ...FBT_TAGS, ...(fn.env.config.customMacros ?? []), @@ -52,6 +54,7 @@ export function memoizeFbtAndMacroOperandsInSameScope(fn: HIRFunction): void { break; } } + return fbtValues; } export const FBT_TAGS: Set = new Set([ diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md deleted file mode 100644 index 054804c3e1..0000000000 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md +++ /dev/null @@ -1,36 +0,0 @@ - -## Input - -```javascript -import fbt from "fbt"; - -function Component(props) { - const element = ( - - Hello{" "} - - {props.name} - - - ); - return element.toString(); -} - -export const FIXTURE_ENTRYPOINT = { - fn: Component, - params: [{ name: "Jason" }], -}; - -``` - - -## Error - -``` -Cannot read properties of undefined (reading 'replace') -``` - - \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md deleted file mode 100644 index 9d616baf58..0000000000 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md +++ /dev/null @@ -1,30 +0,0 @@ - -## Input - -```javascript -import fbt from "fbt"; - -function Component(props) { - const element = ( - - Hello {props.name} - - ); - return element.toString(); -} - -export const FIXTURE_ENTRYPOINT = { - fn: Component, - params: [{ name: "Jason" }], -}; - -``` - - -## Error - -``` -Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer" -``` - - \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md deleted file mode 100644 index ef75314048..0000000000 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md +++ /dev/null @@ -1,30 +0,0 @@ - -## Input - -```javascript -import fbt from "fbt"; - -function Component(props) { - const element = ( - - Hello {props.name} - - ); - return element.toString(); -} - -export const FIXTURE_ENTRYPOINT = { - fn: Component, - params: [{ name: "Jason" }], -}; - -``` - - -## Error - -``` -Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer" -``` - - \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md new file mode 100644 index 0000000000..67402ba3bd --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md @@ -0,0 +1,75 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello{" "} + + {props.name} + + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + +## Code + +```javascript +import { c as _c } from "react/compiler-runtime"; +import fbt from "fbt"; + +function Component(props) { + const $ = _c(4); + let t0; + if ($[0] !== props.name) { + t0 = fbt._( + "Hello {a really long description that got split into multiple lines}", + [ + fbt._param( + "a really long description that got split into multiple lines", + + props.name, + ), + ], + { hk: "1euPUp" }, + ); + $[0] = props.name; + $[1] = t0; + } else { + t0 = $[1]; + } + const element = t0; + let t1; + if ($[2] !== element) { + t1 = element.toString(); + $[2] = element; + $[3] = t1; + } else { + t1 = $[3]; + } + return t1; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + +### Eval output +(kind: ok) "Hello Jason" \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.js similarity index 100% rename from compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.js rename to compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.js diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md new file mode 100644 index 0000000000..4fc0d198c6 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md @@ -0,0 +1,61 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello {props.name} + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + +## Code + +```javascript +import { c as _c } from "react/compiler-runtime"; +import fbt from "fbt"; + +function Component(props) { + const $ = _c(4); + let t0; + if ($[0] !== props.name) { + t0 = fbt._('Hello {"user" name}', [fbt._param('"user" name', props.name)], { + hk: "S0vMe", + }); + $[0] = props.name; + $[1] = t0; + } else { + t0 = $[1]; + } + const element = t0; + let t1; + if ($[2] !== element) { + t1 = element.toString(); + $[2] = element; + $[3] = t1; + } else { + t1 = $[3]; + } + return t1; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + +### Eval output +(kind: ok) "Hello Jason" \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.js similarity index 100% rename from compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.js rename to compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.js diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md new file mode 100644 index 0000000000..221a585591 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md @@ -0,0 +1,63 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component(props) { + const element = ( + + Hello {props.name} + + ); + return element.toString(); +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + +## Code + +```javascript +import { c as _c } from "react/compiler-runtime"; +import fbt from "fbt"; + +function Component(props) { + const $ = _c(4); + let t0; + if ($[0] !== props.name) { + t0 = fbt._( + "Hello {user name ☺}", + [fbt._param("user name \u263A", props.name)], + { hk: "1En1lp" }, + ); + $[0] = props.name; + $[1] = t0; + } else { + t0 = $[1]; + } + const element = t0; + let t1; + if ($[2] !== element) { + t1 = element.toString(); + $[2] = element; + $[3] = t1; + } else { + t1 = $[3]; + } + return t1; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ name: "Jason" }], +}; + +``` + +### Eval output +(kind: ok) "Hello Jason" \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.js similarity index 100% rename from compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.js rename to compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.js From 76f8cf5277cff10a9a559ec10b810c3bca77f5d2 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:09 -0400 Subject: [PATCH 04/78] [ci] Rename temporary build parts Adds an _ prefix to temporary build parts from parallelization to allow easier merging in later passes. ghstack-source-id: 714da85972e138d389224f67601dc7aaa6676e11 Pull Request resolved: https://github.com/facebook/react/pull/30385 --- .github/workflows/runtime_build_and_test.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index 181bb2ffa8..b5dd8a9693 100644 --- a/.github/workflows/runtime_build_and_test.yml +++ b/.github/workflows/runtime_build_and_test.yml @@ -180,9 +180,8 @@ jobs: - name: Archive build uses: actions/upload-artifact@v4 with: - name: build_${{ matrix.worker_id }}_${{ matrix.release_channel }} - path: | - build + name: _build_${{ matrix.worker_id }}_${{ matrix.release_channel }} + path: build test_build: name: yarn test-build @@ -242,6 +241,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - name: Display structure of build @@ -269,6 +269,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - name: Display structure of build @@ -311,6 +312,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - name: Display structure of build @@ -341,6 +343,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - name: Display structure of build @@ -370,6 +373,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - name: Display structure of build @@ -407,6 +411,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - name: Display structure of build @@ -462,6 +467,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - run: ./scripts/circleci/pack_and_store_devtools_artifacts.sh @@ -507,6 +513,7 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: + pattern: _build_* path: build merge-multiple: true - run: | From 21be03bfed606f984412477843c7f747933900c9 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:10 -0400 Subject: [PATCH 05/78] [ci] Fork scripts/release/download-experimental-build.js This PR just copies the original file without any modifications for easier review. The original script makes assumptions about CircleCI that are difficult to untangle. So let's fork this file temporarily for GitHub actions. Later on we will remove the original and rename this fork back to the original naming. ghstack-source-id: 0ce078538e76349d9ecb69ffc1c352e24390c426 Pull Request resolved: https://github.com/facebook/react/pull/30374 --- .../download-experimental-build-ghaction.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 scripts/release/download-experimental-build-ghaction.js diff --git a/scripts/release/download-experimental-build-ghaction.js b/scripts/release/download-experimental-build-ghaction.js new file mode 100755 index 0000000000..c57ec4f1bf --- /dev/null +++ b/scripts/release/download-experimental-build-ghaction.js @@ -0,0 +1,32 @@ +#!/usr/bin/env node + +'use strict'; + +const {join} = require('path'); +const { + addDefaultParamValue, + getPublicPackages, + handleError, +} = require('./utils'); + +const downloadBuildArtifacts = require('./shared-commands/download-build-artifacts'); +const parseParams = require('./shared-commands/parse-params'); +const printSummary = require('./download-experimental-build-commands/print-summary'); + +const run = async () => { + try { + addDefaultParamValue('-r', '--releaseChannel', 'experimental'); + + const params = await parseParams(); + params.cwd = join(__dirname, '..', '..'); + params.packages = await getPublicPackages(true); + + await downloadBuildArtifacts(params); + + printSummary(params); + } catch (error) { + handleError(error); + } +}; + +run(); From eed9ca203c768c3878496a1435ae7c718cf17a92 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:10 -0400 Subject: [PATCH 06/78] [ci] Use yargs to parse args to download-experimental-build ghstack-source-id: 0b222cf61368f1cafdd7b44cdb1a574228cbe403 Pull Request resolved: https://github.com/facebook/react/pull/30375 --- .../download-experimental-build-ghaction.js | 70 ++++++++++++++----- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/scripts/release/download-experimental-build-ghaction.js b/scripts/release/download-experimental-build-ghaction.js index c57ec4f1bf..a8f79d8994 100755 --- a/scripts/release/download-experimental-build-ghaction.js +++ b/scripts/release/download-experimental-build-ghaction.js @@ -2,28 +2,66 @@ 'use strict'; -const {join} = require('path'); -const { - addDefaultParamValue, - getPublicPackages, - handleError, -} = require('./utils'); +const {join, relative} = require('path'); +const {getPublicPackages, handleError} = require('./utils'); +const yargs = require('yargs'); +const clear = require('clear'); +const theme = require('./theme'); -const downloadBuildArtifacts = require('./shared-commands/download-build-artifacts'); -const parseParams = require('./shared-commands/parse-params'); -const printSummary = require('./download-experimental-build-commands/print-summary'); +const argv = yargs.wrap(yargs.terminalWidth()).options({ + releaseChannel: { + alias: 'r', + describe: 'Download the given release channel.', + requiresArg: true, + type: 'string', + choices: ['experimental', 'stable'], + default: 'experimental', + }, + commit: { + alias: 'c', + describe: 'Commit hash to download.', + requiresArg: true, + type: 'string', + }, + skipTests: { + requiresArg: false, + type: 'boolean', + default: false, + }, + allowBrokenCI: { + requiresArg: false, + type: 'boolean', + default: false, + }, +}).argv; + +// Inlined from scripts/release/download-experimental-build-commands/print-summary.js +function printSummary(commit) { + const commandPath = relative( + process.env.PWD, + join(__dirname, '../download-experimental-build-ghaction.js') + ); + + clear(); + + const message = theme` + {caution An experimental build has been downloaded!} + + You can download this build again by running: + {path ${commandPath}} --commit={commit ${commit}} + `; + + console.log(message.replace(/\n +/g, '\n').trim()); +} const run = async () => { try { - addDefaultParamValue('-r', '--releaseChannel', 'experimental'); + argv.cwd = join(__dirname, '..', '..'); + argv.packages = await getPublicPackages(true); - const params = await parseParams(); - params.cwd = join(__dirname, '..', '..'); - params.packages = await getPublicPackages(true); + console.log(argv); - await downloadBuildArtifacts(params); - - printSummary(params); + printSummary(argv.commit); } catch (error) { handleError(error); } From f6bc05a22a7b3ff609d441053b73a4f7e65a38e0 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:11 -0400 Subject: [PATCH 07/78] [ci] Add script to download artifact from github Updates the forked script to download build artifacts from GitHub. Note that this PR just adds the script, it does not add it to GH actions yet. ghstack-source-id: 08b0d2f93a88d55386e43a7d1bf88a67a117e899 Pull Request resolved: https://github.com/facebook/react/pull/30376 --- .../download-experimental-build-ghaction.js | 149 +++++++++++++++--- 1 file changed, 130 insertions(+), 19 deletions(-) diff --git a/scripts/release/download-experimental-build-ghaction.js b/scripts/release/download-experimental-build-ghaction.js index a8f79d8994..8f670f4e96 100755 --- a/scripts/release/download-experimental-build-ghaction.js +++ b/scripts/release/download-experimental-build-ghaction.js @@ -3,10 +3,12 @@ 'use strict'; const {join, relative} = require('path'); -const {getPublicPackages, handleError} = require('./utils'); +const {logPromise, handleError} = require('./utils'); const yargs = require('yargs'); const clear = require('clear'); const theme = require('./theme'); +const {exec} = require('child-process-promise'); +const {existsSync} = require('fs'); const argv = yargs.wrap(yargs.terminalWidth()).options({ releaseChannel: { @@ -21,21 +23,11 @@ const argv = yargs.wrap(yargs.terminalWidth()).options({ alias: 'c', describe: 'Commit hash to download.', requiresArg: true, + demandOption: true, type: 'string', }, - skipTests: { - requiresArg: false, - type: 'boolean', - default: false, - }, - allowBrokenCI: { - requiresArg: false, - type: 'boolean', - default: false, - }, }).argv; -// Inlined from scripts/release/download-experimental-build-commands/print-summary.js function printSummary(commit) { const commandPath = relative( process.env.PWD, @@ -54,17 +46,136 @@ function printSummary(commit) { console.log(message.replace(/\n +/g, '\n').trim()); } -const run = async () => { +const OWNER = 'facebook'; +const REPO = 'react'; +const WORKFLOW_ID = 'runtime_build_and_test.yml'; +const GITHUB_HEADERS = ` + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${process.env.GH_TOKEN}" \ + -H "X-GitHub-Api-Version: 2022-11-28"`.trim(); + +function getWorkflowId() { + if (existsSync(join(__dirname, `../../.github/workflows/${WORKFLOW_ID}`))) { + return WORKFLOW_ID; + } else { + throw new Error( + `Incorrect workflow ID: .github/workflows/${WORKFLOW_ID} does not exist. Please check the name of the workflow being downloaded from.` + ); + } +} + +async function getWorkflowRunId(commit) { + const res = await exec( + `curl -L ${GITHUB_HEADERS} https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${getWorkflowId()}/runs?head_sha=${commit}&branch=main&exclude_pull_requests=true` + ); + + const json = JSON.parse(res.stdout); + let workflowRun; + if (json.total_count === 1) { + workflowRun = json.workflow_runs[0]; + } else { + workflowRun = json.workflow_runs.find( + run => run.head_sha === commit && run.head_branch === 'main' + ); + } + + if (workflowRun == null || workflowRun.id == null) { + console.log( + theme`{error The workflow run for the specified commit (${commit}) could not be found.}` + ); + process.exit(1); + } + + return workflowRun.id; +} + +async function getArtifact(workflowRunId, artifactName) { + const res = await exec( + `curl -L ${GITHUB_HEADERS} https://api.github.com/repos/${OWNER}/${REPO}/actions/runs/${workflowRunId}/artifacts?per_page=100&name=${artifactName}` + ); + + const json = JSON.parse(res.stdout); + let artifact; + if (json.total_count === 1) { + artifact = json.artifacts[0]; + } else { + artifact = json.artifacts.find( + _artifact => _artifact.name === artifactName + ); + } + + if (artifact == null) { + console.log( + theme`{error The specified workflow run (${workflowRunId}) does not contain any build artifacts.}` + ); + process.exit(1); + } + + return artifact; +} + +async function downloadArtifactsFromGitHub(commit, releaseChannel) { + const workflowRunId = await getWorkflowRunId(commit); + const artifact = await getArtifact(workflowRunId, 'artifacts_combined'); + + // Download and extract artifact + const cwd = join(__dirname, '..', '..'); + await exec(`rm -rf ./build`, {cwd}); + await exec( + `curl -L ${GITHUB_HEADERS} ${artifact.archive_download_url} \ + > a.zip && unzip a.zip -d . && rm a.zip build2.tgz && tar -xvzf build.tgz && rm build.tgz`, + { + cwd, + } + ); + + // Copy to staging directory + // TODO: Consider staging the release in a different directory from the CI + // build artifacts: `./build/node_modules` -> `./staged-releases` + if (!existsSync(join(cwd, 'build'))) { + await exec(`mkdir ./build`, {cwd}); + } else { + await exec(`rm -rf ./build/node_modules`, {cwd}); + } + let sourceDir; + // TODO: Rename release channel to `next` + if (releaseChannel === 'stable') { + sourceDir = 'oss-stable'; + } else if (releaseChannel === 'experimental') { + sourceDir = 'oss-experimental'; + } else if (releaseChannel === 'rc') { + sourceDir = 'oss-stable-rc'; + } else if (releaseChannel === 'latest') { + sourceDir = 'oss-stable-semver'; + } else { + console.error('Internal error: Invalid release channel: ' + releaseChannel); + process.exit(releaseChannel); + } + await exec(`cp -r ./build/${sourceDir} ./build/node_modules`, {cwd}); +} + +async function downloadBuildArtifacts(commit, releaseChannel) { + const label = theme`commit {commit ${commit}})`; + return logPromise( + downloadArtifactsFromGitHub(commit, releaseChannel), + theme`Downloading artifacts from GitHub for ${label}` + ); +} + +const main = async () => { try { - argv.cwd = join(__dirname, '..', '..'); - argv.packages = await getPublicPackages(true); - - console.log(argv); - + await downloadBuildArtifacts(argv.commit, argv.releaseChannel); printSummary(argv.commit); } catch (error) { handleError(error); } }; -run(); +if (process.env.GH_TOKEN == null) { + console.log( + theme`{error Expected GH_TOKEN to be provided as an env variable}` + ); + process.exit(1); +} + +main(); From 4fb11acd795310a97c5052733e3240a9517eae76 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:11 -0400 Subject: [PATCH 08/78] [ci] Add sizebot to gh actions Wires up sizebot in gh actions. I also fixed sizebot incorrectly reporting that ReactAllWarnings was deleted. ghstack-source-id: d3b1bb2088651409e8656c66f1eb28ab534a0604 Pull Request resolved: https://github.com/facebook/react/pull/30380 --- .github/workflows/runtime_build_and_test.yml | 84 ++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index b5dd8a9693..19ee2c180f 100644 --- a/.github/workflows/runtime_build_and_test.yml +++ b/.github/workflows/runtime_build_and_test.yml @@ -522,3 +522,87 @@ jobs: - run: ./scripts/circleci/run_devtools_e2e_tests.js env: RELEASE_CHANNEL: experimental + + # ----- SIZEBOT ----- + download_base_build_for_sizebot: + name: Download base build for sizebot + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.20.1 + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: scripts/release/node_modules + key: ${{ runner.arch }}-${{ runner.os }}-scripts-modules-${{ hashFiles('scripts/release/yarn.lock') }} + - run: yarn install --frozen-lockfile + - run: yarn install --frozen-lockfile + working-directory: scripts/release + - name: Download artifacts for base revision + run: | + git fetch origin main + GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=$(git rev-parse origin/main) + mv ./build ./base-build + # TODO: The `download-experimental-build` script copies the npm + # packages into the `node_modules` directory. This is a historical + # quirk of how the release script works. Let's pretend they + # don't exist. + - name: Delete extraneous files + run: rm -rf ./base-build/node_modules + - name: Display structure of base-build + run: ls -R base-build + - name: Archive base-build + uses: actions/upload-artifact@v4 + with: + name: base-build + path: base-build + + sizebot: + name: Run sizebot + needs: download_base_build_for_sizebot + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.20.1 + cache: yarn + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - run: yarn install --frozen-lockfile + - name: Restore archived build for PR + uses: actions/download-artifact@v4 + with: + pattern: _build_* + path: build + merge-multiple: true + - name: Scrape warning messages + run: | + mkdir -p ./build/__test_utils__ + node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js + - name: Display structure of build for PR + run: ls -R build + - name: Restore archived base-build from origin/main + uses: actions/download-artifact@v4 + with: + name: base-build + path: base-build + - name: Display structure of base-build from origin/main + run: ls -R base-build + - run: echo ${{ github.sha }} >> build/COMMIT_SHA + - run: node ./scripts/tasks/danger + - name: Archive sizebot results + uses: actions/upload-artifact@v4 + with: + name: sizebot-message + path: sizebot-message.md From 7af570c3d9d61ae57c9f974998324cfa22a615e0 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:12 -0400 Subject: [PATCH 09/78] [ci] Remove sizebot from circleci Now that the job is migrated to GH, we can remove this from circleci. Note that sizebot still comments on this PR. ghstack-source-id: 337661e3b00d3d3686a539bf0877d8526b0f15b9 Pull Request resolved: https://github.com/facebook/react/pull/30387 --- .circleci/config.yml | 55 -------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 37544484f2..a95b612e2f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,33 +97,6 @@ jobs: paths: - build - download_base_build_for_sizebot: - docker: *docker - environment: *environment - steps: - - checkout - - setup_node_modules - - run: - name: Download artifacts for base revision - command: | - git fetch origin main - cd ./scripts/release && yarn && cd ../../ - scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main) --allowBrokenCI - mv ./build ./base-build - - - run: - # TODO: The `download-experimental-build` script copies the npm - # packages into the `node_modules` directory. This is a historical - # quirk of how the release script works. Let's pretend they - # don't exist. - name: Delete extraneous files - command: rm -rf ./base-build/node_modules - - - persist_to_workspace: - root: . - paths: - - base-build - process_artifacts_combined: docker: *docker environment: *environment @@ -142,20 +115,6 @@ jobs: - store_artifacts: path: ./build.tgz - sizebot: - docker: *docker - environment: *environment - steps: - - checkout - - attach_workspace: - at: . - - run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA - - setup_node_modules - - run: - command: node ./scripts/tasks/danger - - store_artifacts: - path: sizebot-message.md - build_devtools_and_process_artifacts: docker: *docker environment: *environment @@ -280,20 +239,6 @@ workflows: requires: - scrape_warning_messages - yarn_build - - download_base_build_for_sizebot: - filters: - branches: - ignore: - - main - - builds/facebook-www - - sizebot: - filters: - branches: - ignore: - - main - requires: - - download_base_build_for_sizebot - - yarn_build devtools_regression_tests: unless: << pipeline.parameters.prerelease_commit_sha >> From 6fac743ed757d5d61972e25f43f26c7a2ca07dc2 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 18 Jul 2024 16:19:12 -0400 Subject: [PATCH 10/78] [circleci] Inline scrape_warning_messages This job was only being used for process_artifacts_combined in circleci but as it was a separate job would incur the cost and time of spinning up a new CI worker. We can simply inline this into process_artifacts_combined. Test plan: Download [build.tgz](https://app.circleci.com/pipelines/github/facebook/react/57183/workflows/3b22a99e-b8a5-4c80-9682-576f24581b00/jobs/956476/artifacts) from circleci and observe that the __test_utils__ directory is still present. ghstack-source-id: 8748d8fb9cf01d8fffe7e7590729a44def265c79 Pull Request resolved: https://github.com/facebook/react/pull/30388 --- .circleci/config.yml | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a95b612e2f..fc24be0cae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,22 +48,6 @@ parameters: default: '' jobs: - scrape_warning_messages: - docker: *docker - environment: *environment - - steps: - - checkout - - setup_node_modules - - run: - command: | - mkdir -p ./build/__test_utils__ - node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js - - persist_to_workspace: - root: . - paths: - - build - yarn_build: docker: *docker environment: *environment @@ -106,7 +90,10 @@ jobs: at: . - setup_node_modules - run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA - # Compress build directory into a single tarball for easy download + - run: | + mkdir -p ./build/__test_utils__ + node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js + # Compress build directory into a single tarball for easy download - run: tar -zcvf ./build.tgz ./build # TODO: Migrate scripts to use `build` directory instead of `build2` - run: cp ./build.tgz ./build2.tgz @@ -230,14 +217,8 @@ workflows: branches: ignore: - builds/facebook-www - - scrape_warning_messages: - filters: - branches: - ignore: - - builds/facebook-www - process_artifacts_combined: requires: - - scrape_warning_messages - yarn_build devtools_regression_tests: From fd2b3e13d330a4559f5aa21462e1cb2cbbcf144b Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Thu, 18 Jul 2024 17:00:24 -0400 Subject: [PATCH 11/78] Compiler: unfork prettier config (#30205) Updates the prettier config to format all `.ts` and `.tsx` files in the repo using the existing defaults and removing overrides. The first commit in this PR contains the config changes, the second is just the result of running `yarn prettier-all`. --- .prettierrc.js | 22 +- .../playground/__tests__/e2e/page.spec.ts | 28 +- compiler/apps/playground/app/index.tsx | 22 +- compiler/apps/playground/app/layout.tsx | 19 +- compiler/apps/playground/app/page.tsx | 11 +- compiler/apps/playground/babel.config.js | 6 +- compiler/apps/playground/colors.js | 132 +- .../components/Editor/EditorImpl.tsx | 134 +- .../playground/components/Editor/Input.tsx | 55 +- .../playground/components/Editor/Output.tsx | 109 +- .../playground/components/Editor/index.tsx | 4 +- .../components/Editor/monacoOptions.ts | 16 +- .../apps/playground/components/Header.tsx | 41 +- .../components/Icons/IconGitHub.tsx | 9 +- compiler/apps/playground/components/Logo.tsx | 5 +- .../apps/playground/components/Message.tsx | 24 +- .../playground/components/StoreContext.tsx | 24 +- .../playground/components/TabbedWindow.tsx | 23 +- compiler/apps/playground/components/index.ts | 6 +- compiler/apps/playground/hooks/index.ts | 2 +- .../apps/playground/hooks/useMountEffect.ts | 4 +- compiler/apps/playground/lib/createContext.ts | 6 +- compiler/apps/playground/lib/defaultStore.ts | 4 +- .../lib/reactCompilerMonacoDiagnostics.ts | 26 +- compiler/apps/playground/lib/stores/index.ts | 4 +- .../apps/playground/lib/stores/messages.ts | 6 +- compiler/apps/playground/lib/stores/store.ts | 20 +- compiler/apps/playground/next.config.js | 16 +- compiler/apps/playground/playwright.config.js | 18 +- .../apps/playground/scripts/downloadFonts.js | 8 +- compiler/apps/playground/tailwind.config.js | 28 +- .../jest.config.js | 2 +- .../rollup.config.js | 34 +- .../babel-plugin-annotate-react-code.ts | 92 +- .../scripts/build-react-hooks-fixures.js | 52 +- .../eslint-plugin-react-hooks-test-cases.js | 6 +- .../scripts/jest/e2e-classic.config.js | 4 +- .../scripts/jest/e2e-forget.config.js | 6 +- .../scripts/jest/main.config.js | 8 +- .../scripts/jest/makeE2EConfig.js | 22 +- .../scripts/jest/makeSnapshotResolver.js | 4 +- .../scripts/jest/makeTransform.ts | 60 +- .../scripts/jest/setupEnvE2E.js | 2 +- .../jest/snapshot-resolver-no-forget.js | 2 +- .../jest/snapshot-resolver-with-forget.js | 2 +- .../scripts/jest/transform-no-forget.js | 2 +- .../scripts/jest/transform-with-forget.js | 2 +- .../src/Babel/BabelPlugin.ts | 14 +- .../src/Babel/RunReactCompilerBabelPlugin.ts | 30 +- .../src/CompilerError.ts | 60 +- .../src/Entrypoint/Gating.ts | 41 +- .../src/Entrypoint/Imports.ts | 62 +- .../src/Entrypoint/Options.ts | 48 +- .../src/Entrypoint/Pipeline.ts | 248 +-- .../src/Entrypoint/Program.ts | 320 +-- .../src/Entrypoint/Reanimated.ts | 18 +- .../src/Entrypoint/Suppression.ts | 46 +- .../src/Entrypoint/index.ts | 12 +- .../src/HIR/AssertConsistentIdentifiers.ts | 12 +- .../src/HIR/AssertTerminalBlocksExist.ts | 18 +- .../src/HIR/AssertValidBlockNesting.ts | 24 +- .../src/HIR/AssertValidMutableRanges.ts | 10 +- .../src/HIR/BuildHIR.ts | 1714 ++++++++--------- .../src/HIR/BuildReactiveScopeTerminalsHIR.ts | 36 +- .../src/HIR/ComputeUnconditionalBlocks.ts | 6 +- .../src/HIR/Dominator.ts | 24 +- .../src/HIR/Environment.ts | 110 +- .../src/HIR/FindContextIdentifiers.ts | 54 +- .../src/HIR/Globals.ts | 296 +-- .../src/HIR/HIR.ts | 414 ++-- .../src/HIR/HIRBuilder.ts | 134 +- .../src/HIR/MergeConsecutiveBlocks.ts | 24 +- .../HIR/MergeOverlappingReactiveScopesHIR.ts | 40 +- .../src/HIR/ObjectShape.ts | 214 +- .../src/HIR/PrintHIR.ts | 494 ++--- .../src/HIR/PruneUnusedLabelsHIR.ts | 20 +- .../src/HIR/Types.ts | 72 +- .../src/HIR/index.ts | 28 +- .../src/HIR/visitors.ts | 586 +++--- .../src/Inference/AnalyseFunctions.ts | 46 +- .../src/Inference/DropManualMemoization.ts | 100 +- .../src/Inference/InferAlias.ts | 24 +- .../src/Inference/InferAliasForPhis.ts | 6 +- .../src/Inference/InferAliasForStores.ts | 14 +- .../Inference/InferMutableContextVariables.ts | 20 +- .../src/Inference/InferMutableLifetimes.ts | 24 +- .../src/Inference/InferMutableRanges.ts | 14 +- .../Inference/InferMutableRangesForAlias.ts | 8 +- .../src/Inference/InferReactivePlaces.ts | 48 +- .../src/Inference/InferReferenceEffects.ts | 406 ++-- .../src/Inference/InferTryCatchAliases.ts | 12 +- ...neImmediatelyInvokedFunctionExpressions.ts | 38 +- .../src/Inference/index.ts | 12 +- .../src/Optimization/ConstantPropagation.ts | 222 +-- .../src/Optimization/DeadCodeElimination.ts | 126 +- .../src/Optimization/InstructionReordering.ts | 86 +- .../src/Optimization/OutlineFunctions.ts | 14 +- .../src/Optimization/PruneMaybeThrows.ts | 22 +- .../src/Optimization/index.ts | 6 +- .../ReactiveScopes/AlignMethodCallScopes.ts | 16 +- .../ReactiveScopes/AlignObjectMethodScopes.ts | 30 +- .../AlignReactiveScopesToBlockScopes.ts | 18 +- .../AlignReactiveScopesToBlockScopesHIR.ts | 54 +- .../AssertScopeInstructionsWithinScope.ts | 18 +- .../AssertWellFormedBreakTargets.ts | 12 +- .../src/ReactiveScopes/BuildReactiveBlocks.ts | 60 +- .../ReactiveScopes/BuildReactiveFunction.ts | 360 ++-- .../ReactiveScopes/CodegenReactiveFunction.ts | 997 +++++----- .../CollectReactiveIdentifiers.ts | 12 +- .../CollectReferencedGlobals.ts | 14 +- .../DeriveMinimalDependencies.ts | 86 +- ...tractScopeDeclarationsFromDestructuring.ts | 28 +- .../ReactiveScopes/FlattenReactiveLoops.ts | 44 +- .../ReactiveScopes/FlattenReactiveLoopsHIR.ts | 56 +- .../FlattenScopesWithHooksOrUse.ts | 20 +- .../FlattenScopesWithHooksOrUseHIR.ts | 30 +- .../InferReactiveScopeVariables.ts | 126 +- .../MemoizeFbtAndMacroOperandsInSameScope.ts | 58 +- .../MergeOverlappingReactiveScopes.ts | 34 +- ...rgeReactiveScopesThatInvalidateTogether.ts | 108 +- .../ReactiveScopes/PrintReactiveFunction.ts | 174 +- .../ReactiveScopes/PromoteUsedTemporaries.ts | 32 +- .../ReactiveScopes/PropagateEarlyReturns.ts | 82 +- .../PropagateScopeDependencies.ts | 173 +- .../ReactiveScopes/PruneAllReactiveScopes.ts | 8 +- .../PruneAlwaysInvalidatingScopes.ts | 36 +- .../ReactiveScopes/PruneHoistedContexts.ts | 22 +- .../PruneInitializationDependencies.ts | 98 +- .../ReactiveScopes/PruneNonEscapingScopes.ts | 274 +-- .../PruneNonReactiveDependencies.ts | 24 +- .../ReactiveScopes/PruneTemporaryLValues.ts | 6 +- .../src/ReactiveScopes/PruneUnusedLabels.ts | 22 +- .../src/ReactiveScopes/PruneUnusedScopes.ts | 16 +- .../src/ReactiveScopes/RenameVariables.ts | 22 +- .../src/ReactiveScopes/StabilizeBlockIds.ts | 22 +- .../src/ReactiveScopes/index.ts | 59 +- .../src/ReactiveScopes/visitors.ts | 254 +-- .../src/SSA/EliminateRedundantPhi.ts | 22 +- .../src/SSA/EnterSSA.ts | 52 +- .../src/SSA/LeaveSSA.ts | 96 +- .../src/SSA/index.ts | 6 +- .../src/TypeInference/InferTypes.ts | 272 +-- .../src/TypeInference/index.ts | 2 +- .../src/Utils/ComponentDeclaration.ts | 8 +- .../src/Utils/DisjointSet.ts | 4 +- .../src/Utils/HookDeclaration.ts | 8 +- .../src/Utils/Stack.ts | 2 +- .../src/Utils/logger.ts | 28 +- .../src/Utils/todo.ts | 6 +- .../src/Utils/utils.ts | 16 +- .../ValidateContextVariableLValues.ts | 69 +- .../src/Validation/ValidateHooksUsage.ts | 90 +- .../ValidateLocalsNotReassignedAfterRender.ts | 48 +- .../ValidateMemoizedEffectDependencies.ts | 20 +- .../Validation/ValidateNoCapitalizedCalls.ts | 20 +- .../Validation/ValidateNoRefAccesInRender.ts | 78 +- .../Validation/ValidateNoSetStateInRender.ts | 42 +- .../ValidatePreservedManualMemoization.ts | 124 +- .../src/Validation/ValidateUseMemo.ts | 30 +- .../src/Validation/index.ts | 16 +- .../src/__tests__/DisjointSet-test.ts | 22 +- .../src/__tests__/Logger-test.ts | 60 +- .../src/__tests__/Result-test.ts | 114 +- .../src/__tests__/e2e/constant-prop.e2e.js | 32 +- .../src/__tests__/e2e/hello.e2e.js | 18 +- .../src/__tests__/e2e/update-button.e2e.js | 16 +- .../__tests__/e2e/update-expressions.e2e.js | 10 +- .../src/__tests__/e2e/use-state.e2e.js | 22 +- .../src/__tests__/envConfig-test.ts | 22 +- ...re-in-method-receiver-and-mutate.expect.md | 2 +- ...s-capture-in-method-receiver-and-mutate.js | 2 +- .../compiler/alias-computed-load.expect.md | 4 +- .../fixtures/compiler/alias-computed-load.js | 4 +- .../align-scope-starts-within-cond.expect.md | 2 +- .../align-scope-starts-within-cond.ts | 2 +- ...fe-return-modified-later-logical.expect.md | 4 +- ...opes-iife-return-modified-later-logical.ts | 4 +- ...gn-scopes-nested-block-structure.expect.md | 16 +- .../align-scopes-nested-block-structure.ts | 16 +- ...copes-reactive-scope-overlaps-if.expect.md | 14 +- ...align-scopes-reactive-scope-overlaps-if.ts | 14 +- ...es-reactive-scope-overlaps-label.expect.md | 14 +- ...gn-scopes-reactive-scope-overlaps-label.ts | 14 +- ...opes-reactive-scope-overlaps-try.expect.md | 8 +- ...lign-scopes-reactive-scope-overlaps-try.ts | 8 +- ...rycatch-nested-overlapping-range.expect.md | 2 +- ...copes-trycatch-nested-overlapping-range.ts | 2 +- ...ithin-nested-valueblock-in-array.expect.md | 10 +- ...opes-within-nested-valueblock-in-array.tsx | 10 +- ...cal-expression-instruction-scope.expect.md | 4 +- ...ng-logical-expression-instruction-scope.ts | 4 +- ...ng-primitive-as-dep-nested-scope.expect.md | 12 +- ...llocating-primitive-as-dep-nested-scope.js | 12 +- ...n-in-effect-indirect-usecallback.expect.md | 2 +- ...mutation-in-effect-indirect-usecallback.js | 2 +- ...obal-mutation-in-effect-indirect.expect.md | 2 +- ...llow-global-mutation-in-effect-indirect.js | 2 +- ...obal-mutation-unused-usecallback.expect.md | 2 +- ...llow-global-mutation-unused-usecallback.js | 2 +- ...-reassignment-in-effect-indirect.expect.md | 2 +- ...-global-reassignment-in-effect-indirect.js | 2 +- ...ow-global-reassignment-in-effect.expect.md | 2 +- .../allow-global-reassignment-in-effect.js | 2 +- ...ow-modify-global-in-callback-jsx.expect.md | 18 +- .../allow-modify-global-in-callback-jsx.js | 18 +- ...mutate-global-in-effect-fixpoint.expect.md | 6 +- .../allow-mutate-global-in-effect-fixpoint.js | 6 +- ...-callback-passed-to-jsx-indirect.expect.md | 4 +- ...ref-in-callback-passed-to-jsx-indirect.tsx | 4 +- ...ng-ref-in-callback-passed-to-jsx.expect.md | 4 +- ...mutating-ref-in-callback-passed-to-jsx.tsx | 4 +- ...-callback-passed-to-jsx-indirect.expect.md | 4 +- ...rty-in-callback-passed-to-jsx-indirect.tsx | 4 +- ...operty-in-callback-passed-to-jsx.expect.md | 4 +- ...ref-property-in-callback-passed-to-jsx.tsx | 4 +- ...ow-ref-access-in-effect-indirect.expect.md | 6 +- .../allow-ref-access-in-effect-indirect.js | 6 +- .../allow-ref-access-in-effect.expect.md | 6 +- .../compiler/allow-ref-access-in-effect.js | 6 +- ...access-in-unused-callback-nested.expect.md | 6 +- ...ow-ref-access-in-unused-callback-nested.js | 6 +- .../array-access-assignment.expect.md | 14 +- .../compiler/array-access-assignment.js | 14 +- .../array-concat-should-capture.expect.md | 10 +- .../compiler/array-concat-should-capture.ts | 10 +- .../array-expression-spread.expect.md | 4 +- .../compiler/array-expression-spread.js | 4 +- .../fixtures/compiler/array-join.expect.md | 2 +- .../__tests__/fixtures/compiler/array-join.js | 2 +- ...ay-map-captures-receiver-noAlias.expect.md | 6 +- .../array-map-captures-receiver-noAlias.js | 6 +- .../array-map-frozen-array-noAlias.expect.md | 2 +- .../array-map-frozen-array-noAlias.js | 2 +- .../compiler/array-map-frozen-array.expect.md | 2 +- .../compiler/array-map-frozen-array.js | 2 +- ...le-array-mutating-lambda-noAlias.expect.md | 2 +- ...p-mutable-array-mutating-lambda-noAlias.js | 2 +- ...ap-mutable-array-mutating-lambda.expect.md | 2 +- ...array-map-mutable-array-mutating-lambda.js | 2 +- ...n-mutating-lambda-mutated-result.expect.md | 2 +- ...rray-non-mutating-lambda-mutated-result.js | 2 +- ...ay-map-noAlias-escaping-function.expect.md | 4 +- .../array-map-noAlias-escaping-function.js | 4 +- .../compiler/array-pattern-params.expect.md | 6 +- .../fixtures/compiler/array-pattern-params.js | 6 +- .../compiler/array-properties.expect.md | 6 +- .../fixtures/compiler/array-properties.js | 6 +- .../compiler/array-property-call.expect.md | 6 +- .../fixtures/compiler/array-property-call.js | 6 +- .../compiler/array-push-effect.expect.md | 2 +- .../fixtures/compiler/array-push-effect.js | 2 +- .../compiler/arrow-expr-directive.expect.md | 6 +- .../fixtures/compiler/arrow-expr-directive.js | 6 +- ...rrow-function-one-line-directive.expect.md | 2 +- .../arrow-function-one-line-directive.js | 2 +- .../assignment-expression-computed.expect.md | 4 +- .../assignment-expression-computed.js | 4 +- ...ssignment-expression-nested-path.expect.md | 4 +- .../assignment-expression-nested-path.js | 4 +- ...gnment-variations-complex-lvalue.expect.md | 2 +- .../assignment-variations-complex-lvalue.js | 2 +- .../babel-existing-react-import.expect.md | 2 +- .../compiler/babel-existing-react-import.js | 2 +- ...xisting-react-kitchensink-import.expect.md | 4 +- ...babel-existing-react-kitchensink-import.js | 4 +- ...-existing-react-namespace-import.expect.md | 4 +- .../babel-existing-react-namespace-import.js | 4 +- .../block-scoping-switch-dead-code.expect.md | 2 +- .../block-scoping-switch-dead-code.js | 2 +- ...-scoping-switch-variable-scoping.expect.md | 6 +- .../block-scoping-switch-variable-scoping.js | 6 +- .../bug-codegen-inline-iife.expect.md | 4 +- .../compiler/bug-codegen-inline-iife.ts | 4 +- ...ug-invalid-hoisting-functionexpr.expect.md | 6 +- .../bug-invalid-hoisting-functionexpr.tsx | 6 +- .../capitalized-function-allowlist.expect.md | 4 +- .../capitalized-function-allowlist.js | 4 +- ...pture-indirect-mutate-alias-iife.expect.md | 2 +- .../capture-indirect-mutate-alias-iife.js | 2 +- .../capture-indirect-mutate-alias.expect.md | 6 +- .../compiler/capture-indirect-mutate-alias.js | 6 +- .../compiler/capture-param-mutate.expect.md | 10 +- .../fixtures/compiler/capture-param-mutate.js | 10 +- .../capture-ref-for-later-mutation.expect.md | 12 +- .../capture-ref-for-later-mutation.tsx | 12 +- .../capture_mutate-across-fns-iife.expect.md | 2 +- .../capture_mutate-across-fns-iife.js | 2 +- .../capture_mutate-across-fns.expect.md | 6 +- .../compiler/capture_mutate-across-fns.js | 6 +- .../capturing-arrow-function-1.expect.md | 6 +- .../compiler/capturing-arrow-function-1.js | 6 +- ...fun-alias-captured-mutate-2-iife.expect.md | 10 +- ...turing-fun-alias-captured-mutate-2-iife.js | 10 +- ...ring-fun-alias-captured-mutate-2.expect.md | 6 +- .../capturing-fun-alias-captured-mutate-2.js | 6 +- ...alias-captured-mutate-arr-2-iife.expect.md | 8 +- ...ng-fun-alias-captured-mutate-arr-2-iife.js | 8 +- ...-fun-alias-captured-mutate-arr-2.expect.md | 4 +- ...pturing-fun-alias-captured-mutate-arr-2.js | 4 +- ...c-alias-captured-mutate-arr-iife.expect.md | 8 +- ...ing-func-alias-captured-mutate-arr-iife.js | 8 +- ...g-func-alias-captured-mutate-arr.expect.md | 4 +- ...apturing-func-alias-captured-mutate-arr.js | 4 +- ...-func-alias-captured-mutate-iife.expect.md | 10 +- ...pturing-func-alias-captured-mutate-iife.js | 10 +- ...uring-func-alias-captured-mutate.expect.md | 6 +- .../capturing-func-alias-captured-mutate.js | 6 +- ...-func-alias-computed-mutate-iife.expect.md | 8 +- ...pturing-func-alias-computed-mutate-iife.js | 8 +- ...uring-func-alias-computed-mutate.expect.md | 4 +- .../capturing-func-alias-computed-mutate.js | 4 +- ...capturing-func-alias-mutate-iife.expect.md | 6 +- .../capturing-func-alias-mutate-iife.js | 6 +- .../capturing-func-alias-mutate.expect.md | 2 +- .../compiler/capturing-func-alias-mutate.js | 2 +- ...as-receiver-computed-mutate-iife.expect.md | 8 +- ...unc-alias-receiver-computed-mutate-iife.js | 8 +- ...c-alias-receiver-computed-mutate.expect.md | 4 +- ...ing-func-alias-receiver-computed-mutate.js | 4 +- ...-func-alias-receiver-mutate-iife.expect.md | 6 +- ...pturing-func-alias-receiver-mutate-iife.js | 6 +- ...uring-func-alias-receiver-mutate.expect.md | 2 +- .../capturing-func-alias-receiver-mutate.js | 2 +- .../capturing-func-mutate-2.expect.md | 6 +- .../compiler/capturing-func-mutate-2.js | 6 +- .../capturing-func-mutate-3.expect.md | 8 +- .../compiler/capturing-func-mutate-3.js | 8 +- .../capturing-func-mutate-nested.expect.md | 6 +- .../compiler/capturing-func-mutate-nested.js | 6 +- .../compiler/capturing-func-mutate.expect.md | 8 +- .../compiler/capturing-func-mutate.js | 8 +- ...capturing-func-simple-alias-iife.expect.md | 6 +- .../capturing-func-simple-alias-iife.js | 6 +- .../capturing-func-simple-alias.expect.md | 2 +- .../compiler/capturing-func-simple-alias.js | 2 +- .../compiler/capturing-function-1.expect.md | 6 +- .../fixtures/compiler/capturing-function-1.js | 6 +- ...ction-alias-computed-load-2-iife.expect.md | 2 +- ...ing-function-alias-computed-load-2-iife.js | 2 +- ...g-function-alias-computed-load-2.expect.md | 2 +- ...apturing-function-alias-computed-load-2.js | 2 +- ...ction-alias-computed-load-4-iife.expect.md | 2 +- ...ing-function-alias-computed-load-4-iife.js | 2 +- ...g-function-alias-computed-load-4.expect.md | 2 +- ...apturing-function-alias-computed-load-4.js | 2 +- ...unction-alias-computed-load-iife.expect.md | 2 +- ...uring-function-alias-computed-load-iife.js | 2 +- ...ing-function-alias-computed-load.expect.md | 4 +- .../capturing-function-alias-computed-load.js | 4 +- ...nction-capture-ref-before-rename.expect.md | 6 +- ...ring-function-capture-ref-before-rename.js | 6 +- ...ction-conditional-capture-mutate.expect.md | 2 +- ...ing-function-conditional-capture-mutate.js | 2 +- .../capturing-function-decl.expect.md | 6 +- .../compiler/capturing-function-decl.js | 6 +- ...g-function-member-expr-arguments.expect.md | 2 +- ...apturing-function-member-expr-arguments.js | 2 +- ...turing-function-member-expr-call.expect.md | 2 +- .../capturing-function-member-expr-call.js | 2 +- .../capturing-function-renamed-ref.expect.md | 4 +- .../capturing-function-renamed-ref.js | 4 +- ...apturing-function-runs-inference.expect.md | 2 +- .../capturing-function-runs-inference.js | 2 +- ...pturing-function-shadow-captured.expect.md | 2 +- .../capturing-function-shadow-captured.js | 2 +- ...ring-function-skip-computed-path.expect.md | 8 +- .../capturing-function-skip-computed-path.js | 8 +- .../capturing-function-within-block.expect.md | 6 +- .../capturing-function-within-block.js | 6 +- .../compiler/capturing-member-expr.expect.md | 6 +- .../compiler/capturing-member-expr.js | 6 +- .../capturing-nested-member-call.expect.md | 6 +- .../compiler/capturing-nested-member-call.js | 6 +- ...ested-member-expr-in-nested-func.expect.md | 6 +- ...uring-nested-member-expr-in-nested-func.js | 6 +- .../capturing-nested-member-expr.expect.md | 6 +- .../compiler/capturing-nested-member-expr.js | 6 +- ...capturing-reference-changes-type.expect.md | 2 +- .../capturing-reference-changes-type.js | 2 +- ...pturing-variable-in-nested-block.expect.md | 6 +- .../capturing-variable-in-nested-block.js | 6 +- ...ring-variable-in-nested-function.expect.md | 6 +- .../capturing-variable-in-nested-function.js | 6 +- ...ined-assignment-context-variable.expect.md | 2 +- .../chained-assignment-context-variable.js | 2 +- .../chained-assignment-expressions.expect.md | 6 +- .../chained-assignment-expressions.js | 6 +- ...en-instrument-forget-gating-test.expect.md | 4 +- .../codegen-instrument-forget-gating-test.js | 4 +- .../codegen-instrument-forget-test.expect.md | 4 +- .../codegen-instrument-forget-test.js | 4 +- .../fixtures/compiler/complex-while.expect.md | 4 +- .../fixtures/compiler/complex-while.js | 4 +- ...nt-inner-function-with-many-args.expect.md | 4 +- ...omponent-inner-function-with-many-args.tsx | 4 +- .../fixtures/compiler/component.expect.md | 4 +- .../__tests__/fixtures/compiler/component.js | 4 +- .../computed-call-evaluation-order.expect.md | 10 +- .../computed-call-evaluation-order.js | 10 +- .../compiler/computed-store-alias.expect.md | 6 +- .../fixtures/compiler/computed-store-alias.js | 6 +- .../compiler/concise-arrow-expr.expect.md | 2 +- .../fixtures/compiler/concise-arrow-expr.js | 2 +- .../conditional-break-labeled.expect.md | 4 +- .../compiler/conditional-break-labeled.js | 4 +- .../conditional-early-return.expect.md | 2 +- .../compiler/conditional-early-return.js | 2 +- .../conditional-set-state-in-render.expect.md | 4 +- .../conditional-set-state-in-render.js | 4 +- ...conflicting-dollar-sign-variable.expect.md | 4 +- .../conflicting-dollar-sign-variable.js | 4 +- .../compiler/consecutive-use-memo.expect.md | 10 +- .../fixtures/compiler/consecutive-use-memo.ts | 10 +- .../compiler/console-readonly.expect.md | 4 +- .../fixtures/compiler/console-readonly.js | 4 +- .../const-propagation-phi-nodes.expect.md | 2 +- .../compiler/const-propagation-phi-nodes.ts | 2 +- .../compiler/constant-computed.expect.md | 8 +- .../fixtures/compiler/constant-computed.js | 8 +- ...ant-prop-across-objectmethod-def.expect.md | 2 +- .../constant-prop-across-objectmethod-def.js | 2 +- ...nstant-prop-colliding-identifier.expect.md | 4 +- .../constant-prop-colliding-identifier.js | 4 +- .../constant-prop-to-object-method.expect.md | 2 +- .../constant-prop-to-object-method.js | 2 +- ...t-propagate-global-phis-constant.expect.md | 8 +- ...constant-propagate-global-phis-constant.js | 8 +- .../constant-propagate-global-phis.expect.md | 8 +- .../constant-propagate-global-phis.js | 8 +- .../constant-propagation-bit-ops.expect.md | 2 +- .../compiler/constant-propagation-bit-ops.js | 2 +- .../constant-propagation-phi.expect.md | 4 +- .../compiler/constant-propagation-phi.js | 4 +- ...nstant-propagation-string-concat.expect.md | 4 +- .../constant-propagation-string-concat.js | 4 +- .../constant-propagation-unary.expect.md | 12 +- .../compiler/constant-propagation-unary.js | 12 +- .../compiler/constant-propagation.expect.md | 2 +- .../fixtures/compiler/constant-propagation.js | 2 +- ...text-variable-as-jsx-element-tag.expect.md | 6 +- .../context-variable-as-jsx-element-tag.js | 6 +- ...ext-variable-only-chained-assign.expect.md | 2 +- .../context-variable-only-chained-assign.js | 2 +- ...e-reactive-explicit-control-flow.expect.md | 8 +- ...variable-reactive-explicit-control-flow.js | 8 +- ...e-reactive-implicit-control-flow.expect.md | 8 +- ...variable-reactive-implicit-control-flow.js | 8 +- ...variable-reassigned-objectmethod.expect.md | 6 +- ...ontext-variable-reassigned-objectmethod.js | 6 +- ...ble-reassigned-outside-of-lambda.expect.md | 2 +- ...t-variable-reassigned-outside-of-lambda.js | 2 +- ...able-reassigned-reactive-capture.expect.md | 8 +- ...xt-variable-reassigned-reactive-capture.js | 8 +- ...-variable-reassigned-two-lambdas.expect.md | 12 +- ...context-variable-reassigned-two-lambdas.js | 12 +- .../compiler/controlled-input.expect.md | 4 +- .../fixtures/compiler/controlled-input.js | 4 +- .../compiler/createElement-freeze.expect.md | 8 +- .../fixtures/compiler/createElement-freeze.js | 8 +- .../fixtures/compiler/dce-loop.expect.md | 2 +- .../__tests__/fixtures/compiler/dce-loop.js | 2 +- .../compiler/dce-unused-const.expect.md | 2 +- .../fixtures/compiler/dce-unused-const.js | 2 +- .../dce-unused-postfix-update.expect.md | 2 +- .../compiler/dce-unused-postfix-update.js | 2 +- .../dce-unused-prefix-update.expect.md | 2 +- .../compiler/dce-unused-prefix-update.js | 2 +- .../compiler/debugger-memoized.expect.md | 4 +- .../fixtures/compiler/debugger-memoized.js | 4 +- .../fixtures/compiler/debugger.expect.md | 4 +- .../__tests__/fixtures/compiler/debugger.js | 4 +- ...are-reassign-variable-in-closure.expect.md | 4 +- .../declare-reassign-variable-in-closure.js | 4 +- ...ault-param-calls-global-function.expect.md | 4 +- .../default-param-calls-global-function.js | 4 +- ...-param-with-reorderable-callback.expect.md | 2 +- ...default-param-with-reorderable-callback.js | 2 +- .../delete-computed-property.expect.md | 8 +- .../compiler/delete-computed-property.js | 8 +- .../compiler/delete-property.expect.md | 6 +- .../fixtures/compiler/delete-property.js | 6 +- .../compiler/dependencies-outputs.expect.md | 4 +- .../fixtures/compiler/dependencies-outputs.js | 4 +- .../fixtures/compiler/dependencies.expect.md | 4 +- .../fixtures/compiler/dependencies.js | 4 +- ...-array-assignment-to-context-var.expect.md | 6 +- ...ructure-array-assignment-to-context-var.js | 6 +- ...array-declaration-to-context-var.expect.md | 6 +- ...ucture-array-declaration-to-context-var.js | 6 +- .../destructure-capture-global.expect.md | 4 +- .../compiler/destructure-capture-global.js | 4 +- ...ructure-default-array-with-unary.expect.md | 2 +- .../destructure-default-array-with-unary.js | 2 +- .../destructure-direct-reassignment.expect.md | 6 +- .../destructure-direct-reassignment.js | 6 +- .../destructure-in-branch-ssa.expect.md | 4 +- .../compiler/destructure-in-branch-ssa.ts | 4 +- ...ructure-mixed-property-key-types.expect.md | 6 +- .../destructure-mixed-property-key-types.js | 6 +- ...object-assignment-to-context-var.expect.md | 8 +- ...ucture-object-assignment-to-context-var.js | 8 +- ...bject-declaration-to-context-var.expect.md | 8 +- ...cture-object-declaration-to-context-var.js | 8 +- ...g-literal-key-invalid-identifier.expect.md | 4 +- ...m-string-literal-key-invalid-identifier.js | 4 +- ...ructure-param-string-literal-key.expect.md | 4 +- .../destructure-param-string-literal-key.js | 4 +- ...-invalid-identifier-property-key.expect.md | 2 +- ...literal-invalid-identifier-property-key.js | 2 +- ...ture-string-literal-property-key.expect.md | 2 +- ...destructure-string-literal-property-key.js | 2 +- .../destructuring-array-default.expect.md | 6 +- .../compiler/destructuring-array-default.js | 6 +- ...estructuring-array-param-default.expect.md | 4 +- .../destructuring-array-param-default.js | 4 +- ...cturing-assignment-array-default.expect.md | 6 +- .../destructuring-assignment-array-default.js | 6 +- .../destructuring-assignment.expect.md | 8 +- .../compiler/destructuring-assignment.js | 8 +- ...tructuring-default-at-array-hole.expect.md | 2 +- .../destructuring-default-at-array-hole.js | 2 +- ...cturing-default-at-explicit-null.expect.md | 2 +- .../destructuring-default-at-explicit-null.js | 2 +- ...ng-default-at-explicit-undefined.expect.md | 2 +- ...ructuring-default-at-explicit-undefined.js | 2 +- ...turing-default-past-end-of-array.expect.md | 2 +- ...destructuring-default-past-end-of-array.js | 2 +- ...and-local-variables-with-default.expect.md | 14 +- ...-scope-and-local-variables-with-default.js | 14 +- ...ed-scope-declarations-and-locals.expect.md | 4 +- ...ing-mixed-scope-declarations-and-locals.js | 4 +- .../destructuring-object-default.expect.md | 6 +- .../compiler/destructuring-object-default.js | 6 +- ...structuring-object-param-default.expect.md | 6 +- .../destructuring-object-param-default.js | 6 +- ...uring-object-pattern-within-rest.expect.md | 4 +- ...estructuring-object-pattern-within-rest.js | 4 +- ...destructuring-property-inference.expect.md | 2 +- .../destructuring-property-inference.js | 2 +- ...g-same-property-identifier-names.expect.md | 6 +- ...ucturing-same-property-identifier-names.js | 6 +- ...ith-conditional-as-default-value.expect.md | 2 +- ...uring-with-conditional-as-default-value.js | 2 +- .../fixtures/compiler/destructuring.expect.md | 6 +- .../fixtures/compiler/destructuring.js | 6 +- .../compiler/do-while-break.expect.md | 4 +- .../fixtures/compiler/do-while-break.js | 4 +- .../compiler/do-while-compound-test.expect.md | 4 +- .../compiler/do-while-compound-test.js | 4 +- .../fixtures/compiler/dominator.expect.md | 10 +- .../__tests__/fixtures/compiler/dominator.js | 10 +- ...er-declaration-of-previous-scope.expect.md | 14 +- ...-is-inner-declaration-of-previous-scope.js | 14 +- ...ng-scopes-store-const-used-later.expect.md | 4 +- ...erlapping-scopes-store-const-used-later.js | 4 +- ...s-with-intermediate-reassignment.expect.md | 4 +- ...g-scopes-with-intermediate-reassignment.js | 4 +- .../drop-methodcall-usecallback.expect.md | 4 +- .../compiler/drop-methodcall-usecallback.js | 4 +- .../drop-methodcall-usememo.expect.md | 4 +- .../compiler/drop-methodcall-usememo.js | 4 +- ...rly-return-within-reactive-scope.expect.md | 2 +- ...sted-early-return-within-reactive-scope.js | 2 +- ...tions-reassignments-dependencies.expect.md | 20 +- ...declarations-reassignments-dependencies.js | 20 +- ...rly-return-within-reactive-scope.expect.md | 18 +- .../early-return-within-reactive-scope.js | 18 +- .../fixtures/compiler/early-return.expect.md | 4 +- .../fixtures/compiler/early-return.js | 4 +- .../compiler/empty-catch-statement.expect.md | 2 +- .../compiler/empty-catch-statement.ts | 2 +- ...odo.computed-lval-in-destructure.expect.md | 6 +- ...rror._todo.computed-lval-in-destructure.js | 2 +- ...ut-on-suppression-of-custom-rule.expect.md | 4 +- ...r.bailout-on-suppression-of-custom-rule.js | 2 +- ...gen-error-on-conflicting-imports.expect.md | 2 +- ...or.codegen-error-on-conflicting-imports.js | 2 +- ...rror.dont-hoist-inline-reference.expect.md | 4 +- .../error.dont-hoist-inline-reference.js | 2 +- .../error.gating-use-before-decl.expect.md | 2 +- .../compiler/error.gating-use-before-decl.js | 2 +- ...ror.hoisted-function-declaration.expect.md | 4 +- .../error.hoisted-function-declaration.js | 2 +- ...or.hook-property-load-local-hook.expect.md | 2 +- .../error.hook-property-load-local-hook.js | 2 +- ...-callback-invoked-during-render-.expect.md | 8 +- ...-ref-in-callback-invoked-during-render-.js | 4 +- ...itional-call-aliased-hook-import.expect.md | 2 +- ...id-conditional-call-aliased-hook-import.js | 2 +- ...ditional-call-aliased-react-hook.expect.md | 2 +- ...lid-conditional-call-aliased-react-hook.js | 2 +- ...l-call-non-hook-imported-as-hook.expect.md | 2 +- ...ditional-call-non-hook-imported-as-hook.js | 2 +- ...destructure-assignment-to-global.expect.md | 4 +- ...nvalid-destructure-assignment-to-global.js | 2 +- ...pression-mutates-immutable-value.expect.md | 6 +- ...tion-expression-mutates-immutable-value.js | 4 +- ...lid-global-reassignment-indirect.expect.md | 2 +- ...or.invalid-global-reassignment-indirect.js | 2 +- ...-mutate-props-in-effect-fixpoint.expect.md | 2 +- ...invalid-mutate-props-in-effect-fixpoint.js | 2 +- ...rror.invalid-mutation-in-closure.expect.md | 4 +- .../error.invalid-mutation-in-closure.js | 2 +- ...d-ref-prop-in-render-destructure.expect.md | 4 +- ...lid-read-ref-prop-in-render-destructure.js | 2 +- ...ssign-local-in-hook-return-value.expect.md | 4 +- ...lid-reassign-local-in-hook-return-value.js | 2 +- ...local-variable-in-async-callback.expect.md | 2 +- ...assign-local-variable-in-async-callback.js | 2 +- ...eassign-local-variable-in-effect.expect.md | 18 +- ...valid-reassign-local-variable-in-effect.js | 14 +- ...-local-variable-in-hook-argument.expect.md | 20 +- ...eassign-local-variable-in-hook-argument.js | 16 +- ...n-local-variable-in-jsx-callback.expect.md | 14 +- ...reassign-local-variable-in-jsx-callback.js | 10 +- ...n-callback-invoked-during-render.expect.md | 8 +- ...d-ref-in-callback-invoked-during-render.js | 4 +- ...ef-nested-property-during-render.expect.md | 4 +- ...-read-ref-nested-property-during-render.js | 2 +- ....invalid-sketchy-code-use-forget.expect.md | 4 +- .../error.invalid-sketchy-code-use-forget.js | 2 +- ...alid-unclosed-eslint-suppression.expect.md | 4 +- ...ror.invalid-unclosed-eslint-suppression.js | 2 +- ...f-added-to-dep-without-type-info.expect.md | 10 +- ...-use-ref-added-to-dep-without-type-info.js | 6 +- ...valid-useEffect-dep-not-memoized.expect.md | 2 +- ...rror.invalid-useEffect-dep-not-memoized.js | 2 +- ...InsertionEffect-dep-not-memoized.expect.md | 2 +- ...lid-useInsertionEffect-dep-not-memoized.js | 2 +- ...useLayoutEffect-dep-not-memoized.expect.md | 2 +- ...nvalid-useLayoutEffect-dep-not-memoized.js | 2 +- ...or.invalid-useMemo-callback-args.expect.md | 6 +- .../error.invalid-useMemo-callback-args.js | 2 +- ...rite-but-dont-read-ref-in-render.expect.md | 2 +- ...valid-write-but-dont-read-ref-in-render.js | 2 +- .../compiler/error.modify-state-2.expect.md | 6 +- .../fixtures/compiler/error.modify-state-2.js | 4 +- .../compiler/error.modify-state.expect.md | 2 +- .../fixtures/compiler/error.modify-state.js | 2 +- .../error.modify-useReducer-state.expect.md | 6 +- .../compiler/error.modify-useReducer-state.js | 4 +- ...r.mutate-captured-arg-separately.expect.md | 4 +- .../error.mutate-captured-arg-separately.js | 2 +- .../error.mutate-function-property.expect.md | 8 +- .../error.mutate-function-property.js | 4 +- ...or.not-useEffect-external-mutate.expect.md | 2 +- .../error.not-useEffect-external-mutate.js | 2 +- .../error.ref-like-name-not-Ref.expect.md | 4 +- .../compiler/error.ref-like-name-not-Ref.js | 4 +- .../error.ref-like-name-not-a-ref.expect.md | 4 +- .../compiler/error.ref-like-name-not-a-ref.js | 4 +- .../error.todo-for-await-loops.expect.md | 4 +- .../compiler/error.todo-for-await-loops.js | 2 +- ...p-with-context-variable-iterator.expect.md | 4 +- ...-in-loop-with-context-variable-iterator.js | 4 +- ...p-with-context-variable-iterator.expect.md | 4 +- ...-of-loop-with-context-variable-iterator.js | 4 +- .../compiler/error.todo-kitchensink.expect.md | 12 +- .../compiler/error.todo-kitchensink.js | 10 +- ...wer-property-load-into-temporary.expect.md | 2 +- ...alls-lower-property-load-into-temporary.js | 2 +- ...or.todo-new-target-meta-property.expect.md | 2 +- .../error.todo-new-target-meta-property.js | 2 +- ...after-construction-sequence-expr.expect.md | 4 +- ...during-after-construction-sequence-expr.js | 4 +- ...dified-during-after-construction.expect.md | 4 +- ...-key-modified-during-after-construction.js | 4 +- ...te-key-while-constructing-object.expect.md | 4 +- ...ey-mutate-key-while-constructing-object.js | 4 +- ...odo-object-expression-get-syntax.expect.md | 8 +- ...error.todo-object-expression-get-syntax.js | 6 +- ...odo-object-expression-set-syntax.expect.md | 4 +- ...error.todo-object-expression-set-syntax.js | 4 +- ...ional-call-chain-in-logical-expr.expect.md | 8 +- ...odo-optional-call-chain-in-logical-expr.ts | 6 +- ...-optional-call-chain-in-optional.expect.md | 10 +- ...or.todo-optional-call-chain-in-optional.ts | 6 +- ...o-optional-call-chain-in-ternary.expect.md | 8 +- ...ror.todo-optional-call-chain-in-ternary.ts | 6 +- .../error.todo-reassign-const.expect.md | 10 +- .../compiler/error.todo-reassign-const.js | 4 +- ...ack-captured-in-context-variable.expect.md | 16 +- ...-callback-captured-in-context-variable.tsx | 16 +- ...ia-function-preserve-memoization.expect.md | 12 +- ...later-via-function-preserve-memoization.js | 6 +- ...ified-later-preserve-memoization.expect.md | 12 +- ...ref-modified-later-preserve-memoization.js | 6 +- ...-state-in-render-with-loop-throw.expect.md | 2 +- ...nal-set-state-in-render-with-loop-throw.js | 2 +- ...ror.useMemo-non-literal-depslist.expect.md | 12 +- .../error.useMemo-non-literal-depslist.ts | 10 +- ...ffect-deps-invalidated-dep-value.expect.md | 4 +- ...oized-effect-deps-invalidated-dep-value.js | 4 +- ...alidate-mutate-ref-arg-in-render.expect.md | 2 +- ...error.validate-mutate-ref-arg-in-render.js | 2 +- ...alysis-destructured-rest-element.expect.md | 6 +- ...cape-analysis-destructured-rest-element.js | 6 +- .../escape-analysis-jsx-child.expect.md | 4 +- .../compiler/escape-analysis-jsx-child.js | 4 +- .../escape-analysis-logical.expect.md | 4 +- .../compiler/escape-analysis-logical.js | 4 +- ...nterleaved-allocating-dependency.expect.md | 4 +- ...aping-interleaved-allocating-dependency.js | 4 +- ...ved-allocating-nested-dependency.expect.md | 4 +- ...nterleaved-allocating-nested-dependency.js | 4 +- ...interleaved-primitive-dependency.expect.md | 4 +- ...caping-interleaved-primitive-dependency.js | 4 +- ...pe-analysis-not-conditional-test.expect.md | 4 +- .../escape-analysis-not-conditional-test.js | 4 +- .../escape-analysis-not-if-test.expect.md | 4 +- .../compiler/escape-analysis-not-if-test.js | 4 +- .../escape-analysis-not-switch-case.expect.md | 4 +- .../escape-analysis-not-switch-case.js | 4 +- .../escape-analysis-not-switch-test.expect.md | 4 +- .../escape-analysis-not-switch-test.js | 4 +- .../existing-variables-with-c-name.expect.md | 4 +- .../existing-variables-with-c-name.js | 4 +- ...pression-with-assignment-dynamic.expect.md | 4 +- .../expression-with-assignment-dynamic.js | 4 +- .../compiler/extend-scopes-if.expect.md | 4 +- .../fixtures/compiler/extend-scopes-if.js | 4 +- ...-dont-refresh-const-changes-prod.expect.md | 6 +- ...refresh-dont-refresh-const-changes-prod.js | 6 +- ...esh-refresh-on-const-changes-dev.expect.md | 10 +- ...st-refresh-refresh-on-const-changes-dev.js | 6 +- .../compiler/fast-refresh-reloading.expect.md | 8 +- .../compiler/fast-refresh-reloading.js | 4 +- ...rror.todo-fbt-unknown-enum-value.expect.md | 12 +- .../fbt/error.todo-fbt-unknown-enum-value.js | 8 +- .../error.todo-locally-require-fbt.expect.md | 8 +- .../fbt/error.todo-locally-require-fbt.js | 4 +- .../compiler/fbt/fbs-params.expect.md | 9 +- .../fixtures/compiler/fbt/fbs-params.js | 9 +- .../fbt-call-complex-param-value.expect.md | 10 +- .../fbt/fbt-call-complex-param-value.js | 10 +- .../fixtures/compiler/fbt/fbt-call.expect.md | 8 +- .../fixtures/compiler/fbt/fbt-call.js | 8 +- ...no-whitespace-btw-text-and-param.expect.md | 6 +- .../fbt-no-whitespace-btw-text-and-param.tsx | 6 +- ...bt-param-with-leading-whitespace.expect.md | 24 +- .../fbt/fbt-param-with-leading-whitespace.js | 24 +- .../fbt/fbt-param-with-newline.expect.md | 11 +- .../compiler/fbt/fbt-param-with-newline.js | 11 +- .../fbt/fbt-param-with-quotes.expect.md | 6 +- .../compiler/fbt/fbt-param-with-quotes.js | 6 +- ...t-param-with-trailing-whitespace.expect.md | 24 +- .../fbt/fbt-param-with-trailing-whitespace.js | 24 +- .../fbt/fbt-param-with-unicode.expect.md | 6 +- .../compiler/fbt/fbt-param-with-unicode.js | 6 +- .../fbt-params-complex-param-value.expect.md | 4 +- .../fbt/fbt-params-complex-param-value.js | 4 +- .../compiler/fbt/fbt-params.expect.md | 10 +- .../fixtures/compiler/fbt/fbt-params.js | 10 +- .../fbt/fbt-preserve-jsxtext.expect.md | 10 +- .../compiler/fbt/fbt-preserve-jsxtext.js | 10 +- .../fbt/fbt-preserve-whitespace.expect.md | 6 +- .../compiler/fbt/fbt-preserve-whitespace.tsx | 6 +- ...-single-space-btw-param-and-text.expect.md | 6 +- .../fbt-single-space-btw-param-and-text.tsx | 6 +- .../fbt-template-string-same-scope.expect.md | 10 +- .../fbt/fbt-template-string-same-scope.js | 10 +- .../compiler/fbt/fbt-to-string.expect.md | 6 +- .../fixtures/compiler/fbt/fbt-to-string.js | 6 +- ...bt-whitespace-around-param-value.expect.md | 6 +- .../fbt/fbt-whitespace-around-param-value.tsx | 6 +- .../fbt/fbt-whitespace-within-text.expect.md | 6 +- .../fbt/fbt-whitespace-within-text.tsx | 6 +- ...xt-must-use-expression-container.expect.md | 4 +- ...aram-text-must-use-expression-container.js | 4 +- ...btparam-with-jsx-element-content.expect.md | 4 +- .../fbt/fbtparam-with-jsx-element-content.js | 4 +- ...fbtparam-with-jsx-fragment-value.expect.md | 4 +- .../fbt/fbtparam-with-jsx-fragment-value.js | 4 +- .../compiler/fbt/lambda-with-fbt.expect.md | 8 +- .../fixtures/compiler/fbt/lambda-with-fbt.js | 8 +- .../flag-enable-emit-hook-guards.expect.md | 10 +- .../compiler/flag-enable-emit-hook-guards.ts | 10 +- ...tten-scopes-with-methodcall-hook.expect.md | 2 +- .../flatten-scopes-with-methodcall-hook.js | 2 +- .../for-empty-update-with-continue.expect.md | 4 +- .../for-empty-update-with-continue.js | 4 +- .../compiler/for-empty-update.expect.md | 4 +- .../fixtures/compiler/for-empty-update.js | 4 +- ...in-statement-body-always-returns.expect.md | 2 +- .../for-in-statement-body-always-returns.js | 2 +- .../compiler/for-in-statement-break.expect.md | 6 +- .../compiler/for-in-statement-break.js | 6 +- .../for-in-statement-continue.expect.md | 22 +- .../compiler/for-in-statement-continue.js | 22 +- .../for-in-statement-empty-body.expect.md | 2 +- .../compiler/for-in-statement-empty-body.js | 2 +- .../for-in-statement-type-inference.expect.md | 6 +- .../for-in-statement-type-inference.js | 6 +- .../compiler/for-in-statement.expect.md | 6 +- .../fixtures/compiler/for-in-statement.js | 6 +- .../fixtures/compiler/for-logical.expect.md | 4 +- .../fixtures/compiler/for-logical.js | 4 +- .../for-loop-let-undefined-decl.expect.md | 4 +- .../compiler/for-loop-let-undefined-decl.js | 4 +- ...oop-with-value-block-initializer.expect.md | 24 +- .../for-loop-with-value-block-initializer.js | 24 +- ...able-declarations-in-initializer.expect.md | 2 +- ...le-variable-declarations-in-initializer.js | 2 +- ...utate-later-value-initially-null.expect.md | 2 +- ...ction-mutate-later-value-initially-null.js | 2 +- ...of-local-collection-mutate-later.expect.md | 2 +- ...e-item-of-local-collection-mutate-later.js | 2 +- .../compiler/for-of-destructure.expect.md | 4 +- .../fixtures/compiler/for-of-destructure.js | 4 +- .../for-of-immutable-collection.expect.md | 10 +- .../compiler/for-of-immutable-collection.js | 10 +- ...iterator-of-immutable-collection.expect.md | 10 +- ...for-of-iterator-of-immutable-collection.js | 10 +- ...-mutate-item-of-local-collection.expect.md | 2 +- .../for-of-mutate-item-of-local-collection.js | 2 +- .../fixtures/compiler/for-of-mutate.expect.md | 2 +- .../fixtures/compiler/for-of-mutate.tsx | 2 +- ...onmutating-loop-local-collection.expect.md | 14 +- ...or-of-nonmutating-loop-local-collection.js | 14 +- .../fixtures/compiler/for-return.expect.md | 4 +- .../__tests__/fixtures/compiler/for-return.js | 4 +- .../for-with-assignment-as-update.expect.md | 2 +- .../compiler/for-with-assignment-as-update.js | 2 +- .../function-declaration-simple.expect.md | 6 +- .../compiler/function-declaration-simple.js | 6 +- .../function-expr-directive.expect.md | 6 +- .../compiler/function-expr-directive.js | 6 +- ...-captures-value-later-frozen-jsx.expect.md | 2 +- ...ression-captures-value-later-frozen-jsx.js | 2 +- ...pression-prototype-call-mutating.expect.md | 12 +- ...tion-expression-prototype-call-mutating.js | 12 +- ...nction-expression-prototype-call.expect.md | 2 +- .../function-expression-prototype-call.js | 2 +- ...unction-param-assignment-pattern.expect.md | 6 +- .../function-param-assignment-pattern.js | 6 +- .../functionexpr–conditional-access.expect.md | 2 +- .../functionexpr–conditional-access.js | 2 +- ...ng-preserves-function-properties.expect.md | 4 +- .../gating-preserves-function-properties.tsx | 4 +- ...ing-test-export-default-function.expect.md | 4 +- .../gating-test-export-default-function.js | 4 +- ...test-export-function-and-default.expect.md | 4 +- ...gating-test-export-function-and-default.js | 4 +- .../gating-test-export-function.expect.md | 4 +- .../compiler/gating-test-export-function.js | 4 +- .../fixtures/compiler/gating-test.expect.md | 4 +- .../fixtures/compiler/gating-test.js | 4 +- .../compiler/globals-Boolean.expect.md | 4 +- .../fixtures/compiler/globals-Boolean.js | 4 +- .../compiler/globals-Number.expect.md | 4 +- .../fixtures/compiler/globals-Number.js | 4 +- .../compiler/globals-String.expect.md | 4 +- .../fixtures/compiler/globals-String.js | 4 +- ...bals-dont-resolve-local-useState.expect.md | 8 +- .../globals-dont-resolve-local-useState.js | 8 +- .../hoisted-declaration-with-scope.expect.md | 10 +- .../hoisted-declaration-with-scope.tsx | 10 +- ...sting-computed-member-expression.expect.md | 8 +- .../hoisting-computed-member-expression.js | 8 +- .../hoisting-member-expression.expect.md | 4 +- .../compiler/hoisting-member-expression.js | 4 +- ...hoisting-nested-block-statements.expect.md | 2 +- .../hoisting-nested-block-statements.js | 2 +- ...ing-recursive-call-within-lambda.expect.md | 4 +- .../hoisting-recursive-call-within-lambda.js | 4 +- .../hoisting-recursive-call.expect.md | 4 +- .../compiler/hoisting-recursive-call.ts | 4 +- .../compiler/holey-array-expr.expect.md | 4 +- .../fixtures/compiler/holey-array-expr.js | 4 +- .../holey-array-pattern-dce-2.expect.md | 4 +- .../compiler/holey-array-pattern-dce-2.js | 4 +- .../holey-array-pattern-dce.expect.md | 4 +- .../compiler/holey-array-pattern-dce.js | 4 +- .../fixtures/compiler/holey-array.expect.md | 4 +- .../fixtures/compiler/holey-array.js | 4 +- .../fixtures/compiler/hook-noAlias.expect.md | 6 +- .../fixtures/compiler/hook-noAlias.js | 6 +- .../compiler/hooks-with-prefix.expect.md | 6 +- .../fixtures/compiler/hooks-with-prefix.js | 6 +- .../compiler/ignore-use-no-forget.expect.md | 4 +- .../fixtures/compiler/ignore-use-no-forget.js | 4 +- .../iife-return-modified-later-phi.expect.md | 2 +- .../iife-return-modified-later-phi.js | 2 +- .../iife-return-modified-later.expect.md | 2 +- .../compiler/iife-return-modified-later.js | 2 +- ...rtent-mutability-readonly-lambda.expect.md | 2 +- .../inadvertent-mutability-readonly-lambda.js | 2 +- ...incompatible-destructuring-kinds.expect.md | 8 +- .../incompatible-destructuring-kinds.js | 8 +- ...endently-memoize-object-property.expect.md | 6 +- .../independently-memoize-object-property.js | 6 +- ...mpile-hooks-with-multiple-params.expect.md | 2 +- ...nfer-compile-hooks-with-multiple-params.js | 2 +- .../infer-function-React-memo.expect.md | 2 +- .../compiler/infer-function-React-memo.js | 2 +- .../infer-function-assignment.expect.md | 2 +- .../compiler/infer-function-assignment.js | 2 +- ...ion-expression-React-memo-gating.expect.md | 2 +- ...r-function-expression-React-memo-gating.js | 2 +- .../infer-function-forwardRef.expect.md | 2 +- .../compiler/infer-function-forwardRef.js | 2 +- .../compiler/infer-global-object.expect.md | 6 +- .../fixtures/compiler/infer-global-object.js | 6 +- .../infer-no-component-annot.expect.md | 2 +- .../compiler/infer-no-component-annot.ts | 2 +- .../infer-no-component-obj-return.expect.md | 2 +- .../compiler/infer-no-component-obj-return.js | 2 +- .../compiler/inverted-if-else.expect.md | 4 +- .../fixtures/compiler/inverted-if-else.js | 4 +- .../fixtures/compiler/inverted-if.expect.md | 4 +- .../fixtures/compiler/inverted-if.js | 4 +- .../fixtures/compiler/issue852.expect.md | 2 +- .../__tests__/fixtures/compiler/issue852.js | 2 +- ...ue933-disjoint-set-infinite-loop.expect.md | 4 +- .../issue933-disjoint-set-infinite-loop.js | 4 +- .../jsx-attribute-default-to-true.expect.md | 2 +- .../jsx-attribute-default-to-true.tsx | 2 +- ...attribute-with-jsx-element-value.expect.md | 15 +- .../jsx-attribute-with-jsx-element-value.js | 15 +- .../compiler/jsx-empty-expression.expect.md | 2 +- .../fixtures/compiler/jsx-empty-expression.js | 2 +- .../fixtures/compiler/jsx-fragment.expect.md | 6 +- .../fixtures/compiler/jsx-fragment.js | 6 +- .../fixtures/compiler/jsx-freeze.expect.md | 8 +- .../__tests__/fixtures/compiler/jsx-freeze.js | 8 +- ...local-memberexpr-tag-conditional.expect.md | 6 +- .../jsx-local-memberexpr-tag-conditional.js | 6 +- .../jsx-local-memberexpr-tag.expect.md | 2 +- .../compiler/jsx-local-memberexpr-tag.js | 2 +- .../jsx-local-tag-in-lambda.expect.md | 2 +- .../compiler/jsx-local-tag-in-lambda.js | 2 +- .../jsx-memberexpr-tag-in-lambda.expect.md | 2 +- .../compiler/jsx-memberexpr-tag-in-lambda.js | 2 +- .../compiler/jsx-namespaced-name.expect.md | 4 +- .../fixtures/compiler/jsx-namespaced-name.js | 4 +- .../jsx-preserve-whitespace.expect.md | 2 +- .../compiler/jsx-preserve-whitespace.tsx | 2 +- ...ctive-local-variable-member-expr.expect.md | 11 +- ...sx-reactive-local-variable-member-expr.tsx | 10 +- .../fixtures/compiler/jsx-spread.expect.md | 2 +- .../__tests__/fixtures/compiler/jsx-spread.js | 2 +- ...g-attribute-expression-container.expect.md | 14 +- ...x-string-attribute-expression-container.js | 14 +- .../jsx-string-attribute-non-ascii.expect.md | 2 +- .../jsx-string-attribute-non-ascii.js | 2 +- ...-tag-evaluation-order-non-global.expect.md | 4 +- .../jsx-tag-evaluation-order-non-global.js | 4 +- .../jsx-tag-evaluation-order.expect.md | 6 +- .../compiler/jsx-tag-evaluation-order.tsx | 6 +- .../jsx-ternary-local-variable.expect.md | 6 +- .../compiler/jsx-ternary-local-variable.tsx | 6 +- ...abeled-break-within-label-switch.expect.md | 2 +- .../labeled-break-within-label-switch.ts | 2 +- ...rray-access-member-expr-captured.expect.md | 4 +- ...ambda-array-access-member-expr-captured.ts | 4 +- ...a-array-access-member-expr-param.expect.md | 4 +- .../lambda-array-access-member-expr-param.ts | 4 +- .../lambda-capture-returned-alias.expect.md | 2 +- .../compiler/lambda-capture-returned-alias.js | 2 +- ...mutated-non-reactive-to-reactive.expect.md | 6 +- ...lambda-mutated-non-reactive-to-reactive.js | 6 +- .../lambda-mutated-ref-non-reactive.expect.md | 4 +- .../lambda-mutated-ref-non-reactive.js | 4 +- .../lambda-return-expression.expect.md | 2 +- .../compiler/lambda-return-expression.ts | 2 +- .../compiler/log-pruned-memoization.expect.md | 8 +- .../compiler/log-pruned-memoization.js | 4 +- .../logical-expression-object.expect.md | 6 +- .../compiler/logical-expression-object.js | 6 +- .../compiler/logical-expression.expect.md | 4 +- .../fixtures/compiler/logical-expression.js | 4 +- .../maybe-mutate-object-in-callback.expect.md | 6 +- .../maybe-mutate-object-in-callback.js | 6 +- ...s-dont-merge-with-different-deps.expect.md | 6 +- ...e-scopes-dont-merge-with-different-deps.js | 6 +- .../compiler/memoization-comments.expect.md | 4 +- .../fixtures/compiler/memoization-comments.js | 4 +- .../merge-consecutive-nested-scopes.expect.md | 6 +- .../merge-consecutive-nested-scopes.js | 6 +- ...tive-scopes-deps-subset-of-decls.expect.md | 2 +- ...consecutive-scopes-deps-subset-of-decls.js | 2 +- ...merge-consecutive-scopes-no-deps.expect.md | 4 +- .../merge-consecutive-scopes-no-deps.js | 4 +- ...merge-consecutive-scopes-objects.expect.md | 14 +- .../merge-consecutive-scopes-objects.js | 14 +- ...ge-consecutive-scopes-reordering.expect.md | 6 +- .../merge-consecutive-scopes-reordering.js | 6 +- .../merge-consecutive-scopes.expect.md | 6 +- .../compiler/merge-consecutive-scopes.js | 6 +- ...e-nested-scopes-with-same-inputs.expect.md | 4 +- .../merge-nested-scopes-with-same-inputs.js | 4 +- .../compiler/merge-scopes-callback.expect.md | 4 +- .../compiler/merge-scopes-callback.js | 4 +- ...ged-scopes-are-valid-effect-deps.expect.md | 4 +- .../merged-scopes-are-valid-effect-deps.js | 4 +- .../repro-cx-assigned-to-temporary.expect.md | 10 +- .../repro-cx-assigned-to-temporary.js | 10 +- ...-namespace-assigned-to-temporary.expect.md | 10 +- ...epro-cx-namespace-assigned-to-temporary.js | 10 +- .../repro-cx-namespace-nesting.expect.md | 8 +- .../meta-isms/repro-cx-namespace-nesting.js | 8 +- .../fixtures/compiler/method-call.expect.md | 4 +- .../fixtures/compiler/method-call.js | 4 +- .../compiler/module-scoped-bindings.expect.md | 4 +- .../compiler/module-scoped-bindings.js | 4 +- ...-expr-export-default-gating-test.expect.md | 2 +- ...i-arrow-expr-export-default-gating-test.js | 2 +- ...ti-arrow-expr-export-gating-test.expect.md | 2 +- .../multi-arrow-expr-export-gating-test.js | 2 +- .../multi-arrow-expr-gating-test.expect.md | 2 +- .../compiler/multi-arrow-expr-gating-test.js | 2 +- .../compiler/multi-directive.expect.md | 4 +- .../fixtures/compiler/multi-directive.js | 4 +- ...ted-callback-from-other-callback.expect.md | 4 +- ...to-hoisted-callback-from-other-callback.js | 4 +- .../compiler/mutable-lifetime-loops.expect.md | 6 +- .../compiler/mutable-lifetime-loops.js | 6 +- .../mutable-lifetime-with-aliasing.expect.md | 4 +- .../mutable-lifetime-with-aliasing.js | 4 +- ...e-outer-scope-within-value-block.expect.md | 8 +- .../mutate-outer-scope-within-value-block.ts | 8 +- ...mutation-during-jsx-construction.expect.md | 4 +- .../mutation-during-jsx-construction.js | 4 +- ...-within-capture-and-mutablerange.expect.md | 8 +- ...tation-within-capture-and-mutablerange.tsx | 8 +- .../mutation-within-jsx-and-break.expect.md | 10 +- .../mutation-within-jsx-and-break.tsx | 10 +- .../compiler/mutation-within-jsx.expect.md | 10 +- .../fixtures/compiler/mutation-within-jsx.tsx | 10 +- ...ed-function-shadowed-identifiers.expect.md | 8 +- .../nested-function-shadowed-identifiers.js | 8 +- ...opes-begin-same-instr-valueblock.expect.md | 15 +- ...sted-scopes-begin-same-instr-valueblock.ts | 15 +- .../new-does-not-mutate-class.expect.md | 6 +- .../compiler/new-does-not-mutate-class.ts | 6 +- .../noAlias-filter-on-array-prop.expect.md | 14 +- .../compiler/noAlias-filter-on-array-prop.js | 14 +- .../compiler/non-null-assertion.expect.md | 2 +- .../fixtures/compiler/non-null-assertion.ts | 2 +- ...pture-in-unsplittable-memo-block.expect.md | 14 +- ...ting-capture-in-unsplittable-memo-block.ts | 14 +- ...al-load-from-optional-memberexpr.expect.md | 4 +- ...noptional-load-from-optional-memberexpr.js | 4 +- ...-can-inline-into-consuming-scope.expect.md | 5 +- ...endency-can-inline-into-consuming-scope.js | 5 +- .../obj-literal-cached-in-if-else.expect.md | 4 +- .../compiler/obj-literal-cached-in-if-else.js | 4 +- ...bj-literal-mutated-after-if-else.expect.md | 4 +- .../obj-literal-mutated-after-if-else.js | 4 +- ...bject-computed-access-assignment.expect.md | 6 +- .../object-computed-access-assignment.js | 6 +- ...ion-computed-key-constant-number.expect.md | 4 +- ...expression-computed-key-constant-number.js | 4 +- ...ion-computed-key-constant-string.expect.md | 6 +- ...expression-computed-key-constant-string.js | 6 +- ...ession-computed-key-non-reactive.expect.md | 4 +- ...ct-expression-computed-key-non-reactive.js | 4 +- ...omputed-key-object-mutated-later.expect.md | 4 +- ...ssion-computed-key-object-mutated-later.js | 4 +- .../object-expression-computed-key.expect.md | 6 +- .../object-expression-computed-key.js | 6 +- ...ct-expression-string-literal-key.expect.md | 6 +- .../object-expression-string-literal-key.js | 6 +- ...eral-method-call-in-ternary-test.expect.md | 6 +- ...ect-literal-method-call-in-ternary-test.js | 6 +- ...od-derived-in-ternary-consequent.expect.md | 6 +- ...al-method-derived-in-ternary-consequent.js | 6 +- ...ral-method-in-ternary-consequent.expect.md | 6 +- ...ct-literal-method-in-ternary-consequent.js | 6 +- ...t-literal-method-in-ternary-test.expect.md | 10 +- .../object-literal-method-in-ternary-test.js | 10 +- .../object-literal-spread-element.expect.md | 6 +- .../compiler/object-literal-spread-element.js | 6 +- .../object-method-maybe-alias.expect.md | 6 +- .../compiler/object-method-maybe-alias.js | 6 +- .../object-method-shorthand-3.expect.md | 6 +- .../compiler/object-method-shorthand-3.js | 6 +- ...d-shorthand-aliased-mutate-after.expect.md | 8 +- ...t-method-shorthand-aliased-mutate-after.js | 8 +- ...t-method-shorthand-derived-value.expect.md | 8 +- .../object-method-shorthand-derived-value.js | 8 +- ...object-method-shorthand-hook-dep.expect.md | 4 +- .../object-method-shorthand-hook-dep.js | 4 +- ...t-method-shorthand-mutated-after.expect.md | 8 +- .../object-method-shorthand-mutated-after.js | 8 +- .../object-method-shorthand.expect.md | 2 +- .../compiler/object-method-shorthand.js | 2 +- ...consequent-alternate-both-return.expect.md | 4 +- ...ted-in-consequent-alternate-both-return.js | 4 +- .../compiler/object-pattern-params.expect.md | 12 +- .../compiler/object-pattern-params.js | 12 +- .../compiler/object-properties.expect.md | 2 +- .../fixtures/compiler/object-properties.js | 2 +- .../object-shorthand-method-1.expect.md | 6 +- .../compiler/object-shorthand-method-1.js | 6 +- .../object-shorthand-method-2.expect.md | 8 +- .../compiler/object-shorthand-method-2.js | 8 +- .../object-shorthand-method-nested.expect.md | 8 +- .../object-shorthand-method-nested.js | 8 +- ...n-enable-change-variable-codegen.expect.md | 2 +- .../option-enable-change-variable-codegen.js | 2 +- .../compiler/optional-call-logical.expect.md | 2 +- .../compiler/optional-call-logical.js | 2 +- ...optional-member-expression-chain.expect.md | 6 +- .../optional-member-expression-chain.js | 6 +- ...cal-expression-instruction-scope.expect.md | 4 +- ...ng-logical-expression-instruction-scope.ts | 4 +- ...g-hoisted-declaration-with-scope.expect.md | 10 +- .../bug-hoisted-declaration-with-scope.tsx | 10 +- ...pture-in-unsplittable-memo-block.expect.md | 14 +- ...ting-capture-in-unsplittable-memo-block.ts | 14 +- .../capture-ref-for-later-mutation.expect.md | 12 +- .../capture-ref-for-later-mutation.tsx | 12 +- ...ithin-nested-valueblock-in-array.expect.md | 10 +- ...opes-within-nested-valueblock-in-array.tsx | 10 +- ...e-outer-scope-within-value-block.expect.md | 8 +- .../mutate-outer-scope-within-value-block.ts | 8 +- ...-within-capture-and-mutablerange.expect.md | 8 +- ...tation-within-capture-and-mutablerange.tsx | 8 +- .../mutation-within-jsx-and-break.expect.md | 10 +- .../mutation-within-jsx-and-break.tsx | 10 +- .../mutation-within-jsx.expect.md | 10 +- .../mutation-within-jsx.tsx | 10 +- ...g-ternary-test-instruction-scope.expect.md | 6 +- ...locating-ternary-test-instruction-scope.ts | 6 +- .../outlined-destructured-params.expect.md | 6 +- .../compiler/outlined-destructured-params.js | 6 +- .../compiler/outlined-helper.expect.md | 6 +- .../fixtures/compiler/outlined-helper.js | 6 +- ...g-scopes-interleaved-by-terminal.expect.md | 4 +- ...rlapping-scopes-interleaved-by-terminal.js | 4 +- .../overlapping-scopes-interleaved.expect.md | 4 +- .../overlapping-scopes-interleaved.js | 4 +- .../overlapping-scopes-shadowed.expect.md | 4 +- .../compiler/overlapping-scopes-shadowed.js | 4 +- ...ng-scopes-shadowing-within-block.expect.md | 4 +- ...erlapping-scopes-shadowing-within-block.js | 4 +- .../overlapping-scopes-while.expect.md | 4 +- .../compiler/overlapping-scopes-while.js | 4 +- .../overlapping-scopes-within-block.expect.md | 4 +- .../overlapping-scopes-within-block.js | 4 +- ...rly-return-within-reactive-scope.expect.md | 2 +- ...tial-early-return-within-reactive-scope.js | 2 +- .../compiler/phi-reference-effects.expect.md | 6 +- .../compiler/phi-reference-effects.ts | 6 +- .../phi-type-inference-array-push.expect.md | 8 +- .../compiler/phi-type-inference-array-push.js | 8 +- ...hi-type-inference-property-store.expect.md | 4 +- .../phi-type-inference-property-store.js | 4 +- ...sxtext-stringliteral-distinction.expect.md | 2 +- ...serve-jsxtext-stringliteral-distinction.js | 2 +- ...sitive-useMemo-infer-mutate-deps.expect.md | 4 +- ...alse-positive-useMemo-infer-mutate-deps.ts | 4 +- ...back-captures-reassigned-context.expect.md | 4 +- ...useCallback-captures-reassigned-context.ts | 4 +- ...nvalid-useCallback-read-maybeRef.expect.md | 2 +- ...maybe-invalid-useCallback-read-maybeRef.ts | 2 +- ...be-invalid-useMemo-read-maybeRef.expect.md | 2 +- ...ror.maybe-invalid-useMemo-read-maybeRef.ts | 2 +- ...back-captures-invalidating-value.expect.md | 2 +- ...useCallback-captures-invalidating-value.ts | 2 +- ...lback-conditional-access-noAlloc.expect.md | 8 +- ....useCallback-conditional-access-noAlloc.ts | 6 +- ...less-specific-conditional-access.expect.md | 8 +- ...-infer-less-specific-conditional-access.ts | 6 +- ...or.useCallback-property-call-dep.expect.md | 6 +- .../error.useCallback-property-call-dep.ts | 4 +- ...error.useMemo-dep-not-recognized.expect.md | 6 +- .../error.useMemo-dep-not-recognized.ts | 6 +- ...less-specific-conditional-access.expect.md | 8 +- ...-infer-less-specific-conditional-access.ts | 6 +- ...specific-conditional-value-block.expect.md | 8 +- ...r-less-specific-conditional-value-block.ts | 6 +- ...emo-property-call-chained-object.expect.md | 6 +- ...or.useMemo-property-call-chained-object.ts | 4 +- .../error.useMemo-property-call-dep.expect.md | 6 +- .../error.useMemo-property-call-dep.ts | 4 +- ...o-unrelated-mutation-in-depslist.expect.md | 2 +- ....useMemo-unrelated-mutation-in-depslist.ts | 2 +- ...-useMemo-no-memoblock-sideeffect.expect.md | 6 +- ...invalid-useMemo-no-memoblock-sideeffect.ts | 6 +- ...-constant-prop-decls-get-removed.expect.md | 2 +- ...-ensure-constant-prop-decls-get-removed.ts | 2 +- ...Callback-alias-property-load-dep.expect.md | 8 +- .../useCallback-alias-property-load-dep.ts | 8 +- ...ures-reassigned-context-property.expect.md | 8 +- ...k-captures-reassigned-context-property.tsx | 8 +- ...back-captures-reassigned-context.expect.md | 4 +- ...useCallback-captures-reassigned-context.ts | 4 +- ...ack-conditional-access-own-scope.expect.md | 6 +- ...seCallback-conditional-access-own-scope.ts | 6 +- ...Callback-in-other-reactive-block.expect.md | 6 +- .../useCallback-in-other-reactive-block.ts | 6 +- ...ck-infer-conditional-value-block.expect.md | 6 +- ...eCallback-infer-conditional-value-block.ts | 6 +- .../useCallback-infer-fewer-deps.expect.md | 2 +- .../useCallback-infer-fewer-deps.ts | 2 +- .../useCallback-infer-more-specific.expect.md | 4 +- .../useCallback-infer-more-specific.ts | 4 +- .../useCallback-infer-read-dep.expect.md | 4 +- .../useCallback-infer-read-dep.ts | 4 +- .../useCallback-infer-scope-global.expect.md | 4 +- .../useCallback-infer-scope-global.ts | 4 +- ...invoked-callback-escaping-return.expect.md | 6 +- ...caping-invoked-callback-escaping-return.js | 6 +- .../useCallback-nonescaping.expect.md | 6 +- .../useCallback-nonescaping.js | 6 +- ...k-reordering-deplist-controlflow.expect.md | 14 +- ...allback-reordering-deplist-controlflow.tsx | 14 +- ...k-reordering-depslist-assignment.expect.md | 6 +- ...allback-reordering-depslist-assignment.tsx | 6 +- .../useCallback-with-no-depslist.expect.md | 6 +- .../useCallback-with-no-depslist.ts | 6 +- .../useMemo-alias-property-load-dep.expect.md | 8 +- .../useMemo-alias-property-load-dep.ts | 8 +- ...useMemo-conditional-access-alloc.expect.md | 8 +- .../useMemo-conditional-access-alloc.ts | 8 +- ...eMemo-conditional-access-noAlloc.expect.md | 6 +- .../useMemo-conditional-access-noAlloc.ts | 6 +- ...emo-conditional-access-own-scope.expect.md | 6 +- .../useMemo-conditional-access-own-scope.ts | 6 +- .../useMemo-constant-prop.expect.md | 4 +- .../useMemo-constant-prop.ts | 4 +- ...ropped-infer-always-invalidating.expect.md | 4 +- ...eMemo-dropped-infer-always-invalidating.ts | 4 +- .../useMemo-in-other-reactive-block.expect.md | 6 +- .../useMemo-in-other-reactive-block.ts | 6 +- .../useMemo-infer-fewer-deps.expect.md | 2 +- .../useMemo-infer-fewer-deps.ts | 2 +- .../useMemo-infer-more-specific.expect.md | 4 +- .../useMemo-infer-more-specific.ts | 4 +- .../useMemo-infer-nonallocating.expect.md | 2 +- .../useMemo-infer-nonallocating.ts | 2 +- .../useMemo-infer-scope-global.expect.md | 4 +- .../useMemo-infer-scope-global.ts | 4 +- .../useMemo-inner-decl.expect.md | 8 +- .../useMemo-inner-decl.ts | 8 +- .../useMemo-invoke-prop.expect.md | 6 +- .../useMemo-invoke-prop.ts | 6 +- ...o-reordering-depslist-assignment.expect.md | 4 +- .../useMemo-reordering-depslist-assignment.ts | 4 +- ...-reordering-depslist-controlflow.expect.md | 14 +- ...seMemo-reordering-depslist-controlflow.tsx | 14 +- .../useMemo-with-no-depslist.expect.md | 6 +- .../useMemo-with-no-depslist.ts | 6 +- .../compiler/primitive-alias-mutate.expect.md | 6 +- .../compiler/primitive-alias-mutate.js | 6 +- .../primitive-as-dep-nested-scope.expect.md | 12 +- .../compiler/primitive-as-dep-nested-scope.js | 12 +- ...signed-loop-force-scopes-enabled.expect.md | 12 +- ...ve-reassigned-loop-force-scopes-enabled.js | 12 +- .../prop-capturing-function-1.expect.md | 6 +- .../compiler/prop-capturing-function-1.js | 6 +- .../property-call-evaluation-order.expect.md | 8 +- .../property-call-evaluation-order.js | 8 +- ...opes-whose-deps-invalidate-array.expect.md | 4 +- ...rune-scopes-whose-deps-invalidate-array.js | 4 +- ...scopes-whose-deps-invalidate-jsx.expect.md | 4 +- .../prune-scopes-whose-deps-invalidate-jsx.js | 4 +- ...scopes-whose-deps-invalidate-new.expect.md | 8 +- .../prune-scopes-whose-deps-invalidate-new.js | 8 +- ...pes-whose-deps-invalidate-object.expect.md | 8 +- ...une-scopes-whose-deps-invalidate-object.js | 8 +- ...-whose-deps-may-invalidate-array.expect.md | 4 +- ...-scopes-whose-deps-may-invalidate-array.js | 4 +- .../compiler/react-namespace.expect.md | 4 +- .../fixtures/compiler/react-namespace.js | 4 +- ...rol-dependency-do-while-indirect.expect.md | 16 +- ...ve-control-dependency-do-while-indirect.js | 16 +- ...control-dependency-do-while-test.expect.md | 16 +- ...active-control-dependency-do-while-test.js | 16 +- ...tive-control-dependency-for-init.expect.md | 16 +- .../reactive-control-dependency-for-init.js | 16 +- ...tive-control-dependency-for-test.expect.md | 16 +- .../reactive-control-dependency-for-test.js | 16 +- ...ve-control-dependency-for-update.expect.md | 16 +- .../reactive-control-dependency-for-update.js | 16 +- ...trol-dependency-forin-collection.expect.md | 16 +- ...ive-control-dependency-forin-collection.js | 16 +- ...trol-dependency-forof-collection.expect.md | 16 +- ...ive-control-dependency-forof-collection.js | 16 +- ...-interleaved-reactivity-do-while.expect.md | 2 +- ...cy-from-interleaved-reactivity-do-while.js | 2 +- ...om-interleaved-reactivity-for-in.expect.md | 4 +- ...ency-from-interleaved-reactivity-for-in.js | 4 +- ...-interleaved-reactivity-for-init.expect.md | 2 +- ...cy-from-interleaved-reactivity-for-init.js | 2 +- ...om-interleaved-reactivity-for-of.expect.md | 2 +- ...ency-from-interleaved-reactivity-for-of.js | 2 +- ...-interleaved-reactivity-for-test.expect.md | 2 +- ...cy-from-interleaved-reactivity-for-test.js | 2 +- ...nterleaved-reactivity-for-update.expect.md | 2 +- ...-from-interleaved-reactivity-for-update.js | 2 +- ...y-from-interleaved-reactivity-if.expect.md | 2 +- ...pendency-from-interleaved-reactivity-if.js | 2 +- ...om-interleaved-reactivity-switch.expect.md | 2 +- ...ency-from-interleaved-reactivity-switch.js | 2 +- ...rom-interleaved-reactivity-while.expect.md | 2 +- ...dency-from-interleaved-reactivity-while.js | 2 +- .../reactive-control-dependency-if.expect.md | 16 +- .../reactive-control-dependency-if.js | 16 +- ...l-dependency-on-context-variable.expect.md | 18 +- ...-control-dependency-on-context-variable.js | 18 +- ...rol-dependency-phi-setState-type.expect.md | 30 +- ...ve-control-dependency-phi-setState-type.js | 30 +- ...pendency-reactive-after-fixpoint.expect.md | 16 +- ...trol-dependency-reactive-after-fixpoint.js | 16 +- ...trol-dependency-switch-case-test.expect.md | 16 +- ...ive-control-dependency-switch-case-test.js | 16 +- ...trol-dependency-switch-condition.expect.md | 18 +- ...ive-control-dependency-switch-condition.js | 18 +- ...ntrol-dependency-via-mutation-if.expect.md | 16 +- ...tive-control-dependency-via-mutation-if.js | 16 +- ...l-dependency-via-mutation-switch.expect.md | 16 +- ...-control-dependency-via-mutation-switch.js | 16 +- ...ve-control-dependency-while-test.expect.md | 16 +- .../reactive-control-dependency-while-test.js | 16 +- .../reactive-dependency-fixpoint.expect.md | 2 +- .../compiler/reactive-dependency-fixpoint.js | 2 +- ...nreactive-captured-with-reactive.expect.md | 2 +- ...ency-nonreactive-captured-with-reactive.js | 2 +- ...t-captured-with-reactive-mutated.expect.md | 4 +- ...y-object-captured-with-reactive-mutated.js | 4 +- .../compiler/reactive-scopes-if.expect.md | 4 +- .../fixtures/compiler/reactive-scopes-if.js | 4 +- .../compiler/reactive-scopes.expect.md | 4 +- .../fixtures/compiler/reactive-scopes.js | 4 +- ...-analysis-interleaved-reactivity.expect.md | 4 +- ...ctivity-analysis-interleaved-reactivity.js | 4 +- ...ve-via-mutation-of-computed-load.expect.md | 2 +- ...-reactive-via-mutation-of-computed-load.js | 2 +- ...ve-via-mutation-of-property-load.expect.md | 2 +- ...-reactive-via-mutation-of-property-load.js | 2 +- ...ivity-via-aliased-mutation-array.expect.md | 16 +- .../reactivity-via-aliased-mutation-array.js | 16 +- ...vity-via-aliased-mutation-lambda.expect.md | 18 +- .../reactivity-via-aliased-mutation-lambda.js | 18 +- ...d-mutation-through-property-load.expect.md | 16 +- ...-aliased-mutation-through-property-load.js | 16 +- ...-readonly-alias-of-mutable-value.expect.md | 16 +- ...ity-via-readonly-alias-of-mutable-value.js | 16 +- ...ject-method-calls-mutable-lambda.expect.md | 2 +- ...only-object-method-calls-mutable-lambda.js | 2 +- .../readonly-object-method-calls.expect.md | 2 +- .../compiler/readonly-object-method-calls.js | 2 +- ...reassign-in-while-loop-condition.expect.md | 2 +- .../reassign-in-while-loop-condition.js | 2 +- .../reassignment-separate-scopes.expect.md | 4 +- .../compiler/reassignment-separate-scopes.js | 4 +- ...eactive-cond-deps-break-in-scope.expect.md | 8 +- ...educe-reactive-cond-deps-break-in-scope.ts | 8 +- ...-cond-deps-cfg-nested-testifelse.expect.md | 12 +- ...eactive-cond-deps-cfg-nested-testifelse.ts | 12 +- ...active-cond-deps-return-in-scope.expect.md | 8 +- ...duce-reactive-cond-deps-return-in-scope.ts | 8 +- .../cfg-condexpr.expect.md | 4 +- .../reduce-reactive-deps/cfg-condexpr.js | 4 +- .../reduce-reactive-deps/cfg-ifelse.expect.md | 4 +- .../reduce-reactive-deps/cfg-ifelse.js | 4 +- .../cfg-nested-ifelse-missing.expect.md | 4 +- .../cfg-nested-ifelse-missing.js | 4 +- .../cfg-nested-ifelse.expect.md | 4 +- .../reduce-reactive-deps/cfg-nested-ifelse.js | 4 +- .../cfg-switch-exhaustive.expect.md | 4 +- .../cfg-switch-exhaustive.js | 4 +- .../cfg-switch-missing-case.expect.md | 4 +- .../cfg-switch-missing-case.js | 4 +- .../cfg-switch-missing-default.expect.md | 4 +- .../cfg-switch-missing-default.js | 4 +- .../reduce-reactive-deps/cond-scope.expect.md | 2 +- .../reduce-reactive-deps/cond-scope.js | 2 +- .../conditional-member-expr.expect.md | 2 +- .../conditional-member-expr.js | 2 +- .../join-uncond-scopes-cond-deps.expect.md | 4 +- .../join-uncond-scopes-cond-deps.js | 4 +- .../jump-poisoned/break-in-scope.expect.md | 14 +- .../jump-poisoned/break-in-scope.ts | 14 +- .../break-poisons-outer-scope.expect.md | 20 +- .../break-poisons-outer-scope.ts | 20 +- .../loop-break-in-scope.expect.md | 14 +- .../jump-poisoned/loop-break-in-scope.ts | 14 +- ...e-if-nonexhaustive-poisoned-deps.expect.md | 18 +- .../reduce-if-nonexhaustive-poisoned-deps.ts | 18 +- ...-if-nonexhaustive-poisoned-deps1.expect.md | 16 +- .../reduce-if-nonexhaustive-poisoned-deps1.ts | 16 +- .../jump-poisoned/return-in-scope.expect.md | 14 +- .../jump-poisoned/return-in-scope.ts | 14 +- .../return-poisons-outer-scope.expect.md | 20 +- .../return-poisons-outer-scope.ts | 20 +- .../else-branch-scope-unpoisoned.expect.md | 20 +- .../else-branch-scope-unpoisoned.ts | 20 +- .../jump-target-within-scope-label.expect.md | 18 +- .../jump-target-within-scope-label.ts | 18 +- ...p-target-within-scope-loop-break.expect.md | 16 +- .../jump-target-within-scope-loop-break.ts | 16 +- ...e-if-exhaustive-nonpoisoned-deps.expect.md | 6 +- .../reduce-if-exhaustive-nonpoisoned-deps.ts | 6 +- ...-if-exhaustive-nonpoisoned-deps1.expect.md | 16 +- .../reduce-if-exhaustive-nonpoisoned-deps1.ts | 16 +- .../return-before-scope-starts.expect.md | 22 +- .../return-before-scope-starts.ts | 22 +- .../throw-before-scope-starts.expect.md | 22 +- .../throw-before-scope-starts.ts | 22 +- .../memberexpr-join-optional-chain.expect.md | 2 +- .../memberexpr-join-optional-chain.ts | 2 +- .../memberexpr-join-optional-chain2.expect.md | 2 +- .../memberexpr-join-optional-chain2.ts | 2 +- .../reduce-reactive-deps/no-uncond.expect.md | 18 +- .../reduce-reactive-deps/no-uncond.js | 18 +- .../promote-uncond.expect.md | 4 +- .../reduce-reactive-deps/promote-uncond.js | 4 +- ...duce-if-exhaustive-poisoned-deps.expect.md | 6 +- .../reduce-if-exhaustive-poisoned-deps.ts | 6 +- .../subpath-order1.expect.md | 4 +- .../reduce-reactive-deps/subpath-order1.js | 4 +- .../subpath-order2.expect.md | 4 +- .../reduce-reactive-deps/subpath-order2.js | 4 +- .../superpath-order1.expect.md | 18 +- .../reduce-reactive-deps/superpath-order1.js | 18 +- .../superpath-order2.expect.md | 18 +- .../reduce-reactive-deps/superpath-order2.js | 18 +- .../uncond-nonoverlap-descendant.expect.md | 2 +- .../uncond-nonoverlap-descendant.js | 2 +- .../uncond-nonoverlap-direct.expect.md | 2 +- .../uncond-nonoverlap-direct.js | 2 +- .../uncond-overlap-descendant.expect.md | 2 +- .../uncond-overlap-descendant.js | 2 +- .../uncond-overlap-direct.expect.md | 2 +- .../uncond-overlap-direct.js | 2 +- .../uncond-subpath-order1.expect.md | 2 +- .../uncond-subpath-order1.js | 2 +- .../uncond-subpath-order2.expect.md | 2 +- .../uncond-subpath-order2.js | 2 +- .../uncond-subpath-order3.expect.md | 2 +- .../uncond-subpath-order3.js | 2 +- ...rrent-aliased-not-added-to-dep-2.expect.md | 4 +- .../ref-current-aliased-not-added-to-dep-2.js | 4 +- ...ent-field-write-not-added-to-dep.expect.md | 6 +- ...ef-current-field-write-not-added-to-dep.js | 6 +- .../ref-current-not-added-to-dep-2.expect.md | 4 +- .../ref-current-not-added-to-dep-2.js | 4 +- .../fixtures/compiler/ref-in-effect.expect.md | 2 +- .../fixtures/compiler/ref-in-effect.js | 2 +- .../ref-like-name-in-effect.expect.md | 4 +- .../compiler/ref-like-name-in-effect.js | 4 +- .../ref-like-name-in-useCallback-2.expect.md | 4 +- .../ref-like-name-in-useCallback-2.js | 4 +- .../ref-like-name-in-useCallback.expect.md | 4 +- .../compiler/ref-like-name-in-useCallback.js | 4 +- .../ref-parameter-mutate-in-effect.expect.md | 4 +- .../ref-parameter-mutate-in-effect.js | 4 +- ...source-variables-nested-function.expect.md | 12 +- ...rename-source-variables-nested-function.js | 12 +- ...e-variables-nested-object-method.expect.md | 12 +- ...e-source-variables-nested-object-method.js | 12 +- .../rename-source-variables.expect.md | 12 +- .../compiler/rename-source-variables.ts | 12 +- .../reordering-across-blocks.expect.md | 8 +- .../compiler/reordering-across-blocks.js | 8 +- ...g-ternary-test-instruction-scope.expect.md | 6 +- ...locating-ternary-test-instruction-scope.ts | 6 +- .../repro-dce-circular-reference.expect.md | 10 +- .../compiler/repro-dce-circular-reference.js | 10 +- ...ay-with-capturing-map-after-hook.expect.md | 10 +- ...ize-array-with-capturing-map-after-hook.js | 10 +- ...rray-with-mutable-map-after-hook.expect.md | 10 +- ...moize-array-with-mutable-map-after-hook.js | 10 +- ...repro-duplicate-import-specifier.expect.md | 6 +- .../repro-duplicate-import-specifier.ts | 6 +- ...on-from-merge-consecutive-scopes.expect.md | 4 +- ...struction-from-merge-consecutive-scopes.js | 4 +- .../repro-duplicate-type-import.expect.md | 2 +- .../compiler/repro-duplicate-type-import.tsx | 2 +- ...epro-hoisting-variable-collision.expect.md | 4 +- .../repro-hoisting-variable-collision.js | 4 +- .../compiler/repro-hoisting.expect.md | 4 +- .../fixtures/compiler/repro-hoisting.js | 4 +- ...ed-property-load-for-method-call.expect.md | 6 +- ...-memoized-property-load-for-method-call.js | 6 +- ...ion-part-of-already-closed-scope.expect.md | 6 +- ...nstruction-part-of-already-closed-scope.js | 6 +- ...uned-scope-leaks-value-via-alias.expect.md | 17 +- ...alid-pruned-scope-leaks-value-via-alias.ts | 17 +- ...invalid-pruned-scope-leaks-value.expect.md | 17 +- .../repro-invalid-pruned-scope-leaks-value.ts | 17 +- ...o-invalid-reactivity-value-block.expect.md | 4 +- .../repro-invalid-reactivity-value-block.ts | 4 +- ...valid-scope-merging-value-blocks.expect.md | 2 +- ...epro-invalid-scope-merging-value-blocks.ts | 2 +- ...ay-with-immutable-map-after-hook.expect.md | 6 +- ...ize-array-with-immutable-map-after-hook.js | 6 +- ...ssing-dependency-if-within-while.expect.md | 20 +- ...epro-missing-dependency-if-within-while.js | 20 +- ...ble-range-extending-into-ternary.expect.md | 22 +- ...ro-mutable-range-extending-into-ternary.js | 22 +- ...mport-without-compiled-functions.expect.md | 2 +- ...ating-import-without-compiled-functions.js | 2 +- ...reactive-scope-with-early-return.expect.md | 8 +- ...porary-reactive-scope-with-early-return.js | 8 +- ...repro-non-identifier-object-keys.expect.md | 10 +- .../repro-non-identifier-object-keys.ts | 10 +- .../compiler/repro-object-pattern.expect.md | 6 +- .../fixtures/compiler/repro-object-pattern.js | 6 +- ...fined-try-catch-return-primitive.expect.md | 4 +- ...ds-undefined-try-catch-return-primitive.js | 4 +- .../repro-ref-mutable-range.expect.md | 4 +- .../compiler/repro-ref-mutable-range.tsx | 4 +- ...repro-renaming-conflicting-decls.expect.md | 9 +- .../repro-renaming-conflicting-decls.js | 9 +- ...repro-retain-source-when-bailout.expect.md | 4 +- .../repro-retain-source-when-bailout.js | 4 +- ...epro-scope-missing-mutable-range.expect.md | 2 +- .../repro-scope-missing-mutable-range.js | 2 +- .../repro-separate-scopes-for-divs.expect.md | 20 +- .../repro-separate-scopes-for-divs.js | 20 +- ...epro-slow-validate-preserve-memo.expect.md | 14 +- .../repro-slow-validate-preserve-memo.ts | 14 +- ...ession-of-jsxexpressioncontainer.expect.md | 12 +- ...ed-expression-of-jsxexpressioncontainer.js | 12 +- ...erge-overlapping-reactive-scopes.expect.md | 14 +- ...-call-merge-overlapping-reactive-scopes.js | 14 +- ...ble-code-early-return-in-useMemo.expect.md | 26 +- ...nreachable-code-early-return-in-useMemo.js | 26 +- .../fixtures/compiler/repro.expect.md | 4 +- .../src/__tests__/fixtures/compiler/repro.js | 4 +- ...react-hooks-based-on-import-name.expect.md | 4 +- ...esolve-react-hooks-based-on-import-name.js | 4 +- .../rest-param-with-array-pattern.expect.md | 2 +- .../compiler/rest-param-with-array-pattern.js | 2 +- .../rest-param-with-identifier.expect.md | 2 +- .../compiler/rest-param-with-identifier.js | 2 +- ...param-with-object-spread-pattern.expect.md | 4 +- .../rest-param-with-object-spread-pattern.js | 4 +- .../compiler/return-conditional.expect.md | 4 +- .../fixtures/compiler/return-conditional.js | 4 +- .../compiler/return-undefined.expect.md | 4 +- .../fixtures/compiler/return-undefined.js | 4 +- .../compiler/reverse-postorder.expect.md | 4 +- .../fixtures/compiler/reverse-postorder.js | 4 +- .../allow-locals-named-like-hooks.expect.md | 2 +- .../allow-locals-named-like-hooks.js | 2 +- .../allow-props-named-like-hooks.expect.md | 6 +- .../allow-props-named-like-hooks.js | 6 +- ...bail.rules-of-hooks-8503ca76d6f8.expect.md | 4 +- .../error.bail.rules-of-hooks-8503ca76d6f8.js | 2 +- ...nally-call-local-named-like-hook.expect.md | 2 +- ...onditionally-call-local-named-like-hook.js | 2 +- ...onally-call-prop-named-like-hook.expect.md | 4 +- ...conditionally-call-prop-named-like-hook.js | 2 +- ...dcall-hooklike-property-of-local.expect.md | 2 +- ...y-methodcall-hooklike-property-of-local.js | 2 +- ...-call-hooklike-property-of-local.expect.md | 2 +- ...ionally-call-hooklike-property-of-local.js | 2 +- .../error.invalid-hook-as-prop.expect.md | 4 +- .../error.invalid-hook-as-prop.js | 2 +- ...or.invalid-hook-from-hook-return.expect.md | 4 +- .../error.invalid-hook-from-hook-return.js | 2 +- ...hook-from-property-of-other-hook.expect.md | 4 +- ...nvalid-hook-from-property-of-other-hook.js | 2 +- ...ion-expression-object-expression.expect.md | 2 +- ...d-function-expression-object-expression.js | 2 +- ...lid-hook-in-nested-object-method.expect.md | 2 +- ...or.invalid-hook-in-nested-object-method.js | 2 +- ...invalid-hook-optional-methodcall.expect.md | 6 +- .../error.invalid-hook-optional-methodcall.js | 2 +- ...r.invalid-hook-optional-property.expect.md | 6 +- .../error.invalid-hook-optional-property.js | 2 +- .../error.invalid-hook-optionalcall.expect.md | 6 +- .../error.invalid-hook-optionalcall.js | 2 +- ...alid-rules-of-hooks-9718e30b856c.expect.md | 6 +- ...ror.invalid-rules-of-hooks-9718e30b856c.js | 4 +- ...alid-rules-of-hooks-f3d6c5e9c83d.expect.md | 4 +- ...ror.invalid-rules-of-hooks-f3d6c5e9c83d.js | 4 +- ...alid-rules-of-hooks-f69800950ff0.expect.md | 4 +- ...ror.invalid-rules-of-hooks-f69800950ff0.js | 2 +- .../rules-of-hooks-0592bd574811.expect.md | 2 +- .../rules-of-hooks-0592bd574811.js | 2 +- .../rules-of-hooks-0e2214abc294.expect.md | 2 +- .../rules-of-hooks-0e2214abc294.js | 2 +- .../rules-of-hooks-69521d94fa03.expect.md | 2 +- .../rules-of-hooks-69521d94fa03.js | 2 +- ...bail.rules-of-hooks-28a78701970c.expect.md | 2 +- .../todo.bail.rules-of-hooks-28a78701970c.js | 2 +- ...alid-rules-of-hooks-28a7111f56a7.expect.md | 4 +- ...lid.invalid-rules-of-hooks-28a7111f56a7.js | 4 +- ...s-dep-and-redeclare-maybe-frozen.expect.md | 4 +- ...iable-as-dep-and-redeclare-maybe-frozen.js | 4 +- ...me-variable-as-dep-and-redeclare.expect.md | 4 +- .../same-variable-as-dep-and-redeclare.js | 4 +- ...assignment-to-scope-declarations.expect.md | 12 +- ...turing-assignment-to-scope-declarations.js | 12 +- ...ixed-local-and-scope-declaration.expect.md | 12 +- ...-both-mixed-local-and-scope-declaration.js | 12 +- ...-progagatable-if-test-conditions.expect.md | 8 +- ...onstant-progagatable-if-test-conditions.js | 8 +- ...hout-compilation-annotation-mode.expect.md | 6 +- ...out-without-compilation-annotation-mode.js | 6 +- ...t-without-compilation-infer-mode.expect.md | 4 +- ...-bailout-without-compilation-infer-mode.js | 4 +- .../fixtures/compiler/simple-scope.expect.md | 4 +- .../fixtures/compiler/simple-scope.js | 4 +- .../compiler/skip-useMemoCache.expect.md | 4 +- .../fixtures/compiler/skip-useMemoCache.js | 4 +- .../compiler/ssa-arrayexpression.expect.md | 4 +- .../fixtures/compiler/ssa-arrayexpression.js | 4 +- .../ssa-cascading-eliminated-phis.expect.md | 4 +- .../compiler/ssa-cascading-eliminated-phis.js | 4 +- .../fixtures/compiler/ssa-for-of.expect.md | 4 +- .../__tests__/fixtures/compiler/ssa-for-of.js | 4 +- .../compiler/ssa-multiple-phis.expect.md | 4 +- .../fixtures/compiler/ssa-multiple-phis.js | 4 +- .../ssa-nested-loops-no-reassign.expect.md | 4 +- .../compiler/ssa-nested-loops-no-reassign.js | 4 +- .../compiler/ssa-nested-partial-phi.expect.md | 4 +- .../compiler/ssa-nested-partial-phi.js | 4 +- .../ssa-nested-partial-reassignment.expect.md | 4 +- .../ssa-nested-partial-reassignment.js | 4 +- .../ssa-non-empty-initializer.expect.md | 4 +- .../compiler/ssa-non-empty-initializer.js | 4 +- .../ssa-objectexpression-phi.expect.md | 2 +- .../compiler/ssa-objectexpression-phi.js | 2 +- .../compiler/ssa-objectexpression.expect.md | 6 +- .../fixtures/compiler/ssa-objectexpression.js | 6 +- .../compiler/ssa-property-alias-if.expect.md | 4 +- .../compiler/ssa-property-alias-if.js | 4 +- .../compiler/ssa-property-call.expect.md | 2 +- .../fixtures/compiler/ssa-property-call.js | 2 +- .../fixtures/compiler/ssa-reassign.expect.md | 4 +- .../fixtures/compiler/ssa-reassign.js | 4 +- ...ernary-destruction-with-mutation.expect.md | 2 +- ...aming-ternary-destruction-with-mutation.js | 2 +- ...ssa-renaming-ternary-destruction.expect.md | 6 +- .../ssa-renaming-ternary-destruction.js | 6 +- .../compiler/ssa-renaming-ternary.expect.md | 4 +- .../fixtures/compiler/ssa-renaming-ternary.js | 4 +- ...onditional-ternary-with-mutation.expect.md | 10 +- ...ing-unconditional-ternary-with-mutation.js | 10 +- ...a-renaming-unconditional-ternary.expect.md | 4 +- .../ssa-renaming-unconditional-ternary.js | 4 +- ...-via-destructuring-with-mutation.expect.md | 6 +- ...enaming-via-destructuring-with-mutation.js | 6 +- .../ssa-renaming-via-destructuring.expect.md | 10 +- .../ssa-renaming-via-destructuring.js | 10 +- .../fixtures/compiler/ssa-renaming.expect.md | 4 +- .../fixtures/compiler/ssa-renaming.js | 4 +- .../fixtures/compiler/ssa-shadowing.expect.md | 6 +- .../fixtures/compiler/ssa-shadowing.js | 6 +- .../compiler/ssa-sibling-phis.expect.md | 4 +- .../fixtures/compiler/ssa-sibling-phis.js | 4 +- .../switch-with-fallthrough.expect.md | 4 +- .../compiler/switch-with-fallthrough.js | 4 +- .../switch-with-only-default.expect.md | 6 +- .../compiler/switch-with-only-default.js | 6 +- .../ternary-assignment-expression.expect.md | 4 +- .../compiler/ternary-assignment-expression.js | 4 +- .../compiler/ternary-expression.expect.md | 4 +- .../fixtures/compiler/ternary-expression.js | 4 +- ...sion-captures-value-later-frozen.expect.md | 2 +- ...-expression-captures-value-later-frozen.js | 2 +- ...rror.object-pattern-computed-key.expect.md | 10 +- .../todo.error.object-pattern-computed-key.js | 6 +- ...eassign-local-variable-in-effect.expect.md | 14 +- ...ction-reassign-local-variable-in-effect.js | 14 +- ...o.unnecessary-lambda-memoization.expect.md | 2 +- .../todo.unnecessary-lambda-memoization.js | 2 +- .../transitive-freeze-array.expect.md | 2 +- .../compiler/transitive-freeze-array.js | 2 +- ...tive-freeze-function-expressions.expect.md | 4 +- .../transitive-freeze-function-expressions.js | 4 +- .../fixtures/compiler/trivial.expect.md | 4 +- .../__tests__/fixtures/compiler/trivial.js | 4 +- .../try-catch-alias-try-values.expect.md | 2 +- .../compiler/try-catch-alias-try-values.js | 2 +- .../compiler/try-catch-empty-try.expect.md | 2 +- .../fixtures/compiler/try-catch-empty-try.js | 2 +- .../try-catch-in-nested-scope.expect.md | 20 +- .../compiler/try-catch-in-nested-scope.ts | 20 +- .../try-catch-mutate-outer-value.expect.md | 8 +- .../compiler/try-catch-mutate-outer-value.js | 8 +- ...ry-catch-try-immediately-returns.expect.md | 2 +- .../try-catch-try-immediately-returns.js | 2 +- ...hrows-after-constant-propagation.expect.md | 2 +- ...ately-throws-after-constant-propagation.js | 2 +- ...value-modified-in-catch-escaping.expect.md | 4 +- ...ch-try-value-modified-in-catch-escaping.js | 4 +- ...atch-try-value-modified-in-catch.expect.md | 4 +- .../try-catch-try-value-modified-in-catch.js | 4 +- .../try-catch-with-catch-param.expect.md | 2 +- .../compiler/try-catch-with-catch-param.js | 2 +- .../compiler/try-catch-with-return.expect.md | 2 +- .../compiler/try-catch-with-return.js | 2 +- ...-expression-returns-caught-value.expect.md | 4 +- ...unction-expression-returns-caught-value.js | 4 +- .../try-catch-within-mutable-range.expect.md | 4 +- .../try-catch-within-mutable-range.js | 4 +- ...ject-method-returns-caught-value.expect.md | 4 +- ...thin-object-method-returns-caught-value.js | 4 +- .../fixtures/compiler/try-catch.expect.md | 4 +- .../__tests__/fixtures/compiler/try-catch.js | 4 +- .../compiler/type-alias-declaration.expect.md | 6 +- .../compiler/type-alias-declaration.ts | 6 +- .../type-alias-used-as-annotation.expect.md | 2 +- .../compiler/type-alias-used-as-annotation.ts | 2 +- ...lias-used-as-variable-annotation.expect.md | 4 +- .../type-alias-used-as-variable-annotation.ts | 4 +- .../todo_type-annotations-props.expect.md | 2 +- .../todo_type-annotations-props.ts | 2 +- .../type-annotation-as-array.expect.md | 4 +- .../type-annotation-as-array.ts | 4 +- .../type-annotation-as-number.expect.md | 6 +- .../type-annotation-as-number.ts | 6 +- .../type-annotation-var-array.expect.md | 4 +- .../type-annotation-var-array.ts | 4 +- .../type-args-test-binary-operator.expect.md | 4 +- .../type-args-test-binary-operator.js | 4 +- .../compiler/type-field-load.expect.md | 2 +- .../fixtures/compiler/type-field-load.js | 2 +- .../type-test-field-load-binary-op.expect.md | 2 +- .../type-test-field-load-binary-op.js | 2 +- .../fixtures/compiler/unary-expr.expect.md | 8 +- .../__tests__/fixtures/compiler/unary-expr.js | 8 +- .../unconditional-break-label.expect.md | 4 +- .../compiler/unconditional-break-label.js | 4 +- ...abeled-break-within-label-switch.expect.md | 2 +- .../unlabeled-break-within-label-switch.ts | 2 +- ...pendency-is-pruned-as-dependency.expect.md | 4 +- ...tive-dependency-is-pruned-as-dependency.js | 4 +- .../unused-array-middle-element.expect.md | 4 +- .../compiler/unused-array-middle-element.js | 4 +- .../unused-array-rest-element.expect.md | 4 +- .../compiler/unused-array-rest-element.js | 4 +- .../compiler/unused-conditional.expect.md | 4 +- .../fixtures/compiler/unused-conditional.js | 4 +- .../compiler/unused-logical.expect.md | 4 +- .../fixtures/compiler/unused-logical.js | 4 +- .../unused-object-element-with-rest.expect.md | 6 +- .../unused-object-element-with-rest.js | 6 +- .../compiler/unused-object-element.expect.md | 6 +- .../compiler/unused-object-element.js | 6 +- ...-expression-constant-propagation.expect.md | 2 +- .../update-expression-constant-propagation.js | 2 +- .../update-expression-in-sequence.expect.md | 2 +- .../compiler/update-expression-in-sequence.js | 2 +- ...pression-on-function-parameter-1.expect.md | 4 +- ...date-expression-on-function-parameter-1.js | 4 +- ...pression-on-function-parameter-3.expect.md | 4 +- ...date-expression-on-function-parameter-3.js | 4 +- .../compiler/update-expression.expect.md | 6 +- .../fixtures/compiler/update-expression.ts | 6 +- .../compiler/use-memo-simple.expect.md | 4 +- .../fixtures/compiler/use-memo-simple.js | 4 +- .../use-no-forget-module-level.expect.md | 2 +- .../compiler/use-no-forget-module-level.js | 2 +- ...multiple-with-eslint-suppression.expect.md | 8 +- ...forget-multiple-with-eslint-suppression.js | 8 +- ...o-forget-with-eslint-suppression.expect.md | 6 +- .../use-no-forget-with-eslint-suppression.js | 6 +- .../use-no-memo-module-level.expect.md | 2 +- .../compiler/use-no-memo-module-level.js | 2 +- .../compiler/use-no-memo-simple.expect.md | 4 +- .../fixtures/compiler/use-no-memo-simple.js | 4 +- .../use-operator-call-expression.expect.md | 24 +- .../compiler/use-operator-call-expression.js | 24 +- .../use-operator-conditional.expect.md | 22 +- .../compiler/use-operator-conditional.js | 22 +- .../use-operator-method-call.expect.md | 26 +- .../compiler/use-operator-method-call.js | 26 +- ...patch-considered-as-non-reactive.expect.md | 2 +- ...ate-dispatch-considered-as-non-reactive.js | 2 +- ...-value-dont-preserve-memoization.expect.md | 4 +- ...mutable-value-dont-preserve-memoization.js | 4 +- ...table-value-preserve-memoization.expect.md | 4 +- ...aybe-mutable-value-preserve-memoization.js | 4 +- ...t-preserve-memoization-guarantee.expect.md | 11 +- ...ble-dont-preserve-memoization-guarantee.js | 11 +- ...e-preserve-memoization-guarantee.expect.md | 11 +- ...variable-preserve-memoization-guarantee.js | 11 +- ...ng-same-ref-preserve-memoization.expect.md | 6 +- ...modifying-same-ref-preserve-memoization.js | 6 +- ...operty-dont-preserve-memoization.expect.md | 6 +- ...sted-property-dont-preserve-memoization.js | 6 +- ...ed-property-preserve-memoization.expect.md | 6 +- ...ef-nested-property-preserve-memoization.js | 6 +- ...Callback-set-ref-nested-property.expect.md | 6 +- .../useCallback-set-ref-nested-property.js | 6 +- ...-value-dont-preserve-memoization.expect.md | 4 +- ...set-ref-value-dont-preserve-memoization.js | 4 +- ...t-ref-value-preserve-memoization.expect.md | 4 +- ...back-set-ref-value-preserve-memoization.js | 4 +- ...maybe-mutate-context-in-callback.expect.md | 10 +- ...ontext-maybe-mutate-context-in-callback.js | 10 +- ...context-in-callback-if-condition.expect.md | 6 +- ...t-read-context-in-callback-if-condition.js | 6 +- ...Context-read-context-in-callback.expect.md | 6 +- .../useContext-read-context-in-callback.js | 6 +- .../compiler/useEffect-arg-memoized.expect.md | 2 +- .../compiler/useEffect-arg-memoized.js | 2 +- .../useEffect-external-mutate.expect.md | 4 +- .../compiler/useEffect-external-mutate.js | 4 +- .../useEffect-global-pruned.expect.md | 2 +- .../compiler/useEffect-global-pruned.js | 2 +- .../useEffect-namespace-pruned.expect.md | 2 +- .../compiler/useEffect-namespace-pruned.js | 2 +- .../useEffect-nested-lambdas.expect.md | 2 +- .../compiler/useEffect-nested-lambdas.js | 2 +- .../compiler/useEffect-snap-test.expect.md | 6 +- .../fixtures/compiler/useEffect-snap-test.js | 6 +- .../useMemo-inlining-block-return.expect.md | 6 +- .../compiler/useMemo-inlining-block-return.js | 6 +- .../compiler/useMemo-inverted-if.expect.md | 4 +- .../fixtures/compiler/useMemo-inverted-if.js | 4 +- ...d-statement-unconditional-return.expect.md | 4 +- ...-labeled-statement-unconditional-return.js | 4 +- .../compiler/useMemo-logical.expect.md | 4 +- .../fixtures/compiler/useMemo-logical.js | 4 +- ...-preserve-memoization-guarantees.expect.md | 11 +- ...le-dont-preserve-memoization-guarantees.js | 11 +- ...-preserve-memoization-guarantees.expect.md | 11 +- ...ariable-preserve-memoization-guarantees.js | 11 +- ...-preserve-memoization-guarantees.expect.md | 4 +- ...er-dont-preserve-memoization-guarantees.js | 4 +- ...-preserve-memoization-guarantees.expect.md | 4 +- ...d-later-preserve-memoization-guarantees.js | 4 +- .../useMemo-multiple-if-else.expect.md | 4 +- .../compiler/useMemo-multiple-if-else.js | 4 +- .../compiler/useMemo-named-function.expect.md | 4 +- .../compiler/useMemo-named-function.ts | 4 +- .../compiler/useMemo-nested-ifs.expect.md | 4 +- .../fixtures/compiler/useMemo-nested-ifs.js | 4 +- .../useMemo-simple-preserved-nomemo.expect.md | 6 +- .../useMemo-simple-preserved-nomemo.js | 6 +- .../useMemo-simple-preserved.expect.md | 6 +- .../compiler/useMemo-simple-preserved.js | 6 +- .../useMemo-switch-no-fallthrough.expect.md | 6 +- .../compiler/useMemo-switch-no-fallthrough.js | 6 +- .../compiler/useMemo-switch-return.expect.md | 12 +- .../compiler/useMemo-switch-return.js | 12 +- ...urned-dispatcher-is-non-reactive.expect.md | 2 +- ...cer-returned-dispatcher-is-non-reactive.js | 2 +- ...d-other-hook-unpruned-dependency.expect.md | 4 +- ...tate-and-other-hook-unpruned-dependency.js | 4 +- ...-pruned-dependency-change-detect.expect.md | 2 +- ...seState-pruned-dependency-change-detect.js | 2 +- .../useState-unpruned-dependency.expect.md | 4 +- .../compiler/useState-unpruned-dependency.js | 4 +- .../userspace-use-memo-cache.expect.md | 3 +- .../compiler/userspace-use-memo-cache.js | 3 +- ...tion-with-mutable-range-is-valid.expect.md | 8 +- ...ed-function-with-mutable-range-is-valid.js | 8 +- ...hich-conditionally-sets-state-ok.expect.md | 4 +- ...ambda-which-conditionally-sets-state-ok.js | 4 +- .../value-block-mutates-outer-value.expect.md | 8 +- .../value-block-mutates-outer-value.ts | 8 +- .../fixtures/compiler/while-break.expect.md | 4 +- .../fixtures/compiler/while-break.js | 4 +- .../while-conditional-continue.expect.md | 4 +- .../compiler/while-conditional-continue.js | 4 +- .../fixtures/compiler/while-logical.expect.md | 4 +- .../fixtures/compiler/while-logical.js | 4 +- .../compiler/while-property.expect.md | 4 +- .../fixtures/compiler/while-property.js | 4 +- .../src/__tests__/parseConfigPragma-test.ts | 8 +- .../test-utils/validateNoUseBeforeDefine.ts | 24 +- .../babel-plugin-react-compiler/src/index.ts | 12 +- .../__tests__/ReactCompilerRule-test.ts | 48 +- .../ReactCompilerRuleTypescript-test.ts | 24 +- .../babel.config.js | 8 +- .../rollup.config.js | 38 +- .../eslint-plugin-react-compiler/src/index.ts | 4 +- .../src/rules/ReactCompilerRule.ts | 84 +- .../make-read-only-util/jest.config.js | 4 +- .../src/__tests__/makeReadOnly-test.ts | 136 +- .../make-read-only-util/src/makeReadOnly.ts | 48 +- .../rollup.config.js | 48 +- .../src/checks/libraryCompat.ts | 4 +- .../src/checks/reactCompiler.ts | 48 +- .../src/checks/strictMode.ts | 6 +- .../react-compiler-healthcheck/src/config.ts | 2 +- .../react-compiler-healthcheck/src/index.ts | 42 +- .../react-compiler-runtime/rollup.config.js | 30 +- .../react-compiler-runtime/src/index.ts | 136 +- .../packages/snap/src/SproutTodoFilter.ts | 898 ++++----- compiler/packages/snap/src/compiler.ts | 240 ++- compiler/packages/snap/src/constants.ts | 34 +- compiler/packages/snap/src/fixture-utils.ts | 76 +- compiler/packages/snap/src/main.ts | 28 +- compiler/packages/snap/src/reporter.ts | 70 +- compiler/packages/snap/src/runner-watch.ts | 72 +- compiler/packages/snap/src/runner-worker.ts | 52 +- compiler/packages/snap/src/runner.ts | 112 +- .../packages/snap/src/sprout/evaluator.ts | 100 +- compiler/packages/snap/src/sprout/index.ts | 32 +- .../snap/src/sprout/shared-runtime.ts | 64 +- compiler/scripts/copyright.js | 28 +- compiler/scripts/release/prompt-for-otp.js | 6 +- compiler/scripts/release/publish-manual.js | 90 +- compiler/scripts/update-commit-message.js | 52 +- scripts/shared/pathsByLanguageVersion.js | 6 - 1898 files changed, 12437 insertions(+), 12663 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index 5f3e78b0b8..aa54cbae1f 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,10 +1,6 @@ 'use strict'; -const { - compilerPaths, - esNextPaths, - typescriptPaths, -} = require('./scripts/shared/pathsByLanguageVersion'); +const {esNextPaths} = require('./scripts/shared/pathsByLanguageVersion'); module.exports = { bracketSpacing: false, @@ -28,25 +24,11 @@ module.exports = { }, }, { - files: typescriptPaths, + files: ['*.ts', '*.tsx'], options: { trailingComma: 'all', parser: 'typescript', }, }, - { - files: compilerPaths, - options: { - requirePragma: false, - parser: 'babel-ts', - semi: true, - singleQuote: false, - trailingComma: 'es5', - bracketSpacing: true, - bracketSameLine: false, - printWidth: 80, - arrowParens: 'always', - }, - }, ], }; diff --git a/compiler/apps/playground/__tests__/e2e/page.spec.ts b/compiler/apps/playground/__tests__/e2e/page.spec.ts index 3bb6637f95..bc93352a09 100644 --- a/compiler/apps/playground/__tests__/e2e/page.spec.ts +++ b/compiler/apps/playground/__tests__/e2e/page.spec.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import { expect, test } from "@playwright/test"; -import { encodeStore, type Store } from "../../lib/stores"; +import {expect, test} from '@playwright/test'; +import {encodeStore, type Store} from '../../lib/stores'; const STORE: Store = { source: `export default function TestComponent({ x }) { @@ -17,33 +17,33 @@ const STORE: Store = { const HASH = encodeStore(STORE); function concat(data: Array): string { - return data.join(""); + return data.join(''); } -test("editor should compile successfully", async ({ page }) => { - await page.goto(`/#${HASH}`, { waitUntil: "networkidle" }); +test('editor should compile successfully', async ({page}) => { + await page.goto(`/#${HASH}`, {waitUntil: 'networkidle'}); await page.screenshot({ fullPage: true, - path: "test-results/00-on-networkidle.png", + path: 'test-results/00-on-networkidle.png', }); // User input from hash compiles await page.screenshot({ fullPage: true, - path: "test-results/01-show-js-before.png", + path: 'test-results/01-show-js-before.png', }); const userInput = - (await page.locator(".monaco-editor").nth(2).allInnerTexts()) ?? []; - expect(concat(userInput)).toMatchSnapshot("user-input.txt"); + (await page.locator('.monaco-editor').nth(2).allInnerTexts()) ?? []; + expect(concat(userInput)).toMatchSnapshot('user-input.txt'); // Reset button works - page.on("dialog", (dialog) => dialog.accept()); - await page.getByRole("button", { name: "Reset" }).click(); + page.on('dialog', dialog => dialog.accept()); + await page.getByRole('button', {name: 'Reset'}).click(); await page.screenshot({ fullPage: true, - path: "test-results/02-show-js-after.png", + path: 'test-results/02-show-js-after.png', }); const defaultInput = - (await page.locator(".monaco-editor").nth(2).allInnerTexts()) ?? []; - expect(concat(defaultInput)).toMatchSnapshot("default-input.txt"); + (await page.locator('.monaco-editor').nth(2).allInnerTexts()) ?? []; + expect(concat(defaultInput)).toMatchSnapshot('default-input.txt'); }); diff --git a/compiler/apps/playground/app/index.tsx b/compiler/apps/playground/app/index.tsx index 75411cd36e..3bbf2e9b55 100644 --- a/compiler/apps/playground/app/index.tsx +++ b/compiler/apps/playground/app/index.tsx @@ -5,25 +5,24 @@ * LICENSE file in the root directory of this source tree. */ -import type { NextPage } from "next"; -import Head from "next/head"; -import { SnackbarProvider } from "notistack"; -import { Editor, Header, StoreProvider } from "../components"; -import MessageSnackbar from "../components/Message"; +import type {NextPage} from 'next'; +import Head from 'next/head'; +import {SnackbarProvider} from 'notistack'; +import {Editor, Header, StoreProvider} from '../components'; +import MessageSnackbar from '../components/Message'; const Home: NextPage = () => { return (
- {process.env.NODE_ENV === "development" - ? "[DEV] React Compiler Playground" - : "React Compiler Playground"} + {process.env.NODE_ENV === 'development' + ? '[DEV] React Compiler Playground' + : 'React Compiler Playground'} + content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> { + Components={{message: MessageSnackbar}}>
diff --git a/compiler/apps/playground/app/layout.tsx b/compiler/apps/playground/app/layout.tsx index be0d04e932..3e888ae955 100644 --- a/compiler/apps/playground/app/layout.tsx +++ b/compiler/apps/playground/app/layout.tsx @@ -5,26 +5,21 @@ * LICENSE file in the root directory of this source tree. */ -import "../styles/globals.css"; +import '../styles/globals.css'; -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}) { - "use no memo"; +export default function RootLayout({children}: {children: React.ReactNode}) { + 'use no memo'; return ( - {process.env.NODE_ENV === "development" - ? "[DEV] React Compiler Playground" - : "React Compiler Playground"} + {process.env.NODE_ENV === 'development' + ? '[DEV] React Compiler Playground' + : 'React Compiler Playground'} + content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> + Components={{message: MessageSnackbar}}>
diff --git a/compiler/apps/playground/babel.config.js b/compiler/apps/playground/babel.config.js index 900b52dd30..0edf2e9b72 100644 --- a/compiler/apps/playground/babel.config.js +++ b/compiler/apps/playground/babel.config.js @@ -8,12 +8,12 @@ module.exports = function (api) { api.cache(true); return { - presets: ["next/babel"], + presets: ['next/babel'], plugins: [ [ - "babel-plugin-react-compiler", + 'babel-plugin-react-compiler', { - runtimeModule: "react-compiler-runtime", + runtimeModule: 'react-compiler-runtime', }, ], ], diff --git a/compiler/apps/playground/colors.js b/compiler/apps/playground/colors.js index 7259e1f32b..bd5f1426f5 100644 --- a/compiler/apps/playground/colors.js +++ b/compiler/apps/playground/colors.js @@ -11,86 +11,86 @@ module.exports = { // Text colors - primary: "#23272F", // gray-90 - "primary-dark": "#F6F7F9", // gray-5 - secondary: "#404756", // gray-70 - "secondary-dark": "#EBECF0", // gray-10 - link: "#087EA4", // blue-50 - "link-dark": "#149ECA", // blue-40 - syntax: "#EBECF0", // gray-10 - wash: "#FFFFFF", - "wash-dark": "#23272F", // gray-90 - card: "#F6F7F9", // gray-05 - "card-dark": "#343A46", // gray-80 - highlight: "#E6F7FF", // blue-10 - "highlight-dark": "rgba(88,175,223,.1)", - border: "#EBECF0", // gray-10 - "border-dark": "#343A46", // gray-80 - "secondary-button": "#EBECF0", // gray-10 - "secondary-button-dark": "#404756", // gray-70 + primary: '#23272F', // gray-90 + 'primary-dark': '#F6F7F9', // gray-5 + secondary: '#404756', // gray-70 + 'secondary-dark': '#EBECF0', // gray-10 + link: '#087EA4', // blue-50 + 'link-dark': '#149ECA', // blue-40 + syntax: '#EBECF0', // gray-10 + wash: '#FFFFFF', + 'wash-dark': '#23272F', // gray-90 + card: '#F6F7F9', // gray-05 + 'card-dark': '#343A46', // gray-80 + highlight: '#E6F7FF', // blue-10 + 'highlight-dark': 'rgba(88,175,223,.1)', + border: '#EBECF0', // gray-10 + 'border-dark': '#343A46', // gray-80 + 'secondary-button': '#EBECF0', // gray-10 + 'secondary-button-dark': '#404756', // gray-70 // Gray - "gray-95": "#16181D", - "gray-90": "#23272F", - "gray-80": "#343A46", - "gray-70": "#404756", - "gray-60": "#4E5769", - "gray-50": "#5E687E", // unused - "gray-40": "#78839B", - "gray-30": "#99A1B3", - "gray-20": "#BCC1CD", - "gray-10": "#EBECF0", - "gray-5": "#F6F7F9", + 'gray-95': '#16181D', + 'gray-90': '#23272F', + 'gray-80': '#343A46', + 'gray-70': '#404756', + 'gray-60': '#4E5769', + 'gray-50': '#5E687E', // unused + 'gray-40': '#78839B', + 'gray-30': '#99A1B3', + 'gray-20': '#BCC1CD', + 'gray-10': '#EBECF0', + 'gray-5': '#F6F7F9', // Blue - "blue-60": "#045975", - "blue-50": "#087EA4", - "blue-40": "#149ECA", // Brand Blue - "blue-30": "#58C4DC", // unused - "blue-20": "#ABE2ED", - "blue-10": "#E6F7FF", // todo: doesn't match illustrations - "blue-5": "#E6F6FA", + 'blue-60': '#045975', + 'blue-50': '#087EA4', + 'blue-40': '#149ECA', // Brand Blue + 'blue-30': '#58C4DC', // unused + 'blue-20': '#ABE2ED', + 'blue-10': '#E6F7FF', // todo: doesn't match illustrations + 'blue-5': '#E6F6FA', // Yellow - "yellow-60": "#B65700", - "yellow-50": "#C76A15", - "yellow-40": "#DB7D27", // unused - "yellow-30": "#FABD62", // unused - "yellow-20": "#FCDEB0", // unused - "yellow-10": "#FDE7C7", - "yellow-5": "#FEF5E7", + 'yellow-60': '#B65700', + 'yellow-50': '#C76A15', + 'yellow-40': '#DB7D27', // unused + 'yellow-30': '#FABD62', // unused + 'yellow-20': '#FCDEB0', // unused + 'yellow-10': '#FDE7C7', + 'yellow-5': '#FEF5E7', // Purple - "purple-60": "#2B3491", // unused - "purple-50": "#575FB7", - "purple-40": "#6B75DB", - "purple-30": "#8891EC", - "purple-20": "#C3C8F5", // unused - "purple-10": "#E7E9FB", - "purple-5": "#F3F4FD", + 'purple-60': '#2B3491', // unused + 'purple-50': '#575FB7', + 'purple-40': '#6B75DB', + 'purple-30': '#8891EC', + 'purple-20': '#C3C8F5', // unused + 'purple-10': '#E7E9FB', + 'purple-5': '#F3F4FD', // Green - "green-60": "#2B6E62", - "green-50": "#388F7F", - "green-40": "#44AC99", - "green-30": "#7FCCBF", - "green-20": "#ABDED5", - "green-10": "#E5F5F2", - "green-5": "#F4FBF9", + 'green-60': '#2B6E62', + 'green-50': '#388F7F', + 'green-40': '#44AC99', + 'green-30': '#7FCCBF', + 'green-20': '#ABDED5', + 'green-10': '#E5F5F2', + 'green-5': '#F4FBF9', // RED - "red-60": "#712D28", - "red-50": "#A6423A", // unused - "red-40": "#C1554D", - "red-30": "#D07D77", - "red-20": "#E5B7B3", // unused - "red-10": "#F2DBD9", // unused - "red-5": "#FAF1F0", + 'red-60': '#712D28', + 'red-50': '#A6423A', // unused + 'red-40': '#C1554D', + 'red-30': '#D07D77', + 'red-20': '#E5B7B3', // unused + 'red-10': '#F2DBD9', // unused + 'red-5': '#FAF1F0', // MISC - "code-block": "#99a1b30f", // gray-30 @ 6% - "gradient-blue": "#58C4DC", // Only used for the landing gradient for now. + 'code-block': '#99a1b30f', // gray-30 @ 6% + 'gradient-blue': '#58C4DC', // Only used for the landing gradient for now. github: { - highlight: "#fffbdd", + highlight: '#fffbdd', }, }; diff --git a/compiler/apps/playground/components/Editor/EditorImpl.tsx b/compiler/apps/playground/components/Editor/EditorImpl.tsx index a96672194b..ebac65dc4b 100644 --- a/compiler/apps/playground/components/Editor/EditorImpl.tsx +++ b/compiler/apps/playground/components/Editor/EditorImpl.tsx @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import { parse as babelParse, ParserPlugin } from "@babel/parser"; -import * as HermesParser from "hermes-parser"; -import traverse, { NodePath } from "@babel/traverse"; -import * as t from "@babel/types"; +import {parse as babelParse, ParserPlugin} from '@babel/parser'; +import * as HermesParser from 'hermes-parser'; +import traverse, {NodePath} from '@babel/traverse'; +import * as t from '@babel/types'; import { CompilerError, CompilerErrorDetail, @@ -20,51 +20,51 @@ import { run, ValueKind, type Hook, -} from "babel-plugin-react-compiler/src"; -import { type ReactFunctionType } from "babel-plugin-react-compiler/src/HIR/Environment"; -import clsx from "clsx"; -import invariant from "invariant"; -import { useSnackbar } from "notistack"; -import { useDeferredValue, useMemo } from "react"; -import { useMountEffect } from "../../hooks"; -import { defaultStore } from "../../lib/defaultStore"; +} from 'babel-plugin-react-compiler/src'; +import {type ReactFunctionType} from 'babel-plugin-react-compiler/src/HIR/Environment'; +import clsx from 'clsx'; +import invariant from 'invariant'; +import {useSnackbar} from 'notistack'; +import {useDeferredValue, useMemo} from 'react'; +import {useMountEffect} from '../../hooks'; +import {defaultStore} from '../../lib/defaultStore'; import { createMessage, initStoreFromUrlOrLocalStorage, MessageLevel, MessageSource, type Store, -} from "../../lib/stores"; -import { useStore, useStoreDispatch } from "../StoreContext"; -import Input from "./Input"; +} from '../../lib/stores'; +import {useStore, useStoreDispatch} from '../StoreContext'; +import Input from './Input'; import { CompilerOutput, default as Output, PrintedCompilerPipelineValue, -} from "./Output"; -import { printFunctionWithOutlined } from "babel-plugin-react-compiler/src/HIR/PrintHIR"; -import { printReactiveFunctionWithOutlined } from "babel-plugin-react-compiler/src/ReactiveScopes/PrintReactiveFunction"; +} from './Output'; +import {printFunctionWithOutlined} from 'babel-plugin-react-compiler/src/HIR/PrintHIR'; +import {printReactiveFunctionWithOutlined} from 'babel-plugin-react-compiler/src/ReactiveScopes/PrintReactiveFunction'; -function parseInput(input: string, language: "flow" | "typescript") { +function parseInput(input: string, language: 'flow' | 'typescript') { // Extract the first line to quickly check for custom test directives - if (language === "flow") { + if (language === 'flow') { return HermesParser.parse(input, { babel: true, - flow: "all", - sourceType: "module", + flow: 'all', + sourceType: 'module', enableExperimentalComponentSyntax: true, }); } else { return babelParse(input, { - plugins: ["typescript", "jsx"], - sourceType: "module", + plugins: ['typescript', 'jsx'], + sourceType: 'module', }); } } function parseFunctions( source: string, - language: "flow" | "typescript" + language: 'flow' | 'typescript', ): Array< NodePath< t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression @@ -105,7 +105,7 @@ function parseFunctions( const COMMON_HOOKS: Array<[string, Hook]> = [ [ - "useFragment", + 'useFragment', { valueKind: ValueKind.Frozen, effectKind: Effect.Freeze, @@ -114,7 +114,7 @@ const COMMON_HOOKS: Array<[string, Hook]> = [ }, ], [ - "usePaginationFragment", + 'usePaginationFragment', { valueKind: ValueKind.Frozen, effectKind: Effect.Freeze, @@ -123,7 +123,7 @@ const COMMON_HOOKS: Array<[string, Hook]> = [ }, ], [ - "useRefetchableFragment", + 'useRefetchableFragment', { valueKind: ValueKind.Frozen, effectKind: Effect.Freeze, @@ -132,7 +132,7 @@ const COMMON_HOOKS: Array<[string, Hook]> = [ }, ], [ - "useLazyLoadQuery", + 'useLazyLoadQuery', { valueKind: ValueKind.Frozen, effectKind: Effect.Freeze, @@ -141,7 +141,7 @@ const COMMON_HOOKS: Array<[string, Hook]> = [ }, ], [ - "usePreloadedQuery", + 'usePreloadedQuery', { valueKind: ValueKind.Frozen, effectKind: Effect.Freeze, @@ -156,22 +156,22 @@ function isHookName(s: string): boolean { } function getReactFunctionType( - id: NodePath + id: NodePath, ): ReactFunctionType { if (id && id.node && id.isIdentifier()) { if (isHookName(id.node.name)) { - return "Hook"; + return 'Hook'; } const isPascalCaseNameSpace = /^[A-Z].*/; if (isPascalCaseNameSpace.test(id.node.name)) { - return "Component"; + return 'Component'; } } - return "Other"; + return 'Other'; } -function compile(source: string): [CompilerOutput, "flow" | "typescript"] { +function compile(source: string): [CompilerOutput, 'flow' | 'typescript'] { const results = new Map(); const error = new CompilerError(); const upsert = (result: PrintedCompilerPipelineValue) => { @@ -182,15 +182,15 @@ function compile(source: string): [CompilerOutput, "flow" | "typescript"] { results.set(result.name, [result]); } }; - let language: "flow" | "typescript"; + let language: 'flow' | 'typescript'; if (source.match(/\@flow/)) { - language = "flow"; + language = 'flow'; } else { - language = "typescript"; + language = 'typescript'; } try { // Extract the first line to quickly check for custom test directives - const pragma = source.substring(0, source.indexOf("\n")); + const pragma = source.substring(0, source.indexOf('\n')); const config = parseConfigPragma(pragma); for (const fn of parseFunctions(source, language)) { @@ -199,16 +199,16 @@ function compile(source: string): [CompilerOutput, "flow" | "typescript"] { new CompilerErrorDetail({ reason: `Unexpected function type ${fn.node.type}`, description: - "Playground only supports parsing function declarations", + 'Playground only supports parsing function declarations', severity: ErrorSeverity.Todo, loc: fn.node.loc ?? null, suggestions: null, - }) + }), ); continue; } - const id = fn.get("id"); + const id = fn.get('id'); for (const result of run( fn, { @@ -216,20 +216,20 @@ function compile(source: string): [CompilerOutput, "flow" | "typescript"] { customHooks: new Map([...COMMON_HOOKS]), }, getReactFunctionType(id), - "_c", + '_c', + null, null, null, - null )) { const fnName = fn.node.id?.name ?? null; switch (result.kind) { - case "ast": { + case 'ast': { upsert({ - kind: "ast", + kind: 'ast', fnName, name: result.name, value: { - type: "FunctionDeclaration", + type: 'FunctionDeclaration', id: result.value.id, async: result.value.async, generator: result.value.generator, @@ -239,27 +239,27 @@ function compile(source: string): [CompilerOutput, "flow" | "typescript"] { }); break; } - case "hir": { + case 'hir': { upsert({ - kind: "hir", + kind: 'hir', fnName, name: result.name, value: printFunctionWithOutlined(result.value), }); break; } - case "reactive": { + case 'reactive': { upsert({ - kind: "reactive", + kind: 'reactive', fnName, name: result.name, value: printReactiveFunctionWithOutlined(result.value), }); break; } - case "debug": { + case 'debug': { upsert({ - kind: "debug", + kind: 'debug', fnName, name: result.name, value: result.value, @@ -288,24 +288,24 @@ function compile(source: string): [CompilerOutput, "flow" | "typescript"] { reason: `Unexpected failure when transforming input! ${err}`, loc: null, suggestions: null, - }) + }), ); } } if (error.hasErrors()) { - return [{ kind: "err", results, error: error }, language]; + return [{kind: 'err', results, error: error}, language]; } - return [{ kind: "ok", results }, language]; + return [{kind: 'ok', results}, language]; } export default function Editor() { const store = useStore(); const deferredStore = useDeferredValue(store); const dispatchStore = useStoreDispatch(); - const { enqueueSnackbar } = useSnackbar(); + const {enqueueSnackbar} = useSnackbar(); const [compilerOutput, language] = useMemo( () => compile(deferredStore.source), - [deferredStore.source] + [deferredStore.source], ); useMountEffect(() => { @@ -313,35 +313,35 @@ export default function Editor() { try { mountStore = initStoreFromUrlOrLocalStorage(); } catch (e) { - invariant(e instanceof Error, "Only Error may be caught."); + invariant(e instanceof Error, 'Only Error may be caught.'); enqueueSnackbar(e.message, { - variant: "message", + variant: 'message', ...createMessage( - "Bad URL - fell back to the default Playground.", + 'Bad URL - fell back to the default Playground.', MessageLevel.Info, - MessageSource.Playground + MessageSource.Playground, ), }); mountStore = defaultStore; } dispatchStore({ - type: "setStore", - payload: { store: mountStore }, + type: 'setStore', + payload: {store: mountStore}, }); }); return ( <>
-
+
-
+
diff --git a/compiler/apps/playground/components/Editor/Input.tsx b/compiler/apps/playground/components/Editor/Input.tsx index 219f13ba23..c2ce8efc70 100644 --- a/compiler/apps/playground/components/Editor/Input.tsx +++ b/compiler/apps/playground/components/Editor/Input.tsx @@ -5,28 +5,28 @@ * LICENSE file in the root directory of this source tree. */ -import MonacoEditor, { loader, type Monaco } from "@monaco-editor/react"; -import { CompilerErrorDetail } from "babel-plugin-react-compiler/src"; -import invariant from "invariant"; -import type { editor } from "monaco-editor"; -import * as monaco from "monaco-editor"; -import { Resizable } from "re-resizable"; -import { useEffect, useState } from "react"; -import { renderReactCompilerMarkers } from "../../lib/reactCompilerMonacoDiagnostics"; -import { useStore, useStoreDispatch } from "../StoreContext"; -import { monacoOptions } from "./monacoOptions"; +import MonacoEditor, {loader, type Monaco} from '@monaco-editor/react'; +import {CompilerErrorDetail} from 'babel-plugin-react-compiler/src'; +import invariant from 'invariant'; +import type {editor} from 'monaco-editor'; +import * as monaco from 'monaco-editor'; +import {Resizable} from 're-resizable'; +import {useEffect, useState} from 'react'; +import {renderReactCompilerMarkers} from '../../lib/reactCompilerMonacoDiagnostics'; +import {useStore, useStoreDispatch} from '../StoreContext'; +import {monacoOptions} from './monacoOptions'; // TODO: Make TS recognize .d.ts files, in addition to loading them with webpack. // @ts-ignore -import React$Types from "../../node_modules/@types/react/index.d.ts"; +import React$Types from '../../node_modules/@types/react/index.d.ts'; -loader.config({ monaco }); +loader.config({monaco}); type Props = { errors: CompilerErrorDetail[]; - language: "flow" | "typescript"; + language: 'flow' | 'typescript'; }; -export default function Input({ errors, language }: Props) { +export default function Input({errors, language}: Props) { const [monaco, setMonaco] = useState(null); const store = useStore(); const dispatchStore = useStoreDispatch(); @@ -36,11 +36,11 @@ export default function Input({ errors, language }: Props) { if (!monaco) return; const uri = monaco.Uri.parse(`file:///index.js`); const model = monaco.editor.getModel(uri); - invariant(model, "Model must exist for the selected input file."); - renderReactCompilerMarkers({ monaco, model, details: errors }); + invariant(model, 'Model must exist for the selected input file.'); + renderReactCompilerMarkers({monaco, model, details: errors}); // N.B. that `tabSize` is a model property, not an editor property. // So, the tab size has to be set per model. - model.updateOptions({ tabSize: 2 }); + model.updateOptions({tabSize: 2}); }, [monaco, errors]); const flowDiagnosticDisable = [ @@ -64,11 +64,11 @@ export default function Input({ errors, language }: Props) { 8011, 8012, 8013, - ...(language === "flow" ? flowDiagnosticDisable : []), + ...(language === 'flow' ? flowDiagnosticDisable : []), ], noSemanticValidation: true, // Monaco can't validate Flow component syntax - noSyntaxValidation: language === "flow", + noSyntaxValidation: language === 'flow', }); }, [monaco, language]); @@ -76,7 +76,7 @@ export default function Input({ errors, language }: Props) { if (!value) return; dispatchStore({ - type: "updateFile", + type: 'updateFile', payload: { source: value, }, @@ -91,11 +91,11 @@ export default function Input({ errors, language }: Props) { target: monaco.languages.typescript.ScriptTarget.ES2015, moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs, jsx: monaco.languages.typescript.JsxEmit.Preserve, - typeRoots: ["node_modules/@types"], + typeRoots: ['node_modules/@types'], allowSyntheticDefaultImports: true, }; monaco.languages.typescript.javascriptDefaults.setCompilerOptions( - tscOptions + tscOptions, ); monaco.languages.typescript.typescriptDefaults.setCompilerOptions({ ...tscOptions, @@ -106,7 +106,7 @@ export default function Input({ errors, language }: Props) { // Add React type declarations to Monaco const reactLib = [ React$Types, - "file:///node_modules/@types/react/index.d.ts", + 'file:///node_modules/@types/react/index.d.ts', ] as [any, string]; monaco.languages.typescript.javascriptDefaults.addExtraLib(...reactLib); monaco.languages.typescript.typescriptDefaults.addExtraLib(...reactLib); @@ -124,17 +124,16 @@ export default function Input({ errors, language }: Props) {
+ className="!h-[calc(100vh_-_3.5rem)]"> } + | {kind: 'ok'; results: Map} | { - kind: "err"; + kind: 'err'; results: Map; error: CompilerError; }; @@ -63,7 +63,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { for (const [passName, results] of compilerOutput.results) { for (const result of results) { switch (result.kind) { - case "hir": { + case 'hir': { const prev = concattedResults.get(result.name); const next = result.value; const identName = `function ${result.fnName}`; @@ -74,7 +74,7 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { } break; } - case "reactive": { + case 'reactive': { const prev = concattedResults.get(passName); const next = result.value; if (prev != null) { @@ -84,30 +84,29 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { } break; } - case "ast": + case 'ast': topLevelFnDecls.push(result.value); break; - case "debug": { + case 'debug': { concattedResults.set(passName, result.value); break; } default: { const _: never = result; - throw new Error("Unexpected result kind"); + throw new Error('Unexpected result kind'); } } } } let lastPassOutput: string | null = null; - let nonDiffPasses = ["HIR", "BuildReactiveFunction", "EnvironmentConfig"]; + let nonDiffPasses = ['HIR', 'BuildReactiveFunction', 'EnvironmentConfig']; for (const [passName, text] of concattedResults) { tabs.set( passName, + showInfoPanel={!nonDiffPasses.includes(passName)}>, ); lastPassOutput = text; } @@ -116,25 +115,24 @@ async function tabify(source: string, compilerOutput: CompilerOutput) { // Make a synthetic Program so we can have a single AST with all the top level // FunctionDeclarations const ast = t.program(topLevelFnDecls); - const { code, sourceMapUrl } = await codegen(ast, source); + const {code, sourceMapUrl} = await codegen(ast, source); reorderedTabs.set( - "JS", + 'JS', + showInfoPanel={false}>, ); if (sourceMapUrl) { reorderedTabs.set( - "SourceMap", + 'SourceMap', <>