├── .nvmrc ├── .watchmanconfig ├── compiler ├── fixtures │ └── .gitkeep ├── scripts │ └── release │ │ ├── ci-npmrc │ │ └── shared │ │ └── packages.js ├── 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 │ │ │ ├── compilationMode-infer-output.txt │ │ │ ├── module-scope-use-no-memo-output.txt │ │ │ ├── todo-function-scope-does-not-beat-module-scope-output.txt │ │ │ └── use-no-memo-output.txt │ │ ├── next-env.d.ts │ │ ├── vercel.json │ │ └── hooks │ │ └── index.ts └── 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-hook-for.js │ │ ├── rules-of-hooks-485bf041f55f.js │ │ ├── rules-of-hooks-e5dd6caf4084.js │ │ ├── rules-of-hooks-0e2214abc294.js │ │ ├── todo.invalid.invalid-rules-of-hooks-acb56658fe7e.js │ │ ├── todo.invalid.invalid-rules-of-hooks-f6f37b63b2d4 │ │ ├── rules-of-hooks-33a6e23edac1.js │ │ ├── rules-of-hooks-dfde14171fcd.js │ │ ├── todo.bail.rules-of-hooks-279ac76f53af.js │ │ ├── error.invalid-dynamic-hook-via-hooklike-local.js │ │ ├── rules-of-hooks-2bec02ac982b.js │ │ ├── todo.invalid.invalid-rules-of-hooks-8303403b8e4c.js │ │ ├── rules-of-hooks-8f1c2c3f71c9.js │ │ └── rules-of-hooks-eacfcaa6ef89.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 │ │ ├── error.codegen-error-on-conflicting-imports.js │ │ ├── error.function-expression-references-variable-its-assigned-to.js │ │ ├── error.invalid-access-ref-during-render.js │ │ ├── error.invalid-prop-mutation-indirect.js │ │ ├── error.invalid-type-provider-nonhook-name-typed-as-hook.js │ │ ├── ref-current-optional-field-no-added-to-dep.js │ │ ├── constant-propagation-into-function-expressions.js │ │ ├── optional-call.js │ │ ├── rest-param-with-identifier.js │ │ ├── simple-alias.js │ │ ├── ssa-property-alias-mutate.js │ │ ├── ssa-property-mutate-alias.js │ │ ├── temporary-property-load-accessed-outside-scope.js │ │ ├── type-test-return-type-inference.js │ │ ├── capturing-func-alias-mutate.js │ │ ├── capturing-func-simple-alias.js │ │ ├── capturing-function-renamed-ref.js │ │ ├── dce-unused-const.js │ │ ├── error.declare-reassign-variable-in-function-declaration.js │ │ ├── error.handle-unexpected-exception-pipeline.ts │ │ ├── error.invalid-set-and-read-ref-during-render.js │ │ ├── lower-context-acess-multiple.js │ │ ├── rest-param-with-array-pattern.js │ │ ├── ssa-reassign-in-rval.js │ │ ├── use-callback-simple.js │ │ ├── call.js │ │ ├── default-param-with-reorderable-callback.js │ │ ├── error.invalid-disallow-mutating-ref-in-render.js │ │ ├── error.invalid-read-ref-prop-in-render-destructure.js │ │ ├── error.invalid-type-provider-hook-name-not-typed-as-hook-namespace.js │ │ ├── error.modify-state-2.js │ │ ├── error.reassignment-to-global-indirect.js │ │ ├── infer-skip-components-without-hooks-or-jsx.js │ │ ├── memoize-value-block-value-sequence.js │ │ ├── obj-literal-mutated-after-if-else.js │ │ ├── primitive-alias-mutate.js │ │ ├── ref-current-not-added-to-dep-2.js │ │ ├── repro-object-pattern.js │ │ ├── sequence-expression.js │ │ ├── simple-scope.js │ │ ├── transitive-alias-fields.js │ │ ├── expression-with-assignment.js │ │ ├── hooks-with-React-namespace.js │ │ ├── infer-function-expression-React-memo-gating.js │ │ ├── obj-mutated-after-if-else.js │ │ ├── optional-method-call.js │ │ ├── rest-param-with-object-spread-pattern.js │ │ ├── todo.lower-context-access-nested-destructuring.js │ │ ├── unused-logical-assigned-to-variable.js │ │ ├── capturing-func-alias-computed-mutate.js │ │ ├── change-detect-reassign.js │ │ ├── do-while-conditional-break.js │ │ ├── error.invalid-mutate-props-via-for-of-iterator.js │ │ ├── error.invalid-mutation-in-closure.js │ │ ├── error.invalid-read-ref-prop-in-render-property-load.js │ │ ├── error.invalid-write-ref-prop-in-render.js │ │ ├── memoize-value-block-value-logical.js │ │ ├── optional-receiver-method-call.js │ │ ├── ssa-call-jsx.js │ │ ├── call-with-independently-memoizable-arg.js │ │ ├── constructor.js │ │ ├── destructuring-array-param-default.js │ │ ├── destructuring-object-param-default.js │ │ ├── error.invalid-conditional-call-aliased-react-hook.js │ │ ├── error.invalid-jsx-in-try-with-catch.js │ │ ├── error.todo-function-expression-references-later-variable-declaration.js │ │ ├── memoize-value-block-value-conditional.js │ │ ├── memoize-value-block-value-logical-no-sequence.js │ │ ├── nested-optional-member-expr.js │ │ ├── propagate-scope-deps-hir-fork │ │ └── reactive-dependencies-non-optional-properties-inside-optional-chain.js │ │ ├── useEffect-method-call.js │ │ ├── const-propagation-into-function-expression-global.js │ │ ├── dce-unused-postfix-update.js │ │ ├── dce-unused-prefix-update.js │ │ ├── destructure-param-string-literal-key.js │ │ ├── holey-array-pattern-dce.js │ │ ├── hook-declaration-basic.flow.js │ │ ├── property-assignment.js │ │ ├── reactivity-analysis-reactive-via-mutation-of-property-load.js │ │ ├── ssa-property-alias-mutate-if.js │ │ ├── ssa-property.js │ │ ├── ssa-throw.js │ │ ├── target-flag.js │ │ ├── type-field-load.js │ │ ├── type-test-primitive.js │ │ ├── useState-pruned-dependency-change-detect.js │ │ ├── while-break.js │ │ ├── alias-capture-in-method-receiver.js │ │ ├── capturing-func-alias-receiver-mutate.js │ │ ├── codegen-emit-make-read-only.js │ │ ├── destructure-string-literal-property-key.js │ │ ├── error.invalid-mutate-after-freeze.js │ │ ├── error.todo-logical-expression-within-try-catch.js │ │ ├── error.update-global-should-bailout.tsx │ │ ├── expression-with-assignment-dynamic.js │ │ ├── holey-array-pattern-dce-2.js │ │ ├── infer-functions-component-with-ref-arg.js │ │ ├── multi-directive.js │ │ ├── optional-receiver-optional-method.js │ │ ├── ref-current-aliased-not-added-to-dep-2.js │ │ ├── switch-global-propertyload-case-test.js │ │ ├── temporary-at-start-of-value-block.js │ │ ├── todo.lower-context-access-mixed-array-obj.js │ │ ├── todo.lower-context-access-property-load.js │ │ ├── unused-object-element.js │ │ ├── destructure-default-array-with-unary.js │ │ ├── error.todo-hoisted-function-in-unreachable-code.js │ │ ├── error.todo-invalid-jsx-in-try-with-finally.js │ │ ├── ignore-inner-interface-types.ts │ │ ├── lambda-mutate-shadowed-object.js │ │ ├── reactivity-analysis-reactive-via-mutation-of-computed-load.js │ │ ├── recursive-function.js │ │ ├── ssa-return.js │ │ ├── ssa-shadowing.js │ │ ├── template-literal.js │ │ ├── todo.lower-context-access-destructure-multiple.js │ │ └── useMemo-if-else-multiple-return.js │ ├── react-compiler-healthcheck │ └── src │ │ └── config.ts │ └── react-compiler-runtime │ └── README.md ├── .gitattributes ├── fixtures ├── art │ ├── .gitignore │ ├── README.md │ └── app.js ├── flight │ ├── .nvmrc │ ├── src │ │ ├── cjs │ │ │ ├── package.json │ │ │ ├── Counter3.js │ │ │ └── Note.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 │ │ │ └── yarn.lock │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── yarn.lock │ ├── webpack │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ ├── package.json │ │ │ └── config.js │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ └── package.json │ ├── browserify │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ └── input.js │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ └── input.js │ ├── webpack-alias │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ └── package.json │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ └── package.json │ ├── systemjs-builder │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ └── package.json │ │ └── prod │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── input.js │ │ │ └── package.json │ └── 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 │ │ ├── legacy │ │ │ └── package.json │ │ └── modern │ │ │ └── package.json │ └── .env ├── fiber-debugger │ ├── .env │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── index.js │ │ └── index.css │ └── .gitignore ├── devtools │ └── scheduling-profiler │ │ └── .gitignore ├── eslint │ ├── proxy │ │ └── package.json │ ├── watch.sh │ └── package.json ├── dom │ └── public │ │ ├── test.mp4 │ │ └── favicon.ico ├── flight-parcel │ └── .gitignore ├── ssr │ └── public │ │ └── favicon.ico ├── view-transition │ ├── public │ │ └── favicon.ico │ └── src │ │ └── components │ │ ├── Chrome.css │ │ └── Page.css ├── attribute-behavior │ ├── public │ │ └── favicon.ico │ └── src │ │ ├── index.css │ │ ├── index.js │ │ └── App.test.js ├── legacy-jsx-runtimes │ ├── react-15 │ │ ├── package.json │ │ ├── jsx-runtime.js │ │ └── jsx-dev-runtime.js │ ├── react-14 │ │ ├── package.json │ │ ├── jsx-runtime.js │ │ └── jsx-dev-runtime.js │ ├── react-16 │ │ ├── package.json │ │ ├── jsx-runtime.js │ │ └── jsx-dev-runtime.js │ └── react-17 │ │ ├── package.json │ │ ├── jsx-runtime.js │ │ └── jsx-dev-runtime.js ├── 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 │ └── package.json ├── 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 ├── print-warnings │ └── README.md └── git │ └── pre-commit ├── 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 │ │ ├── client.node.js │ │ └── client.browser.js │ ├── README.md │ └── client.js ├── 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 │ └── src │ │ └── hookNames.js ├── react-devtools-shared │ ├── src │ │ ├── __tests__ │ │ │ └── __mocks__ │ │ │ │ └── cssMock.js │ │ ├── devtools │ │ │ └── views │ │ │ │ ├── Profiler │ │ │ │ ├── RootSelector.css │ │ │ │ ├── CommitRanked.css │ │ │ │ └── CommitFlamegraph.css │ │ │ │ ├── Components │ │ │ │ ├── InspectedElementErrorBoundary.css │ │ │ │ ├── LoadingAnimation.css │ │ │ │ ├── NativeStyleEditor │ │ │ │ │ └── index.css │ │ │ │ ├── InspectedElementStyleXPlugin.css │ │ │ │ ├── constants.js │ │ │ │ ├── KeyValueContextMenuContainer.css │ │ │ │ ├── InspectedElementBadges.css │ │ │ │ ├── ExpandCollapseToggle.css │ │ │ │ ├── EditableName.css │ │ │ │ └── NewKeyValue.css │ │ │ │ ├── Icon.css │ │ │ │ ├── ButtonIcon.css │ │ │ │ ├── ReactLogo.css │ │ │ │ └── WarnIfLegacyBackendDetected.css │ │ └── hooks │ │ │ └── __tests__ │ │ │ └── __source__ │ │ │ └── __untransformed__ │ │ │ └── README.md │ └── README.md ├── 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 │ │ ├── test-utils.js │ │ └── react-dom.react-server.js │ ├── server.js │ ├── static.js │ └── unstable_testing.js ├── jest-react │ ├── README.md │ ├── npm │ │ └── index.js │ └── index.js ├── shared │ └── package.json ├── react-server-dom-parcel │ ├── npm │ │ ├── client.js │ │ ├── server.js │ │ ├── static.js │ │ ├── client.edge.js │ │ └── client.node.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 │ │ ├── 128-deadcode.png │ │ ├── 128-disabled.png │ │ ├── 128-outdated.png │ │ ├── 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-development.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 │ ├── edge │ │ ├── now.json │ │ └── deploy.js │ ├── chrome │ │ ├── now.json │ │ └── deploy.js │ ├── firefox │ │ ├── now.json │ │ └── deploy.js │ ├── main.html │ └── src │ │ └── main │ │ └── debounce.js ├── react-devtools-timeline │ └── src │ │ └── CanvasPage.css ├── react-devtools-shell │ ├── constants.js │ └── src │ │ └── app │ │ ├── InspectableElements │ │ └── UseMemoCache.js │ │ └── ToDoList │ │ └── List.css ├── react-noop-renderer │ ├── README.md │ ├── npm │ │ ├── index.js │ │ ├── server.js │ │ ├── persistent.js │ │ ├── flight-client.js │ │ └── flight-server.js │ └── index.js ├── react │ └── npm │ │ ├── index.js │ │ ├── jsx-runtime.js │ │ ├── jsx-dev-runtime.js │ │ ├── react.react-server.js │ │ ├── unstable-cache.js │ │ ├── jsx-runtime.react-server.js │ │ └── jsx-dev-runtime.react-server.js ├── react-reconciler │ ├── src │ │ └── __tests__ │ │ │ └── __snapshots__ │ │ │ └── ReactHooks-test.internal.js.snap │ └── npm │ │ ├── index.js │ │ ├── constants.js │ │ └── reflection.js ├── react-art │ ├── npm │ │ └── index.js │ ├── index.js │ ├── Circle.js │ ├── Wedge.js │ └── Rectangle.js ├── react-is │ └── npm │ │ └── index.js ├── scheduler │ └── npm │ │ ├── index.js │ │ ├── index.native.js │ │ ├── unstable_mock.js │ │ └── unstable_post_task.js ├── eslint-plugin-react-hooks │ ├── tsup.config.ts │ ├── src │ │ └── types │ │ │ └── global.d.ts │ └── index.js ├── react-cache │ └── npm │ │ └── index.js ├── react-markup │ ├── npm │ │ ├── index.js │ │ └── react-markup.react-server.js │ └── index.js ├── react-server │ └── npm │ │ ├── index.js │ │ └── flight.js ├── react-client │ ├── npm │ │ └── flight.js │ ├── README.md │ └── flight.js ├── react-debug-tools │ ├── npm │ │ └── index.js │ ├── index.js │ └── README.md ├── react-refresh │ ├── npm │ │ ├── babel.js │ │ └── runtime.js │ ├── runtime.js │ └── babel.js ├── use-subscription │ └── npm │ │ └── index.js ├── react-test-renderer │ └── npm │ │ ├── index.js │ │ └── shallow.js └── use-sync-external-store │ ├── npm │ ├── index.js │ └── shim │ │ └── index.js │ └── README.md ├── .git-blame-ignore-revs ├── CONTRIBUTING.md ├── netlify.toml ├── .github └── dependabot.yml └── .editorconfig /.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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/dom/public/test.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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/tedi4t/react/HEAD/fixtures/dom/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/ssr/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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 | -------------------------------------------------------------------------------- /fixtures/flight/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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 | -------------------------------------------------------------------------------- /fixtures/flight-esm/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/fixtures/flight-esm/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/fiber-debugger/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/fixtures/fiber-debugger/public/favicon.ico -------------------------------------------------------------------------------- /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/tedi4t/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/tedi4t/react/HEAD/compiler/apps/playground/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/view-transition/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/fixtures/view-transition/public/favicon.ico -------------------------------------------------------------------------------- /fixtures/view-transition/src/components/Chrome.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 10px; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /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/bench/benchmarks/hacker-news/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/scripts/bench/benchmarks/hacker-news/logo.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /fixtures/attribute-behavior/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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 | -------------------------------------------------------------------------------- /compiler/apps/playground/public/graphvizlib.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/compiler/apps/playground/public/graphvizlib.wasm -------------------------------------------------------------------------------- /compiler/apps/playground/public/icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/compiler/apps/playground/public/icon-180x180.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /scripts/bench/benchmarks/hacker-news/grayarrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/scripts/bench/benchmarks/hacker-news/grayarrow.gif -------------------------------------------------------------------------------- /fixtures/concurrent/time-slicing/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/128-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-outdated.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-deadcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/48-deadcode.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/48-disabled.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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/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-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-restricted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-restricted.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/128-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/128-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-restricted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-restricted.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/16-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/16-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-restricted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-restricted.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/32-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/32-unminified.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-development.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/48-development.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/48-production.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-restricted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/packages/react-devtools-extensions/icons/48-restricted.png -------------------------------------------------------------------------------- /packages/react-devtools-extensions/icons/48-unminified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/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/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-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/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/compilationMode-infer-output.txt: -------------------------------------------------------------------------------- 1 | // @compilationMode(infer) 2 | function nonReactFn() { 3 |   return {}; 4 | } -------------------------------------------------------------------------------- /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-devtools-shared/src/devtools/views/Components/NativeStyleEditor/index.css: -------------------------------------------------------------------------------- 1 | .Stack > *:not(:first-child) { 2 | border-top: 1px solid var(--color-border); 3 | } 4 | -------------------------------------------------------------------------------- /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/apps/playground/public/fonts/Source-Code-Pro-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedi4t/react/HEAD/compiler/apps/playground/public/fonts/Source-Code-Pro-Regular.woff2 -------------------------------------------------------------------------------- /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/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/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/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/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/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/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/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/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/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/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/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/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 | -------------------------------------------------------------------------------- /fixtures/view-transition/src/components/Page.css: -------------------------------------------------------------------------------- 1 | .roboto-font { 2 | font-family: "Roboto", serif; 3 | font-optical-sizing: auto; 4 | font-weight: 100; 5 | font-style: normal; 6 | font-variation-settings: 7 | "wdth" 100; 8 | } 9 | -------------------------------------------------------------------------------- /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/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

