├── .nvmrc
├── .watchmanconfig
├── compiler
├── fixtures
│ └── .gitkeep
├── rust-toolchain.toml
├── scripts
│ └── release
│ │ └── ci-npmrc
├── apps
│ └── playground
│ │ ├── .eslintrc.json
│ │ ├── .vscode
│ │ └── extensions.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── graphvizlib.wasm
│ │ ├── icon-180x180.png
│ │ └── fonts
│ │ │ └── Source-Code-Pro-Regular.woff2
│ │ └── __tests__
│ │ └── e2e
│ │ └── __snapshots__
│ │ └── page.spec.ts
│ │ ├── module-scope-use-no-memo-output.txt
│ │ └── todo-function-scope-does-not-beat-module-scope-output.txt
├── packages
│ ├── make-read-only-util
│ │ ├── .gitignore
│ │ └── README.md
│ ├── babel-plugin-react-compiler
│ │ └── src
│ │ │ └── __tests__
│ │ │ └── fixtures
│ │ │ └── compiler
│ │ │ ├── optional-call-simple.js
│ │ │ ├── error.mutate-props.js
│ │ │ ├── loop-unused-let.js
│ │ │ ├── error.invalid-reassign-const.js
│ │ │ ├── error.mutate-hook-argument.js
│ │ │ ├── error.invalid-pass-hook-as-call-arg.js
│ │ │ ├── error.propertyload-hook.js
│ │ │ ├── rules-of-hooks
│ │ │ ├── error.invalid-hook-as-prop.js
│ │ │ ├── rules-of-hooks-2e405c78cb80.js
│ │ │ ├── rules-of-hooks-844a496db20b.js
│ │ │ ├── rules-of-hooks-1ff6c3fbbc94.js
│ │ │ ├── rules-of-hooks-9d7879272ff6.js
│ │ │ ├── rules-of-hooks-cfdfe5572fc7.js
│ │ │ ├── error.invalid-hook-optionalcall.js
│ │ │ ├── rules-of-hooks-23dc7fffde57.js
│ │ │ ├── error.invalid-conditionally-call-prop-named-like-hook.js
│ │ │ ├── error.invalid-hook-as-conditional-test.js
│ │ │ ├── error.invalid-hook-after-early-return.js
│ │ │ ├── error.invalid-hook-optional-methodcall.js
│ │ │ ├── error.invalid-hook-optional-property.js
│ │ │ ├── rules-of-hooks-7e52f5eec669.js
│ │ │ ├── error.invalid-hook-reassigned-in-conditional.js
│ │ │ ├── rules-of-hooks-347b0dae66f1.js
│ │ │ ├── error.invalid-hook-from-hook-return.js
│ │ │ ├── error.invalid-hook-if-consequent.js
│ │ │ ├── todo.invalid.invalid-rules-of-hooks-ddeca9708b63.js
│ │ │ ├── todo.invalid.invalid-rules-of-hooks-2c51251df67a.js
│ │ │ ├── todo.invalid.invalid-rules-of-hooks-9c79feec4b9b.js
│ │ │ ├── error.invalid-hook-from-property-of-other-hook.js
│ │ │ ├── error.invalid-hook-if-alternate.js
│ │ │ ├── rules-of-hooks-c5d1f3143c4c.js
│ │ │ └── todo.invalid.invalid-rules-of-hooks-e69ffce323c3.js
│ │ │ ├── error.invalid-pass-hook-as-prop.js
│ │ │ ├── infer-function-React-memo.js
│ │ │ ├── issue852.js
│ │ │ ├── optional-call-chained.js
│ │ │ ├── optional-computed-load-static.js
│ │ │ ├── call-spread.js
│ │ │ ├── infer-functions-hook-with-jsx.js
│ │ │ ├── error.invalid-destructure-assignment-to-global.js
│ │ │ ├── error.store-property-in-global.js
│ │ │ ├── infer-function-assignment.js
│ │ │ ├── infer-function-forwardRef.js
│ │ │ ├── store-via-call.js
│ │ │ ├── store-via-new.js
│ │ │ ├── useMemo-simple.js
│ │ │ ├── await.js
│ │ │ ├── error.invalid-useMemo-callback-args.js
│ │ │ ├── error.mutate-property-from-global.js
│ │ │ ├── infer-functions-component-with-jsx.js
│ │ │ ├── new-spread.js
│ │ │ ├── allow-passing-refs-as-props.js
│ │ │ ├── error.gating-use-before-decl.js
│ │ │ ├── property-call-spread.js
│ │ │ ├── simple.js
│ │ │ ├── call-args-assignment.js
│ │ │ ├── error.invalid-ternary-with-hook-values.js
│ │ │ ├── error.nomemo-and-change-detect.js
│ │ │ ├── error.todo-hoist-function-decls.js
│ │ │ ├── infer-property-delete.js
│ │ │ ├── ssa-property-mutate-2.js
│ │ │ ├── ssa-property-mutate.js
│ │ │ ├── useMemo-return-empty.js
│ │ │ ├── computed-call-spread.js
│ │ │ ├── error.capitalized-function-call-aliased.js
│ │ │ ├── await-side-effecting-promise.js
│ │ │ ├── capturing-function-runs-inference.js
│ │ │ ├── computed-store-alias.js
│ │ │ ├── optional-call-with-optional-property-load.js
│ │ │ ├── optional-computed-member-expression.js
│ │ │ ├── optional-member-expression-call-as-property.js
│ │ │ ├── alias-computed-load.js
│ │ │ ├── call-args-destructuring-assignment.js
│ │ │ ├── codegen-emit-imports-same-source.js
│ │ │ ├── error.capitalized-function-call.js
│ │ │ ├── error.component-syntax-ref-gating.flow.js
│ │ │ ├── error.invalid-assign-hook-to-local.js
│ │ │ ├── error.invalid-reassign-local-in-hook-return-value.js
│ │ │ ├── error.mutate-global-increment-op-invalid-react.js
│ │ │ ├── jsx-spread.js
│ │ │ ├── object-properties.js
│ │ │ ├── optional-member-expression.js
│ │ │ ├── type-binary-operator.js
│ │ │ ├── error.capitalized-method-call.js
│ │ │ ├── error.invalid-array-push-frozen.js
│ │ │ ├── error.invalid-destructure-to-local-global-variables.js
│ │ │ ├── error.invalid-useMemo-async-callback.js
│ │ │ ├── error.reassignment-to-global.js
│ │ │ ├── infer-function-expression-component.js
│ │ │ ├── uninitialized-declaration-in-reactive-scope.js
│ │ │ ├── error.assign-global-in-component-tag-function.js
│ │ │ ├── infer-computed-delete.js
│ │ │ ├── repro-no-gating-import-without-compiled-functions.js
│ │ │ ├── arrow-function-expr-gating-test.js
│ │ │ ├── concise-arrow-expr.js
│ │ │ ├── error.call-args-destructuring-asignment-complex.js
│ │ │ ├── error.invalid-ReactUseMemo-async-callback.js
│ │ │ ├── error.not-useEffect-external-mutate.js
│ │ │ ├── error.todo-useMemo-with-optional.js
│ │ │ ├── fbt
│ │ │ └── error.todo-locally-require-fbt.js
│ │ │ ├── nested-scopes-hook-call.js
│ │ │ ├── ssa-newexpression.js
│ │ │ ├── error.assign-global-in-jsx-spread-attribute.js
│ │ │ ├── error.bailout-on-flow-suppression.js
│ │ │ ├── error.conditional-hooks-as-method-call.js
│ │ │ ├── error.modify-state.js
│ │ │ ├── infer-functions-component-with-hook-call.js
│ │ │ ├── infer-functions-hook-with-hook-call.js
│ │ │ ├── jsx-member-expression.js
│ │ │ ├── reactive-dependencies-non-optional-properties-inside-optional-chain.js
│ │ │ ├── tagged-template-literal.js
│ │ │ ├── use-no-memo-module-level.js
│ │ │ ├── capturing-function-shadow-captured.js
│ │ │ ├── error.gating-hoisting.js
│ │ │ ├── error.invalid-mutate-context.js
│ │ │ ├── lower-context-selector-simple.js
│ │ │ ├── transform-fire
│ │ │ └── use-effect-no-args-no-op.js
│ │ │ ├── use-no-forget-module-level.js
│ │ │ ├── builtin-jsx-tag-lowered-between-mutations.js
│ │ │ ├── default-param-array-with-unary.js
│ │ │ ├── destructuring-property-inference.js
│ │ │ ├── error._todo.computed-lval-in-destructure.js
│ │ │ ├── error.invalid-ref-value-as-props.js
│ │ │ ├── error.todo-for-await-loops.js
│ │ │ ├── error.todo-new-target-meta-property.js
│ │ │ ├── jsx-member-expression-tag-grouping.js
│ │ │ ├── default-param-with-empty-callback.js
│ │ │ ├── do-while-early-unconditional-break.js
│ │ │ ├── error.invalid-computed-store-to-frozen-value.js
│ │ │ ├── error.invalid-delete-property-of-frozen-value.js
│ │ │ ├── error.invalid-property-store-to-frozen-value.js
│ │ │ ├── error.invalid-type-provider-hooklike-module-default-not-hook.js
│ │ │ ├── error.todo.try-catch-with-throw.js
│ │ │ ├── jsx-html-entity.js
│ │ │ ├── optional-member-expression-with-optional-member-expr-as-property.js
│ │ │ ├── temporary-accessed-outside-scope.js
│ │ │ ├── trivial.js
│ │ │ ├── unused-optional-method-assigned-to-variable.js
│ │ │ ├── unused-ternary-assigned-to-variable.js
│ │ │ ├── assignment-in-nested-if.js
│ │ │ ├── error.invalid-pass-ref-to-function.js
│ │ │ ├── error.invalid-type-provider-hook-name-not-typed-as-hook.js
│ │ │ ├── error.modify-useReducer-state.js
│ │ │ ├── preserve-jsxtext-stringliteral-distinction.js
│ │ │ ├── todo.lower-context-access-array-destructuring.js
│ │ │ ├── alias-nested-member-path-mutate.js
│ │ │ ├── array-join.js
│ │ │ ├── capturing-reference-changes-type.js
│ │ │ ├── error.conditional-hook-unknown-hook-react-namespace.js
│ │ │ ├── error.invalid-delete-computed-property-of-frozen-value.js
│ │ │ ├── obj-literal-cached-in-if-else.js
│ │ │ ├── ref-current-not-added-to-dep.js
│ │ │ ├── ref-current-write-not-added-to-dep.js
│ │ │ ├── ssa-simple.js
│ │ │ └── use-no-memo-module-scope-usememo-function-scope.js
│ └── react-compiler-healthcheck
│ │ └── src
│ │ └── config.ts
└── crates
│ ├── react_hermes_parser
│ ├── tests
│ │ └── fixtures
│ │ │ ├── trivial.js
│ │ │ ├── recursive-function-expr.js
│ │ │ ├── ssa-simple.js
│ │ │ ├── simple-scope.js
│ │ │ ├── destructuring-array-param-default.js
│ │ │ ├── optional-call-simple.js
│ │ │ ├── destructuring-object-param-default.js
│ │ │ ├── holey-array-expr.js
│ │ │ ├── error.invalid-pass-hook-as-call-arg.js
│ │ │ ├── expression-with-assignment.js
│ │ │ ├── while-break.js
│ │ │ ├── holey-array-pattern-dce.js
│ │ │ ├── error.invalid-pass-hook-as-prop.js
│ │ │ ├── expression-with-assignment-dynamic.js
│ │ │ ├── holey-array-pattern-dce-2.js
│ │ │ ├── optional-computed-load-static.js
│ │ │ ├── type-field-load.js
│ │ │ ├── type-test-primitive.js
│ │ │ ├── unused-object-element.js
│ │ │ ├── bug_object-pattern.js
│ │ │ ├── function-param-assignment-pattern.js
│ │ │ ├── issue852.js
│ │ │ ├── optional-call-chained.js
│ │ │ ├── ssa-property.js
│ │ │ ├── ssa-throw.js
│ │ │ ├── type-args-test-binary-operator.js
│ │ │ ├── unused-array-rest-element.js
│ │ │ ├── call-spread.js
│ │ │ ├── error.hooks-with-React-namespace.js
│ │ │ ├── for-return.js
│ │ │ ├── jsx-namespaced-name.js
│ │ │ ├── object-literal-spread-element.js
│ │ │ ├── ssa-reassign.js
│ │ │ ├── ssa-return.js
│ │ │ ├── store-via-call.js
│ │ │ ├── unused-array-middle-element.js
│ │ │ ├── unused-conditional.js
│ │ │ ├── useMemo-named-function.js
│ │ │ ├── useMemo-simple.js
│ │ │ ├── array-pattern-params.js
│ │ │ ├── destructuring-array-default.js
│ │ │ ├── error.invalid-destructure-assignment-to-global.js
│ │ │ ├── globals-Boolean.js
│ │ │ ├── globals-Number.js
│ │ │ ├── globals-String.js
│ │ │ ├── holey-array.js
│ │ │ ├── simple-function-1.js
│ │ │ ├── ssa-while.js
│ │ │ ├── store-via-new.js
│ │ │ ├── unused-logical.js
│ │ │ ├── useMemo-logical.js
│ │ │ ├── while-property.js
│ │ │ ├── allow-passing-refs-as-props.js
│ │ │ ├── assignment-variations.js
│ │ │ ├── await.js
│ │ │ ├── do-while-break.js
│ │ │ ├── error.invalid-useMemo-callback-args.js
│ │ │ ├── new-spread.js
│ │ │ ├── object-pattern-params.js
│ │ │ ├── overlapping-scopes-shadowed.js
│ │ │ ├── property-call-spread.js
│ │ │ ├── simple.js
│ │ │ ├── ssa-for.js
│ │ │ ├── ssa-property-call.js
│ │ │ ├── ssa-single-if.js
│ │ │ ├── debugger-memoized.js
│ │ │ ├── delete-property.js
│ │ │ ├── destructure-capture-global.js
│ │ │ ├── object-expression-string-literal-key.js
│ │ │ ├── overlapping-scopes-interleaved.js
│ │ │ ├── return-conditional.js
│ │ │ ├── ssa-property-mutate.js
│ │ │ ├── ssa-while-no-reassign.js
│ │ │ ├── useMemo-return-empty.js
│ │ │ ├── array-expression-spread.js
│ │ │ ├── call-args-assignment.js
│ │ │ ├── computed-call-spread.js
│ │ │ ├── destructuring-object-default.js
│ │ │ ├── error.invalid-ternary-with-hook-values.js
│ │ │ ├── for-of-break.js
│ │ │ ├── function-declaration-reassign.js
│ │ │ ├── infer-property-delete.js
│ │ │ ├── object-computed-access-assignment.js
│ │ │ ├── return-undefined.js
│ │ │ ├── ssa-arrayexpression.js
│ │ │ ├── ssa-property-mutate-2.js
│ │ │ ├── update-expression.js
│ │ │ ├── codegen-emit-imports-same-source.js
│ │ │ ├── early-return.js
│ │ │ ├── error.invalid-ref-value-as-props.js
│ │ │ ├── optional-call-with-optional-property-load.js
│ │ │ ├── ssa-objectexpression.js
│ │ │ ├── type-test-field-store.js
│ │ │ ├── await-side-effecting-promise.js
│ │ │ ├── capturing-function-runs-inference.js
│ │ │ ├── function-declaration-redeclare.js
│ │ │ ├── optional-computed-member-expression.js
│ │ │ ├── optional-member-expression-call-as-property.js
│ │ │ ├── ternary-assignment-expression.js
│ │ │ ├── type-binary-operator.js
│ │ │ ├── unconditional-break-label.js
│ │ │ ├── while-logical.js
│ │ │ ├── alias-computed-load.js
│ │ │ ├── assignment-variations-complex-lvalue.js
│ │ │ ├── call-args-destructuring-assignment.js
│ │ │ ├── capturing-arrow-function-1.js
│ │ │ ├── capturing-function-1.js
│ │ │ ├── capturing-function-decl.js
│ │ │ ├── computed-store-alias.js
│ │ │ ├── constant-propagation-for.js
│ │ │ ├── constant-propagation-while.js
│ │ │ ├── error.invalid-array-push-frozen.js
│ │ │ ├── error.invalid-assign-hook-to-local.js
│ │ │ ├── error.invalid-pass-ref-to-function.js
│ │ │ ├── error.mutate-global-increment-op-invalid-react.js
│ │ │ ├── error.reassignment-to-global.js
│ │ │ ├── jsx-empty-expression.js
│ │ │ ├── jsx-spread.js
│ │ │ ├── lambda-mutated-non-reactive-to-reactive.js
│ │ │ ├── object-properties.js
│ │ │ ├── optional-member-expression.js
│ │ │ ├── ssa-complex-single-if.js
│ │ │ ├── uninitialized-declaration-in-reactive-scope.js
│ │ │ ├── alias-nested-member-path.js
│ │ │ ├── capturing-member-expr.js
│ │ │ ├── error.invalid-destructure-to-local-global-variables.js
│ │ │ ├── error.invalid-useMemo-async-callback.js
│ │ │ ├── escape-analysis-not-conditional-test.js
│ │ │ ├── function-declaration-simple.js
│ │ │ ├── hook-inside-logical-expression.js
│ │ │ ├── infer-computed-delete.js
│ │ │ ├── overlapping-scopes-while.js
│ │ │ ├── array-map-frozen-array.js
│ │ │ ├── arrow-function-expr-gating-test.js
│ │ │ ├── assignment-expression-nested-path.js
│ │ │ ├── assignment-variations-complex-lvalue-array.js
│ │ │ ├── capturing-nested-member-call.js
│ │ │ ├── dce-loop.js
│ │ │ ├── nested-scopes-hook-call.js
│ │ │ ├── prop-capturing-function-1.js
│ │ │ ├── reassign-object-in-context.js
│ │ │ ├── reassign-primitive-in-context.js
│ │ │ ├── ssa-non-empty-initializer.js
│ │ │ ├── concise-arrow-expr.js
│ │ │ ├── delete-computed-property.js
│ │ │ ├── error.call-args-destructuring-asignment-complex.js
│ │ │ ├── reactive-dependencies-non-optional-properties-inside-optional-chain.js
│ │ │ ├── reactive-scope-grouping.js
│ │ │ ├── ssa-if-else.js
│ │ │ ├── ssa-newexpression.js
│ │ │ ├── ssa-simple-phi.js
│ │ │ ├── tagged-template-in-hook.js
│ │ │ ├── assignment-expression-computed.js
│ │ │ ├── capturing-func-mutate-nested.js
│ │ │ ├── capturing-nested-member-expr.js
│ │ │ ├── error.invalid-set-and-read-ref-during-render.js
│ │ │ ├── for-of-simple.js
│ │ │ ├── jsx-member-expression.js
│ │ │ ├── builtin-jsx-tag-lowered-between-mutations.js
│ │ │ ├── capturing-function-shadow-captured.js
│ │ │ ├── declare-reassign-variable-in-closure.js
│ │ │ ├── error.invalid-access-ref-during-render.js
│ │ │ ├── ssa-renaming-ternary.js
│ │ │ ├── const-propagation-into-function-expression-primitive.js
│ │ │ ├── constant-computed.js
│ │ │ ├── destructuring-property-inference.js
│ │ │ ├── error._todo.computed-lval-in-destructure.js
│ │ │ ├── error.hoisted-function-declaration.js
│ │ │ ├── error.invalid-property-store-to-frozen-value.js
│ │ │ ├── infer-phi-primitive.js
│ │ │ ├── jsx-member-expression-tag-grouping.js
│ │ │ ├── optional-call-logical.js
│ │ │ ├── optional-member-expression-with-optional-member-expr-as-property.js
│ │ │ ├── temporary-accessed-outside-scope.js
│ │ │ ├── unused-ternary-assigned-to-variable.js
│ │ │ ├── useMemo-inlining-block-return.js
│ │ │ ├── array-properties.js
│ │ │ ├── capturing-function-alias-computed-load.js
│ │ │ ├── do-while-early-unconditional-break.js
│ │ │ ├── error.invalid-computed-store-to-frozen-value.js
│ │ │ ├── error.invalid-delete-property-of-frozen-value.js
│ │ │ ├── ssa-for-trivial-update.js
│ │ │ ├── unused-optional-method-assigned-to-variable.js
│ │ │ ├── while-conditional-continue.js
│ │ │ ├── array-property-call.js
│ │ │ ├── assignment-in-nested-if.js
│ │ │ ├── capturing-func-alias-mutate.js
│ │ │ ├── capturing-func-simple-alias.js
│ │ │ ├── capturing-function-alias-computed-load-2.js
│ │ │ ├── capturing-function-alias-computed-load-4.js
│ │ │ ├── complex-while.js
│ │ │ ├── overlapping-scopes-interleaved-by-terminal.js
│ │ │ ├── ref-current-write-not-added-to-dep.js
│ │ │ ├── alias-nested-member-path-mutate.js
│ │ │ ├── array-access-assignment.js
│ │ │ ├── array-join.js
│ │ │ ├── capture_mutate-across-fns.js
│ │ │ ├── capturing-func-mutate-3.js
│ │ │ ├── capturing-function-skip-computed-path.js
│ │ │ ├── capturing-reference-changes-type.js
│ │ │ ├── capturing-variable-in-nested-block.js
│ │ │ ├── controlled-input.js
│ │ │ ├── error.invalid-delete-computed-property-of-frozen-value.js
│ │ │ ├── jsx-fragment.js
│ │ │ ├── obj-literal-cached-in-if-else.js
│ │ │ ├── ref-current-not-added-to-dep.js
│ │ │ ├── useMemo-labeled-statement-unconditional-return.js
│ │ │ ├── chained-assignment-expressions.js
│ │ │ ├── declare-reassign-variable-in-function-declaration.js
│ │ │ ├── error.codegen-error-on-conflicting-imports.js
│ │ │ ├── for-of-destructure.js
│ │ │ ├── inverted-if-else.js
│ │ │ ├── lambda-mutated-ref-non-reactive.js
│ │ │ ├── logical-expression.js
│ │ │ ├── ref-current-optional-field-no-added-to-dep.js
│ │ │ ├── ssa-complex-multiple-if.js
│ │ │ ├── ssa-for-of.js
│ │ │ ├── temporary-property-load-accessed-outside-scope.js
│ │ │ ├── capturing-func-alias-computed-mutate.js
│ │ │ ├── capturing-func-mutate-2.js
│ │ │ ├── capturing-function-within-block.js
│ │ │ ├── chained-assignment-context-variable.js
│ │ │ ├── constant-propagation-into-function-expressions.js
│ │ │ ├── jsx-tag-evaluation-order.js
│ │ │ ├── optional-call.js
│ │ │ ├── simple-alias.js
│ │ │ ├── ssa-property-alias-if.js
│ │ │ ├── ssa-property-alias-mutate.js
│ │ │ ├── ssa-property-mutate-alias.js
│ │ │ ├── ssa-reassign-in-rval.js
│ │ │ ├── ssa-renaming-ternary-destruction.js
│ │ │ ├── ssa-renaming-ternary-with-mutation.js
│ │ │ ├── ssa-renaming.js
│ │ │ ├── type-test-return-type-inference.js
│ │ │ ├── array-map-mutable-array-mutating-lambda.js
│ │ │ ├── call.js
│ │ │ ├── capturing-function-renamed-ref.js
│ │ │ ├── debugger.js
│ │ │ ├── do-while-simple.js
│ │ │ ├── escape-analysis-not-if-test.js
│ │ │ ├── for-empty-update-with-continue.js
│ │ │ ├── for-empty-update.js
│ │ │ ├── inverted-if.js
│ │ │ ├── unused-object-element-with-rest.js
│ │ │ ├── use-callback-simple.js
│ │ │ ├── useMemo-nested-ifs.js
│ │ │ ├── capturing-func-mutate.js
│ │ │ ├── capturing-variable-in-nested-function.js
│ │ │ ├── error.invalid-unconditional-set-state-in-render.js
│ │ │ ├── error.todo.destructure-assignment-to-context-var.js
│ │ │ ├── obj-literal-mutated-after-if-else.js
│ │ │ ├── obj-mutated-after-if-else.js
│ │ │ ├── optional-method-call.js
│ │ │ ├── primitive-alias-mutate.js
│ │ │ ├── ref-current-not-added-to-dep-2.js
│ │ │ ├── sequence-expression.js
│ │ │ ├── ssa-nested-partial-reassignment.js
│ │ │ ├── transitive-alias-fields.js
│ │ │ ├── capturing-func-alias-receiver-mutate.js
│ │ │ ├── for-of-conditional-break.js
│ │ │ ├── independently-memoize-object-property.js
│ │ │ ├── sketchy-code-rules-of-hooks.js
│ │ │ └── unused-logical-assigned-to-variable.js
│ └── README.md
│ ├── react_fixtures
│ ├── tests
│ │ └── fixtures
│ │ │ ├── error.assign-to-global.js
│ │ │ ├── simple.js
│ │ │ ├── if-statement.js
│ │ │ ├── destructure-array.js
│ │ │ ├── for-statement.js
│ │ │ ├── simple-ssa.js
│ │ │ ├── use-memo.js
│ │ │ └── simple-function.js
│ ├── README.md
│ └── src
│ │ └── lib.rs
│ ├── react_build_hir
│ └── README.md
│ ├── react_optimization
│ └── README.md
│ ├── react_ssa
│ └── README.md
│ ├── react_semantic_analysis
│ └── tests
│ │ └── fixtures
│ │ ├── let-const-hoisting.js
│ │ └── simple-function.js
│ └── react_estree_codegen
│ └── README.md
├── .gitattributes
├── fixtures
├── art
│ ├── .gitignore
│ ├── README.md
│ └── app.js
├── flight
│ ├── .nvmrc
│ ├── src
│ │ ├── cjs
│ │ │ ├── package.json
│ │ │ └── Counter3.js
│ │ ├── style.css
│ │ ├── Counter2.js
│ │ ├── Container.js
│ │ └── ServerState.js
│ ├── config
│ │ └── package.json
│ ├── loader
│ │ └── package.json
│ ├── scripts
│ │ └── package.json
│ ├── server
│ │ └── package.json
│ └── public
│ │ └── favicon.ico
├── flight-esm
│ ├── .nvmrc
│ ├── loader
│ │ └── package.json
│ ├── server
│ │ └── package.json
│ ├── src
│ │ ├── style.css
│ │ └── ServerState.js
│ └── public
│ │ └── favicon.ico
├── packaging
│ ├── rjs
│ │ ├── dev
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ ├── input.js
│ │ │ └── package.json
│ │ └── prod
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ ├── input.js
│ │ │ └── package.json
│ ├── webpack
│ │ ├── dev
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ │ └── prod
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ ├── browserify
│ │ ├── dev
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ │ └── prod
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ ├── webpack-alias
│ │ ├── dev
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ │ └── prod
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ ├── systemjs-builder
│ │ ├── dev
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ │ └── prod
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ └── input.js
│ └── brunch
│ │ ├── dev
│ │ ├── .gitignore
│ │ ├── index.html
│ │ ├── config.js
│ │ ├── input.js
│ │ └── app
│ │ │ └── initialize.js
│ │ └── prod
│ │ ├── .gitignore
│ │ ├── index.html
│ │ ├── config.js
│ │ ├── input.js
│ │ └── app
│ │ └── initialize.js
├── nesting
│ ├── .eslintignore
│ ├── src
│ │ ├── index.js
│ │ └── shared
│ │ │ ├── ThemeContext.js
│ │ │ └── Clock.js
│ └── .env
├── fiber-debugger
│ ├── .env
│ ├── public
│ │ └── favicon.ico
│ └── src
│ │ └── index.js
├── devtools
│ └── scheduling-profiler
│ │ └── .gitignore
├── eslint
│ ├── proxy
│ │ └── package.json
│ └── watch.sh
├── dom
│ └── public
│ │ ├── test.mp4
│ │ └── favicon.ico
├── flight-parcel
│ ├── .gitignore
│ └── .parcelrc
├── ssr
│ └── public
│ │ └── favicon.ico
├── attribute-behavior
│ ├── public
│ │ └── favicon.ico
│ └── src
│ │ ├── index.css
│ │ └── index.js
├── legacy-jsx-runtimes
│ ├── react-15
│ │ └── package.json
│ ├── react-14
│ │ └── package.json
│ ├── react-16
│ │ └── package.json
│ └── react-17
│ │ └── package.json
├── concurrent
│ └── time-slicing
│ │ └── public
│ │ └── favicon.ico
└── stacks
│ └── babel.config.json
├── scripts
├── release
│ ├── .gitignore
│ └── ci-npmrc
├── devtools
│ └── .gitignore
├── bench
│ ├── .gitignore
│ └── benchmarks
│ │ └── hacker-news
│ │ ├── logo.png
│ │ └── grayarrow.gif
├── perf-counters
│ ├── index.js
│ └── Makefile
├── eslint-rules
│ └── package.json
├── jest
│ ├── dont-run-jest-directly.js
│ ├── setupTests.build.js
│ └── setupTests.persistent.js
├── ci
│ └── test_print_warnings.sh
└── rollup
│ └── externs
│ └── closure-externs.js
├── packages
├── internal-test-utils
│ ├── index.js
│ ├── package.json
│ └── shouldIgnoreConsoleWarn.js
├── react-server-dom-esm
│ ├── esm
│ │ └── package.json
│ ├── npm
│ │ ├── esm
│ │ │ └── package.json
│ │ ├── client.js
│ │ ├── server.js
│ │ └── static.js
│ └── README.md
├── react-devtools-core
│ ├── backend.js
│ └── standalone.js
├── react-server-dom-webpack
│ ├── esm
│ │ └── package.json
│ ├── npm
│ │ ├── esm
│ │ │ └── package.json
│ │ ├── client.js
│ │ ├── plugin.js
│ │ ├── node-register.js
│ │ ├── server.js
│ │ └── static.js
│ └── README.md
├── react-devtools-inline
│ ├── backend.js
│ ├── frontend.js
│ └── hookNames.js
├── react-devtools-shared
│ └── src
│ │ ├── __tests__
│ │ └── __mocks__
│ │ │ └── cssMock.js
│ │ └── devtools
│ │ └── views
│ │ ├── Profiler
│ │ ├── RootSelector.css
│ │ └── CommitRanked.css
│ │ ├── Components
│ │ ├── InspectedElementErrorBoundary.css
│ │ ├── LoadingAnimation.css
│ │ ├── InspectedElementStyleXPlugin.css
│ │ ├── constants.js
│ │ ├── KeyValueContextMenuContainer.css
│ │ ├── InspectedElementBadges.css
│ │ └── ExpandCollapseToggle.css
│ │ ├── Icon.css
│ │ ├── ButtonIcon.css
│ │ ├── ReactLogo.css
│ │ └── WarnIfLegacyBackendDetected.css
├── react-dom
│ └── npm
│ │ ├── server.js
│ │ ├── static.js
│ │ ├── client.react-server.js
│ │ ├── server.react-server.js
│ │ ├── static.react-server.js
│ │ ├── profiling.react-server.js
│ │ └── unstable_testing.react-server.js
├── jest-react
│ ├── README.md
│ └── npm
│ │ └── index.js
├── shared
│ └── package.json
├── react-server-dom-parcel
│ ├── npm
│ │ ├── client.js
│ │ ├── server.js
│ │ └── static.js
│ └── README.md
├── react-server-dom-turbopack
│ ├── npm
│ │ ├── client.js
│ │ ├── server.js
│ │ └── static.js
│ └── README.md
├── react-devtools
│ └── icons
│ │ └── icon128.png
├── react-suspense-test-utils
│ └── npm
│ │ └── index.js
├── dom-event-testing-library
│ └── package.json
├── react-devtools-extensions
│ ├── icons
│ │ ├── 16-deadcode.png
│ │ ├── 16-disabled.png
│ │ ├── 16-outdated.png
│ │ ├── 32-deadcode.png
│ │ ├── 32-disabled.png
│ │ ├── 32-outdated.png
│ │ ├── 48-deadcode.png
│ │ ├── 48-disabled.png
│ │ ├── 48-outdated.png
│ │ ├── 128-deadcode.png
│ │ ├── 128-disabled.png
│ │ ├── 128-outdated.png
│ │ ├── 128-production.png
│ │ ├── 128-restricted.png
│ │ ├── 128-unminified.png
│ │ ├── 16-development.png
│ │ ├── 16-production.png
│ │ ├── 16-restricted.png
│ │ ├── 16-unminified.png
│ │ ├── 32-development.png
│ │ ├── 32-production.png
│ │ ├── 32-restricted.png
│ │ ├── 32-unminified.png
│ │ ├── 48-development.png
│ │ ├── 48-production.png
│ │ ├── 48-restricted.png
│ │ ├── 48-unminified.png
│ │ └── 128-development.png
│ ├── edge
│ │ ├── now.json
│ │ └── deploy.js
│ ├── chrome
│ │ ├── now.json
│ │ └── deploy.js
│ ├── firefox
│ │ ├── now.json
│ │ └── deploy.js
│ └── main.html
├── react-devtools-timeline
│ └── src
│ │ └── CanvasPage.css
├── react-devtools-shell
│ └── constants.js
├── react-noop-renderer
│ └── README.md
├── react
│ └── npm
│ │ ├── index.js
│ │ └── jsx-runtime.js
├── react-reconciler
│ ├── src
│ │ └── __tests__
│ │ │ └── __snapshots__
│ │ │ └── ReactHooks-test.internal.js.snap
│ └── npm
│ │ └── index.js
├── react-art
│ └── npm
│ │ └── index.js
├── react-is
│ └── npm
│ │ └── index.js
├── scheduler
│ └── npm
│ │ └── index.js
├── react-cache
│ └── npm
│ │ └── index.js
├── react-markup
│ └── npm
│ │ └── index.js
├── react-server
│ └── npm
│ │ └── index.js
├── react-client
│ └── npm
│ │ └── flight.js
└── react-debug-tools
│ └── npm
│ └── index.js
├── .git-blame-ignore-revs
├── CONTRIBUTING.md
├── netlify.toml
└── .github
└── dependabot.yml
/.nvmrc:
--------------------------------------------------------------------------------
1 | v18.20.1
2 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/compiler/fixtures/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/fixtures/art/.gitignore:
--------------------------------------------------------------------------------
1 | bundle.js
--------------------------------------------------------------------------------
/fixtures/flight/.nvmrc:
--------------------------------------------------------------------------------
1 | v18
2 |
--------------------------------------------------------------------------------
/fixtures/flight-esm/.nvmrc:
--------------------------------------------------------------------------------
1 | v18
2 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/dev/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/prod/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/scripts/release/.gitignore:
--------------------------------------------------------------------------------
1 | .progress-estimator
--------------------------------------------------------------------------------
/fixtures/nesting/.eslintignore:
--------------------------------------------------------------------------------
1 | src/*/node_modules
2 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack/dev/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/fixtures/packaging/webpack/prod/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/fixtures/fiber-debugger/.env:
--------------------------------------------------------------------------------
1 | NODE_PATH=../../build/packages
--------------------------------------------------------------------------------
/fixtures/nesting/src/index.js:
--------------------------------------------------------------------------------
1 | import './modern/index';
2 |
--------------------------------------------------------------------------------
/fixtures/packaging/browserify/dev/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
2 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/dev/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/prod/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/compiler/rust-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "stable"
--------------------------------------------------------------------------------
/fixtures/packaging/browserify/prod/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
2 |
--------------------------------------------------------------------------------
/fixtures/packaging/systemjs-builder/dev/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/fixtures/packaging/systemjs-builder/prod/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
--------------------------------------------------------------------------------
/fixtures/devtools/scheduling-profiler/.gitignore:
--------------------------------------------------------------------------------
1 | dependencies
2 |
--------------------------------------------------------------------------------
/fixtures/flight/src/cjs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type":"commonjs"
3 | }
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/dev/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
2 | output.js.map
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/prod/.gitignore:
--------------------------------------------------------------------------------
1 | output.js
2 | output.js.map
--------------------------------------------------------------------------------
/fixtures/flight/config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/loader/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/scripts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/src/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Helvetica;
3 | }
--------------------------------------------------------------------------------
/scripts/devtools/.gitignore:
--------------------------------------------------------------------------------
1 | .build-metadata
2 | .progress-estimator
3 |
--------------------------------------------------------------------------------
/fixtures/flight-esm/loader/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight-esm/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight-esm/src/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Helvetica;
3 | }
--------------------------------------------------------------------------------
/fixtures/nesting/.env:
--------------------------------------------------------------------------------
1 | EXTEND_ESLINT=true
2 | SKIP_PREFLIGHT_CHECK=true
3 |
--------------------------------------------------------------------------------
/scripts/release/ci-npmrc:
--------------------------------------------------------------------------------
1 | //registry.npmjs.org/:_authToken=${NPM_TOKEN}
2 |
--------------------------------------------------------------------------------
/compiler/scripts/release/ci-npmrc:
--------------------------------------------------------------------------------
1 | //registry.npmjs.org/:_authToken=${NPM_TOKEN}
2 |
--------------------------------------------------------------------------------
/packages/internal-test-utils/index.js:
--------------------------------------------------------------------------------
1 | export * from './ReactInternalTestUtils';
2 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/esm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/src/Counter2.js:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | export * from './Counter.js';
4 |
--------------------------------------------------------------------------------
/packages/react-devtools-core/backend.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./dist/backend');
2 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/npm/esm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/esm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
4 |
--------------------------------------------------------------------------------
/scripts/bench/.gitignore:
--------------------------------------------------------------------------------
1 | react-dom.production.min.js
2 | react.production.min.js
3 |
--------------------------------------------------------------------------------
/compiler/apps/playground/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/eslint/proxy/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "version": "0.0.0"
4 | }
--------------------------------------------------------------------------------
/packages/react-devtools-core/standalone.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./dist/standalone');
2 |
--------------------------------------------------------------------------------
/packages/react-devtools-inline/backend.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./dist/backend');
2 |
--------------------------------------------------------------------------------
/packages/react-devtools-inline/frontend.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./dist/frontend');
2 |
--------------------------------------------------------------------------------
/packages/react-devtools-inline/hookNames.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./dist/hookNames');
2 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/__tests__/__mocks__/cssMock.js:
--------------------------------------------------------------------------------
1 | module.exports = {};
2 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/npm/esm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "module"
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/packages/make-read-only-util/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 | tsconfig.tsbuildinfo
4 |
--------------------------------------------------------------------------------
/packages/react-dom/npm/server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./server.node');
4 |
--------------------------------------------------------------------------------
/packages/react-dom/npm/static.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./static.node');
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/trivial.js:
--------------------------------------------------------------------------------
1 | function foo(x) {
2 | return x;
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/dom/public/test.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/dom/public/test.mp4
--------------------------------------------------------------------------------
/fixtures/flight-parcel/.gitignore:
--------------------------------------------------------------------------------
1 | .parcel-cache
2 | .DS_Store
3 | node_modules
4 | dist
5 | todos.json
6 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | c998bb1ed4b3285398c9c7797135d3f060243c6a
2 | fd2b3e13d330a4559f5aa21462e1cb2cbbcf144b
3 |
--------------------------------------------------------------------------------
/fixtures/dom/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/dom/public/favicon.ico
--------------------------------------------------------------------------------
/fixtures/ssr/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/ssr/public/favicon.ico
--------------------------------------------------------------------------------
/packages/jest-react/README.md:
--------------------------------------------------------------------------------
1 | # `jest-react`
2 |
3 | Jest matchers and utilities for testing React Test Renderer.
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Profiler/RootSelector.css:
--------------------------------------------------------------------------------
1 | .Spacer {
2 | flex: 1;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/shared/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "shared",
4 | "version": "0.0.0"
5 | }
6 |
--------------------------------------------------------------------------------
/scripts/perf-counters/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('bindings')('perfcounters');
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/error.assign-to-global.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | x = true;
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/flight/public/favicon.ico
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/npm/client.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./client.browser');
4 |
--------------------------------------------------------------------------------
/scripts/eslint-rules/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "eslint-plugin-react-internal",
3 | "version": "0.0.0"
4 | }
5 |
--------------------------------------------------------------------------------
/packages/react-server-dom-parcel/npm/client.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./client.browser');
4 |
--------------------------------------------------------------------------------
/packages/react-server-dom-turbopack/npm/client.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./client.browser');
4 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/npm/client.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./client.browser');
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/recursive-function-expr.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | (() => foo())();
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-simple.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | let y = 2;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/flight-esm/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/flight-esm/public/favicon.ico
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/simple-scope.js:
--------------------------------------------------------------------------------
1 | function foo(a) {
2 | const x = [a.b];
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementErrorBoundary.css:
--------------------------------------------------------------------------------
1 | .Wrapper {
2 | height: 100%;
3 | }
--------------------------------------------------------------------------------
/packages/react-devtools/icons/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools/icons/icon128.png
--------------------------------------------------------------------------------
/compiler/apps/playground/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["bradlc.vscode-tailwindcss", "heybourn.headwind"]
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/apps/playground/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/compiler/apps/playground/public/favicon.ico
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/README.md:
--------------------------------------------------------------------------------
1 | # fixtures
2 |
3 | This crate is for tests only, and runs the suite of compiler fixture tests.
--------------------------------------------------------------------------------
/fixtures/fiber-debugger/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/fiber-debugger/public/favicon.ico
--------------------------------------------------------------------------------
/fixtures/flight-parcel/.parcelrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@parcel/config-default",
3 | "runtimes": ["...", "@parcel/runtime-rsc"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/internal-test-utils/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "internal-test-utils",
4 | "version": "0.0.0"
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-suspense-test-utils/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./cjs/react-suspense-test-utils.js');
4 |
--------------------------------------------------------------------------------
/scripts/jest/dont-run-jest-directly.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error("Don't run `jest` directly. Run `yarn test` instead.");
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/destructuring-array-param-default.js:
--------------------------------------------------------------------------------
1 | function Component([a = 2]) {
2 | return a;
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-call-simple.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return foo?.(props);
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/attribute-behavior/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/attribute-behavior/public/favicon.ico
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-15/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "react": "15",
4 | "react-dom": "15"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Icon.css:
--------------------------------------------------------------------------------
1 | .Icon {
2 | width: 1rem;
3 | height: 1rem;
4 | fill: currentColor;
5 | }
6 |
--------------------------------------------------------------------------------
/scripts/bench/benchmarks/hacker-news/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/scripts/bench/benchmarks/hacker-news/logo.png
--------------------------------------------------------------------------------
/compiler/apps/playground/public/graphvizlib.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/compiler/apps/playground/public/graphvizlib.wasm
--------------------------------------------------------------------------------
/compiler/apps/playground/public/icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/compiler/apps/playground/public/icon-180x180.png
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/destructuring-object-param-default.js:
--------------------------------------------------------------------------------
1 | function Component({ a = 2 }) {
2 | return a;
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/holey-array-expr.js:
--------------------------------------------------------------------------------
1 | function t(props) {
2 | let x = [, foo, props];
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-14/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "react": "0.14",
4 | "react-dom": "0.14"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/npm/plugin.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./cjs/react-server-dom-webpack-plugin.js');
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-pass-hook-as-call-arg.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return foo(useFoo);
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/expression-with-assignment.js:
--------------------------------------------------------------------------------
1 | function f() {
2 | let x = 1;
3 | return x + (x = 2) + x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/while-break.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | while (a) {
3 | break;
4 | }
5 | return b;
6 | }
7 |
--------------------------------------------------------------------------------
/fixtures/concurrent/time-slicing/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/fixtures/concurrent/time-slicing/public/favicon.ico
--------------------------------------------------------------------------------
/packages/dom-event-testing-library/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "dom-event-testing-library",
4 | "version": "0.0.0"
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/ButtonIcon.css:
--------------------------------------------------------------------------------
1 | .ButtonIcon {
2 | width: 1rem;
3 | height: 1rem;
4 | fill: currentColor;
5 | }
6 |
--------------------------------------------------------------------------------
/scripts/bench/benchmarks/hacker-news/grayarrow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/scripts/bench/benchmarks/hacker-news/grayarrow.gif
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/simple.js:
--------------------------------------------------------------------------------
1 | function test() {
2 | [true, false, null, 1, 3.14, ...["hello world!"]];
3 | return 2;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/holey-array-pattern-dce.js:
--------------------------------------------------------------------------------
1 | function t(props) {
2 | let [, foo, bar] = props;
3 | return foo;
4 | }
5 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Profiler/CommitRanked.css:
--------------------------------------------------------------------------------
1 | .Container {
2 | width: 100%;
3 | flex: 1;
4 | padding: 0.5rem;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/npm/node-register.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = require('./cjs/react-server-dom-webpack-node-register.js');
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/README.md:
--------------------------------------------------------------------------------
1 | # react_hermes_parser
2 |
3 | Wrapper around the Hermes parser that exposes parse results as a `react_estree` AST.
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-pass-hook-as-prop.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return ;
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/expression-with-assignment-dynamic.js:
--------------------------------------------------------------------------------
1 | function f(y) {
2 | let x = y;
3 | return x + (x = 2) + x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/holey-array-pattern-dce-2.js:
--------------------------------------------------------------------------------
1 | function t(props) {
2 | let [foo, bar, ,] = props;
3 | return foo;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-computed-load-static.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = a?.b.c[0];
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/type-field-load.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = { t: 1 };
3 | let p = x.t;
4 | return p;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/type-test-primitive.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = 1;
3 | let y = 2;
4 |
5 | return y;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-object-element.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | const { x, y, ...z } = props.a;
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/attribute-behavior/src/index.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | body {
6 | font-family: monospace;
7 | font-size: 12px;
8 | }
9 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-deadcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-deadcode.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-disabled.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-outdated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-outdated.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-deadcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-deadcode.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-disabled.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-outdated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-outdated.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-deadcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-deadcode.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-disabled.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-outdated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-outdated.png
--------------------------------------------------------------------------------
/packages/react-devtools-timeline/src/CanvasPage.css:
--------------------------------------------------------------------------------
1 | .CanvasPage {
2 | position: absolute;
3 | top: 0;
4 | bottom: 0;
5 | left: 0;
6 | right: 0;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/bug_object-pattern.js:
--------------------------------------------------------------------------------
1 | function component(t) {
2 | let { a } = t;
3 | let y = { a };
4 | return y;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/function-param-assignment-pattern.js:
--------------------------------------------------------------------------------
1 | function Component(x = "default", y = [{}]) {
2 | return [x, y];
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/issue852.js:
--------------------------------------------------------------------------------
1 | function Component(c) {
2 | let x = { c };
3 | mutate(x);
4 | let a = x;
5 | let b = a;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-call-chained.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return call?.(props.a)?.(props.b)?.(props.c);
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = {};
4 | y.x = x;
5 | return y;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-throw.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | if (x === 1) {
4 | x = 2;
5 | }
6 | throw x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/type-args-test-binary-operator.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | if (a > b) {
3 | let m = {};
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-array-rest-element.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | const [x, y, ...z] = props.a;
3 | return x + y;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-simple.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return foo?.(props);
3 | }
4 |
--------------------------------------------------------------------------------
/fixtures/flight/src/Container.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | export default function Container({children}) {
4 | return {children}
;
5 | }
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/browserify/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/browserify/prod/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack/prod/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-deadcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-deadcode.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-disabled.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-outdated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-outdated.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-production.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-production.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-restricted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-restricted.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-unminified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-unminified.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-development.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-development.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-production.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-production.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-restricted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-restricted.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/16-unminified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/16-unminified.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-development.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-development.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-production.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-production.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-restricted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-restricted.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/32-unminified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/32-unminified.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-development.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-development.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-production.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-production.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-restricted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-restricted.png
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/48-unminified.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/48-unminified.png
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/LoadingAnimation.css:
--------------------------------------------------------------------------------
1 | .Icon {
2 | width: 1rem;
3 | height: 1rem;
4 | fill: currentColor;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-dom/npm/client.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'react-dom/client is not supported in React Server Components.'
5 | );
6 |
--------------------------------------------------------------------------------
/packages/react-dom/npm/server.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'react-dom/server is not supported in React Server Components.'
5 | );
6 |
--------------------------------------------------------------------------------
/packages/react-dom/npm/static.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'react-dom/static is not supported in React Server Components.'
5 | );
6 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/README.md:
--------------------------------------------------------------------------------
1 | # react-server-dom-esm
2 |
3 | Experimental React Flight bindings for DOM using ESM.
4 |
5 | **Use it at your own risk.**
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_build_hir/README.md:
--------------------------------------------------------------------------------
1 | # Build-HIR
2 |
3 | This crate converts from `react_estree` into React Compiler's HIR format as the first phase of compilation.
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/call-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = foo(...props.a, null, ...props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.hooks-with-React-namespace.js:
--------------------------------------------------------------------------------
1 | function Foo() {
2 | const [x, setX] = React.useState(1);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-return.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | for (let i = 0; i < props.count; i++) {
3 | return;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-namespaced-name.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return ;
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/object-literal-spread-element.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = { ...props.foo };
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-reassign.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | let x = 0;
3 | x = a;
4 | x = b;
5 | x = c;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-return.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | if (x === 1) {
4 | x = 2;
5 | }
6 |
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/store-via-call.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = {};
3 | const y = foo(x);
4 | y.mutate();
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-array-middle-element.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | const [x, unused, y] = props.a;
3 | return x + y;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-conditional.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = 0;
3 | (x = 1) && (x = 2);
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-named-function.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useMemo(someHelper, []);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-simple.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = useMemo(() => [a], [a]);
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.mutate-props.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | props.test = 1;
3 | return null;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/loop-unused-let.js:
--------------------------------------------------------------------------------
1 | function useFoo() {
2 | while (1) {
3 | let foo;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/react-compiler-healthcheck/src/config.ts:
--------------------------------------------------------------------------------
1 | export const config = {
2 | knownIncompatibleLibraries: ['mobx', '@risingstack/react-easy-state'],
3 | };
4 |
--------------------------------------------------------------------------------
/fixtures/flight/src/cjs/Counter3.js:
--------------------------------------------------------------------------------
1 | "use client";
2 | // CJS-ESM async module
3 | module.exports = import('../Counter.js').then(m => {
4 | return m.Counter
5 | });
6 |
--------------------------------------------------------------------------------
/fixtures/nesting/src/shared/ThemeContext.js:
--------------------------------------------------------------------------------
1 | import {createContext} from 'react';
2 |
3 | const ThemeContext = createContext(null);
4 |
5 | export default ThemeContext;
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/systemjs-builder/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/systemjs-builder/prod/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/prod/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/packages/internal-test-utils/shouldIgnoreConsoleWarn.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function shouldIgnoreConsoleWarn(format) {
4 | return false;
5 | };
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/icons/128-development.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/packages/react-devtools-extensions/icons/128-development.png
--------------------------------------------------------------------------------
/packages/react-dom/npm/profiling.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'react-dom/profiling is not supported in React Server Components.'
5 | );
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/if-statement.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | if (a) {
3 | return b;
4 | } else {
5 | c;
6 | }
7 | d;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-pattern-params.js:
--------------------------------------------------------------------------------
1 | function component([a, b]) {
2 | let y = { a };
3 | let z = { b };
4 | return [y, z];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/destructuring-array-default.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const [[x] = ["default"]] = props.y;
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-destructure-assignment-to-global.js:
--------------------------------------------------------------------------------
1 | function useFoo(props) {
2 | [x] = props;
3 | return { x };
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/globals-Boolean.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = {};
3 | const y = Boolean(x);
4 | return [x, y];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/globals-Number.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = {};
3 | const y = Number(x);
4 | return [x, y];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/globals-String.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = {};
3 | const y = String(x);
4 | return [x, y];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/holey-array.js:
--------------------------------------------------------------------------------
1 | function t(props) {
2 | let [, setstate] = useState();
3 | setstate(1);
4 | return props.foo;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/simple-function-1.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = function (a) {
3 | a.foo();
4 | };
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-while.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | while (x < 10) {
4 | x = x + 1;
5 | }
6 |
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/store-via-new.js:
--------------------------------------------------------------------------------
1 | function Foo() {
2 | const x = {};
3 | const y = new Foo(x);
4 | y.mutate();
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-logical.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = 0;
3 | props.cond ? (x = 1) : (x = 2);
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-logical.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useMemo(() => props.a && props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/while-property.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | let x = 0;
3 | while (a.b.c) {
4 | x += b;
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_optimization/README.md:
--------------------------------------------------------------------------------
1 | # react_optimization
2 |
3 | Compiler passes that apply various optimizations to improve the performance and/or size of the program.
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-reassign-const.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const x = 0;
3 | x = 1;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.mutate-hook-argument.js:
--------------------------------------------------------------------------------
1 | function useHook(a, b) {
2 | b.test = 1;
3 | a.test = 2;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-16/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "prop-types": "^15.7.2",
4 | "react": "16",
5 | "react-dom": "16"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-server-dom-parcel/README.md:
--------------------------------------------------------------------------------
1 | # react-server-dom-parcel
2 |
3 | Experimental React Flight bindings for DOM using Parcel.
4 |
5 | **Use it at your own risk.**
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/allow-passing-refs-as-props.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const ref = useRef(null);
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/assignment-variations.js:
--------------------------------------------------------------------------------
1 | function f() {
2 | let x = 1;
3 | x = x + 1;
4 | x += 1;
5 | x >>>= 1;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/await.js:
--------------------------------------------------------------------------------
1 | async function Component(props) {
2 | const user = await load(props.id);
3 | return {user.name}
;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/do-while-break.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | do {
3 | break;
4 | } while (props.cond);
5 | return props;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-useMemo-callback-args.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let x = useMemo((c) => a, []);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/new-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = new Foo(...props.foo, null, ...[props.bar]);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/object-pattern-params.js:
--------------------------------------------------------------------------------
1 | function component({ a, b }) {
2 | let y = { a };
3 | let z = { b };
4 | return { y, z };
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/overlapping-scopes-shadowed.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | let x = [];
3 | let y = [];
4 | y.push(b);
5 | x.push(a);
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/property-call-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = foo.bar(...props.a, null, ...props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/simple.js:
--------------------------------------------------------------------------------
1 | export default function foo(x, y) {
2 | if (x) {
3 | return foo(false, y);
4 | }
5 | return [y * 10];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-for.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | for (let i = 0; i < 10; i++) {
4 | x += 1;
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property-call.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = { x: x };
4 | y.x.push([]);
5 | return y;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-single-if.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | let y = 2;
4 |
5 | if (y) {
6 | let z = x + y;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_ssa/README.md:
--------------------------------------------------------------------------------
1 | # react_ssa
2 |
3 | This crate handles conversion to/from SSA and normal form. This includes a pass to eliminate redundant phi nodes in SSA form.
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-call-arg.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return foo(useFoo);
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.propertyload-hook.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const x = Foo.useFoo;
3 | return x();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-as-prop.js:
--------------------------------------------------------------------------------
1 | function Component({useFoo}) {
2 | useFoo();
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/packages/make-read-only-util/README.md:
--------------------------------------------------------------------------------
1 | Utility package to track mutations to objects marked as "read-only".
2 | Available commands:
3 |
4 | - yarn build
5 | - yarn test
6 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/README.md:
--------------------------------------------------------------------------------
1 | # react-server-dom-webpack
2 |
3 | Experimental React Flight bindings for DOM using Webpack.
4 |
5 | **Use it at your own risk.**
6 |
--------------------------------------------------------------------------------
/scripts/ci/test_print_warnings.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | WARNINGS=$(node scripts/print-warnings/print-warnings.js)
6 | echo "$WARNINGS"
7 | test ! -z "$WARNINGS"
8 |
--------------------------------------------------------------------------------
/compiler/apps/playground/public/fonts/Source-Code-Pro-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Briagont/react/HEAD/compiler/apps/playground/public/fonts/Source-Code-Pro-Regular.woff2
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/debugger-memoized.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | debugger;
4 | x.push(props.value);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/delete-property.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = { a: props.a, b: props.b };
3 | delete x.b;
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/destructure-capture-global.js:
--------------------------------------------------------------------------------
1 | let someGlobal = {};
2 | function component(a) {
3 | let x = { a, someGlobal };
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/object-expression-string-literal-key.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = { ["foo"]: props.foo };
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/overlapping-scopes-interleaved.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | let x = [];
3 | let y = [];
4 | x.push(a);
5 | y.push(b);
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/return-conditional.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | if (a == null) {
3 | return null;
4 | } else {
5 | return b;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property-mutate.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = {};
4 | y.x = x;
5 | mutate(y);
6 | return y;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-while-no-reassign.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | while (x < 10) {
4 | x + 1;
5 | }
6 |
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-return-empty.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = useMemo(() => {
3 | mutate(a);
4 | }, []);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-pass-hook-as-prop.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return ;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/react-devtools-shell/constants.js:
--------------------------------------------------------------------------------
1 | const SUCCESSFUL_COMPILATION_MESSAGE = 'Compiled successfully.';
2 |
3 | module.exports = {
4 | SUCCESSFUL_COMPILATION_MESSAGE,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/react-dom/npm/unstable_testing.react-server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'react-dom/unstable_testing is not supported in React Server Components.'
5 | );
6 |
--------------------------------------------------------------------------------
/packages/react-server-dom-turbopack/README.md:
--------------------------------------------------------------------------------
1 | # react-server-dom-turbopack
2 |
3 | Experimental React Flight bindings for DOM using Turbopack.
4 |
5 | **Use it at your own risk.**
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/destructure-array.js:
--------------------------------------------------------------------------------
1 | function Component(a, b) {
2 | const [c, , ...d] = a;
3 | const [[[e]], ...[f]] = b;
4 | return [c, d, e, f];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/for-statement.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 0;
3 | for (let i = 0; i < 10; i = i + 1) {
4 | x = x + i;
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-expression-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [0, ...props.foo, null, ...props.bar, "z"];
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/call-args-assignment.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = makeObject();
3 | x.foo((x = makeObject()));
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/computed-call-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = foo[props.method](...props.a, null, ...props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/destructuring-object-default.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const { x: { y } = { y: "default" } } = props.y;
3 | return y;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-ternary-with-hook-values.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = props.cond ? useA : useB;
3 | return x();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-of-break.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const x = [];
3 | for (const item of [1, 2]) {
4 | break;
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/function-declaration-reassign.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | function x(a) {
3 | a.foo();
4 | }
5 | x = {};
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/infer-property-delete.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | const y = delete x.value;
4 | return y;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/object-computed-access-assignment.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | const x = { ...a };
3 | x[b] = c[b];
4 | x[1 + 2] = c[b * 4];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/return-undefined.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | if (props.cond) {
3 | return undefined;
4 | }
5 | return props.value;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-arrayexpression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const a = 1;
3 | const b = 2;
4 | const x = [a, b];
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property-mutate-2.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = {};
4 | y.x = x;
5 | mutate(x);
6 | return y;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/update-expression.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = props.x;
3 | let y = x++;
4 | let z = x--;
5 | return { x, y, z };
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-React-memo.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | React.memo(props => {
3 | return ;
4 | });
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/issue852.js:
--------------------------------------------------------------------------------
1 | function Component(c) {
2 | let x = {c};
3 | mutate(x);
4 | let a = x;
5 | let b = a;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-chained.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return call?.(props.a)?.(props.b)?.(props.c);
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-computed-load-static.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = a?.b.c[0];
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/scripts/rollup/externs/closure-externs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @externs
3 | */
4 | /* eslint-disable */
5 |
6 | 'use strict';
7 |
8 | /** @type {function} */
9 | var addEventListener;
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/codegen-emit-imports-same-source.js:
--------------------------------------------------------------------------------
1 | // @enableEmitFreeze @instrumentForget
2 |
3 | function useFoo(props) {
4 | return foo(props.x);
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/early-return.js:
--------------------------------------------------------------------------------
1 | function MyApp(props) {
2 | let res;
3 | if (props.cond) {
4 | return;
5 | } else {
6 | res = 1;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-ref-value-as-props.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const ref = useRef(null);
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-call-with-optional-property-load.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return props?.items?.map?.(render)?.filter(Boolean) ?? [];
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-objectexpression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const a = 1;
3 | const b = 2;
4 | const x = { a: a, b: b };
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/type-test-field-store.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = {};
3 | let q = {};
4 | x.t = q;
5 | let z = x.t;
6 | return z;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_semantic_analysis/tests/fixtures/let-const-hoisting.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | function foo() {
3 | a;
4 | b;
5 | }
6 | let a;
7 | const b = true;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = foo(...props.a, null, ...props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-functions-hook-with-jsx.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | function useDiv(props) {
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/legacy-jsx-runtimes/react-17/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "prop-types": "^15.7.2",
4 | "react": "17.0.0-rc.3",
5 | "react-dom": "17.0.0-rc.3"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/scripts/jest/setupTests.build.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | jest.mock('scheduler', () => jest.requireActual('scheduler/unstable_mock'));
4 |
5 | global.__unmockReact = () => jest.unmock('react');
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/await-side-effecting-promise.js:
--------------------------------------------------------------------------------
1 | async function Component(props) {
2 | const x = [];
3 | await populateData(props.id, x);
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-runs-inference.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let z = { a };
3 | let p = () => {z};
4 | return p();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/function-declaration-redeclare.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | function x(a) {
3 | a.foo();
4 | }
5 | function x() {}
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-computed-member-expression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const object = makeObject(props);
3 | return object?.[props.key];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-member-expression-call-as-property.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | return x?.[foo(props.value)];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ternary-assignment-expression.js:
--------------------------------------------------------------------------------
1 | function ternary(props) {
2 | let x = 0;
3 | const y = props.a ? (x = 1) : (x = 2);
4 | return x + y;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/type-binary-operator.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let a = some();
3 | let b = someOther();
4 | if (a > b) {
5 | let m = {};
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unconditional-break-label.js:
--------------------------------------------------------------------------------
1 | function foo(a) {
2 | let x = 0;
3 | bar: {
4 | x = 1;
5 | break bar;
6 | }
7 | return a + x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/while-logical.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = 0;
3 | while (x > props.min && x < props.max) {
4 | x *= 2;
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-destructure-assignment-to-global.js:
--------------------------------------------------------------------------------
1 | function useFoo(props) {
2 | [x] = props;
3 | return {x};
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.store-property-in-global.js:
--------------------------------------------------------------------------------
1 | let wat = {};
2 |
3 | function Foo() {
4 | wat.test = 1;
5 | return wat;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-assignment.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | const Component = props => {
3 | return ;
4 | };
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-forwardRef.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | React.forwardRef(props => {
3 | return ;
4 | });
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/store-via-call.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = {};
3 | const y = foo(x);
4 | y.mutate();
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/store-via-new.js:
--------------------------------------------------------------------------------
1 | function Foo() {
2 | const x = {};
3 | const y = new Foo(x);
4 | y.mutate();
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useMemo-simple.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = useMemo(() => [a], [a]);
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/simple-ssa.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let a;
3 | if (props) {
4 | a = 1;
5 | } else {
6 | a = 2;
7 | }
8 | return a;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/alias-computed-load.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = { a };
3 | let y = {};
4 |
5 | y.x = x["a"];
6 | mutate(y);
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/assignment-variations-complex-lvalue.js:
--------------------------------------------------------------------------------
1 | function g() {
2 | const x = { y: { z: 1 } };
3 | x.y.z = x.y.z + 1;
4 | x.y.z *= 2;
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/call-args-destructuring-assignment.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = makeObject();
3 | x.foo(([x] = makeObject()));
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-arrow-function-1.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x = () => {
4 | console.log(z);
5 | };
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-1.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x = function () {
4 | console.log(z);
5 | };
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-decl.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let t = { a };
3 | function x() {
4 | t.foo();
5 | }
6 | x(t);
7 | return t;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/computed-store-alias.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let y = { a };
3 | let x = { b };
4 | x["y"] = y;
5 | mutate(x);
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/constant-propagation-for.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let y = 0;
3 | for (const x = 100; x < 10; x) {
4 | y = y + 1;
5 | }
6 | return y;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/constant-propagation-while.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 100;
3 | let y = 0;
4 | while (x < 10) {
5 | y += 1;
6 | }
7 | return y;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-array-push-frozen.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | {x}
;
4 | x.push(props.value);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-assign-hook-to-local.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useState;
3 | const state = x(null);
4 | return state[0];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-pass-ref-to-function.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const ref = useRef(null);
3 | const x = foo(ref);
4 | return x.current;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.mutate-global-increment-op-invalid-react.js:
--------------------------------------------------------------------------------
1 | let renderCount = 0;
2 |
3 | function NoHooks() {
4 | renderCount++;
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.reassignment-to-global.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | // Cannot assign to globals
3 | someUnknownGlobal = true;
4 | moduleLocal = true;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-empty-expression.js:
--------------------------------------------------------------------------------
1 | export function Component(props) {
2 | return (
3 |
4 | {}
5 | {props.a}
6 |
7 | );
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return (
3 |
4 | );
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/lambda-mutated-non-reactive-to-reactive.js:
--------------------------------------------------------------------------------
1 | function f(a) {
2 | let x;
3 | (() => {
4 | x = { a };
5 | })();
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/object-properties.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | const x = a.x;
3 | const y = { ...b.c.d };
4 | y.z = c.d.e;
5 | foo(a.b.c);
6 | [a.b.c];
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-member-expression.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | let x = bar(props.a);
3 | let y = x?.b;
4 |
5 | let z = useBar(y);
6 | return z;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-complex-single-if.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | let y = 2;
4 | if (y === 2) {
5 | x = 3;
6 | }
7 |
8 | y = x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/uninitialized-declaration-in-reactive-scope.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = mutate();
3 | let y;
4 | foo(x);
5 | return [y, x];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/await.js:
--------------------------------------------------------------------------------
1 | async function Component(props) {
2 | const user = await load(props.id);
3 | return {user.name}
;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-useMemo-callback-args.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let x = useMemo(c => a, []);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.mutate-property-from-global.js:
--------------------------------------------------------------------------------
1 | let wat = {};
2 |
3 | function Foo() {
4 | delete wat.foo;
5 | return wat;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-functions-component-with-jsx.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | function Component(props) {
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = new Foo(...props.foo, null, ...[props.bar]);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/art/README.md:
--------------------------------------------------------------------------------
1 | # VectorWidget example
2 |
3 | To try this example, run:
4 |
5 | ```
6 | yarn
7 | yarn build
8 | ```
9 |
10 | in this directory, then open index.html in your browser.
11 |
--------------------------------------------------------------------------------
/fixtures/stacks/babel.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": [
3 | ["@babel/plugin-proposal-class-properties", {"loose": false}],
4 | ["@babel/plugin-transform-classes", {"loose": true}]
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/ReactLogo.css:
--------------------------------------------------------------------------------
1 | .ReactLogo {
2 | width: 1.75rem;
3 | height: 1.75rem;
4 | margin: 0 0.75rem 0 0.25rem;
5 | color: var(--color-button-active);
6 | }
7 |
--------------------------------------------------------------------------------
/scripts/jest/setupTests.persistent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | jest.mock('react-noop-renderer', () =>
4 | jest.requireActual('react-noop-renderer/persistent')
5 | );
6 |
7 | global.__PERSISTENT__ = true;
8 |
--------------------------------------------------------------------------------
/compiler/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/module-scope-use-no-memo-output.txt:
--------------------------------------------------------------------------------
1 | "use no memo";
2 | export default function TestComponent({ x }) {
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/use-memo.js:
--------------------------------------------------------------------------------
1 | import { useMemo } from "react";
2 |
3 | function Component(x) {
4 | const y = useMemo(() => {
5 | return x;
6 | });
7 | return y;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/alias-nested-member-path.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let z = [];
3 | let y = {};
4 | y.z = z;
5 | let x = {};
6 | x.y = y;
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-member-expr.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x = function () {
4 | console.log(z.a);
5 | };
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-destructure-to-local-global-variables.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let a;
3 | [a, b] = props.value;
4 |
5 | return [a, b];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-useMemo-async-callback.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let x = useMemo(async () => {
3 | await a;
4 | }, []);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/escape-analysis-not-conditional-test.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [props.a];
3 | const y = x ? props.b : props.c;
4 | return y;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/function-declaration-simple.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let t = { a };
3 | function x(p) {
4 | p.foo();
5 | }
6 | x(t);
7 | return t;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/hook-inside-logical-expression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const user = useFragment(graphql`...`, props.user) ?? {};
3 | return user.name;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/infer-computed-delete.js:
--------------------------------------------------------------------------------
1 | // @debug
2 | function Component(props) {
3 | const x = makeObject();
4 | const y = delete x[props.value];
5 | return y;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/overlapping-scopes-while.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | let x = [];
3 | let y = [];
4 | while (c) {
5 | y.push(b);
6 | x.push(a);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-passing-refs-as-props.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const ref = useRef(null);
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.gating-use-before-decl.js:
--------------------------------------------------------------------------------
1 | // @gating
2 | import {memo} from 'react';
3 |
4 | export default memo(Foo);
5 | function Foo() {}
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/property-call-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = foo.bar(...props.a, null, ...props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/simple.js:
--------------------------------------------------------------------------------
1 | export default function foo(x, y) {
2 | if (x) {
3 | return foo(false, y);
4 | }
5 | return [y * 10];
6 | }
7 |
--------------------------------------------------------------------------------
/fixtures/eslint/watch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | (cd ../.. && yarn build eslint --type=NODE_DEV)
3 | (cd ../.. && watchman-make --make 'yarn build eslint --type=NODE_DEV' -p 'packages/eslint-plugin-*/**/*' -t ignored)
4 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/prod/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-map-frozen-array.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | {x};
4 | const y = x.map((item) => item);
5 | return [x, y];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/arrow-function-expr-gating-test.js:
--------------------------------------------------------------------------------
1 | // @gating
2 | const ErrorView = (error, _retry) => ;
3 |
4 | export default ErrorView;
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/assignment-expression-nested-path.js:
--------------------------------------------------------------------------------
1 | function g(props) {
2 | const a = { b: { c: props.c } };
3 | a.b.c = a.b.c + 1;
4 | a.b.c *= 2;
5 | return a;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/assignment-variations-complex-lvalue-array.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const a = [[1]];
3 | const first = a.at(0);
4 | first.set(0, 2);
5 | return a;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-nested-member-call.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a: { a } };
3 | let x = function () {
4 | z.a.a();
5 | };
6 | return z;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/dce-loop.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = 0;
3 | let y = 0;
4 | while (y < props.max) {
5 | x++;
6 | y++;
7 | }
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/nested-scopes-hook-call.js:
--------------------------------------------------------------------------------
1 | function component(props) {
2 | let x = [];
3 | let y = [];
4 | y.push(useHook(props.foo));
5 | x.push(y);
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/prop-capturing-function-1.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let z = { a, b };
3 | let x = function () {
4 | console.log(z);
5 | };
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/reassign-object-in-context.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = [];
3 | let foo = () => {
4 | x = {};
5 | };
6 | foo();
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/reassign-primitive-in-context.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = 5;
3 | let foo = () => {
4 | x = {};
5 | };
6 | foo();
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-non-empty-initializer.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | let x = [];
3 | if (a) {
4 | x = 1;
5 | }
6 |
7 | let y = x;
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-args-assignment.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = makeObject();
3 | x.foo((x = makeObject()));
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-ternary-with-hook-values.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = props.cond ? useA : useB;
3 | return x();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.nomemo-and-change-detect.js:
--------------------------------------------------------------------------------
1 | // @disableMemoizationForDebugging @enableChangeDetectionForDebugging
2 | function Component(props) {}
3 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-hoist-function-decls.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | return get2();
3 | function get2() {
4 | return 2;
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-property-delete.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | const y = delete x.value;
4 | return y;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-mutate-2.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = {};
4 | y.x = x;
5 | mutate(x);
6 | return y;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-mutate.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = [];
3 | const y = {};
4 | y.x = x;
5 | mutate(y);
6 | return y;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useMemo-return-empty.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = useMemo(() => {
3 | mutate(a);
4 | }, []);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/dev/config.js:
--------------------------------------------------------------------------------
1 | exports.config = {
2 | paths: {
3 | public: '.',
4 | },
5 | files: {
6 | javascripts: {
7 | joinTo: 'output.js',
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/prod/config.js:
--------------------------------------------------------------------------------
1 | exports.config = {
2 | paths: {
3 | public: '.',
4 | },
5 | files: {
6 | javascripts: {
7 | joinTo: 'output.js',
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/edge/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-devtools-experimental-edge",
3 | "alias": ["react-devtools-experimental-edge"],
4 | "files": ["index.html", "ReactDevTools.zip"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementStyleXPlugin.css:
--------------------------------------------------------------------------------
1 | .Source {
2 | color: var(--color-dim);
3 | margin-left: 1rem;
4 | overflow: auto;
5 | text-overflow: ellipsis;
6 | }
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/constants.js:
--------------------------------------------------------------------------------
1 | export const PROTOCOLS_SUPPORTED_AS_LINKS_IN_KEY_VALUE = [
2 | 'file:///',
3 | 'http://',
4 | 'https://',
5 | 'vscode://',
6 | ];
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/concise-arrow-expr.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let [x, setX] = useState(0);
3 | const handler = (v) => setX(v);
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/delete-computed-property.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = { a: props.a, b: props.b };
3 | const key = "b";
4 | delete x[key];
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.call-args-destructuring-asignment-complex.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = makeObject();
3 | x.foo(([[x]] = makeObject()));
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/reactive-dependencies-non-optional-properties-inside-optional-chain.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return props.post.feedback.comments?.edges?.map(render);
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/reactive-scope-grouping.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = {};
3 | let y = [];
4 | let z = {};
5 | y.push(z);
6 | x.y = y;
7 |
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-if-else.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | let y = 2;
4 |
5 | if (y) {
6 | let z = x + y;
7 | } else {
8 | let z = x;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-newexpression.js:
--------------------------------------------------------------------------------
1 | function Foo() {}
2 |
3 | function Component(props) {
4 | const a = [];
5 | const b = {};
6 | let c = new Foo(a, b);
7 | return c;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-simple-phi.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let y = 2;
3 |
4 | if (y > 1) {
5 | y = 1;
6 | } else {
7 | y = 2;
8 | }
9 |
10 | let x = y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/tagged-template-in-hook.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const user = useFragment(graphql`fragment on User { name }`, props.user);
3 | return user.name;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = foo[props.method](...props.a, null, ...props.b);
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.capitalized-function-call-aliased.js:
--------------------------------------------------------------------------------
1 | // @validateNoCapitalizedCalls
2 | function Foo() {
3 | let x = Bar;
4 | x(); // ERROR
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-2e405c78cb80.js:
--------------------------------------------------------------------------------
1 | // Valid because hooks can call hooks.
2 | function useHook() {
3 | useState() && a;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-844a496db20b.js:
--------------------------------------------------------------------------------
1 | // Valid because hooks can use hooks.
2 | function useHookWithHook() {
3 | useHook();
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/nesting/src/shared/Clock.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import useTime from './useTime';
4 |
5 | export default function Clock() {
6 | const time = useTime();
7 | return Time: {time}
;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/chrome/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-devtools-experimental-chrome",
3 | "alias": ["react-devtools-experimental-chrome"],
4 | "files": ["index.html", "ReactDevTools.zip"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/firefox/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-devtools-experimental-firefox",
3 | "alias": ["react-devtools-experimental-firefox"],
4 | "files": ["index.html", "ReactDevTools.zip"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/KeyValueContextMenuContainer.css:
--------------------------------------------------------------------------------
1 | .ContextMenuItemContent {
2 | display: flex;
3 | flex-direction: row;
4 | align-items: center;
5 | gap: 0.5rem;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/assignment-expression-computed.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [props.x];
3 | const index = 0;
4 | x[index] *= 2;
5 | x["0"] += 3;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-mutate-nested.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let y = { b: { a } };
3 | let x = function () {
4 | y.b.a = 2;
5 | };
6 | x();
7 | return y;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-nested-member-expr.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a: { a } };
3 | let x = function () {
4 | console.log(z.a.a);
5 | };
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-set-and-read-ref-during-render.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const ref = useRef(null);
3 | ref.current = props.value;
4 | return ref.current;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-of-simple.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | let x = [];
3 | let items = [0, 1, 2];
4 | for (const ii of items) {
5 | x.push(ii * 2);
6 | }
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-member-expression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return (
3 |
4 |
5 |
6 | );
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/await-side-effecting-promise.js:
--------------------------------------------------------------------------------
1 | async function Component(props) {
2 | const x = [];
3 | await populateData(props.id, x);
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-runs-inference.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let z = {a};
3 | let p = () => {z};
4 | return p();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-store-alias.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let y = {a};
3 | let x = {b};
4 | x['y'] = y;
5 | mutate(x);
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-optional-property-load.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return props?.items?.map?.(render)?.filter(Boolean) ?? [];
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-computed-member-expression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const object = makeObject(props);
3 | return object?.[props.key];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-call-as-property.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | return x?.[foo(props.value)];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-1ff6c3fbbc94.js:
--------------------------------------------------------------------------------
1 | // Valid because components can use hooks.
2 | function ComponentWithHook() {
3 | useHook();
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/fiber-debugger/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 | import './index.css';
5 |
6 | ReactDOM.render(, document.getElementById('root'));
7 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/edge/deploy.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | 'use strict';
4 |
5 | const deploy = require('../deploy');
6 |
7 | const main = async () => await deploy('edge');
8 |
9 | main();
10 |
--------------------------------------------------------------------------------
/packages/react-noop-renderer/README.md:
--------------------------------------------------------------------------------
1 | # `react-noop-renderer`
2 |
3 | This package is the renderer we use for debugging [Fiber](https://github.com/facebook/react/issues/6170).
4 | It is not intended to be used directly.
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_estree_codegen/README.md:
--------------------------------------------------------------------------------
1 | # react_estree_codegen
2 |
3 | This crate is a build dependency for `react_estree`, and contains codegen logic to produce Rust code to describe the ESTree format
4 | given a JSON schema.
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/builtin-jsx-tag-lowered-between-mutations.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | return {maybeMutate(maybeMutable)}
;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-shadow-captured.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x = function () {
4 | let z;
5 | mutate(z);
6 | };
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/declare-reassign-variable-in-closure.js:
--------------------------------------------------------------------------------
1 | function Component(p) {
2 | let x;
3 | const foo = () => {
4 | x = {};
5 | };
6 | foo();
7 |
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-access-ref-during-render.js:
--------------------------------------------------------------------------------
1 | // @debug
2 | function Component(props) {
3 | const ref = useRef(null);
4 | const value = ref.current;
5 | return value;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-renaming-ternary.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = [];
3 | x.push(props.bar);
4 | props.cond ? ((x = {}), (x = []), x.push(props.foo)) : null;
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-computed-load.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = {a};
3 | let y = {};
4 |
5 | y.x = x['a'];
6 | mutate(y);
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-args-destructuring-assignment.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = makeObject();
3 | x.foo(([x] = makeObject()));
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-emit-imports-same-source.js:
--------------------------------------------------------------------------------
1 | // @enableEmitFreeze @enableEmitInstrumentForget
2 |
3 | function useFoo(props) {
4 | return foo(props.x);
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.capitalized-function-call.js:
--------------------------------------------------------------------------------
1 | // @validateNoCapitalizedCalls
2 | function Component() {
3 | const x = SomeFunc();
4 |
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.component-syntax-ref-gating.flow.js:
--------------------------------------------------------------------------------
1 | // @flow @gating
2 | component Foo(ref: React.RefSetter) {
3 | return ;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-assign-hook-to-local.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useState;
3 | const state = x(null);
4 | return state[0];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-reassign-local-in-hook-return-value.js:
--------------------------------------------------------------------------------
1 | function useFoo() {
2 | let x = 0;
3 | return value => {
4 | x = value;
5 | };
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.mutate-global-increment-op-invalid-react.js:
--------------------------------------------------------------------------------
1 | let renderCount = 0;
2 |
3 | function NoHooks() {
4 | renderCount++;
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-spread.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return (
3 |
4 | );
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-properties.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | const x = a.x;
3 | const y = {...b.c.d};
4 | y.z = c.d.e;
5 | foo(a.b.c);
6 | [a.b.c];
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | let x = bar(props.a);
3 | let y = x?.b;
4 |
5 | let z = useBar(y);
6 | return z;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-9d7879272ff6.js:
--------------------------------------------------------------------------------
1 | // Valid because hooks can call hooks.
2 | function useHook() {
3 | return useHook1(useHook2());
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-cfdfe5572fc7.js:
--------------------------------------------------------------------------------
1 | // Valid because hooks can call hooks.
2 | function useHook() {
3 | useHook1();
4 | useHook2();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-binary-operator.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let a = some();
3 | let b = someOther();
4 | if (a > b) {
5 | let m = {};
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/fixtures/attribute-behavior/src/index.js:
--------------------------------------------------------------------------------
1 | import './index.css';
2 | import React from 'react';
3 | import ReactDOM from 'react-dom';
4 | import App from './App';
5 |
6 | ReactDOM.render(, document.getElementById('root'));
7 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/chrome/deploy.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | 'use strict';
4 |
5 | const deploy = require('../deploy');
6 |
7 | const main = async () => await deploy('chrome');
8 |
9 | main();
10 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/firefox/deploy.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | 'use strict';
4 |
5 | const deploy = require('../deploy');
6 |
7 | const main = async () => await deploy('firefox');
8 |
9 | main();
10 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementBadges.css:
--------------------------------------------------------------------------------
1 | .Root {
2 | user-select: none;
3 | display: inline-flex;
4 | }
5 |
6 | .Root *:not(:first-child) {
7 | margin-left: 0.25rem;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/WarnIfLegacyBackendDetected.css:
--------------------------------------------------------------------------------
1 | .Command {
2 | background-color: var(--color-dimmest);
3 | padding: 0.25rem 0.5rem;
4 | display: block;
5 | border-radius: 0.125rem;
6 | }
7 |
--------------------------------------------------------------------------------
/scripts/perf-counters/Makefile:
--------------------------------------------------------------------------------
1 | build/jsc-perf: src/*
2 | mkdir -p build
3 | g++ -std=c++11 -I/usr/include/webkitgtk-1.0/ -ljavascriptcoregtk-1.0 src/jsc-perf.cpp src/hardware-counter.cpp src/thread-local.cpp -o build/jsc-perf
4 |
--------------------------------------------------------------------------------
/compiler/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/todo-function-scope-does-not-beat-module-scope-output.txt:
--------------------------------------------------------------------------------
1 | "use no memo";
2 | function TestComponent({ x }) {
3 | "use memo";
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/const-propagation-into-function-expression-primitive.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = 42;
3 | const f = () => {
4 | console.log(x);
5 | };
6 | f();
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/constant-computed.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const index = "foo";
3 | const x = {};
4 | x[index] = x[index] + x["bar"];
5 | x[index](props.foo);
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/destructuring-property-inference.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | x.push(props.value);
4 | const { length: y } = x;
5 | foo(y);
6 | return [x, y];
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error._todo.computed-lval-in-destructure.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const computedKey = props.key;
3 | const { [computedKey]: x } = props.val;
4 |
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.hoisted-function-declaration.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let t = { a };
3 | x(t); // hoisted call
4 | function x(p) {
5 | p.foo();
6 | }
7 | return t;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-property-store-to-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | x.y = true;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/infer-phi-primitive.js:
--------------------------------------------------------------------------------
1 | function foo(a, b) {
2 | let x;
3 | if (a) {
4 | x = 1;
5 | } else {
6 | x = 2;
7 | }
8 |
9 | let y = x;
10 | return y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-member-expression-tag-grouping.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | return {maybeMutate(maybeMutable)};
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-call-logical.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const item = useFragment(graphql`...`, props.item);
3 | return item.items?.map((item) => renderItem(item)) ?? [];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-member-expression-with-optional-member-expr-as-property.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | return x.y?.[props.a?.[props.b?.[props.c]]];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/temporary-accessed-outside-scope.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | let x = props;
4 | return [x, maybeMutate(maybeMutable)];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-ternary-assigned-to-variable.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | // unused!
3 | const obj = makeObject();
4 | const _ = obj.a ? props.b : props.c;
5 | return null;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-inlining-block-return.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let x = useMemo(() => {
3 | if (a) {
4 | return { b };
5 | }
6 | }, [a, b]);
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.capitalized-method-call.js:
--------------------------------------------------------------------------------
1 | // @validateNoCapitalizedCalls
2 | function Component() {
3 | const x = someGlobal.SomeFunc();
4 |
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | {x}
;
4 | x.push(props.value);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-destructure-to-local-global-variables.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let a;
3 | [a, b] = props.value;
4 |
5 | return [a, b];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-useMemo-async-callback.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let x = useMemo(async () => {
3 | await a;
4 | }, []);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.reassignment-to-global.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | // Cannot assign to globals
3 | someUnknownGlobal = true;
4 | moduleLocal = true;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-function-expression-component.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 |
3 | const Component = function ComponentName(props) {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-optionalcall.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const {result} = useConditionalHook?.() ?? {};
3 | return result;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-23dc7fffde57.js:
--------------------------------------------------------------------------------
1 | // Valid because hooks can call hooks.
2 | function useHook() {
3 | return useHook1() + useHook2();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/uninitialized-declaration-in-reactive-scope.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = mutate();
3 | let y;
4 | foo(x);
5 | return [y, x];
6 | }
7 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/prod/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to React
2 |
3 | Want to contribute to React? There are a few things you need to know.
4 |
5 | We wrote a **[contribution guide](https://reactjs.org/docs/how-to-contribute.html)** to help you get started.
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-properties.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const a = [props.a, props.b, "hello"];
3 | const x = a.length;
4 | const y = a.push;
5 | return { a, x, y, z: a.concat };
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-alias-computed-load.js:
--------------------------------------------------------------------------------
1 | function bar(a) {
2 | let x = [a];
3 | let y = {};
4 | (function () {
5 | y = x[0];
6 | })();
7 |
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/do-while-early-unconditional-break.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = [1, 2, 3];
3 | do {
4 | mutate(x);
5 | break;
6 | } while (props.cond);
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-computed-store-to-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | x[0] = true;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-delete-property-of-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | delete x.y;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-for-trivial-update.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | for (let i = 0; i < 10; /* update is intentally a single identifier */ i) {
4 | x += 1;
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-optional-method-assigned-to-variable.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | // unused!
3 | const obj = makeObject();
4 | const _ = obj.a?.b?.(props.c);
5 | return null;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/while-conditional-continue.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | while (a) {
3 | if (b) {
4 | continue;
5 | }
6 | c();
7 | continue;
8 | }
9 | d();
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.assign-global-in-component-tag-function.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const Foo = () => {
3 | someGlobal = true;
4 | };
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-computed-delete.js:
--------------------------------------------------------------------------------
1 | // @debug
2 | function Component(props) {
3 | const x = makeObject();
4 | const y = delete x[props.value];
5 | return y;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-gating-import-without-compiled-functions.js:
--------------------------------------------------------------------------------
1 | // @gating
2 | import {isForgetEnabled_Fixtures} from 'ReactForgetFeatureFlag';
3 |
4 | export default 42;
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-conditionally-call-prop-named-like-hook.js:
--------------------------------------------------------------------------------
1 | function Component({cond, useFoo}) {
2 | if (cond) {
3 | useFoo();
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-as-conditional-test.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = props.cond ? (useFoo ? 1 : 2) : 3;
3 | return x;
4 | }
5 |
--------------------------------------------------------------------------------
/fixtures/flight/src/ServerState.js:
--------------------------------------------------------------------------------
1 | let serverState = 'Hello World';
2 |
3 | export function setServerState(message) {
4 | serverState = message;
5 | }
6 |
7 | export function getServerState() {
8 | return serverState;
9 | }
10 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/dev/input.js:
--------------------------------------------------------------------------------
1 | require(['react', 'react-dom'], function (React, ReactDOM) {
2 | ReactDOM.render(
3 | React.createElement('h1', null, 'Hello World!'),
4 | document.getElementById('container')
5 | );
6 | });
7 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/prod/input.js:
--------------------------------------------------------------------------------
1 | require(['react', 'react-dom'], function (React, ReactDOM) {
2 | ReactDOM.render(
3 | React.createElement('h1', null, 'Hello World!'),
4 | document.getElementById('container')
5 | );
6 | });
7 |
--------------------------------------------------------------------------------
/packages/react/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react.production.js');
5 | } else {
6 | module.exports = require('./cjs/react.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-property-call.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const a = [props.a, props.b, "hello"];
3 | const x = a.push(42);
4 | const y = a.at(props.c);
5 |
6 | return { a, x, y };
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/assignment-in-nested-if.js:
--------------------------------------------------------------------------------
1 | function useBar(props) {
2 | let z;
3 |
4 | if (props.a) {
5 | if (props.b) {
6 | z = baz();
7 | }
8 | }
9 |
10 | return z;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-alias-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = { a };
3 | let y = {};
4 | (function () {
5 | y.x = x;
6 | })();
7 | mutate(y);
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-simple-alias.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = { a };
3 | let y = {};
4 | (function () {
5 | y = x;
6 | })();
7 | mutate(y);
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-alias-computed-load-2.js:
--------------------------------------------------------------------------------
1 | function bar(a) {
2 | let x = [a];
3 | let y = {};
4 | (function () {
5 | y = x[0][1];
6 | })();
7 |
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-alias-computed-load-4.js:
--------------------------------------------------------------------------------
1 | function bar(a) {
2 | let x = [a];
3 | let y = {};
4 | (function () {
5 | y = x[0].a[1];
6 | })();
7 |
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/complex-while.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | label: if (a) {
3 | while (b) {
4 | if (c) {
5 | break label;
6 | }
7 | }
8 | }
9 | return c;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/overlapping-scopes-interleaved-by-terminal.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | const x = [];
3 | const y = [];
4 |
5 | if (x) {
6 | }
7 |
8 | y.push(a);
9 | x.push(b);
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ref-current-write-not-added-to-dep.js:
--------------------------------------------------------------------------------
1 | function VideoTab() {
2 | const ref = useRef();
3 | let x = () => {
4 | ref.current = 1;
5 | };
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.js:
--------------------------------------------------------------------------------
1 | // @gating
2 | const ErrorView = (error, _retry) => ;
3 |
4 | export default ErrorView;
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/concise-arrow-expr.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let [x, setX] = useState(0);
3 | const handler = v => setX(v);
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.call-args-destructuring-asignment-complex.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = makeObject();
3 | x.foo(([[x]] = makeObject()));
4 | return x;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-ReactUseMemo-async-callback.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let x = React.useMemo(async () => {
3 | await a;
4 | }, []);
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.not-useEffect-external-mutate.js:
--------------------------------------------------------------------------------
1 | let x = {a: 42};
2 |
3 | function Component(props) {
4 | foo(() => {
5 | x.a = 10;
6 | x.a = 20;
7 | });
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return (
3 | useMemo(() => {
4 | return [props.value];
5 | }) || []
6 | );
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/error.todo-locally-require-fbt.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const fbt = require('fbt');
3 |
4 | return {'Text'};
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nested-scopes-hook-call.js:
--------------------------------------------------------------------------------
1 | function component(props) {
2 | let x = [];
3 | let y = [];
4 | y.push(useHook(props.foo));
5 | x.push(y);
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-after-early-return.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | if (props.cond) {
3 | return null;
4 | }
5 | return useHook();
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-optional-methodcall.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const {result} = Module.useConditionalHook?.() ?? {};
3 | return result;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-optional-property.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const {result} = Module?.useConditionalHook() ?? {};
3 | return result;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-7e52f5eec669.js:
--------------------------------------------------------------------------------
1 | // Valid because components can call functions.
2 | function ComponentWithNormalFunction() {
3 | doSomething();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-newexpression.js:
--------------------------------------------------------------------------------
1 | function Foo() {}
2 |
3 | function Component(props) {
4 | const a = [];
5 | const b = {};
6 | let c = new Foo(a, b);
7 | return c;
8 | }
9 |
--------------------------------------------------------------------------------
/fixtures/flight-esm/src/ServerState.js:
--------------------------------------------------------------------------------
1 | let serverState = 'Hello World';
2 |
3 | export function setServerState(message) {
4 | serverState = message;
5 | }
6 |
7 | export function getServerState() {
8 | return serverState;
9 | }
10 |
--------------------------------------------------------------------------------
/fixtures/packaging/browserify/dev/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/dev/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/prod/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/systemjs-builder/dev/input.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack/dev/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack/prod/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/packages/react-devtools-extensions/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/packages/react-devtools-shared/src/devtools/views/Components/ExpandCollapseToggle.css:
--------------------------------------------------------------------------------
1 | .ExpandCollapseToggle {
2 | flex: 0 0 1rem;
3 | width: 1rem;
4 | height: 1rem;
5 | padding: 0;
6 | color: var(--color-expand-collapse-toggle);
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-reconciler/src/__tests__/__snapshots__/ReactHooks-test.internal.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`ReactHooks works with ReactDOMServer calls inside a component 1`] = `"hello
0bye
"`;
4 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/tests/fixtures/simple-function.js:
--------------------------------------------------------------------------------
1 | function Component(a) {
2 | Math;
3 | let b = 0;
4 | const foo = function foo_(c) {
5 | let d = 1;
6 | return a + b + c + d;
7 | };
8 | return foo();
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/alias-nested-member-path-mutate.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let z = [];
3 | let y = {};
4 | y.z = z;
5 | let x = {};
6 | x.y = y;
7 | mutate(x.y.z);
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-access-assignment.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | const x = [a];
3 | const y = [null, b];
4 | const z = [[], [], [c]];
5 | x[0] = y[1];
6 | z[0][0] = x[0];
7 | return [x, z];
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-join.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [{}, [], props.value];
3 | const y = x.join(() => "this closure gets stringified, not called");
4 | foo(y);
5 | return [x, y];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capture_mutate-across-fns.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | (function () {
4 | (function () {
5 | z.b = 1;
6 | })();
7 | })();
8 | return z;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-mutate-3.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let y = { b };
3 | let z = { a };
4 | let x = function () {
5 | z.a = 2;
6 | y.b;
7 | };
8 | return z;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-skip-computed-path.js:
--------------------------------------------------------------------------------
1 | function StoreLandingUnseenGiftModalContainer(a) {
2 | const giftsSeen = { a };
3 | return ((gift) => (gift.id ? giftsSeen[gift.id] : false))();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-reference-changes-type.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = { a };
3 | let y = 1;
4 | (function () {
5 | y = x;
6 | })();
7 | mutate(y);
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-variable-in-nested-block.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x = function () {
4 | {
5 | console.log(z);
6 | }
7 | };
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/controlled-input.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let [x, setX] = useState(0);
3 | const handler = (event) => setX(event.target.value);
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-delete-computed-property-of-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | delete x[y];
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-fragment.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | return (
3 | <>
4 | Hello {props.greeting}{" "}
5 |
6 | <>Text>
7 |
8 | >
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/obj-literal-cached-in-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let x = {};
3 | if (someVal) {
4 | x = { b };
5 | } else {
6 | x = { c };
7 | }
8 |
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ref-current-not-added-to-dep.js:
--------------------------------------------------------------------------------
1 | function VideoTab() {
2 | const ref = useRef();
3 | let x = () => {
4 | console.log(ref.current);
5 | };
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-labeled-statement-unconditional-return.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useMemo(() => {
3 | label: {
4 | return props.value;
5 | }
6 | });
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.assign-global-in-jsx-spread-attribute.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const foo = () => {
3 | someGlobal = true;
4 | };
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.bailout-on-flow-suppression.js:
--------------------------------------------------------------------------------
1 | // @enableFlowSuppressions
2 |
3 | function Foo(props) {
4 | // $FlowFixMe[react-rule-hook]
5 | useX();
6 | return null;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.conditional-hooks-as-method-call.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = null;
3 | if (props.cond) {
4 | x = Foo.useFoo();
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.modify-state.js:
--------------------------------------------------------------------------------
1 | import {useState} from 'react';
2 |
3 | function Foo() {
4 | let [state, setState] = useState({});
5 | state.foo = 1;
6 | return state;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-functions-component-with-hook-call.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | function Component(props) {
3 | const [state, _] = useState(null);
4 | return [state];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-functions-hook-with-hook-call.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(infer)
2 | function useStateValue(props) {
3 | const [state, _] = useState(null);
4 | return [state];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-member-expression.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return (
3 |
4 |
5 |
6 | );
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-dependencies-non-optional-properties-inside-optional-chain.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | return props.post.feedback.comments?.edges?.map(render);
3 | }
4 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-reassigned-in-conditional.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let y;
3 | props.cond ? (y = useFoo) : null;
4 | return y();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-347b0dae66f1.js:
--------------------------------------------------------------------------------
1 | // Valid because functions can call functions.
2 | function normalFunctionWithNormalFunction() {
3 | doSomething();
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/tagged-template-literal.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let t = graphql`
3 | fragment F on T {
4 | id
5 | }
6 | `;
7 |
8 | return t;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-no-memo-module-level.js:
--------------------------------------------------------------------------------
1 | 'use no memo';
2 |
3 | export default function foo(x, y) {
4 | if (x) {
5 | return foo(false, y);
6 | }
7 | return [y * 10];
8 | }
9 |
--------------------------------------------------------------------------------
/fixtures/art/app.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var React = require('react');
4 | var ReactDOM = require('react-dom');
5 | var VectorWidget = require('./VectorWidget');
6 |
7 | ReactDOM.render(, document.getElementById('container'));
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/browserify/prod/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/dev/app/initialize.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/systemjs-builder/prod/input.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/dev/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/fixtures/packaging/webpack-alias/prod/input.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/packages/react-art/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-art.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-art.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-is/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-is.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-is.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/scheduler/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/scheduler.production.js');
5 | } else {
6 | module.exports = require('./cjs/scheduler.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_fixtures/src/lib.rs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/chained-assignment-expressions.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const x = { x: 0 };
3 | const y = { z: 0 };
4 | const z = { z: 0 };
5 | x.x += y.y *= 1;
6 | z.z += y.y *= x.x &= 3;
7 | return z;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/declare-reassign-variable-in-function-declaration.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | let x = null;
3 | function foo() {
4 | x = 9;
5 | }
6 | const y = bar(foo);
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.codegen-error-on-conflicting-imports.js:
--------------------------------------------------------------------------------
1 | // @enableEmitFreeze @instrumentForget
2 |
3 | let makeReadOnly = "conflicting identifier";
4 | function useFoo(props) {
5 | return foo(props.x);
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-of-destructure.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | let x = [];
3 | let items = [{ v: 0 }, { v: 1 }, { v: 2 }];
4 | for (const { v } of items) {
5 | x.push(v * 2);
6 | }
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/inverted-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | let x = null;
3 | label: {
4 | if (a) {
5 | x = b;
6 | break label;
7 | }
8 | x = c;
9 | }
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/lambda-mutated-ref-non-reactive.js:
--------------------------------------------------------------------------------
1 | function f(a) {
2 | let x;
3 | (() => {
4 | x = {};
5 | })();
6 | // this is not reactive on `x` as `x` is never reactive
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/logical-expression.js:
--------------------------------------------------------------------------------
1 | function component(props) {
2 | let a = props.a || (props.b && props.c && props.d);
3 | let b = (props.a && props.b && props.c) || props.d;
4 | return a ? b : props.c;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ref-current-optional-field-no-added-to-dep.js:
--------------------------------------------------------------------------------
1 | function VideoTab() {
2 | const ref = useRef();
3 | let x = () => {
4 | ref.current?.x;
5 | };
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-complex-multiple-if.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | let y = 2;
4 | if (y === 2) {
5 | x = 3;
6 | }
7 |
8 | if (y === 3) {
9 | x = 5;
10 | }
11 | y = x;
12 | }
13 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-for-of.js:
--------------------------------------------------------------------------------
1 | function foo(cond) {
2 | let items = [];
3 | for (const item of items) {
4 | let y = 0;
5 | if (cond) {
6 | y = 1;
7 | }
8 | }
9 | return items;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/temporary-property-load-accessed-outside-scope.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | let x = props.value;
4 | return [x, maybeMutate(maybeMutable)];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-shadow-captured.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = {a};
3 | let x = function () {
4 | let z;
5 | mutate(z);
6 | };
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.gating-hoisting.js:
--------------------------------------------------------------------------------
1 | // @gating
2 | const Foo = React.forwardRef(Foo_withRef);
3 | function Foo_withRef(props, ref) {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutate-context.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const context = useContext(FooContext);
3 | context.value = props.value;
4 | return context.value;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-selector-simple.js:
--------------------------------------------------------------------------------
1 | // @lowerContextAccess
2 | function App() {
3 | const {foo, bar} = useContext(MyContext);
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-from-hook-return.js:
--------------------------------------------------------------------------------
1 | function useFoo({data}) {
2 | const useMedia = useVideoPlayer();
3 | const foo = useMedia();
4 | return foo;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-if-consequent.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = null;
3 | if (props.cond) {
4 | x = useHook();
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/use-effect-no-args-no-op.js:
--------------------------------------------------------------------------------
1 | // @enableFire
2 | import {fire} from 'react';
3 |
4 | function Component(props) {
5 | useEffect();
6 |
7 | return null;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-no-forget-module-level.js:
--------------------------------------------------------------------------------
1 | 'use no forget';
2 |
3 | export default function foo(x, y) {
4 | if (x) {
5 | return foo(false, y);
6 | }
7 | return [y * 10];
8 | }
9 |
--------------------------------------------------------------------------------
/fixtures/packaging/brunch/prod/app/initialize.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 |
4 | ReactDOM.render(
5 | React.createElement('h1', null, 'Hello World!'),
6 | document.getElementById('container')
7 | );
8 |
--------------------------------------------------------------------------------
/packages/jest-react/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/jest-react.production.js');
5 | } else {
6 | module.exports = require('./cjs/jest-react.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-alias-computed-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = { a };
3 | let y = {};
4 | (function () {
5 | y["x"] = x;
6 | })();
7 | mutate(y);
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-mutate-2.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let y = { b };
3 | let z = { a };
4 | let x = function () {
5 | z.a = 2;
6 | y.b;
7 | };
8 | x();
9 | return z;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-within-block.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x;
4 | {
5 | x = function () {
6 | console.log(z);
7 | };
8 | }
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/chained-assignment-context-variable.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | let x,
3 | y = (x = {});
4 | const foo = () => {
5 | x = getObject();
6 | };
7 | foo();
8 | return [y, x];
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/constant-propagation-into-function-expressions.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = 42;
3 | const onEvent = () => {
4 | console.log(x);
5 | };
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/jsx-tag-evaluation-order.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let Tag = View;
3 | return (
4 |
5 | {((Tag = HScroll), props.value)}
6 |
7 |
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-call.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeOptionalFunction(props);
3 | const y = makeObject(props);
4 | const z = x?.(y.a, props.a, foo(y.b), bar(props.b));
5 | return z;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/simple-alias.js:
--------------------------------------------------------------------------------
1 | function mutate() {}
2 | function foo() {
3 | let a = {};
4 | let b = {};
5 | let c = {};
6 | a = b;
7 | b = c;
8 | c = a;
9 | mutate(a, b);
10 | return c;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property-alias-if.js:
--------------------------------------------------------------------------------
1 | function foo(a) {
2 | const x = {};
3 | if (a) {
4 | let y = {};
5 | x.y = y;
6 | } else {
7 | let z = {};
8 | x.z = z;
9 | }
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property-alias-mutate.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const a = {};
3 | const x = a;
4 |
5 | const y = {};
6 | y.x = x;
7 |
8 | mutate(a); // y & x are aliased to a
9 | return y;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-property-mutate-alias.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | const a = {};
3 | const y = a;
4 | const x = [];
5 |
6 | y.x = x;
7 |
8 | mutate(a); // y & x are aliased to a
9 | return y;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-reassign-in-rval.js:
--------------------------------------------------------------------------------
1 | // Forget should call the original x (x = foo()) to compute result
2 | function Component() {
3 | let x = foo();
4 | let result = x((x = bar()), 5);
5 | return [result, x];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-renaming-ternary-destruction.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = [];
3 | x.push(props.bar);
4 | props.cond ? (({ x } = { x: {} }), ([x] = [[]]), x.push(props.foo)) : null;
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-renaming-ternary-with-mutation.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = [];
3 | x.push(props.bar);
4 | props.cond ? ((x = {}), (x = []), x.push(props.foo)) : null;
5 | mut(x);
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-renaming.js:
--------------------------------------------------------------------------------
1 | function foo(props) {
2 | let x = [];
3 | x.push(props.bar);
4 | if (props.cond) {
5 | x = {};
6 | x = [];
7 | x.push(props.foo);
8 | }
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/type-test-return-type-inference.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = foo();
3 | let y = foo();
4 | if (x > y) {
5 | let z = {};
6 | }
7 |
8 | let z = foo();
9 | return z;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_semantic_analysis/tests/fixtures/simple-function.js:
--------------------------------------------------------------------------------
1 | function Component(a) {
2 | Math;
3 | let b = 0;
4 | const foo = function foo_(c) {
5 | let d = 1;
6 | return a + b + c + d;
7 | };
8 | return foo();
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/builtin-jsx-tag-lowered-between-mutations.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | return {maybeMutate(maybeMutable)}
;
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/default-param-array-with-unary.js:
--------------------------------------------------------------------------------
1 | function Component(x = [-1, 1]) {
2 | return x;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: Component,
7 | params: [],
8 | };
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-property-inference.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | x.push(props.value);
4 | const {length: y} = x;
5 | foo(y);
6 | return [x, y];
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error._todo.computed-lval-in-destructure.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const computedKey = props.key;
3 | const {[computedKey]: x} = props.val;
4 |
5 | return x;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-ref-value-as-props.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender
2 | function Component(props) {
3 | const ref = useRef(null);
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-await-loops.js:
--------------------------------------------------------------------------------
1 | async function Component({items}) {
2 | const x = [];
3 | for await (const item of items) {
4 | x.push(item);
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-new-target-meta-property.js:
--------------------------------------------------------------------------------
1 | import {Stringify} from 'shared-runtime';
2 |
3 | function foo() {
4 | const nt = new.target;
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-member-expression-tag-grouping.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | return {maybeMutate(maybeMutable)};
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-ddeca9708b63.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | (class {
5 | i() {
6 | useState();
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/netlify.toml:
--------------------------------------------------------------------------------
1 | [build]
2 | base = ""
3 | publish = "fixtures/dom/build"
4 | command = "yarn build --type=UMD_DEV && cd fixtures/dom/ && yarn && yarn build"
5 |
6 | [[redirects]]
7 | from = "/*"
8 | to = "/index.html"
9 | status = 200
10 |
--------------------------------------------------------------------------------
/packages/react-cache/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-cache.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-cache.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-markup/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-markup.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-markup.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/npm/server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-esm/npm/static.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-server.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-server.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/array-map-mutable-array-mutating-lambda.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [];
3 | const y = x.map((item) => {
4 | item.updated = true;
5 | return item;
6 | });
7 | return [x, y];
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/call.js:
--------------------------------------------------------------------------------
1 | function foo() {}
2 |
3 | function Component(props) {
4 | const a = [];
5 | const b = {};
6 | foo(a, b);
7 | let _ = ;
8 | foo(b);
9 | return ;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-function-renamed-ref.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let z = { a };
3 | {
4 | let z = { b };
5 | (function () {
6 | mutate(z);
7 | })();
8 | }
9 | return z;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/debugger.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | debugger;
3 | if (props.cond) {
4 | debugger;
5 | } else {
6 | while (props.cond) {
7 | debugger;
8 | }
9 | }
10 | debugger;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/do-while-simple.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | let x = [1, 2, 3];
3 | let ret = [];
4 | do {
5 | let item = x.pop();
6 | ret.push(item * 2);
7 | } while (x.length);
8 | return ret;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/escape-analysis-not-if-test.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [props.a];
3 | let y;
4 | if (x) {
5 | y = props.b;
6 | } else {
7 | y = props.c;
8 | }
9 | return y;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-empty-update-with-continue.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = 0;
3 | for (let i = 0; i < props.count; ) {
4 | x += i;
5 | i += 1;
6 | continue;
7 | }
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-empty-update.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = 0;
3 | for (let i = 0; i < props.count; ) {
4 | x += i;
5 | if (x > 10) {
6 | break;
7 | }
8 | }
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/inverted-if.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let y = [];
3 | label: if (a) {
4 | if (b) {
5 | y.push(c);
6 | break label;
7 | }
8 | y.push(d);
9 | }
10 | return y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-object-element-with-rest.js:
--------------------------------------------------------------------------------
1 | function Foo(props) {
2 | // can't remove `unused` since it affects which properties are copied into `rest`
3 | const { unused, ...rest } = props.a;
4 | return rest;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/use-callback-simple.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | const [count, setCount] = useState(0);
3 | const increment = useCallback(() => setCount(count + 1));
4 |
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/useMemo-nested-ifs.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = useMemo(() => {
3 | if (props.cond) {
4 | if (props.cond) {
5 | }
6 | }
7 | }, [props.cond]);
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/default-param-with-empty-callback.js:
--------------------------------------------------------------------------------
1 | function Component(x = () => {}) {
2 | return x;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: Component,
7 | params: [],
8 | };
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/do-while-early-unconditional-break.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = [1, 2, 3];
3 | do {
4 | mutate(x);
5 | break;
6 | } while (props.cond);
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-computed-store-to-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | x[0] = true;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-delete-property-of-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | delete x.y;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-property-store-to-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | x.y = true;
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-type-provider-hooklike-module-default-not-hook.js:
--------------------------------------------------------------------------------
1 | import foo from 'useDefaultExportNotTypedAsHook';
2 |
3 | function Component() {
4 | return {foo()}
;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo.try-catch-with-throw.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x;
3 | try {
4 | throw [];
5 | } catch (e) {
6 | x.push(e);
7 | }
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-html-entity.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | return ><span &
;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: Component,
7 | params: [{}],
8 | };
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-optional-member-expr-as-property.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | return x.y?.[props.a?.[props.b?.[props.c]]];
4 | }
5 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-2c51251df67a.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | (class {
5 | useHook() {
6 | useState();
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-9c79feec4b9b.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | (class {
5 | h = () => {
6 | useState();
7 | };
8 | });
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/temporary-accessed-outside-scope.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const maybeMutable = new MaybeMutable();
3 | let x = props;
4 | return [x, maybeMutate(maybeMutable)];
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/trivial.js:
--------------------------------------------------------------------------------
1 | function foo(x) {
2 | return x;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: foo,
7 | params: ['TodoAdd'],
8 | isComponent: 'TodoAdd',
9 | };
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unused-optional-method-assigned-to-variable.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | // unused!
3 | const obj = makeObject();
4 | const _ = obj.a?.b?.(props.c);
5 | return null;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unused-ternary-assigned-to-variable.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | // unused!
3 | const obj = makeObject();
4 | const _ = obj.a ? props.b : props.c;
5 | return null;
6 | }
7 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/dev/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "rjs-dev-fixture",
4 | "dependencies": {
5 | "requirejs": "^2.3.2"
6 | },
7 | "scripts": {
8 | "build": "rm -f output.js && r.js -o config.js"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/fixtures/packaging/rjs/prod/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "rjs-prod-fixture",
4 | "dependencies": {
5 | "requirejs": "^2.3.2"
6 | },
7 | "scripts": {
8 | "build": "rm -f output.js && r.js -o config.js"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/react-server-dom-parcel/npm/server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-parcel/npm/static.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-turbopack/npm/server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-turbopack/npm/static.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/npm/server.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/packages/react-server-dom-webpack/npm/static.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | throw new Error(
4 | 'The React Server Writer cannot be used outside a react-server environment. ' +
5 | 'You must configure Node.js using the `--conditions react-server` flag.'
6 | );
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a, b) {
2 | let z = { a };
3 | let y = { b };
4 | let x = function () {
5 | z.a = 2;
6 | console.log(y.b);
7 | };
8 | x();
9 | return z;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-variable-in-nested-function.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let z = { a };
3 | let x = function () {
4 | (function () {
5 | console.log(z);
6 | })();
7 | };
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-unconditional-set-state-in-render.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const [x, setX] = useState(0);
3 | const aliased = setX;
4 |
5 | setX(1);
6 | aliased(2);
7 |
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/error.todo.destructure-assignment-to-context-var.js:
--------------------------------------------------------------------------------
1 | function useFoo(props) {
2 | let x;
3 | [x] = props;
4 | const foo = () => {
5 | x = getX(props);
6 | };
7 | foo();
8 | return { x };
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/obj-literal-mutated-after-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let x = {};
3 | if (someVal) {
4 | x = { b };
5 | } else {
6 | x = { c };
7 | }
8 |
9 | x.f = 1;
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/obj-mutated-after-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let x = someObj();
3 | if (a) {
4 | x = someObj();
5 | } else {
6 | x = someObj();
7 | }
8 |
9 | x.f = 1;
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/optional-method-call.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject(props);
3 | const y = makeObject(props);
4 | const z = x.optionalMethod?.(y.a, props.a, foo(y.b), bar(props.b));
5 | return z;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/primitive-alias-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = "foo";
3 | if (a) {
4 | x = "bar";
5 | } else {
6 | x = "baz";
7 | }
8 | let y = x;
9 | mutate(y);
10 | return y;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ref-current-not-added-to-dep-2.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender false
2 | function Foo({ a }) {
3 | const ref = useRef();
4 | const x = { a, val: ref.current };
5 |
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/sequence-expression.js:
--------------------------------------------------------------------------------
1 | function sequence(props) {
2 | let x = (null, Math.max(1, 2), foo());
3 | while ((foo(), true)) {
4 | x = (foo(), 2);
5 | }
6 | return x;
7 | }
8 |
9 | function foo() {}
10 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/ssa-nested-partial-reassignment.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d, e) {
2 | let x = null;
3 | if (a) {
4 | x = b;
5 | } else {
6 | if (c) {
7 | x = d;
8 | }
9 | }
10 | return x;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/transitive-alias-fields.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let x = {};
3 | let p = {};
4 | let q = {};
5 | let y = {};
6 |
7 | x.y = y;
8 | p.y = x.y;
9 | q.y = p.y;
10 |
11 | mutate(q);
12 | }
13 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/assignment-in-nested-if.js:
--------------------------------------------------------------------------------
1 | function useBar(props) {
2 | let z;
3 |
4 | if (props.a) {
5 | if (props.b) {
6 | z = baz();
7 | }
8 | }
9 |
10 | return z;
11 | }
12 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-pass-ref-to-function.js:
--------------------------------------------------------------------------------
1 | // @validateRefAccessDuringRender
2 | function Component(props) {
3 | const ref = useRef(null);
4 | const x = foo(ref);
5 | return x.current;
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-type-provider-hook-name-not-typed-as-hook.js:
--------------------------------------------------------------------------------
1 | import {useHookNotTypedAsHook} from 'ReactCompilerTest';
2 |
3 | function Component() {
4 | return useHookNotTypedAsHook();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.modify-useReducer-state.js:
--------------------------------------------------------------------------------
1 | import {useReducer} from 'react';
2 |
3 | function Foo() {
4 | let [state, setState] = useReducer({foo: 1});
5 | state.foo = 1;
6 | return state;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-jsxtext-stringliteral-distinction.js:
--------------------------------------------------------------------------------
1 | function Foo() {
2 | return {', '}
;
3 | }
4 |
5 | export const FIXTURE_ENTRYPOINT = {
6 | fn: Foo,
7 | params: [{}],
8 | };
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-from-property-of-other-hook.js:
--------------------------------------------------------------------------------
1 | function useFoo({data}) {
2 | const player = useVideoPlayer();
3 | const foo = player.useMedia();
4 | return foo;
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-if-alternate.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = null;
3 | if (props.cond) {
4 | } else {
5 | x = useHook();
6 | }
7 | return x;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-c5d1f3143c4c.js:
--------------------------------------------------------------------------------
1 | // Regression test for incorrectly flagged valid code.
2 | function RegressionTest() {
3 | const foo = cond ? a : b;
4 | useState();
5 | }
6 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/todo.invalid.invalid-rules-of-hooks-e69ffce323c3.js:
--------------------------------------------------------------------------------
1 | // @skip
2 | // Passed but should have failed
3 |
4 | (class {
5 | useHook = () => {
6 | useState();
7 | };
8 | });
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-array-destructuring.js:
--------------------------------------------------------------------------------
1 | // @lowerContextAccess
2 | function App() {
3 | const [foo, bar] = useContext(MyContext);
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react/npm/jsx-runtime.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-jsx-runtime.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-jsx-runtime.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "npm"
4 | directories:
5 | - "/fixtures/*"
6 | schedule:
7 | interval: "monthly"
8 | open-pull-requests-limit: 0
9 | ignore:
10 | - dependency-name: "*"
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/capturing-func-alias-receiver-mutate.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = { a };
3 | let y = {};
4 | (function () {
5 | let a = y;
6 | a.x = x;
7 | })();
8 | mutate(y);
9 | return y;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/for-of-conditional-break.js:
--------------------------------------------------------------------------------
1 | function Component() {
2 | const x = [];
3 | for (const item of [1, 2]) {
4 | if (item === 1) {
5 | break;
6 | }
7 | x.push(item);
8 | }
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/independently-memoize-object-property.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c) {
2 | const x = { a: a };
3 | // NOTE: this array should memoize independently from x, w only b,c as deps
4 | x.y = [b, c];
5 |
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/sketchy-code-rules-of-hooks.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable react-hooks/rules-of-hooks */
2 | function lowercasecomponent() {
3 | const x = [];
4 | return {x}
;
5 | }
6 | /* eslint-enable react-hooks/rules-of-hooks */
7 |
--------------------------------------------------------------------------------
/compiler/crates/react_hermes_parser/tests/fixtures/unused-logical-assigned-to-variable.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | // unused!
3 | const obj = makeObject();
4 | const obj2 = makeObject();
5 | const _ = (obj.a ?? obj2.b) || props.c;
6 | return null;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-nested-member-path-mutate.js:
--------------------------------------------------------------------------------
1 | function component() {
2 | let z = [];
3 | let y = {};
4 | y.z = z;
5 | let x = {};
6 | x.y = y;
7 | mutate(x.y.z);
8 | return x;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-join.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = [{}, [], props.value];
3 | const y = x.join(() => 'this closure gets stringified, not called');
4 | foo(y);
5 | return [x, y];
6 | }
7 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-reference-changes-type.js:
--------------------------------------------------------------------------------
1 | function component(a) {
2 | let x = {a};
3 | let y = 1;
4 | (function () {
5 | y = x;
6 | })();
7 | mutate(y);
8 | return y;
9 | }
10 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.conditional-hook-unknown-hook-react-namespace.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | let x = null;
3 | if (props.cond) {
4 | x = React.useNonexistentHook();
5 | }
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-delete-computed-property-of-frozen-value.js:
--------------------------------------------------------------------------------
1 | function Component(props) {
2 | const x = makeObject();
3 | // freeze
4 | {x}
;
5 | delete x[y];
6 | return x;
7 | }
8 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/obj-literal-cached-in-if-else.js:
--------------------------------------------------------------------------------
1 | function foo(a, b, c, d) {
2 | let x = {};
3 | if (someVal) {
4 | x = {b};
5 | } else {
6 | x = {c};
7 | }
8 |
9 | return x;
10 | }
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep.js:
--------------------------------------------------------------------------------
1 | function VideoTab() {
2 | const ref = useRef();
3 | let x = () => {
4 | console.log(ref.current);
5 | };
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-write-not-added-to-dep.js:
--------------------------------------------------------------------------------
1 | function VideoTab() {
2 | const ref = useRef();
3 | let x = () => {
4 | ref.current = 1;
5 | };
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-simple.js:
--------------------------------------------------------------------------------
1 | function foo() {
2 | let x = 1;
3 | let y = 2;
4 | }
5 |
6 | export const FIXTURE_ENTRYPOINT = {
7 | fn: foo,
8 | params: [],
9 | isComponent: false,
10 | };
11 |
--------------------------------------------------------------------------------
/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-no-memo-module-scope-usememo-function-scope.js:
--------------------------------------------------------------------------------
1 | // @compilationMode(all)
2 | 'use no memo';
3 |
4 | function TestComponent({x}) {
5 | 'use memo';
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-client/npm/flight.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-client-flight.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-client-flight.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-debug-tools/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-debug-tools.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-debug-tools.development.js');
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-reconciler/npm/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | if (process.env.NODE_ENV === 'production') {
4 | module.exports = require('./cjs/react-reconciler.production.js');
5 | } else {
6 | module.exports = require('./cjs/react-reconciler.development.js');
7 | }
8 |
--------------------------------------------------------------------------------