0

bye

"`; 4 | -------------------------------------------------------------------------------- /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/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/eslint-plugin-react-hooks/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from 'tsup'; 2 | 3 | export default defineConfig({ 4 | clean: true, 5 | dts: true, 6 | entry: ['src/index.ts'], 7 | format: ['cjs'], 8 | outDir: 'build', 9 | }); 10 | -------------------------------------------------------------------------------- /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/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/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/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/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/eslint-plugin-react-hooks/src/types/global.d.ts: -------------------------------------------------------------------------------- 1 | // In order to support the __EXPERIMENTAL__ global in TypeScript, 2 | // we need to declare it here. The value of this is set in both 3 | // the jest setup and CI build 4 | declare const __EXPERIMENTAL__: boolean; 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /packages/react-refresh/npm/babel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-refresh-babel.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-refresh-babel.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-server/npm/flight.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-server-flight.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-server-flight.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/scheduler/npm/index.native.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/scheduler.native.production.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler.native.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/use-subscription/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/use-subscription.production.js'); 5 | } else { 6 | module.exports = require('./cjs/use-subscription.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.function-expression-references-variable-its-assigned-to.js: -------------------------------------------------------------------------------- 1 | function Component() { 2 | let callback = () => { 3 | callback = null; 4 | }; 5 | return
; 6 | } 7 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-access-ref-during-render.js: -------------------------------------------------------------------------------- 1 | // @validateRefAccessDuringRender 2 | function Component(props) { 3 | const ref = useRef(null); 4 | const value = ref.current; 5 | return value; 6 | } 7 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-prop-mutation-indirect.js: -------------------------------------------------------------------------------- 1 | function Component(props) { 2 | const f = () => { 3 | props.value = true; 4 | }; 5 | const g = () => { 6 | f(); 7 | }; 8 | g(); 9 | } 10 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-type-provider-nonhook-name-typed-as-hook.js: -------------------------------------------------------------------------------- 1 | import {notAhookTypedAsHook} from 'ReactCompilerTest'; 2 | 3 | function Component() { 4 | return
{notAhookTypedAsHook()}
; 5 | } 6 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/error.invalid-hook-for.js: -------------------------------------------------------------------------------- 1 | function Component(props) { 2 | let i = 0; 3 | for (let x = 0; useHook(x) < 10; useHook(i), x++) { 4 | i += useHook(x); 5 | } 6 | return i; 7 | } 8 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-485bf041f55f.js: -------------------------------------------------------------------------------- 1 | // Valid because functions can call functions. 2 | function functionThatStartsWithUseButIsntAHook() { 3 | if (cond) { 4 | userFetch(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /fixtures/attribute-behavior/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | }); 9 | -------------------------------------------------------------------------------- /fixtures/fiber-debugger/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | npm-debug.log 15 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack/dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "webpack-dev-fixture", 4 | "dependencies": { 5 | "webpack": "^1.14.0" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && webpack --config config.js" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack/prod/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "webpack-prod-fixture", 4 | "dependencies": { 5 | "webpack": "^1.14.0" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && webpack --config config.js" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.css: -------------------------------------------------------------------------------- 1 | .Container { 2 | width: 100%; 3 | flex: 1; 4 | padding: 0.5rem; 5 | } 6 | 7 | .PatternPath { 8 | stroke: var(--color-commit-did-not-render-pattern); 9 | stroke-width: 1; 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-dom/npm/test-utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-dom-test-utils.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-dom-test-utils.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-noop-renderer/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-noop-renderer.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-noop-renderer.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-refresh/npm/runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-refresh-runtime.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-refresh-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react-test-renderer/npm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-test-renderer.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-test-renderer.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/npm/jsx-dev-runtime.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-jsx-dev-runtime.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-jsx-dev-runtime.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/npm/react.react-server.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react.react-server.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react.react-server.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /packages/react/npm/unstable-cache.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/react-unstable-cache.production.js'); 5 | } else { 6 | module.exports = require('./cjs/react-unstable-cache.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /compiler/apps/playground/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. 6 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-identifier.js: -------------------------------------------------------------------------------- 1 | function Component(foo, ...bar) { 2 | return [foo, bar]; 3 | } 4 | 5 | export const FIXTURE_ENTRYPOINT = { 6 | fn: Component, 7 | params: ['foo', 'bar', 'baz'], 8 | }; 9 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-e5dd6caf4084.js: -------------------------------------------------------------------------------- 1 | // Valid because functions can call functions. 2 | function normalFunctionWithConditionalFunction() { 3 | if (cond) { 4 | doSomething(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/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 | -------------------------------------------------------------------------------- /fixtures/flight/src/cjs/Note.js: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | var React = require('react'); 4 | 5 | function Note() { 6 | return 'This component was exported on a commonJS module and imported into ESM as a named import.'; 7 | } 8 | 9 | module.exports = { 10 | Note, 11 | }; 12 | -------------------------------------------------------------------------------- /fixtures/nesting/src/legacy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-nesting-example-legacy", 4 | "dependencies": { 5 | "react": "16.8", 6 | "react-dom": "16.8", 7 | "react-redux": "4.4.10", 8 | "react-router-dom": "5.2.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "systemjs-dev-fixture", 4 | "dependencies": { 5 | "systemjs-builder": "^0.15.34" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && node build.js" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-devtools-shared/README.md: -------------------------------------------------------------------------------- 1 | This directory contains code shared between several DevTools packages: 2 | * /packages/react-devtools-core 3 | * /packages/react-devtools-extensions 4 | * /packages/react-devtools-inline 5 | 6 | It is not published or released anywhere directly. -------------------------------------------------------------------------------- /packages/react-devtools-shell/src/app/InspectableElements/UseMemoCache.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {c as useMemoCache} from 'react/compiler-runtime'; 3 | 4 | export default function UseMemoCache(): React.Node { 5 | useMemoCache(1); 6 | 7 | return null; 8 | } 9 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.js: -------------------------------------------------------------------------------- 1 | function component(a) { 2 | let x = {a}; 3 | let y = {}; 4 | const f0 = function () { 5 | y.x = x; 6 | }; 7 | f0(); 8 | mutate(y); 9 | return y; 10 | } 11 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.js: -------------------------------------------------------------------------------- 1 | function component(a) { 2 | let x = {a}; 3 | let y = {}; 4 | const f0 = function () { 5 | y = x; 6 | }; 7 | f0(); 8 | mutate(y); 9 | return y; 10 | } 11 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dce-unused-const.js: -------------------------------------------------------------------------------- 1 | function Component(props) { 2 | const _ = 42; 3 | return props.value; 4 | } 5 | 6 | export const FIXTURE_ENTRYPOINT = { 7 | fn: Component, 8 | params: [{value: 42}], 9 | }; 10 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.handle-unexpected-exception-pipeline.ts: -------------------------------------------------------------------------------- 1 | // @throwUnknownException__testonly:true 2 | 3 | function Component() {} 4 | 5 | export const FIXTURE_ENTRYPOINT = { 6 | fn: Component, 7 | params: [], 8 | }; 9 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-set-and-read-ref-during-render.js: -------------------------------------------------------------------------------- 1 | // @validateRefAccessDuringRender 2 | function Component(props) { 3 | const ref = useRef(null); 4 | ref.current = props.value; 5 | return ref.current; 6 | } 7 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-acess-multiple.js: -------------------------------------------------------------------------------- 1 | // @lowerContextAccess 2 | function App() { 3 | const {foo} = useContext(MyContext); 4 | const {bar} = useContext(MyContext); 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.js: -------------------------------------------------------------------------------- 1 | function Component(foo, ...[bar]) { 2 | return [foo, bar]; 3 | } 4 | 5 | export const FIXTURE_ENTRYPOINT = { 6 | fn: Component, 7 | params: ['foo', ['bar', 'baz']], 8 | }; 9 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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 | -------------------------------------------------------------------------------- /fixtures/packaging/systemjs-builder/prod/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "systemjs-prod-fixture", 4 | "dependencies": { 5 | "systemjs-builder": "^0.15.34" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && node build.js" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack-alias/dev/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "webpack-alias-dev-fixture", 4 | "dependencies": { 5 | "webpack": "^1.14.0" 6 | }, 7 | "scripts": { 8 | "build": "rm -f output.js && webpack --config config.js" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/packaging/webpack/dev/config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | entry: './input', 5 | output: { 6 | filename: 'output.js', 7 | }, 8 | resolve: { 9 | root: path.resolve('../../../../build/oss-experimental/'), 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/scheduler/npm/unstable_mock.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (process.env.NODE_ENV === 'production') { 4 | module.exports = require('./cjs/scheduler-unstable_mock.production.js'); 5 | } else { 6 | module.exports = require('./cjs/scheduler-unstable_mock.development.js'); 7 | } 8 | -------------------------------------------------------------------------------- /compiler/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/use-no-memo-output.txt: -------------------------------------------------------------------------------- 1 | const TestComponent = function () { 2 | "use no memo"; 3 | return ; 4 | }; 5 | const TestComponent2 = ({ x }) => { 6 | "use no memo"; 7 | return ; 8 | }; 9 | -------------------------------------------------------------------------------- /compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/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/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/default-param-with-reorderable-callback.js: -------------------------------------------------------------------------------- 1 | function Component(x = () => [-1, true, 42.0, 'hello']) { 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/error.invalid-disallow-mutating-ref-in-render.js: -------------------------------------------------------------------------------- 1 | // @validateRefAccessDuringRender 2 | function Component() { 3 | const ref = useRef(null); 4 | ref.current = false; 5 | 6 | return